diff options
Diffstat (limited to 'libraries/irrlicht-1.8/tools/GUIEditor/CGUIEditWorkspace.h')
-rw-r--r-- | libraries/irrlicht-1.8/tools/GUIEditor/CGUIEditWorkspace.h | 336 |
1 files changed, 168 insertions, 168 deletions
diff --git a/libraries/irrlicht-1.8/tools/GUIEditor/CGUIEditWorkspace.h b/libraries/irrlicht-1.8/tools/GUIEditor/CGUIEditWorkspace.h index 3f21258..c9ccd14 100644 --- a/libraries/irrlicht-1.8/tools/GUIEditor/CGUIEditWorkspace.h +++ b/libraries/irrlicht-1.8/tools/GUIEditor/CGUIEditWorkspace.h | |||
@@ -1,168 +1,168 @@ | |||
1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt / Gaz Davidson | 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt / Gaz Davidson |
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 | #ifndef __C_GUIEDIT_WORKSPACE_H_INCLUDED__ | 5 | #ifndef __C_GUIEDIT_WORKSPACE_H_INCLUDED__ |
6 | #define __C_GUIEDIT_WORKSPACE_H_INCLUDED__ | 6 | #define __C_GUIEDIT_WORKSPACE_H_INCLUDED__ |
7 | 7 | ||
8 | #include "IGUIElement.h" | 8 | #include "IGUIElement.h" |
9 | #include "CGUIEditWindow.h" | 9 | #include "CGUIEditWindow.h" |
10 | #include "EGUIEditTypes.h" | 10 | #include "EGUIEditTypes.h" |
11 | 11 | ||
12 | namespace irr | 12 | namespace irr |
13 | { | 13 | { |
14 | namespace gui | 14 | namespace gui |
15 | { | 15 | { |
16 | 16 | ||
17 | //! Adding the GUI Editor Workspace to an element allows you | 17 | //! Adding the GUI Editor Workspace to an element allows you |
18 | /** to create, edit, load and save any elements supported | 18 | /** to create, edit, load and save any elements supported |
19 | by any loaded factories. | 19 | by any loaded factories. |
20 | When you add it without a parent (to the root element) | 20 | When you add it without a parent (to the root element) |
21 | it will also allow you to edit, load and save settings in | 21 | it will also allow you to edit, load and save settings in |
22 | the current skin. | 22 | the current skin. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | // custom events | 25 | // custom events |
26 | enum EGUIEDIT_CUSTOM_EVENTS | 26 | enum EGUIEDIT_CUSTOM_EVENTS |
27 | { | 27 | { |
28 | EGUIEDCE_ATTRIB_EDITOR = MAKE_IRR_ID('g','A','t','t'), | 28 | EGUIEDCE_ATTRIB_EDITOR = MAKE_IRR_ID('g','A','t','t'), |
29 | EGUIEDCE_OPTION_EDITOR = MAKE_IRR_ID('g','O','p','t'), | 29 | EGUIEDCE_OPTION_EDITOR = MAKE_IRR_ID('g','O','p','t'), |
30 | EGUIEDCE_ENV_EDITOR = MAKE_IRR_ID('g','E','n','v') | 30 | EGUIEDCE_ENV_EDITOR = MAKE_IRR_ID('g','E','n','v') |
31 | }; | 31 | }; |
32 | 32 | ||
33 | class CGUIEditWorkspace : public IGUIElement | 33 | class CGUIEditWorkspace : public IGUIElement |
34 | { | 34 | { |
35 | public: | 35 | public: |
36 | 36 | ||
37 | //! constructor | 37 | //! constructor |
38 | CGUIEditWorkspace(IGUIEnvironment* environment, s32 id=-1, IGUIElement *parent=0); | 38 | CGUIEditWorkspace(IGUIEnvironment* environment, s32 id=-1, IGUIElement *parent=0); |
39 | 39 | ||
40 | //! destructor | 40 | //! destructor |
41 | ~CGUIEditWorkspace(); | 41 | ~CGUIEditWorkspace(); |
42 | 42 | ||
43 | //! called if an event happened. | 43 | //! called if an event happened. |
44 | virtual bool OnEvent(const SEvent &event); | 44 | virtual bool OnEvent(const SEvent &event); |
45 | 45 | ||
46 | //! Removes a child. | 46 | //! Removes a child. |
47 | virtual void removeChild(IGUIElement* child); | 47 | virtual void removeChild(IGUIElement* child); |
48 | 48 | ||
49 | //! draws the element and its children | 49 | //! draws the element and its children |
50 | virtual void draw(); | 50 | virtual void draw(); |
51 | 51 | ||
52 | //! Updates the absolute position. | 52 | //! Updates the absolute position. |
53 | virtual void updateAbsolutePosition(); | 53 | virtual void updateAbsolutePosition(); |
54 | 54 | ||
55 | //! Sets the menu command id's | 55 | //! Sets the menu command id's |
56 | /** The GUI editor defaults to command ID's from 0xED17 to 0xED17+EGUIEDMC_COUNT | 56 | /** The GUI editor defaults to command ID's from 0xED17 to 0xED17+EGUIEDMC_COUNT |
57 | In the rare case that these are already in use and you wish to use menus | 57 | In the rare case that these are already in use and you wish to use menus |
58 | while the editor is present you can set a new offset here. | 58 | while the editor is present you can set a new offset here. |
59 | */ | 59 | */ |
60 | virtual void setMenuCommandIDStart(s32 id); | 60 | virtual void setMenuCommandIDStart(s32 id); |
61 | 61 | ||
62 | //! grid drawing... | 62 | //! grid drawing... |
63 | virtual void setDrawGrid(bool drawGrid); | 63 | virtual void setDrawGrid(bool drawGrid); |
64 | virtual void setGridSize(const core::dimension2di& gridSize); | 64 | virtual void setGridSize(const core::dimension2di& gridSize); |
65 | virtual void setUseGrid(bool useGrid); | 65 | virtual void setUseGrid(bool useGrid); |
66 | 66 | ||
67 | //! returns the first editable element under the mouse | 67 | //! returns the first editable element under the mouse |
68 | virtual IGUIElement* getEditableElementFromPoint(IGUIElement *start, const core::position2di &point, s32 index=0 ); | 68 | virtual IGUIElement* getEditableElementFromPoint(IGUIElement *start, const core::position2di &point, s32 index=0 ); |
69 | 69 | ||
70 | //! selecting elements | 70 | //! selecting elements |
71 | virtual void setSelectedElement(IGUIElement *sel); | 71 | virtual void setSelectedElement(IGUIElement *sel); |
72 | virtual void selectNextSibling(); | 72 | virtual void selectNextSibling(); |
73 | virtual void selectPreviousSibling(); | 73 | virtual void selectPreviousSibling(); |
74 | 74 | ||
75 | //! returns the selected element | 75 | //! returns the selected element |
76 | virtual IGUIElement* getSelectedElement(); | 76 | virtual IGUIElement* getSelectedElement(); |
77 | 77 | ||
78 | //! copies the xml of the selected element and all children to the clipboard | 78 | //! copies the xml of the selected element and all children to the clipboard |
79 | virtual void CopySelectedElementXML(); | 79 | virtual void CopySelectedElementXML(); |
80 | 80 | ||
81 | //! copies the xml of the selected element and all children to the clipboard | 81 | //! copies the xml of the selected element and all children to the clipboard |
82 | virtual void PasteXMLToSelectedElement(); | 82 | virtual void PasteXMLToSelectedElement(); |
83 | 83 | ||
84 | virtual const c8* getTypeName() const | 84 | virtual const c8* getTypeName() const |
85 | { | 85 | { |
86 | return GUIEditElementTypeNames[EGUIEDIT_GUIEDIT]; | 86 | return GUIEditElementTypeNames[EGUIEDIT_GUIEDIT]; |
87 | } | 87 | } |
88 | 88 | ||
89 | virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0); | 89 | virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0); |
90 | virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0); | 90 | virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0); |
91 | 91 | ||
92 | private: | 92 | private: |
93 | 93 | ||
94 | enum EGUIEDIT_MODE | 94 | enum EGUIEDIT_MODE |
95 | { | 95 | { |
96 | // when we are currently selecting an element | 96 | // when we are currently selecting an element |
97 | EGUIEDM_SELECT=0, | 97 | EGUIEDM_SELECT=0, |
98 | // selecting a new parent for the selected element | 98 | // selecting a new parent for the selected element |
99 | EGUIEDM_SELECT_NEW_PARENT, | 99 | EGUIEDM_SELECT_NEW_PARENT, |
100 | 100 | ||
101 | // moving the selected element | 101 | // moving the selected element |
102 | EGUIEDM_MOVE, | 102 | EGUIEDM_MOVE, |
103 | // resizing the selected element | 103 | // resizing the selected element |
104 | EGUIEDM_RESIZE_TL, | 104 | EGUIEDM_RESIZE_TL, |
105 | EGUIEDM_RESIZE_T, | 105 | EGUIEDM_RESIZE_T, |
106 | EGUIEDM_RESIZE_TR, | 106 | EGUIEDM_RESIZE_TR, |
107 | EGUIEDM_RESIZE_R, | 107 | EGUIEDM_RESIZE_R, |
108 | EGUIEDM_RESIZE_BR, | 108 | EGUIEDM_RESIZE_BR, |
109 | EGUIEDM_RESIZE_B, | 109 | EGUIEDM_RESIZE_B, |
110 | EGUIEDM_RESIZE_BL, | 110 | EGUIEDM_RESIZE_BL, |
111 | EGUIEDM_RESIZE_L | 111 | EGUIEDM_RESIZE_L |
112 | }; | 112 | }; |
113 | 113 | ||
114 | enum EGUIEDIT_MENUCOMMANDS | 114 | enum EGUIEDIT_MENUCOMMANDS |
115 | { | 115 | { |
116 | //! file commands | 116 | //! file commands |
117 | EGUIEDMC_FILE_NEW, | 117 | EGUIEDMC_FILE_NEW, |
118 | EGUIEDMC_FILE_LOAD, | 118 | EGUIEDMC_FILE_LOAD, |
119 | EGUIEDMC_FILE_SAVE, | 119 | EGUIEDMC_FILE_SAVE, |
120 | //! edit menu | 120 | //! edit menu |
121 | EGUIEDMC_CUT_ELEMENT, | 121 | EGUIEDMC_CUT_ELEMENT, |
122 | EGUIEDMC_COPY_ELEMENT, | 122 | EGUIEDMC_COPY_ELEMENT, |
123 | EGUIEDMC_PASTE_ELEMENT, | 123 | EGUIEDMC_PASTE_ELEMENT, |
124 | EGUIEDMC_DELETE_ELEMENT, | 124 | EGUIEDMC_DELETE_ELEMENT, |
125 | EGUIEDMC_SET_PARENT, | 125 | EGUIEDMC_SET_PARENT, |
126 | EGUIEDMC_BRING_TO_FRONT, | 126 | EGUIEDMC_BRING_TO_FRONT, |
127 | EGUIEDMC_SAVE_ELEMENT, | 127 | EGUIEDMC_SAVE_ELEMENT, |
128 | //! grid | 128 | //! grid |
129 | EGUIEDMC_TOGGLE_EDITOR, | 129 | EGUIEDMC_TOGGLE_EDITOR, |
130 | 130 | ||
131 | EGUIEDMC_INSERT_XML, | 131 | EGUIEDMC_INSERT_XML, |
132 | 132 | ||
133 | //! number of menu options | 133 | //! number of menu options |
134 | EGUIEDMC_COUNT | 134 | EGUIEDMC_COUNT |
135 | }; | 135 | }; |
136 | 136 | ||
137 | EGUIEDIT_MODE getModeFromPos(core::position2di p); | 137 | EGUIEDIT_MODE getModeFromPos(core::position2di p); |
138 | 138 | ||
139 | EGUIEDIT_MODE CurrentMode; | 139 | EGUIEDIT_MODE CurrentMode; |
140 | EGUIEDIT_MODE MouseOverMode; | 140 | EGUIEDIT_MODE MouseOverMode; |
141 | core::position2di DragStart; | 141 | core::position2di DragStart; |
142 | core::position2di StartMovePos; | 142 | core::position2di StartMovePos; |
143 | core::rect<s32> SelectedArea; | 143 | core::rect<s32> SelectedArea; |
144 | 144 | ||
145 | core::dimension2di GridSize; | 145 | core::dimension2di GridSize; |
146 | s32 MenuCommandStart; | 146 | s32 MenuCommandStart; |
147 | bool DrawGrid, UseGrid; | 147 | bool DrawGrid, UseGrid; |
148 | 148 | ||
149 | IGUIElement *MouseOverElement, | 149 | IGUIElement *MouseOverElement, |
150 | *SelectedElement; | 150 | *SelectedElement; |
151 | CGUIEditWindow *EditorWindow; | 151 | CGUIEditWindow *EditorWindow; |
152 | 152 | ||
153 | core::rect<s32> TLRect; | 153 | core::rect<s32> TLRect; |
154 | core::rect<s32> TRRect; | 154 | core::rect<s32> TRRect; |
155 | core::rect<s32> TopRect; | 155 | core::rect<s32> TopRect; |
156 | core::rect<s32> BLRect; | 156 | core::rect<s32> BLRect; |
157 | core::rect<s32> LRect; | 157 | core::rect<s32> LRect; |
158 | core::rect<s32> RRect; | 158 | core::rect<s32> RRect; |
159 | core::rect<s32> BRRect; | 159 | core::rect<s32> BRRect; |
160 | core::rect<s32> BRect; | 160 | core::rect<s32> BRect; |
161 | }; | 161 | }; |
162 | 162 | ||
163 | 163 | ||
164 | } // end namespace gui | 164 | } // end namespace gui |
165 | } // end namespace irr | 165 | } // end namespace irr |
166 | 166 | ||
167 | #endif | 167 | #endif |
168 | 168 | ||