aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8/tools/GUIEditor/CGUIBoolAttribute.h
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/irrlicht-1.8/tools/GUIEditor/CGUIBoolAttribute.h')
-rw-r--r--libraries/irrlicht-1.8/tools/GUIEditor/CGUIBoolAttribute.h136
1 files changed, 68 insertions, 68 deletions
diff --git a/libraries/irrlicht-1.8/tools/GUIEditor/CGUIBoolAttribute.h b/libraries/irrlicht-1.8/tools/GUIEditor/CGUIBoolAttribute.h
index b0521db..189bd2d 100644
--- a/libraries/irrlicht-1.8/tools/GUIEditor/CGUIBoolAttribute.h
+++ b/libraries/irrlicht-1.8/tools/GUIEditor/CGUIBoolAttribute.h
@@ -1,68 +1,68 @@
1#ifndef __C_GUI_BOOL_ATTRIBUTE_H_INCLUDED__ 1#ifndef __C_GUI_BOOL_ATTRIBUTE_H_INCLUDED__
2#define __C_GUI_BOOL_ATTRIBUTE_H_INCLUDED__ 2#define __C_GUI_BOOL_ATTRIBUTE_H_INCLUDED__
3 3
4#include "CGUIAttribute.h" 4#include "CGUIAttribute.h"
5#include "IGUICheckBox.h" 5#include "IGUICheckBox.h"
6#include "EGUIEditTypes.h" 6#include "EGUIEditTypes.h"
7 7
8namespace irr 8namespace irr
9{ 9{
10namespace gui 10namespace gui
11{ 11{
12 12
13 class CGUIBoolAttribute : public CGUIAttribute 13 class CGUIBoolAttribute : public CGUIAttribute
14 { 14 {
15 public: 15 public:
16 // 16 //
17 CGUIBoolAttribute(IGUIEnvironment* environment, IGUIElement *parent, s32 myParentID) : 17 CGUIBoolAttribute(IGUIEnvironment* environment, IGUIElement *parent, s32 myParentID) :
18 CGUIAttribute(environment, parent, myParentID), AttribCheckBox(0) 18 CGUIAttribute(environment, parent, myParentID), AttribCheckBox(0)
19 { 19 {
20 20
21 core::rect<s32> r = getAbsolutePosition(); 21 core::rect<s32> r = getAbsolutePosition();
22 core::rect<s32> r2(0, Environment->getSkin()->getFont()->getDimension(L"A").Height + 10, 22 core::rect<s32> r2(0, Environment->getSkin()->getFont()->getDimension(L"A").Height + 10,
23 r.getWidth() - 5, 23 r.getWidth() - 5,
24 Environment->getSkin()->getFont()->getDimension(L"A").Height*2 + 15 ); 24 Environment->getSkin()->getFont()->getDimension(L"A").Height*2 + 15 );
25 25
26 AttribCheckBox = environment->addCheckBox(false, r2, this); 26 AttribCheckBox = environment->addCheckBox(false, r2, this);
27 AttribCheckBox->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT); 27 AttribCheckBox->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT);
28 AttribCheckBox->setSubElement(true); 28 AttribCheckBox->setSubElement(true);
29 AttribCheckBox->grab(); 29 AttribCheckBox->grab();
30 } 30 }
31 31
32 virtual ~CGUIBoolAttribute() 32 virtual ~CGUIBoolAttribute()
33 { 33 {
34 if (AttribCheckBox) 34 if (AttribCheckBox)
35 AttribCheckBox->drop(); 35 AttribCheckBox->drop();
36 } 36 }
37 37
38 virtual void setAttrib(io::IAttributes *attribs, u32 attribIndex) 38 virtual void setAttrib(io::IAttributes *attribs, u32 attribIndex)
39 { 39 {
40 AttribCheckBox->setChecked(attribs->getAttributeAsBool(attribIndex)); 40 AttribCheckBox->setChecked(attribs->getAttributeAsBool(attribIndex));
41 CGUIAttribute::setAttrib(attribs, attribIndex); 41 CGUIAttribute::setAttrib(attribs, attribIndex);
42 } 42 }
43 43
44 // save the attribute and possibly post the event to its parent 44 // save the attribute and possibly post the event to its parent
45 virtual bool updateAttrib(bool sendEvent=true) 45 virtual bool updateAttrib(bool sendEvent=true)
46 { 46 {
47 if (!Attribs) 47 if (!Attribs)
48 return true; 48 return true;
49 49
50 Attribs->setAttribute(Index, AttribCheckBox->isChecked()); 50 Attribs->setAttribute(Index, AttribCheckBox->isChecked());
51 51
52 return CGUIAttribute::updateAttrib(sendEvent); 52 return CGUIAttribute::updateAttrib(sendEvent);
53 } 53 }
54 54
55 //! Returns the type name of the gui element. 55 //! Returns the type name of the gui element.
56 virtual const c8* getTypeName() const 56 virtual const c8* getTypeName() const
57 { 57 {
58 return GUIEditElementTypeNames[EGUIEDIT_BOOLATTRIBUTE]; 58 return GUIEditElementTypeNames[EGUIEDIT_BOOLATTRIBUTE];
59 } 59 }
60 60
61 private: 61 private:
62 IGUICheckBox* AttribCheckBox; 62 IGUICheckBox* AttribCheckBox;
63 }; 63 };
64 64
65} // namespace gui 65} // namespace gui
66} // namespace irr 66} // namespace irr
67 67
68#endif 68#endif