aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8/tools/GUIEditor/CGUIStringAttribute.h
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/irrlicht-1.8/tools/GUIEditor/CGUIStringAttribute.h')
-rw-r--r--libraries/irrlicht-1.8/tools/GUIEditor/CGUIStringAttribute.h140
1 files changed, 70 insertions, 70 deletions
diff --git a/libraries/irrlicht-1.8/tools/GUIEditor/CGUIStringAttribute.h b/libraries/irrlicht-1.8/tools/GUIEditor/CGUIStringAttribute.h
index af9ac03..36cac56 100644
--- a/libraries/irrlicht-1.8/tools/GUIEditor/CGUIStringAttribute.h
+++ b/libraries/irrlicht-1.8/tools/GUIEditor/CGUIStringAttribute.h
@@ -1,70 +1,70 @@
1#ifndef __C_GUI_STRING_ATTRIBUTE_H_INCLUDED__ 1#ifndef __C_GUI_STRING_ATTRIBUTE_H_INCLUDED__
2#define __C_GUI_STRING_ATTRIBUTE_H_INCLUDED__ 2#define __C_GUI_STRING_ATTRIBUTE_H_INCLUDED__
3 3
4#include "CGUIAttribute.h" 4#include "CGUIAttribute.h"
5#include "IGUIEditBox.h" 5#include "IGUIEditBox.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 CGUIStringAttribute : public CGUIAttribute 13 class CGUIStringAttribute : public CGUIAttribute
14 { 14 {
15 public: 15 public:
16 // 16 //
17 CGUIStringAttribute(IGUIEnvironment* environment, IGUIElement *parent, s32 myParentID) : 17 CGUIStringAttribute(IGUIEnvironment* environment, IGUIElement *parent, s32 myParentID) :
18 CGUIAttribute(environment, parent, myParentID), 18 CGUIAttribute(environment, parent, myParentID),
19 AttribEditBox(0) 19 AttribEditBox(0)
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 AttribEditBox = environment->addEditBox(0, r2, true, this, -1); 26 AttribEditBox = environment->addEditBox(0, r2, true, this, -1);
27 AttribEditBox->grab(); 27 AttribEditBox->grab();
28 AttribEditBox->setSubElement(true); 28 AttribEditBox->setSubElement(true);
29 AttribEditBox->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT); 29 AttribEditBox->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT);
30 30
31 } 31 }
32 32
33 virtual ~CGUIStringAttribute() 33 virtual ~CGUIStringAttribute()
34 { 34 {
35 if (AttribEditBox) 35 if (AttribEditBox)
36 AttribEditBox->drop(); 36 AttribEditBox->drop();
37 } 37 }
38 38
39 virtual void setAttrib(io::IAttributes *attribs, u32 attribIndex) 39 virtual void setAttrib(io::IAttributes *attribs, u32 attribIndex)
40 { 40 {
41 AttribEditBox->setText(attribs->getAttributeAsStringW(attribIndex).c_str()); 41 AttribEditBox->setText(attribs->getAttributeAsStringW(attribIndex).c_str());
42 CGUIAttribute::setAttrib(attribs, attribIndex); 42 CGUIAttribute::setAttrib(attribs, attribIndex);
43 } 43 }
44 44
45 //! save the attribute and possibly post the event to its parent 45 //! save the attribute and possibly post the event to its parent
46 virtual bool updateAttrib(bool sendEvent=true) 46 virtual bool updateAttrib(bool sendEvent=true)
47 { 47 {
48 if (!Attribs) 48 if (!Attribs)
49 return true; 49 return true;
50 50
51 Attribs->setAttribute(Index, AttribEditBox->getText()); 51 Attribs->setAttribute(Index, AttribEditBox->getText());
52 AttribEditBox->setText(Attribs->getAttributeAsStringW(Index).c_str()); 52 AttribEditBox->setText(Attribs->getAttributeAsStringW(Index).c_str());
53 53
54 return CGUIAttribute::updateAttrib(sendEvent); 54 return CGUIAttribute::updateAttrib(sendEvent);
55 } 55 }
56 56
57 //! Returns the type name of the gui element. 57 //! Returns the type name of the gui element.
58 virtual const c8* getTypeName() const 58 virtual const c8* getTypeName() const
59 { 59 {
60 return GUIEditElementTypeNames[EGUIEDIT_STRINGATTRIBUTE]; 60 return GUIEditElementTypeNames[EGUIEDIT_STRINGATTRIBUTE];
61 } 61 }
62 62
63 private: 63 private:
64 IGUIEditBox* AttribEditBox; 64 IGUIEditBox* AttribEditBox;
65 }; 65 };
66 66
67} // namespace gui 67} // namespace gui
68} // namespace irr 68} // namespace irr
69 69
70#endif 70#endif