diff options
author | David Walter Seikel | 2013-01-13 18:54:10 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-01-13 18:54:10 +1000 |
commit | 959831f4ef5a3e797f576c3de08cd65032c997ad (patch) | |
tree | e7351908be5995f0b325b2ebeaa02d5a34b82583 /libraries/irrlicht-1.8/tools/GUIEditor/CGUIEnumAttribute.h | |
parent | Add info about changes to Irrlicht. (diff) | |
download | SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.zip SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.gz SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.bz2 SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.xz |
Remove damned ancient DOS line endings from Irrlicht. Hopefully I did not go overboard.
Diffstat (limited to 'libraries/irrlicht-1.8/tools/GUIEditor/CGUIEnumAttribute.h')
-rw-r--r-- | libraries/irrlicht-1.8/tools/GUIEditor/CGUIEnumAttribute.h | 228 |
1 files changed, 114 insertions, 114 deletions
diff --git a/libraries/irrlicht-1.8/tools/GUIEditor/CGUIEnumAttribute.h b/libraries/irrlicht-1.8/tools/GUIEditor/CGUIEnumAttribute.h index 9e3958d..31951e5 100644 --- a/libraries/irrlicht-1.8/tools/GUIEditor/CGUIEnumAttribute.h +++ b/libraries/irrlicht-1.8/tools/GUIEditor/CGUIEnumAttribute.h | |||
@@ -1,114 +1,114 @@ | |||
1 | #ifndef __C_GUI_ENUM_ATTRIBUTE_H_INCLUDED__ | 1 | #ifndef __C_GUI_ENUM_ATTRIBUTE_H_INCLUDED__ |
2 | #define __C_GUI_ENUM_ATTRIBUTE_H_INCLUDED__ | 2 | #define __C_GUI_ENUM_ATTRIBUTE_H_INCLUDED__ |
3 | 3 | ||
4 | #include "CGUIAttribute.h" | 4 | #include "CGUIAttribute.h" |
5 | #include "IGUIComboBox.h" | 5 | #include "IGUIComboBox.h" |
6 | #include "IGUIEditBox.h" | 6 | #include "IGUIEditBox.h" |
7 | #include "EGUIEditTypes.h" | 7 | #include "EGUIEditTypes.h" |
8 | 8 | ||
9 | namespace irr | 9 | namespace irr |
10 | { | 10 | { |
11 | namespace gui | 11 | namespace gui |
12 | { | 12 | { |
13 | 13 | ||
14 | class CGUIEnumAttribute : public CGUIAttribute | 14 | class CGUIEnumAttribute : public CGUIAttribute |
15 | { | 15 | { |
16 | public: | 16 | public: |
17 | // | 17 | // |
18 | CGUIEnumAttribute(IGUIEnvironment* environment, IGUIElement *parent, s32 myParentID) : | 18 | CGUIEnumAttribute(IGUIEnvironment* environment, IGUIElement *parent, s32 myParentID) : |
19 | CGUIAttribute(environment, parent, myParentID), | 19 | CGUIAttribute(environment, parent, myParentID), |
20 | AttribComboBox(0), AttribEditBox(0) | 20 | AttribComboBox(0), AttribEditBox(0) |
21 | { | 21 | { |
22 | 22 | ||
23 | } | 23 | } |
24 | 24 | ||
25 | virtual ~CGUIEnumAttribute() | 25 | virtual ~CGUIEnumAttribute() |
26 | { | 26 | { |
27 | if (AttribComboBox) | 27 | if (AttribComboBox) |
28 | AttribComboBox->drop(); | 28 | AttribComboBox->drop(); |
29 | if (AttribEditBox) | 29 | if (AttribEditBox) |
30 | AttribEditBox->drop(); | 30 | AttribEditBox->drop(); |
31 | } | 31 | } |
32 | 32 | ||
33 | // save the attribute and possibly post the event to its parent | 33 | // save the attribute and possibly post the event to its parent |
34 | virtual void setAttrib(io::IAttributes *attribs, u32 attribIndex) | 34 | virtual void setAttrib(io::IAttributes *attribs, u32 attribIndex) |
35 | { | 35 | { |
36 | 36 | ||
37 | if (AttribComboBox) | 37 | if (AttribComboBox) |
38 | { | 38 | { |
39 | AttribComboBox->remove(); | 39 | AttribComboBox->remove(); |
40 | AttribComboBox->drop(); | 40 | AttribComboBox->drop(); |
41 | AttribComboBox = 0; | 41 | AttribComboBox = 0; |
42 | } | 42 | } |
43 | 43 | ||
44 | if (AttribEditBox) | 44 | if (AttribEditBox) |
45 | { | 45 | { |
46 | AttribEditBox->remove(); | 46 | AttribEditBox->remove(); |
47 | AttribEditBox->drop(); | 47 | AttribEditBox->drop(); |
48 | AttribEditBox = 0; | 48 | AttribEditBox = 0; |
49 | } | 49 | } |
50 | 50 | ||
51 | core::array<core::stringc> outLiterals; | 51 | core::array<core::stringc> outLiterals; |
52 | attribs->getAttributeEnumerationLiteralsOfEnumeration(attribIndex, outLiterals); | 52 | attribs->getAttributeEnumerationLiteralsOfEnumeration(attribIndex, outLiterals); |
53 | 53 | ||
54 | core::rect<s32> r = getAbsolutePosition(); | 54 | core::rect<s32> r = getAbsolutePosition(); |
55 | core::rect<s32> r2(0, Environment->getSkin()->getFont()->getDimension(L"A").Height + 10, | 55 | core::rect<s32> r2(0, Environment->getSkin()->getFont()->getDimension(L"A").Height + 10, |
56 | r.getWidth() - 5, | 56 | r.getWidth() - 5, |
57 | Environment->getSkin()->getFont()->getDimension(L"A").Height*2 + 20 ); | 57 | Environment->getSkin()->getFont()->getDimension(L"A").Height*2 + 20 ); |
58 | 58 | ||
59 | if (outLiterals.size() > 0) | 59 | if (outLiterals.size() > 0) |
60 | { | 60 | { |
61 | AttribComboBox = Environment->addComboBox(r2, this, -1); | 61 | AttribComboBox = Environment->addComboBox(r2, this, -1); |
62 | for (u32 i=0; i<outLiterals.size(); ++i) | 62 | for (u32 i=0; i<outLiterals.size(); ++i) |
63 | AttribComboBox->addItem( core::stringw(outLiterals[i].c_str()).c_str()); | 63 | AttribComboBox->addItem( core::stringw(outLiterals[i].c_str()).c_str()); |
64 | 64 | ||
65 | AttribComboBox->setSelected( attribs->getAttributeAsInt(attribIndex) ); | 65 | AttribComboBox->setSelected( attribs->getAttributeAsInt(attribIndex) ); |
66 | 66 | ||
67 | AttribComboBox->grab(); | 67 | AttribComboBox->grab(); |
68 | AttribComboBox->setSubElement(true); | 68 | AttribComboBox->setSubElement(true); |
69 | AttribComboBox->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT); | 69 | AttribComboBox->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT); |
70 | } | 70 | } |
71 | else | 71 | else |
72 | { | 72 | { |
73 | 73 | ||
74 | AttribEditBox = Environment->addEditBox( | 74 | AttribEditBox = Environment->addEditBox( |
75 | attribs->getAttributeAsStringW(attribIndex).c_str(), | 75 | attribs->getAttributeAsStringW(attribIndex).c_str(), |
76 | r2, true, this, -1); | 76 | r2, true, this, -1); |
77 | AttribEditBox->grab(); | 77 | AttribEditBox->grab(); |
78 | AttribEditBox->setSubElement(true); | 78 | AttribEditBox->setSubElement(true); |
79 | AttribEditBox->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT); | 79 | AttribEditBox->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT); |
80 | } | 80 | } |
81 | 81 | ||
82 | CGUIAttribute::setAttrib(attribs, attribIndex); | 82 | CGUIAttribute::setAttrib(attribs, attribIndex); |
83 | } | 83 | } |
84 | 84 | ||
85 | //! save the attribute and possibly post the event to its parent | 85 | //! save the attribute and possibly post the event to its parent |
86 | virtual bool updateAttrib(bool sendEvent=true) | 86 | virtual bool updateAttrib(bool sendEvent=true) |
87 | { | 87 | { |
88 | if (!Attribs) | 88 | if (!Attribs) |
89 | return true; | 89 | return true; |
90 | 90 | ||
91 | if (AttribComboBox) | 91 | if (AttribComboBox) |
92 | Attribs->setAttribute(Index, AttribComboBox->getText()); | 92 | Attribs->setAttribute(Index, AttribComboBox->getText()); |
93 | else if (AttribEditBox) | 93 | else if (AttribEditBox) |
94 | Attribs->setAttribute(Index, AttribEditBox->getText()); | 94 | Attribs->setAttribute(Index, AttribEditBox->getText()); |
95 | 95 | ||
96 | return CGUIAttribute::updateAttrib(sendEvent); | 96 | return CGUIAttribute::updateAttrib(sendEvent); |
97 | } | 97 | } |
98 | 98 | ||
99 | //! Returns the type name of the gui element. | 99 | //! Returns the type name of the gui element. |
100 | virtual const c8* getTypeName() const | 100 | virtual const c8* getTypeName() const |
101 | { | 101 | { |
102 | return GUIEditElementTypeNames[EGUIEDIT_ENUMATTRIBUTE]; | 102 | return GUIEditElementTypeNames[EGUIEDIT_ENUMATTRIBUTE]; |
103 | } | 103 | } |
104 | 104 | ||
105 | private: | 105 | private: |
106 | IGUIComboBox* AttribComboBox; | 106 | IGUIComboBox* AttribComboBox; |
107 | IGUIEditBox* AttribEditBox; | 107 | IGUIEditBox* AttribEditBox; |
108 | }; | 108 | }; |
109 | 109 | ||
110 | } // namespace gui | 110 | } // namespace gui |
111 | } // namespace irr | 111 | } // namespace irr |
112 | 112 | ||
113 | #endif | 113 | #endif |
114 | 114 | ||