Merging r6196 through r6248 from trunk to ogl-es branch

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@6249 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien
2021-08-26 21:57:27 +00:00
committed by sfan5
parent c26ff3476f
commit 9690c1b3e3
56 changed files with 3123 additions and 245 deletions

View File

@ -14,7 +14,6 @@
#include "IGUIFont.h"
#include "IGUIStaticText.h"
#include "IAttributes.h"
#include "CGUIEditWorkspace.h"
namespace irr
{

View File

@ -6,7 +6,6 @@
#include "IAttributes.h"
#include "IGUIFont.h"
#include "IGUIScrollBar.h"
#include "CGUIEditWorkspace.h"
#include "CGUIAttribute.h"
#include "CGUIStringAttribute.h"

View File

@ -598,9 +598,14 @@ bool CGUIEditWorkspace::OnEvent(const SEvent &e)
}
// load a gui file
case EGET_FILE_SELECTED:
{
dialog = (IGUIFileOpenDialog*)e.GUIEvent.Caller;
Environment->loadGUI(core::stringc(dialog->getFileName()).c_str());
core::stringc guiFilename(core::stringc(dialog->getFileName()).c_str());
clearParentElements();
Environment->loadGUI(guiFilename, Parent);
EditorWindow->updateTree();
break;
}
case EGET_MENU_ITEM_SELECTED:
{
@ -614,18 +619,7 @@ bool CGUIEditWorkspace::OnEvent(const SEvent &e)
//! file commands
case EGUIEDMC_FILE_NEW:
// clear all elements belonging to our parent
setSelectedElement(0);
MouseOverElement = 0;
el = Parent;
grab();
// remove all children
while(Children.end() != el->getChildren().begin())
el->removeChild(*(el->getChildren().begin()));
// attach to parent again
el->addChild(this);
drop();
clearParentElements();
break;
case EGUIEDMC_FILE_LOAD:
Environment->addFileOpenDialog(L"Please select a GUI file to open", false, this);
@ -843,10 +837,31 @@ void CGUIEditWorkspace::removeChild(IGUIElement* child)
{
IGUIElement::removeChild(child);
// TODO: Can anyone find out why the workspace removes itself when it has no more children
// and document it here?
if (Children.empty())
remove();
}
void CGUIEditWorkspace::clearParentElements()
{
setSelectedElement(0);
MouseOverElement = 0;
IGUIElement * el = Parent;
grab();
if ( el->isMyChild(Environment->getFocus()) )
Environment->setFocus(0);
while (!el->getChildren().empty())
{
el->removeChild(*(el->getChildren().begin()));
}
el->addChild(this);
drop();
}
void CGUIEditWorkspace::updateAbsolutePosition()
{

View File

@ -46,6 +46,9 @@ namespace gui
//! Removes a child.
virtual void removeChild(IGUIElement* child);
//! Remove all gui elements from parent except this one
virtual void clearParentElements();
//! draws the element and its children
virtual void draw();