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
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "Property.h"

Property& Property::SetCalls(Callback1<const Vector<Value>&> set,
Callback2<Value&, const Vector<Value>&> get)
{
Set = set;
Get = get;
return *this;
}

Property& Property::SetEdit(IEditCtrl* edit, bool notify)
{
if (_Edit) _Edit->Release();
if (!edit) return *this;
_Edit = edit;
_Edit->Retain();
_Edit->SetNotify(notify);
_Edit->AttachObserver(this);
return *this;
}

Property& Property::ToPane(Ctrl& c, int& cy, int space)
{
Value v;
Get(v, Vector<Value>());
_Last = v;
if (!_Edit) { _Edit = new CEditField(); _Edit->Retain(); }
_Edit->SetLabel(MetaString("Name"));
_Edit->SetData(v);
_Edit->Set(c, cy);
cy += space;
return *this;
}

bool Property::IsDefault() const
{
Value v;
Get(v, Vector<Value>());
if ((v.GetType() == BOOL_V || v.GetType() == INT_V) &&
(_Default.GetType() == BOOL_V || _Default.GetType() == INT_V))
return _Default == v;
return _Default.ToString() == v.ToString();
}

bool Property::IsChanged() const
{
Value v;
Get(v, Vector<Value>());

bool changed = ((v.GetType() == BOOL_V || v.GetType() == INT_V) &&
(_Last.GetType() == BOOL_V || _Last.GetType() == INT_V))
? (_Last != v)
: (_Last.ToString() != v.ToString());
if (!changed && _Edit)
return v != _Edit->GetData();
return changed;
}

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: 1333 bytes, 57 lines
Powered by Google Project Hosting