diff options
author | David Walter Seikel | 2016-03-28 22:28:34 +1000 |
---|---|---|
committer | David Walter Seikel | 2016-03-28 22:28:34 +1000 |
commit | 7028cbe09c688437910a25623098762bf0fa592d (patch) | |
tree | 10b5af58277d9880380c2251f109325542c4e6eb /libraries/irrlicht-1.8.1/tools/GUIEditor/CGUIAttributeEditor.cpp | |
parent | Move lemon to the src/others directory. (diff) | |
download | SledjHamr-7028cbe09c688437910a25623098762bf0fa592d.zip SledjHamr-7028cbe09c688437910a25623098762bf0fa592d.tar.gz SledjHamr-7028cbe09c688437910a25623098762bf0fa592d.tar.bz2 SledjHamr-7028cbe09c688437910a25623098762bf0fa592d.tar.xz |
Move Irrlicht to src/others.
Diffstat (limited to 'libraries/irrlicht-1.8.1/tools/GUIEditor/CGUIAttributeEditor.cpp')
-rw-r--r-- | libraries/irrlicht-1.8.1/tools/GUIEditor/CGUIAttributeEditor.cpp | 120 |
1 files changed, 0 insertions, 120 deletions
diff --git a/libraries/irrlicht-1.8.1/tools/GUIEditor/CGUIAttributeEditor.cpp b/libraries/irrlicht-1.8.1/tools/GUIEditor/CGUIAttributeEditor.cpp deleted file mode 100644 index 45913b6..0000000 --- a/libraries/irrlicht-1.8.1/tools/GUIEditor/CGUIAttributeEditor.cpp +++ /dev/null | |||
@@ -1,120 +0,0 @@ | |||
1 | |||
2 | #include "CGUIAttributeEditor.h" | ||
3 | #include "IGUIEnvironment.h" | ||
4 | #include "IFileSystem.h" | ||
5 | #include "IVideoDriver.h" | ||
6 | #include "IAttributes.h" | ||
7 | #include "IGUIFont.h" | ||
8 | #include "IGUIScrollBar.h" | ||
9 | #include "CGUIEditWorkspace.h" | ||
10 | #include "CGUIAttribute.h" | ||
11 | #include "CGUIStringAttribute.h" | ||
12 | |||
13 | namespace irr | ||
14 | { | ||
15 | namespace gui | ||
16 | { | ||
17 | |||
18 | using namespace core; | ||
19 | using namespace io; | ||
20 | |||
21 | CGUIAttributeEditor::CGUIAttributeEditor(IGUIEnvironment* environment, s32 id, IGUIElement *parent) : | ||
22 | CGUIPanel(environment, parent, id, rect<s32>(0, 0, 100, 100)), | ||
23 | Attribs(0), Panel(0) | ||
24 | { | ||
25 | #ifdef _DEBUG | ||
26 | setDebugName("CGUIAttributeEditor"); | ||
27 | #endif | ||
28 | |||
29 | // create attributes | ||
30 | Attribs = environment->getFileSystem()->createEmptyAttributes(Environment->getVideoDriver()); | ||
31 | |||
32 | calculateClientArea(); | ||
33 | resizeInnerPane(); | ||
34 | |||
35 | // refresh attrib list | ||
36 | refreshAttribs(); | ||
37 | |||
38 | IGUIScrollBar* sb = getVScrollBar(); | ||
39 | core::rect<s32> r = sb->getRelativePosition(); | ||
40 | r.LowerRightCorner.Y -= 16; | ||
41 | sb->setRelativePosition(r); | ||
42 | } | ||
43 | |||
44 | CGUIAttributeEditor::~CGUIAttributeEditor() | ||
45 | { | ||
46 | for (u32 i=0; i<AttribList.size(); ++i) | ||
47 | { | ||
48 | AttribList[i]->remove(); | ||
49 | AttribList[i]->drop(); | ||
50 | } | ||
51 | AttribList.clear(); | ||
52 | |||
53 | Attribs->drop(); | ||
54 | } | ||
55 | |||
56 | |||
57 | IAttributes* CGUIAttributeEditor::getAttribs() | ||
58 | { | ||
59 | return Attribs; | ||
60 | } | ||
61 | |||
62 | void CGUIAttributeEditor::refreshAttribs() | ||
63 | { | ||
64 | // clear the attribute list | ||
65 | u32 i; | ||
66 | for (i=0; i<AttribList.size(); ++i) | ||
67 | { | ||
68 | AttribList[i]->remove(); | ||
69 | AttribList[i]->drop(); | ||
70 | } | ||
71 | AttribList.clear(); | ||
72 | |||
73 | position2di top(10, 5); | ||
74 | rect<s32> r(top.X, top.Y, | ||
75 | getClientArea().getWidth() - 10, | ||
76 | 5 + Environment->getSkin()->getFont()->getDimension(L"A").Height); | ||
77 | |||
78 | // add attribute elements | ||
79 | u32 c = Attribs->getAttributeCount(); | ||
80 | for (i=0; i<c; ++i) | ||
81 | { | ||
82 | |||
83 | // try to create attribute | ||
84 | stringc str = Attribs->getAttributeTypeString(i); | ||
85 | str += "_attribute"; | ||
86 | CGUIAttribute* n = (CGUIAttribute*)Environment->addGUIElement(str.c_str(), 0); | ||
87 | |||
88 | // if this doesn't exist, use a string editor | ||
89 | if (!n) | ||
90 | n = (CGUIAttribute*)Environment->addGUIElement("string_attribute", 0); | ||
91 | |||
92 | if (n) | ||
93 | { | ||
94 | AttribList.push_back(n); | ||
95 | n->setParentID(getID()); | ||
96 | n->grab(); | ||
97 | } | ||
98 | |||
99 | // We can't set "this" as parent above as we need functionality | ||
100 | // of the overloaded addChild which isn't called in the constructor. | ||
101 | // (that's a general Irrlicht messup with too fat constructors) | ||
102 | addChild(n); | ||
103 | |||
104 | AttribList[i]->setSubElement(true); | ||
105 | AttribList[i]->setRelativePosition(r); | ||
106 | AttribList[i]->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT); | ||
107 | AttribList[i]->setAttrib(Attribs, i); | ||
108 | r += position2di(0, AttribList[i]->getRelativePosition().getHeight() + 5); | ||
109 | } | ||
110 | } | ||
111 | |||
112 | void CGUIAttributeEditor::updateAttribs() | ||
113 | { | ||
114 | for (u32 i=0; i<AttribList.size(); ++i) | ||
115 | AttribList[i]->updateAttrib(false); | ||
116 | } | ||
117 | |||
118 | } // namespace gui | ||
119 | } // namespace irr | ||
120 | |||