diff options
author | David Walter Seikel | 2013-01-13 17:24:39 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-01-13 17:24:39 +1000 |
commit | 393b5cd1dc438872af89d334ef6e5fcc59f27d47 (patch) | |
tree | 6a14521219942a08a1b95cb2f5a923a9edd60f63 /libraries/irrlicht-1.8/tools/GUIEditor/CGUIBoolAttribute.h | |
parent | Add a note about rasters suggested start up code. (diff) | |
download | SledjHamr-393b5cd1dc438872af89d334ef6e5fcc59f27d47.zip SledjHamr-393b5cd1dc438872af89d334ef6e5fcc59f27d47.tar.gz SledjHamr-393b5cd1dc438872af89d334ef6e5fcc59f27d47.tar.bz2 SledjHamr-393b5cd1dc438872af89d334ef6e5fcc59f27d47.tar.xz |
Added Irrlicht 1.8, but without all the Windows binaries.
Diffstat (limited to '')
-rw-r--r-- | libraries/irrlicht-1.8/tools/GUIEditor/CGUIBoolAttribute.h | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/libraries/irrlicht-1.8/tools/GUIEditor/CGUIBoolAttribute.h b/libraries/irrlicht-1.8/tools/GUIEditor/CGUIBoolAttribute.h new file mode 100644 index 0000000..b0521db --- /dev/null +++ b/libraries/irrlicht-1.8/tools/GUIEditor/CGUIBoolAttribute.h | |||
@@ -0,0 +1,68 @@ | |||
1 | #ifndef __C_GUI_BOOL_ATTRIBUTE_H_INCLUDED__ | ||
2 | #define __C_GUI_BOOL_ATTRIBUTE_H_INCLUDED__ | ||
3 | |||
4 | #include "CGUIAttribute.h" | ||
5 | #include "IGUICheckBox.h" | ||
6 | #include "EGUIEditTypes.h" | ||
7 | |||
8 | namespace irr | ||
9 | { | ||
10 | namespace gui | ||
11 | { | ||
12 | |||
13 | class CGUIBoolAttribute : public CGUIAttribute | ||
14 | { | ||
15 | public: | ||
16 | // | ||
17 | CGUIBoolAttribute(IGUIEnvironment* environment, IGUIElement *parent, s32 myParentID) : | ||
18 | CGUIAttribute(environment, parent, myParentID), AttribCheckBox(0) | ||
19 | { | ||
20 | |||
21 | core::rect<s32> r = getAbsolutePosition(); | ||
22 | core::rect<s32> r2(0, Environment->getSkin()->getFont()->getDimension(L"A").Height + 10, | ||
23 | r.getWidth() - 5, | ||
24 | Environment->getSkin()->getFont()->getDimension(L"A").Height*2 + 15 ); | ||
25 | |||
26 | AttribCheckBox = environment->addCheckBox(false, r2, this); | ||
27 | AttribCheckBox->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT); | ||
28 | AttribCheckBox->setSubElement(true); | ||
29 | AttribCheckBox->grab(); | ||
30 | } | ||
31 | |||
32 | virtual ~CGUIBoolAttribute() | ||
33 | { | ||
34 | if (AttribCheckBox) | ||
35 | AttribCheckBox->drop(); | ||
36 | } | ||
37 | |||
38 | virtual void setAttrib(io::IAttributes *attribs, u32 attribIndex) | ||
39 | { | ||
40 | AttribCheckBox->setChecked(attribs->getAttributeAsBool(attribIndex)); | ||
41 | CGUIAttribute::setAttrib(attribs, attribIndex); | ||
42 | } | ||
43 | |||
44 | // save the attribute and possibly post the event to its parent | ||
45 | virtual bool updateAttrib(bool sendEvent=true) | ||
46 | { | ||
47 | if (!Attribs) | ||
48 | return true; | ||
49 | |||
50 | Attribs->setAttribute(Index, AttribCheckBox->isChecked()); | ||
51 | |||
52 | return CGUIAttribute::updateAttrib(sendEvent); | ||
53 | } | ||
54 | |||
55 | //! Returns the type name of the gui element. | ||
56 | virtual const c8* getTypeName() const | ||
57 | { | ||
58 | return GUIEditElementTypeNames[EGUIEDIT_BOOLATTRIBUTE]; | ||
59 | } | ||
60 | |||
61 | private: | ||
62 | IGUICheckBox* AttribCheckBox; | ||
63 | }; | ||
64 | |||
65 | } // namespace gui | ||
66 | } // namespace irr | ||
67 | |||
68 | #endif | ||