My favorites | Sign in
Project Home Downloads Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef FORM_EDITOR_PROPERTIES__PROPERTY_H
#define FORM_EDITOR_PROPERTIES__PROPERTY_H

#include <FormEditorCommon/FormEditorCommon.h>
#include "PropertyEdits.h"

class Property : public IObserver
{
public:
Property() : _Edit(NULL), _Default(String()) {}
virtual ~Property() { if (_Edit) _Edit->Release(); }
virtual void OnUpdate(ISubject* s) { Set(Vector<Value>() << _Edit->GetData()); }

Property& SetCalls(Callback1<const Vector<Value>&> set,
Callback2<Value&, const Vector<Value>&> get);

Property& AddMetaInfo(const String& s, const Value& v){ _Meta.Add(s, v); return *this; }
Property& SetDefault(const Value& val) { _Default = val; return *this; }
Property& SetEdit(IEditCtrl* edit, bool notify);
Property& ToPane(Ctrl& c, int& cy, int space);

void RestoreDefault() { Set(Vector<Value>() << _Default); }
void Restore() { Set(Vector<Value>() << _Last); }
void Apply() { Set(Vector<Value>() << _Edit->GetData()); }
bool IsDefault() const;
bool IsChanged() const;
void Serialize(Stream& s) { s % _Last; }

Value GetLast() const { return _Last; }
Value GetDefault() const { return _Default; }
Value GetMetaInfo(const char* s) const { return _Meta.Get(String(s), Value()); }
String MetaString(const char* s) const { return _Meta.Get(String(s), Value()).ToString(); }

Callback1<const Vector<Value>&> Set;
Callback2<Value&, const Vector<Value>&> Get;

private:
Value _Last;
Value _Default;
IEditCtrl* _Edit;
VectorMap<String, Value> _Meta;
};

#endif

Change log

r4180 by Sc0rch on Nov 17, 2011   Diff
MapRender: First release
(FormEditorCommon, FormEditorProperties,
Map, MapBG, MapCommon, MapEditor,
MapRenderTest.
Go to: 
Project members, sign in to write a code review

Older revisions

All revisions of this file

File info

Size: 1526 bytes, 44 lines
Powered by Google Project Hosting