Add IGUIEnvironment::addToDeletionQueue to allow save removal of gui elements while iterating over them

Basically same as ISceneManager::addToDeletionQueue.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6164 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien
2020-12-09 16:26:25 +00:00
parent 0368c5b09d
commit bd2b44aa1c
4 changed files with 48 additions and 2 deletions

View File

@ -623,10 +623,10 @@ public:
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)=0;
//! writes an element
virtual void writeGUIElement(io::IXMLWriter* writer, IGUIElement* node) =0;
virtual void writeGUIElement(io::IXMLWriter* writer, IGUIElement* element) =0;
//! reads an element
virtual void readGUIElement(io::IXMLReader* reader, IGUIElement* node) =0;
virtual void readGUIElement(io::IXMLReader* reader, IGUIElement* element) =0;
//! Find the next element which would be selected when pressing the tab-key
/** If you set the focus for the result you can manually force focus-changes like they
@ -646,6 +646,17 @@ public:
//! Get the way the gui does handle focus changes
/** \returns A bitmask which is a combination of ::EFOCUS_FLAG flags.*/
virtual u32 getFocusBehavior() const = 0;
//! Adds a IGUIElement to deletion queue.
/** Queued elements will be removed at the end of each drawAll call.
Or latest in the destructor of the GUIEnvironment.
This can be used to allow an element removing itself safely in a function
iterating over gui elements, like an overloaded IGUIElement::draw or
IGUIElement::OnPostRender function.
Note that in general just calling IGUIElement::remove() is enough.
Unless you create your own GUI elements removing themselves you won't need it.
\param element: Element to remove */
virtual void addToDeletionQueue(IGUIElement* element) = 0;
};