Commit 4fc3ef98 authored by bitplane's avatar bitplane

Added root GUI element type. Added tree view to GUI editor, from Armen



git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3545 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 1ab25bd3
Changes in 1.8 (??.??.2011) Changes in 1.8 (??.??.2011)
- Added treeview to GUI editor, provided by Armen
- Added root type for GUI environment
- Fixed panel scrollbars in GUI editor, reported by Armen - Fixed panel scrollbars in GUI editor, reported by Armen
- Add some getters to IGUIImage: getImage, getColor - Add some getters to IGUIImage: getImage, getColor
......
...@@ -88,6 +88,9 @@ enum EGUI_ELEMENT_TYPE ...@@ -88,6 +88,9 @@ enum EGUI_ELEMENT_TYPE
//! Unknown type. //! Unknown type.
EGUIET_ELEMENT, EGUIET_ELEMENT,
//! The root of the GUI
EGUIET_ROOT,
//! Not an element, amount of elements in there //! Not an element, amount of elements in there
EGUIET_COUNT, EGUIET_COUNT,
...@@ -123,6 +126,7 @@ const c8* const GUIElementTypeNames[] = ...@@ -123,6 +126,7 @@ const c8* const GUIElementTypeNames[] =
"treeview", "treeview",
"window", "window",
"element", "element",
"root",
0 0
}; };
......
...@@ -54,7 +54,7 @@ const wchar_t* IRR_XML_FORMAT_GUI_ELEMENT_ATTR_TYPE = L"type"; ...@@ -54,7 +54,7 @@ const wchar_t* IRR_XML_FORMAT_GUI_ELEMENT_ATTR_TYPE = L"type";
//! constructor //! constructor
CGUIEnvironment::CGUIEnvironment(io::IFileSystem* fs, video::IVideoDriver* driver, IOSOperator* op) CGUIEnvironment::CGUIEnvironment(io::IFileSystem* fs, video::IVideoDriver* driver, IOSOperator* op)
: IGUIElement(EGUIET_ELEMENT, 0, 0, 0, core::rect<s32>(core::position2d<s32>(0,0), driver ? core::dimension2d<s32>(driver->getScreenSize()) : core::dimension2d<s32>(0,0))), : IGUIElement(EGUIET_ROOT, 0, 0, 0, core::rect<s32>(core::position2d<s32>(0,0), driver ? core::dimension2d<s32>(driver->getScreenSize()) : core::dimension2d<s32>(0,0))),
Driver(driver), Hovered(0), HoveredNoSubelement(0), Focus(0), LastHoveredMousePos(0,0), CurrentSkin(0), Driver(driver), Hovered(0), HoveredNoSubelement(0), Focus(0), LastHoveredMousePos(0,0), CurrentSkin(0),
FileSystem(fs), UserReceiver(0), Operator(op) FileSystem(fs), UserReceiver(0), Operator(op)
{ {
...@@ -699,6 +699,7 @@ IGUIElement* CGUIEnvironment::addGUIElement(const c8* elementName, IGUIElement* ...@@ -699,6 +699,7 @@ IGUIElement* CGUIEnvironment::addGUIElement(const c8* elementName, IGUIElement*
for (u32 i=0; i<GUIElementFactoryList.size() && !node; ++i) for (u32 i=0; i<GUIElementFactoryList.size() && !node; ++i)
node = GUIElementFactoryList[i]->addGUIElement(elementName, parent); node = GUIElementFactoryList[i]->addGUIElement(elementName, parent);
return node; return node;
} }
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "CGUIPanel.h" #include "CGUIPanel.h"
#include "irrArray.h" #include "irrArray.h"
#include "IAttributes.h" #include "IAttributes.h"
#include "EGUIEditTypes.h"
namespace irr namespace irr
{ {
...@@ -33,8 +34,11 @@ namespace gui ...@@ -33,8 +34,11 @@ namespace gui
// save the attributes // save the attributes
void updateAttribs(); void updateAttribs();
//! this shoudln't be serialized, but this is included as it's an example //! Returns the type name of the gui element.
virtual const c8* getTypeName() const { return "attributeEditor"; } virtual const c8* getTypeName() const
{
return GUIEditElementTypeNames[EGUIEDIT_ATTRIBUTEEDITOR];
}
private: private:
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include "CGUIAttribute.h" #include "CGUIAttribute.h"
#include "IGUICheckBox.h" #include "IGUICheckBox.h"
#include "EGUIEditTypes.h"
namespace irr namespace irr
{ {
...@@ -51,6 +52,12 @@ namespace gui ...@@ -51,6 +52,12 @@ namespace gui
return CGUIAttribute::updateAttrib(sendEvent); return CGUIAttribute::updateAttrib(sendEvent);
} }
//! Returns the type name of the gui element.
virtual const c8* getTypeName() const
{
return GUIEditElementTypeNames[EGUIEDIT_BOOLATTRIBUTE];
}
private: private:
IGUICheckBox* AttribCheckBox; IGUICheckBox* AttribCheckBox;
}; };
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "IGUIStaticText.h" #include "IGUIStaticText.h"
#include "IGUIScrollBar.h" #include "IGUIScrollBar.h"
#include "IGUITabControl.h" #include "IGUITabControl.h"
#include "EGUIEditTypes.h"
namespace irr namespace irr
{ {
...@@ -156,10 +157,10 @@ namespace gui ...@@ -156,10 +157,10 @@ namespace gui
return CGUIAttribute::updateAttrib(sendEvent); return CGUIAttribute::updateAttrib(sendEvent);
} }
//! this shoudln't be serialized, but this is included as it's an example //! Returns the type name of the gui element.
virtual const c8* getTypeName() const virtual const c8* getTypeName() const
{ {
return "color_attribute"; return GUIEditElementTypeNames[EGUIEDIT_COLORATTRIBUTE];
} }
private: private:
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
#include "IGUIEnvironment.h" #include "IGUIEnvironment.h"
#include "irrString.h" #include "irrString.h"
#include "EGUIEditTypes.h"
#include "CGUIEditWorkspace.h" #include "CGUIEditWorkspace.h"
#include "CGUIEditWindow.h" #include "CGUIEditWindow.h"
#include "CGUIPanel.h" #include "CGUIPanel.h"
...@@ -19,56 +21,6 @@ namespace irr ...@@ -19,56 +21,6 @@ namespace irr
namespace gui namespace gui
{ {
enum EGUIEDIT_ELEMENT_TYPES
{
// GUI Editor
EGUIEDIT_GUIEDIT=0,
EGUIEDIT_GUIEDITWINDOW,
// Generic
EGUIEDIT_GUIPANEL,
EGUIEDIT_TEXTUREBROWSER,
// Attribute editors
EGUIEDIT_ATTRIBUTEEDITOR,
EGUIEDIT_STRINGATTRIBUTE,
EGUIEDIT_BOOLATTRIBUTE,
EGUIEDIT_ENUMATTRIBUTE,
EGUIEDIT_COLORATTRIBUTE,
EGUIEDIT_COLORFATTRIBUTE,
EGUIEDIT_TEXTUREATTRIBUTE,
// Dummy editor stubs
EGUIEDIT_CONTEXTMENUEDITOR,
EGUIEDIT_MENUEDITOR,
EGUIEDIT_FILEDIALOGEDITOR,
EGUIEDIT_COLORDIALOGEDITOR,
EGUIEDIT_MODALSCREENEDITOR,
// Count
EGUIEDIT_COUNT
};
const c8* const GUIEditElementTypeNames[] =
{
"GUIEditor",
"GUIEditWindow",
"panel",
"textureCacheBrowser",
"attributeEditor",
"string_attribute",
"bool_attribute",
"enum_attribute",
"color_attribute",
"colorf_attribute",
"texture_attribute",
// dummy editors
"contextMenu_editor",
"menu_editor",
"fileOpenDialog_editor",
"colorSelectDialog_editor",
"modalScreen_editor",
0
};
CGUIEditFactory::CGUIEditFactory(IGUIEnvironment* env) CGUIEditFactory::CGUIEditFactory(IGUIEnvironment* env)
: Environment(env) : Environment(env)
{ {
......
...@@ -36,7 +36,6 @@ namespace gui ...@@ -36,7 +36,6 @@ namespace gui
getCreatableGUIElementTypeCount() */ getCreatableGUIElementTypeCount() */
virtual const c8* getCreateableGUIElementTypeName(s32 idx) const; virtual const c8* getCreateableGUIElementTypeName(s32 idx) const;
// not used: // not used:
virtual const c8* getCreateableGUIElementTypeName(EGUI_ELEMENT_TYPE type) const {return 0;} ; virtual const c8* getCreateableGUIElementTypeName(EGUI_ELEMENT_TYPE type) const {return 0;} ;
virtual EGUI_ELEMENT_TYPE getCreateableGUIElementType(s32 idx) const { return EGUIET_ELEMENT;}; virtual EGUI_ELEMENT_TYPE getCreateableGUIElementType(s32 idx) const { return EGUIET_ELEMENT;};
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "IAttributes.h" #include "IAttributes.h"
#include "IGUIFont.h" #include "IGUIFont.h"
#include "IGUITabControl.h" #include "IGUITabControl.h"
#include "IGUITreeView.h"
#include "CGUIEditWorkspace.h" #include "CGUIEditWorkspace.h"
using namespace irr; using namespace irr;
...@@ -76,6 +77,12 @@ CGUIEditWindow::CGUIEditWindow(IGUIEnvironment* environment, core::rect<s32> rec ...@@ -76,6 +77,12 @@ CGUIEditWindow::CGUIEditWindow(IGUIEnvironment* environment, core::rect<s32> rec
AttribEditor->setRelativePositionProportional(core::rect<f32>(0.0f, 0.0f, 1.0f, 1.0f)); AttribEditor->setRelativePositionProportional(core::rect<f32>(0.0f, 0.0f, 1.0f, 1.0f));
AttribEditor->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT); AttribEditor->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT);
IGUITab* TreeTab = TabControl->addTab(L"Tree");
TreeView = environment->addTreeView(core::rect<s32>(0,0,0,0), TreeTab);
TreeView->setRelativePositionProportional(core::rect<f32>(0.0f, 0.0f, 1.0f, 1.0f));
TreeView->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT);
IGUITreeViewNode* treenode = TreeView->getRoot();
//treenode->addChildFront(L"Elements");
ResizeButton = environment->addButton(core::rect<s32>(199-th,449-th,199,449), this); ResizeButton = environment->addButton(core::rect<s32>(199-th,449-th,199,449), this);
ResizeButton->setDrawBorder(false); ResizeButton->setDrawBorder(false);
ResizeButton->setEnabled(false); ResizeButton->setEnabled(false);
...@@ -85,6 +92,7 @@ CGUIEditWindow::CGUIEditWindow(IGUIEnvironment* environment, core::rect<s32> rec ...@@ -85,6 +92,7 @@ CGUIEditWindow::CGUIEditWindow(IGUIEnvironment* environment, core::rect<s32> rec
ResizeButton->grab(); ResizeButton->grab();
ResizeButton->setSubElement(true); ResizeButton->setSubElement(true);
ResizeButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT); ResizeButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT);
updateTree();
} }
...@@ -102,6 +110,10 @@ CGUIEditWindow::~CGUIEditWindow() ...@@ -102,6 +110,10 @@ CGUIEditWindow::~CGUIEditWindow()
ResizeButton->drop(); ResizeButton->drop();
} }
IGUITreeView* CGUIEditWindow::getTreeView() const
{
return TreeView;
}
CGUIAttributeEditor* CGUIEditWindow::getEnvironmentEditor() const CGUIAttributeEditor* CGUIEditWindow::getEnvironmentEditor() const
{ {
return EnvEditor; return EnvEditor;
...@@ -117,10 +129,65 @@ CGUIAttributeEditor* CGUIEditWindow::getOptionEditor() const ...@@ -117,10 +129,65 @@ CGUIAttributeEditor* CGUIEditWindow::getOptionEditor() const
return OptionEditor; return OptionEditor;
} }
IGUITreeViewNode* CGUIEditWindow::getTreeNode(IGUIElement* element, IGUITreeViewNode* searchnode)
{
IGUITreeViewNode* child = searchnode->getFirstChild();
while (!child)
{
if (((IGUIElement*) child->getData()) == element)
return child;
if (child->hasChildren())
{
IGUITreeViewNode* foundnode = getTreeNode(element, child);
if (foundnode)
return foundnode;
}
child = child->getNextSibling();
}
return 0;
}
void CGUIEditWindow::addChildrenToTree(IGUIElement* parentElement, IGUITreeViewNode* treenode)
{
core::stringw name = core::stringw(parentElement->getTypeName());
if (parentElement->getID() != -1)
name += core::stringw(L" [") + core::stringw(parentElement->getID()) + core::stringw(L"]");
IGUITreeViewNode* newnode = treenode->addChildBack(name.c_str());
newnode->setData((void*)parentElement);
core::list<IGUIElement*> children = parentElement->getChildren();
for (core::list<IGUIElement*>::Iterator i = children.begin(); i != children.end(); i++ )
{
if(core::stringc((*i)->getTypeName()) != "GUIEditor" && !(*i)->isSubElement())
addChildrenToTree(*i, newnode);
}
}
void CGUIEditWindow::updateTree()
{
TreeView->getRoot()->clearChildren();
IGUIElement* root = Environment->getRootGUIElement();
addChildrenToTree(root, TreeView->getRoot());
TreeView->getRoot()->getFirstChild()->setExpanded(true);
}
void CGUIEditWindow::setSelectedElement(IGUIElement *sel) void CGUIEditWindow::setSelectedElement(IGUIElement *sel)
{ {
// save changes // save changes
AttribEditor->updateAttribs(); AttribEditor->updateAttribs();
IGUITreeViewNode* elementTreeNode = getTreeNode(sel, TreeView->getRoot());
if (elementTreeNode)
{
elementTreeNode->setSelected(true);
while (elementTreeNode)
{
elementTreeNode->setExpanded(true);
elementTreeNode = elementTreeNode->getParent();
}
}
io::IAttributes* Attribs = AttribEditor->getAttribs(); io::IAttributes* Attribs = AttribEditor->getAttribs();
...@@ -196,7 +263,6 @@ bool CGUIEditWindow::OnEvent(const SEvent &event) ...@@ -196,7 +263,6 @@ bool CGUIEditWindow::OnEvent(const SEvent &event)
{ {
case EMIE_LMOUSE_PRESSED_DOWN: case EMIE_LMOUSE_PRESSED_DOWN:
{ {
DragStart.X = event.MouseInput.X; DragStart.X = event.MouseInput.X;
DragStart.Y = event.MouseInput.Y; DragStart.Y = event.MouseInput.Y;
...@@ -284,10 +350,7 @@ void CGUIEditWindow::setDraggable(bool draggable) ...@@ -284,10 +350,7 @@ void CGUIEditWindow::setDraggable(bool draggable)
// but we don't need them so we'll just return null // but we don't need them so we'll just return null
//! Returns the rectangle of the drawable area (without border, without titlebar and without scrollbars) //! Returns the rectangle of the drawable area (without border, without titlebar and without scrollbars)
core::rect<s32> CGUIEditWindow::getClientRect() const core::rect<s32> CGUIEditWindow::getClientRect() const {return core::recti();}
{
return core::recti();
}
IGUIButton* CGUIEditWindow::getCloseButton() const {return 0;} IGUIButton* CGUIEditWindow::getCloseButton() const {return 0;}
IGUIButton* CGUIEditWindow::getMinimizeButton() const {return 0;} IGUIButton* CGUIEditWindow::getMinimizeButton() const {return 0;}
IGUIButton* CGUIEditWindow::getMaximizeButton() const {return 0;} IGUIButton* CGUIEditWindow::getMaximizeButton() const {return 0;}
...@@ -6,8 +6,10 @@ ...@@ -6,8 +6,10 @@
#include "CGUIAttributeEditor.h" #include "CGUIAttributeEditor.h"
//#include "IGUIStaticText.h" //#include "IGUIStaticText.h"
#include "IGUIButton.h" #include "IGUIButton.h"
#include "IGUITreeView.h"
#include "irrArray.h" #include "irrArray.h"
#include "IAttributes.h" #include "IAttributes.h"
#include "EGUIEditTypes.h"
namespace irr namespace irr
{ {
...@@ -47,16 +49,22 @@ namespace gui ...@@ -47,16 +49,22 @@ namespace gui
virtual void setDrawTitlebar(bool draw) { } virtual void setDrawTitlebar(bool draw) { }
virtual bool getDrawTitlebar() const { return true; } virtual bool getDrawTitlebar() const { return true; }
IGUITreeView* getTreeView() const;
CGUIAttributeEditor* getAttributeEditor() const; CGUIAttributeEditor* getAttributeEditor() const;
CGUIAttributeEditor* getOptionEditor() const; CGUIAttributeEditor* getOptionEditor() const;
CGUIAttributeEditor* getEnvironmentEditor() const; CGUIAttributeEditor* getEnvironmentEditor() const;
//! this shoudln't be serialized, but this is included as it's an example //! Returns the type name of the gui element.
virtual const c8* getTypeName() const { return "GUIEditWindow"; } virtual const c8* getTypeName() const
{
return GUIEditElementTypeNames[EGUIEDIT_GUIEDITWINDOW];
}
void updateTree();
private: private:
void addChildrenToTree(IGUIElement* parentElement, IGUITreeViewNode* treenode);
IGUITreeViewNode* getTreeNode(IGUIElement* element, IGUITreeViewNode* searchnode);
// for dragging the window // for dragging the window
bool Dragging; bool Dragging;
bool IsDraggable; bool IsDraggable;
...@@ -68,6 +76,7 @@ namespace gui ...@@ -68,6 +76,7 @@ namespace gui
CGUIAttributeEditor* AttribEditor; // edits the current attribute CGUIAttributeEditor* AttribEditor; // edits the current attribute
CGUIAttributeEditor* OptionEditor; // edits the options for the window CGUIAttributeEditor* OptionEditor; // edits the options for the window
CGUIAttributeEditor* EnvEditor; // edits attributes for the environment CGUIAttributeEditor* EnvEditor; // edits attributes for the environment
IGUITreeView* TreeView; // tree view of all elements in scene
IGUIButton* ResizeButton; IGUIButton* ResizeButton;
}; };
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "CGUIEditWindow.h" #include "CGUIEditWindow.h"
#include "IGUIContextMenu.h" #include "IGUIContextMenu.h"
#include "IGUIFileOpenDialog.h" #include "IGUIFileOpenDialog.h"
#include "IGUITreeView.h"
#include "CGUIAttribute.h" #include "CGUIAttribute.h"
#include "CMemoryReadWriteFile.h" #include "CMemoryReadWriteFile.h"
...@@ -237,6 +238,7 @@ bool CGUIEditWorkspace::OnEvent(const SEvent &e) ...@@ -237,6 +238,7 @@ bool CGUIEditWorkspace::OnEvent(const SEvent &e)
if (SelectedElement) if (SelectedElement)
{ {
SelectedElement->deserializeAttributes(EditorWindow->getAttributeEditor()->getAttribs()); SelectedElement->deserializeAttributes(EditorWindow->getAttributeEditor()->getAttribs());
EditorWindow->updateTree();
} }
return true; return true;
} }
...@@ -268,6 +270,7 @@ bool CGUIEditWorkspace::OnEvent(const SEvent &e) ...@@ -268,6 +270,7 @@ bool CGUIEditWorkspace::OnEvent(const SEvent &e)
setSelectedElement(0); setSelectedElement(0);
MouseOverElement = 0; MouseOverElement = 0;
el->remove(); el->remove();
EditorWindow->updateTree();
} }
break; break;
case KEY_KEY_X: case KEY_KEY_X:
...@@ -570,6 +573,13 @@ bool CGUIEditWorkspace::OnEvent(const SEvent &e) ...@@ -570,6 +573,13 @@ bool CGUIEditWorkspace::OnEvent(const SEvent &e)
case EET_GUI_EVENT: case EET_GUI_EVENT:
switch(e.GUIEvent.EventType) switch(e.GUIEvent.EventType)
{ {
case EGET_TREEVIEW_NODE_SELECT:
{
IGUITreeViewNode* eventnode = ((IGUITreeView*)e.GUIEvent.Caller)->getLastEventNode();
if(!eventnode->isRoot())
setSelectedElement((IGUIElement*)(eventnode->getData()));
break;
}
// load a gui file // load a gui file
case EGET_FILE_SELECTED: case EGET_FILE_SELECTED:
dialog = (IGUIFileOpenDialog*)e.GUIEvent.Caller; dialog = (IGUIFileOpenDialog*)e.GUIEvent.Caller;
...@@ -639,6 +649,7 @@ bool CGUIEditWorkspace::OnEvent(const SEvent &e) ...@@ -639,6 +649,7 @@ bool CGUIEditWorkspace::OnEvent(const SEvent &e)
break; break;
case EGUIEDMC_SAVE_ELEMENT: case EGUIEDMC_SAVE_ELEMENT:
//TODO: add 'save' dialog.
Environment->saveGUI("guiTest.xml", SelectedElement ? SelectedElement : Environment->getRootGUIElement() ); Environment->saveGUI("guiTest.xml", SelectedElement ? SelectedElement : Environment->getRootGUIElement() );
break; break;
...@@ -678,6 +689,7 @@ bool CGUIEditWorkspace::OnEvent(const SEvent &e) ...@@ -678,6 +689,7 @@ bool CGUIEditWorkspace::OnEvent(const SEvent &e)
} }
break; break;
} }
EditorWindow->updateTree();
} }
return true; return true;
default: default:
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "IGUIElement.h" #include "IGUIElement.h"
#include "CGUIEditWindow.h" #include "CGUIEditWindow.h"
#include "EGUIEditTypes.h"
namespace irr namespace irr
{ {
...@@ -80,8 +81,10 @@ namespace gui ...@@ -80,8 +81,10 @@ namespace gui
//! copies the xml of the selected element and all children to the clipboard //! copies the xml of the selected element and all children to the clipboard
virtual void PasteXMLToSelectedElement(); virtual void PasteXMLToSelectedElement();
//! this shoudln't be serialized, but this is included as it's an example virtual const c8* getTypeName() const
virtual const c8* getTypeName() const { return "GUIEditor"; } {
return GUIEditElementTypeNames[EGUIEDIT_GUIEDIT];
}
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0); virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0);
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0); virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0);
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "CGUIAttribute.h" #include "CGUIAttribute.h"
#include "IGUIComboBox.h" #include "IGUIComboBox.h"
#include "IGUIEditBox.h" #include "IGUIEditBox.h"
#include "EGUIEditTypes.h"
namespace irr namespace irr
{ {
...@@ -95,8 +96,11 @@ namespace gui ...@@ -95,8 +96,11 @@ namespace gui
return CGUIAttribute::updateAttrib(sendEvent); return CGUIAttribute::updateAttrib(sendEvent);
} }
//! this shoudln't be serialized, but this is included as it's an example //! Returns the type name of the gui element.
virtual const c8* getTypeName() const { return "enum_attribute"; } virtual const c8* getTypeName() const
{
return GUIEditElementTypeNames[EGUIEDIT_ENUMATTRIBUTE];
}
private: private:
IGUIComboBox* AttribComboBox; IGUIComboBox* AttribComboBox;
......
...@@ -20,7 +20,7 @@ namespace irr ...@@ -20,7 +20,7 @@ namespace irr
namespace gui namespace gui
{ {
CGUIPanel::CGUIPanel( IGUIEnvironment* environment, IGUIElement* parent, s32 id, const core::rect<s32>& rectangle, CGUIPanel::CGUIPanel(IGUIEnvironment* environment, IGUIElement* parent, s32 id, const core::rect<s32>& rectangle,
bool border, E_SCROLL_BAR_MODE vMode, E_SCROLL_BAR_MODE hMode) bool border, E_SCROLL_BAR_MODE vMode, E_SCROLL_BAR_MODE hMode)
: IGUIElement(EGUIET_ELEMENT, environment, parent, id, rectangle), : IGUIElement(EGUIET_ELEMENT, environment, parent, id, rectangle),
VScrollBar(0), HScrollBar(0), ClipPane(0), InnerPane(0), VScrollBar(0), HScrollBar(0), ClipPane(0), InnerPane(0),
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define _C_GUI_PANEL_H_ #define _C_GUI_PANEL_H_
#include "IGUIElement.h" #include "IGUIElement.h"
#include "EGUIEditTypes.h"
namespace irr namespace irr
{ {
...@@ -93,6 +94,12 @@ public: ...@@ -93,6 +94,12 @@ public:
//! returns children of the inner pane //! returns children of the inner pane
virtual const core::list<IGUIElement*>& getChildren(); virtual const core::list<IGUIElement*>& getChildren();
//! Returns the type name of the gui element.
virtual const c8* getTypeName() const
{
return GUIEditElementTypeNames[EGUIEDIT_GUIPANEL];
}
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0); virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0);
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0); virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0);
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include "CGUIAttribute.h" #include "CGUIAttribute.h"
#include "IGUIEditBox.h" #include "IGUIEditBox.h"
#include "EGUIEditTypes.h"
namespace irr namespace irr
{ {
...@@ -53,8 +54,11 @@ namespace gui ...@@ -53,8 +54,11 @@ namespace gui
return CGUIAttribute::updateAttrib(sendEvent); return CGUIAttribute::updateAttrib(sendEvent);
} }
//! this shoudln't be serialized, but this is included as it's an example //! Returns the type name of the gui element.
virtual const c8* getTypeName() const { return "string_attribute"; } virtual const c8* getTypeName() const
{
return GUIEditElementTypeNames[EGUIEDIT_STRINGATTRIBUTE];
}
private: private:
IGUIEditBox* AttribEditBox; IGUIEditBox* AttribEditBox;
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "IGUIEditBox.h" #include "IGUIEditBox.h"
#include "IGUIImage.h" #include "IGUIImage.h"
#include "IGUIButton.h" #include "IGUIButton.h"
#include "EGUIEditTypes.h"
namespace irr namespace irr
{ {
...@@ -121,8 +122,11 @@ namespace gui ...@@ -121,8 +122,11 @@ namespace gui
return CGUIAttribute::updateAttrib(sendEvent); return CGUIAttribute::updateAttrib(sendEvent);
} }
//! this shoudln't be serialized, but this is included as it's an example //! Returns the type name of the gui element.
virtual const c8* getTypeName() const { return "texture_attribute"; } virtual const c8* getTypeName() const
{
return GUIEditElementTypeNames[EGUIEDIT_TEXTUREATTRIBUTE];
}
private: private:
IGUIEditBox* AttribEditBox; IGUIEditBox* AttribEditBox;
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "IGUIWindow.h" #include "IGUIWindow.h"
#include "CGUIPanel.h" #include "CGUIPanel.h"
#include "IGUIImage.h" #include "IGUIImage.h"
#include "EGUIEditTypes.h"
namespace irr namespace irr
{ {
......
#ifndef __C_GUIEDIT_TYPES_H_INCLUDED__
#define __C_GUIEDIT_TYPES_H_INCLUDED__
#include "irrTypes.h"
namespace irr {
namespace gui {
enum EGUIEDIT_ELEMENT_TYPES
{
// GUI Editor
EGUIEDIT_GUIEDIT=0,
EGUIEDIT_GUIEDITWINDOW,
// Generic
EGUIEDIT_GUIPANEL,
EGUIEDIT_TEXTUREBROWSER,
// Attribute editors
EGUIEDIT_ATTRIBUTEEDITOR,
EGUIEDIT_STRINGATTRIBUTE,
EGUIEDIT_BOOLATTRIBUTE,
EGUIEDIT_ENUMATTRIBUTE,
EGUIEDIT_COLORATTRIBUTE,
EGUIEDIT_COLORFATTRIBUTE,
EGUIEDIT_TEXTUREATTRIBUTE,
// Dummy editor stubs
EGUIEDIT_CONTEXTMENUEDITOR,
EGUIEDIT_MENUEDITOR,
EGUIEDIT_FILEDIALOGEDITOR,
EGUIEDIT_COLORDIALOGEDITOR,
EGUIEDIT_MODALSCREENEDITOR,
// Count
EGUIEDIT_COUNT
};
const c8* const GUIEditElementTypeNames[] =
{
"GUIEditor",
"GUIEditWindow",
"panel",
"textureCacheBrowser",
"attributeEditor",
"string_attribute",
"bool_attribute",
"enum_attribute",
"color_attribute",
"colorf_attribute",
"texture_attribute",
// dummy editors
"contextMenu_editor",
"menu_editor",
"fileOpenDialog_editor",
"colorSelectDialog_editor",
"modalScreen_editor",
0
};
} // gui
} // irr
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment