1 /*
2 	GWEN
3 	Copyright (c) 2010 Facepunch Studios
4 	See license in Gwen.h
5 */
6 
7 #pragma once
8 #ifndef GWEN_CONTROLS_PROPERTIES_H
9 #define GWEN_CONTROLS_PROPERTIES_H
10 
11 #include "Gwen/Controls/Base.h"
12 #include "Gwen/Controls/Label.h"
13 #include "Gwen/Controls/Property/BaseProperty.h"
14 #include "Gwen/Controls/Property/Text.h"
15 #include "Gwen/Controls/SplitterBar.h"
16 #include "Gwen/Gwen.h"
17 #include "Gwen/Skin.h"
18 
19 namespace Gwen
20 {
21 namespace Controls
22 {
23 class PropertyRow;
24 
25 class GWEN_EXPORT Properties : public Base
26 {
27 public:
28 	GWEN_CONTROL(Properties, Base);
29 
30 	virtual void PostLayout(Gwen::Skin::Base* skin);
31 
32 	PropertyRow* Add(const UnicodeString& text, const UnicodeString& value = L"");
33 	PropertyRow* Add(const String& text, const String& value = "");
34 	PropertyRow* Add(const UnicodeString& text, Property::Base* pProp);
35 	PropertyRow* Add(const String& text, Property::Base* pProp);
36 
37 	virtual int GetSplitWidth();
38 
39 	virtual void Clear();
40 
41 protected:
42 	virtual void OnSplitterMoved(Controls::Base* control);
43 
44 	Controls::SplitterBar* m_SplitterBar;
45 };
46 
47 class GWEN_EXPORT PropertyRow : public Base
48 {
49 public:
50 	GWEN_CONTROL(PropertyRow, Base);
51 
GetLabel()52 	virtual Label* GetLabel() { return m_Label; }
53 	virtual void SetProperty(Property::Base* prop);
GetProperty()54 	virtual Property::Base* GetProperty() { return m_Property; }
55 
56 	virtual void Layout(Gwen::Skin::Base* skin);
57 	virtual void Render(Gwen::Skin::Base* skin);
58 
59 	Event::Caller onChange;
60 
61 protected:
62 	void OnPropertyValueChanged(Gwen::Controls::Base* control);
63 
64 	Label* m_Label;
65 	Property::Base* m_Property;
66 };
67 }  // namespace Controls
68 }  // namespace Gwen
69 #endif
70