Changed parent handling in GUI loader.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2091 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
ebb184024e
commit
7ed594d039
|
@ -75,7 +75,7 @@ public:
|
|||
virtual bool setFocus(IGUIElement* element) = 0;
|
||||
|
||||
//! Returns the element which holds the focus.
|
||||
//! \return Pointer to the element with focus.
|
||||
/** \return Pointer to the element with focus. */
|
||||
virtual IGUIElement* getFocus() const = 0;
|
||||
|
||||
//! Removes the focus from an element.
|
||||
|
@ -91,15 +91,15 @@ public:
|
|||
virtual bool hasFocus(IGUIElement* element) const = 0;
|
||||
|
||||
//! Returns the current video driver.
|
||||
//! \return Pointer to the video driver.
|
||||
/** \return Pointer to the video driver. */
|
||||
virtual video::IVideoDriver* getVideoDriver() const = 0;
|
||||
|
||||
//! Returns the file system.
|
||||
//! \return Pointer to the file system.
|
||||
/** \return Pointer to the file system. */
|
||||
virtual io::IFileSystem* getFileSystem() const = 0;
|
||||
|
||||
//! returns a pointer to the OS operator
|
||||
//! \return Pointer to the OS operator.
|
||||
/** \return Pointer to the OS operator. */
|
||||
virtual IOSOperator* getOSOperator() const = 0;
|
||||
|
||||
//! Removes all elements from the environment.
|
||||
|
@ -119,7 +119,7 @@ public:
|
|||
virtual void setUserEventReceiver(IEventReceiver* evr) = 0;
|
||||
|
||||
//! Returns pointer to the current gui skin.
|
||||
//! \return Pointer to the GUI skin.
|
||||
/** \return Pointer to the GUI skin. */
|
||||
virtual IGUISkin* getSkin() const = 0;
|
||||
|
||||
//! Sets a new GUI Skin
|
||||
|
@ -208,10 +208,10 @@ public:
|
|||
virtual IGUIWindow* addWindow(const core::rect<s32>& rectangle, bool modal = false,
|
||||
const wchar_t* text=0, IGUIElement* parent=0, s32 id=-1) = 0;
|
||||
|
||||
//! Adds a modal screen. This control stops its parent's members from
|
||||
//! being able to recieve input until its last child is removed, it
|
||||
//! then deletes itself.
|
||||
/** \param parent Parent gui element of the modal.
|
||||
//! Adds a modal screen.
|
||||
/** This control stops its parent's members from being able to recieve
|
||||
input until its last child is removed, it then deletes itself.
|
||||
\param parent Parent gui element of the modal.
|
||||
\return Pointer to the created modal. Returns 0 if an error occured.
|
||||
This pointer should not be dropped. See IReferenceCounted::drop() for
|
||||
more information. */
|
||||
|
@ -434,7 +434,7 @@ public:
|
|||
IGUIElement* parent=0, s32 id=-1) = 0;
|
||||
|
||||
//! Adds a menu to the environment.
|
||||
/* This is like the menu you can find on top of most windows in modern
|
||||
/** This is like the menu you can find on top of most windows in modern
|
||||
graphical user interfaces.
|
||||
\param parent Parent item of the element, e.g. a window.
|
||||
Set it to 0 to place the menu directly in the environment.
|
||||
|
@ -467,6 +467,14 @@ public:
|
|||
IGUIElement* parent=0, s32 id=-1) = 0;
|
||||
|
||||
//! Adds a table to the environment
|
||||
/** \param rectangle Position and dimension of the table.
|
||||
\param parent Parent item of the element, e.g. a window. Set it to 0
|
||||
to place the element directly in the environment.
|
||||
\param id An identifier for the table.
|
||||
\param drawBackground Flag whether the background should be drawn.
|
||||
\return Pointer to the created table. Returns 0 if an error occured.
|
||||
This pointer should not be dropped. See IReferenceCounted::drop() for
|
||||
more information. */
|
||||
virtual IGUITable* addTable(const core::rect<s32>& rectangle,
|
||||
IGUIElement* parent=0, s32 id=-1, bool drawBackground = false) = 0;
|
||||
|
||||
|
@ -484,7 +492,7 @@ public:
|
|||
virtual void registerGUIElementFactory(IGUIElementFactory* factoryToAdd) = 0;
|
||||
|
||||
//! Returns amount of registered gui element factories.
|
||||
//! \return Amount of registered gui element factories.
|
||||
/** \return Amount of registered gui element factories. */
|
||||
virtual u32 getRegisteredGUIElementFactoryCount() const = 0;
|
||||
|
||||
//! Returns a gui element factory by index
|
||||
|
@ -494,23 +502,23 @@ public:
|
|||
virtual IGUIElement* addGUIElement(const c8* elementName, IGUIElement* parent=0) = 0;
|
||||
|
||||
//! Saves the current gui into a file.
|
||||
//! \param filename Name of the file.
|
||||
//! \param start The GUIElement to start with. Root if 0.
|
||||
/** \param filename Name of the file.
|
||||
\param start The GUIElement to start with. Root if 0. */
|
||||
virtual bool saveGUI(const c8* filename, IGUIElement* start=0) = 0;
|
||||
|
||||
//! Saves the current gui into a file.
|
||||
//! \param file The file to write to.
|
||||
//! \param start The GUIElement to start with. Root if 0.
|
||||
/** \param file The file to write to.
|
||||
\param start The GUIElement to start with. Root if 0. */
|
||||
virtual bool saveGUI(io::IWriteFile* file, IGUIElement* start=0) = 0;
|
||||
|
||||
//! Loads the gui. Note that the current gui is not cleared before.
|
||||
//! \param filename Name of the file .
|
||||
//! \param parent Parent for the loaded GUI, root if 0.
|
||||
/** \param filename Name of the file.
|
||||
\param parent Parent for the loaded GUI, root if 0. */
|
||||
virtual bool loadGUI(const c8* filename, IGUIElement* parent=0) = 0;
|
||||
|
||||
//! Loads the gui. Note that the current gui is not cleared before.
|
||||
//! \param file The file to load from.
|
||||
//! \param parent Parent for the loaded GUI, root if 0.
|
||||
/** \param file The file to load from.
|
||||
\param parent Parent for the loaded GUI, root if 0. */
|
||||
virtual bool loadGUI(io::IReadFile* file, IGUIElement* parent=0) = 0;
|
||||
|
||||
//! Writes attributes of the gui environment
|
||||
|
@ -523,7 +531,7 @@ public:
|
|||
virtual void writeGUIElement(io::IXMLWriter* writer, IGUIElement* node) =0;
|
||||
|
||||
//! reads an element
|
||||
virtual void readGUIElement(io::IXMLReader* reader, IGUIElement* parent) =0;
|
||||
virtual void readGUIElement(io::IXMLReader* reader, IGUIElement* node) =0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -747,28 +747,27 @@ bool CGUIEnvironment::loadGUI(io::IReadFile* file, IGUIElement* parent)
|
|||
|
||||
|
||||
//! reads an element
|
||||
void CGUIEnvironment::readGUIElement(io::IXMLReader* reader, IGUIElement* parent)
|
||||
void CGUIEnvironment::readGUIElement(io::IXMLReader* reader, IGUIElement* node)
|
||||
{
|
||||
if (!reader)
|
||||
return;
|
||||
|
||||
gui::IGUIElement* node = 0;
|
||||
|
||||
io::EXML_NODE nodeType = reader->getNodeType();
|
||||
|
||||
if (nodeType == io::EXN_NONE || nodeType == io::EXN_UNKNOWN || nodeType == io::EXN_ELEMENT_END)
|
||||
return;
|
||||
|
||||
if (!parent && !wcscmp(IRR_XML_FORMAT_GUI_ENV, reader->getNodeName()))
|
||||
if (!wcscmp(IRR_XML_FORMAT_GUI_ENV, reader->getNodeName()))
|
||||
{
|
||||
node = this; // root
|
||||
if (!node)
|
||||
node = this; // root
|
||||
}
|
||||
else if (!wcscmp(IRR_XML_FORMAT_GUI_ELEMENT, reader->getNodeName()))
|
||||
{
|
||||
// find node type and create it
|
||||
core::stringc attrName = reader->getAttributeValue(IRR_XML_FORMAT_GUI_ELEMENT_ATTR_TYPE);
|
||||
const core::stringc attrName = reader->getAttributeValue(IRR_XML_FORMAT_GUI_ELEMENT_ATTR_TYPE);
|
||||
|
||||
node = addGUIElement(attrName.c_str(), parent);
|
||||
node = addGUIElement(attrName.c_str(), node);
|
||||
|
||||
if (!node)
|
||||
os::Printer::log("Could not create GUI element of unknown type", attrName.c_str());
|
||||
|
|
|
@ -233,7 +233,7 @@ public:
|
|||
virtual void writeGUIElement(io::IXMLWriter* writer, IGUIElement* node);
|
||||
|
||||
//! reads an element
|
||||
virtual void readGUIElement(io::IXMLReader* reader, IGUIElement* parent);
|
||||
virtual void readGUIElement(io::IXMLReader* reader, IGUIElement* node);
|
||||
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in New Issue