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/source/Irrlicht/CDefaultGUIElementFactory.cpp | |
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 '')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/CDefaultGUIElementFactory.cpp | 328 |
1 files changed, 164 insertions, 164 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CDefaultGUIElementFactory.cpp b/libraries/irrlicht-1.8/source/Irrlicht/CDefaultGUIElementFactory.cpp index c10f18f..23ef81c 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/CDefaultGUIElementFactory.cpp +++ b/libraries/irrlicht-1.8/source/Irrlicht/CDefaultGUIElementFactory.cpp | |||
@@ -1,164 +1,164 @@ | |||
1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt | 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt |
2 | // This file is part of the "Irrlicht Engine". | 2 | // This file is part of the "Irrlicht Engine". |
3 | // For conditions of distribution and use, see copyright notice in irrlicht.h | 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h |
4 | 4 | ||
5 | #include "CDefaultGUIElementFactory.h" | 5 | #include "CDefaultGUIElementFactory.h" |
6 | 6 | ||
7 | #ifdef _IRR_COMPILE_WITH_GUI_ | 7 | #ifdef _IRR_COMPILE_WITH_GUI_ |
8 | 8 | ||
9 | #include "IGUIEnvironment.h" | 9 | #include "IGUIEnvironment.h" |
10 | 10 | ||
11 | #include "IGUIButton.h" | 11 | #include "IGUIButton.h" |
12 | #include "IGUICheckBox.h" | 12 | #include "IGUICheckBox.h" |
13 | #include "IGUIColorSelectDialog.h" | 13 | #include "IGUIColorSelectDialog.h" |
14 | #include "IGUIComboBox.h" | 14 | #include "IGUIComboBox.h" |
15 | #include "IGUIContextMenu.h" | 15 | #include "IGUIContextMenu.h" |
16 | #include "IGUIEditBox.h" | 16 | #include "IGUIEditBox.h" |
17 | #include "IGUIFileOpenDialog.h" | 17 | #include "IGUIFileOpenDialog.h" |
18 | #include "IGUIInOutFader.h" | 18 | #include "IGUIInOutFader.h" |
19 | #include "IGUIImage.h" | 19 | #include "IGUIImage.h" |
20 | #include "IGUIListBox.h" | 20 | #include "IGUIListBox.h" |
21 | #include "IGUIMeshViewer.h" | 21 | #include "IGUIMeshViewer.h" |
22 | #include "IGUIScrollBar.h" | 22 | #include "IGUIScrollBar.h" |
23 | #include "IGUISpinBox.h" | 23 | #include "IGUISpinBox.h" |
24 | #include "IGUIStaticText.h" | 24 | #include "IGUIStaticText.h" |
25 | #include "IGUITabControl.h" | 25 | #include "IGUITabControl.h" |
26 | #include "IGUITable.h" | 26 | #include "IGUITable.h" |
27 | #include "IGUIToolbar.h" | 27 | #include "IGUIToolbar.h" |
28 | #include "IGUIWindow.h" | 28 | #include "IGUIWindow.h" |
29 | #include "IGUITreeView.h" | 29 | #include "IGUITreeView.h" |
30 | 30 | ||
31 | namespace irr | 31 | namespace irr |
32 | { | 32 | { |
33 | namespace gui | 33 | namespace gui |
34 | { | 34 | { |
35 | 35 | ||
36 | CDefaultGUIElementFactory::CDefaultGUIElementFactory(IGUIEnvironment* env) | 36 | CDefaultGUIElementFactory::CDefaultGUIElementFactory(IGUIEnvironment* env) |
37 | : Environment(env) | 37 | : Environment(env) |
38 | { | 38 | { |
39 | 39 | ||
40 | #ifdef _DEBUG | 40 | #ifdef _DEBUG |
41 | setDebugName("CDefaultGUIElementFactory"); | 41 | setDebugName("CDefaultGUIElementFactory"); |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | // don't grab the gui environment here to prevent cyclic references | 44 | // don't grab the gui environment here to prevent cyclic references |
45 | } | 45 | } |
46 | 46 | ||
47 | 47 | ||
48 | //! adds an element to the env based on its type id | 48 | //! adds an element to the env based on its type id |
49 | IGUIElement* CDefaultGUIElementFactory::addGUIElement(EGUI_ELEMENT_TYPE type, IGUIElement* parent) | 49 | IGUIElement* CDefaultGUIElementFactory::addGUIElement(EGUI_ELEMENT_TYPE type, IGUIElement* parent) |
50 | { | 50 | { |
51 | switch(type) | 51 | switch(type) |
52 | { | 52 | { |
53 | case EGUIET_BUTTON: | 53 | case EGUIET_BUTTON: |
54 | return Environment->addButton(core::rect<s32>(0,0,100,100),parent); | 54 | return Environment->addButton(core::rect<s32>(0,0,100,100),parent); |
55 | case EGUIET_CHECK_BOX: | 55 | case EGUIET_CHECK_BOX: |
56 | return Environment->addCheckBox(false, core::rect<s32>(0,0,100,100), parent); | 56 | return Environment->addCheckBox(false, core::rect<s32>(0,0,100,100), parent); |
57 | case EGUIET_COLOR_SELECT_DIALOG: | 57 | case EGUIET_COLOR_SELECT_DIALOG: |
58 | return Environment->addColorSelectDialog(0,true,parent); | 58 | return Environment->addColorSelectDialog(0,true,parent); |
59 | case EGUIET_COMBO_BOX: | 59 | case EGUIET_COMBO_BOX: |
60 | return Environment->addComboBox(core::rect<s32>(0,0,100,100),parent); | 60 | return Environment->addComboBox(core::rect<s32>(0,0,100,100),parent); |
61 | case EGUIET_CONTEXT_MENU: | 61 | case EGUIET_CONTEXT_MENU: |
62 | return Environment->addContextMenu(core::rect<s32>(0,0,100,100),parent); | 62 | return Environment->addContextMenu(core::rect<s32>(0,0,100,100),parent); |
63 | case EGUIET_MENU: | 63 | case EGUIET_MENU: |
64 | return Environment->addMenu(parent); | 64 | return Environment->addMenu(parent); |
65 | case EGUIET_EDIT_BOX: | 65 | case EGUIET_EDIT_BOX: |
66 | return Environment->addEditBox(0,core::rect<s32>(0,0,100,100),true, parent); | 66 | return Environment->addEditBox(0,core::rect<s32>(0,0,100,100),true, parent); |
67 | case EGUIET_FILE_OPEN_DIALOG: | 67 | case EGUIET_FILE_OPEN_DIALOG: |
68 | return Environment->addFileOpenDialog(0,true,parent); | 68 | return Environment->addFileOpenDialog(0,true,parent); |
69 | case EGUIET_IMAGE: | 69 | case EGUIET_IMAGE: |
70 | return Environment->addImage(0,core::position2di(0,0), true, parent); | 70 | return Environment->addImage(0,core::position2di(0,0), true, parent); |
71 | case EGUIET_IN_OUT_FADER: | 71 | case EGUIET_IN_OUT_FADER: |
72 | return Environment->addInOutFader(0,parent); | 72 | return Environment->addInOutFader(0,parent); |
73 | case EGUIET_LIST_BOX: | 73 | case EGUIET_LIST_BOX: |
74 | return Environment->addListBox(core::rect<s32>(0,0,100,100),parent); | 74 | return Environment->addListBox(core::rect<s32>(0,0,100,100),parent); |
75 | case EGUIET_MESH_VIEWER: | 75 | case EGUIET_MESH_VIEWER: |
76 | return Environment->addMeshViewer(core::rect<s32>(0,0,100,100),parent); | 76 | return Environment->addMeshViewer(core::rect<s32>(0,0,100,100),parent); |
77 | case EGUIET_MODAL_SCREEN: | 77 | case EGUIET_MODAL_SCREEN: |
78 | return Environment->addModalScreen(parent); | 78 | return Environment->addModalScreen(parent); |
79 | case EGUIET_MESSAGE_BOX: | 79 | case EGUIET_MESSAGE_BOX: |
80 | return Environment->addMessageBox(0,0,false,0,parent); | 80 | return Environment->addMessageBox(0,0,false,0,parent); |
81 | case EGUIET_SCROLL_BAR: | 81 | case EGUIET_SCROLL_BAR: |
82 | return Environment->addScrollBar(false,core::rect<s32>(0,0,100,100),parent); | 82 | return Environment->addScrollBar(false,core::rect<s32>(0,0,100,100),parent); |
83 | case EGUIET_STATIC_TEXT: | 83 | case EGUIET_STATIC_TEXT: |
84 | return Environment->addStaticText(0,core::rect<s32>(0,0,100,100),false,true,parent); | 84 | return Environment->addStaticText(0,core::rect<s32>(0,0,100,100),false,true,parent); |
85 | case EGUIET_TAB: | 85 | case EGUIET_TAB: |
86 | return Environment->addTab(core::rect<s32>(0,0,100,100),parent); | 86 | return Environment->addTab(core::rect<s32>(0,0,100,100),parent); |
87 | case EGUIET_TAB_CONTROL: | 87 | case EGUIET_TAB_CONTROL: |
88 | return Environment->addTabControl(core::rect<s32>(0,0,100,100),parent); | 88 | return Environment->addTabControl(core::rect<s32>(0,0,100,100),parent); |
89 | case EGUIET_TABLE: | 89 | case EGUIET_TABLE: |
90 | return Environment->addTable(core::rect<s32>(0,0,100,100), parent); | 90 | return Environment->addTable(core::rect<s32>(0,0,100,100), parent); |
91 | case EGUIET_TOOL_BAR: | 91 | case EGUIET_TOOL_BAR: |
92 | return Environment->addToolBar(parent); | 92 | return Environment->addToolBar(parent); |
93 | case EGUIET_WINDOW: | 93 | case EGUIET_WINDOW: |
94 | return Environment->addWindow(core::rect<s32>(0,0,100,100),false,0,parent); | 94 | return Environment->addWindow(core::rect<s32>(0,0,100,100),false,0,parent); |
95 | case EGUIET_SPIN_BOX: | 95 | case EGUIET_SPIN_BOX: |
96 | return Environment->addSpinBox(L"0.0", core::rect<s32>(0,0,100,100), true, parent); | 96 | return Environment->addSpinBox(L"0.0", core::rect<s32>(0,0,100,100), true, parent); |
97 | case EGUIET_TREE_VIEW: | 97 | case EGUIET_TREE_VIEW: |
98 | return Environment->addTreeView(core::rect<s32>(0,0,100,100),parent); | 98 | return Environment->addTreeView(core::rect<s32>(0,0,100,100),parent); |
99 | default: | 99 | default: |
100 | return 0; | 100 | return 0; |
101 | } | 101 | } |
102 | } | 102 | } |
103 | 103 | ||
104 | 104 | ||
105 | //! adds an element to the environment based on its type name | 105 | //! adds an element to the environment based on its type name |
106 | IGUIElement* CDefaultGUIElementFactory::addGUIElement(const c8* typeName, IGUIElement* parent) | 106 | IGUIElement* CDefaultGUIElementFactory::addGUIElement(const c8* typeName, IGUIElement* parent) |
107 | { | 107 | { |
108 | return addGUIElement( getTypeFromName(typeName), parent ); | 108 | return addGUIElement( getTypeFromName(typeName), parent ); |
109 | } | 109 | } |
110 | 110 | ||
111 | 111 | ||
112 | //! Returns the amount of element types this factory is able to create. | 112 | //! Returns the amount of element types this factory is able to create. |
113 | s32 CDefaultGUIElementFactory::getCreatableGUIElementTypeCount() const | 113 | s32 CDefaultGUIElementFactory::getCreatableGUIElementTypeCount() const |
114 | { | 114 | { |
115 | return EGUIET_COUNT; | 115 | return EGUIET_COUNT; |
116 | } | 116 | } |
117 | 117 | ||
118 | 118 | ||
119 | //! Returns the type of a createable element type. | 119 | //! Returns the type of a createable element type. |
120 | EGUI_ELEMENT_TYPE CDefaultGUIElementFactory::getCreateableGUIElementType(s32 idx) const | 120 | EGUI_ELEMENT_TYPE CDefaultGUIElementFactory::getCreateableGUIElementType(s32 idx) const |
121 | { | 121 | { |
122 | if (idx>=0 && idx<EGUIET_COUNT) | 122 | if (idx>=0 && idx<EGUIET_COUNT) |
123 | return (EGUI_ELEMENT_TYPE)idx; | 123 | return (EGUI_ELEMENT_TYPE)idx; |
124 | 124 | ||
125 | return EGUIET_ELEMENT; | 125 | return EGUIET_ELEMENT; |
126 | } | 126 | } |
127 | 127 | ||
128 | 128 | ||
129 | //! Returns the type name of a createable element type. | 129 | //! Returns the type name of a createable element type. |
130 | const c8* CDefaultGUIElementFactory::getCreateableGUIElementTypeName(s32 idx) const | 130 | const c8* CDefaultGUIElementFactory::getCreateableGUIElementTypeName(s32 idx) const |
131 | { | 131 | { |
132 | if (idx>=0 && idx<EGUIET_COUNT) | 132 | if (idx>=0 && idx<EGUIET_COUNT) |
133 | return GUIElementTypeNames[idx]; | 133 | return GUIElementTypeNames[idx]; |
134 | 134 | ||
135 | return 0; | 135 | return 0; |
136 | } | 136 | } |
137 | 137 | ||
138 | 138 | ||
139 | //! Returns the type name of a createable element type. | 139 | //! Returns the type name of a createable element type. |
140 | const c8* CDefaultGUIElementFactory::getCreateableGUIElementTypeName(EGUI_ELEMENT_TYPE type) const | 140 | const c8* CDefaultGUIElementFactory::getCreateableGUIElementTypeName(EGUI_ELEMENT_TYPE type) const |
141 | { | 141 | { |
142 | // for this factory, type == index | 142 | // for this factory, type == index |
143 | 143 | ||
144 | if (type>=0 && type<EGUIET_COUNT) | 144 | if (type>=0 && type<EGUIET_COUNT) |
145 | return GUIElementTypeNames[type]; | 145 | return GUIElementTypeNames[type]; |
146 | 146 | ||
147 | return 0; | 147 | return 0; |
148 | } | 148 | } |
149 | 149 | ||
150 | EGUI_ELEMENT_TYPE CDefaultGUIElementFactory::getTypeFromName(const c8* name) const | 150 | EGUI_ELEMENT_TYPE CDefaultGUIElementFactory::getTypeFromName(const c8* name) const |
151 | { | 151 | { |
152 | for ( u32 i=0; GUIElementTypeNames[i]; ++i) | 152 | for ( u32 i=0; GUIElementTypeNames[i]; ++i) |
153 | if (!strcmp(name, GUIElementTypeNames[i]) ) | 153 | if (!strcmp(name, GUIElementTypeNames[i]) ) |
154 | return (EGUI_ELEMENT_TYPE)i; | 154 | return (EGUI_ELEMENT_TYPE)i; |
155 | 155 | ||
156 | return EGUIET_ELEMENT; | 156 | return EGUIET_ELEMENT; |
157 | } | 157 | } |
158 | 158 | ||
159 | 159 | ||
160 | } // end namespace gui | 160 | } // end namespace gui |
161 | } // end namespace irr | 161 | } // end namespace irr |
162 | 162 | ||
163 | #endif // _IRR_COMPILE_WITH_GUI_ | 163 | #endif // _IRR_COMPILE_WITH_GUI_ |
164 | 164 | ||