]> git.lizzy.rs Git - irrlicht.git/blobdiff - source/Irrlicht/CGUIEnvironment.cpp
Drop _IRR_COMPILE_WITH_GUI_
[irrlicht.git] / source / Irrlicht / CGUIEnvironment.cpp
index e29195b2c3ff181c9f7e652d0aa7758648db032e..a7b280427c01d9b44289944f694301627579e09b 100644 (file)
@@ -5,43 +5,27 @@
 \r
 #include "CGUIEnvironment.h"\r
 \r
-#ifdef _IRR_COMPILE_WITH_GUI_\r
-\r
 #include "IVideoDriver.h"\r
 \r
 #include "CGUISkin.h"\r
 #include "CGUIButton.h"\r
-#include "CGUIWindow.h"\r
 #include "CGUIScrollBar.h"\r
 #include "CGUIFont.h"\r
 #include "CGUISpriteBank.h"\r
 #include "CGUIImage.h"\r
-#include "CGUIMeshViewer.h"\r
 #include "CGUICheckBox.h"\r
 #include "CGUIListBox.h"\r
-#include "CGUITreeView.h"\r
 #include "CGUIImageList.h"\r
 #include "CGUIFileOpenDialog.h"\r
-#include "CGUIColorSelectDialog.h"\r
 #include "CGUIStaticText.h"\r
 #include "CGUIEditBox.h"\r
-#include "CGUISpinBox.h"\r
-#include "CGUIInOutFader.h"\r
-#include "CGUIMessageBox.h"\r
-#include "CGUIModalScreen.h"\r
 #include "CGUITabControl.h"\r
-#include "CGUIContextMenu.h"\r
 #include "CGUIComboBox.h"\r
-#include "CGUIMenu.h"\r
-#include "CGUIToolBar.h"\r
-#include "CGUITable.h"\r
-#include "CGUIProfiler.h"\r
 \r
-#include "CDefaultGUIElementFactory.h"\r
 #include "IWriteFile.h"\r
-#include "IXMLWriter.h"\r
-\r
+#ifdef IRR_ENABLE_BUILTIN_FONT\r
 #include "BuiltInFont.h"\r
+#endif\r
 #include "os.h"\r
 \r
 namespace irr\r
@@ -49,10 +33,6 @@ namespace irr
 namespace gui\r
 {\r
 \r
-const wchar_t IRR_XML_FORMAT_GUI_ENV[]                 = L"irr_gui";\r
-const wchar_t IRR_XML_FORMAT_GUI_ELEMENT[]             = L"element";\r
-const wchar_t IRR_XML_FORMAT_GUI_ELEMENT_ATTR_TYPE[]   = L"type";\r
-\r
 const io::path CGUIEnvironment::DefaultFontName = "#DefaultFont";\r
 \r
 //! constructor\r
@@ -74,11 +54,6 @@ CGUIEnvironment::CGUIEnvironment(io::IFileSystem* fs, video::IVideoDriver* drive
        IGUIEnvironment::setDebugName("CGUIEnvironment");\r
        #endif\r
 \r
-       // gui factory\r
-       IGUIElementFactory* factory = new CDefaultGUIElementFactory(this);\r
-       registerGUIElementFactory(factory);\r
-       factory->drop();\r
-\r
        loadBuiltInFont();\r
 \r
        IGUISkin* skin = createSkin( gui::EGST_WINDOWS_METALLIC );\r
@@ -101,6 +76,8 @@ CGUIEnvironment::CGUIEnvironment(io::IFileSystem* fs, video::IVideoDriver* drive
 //! destructor\r
 CGUIEnvironment::~CGUIEnvironment()\r
 {\r
+       clearDeletionQueue();\r
+\r
        if ( HoveredNoSubelement && HoveredNoSubelement != this )\r
        {\r
                HoveredNoSubelement->drop();\r
@@ -143,10 +120,6 @@ CGUIEnvironment::~CGUIEnvironment()
        for (i=0; i<Fonts.size(); ++i)\r
                Fonts[i].Font->drop();\r
 \r
-       // remove all factories\r
-       for (i=0; i<GUIElementFactoryList.size(); ++i)\r
-               GUIElementFactoryList[i]->drop();\r
-\r
        if (Operator)\r
        {\r
                Operator->drop();\r
@@ -169,6 +142,7 @@ CGUIEnvironment::~CGUIEnvironment()
 \r
 void CGUIEnvironment::loadBuiltInFont()\r
 {\r
+#ifdef IRR_ENABLE_BUILTIN_FONT\r
        io::IReadFile* file = FileSystem->createMemoryReadFile(BuiltInFontData,\r
                                BuiltInFontDataSize, DefaultFontName, false);\r
 \r
@@ -187,23 +161,23 @@ void CGUIEnvironment::loadBuiltInFont()
        Fonts.push_back(f);\r
 \r
        file->drop();\r
+#endif\r
 }\r
 \r
 \r
 //! draws all gui elements\r
-void CGUIEnvironment::drawAll()\r
+void CGUIEnvironment::drawAll(bool useScreenSize)\r
 {\r
-       if (Driver)\r
+       if (useScreenSize && Driver)\r
        {\r
                core::dimension2d<s32> dim(Driver->getScreenSize());\r
                if (AbsoluteRect.LowerRightCorner.X != dim.Width ||\r
-                       AbsoluteRect.LowerRightCorner.Y != dim.Height)\r
+                       AbsoluteRect.UpperLeftCorner.X != 0 ||\r
+                       AbsoluteRect.LowerRightCorner.Y != dim.Height ||\r
+                       AbsoluteRect.UpperLeftCorner.Y != 0\r
+                       )\r
                {\r
-                       // resize gui environment\r
-                       DesiredRect.LowerRightCorner = dim;\r
-                       AbsoluteClippingRect = DesiredRect;\r
-                       AbsoluteRect = DesiredRect;\r
-                       updateAbsolutePosition();\r
+                       setRelativePosition(core::recti(0,0,dim.Width, dim.Height));\r
                }\r
        }\r
 \r
@@ -213,6 +187,8 @@ void CGUIEnvironment::drawAll()
 \r
        draw();\r
        OnPostRender ( os::Timer::getTime () );\r
+\r
+       clearDeletionQueue();\r
 }\r
 \r
 \r
@@ -389,11 +365,7 @@ void CGUIEnvironment::clear()
                HoveredNoSubelement = 0;\r
        }\r
 \r
-       // get the root's children in case the root changes in future\r
-       const core::list<IGUIElement*>& children = getRootGUIElement()->getChildren();\r
-\r
-       while (!children.empty())\r
-               (*children.getLast())->remove();\r
+       getRootGUIElement()->removeAllChildren();\r
 }\r
 \r
 \r
@@ -471,6 +443,28 @@ void CGUIEnvironment::OnPostRender( u32 time )
        IGUIElement::OnPostRender ( time );\r
 }\r
 \r
+void CGUIEnvironment::addToDeletionQueue(IGUIElement* element)\r
+{\r
+       if (!element)\r
+               return;\r
+\r
+       element->grab();\r
+       DeletionQueue.push_back(element);\r
+}\r
+\r
+void CGUIEnvironment::clearDeletionQueue()\r
+{\r
+       if (DeletionQueue.empty())\r
+               return;\r
+\r
+       for (u32 i=0; i<DeletionQueue.size(); ++i)\r
+       {\r
+               DeletionQueue[i]->remove();\r
+               DeletionQueue[i]->drop();\r
+       }\r
+\r
+       DeletionQueue.clear();\r
+}\r
 \r
 //\r
 void CGUIEnvironment::updateHoveredElement(core::position2d<s32> mousePos)\r
@@ -617,8 +611,8 @@ bool CGUIEnvironment::postEventFromUser(const SEvent& event)
 \r
                        // For keys we handle the event before changing focus to give elements the chance for catching the TAB\r
                        // Send focus changing event\r
+                       // CAREFUL when changing - there's an identical check in CGUIModalScreen::OnEvent\r
                        if (FocusFlags & EFF_SET_ON_TAB &&\r
-                               event.EventType == EET_KEY_INPUT_EVENT &&\r
                                event.KeyInput.PressedDown &&\r
                                event.KeyInput.Key == KEY_TAB)\r
                        {\r
@@ -631,6 +625,10 @@ bool CGUIEnvironment::postEventFromUser(const SEvent& event)
                        }\r
                }\r
                break;\r
+       case EET_STRING_INPUT_EVENT:\r
+               if (Focus && Focus->OnEvent(event))\r
+                       return true;\r
+               break;\r
        default:\r
                break;\r
        } // end switch\r
@@ -687,327 +685,6 @@ IGUISkin* CGUIEnvironment::createSkin(EGUI_SKIN_TYPE type)
 }\r
 \r
 \r
-//! Returns the default element factory which can create all built in elements\r
-IGUIElementFactory* CGUIEnvironment::getDefaultGUIElementFactory() const\r
-{\r
-       return getGUIElementFactory(0);\r
-}\r
-\r
-\r
-//! Adds an element factory to the gui environment.\r
-/** Use this to extend the gui environment with new element types which it should be\r
-able to create automatically, for example when loading data from xml files. */\r
-void CGUIEnvironment::registerGUIElementFactory(IGUIElementFactory* factoryToAdd)\r
-{\r
-       if (factoryToAdd)\r
-       {\r
-               factoryToAdd->grab();\r
-               GUIElementFactoryList.push_back(factoryToAdd);\r
-       }\r
-}\r
-\r
-\r
-//! Returns amount of registered scene node factories.\r
-u32 CGUIEnvironment::getRegisteredGUIElementFactoryCount() const\r
-{\r
-       return GUIElementFactoryList.size();\r
-}\r
-\r
-\r
-//! Returns a scene node factory by index\r
-IGUIElementFactory* CGUIEnvironment::getGUIElementFactory(u32 index) const\r
-{\r
-       if (index < GUIElementFactoryList.size())\r
-               return GUIElementFactoryList[index];\r
-       else\r
-               return 0;\r
-}\r
-\r
-\r
-//! adds a GUI Element using its name\r
-IGUIElement* CGUIEnvironment::addGUIElement(const c8* elementName, IGUIElement* parent)\r
-{\r
-       IGUIElement* node=0;\r
-\r
-       if (!parent)\r
-               parent = this;\r
-\r
-       for (s32 i=GUIElementFactoryList.size()-1; i>=0 && !node; --i)\r
-               node = GUIElementFactoryList[i]->addGUIElement(elementName, parent);\r
-\r
-\r
-       return node;\r
-}\r
-\r
-\r
-//! Saves the current gui into a file.\r
-//! \param filename: Name of the file .\r
-bool CGUIEnvironment::saveGUI(const io::path& filename, IGUIElement* start)\r
-{\r
-       io::IWriteFile* file = FileSystem->createAndWriteFile(filename);\r
-       if (!file)\r
-       {\r
-               return false;\r
-       }\r
-\r
-       bool ret = saveGUI(file, start);\r
-       file->drop();\r
-       return ret;\r
-}\r
-\r
-\r
-//! Saves the current gui into a file.\r
-bool CGUIEnvironment::saveGUI(io::IWriteFile* file, IGUIElement* start)\r
-{\r
-       if (!file)\r
-       {\r
-               return false;\r
-       }\r
-\r
-       io::IXMLWriter* writer = FileSystem->createXMLWriter(file);\r
-       if (!writer)\r
-       {\r
-               return false;\r
-       }\r
-\r
-       writer->writeXMLHeader();\r
-       writeGUIElement(writer, start ? start : this);\r
-       writer->drop();\r
-\r
-       return true;\r
-}\r
-\r
-\r
-//! Loads the gui. Note that the current gui is not cleared before.\r
-//! \param filename: Name of the file.\r
-bool CGUIEnvironment::loadGUI(const io::path& filename, IGUIElement* parent)\r
-{\r
-       io::IReadFile* read = FileSystem->createAndOpenFile(filename);\r
-       if (!read)\r
-       {\r
-               os::Printer::log("Unable to open gui file", filename, ELL_ERROR);\r
-               return false;\r
-       }\r
-\r
-       bool ret = loadGUI(read, parent);\r
-       read->drop();\r
-\r
-       return ret;\r
-}\r
-\r
-\r
-//! Loads the gui. Note that the current gui is not cleared before.\r
-bool CGUIEnvironment::loadGUI(io::IReadFile* file, IGUIElement* parent)\r
-{\r
-       if (!file)\r
-       {\r
-               os::Printer::log("Unable to open GUI file", ELL_ERROR);\r
-               return false;\r
-       }\r
-\r
-       io::IXMLReader* reader = FileSystem->createXMLReader(file);\r
-       if (!reader)\r
-       {\r
-               os::Printer::log("GUI is not a valid XML file", file->getFileName(), ELL_ERROR);\r
-               return false;\r
-       }\r
-\r
-       // read file\r
-       while(reader->read())\r
-       {\r
-               readGUIElement(reader, parent);\r
-       }\r
-\r
-       // finish up\r
-\r
-       reader->drop();\r
-       return true;\r
-}\r
-\r
-\r
-//! reads an element\r
-void CGUIEnvironment::readGUIElement(io::IXMLReader* reader, IGUIElement* node)\r
-{\r
-       if (!reader)\r
-               return;\r
-\r
-       io::EXML_NODE nodeType = reader->getNodeType();\r
-\r
-       if (nodeType == io::EXN_NONE || nodeType == io::EXN_UNKNOWN || nodeType == io::EXN_ELEMENT_END)\r
-               return;\r
-\r
-       IGUIElement* deferedNode = 0;\r
-       if (!wcscmp(IRR_XML_FORMAT_GUI_ENV, reader->getNodeName()))\r
-       {\r
-               // GuiEnvironment always must be this as it would serialize into a wrong element otherwise.\r
-               // So we use the given node next time\r
-               if ( node && node != this )\r
-                       deferedNode = node;\r
-               node = this; // root\r
-       }\r
-       else if (!wcscmp(IRR_XML_FORMAT_GUI_ELEMENT, reader->getNodeName()))\r
-       {\r
-               // find node type and create it\r
-               const core::stringc attrName = reader->getAttributeValue(IRR_XML_FORMAT_GUI_ELEMENT_ATTR_TYPE);\r
-\r
-               node = addGUIElement(attrName.c_str(), node);\r
-\r
-               if (!node)\r
-                       os::Printer::log("Could not create GUI element of unknown type", attrName.c_str());\r
-       }\r
-\r
-       // read attributes\r
-\r
-       while(reader->read())\r
-       {\r
-               bool endreached = false;\r
-\r
-               switch (reader->getNodeType())\r
-               {\r
-               case io::EXN_ELEMENT_END:\r
-                       if (!wcscmp(IRR_XML_FORMAT_GUI_ELEMENT,  reader->getNodeName()) ||\r
-                               !wcscmp(IRR_XML_FORMAT_GUI_ENV, reader->getNodeName()))\r
-                       {\r
-                               endreached = true;\r
-                       }\r
-                       break;\r
-               case io::EXN_ELEMENT:\r
-                       if (!wcscmp(L"attributes", reader->getNodeName()))\r
-                       {\r
-                               // read attributes\r
-                               io::IAttributes* attr = FileSystem->createEmptyAttributes(Driver);\r
-                               attr->read(reader, true);\r
-\r
-                               if (node)\r
-                                       node->deserializeAttributes(attr);\r
-\r
-                               attr->drop();\r
-                       }\r
-                       else\r
-                       if (!wcscmp(IRR_XML_FORMAT_GUI_ELEMENT, reader->getNodeName()) ||\r
-                               !wcscmp(IRR_XML_FORMAT_GUI_ENV, reader->getNodeName()))\r
-                       {\r
-                               if ( deferedNode )\r
-                                       readGUIElement(reader, deferedNode);\r
-                               else\r
-                                       readGUIElement(reader, node);\r
-                       }\r
-                       else\r
-                       {\r
-                               os::Printer::log("Found unknown element in irrlicht GUI file",\r
-                                               core::stringc(reader->getNodeName()).c_str());\r
-                       }\r
-\r
-                       break;\r
-               default:\r
-                       break;\r
-               }\r
-\r
-               if (endreached)\r
-                       break;\r
-       }\r
-}\r
-\r
-\r
-//! writes an element\r
-void CGUIEnvironment::writeGUIElement(io::IXMLWriter* writer, IGUIElement* node)\r
-{\r
-       if (!writer || !node )\r
-               return;\r
-\r
-       const wchar_t* name = 0;\r
-\r
-       // write properties\r
-\r
-       io::IAttributes* attr = FileSystem->createEmptyAttributes();\r
-       node->serializeAttributes(attr);\r
-\r
-       // all gui elements must have at least one attribute\r
-       // if they have nothing then we ignore them.\r
-       if (attr->getAttributeCount() != 0)\r
-       {\r
-               if (node == this)\r
-               {\r
-                       name = IRR_XML_FORMAT_GUI_ENV;\r
-                       writer->writeElement(name, false);\r
-               }\r
-               else\r
-               {\r
-                       name = IRR_XML_FORMAT_GUI_ELEMENT;\r
-                       writer->writeElement(name, false, IRR_XML_FORMAT_GUI_ELEMENT_ATTR_TYPE,\r
-                               core::stringw(node->getTypeName()).c_str());\r
-               }\r
-\r
-               writer->writeLineBreak();\r
-\r
-               attr->write(writer);\r
-       }\r
-\r
-       // write children\r
-\r
-       core::list<IGUIElement*>::ConstIterator it = node->getChildren().begin();\r
-       for (; it != node->getChildren().end(); ++it)\r
-       {\r
-               if (!(*it)->isSubElement())\r
-               {\r
-                       writer->writeLineBreak();\r
-                       writeGUIElement(writer, (*it));\r
-               }\r
-       }\r
-\r
-       // write closing brace if required\r
-       if (attr->getAttributeCount() != 0)\r
-       {\r
-               writer->writeClosingTag(name);\r
-               writer->writeLineBreak();\r
-       }\r
-\r
-       attr->drop();\r
-}\r
-\r
-\r
-//! Writes attributes of the environment\r
-void CGUIEnvironment::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const\r
-{\r
-       IGUISkin* skin = getSkin();\r
-\r
-       if (skin)\r
-       {\r
-               out->addEnum("Skin", getSkin()->getType(), GUISkinTypeNames);\r
-               skin->serializeAttributes(out, options);\r
-       }\r
-}\r
-\r
-\r
-//! Reads attributes of the environment\r
-void CGUIEnvironment::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)\r
-{\r
-       if (in->existsAttribute("Skin"))\r
-       {\r
-               IGUISkin *skin = getSkin();\r
-\r
-               EGUI_SKIN_TYPE t = (EGUI_SKIN_TYPE) in->getAttributeAsEnumeration("Skin",GUISkinTypeNames);\r
-               if ( !skin || t != skin->getType())\r
-               {\r
-                       skin = createSkin(t);\r
-                       setSkin(skin);\r
-                       skin->drop();\r
-               }\r
-\r
-               skin = getSkin();\r
-\r
-               if (skin)\r
-               {\r
-                       skin->deserializeAttributes(in, options);\r
-               }\r
-\r
-       }\r
-\r
-       RelativeRect = AbsoluteRect =\r
-                       core::rect<s32>(Driver ? core::dimension2di(Driver->getScreenSize()) : core::dimension2d<s32>(0,0));\r
-}\r
-\r
-\r
 //! adds a button. The returned pointer must not be dropped.\r
 IGUIButton* CGUIEnvironment::addButton(const core::rect<s32>& rectangle, IGUIElement* parent, s32 id, const wchar_t* text, const wchar_t *tooltiptext)\r
 {\r
@@ -1023,82 +700,6 @@ IGUIButton* CGUIEnvironment::addButton(const core::rect<s32>& rectangle, IGUIEle
 }\r
 \r
 \r
-//! adds a window. The returned pointer must not be dropped.\r
-IGUIWindow* CGUIEnvironment::addWindow(const core::rect<s32>& rectangle, bool modal,\r
-               const wchar_t* text, IGUIElement* parent, s32 id)\r
-{\r
-       parent = parent ? parent : this;\r
-\r
-       IGUIWindow* win = new CGUIWindow(this, parent, id, rectangle);\r
-       if (text)\r
-               win->setText(text);\r
-       win->drop();\r
-\r
-       if (modal)\r
-       {\r
-               // Careful, don't just set the modal as parent above. That will mess up the focus (and is hard to change because we have to be very\r
-               // careful not to get virtual function call, like OnEvent, in the window.\r
-               CGUIModalScreen * modalScreen = new CGUIModalScreen(this, parent, -1);\r
-               modalScreen->drop();\r
-               modalScreen->addChild(win);\r
-       }\r
-\r
-       return win;\r
-}\r
-\r
-\r
-//! adds a modal screen. The returned pointer must not be dropped.\r
-IGUIElement* CGUIEnvironment::addModalScreen(IGUIElement* parent)\r
-{\r
-       parent = parent ? parent : this;\r
-\r
-       IGUIElement *win = new CGUIModalScreen(this, parent, -1);\r
-       win->drop();\r
-\r
-       return win;\r
-}\r
-\r
-\r
-//! Adds a message box.\r
-IGUIWindow* CGUIEnvironment::addMessageBox(const wchar_t* caption, const wchar_t* text,\r
-       bool modal, s32 flag, IGUIElement* parent, s32 id, video::ITexture* image)\r
-{\r
-       if (!CurrentSkin)\r
-               return 0;\r
-\r
-       parent = parent ? parent : this;\r
-\r
-       core::rect<s32> rect;\r
-       core::dimension2d<u32> screenDim, msgBoxDim;\r
-\r
-       screenDim.Width = parent->getAbsolutePosition().getWidth();\r
-       screenDim.Height = parent->getAbsolutePosition().getHeight();\r
-       msgBoxDim.Width = 2;\r
-       msgBoxDim.Height = 2;\r
-\r
-       rect.UpperLeftCorner.X = (screenDim.Width - msgBoxDim.Width) / 2;\r
-       rect.UpperLeftCorner.Y = (screenDim.Height - msgBoxDim.Height) / 2;\r
-       rect.LowerRightCorner.X = rect.UpperLeftCorner.X + msgBoxDim.Width;\r
-       rect.LowerRightCorner.Y = rect.UpperLeftCorner.Y + msgBoxDim.Height;\r
-\r
-       IGUIWindow* win = new CGUIMessageBox(this, caption, text, flag,\r
-               parent, id, rect, image);\r
-       win->drop();\r
-\r
-       if (modal)\r
-       {\r
-               // Careful, don't just set the modal as parent above. That will mess up the focus (and is hard to change because we have to be very\r
-               // careful not to get virtual function call, like OnEvent, in the CGUIMessageBox.\r
-               CGUIModalScreen * modalScreen = new CGUIModalScreen(this, parent, -1);\r
-               modalScreen->drop();\r
-               modalScreen->addChild( win );\r
-       }\r
-\r
-\r
-       return win;\r
-}\r
-\r
-\r
 //! adds a scrollbar. The returned pointer must not be dropped.\r
 IGUIScrollBar* CGUIEnvironment::addScrollBar(bool horizontal, const core::rect<s32>& rectangle, IGUIElement* parent, s32 id)\r
 {\r
@@ -1107,21 +708,6 @@ IGUIScrollBar* CGUIEnvironment::addScrollBar(bool horizontal, const core::rect<s
        return bar;\r
 }\r
 \r
-//! Adds a table to the environment\r
-IGUITable* CGUIEnvironment::addTable(const core::rect<s32>& rectangle, IGUIElement* parent, s32 id, bool drawBackground)\r
-{\r
-       CGUITable* b = new CGUITable(this, parent ? parent : this, id, rectangle, true, drawBackground, false);\r
-       b->drop();\r
-       return b;\r
-}\r
-\r
-       //! Adds an element to display the information from the Irrlicht profiler\r
-IGUIProfiler* CGUIEnvironment::addProfilerDisplay(const core::rect<s32>& rectangle, IGUIElement* parent, s32 id)\r
-{\r
-       CGUIProfiler* p = new CGUIProfiler(this, parent ? parent : this, id, rectangle, NULL);\r
-       p->drop();\r
-       return p;\r
-}\r
 \r
 //! Adds an image element.\r
 IGUIImage* CGUIEnvironment::addImage(video::ITexture* image, core::position2d<s32> pos,\r
@@ -1165,20 +751,6 @@ IGUIImage* CGUIEnvironment::addImage(const core::rect<s32>& rectangle, IGUIEleme
 }\r
 \r
 \r
-//! adds an mesh viewer. The returned pointer must not be dropped.\r
-IGUIMeshViewer* CGUIEnvironment::addMeshViewer(const core::rect<s32>& rectangle, IGUIElement* parent, s32 id, const wchar_t* text)\r
-{\r
-       IGUIMeshViewer* v = new CGUIMeshViewer(this, parent ? parent : this,\r
-               id, rectangle);\r
-\r
-       if (text)\r
-               v->setText(text);\r
-\r
-       v->drop();\r
-       return v;\r
-}\r
-\r
-\r
 //! adds a checkbox\r
 IGUICheckBox* CGUIEnvironment::addCheckBox(bool checked, const core::rect<s32>& rectangle, IGUIElement* parent, s32 id, const wchar_t* text)\r
 {\r
@@ -1213,19 +785,6 @@ IGUIListBox* CGUIEnvironment::addListBox(const core::rect<s32>& rectangle,
        return b;\r
 }\r
 \r
-//! adds a tree view\r
-IGUITreeView* CGUIEnvironment::addTreeView(const core::rect<s32>& rectangle,\r
-                                        IGUIElement* parent, s32 id,\r
-                                        bool drawBackground,\r
-                                        bool scrollBarVertical, bool scrollBarHorizontal)\r
-{\r
-       IGUITreeView* b = new CGUITreeView(this, parent ? parent : this, id, rectangle,\r
-               true, drawBackground, scrollBarVertical, scrollBarHorizontal);\r
-\r
-       b->setIconFont ( getBuiltInFont () );\r
-       b->drop();\r
-       return b;\r
-}\r
 \r
 //! adds a file open dialog. The returned pointer must not be dropped.\r
 IGUIFileOpenDialog* CGUIEnvironment::addFileOpenDialog(const wchar_t* title,\r
@@ -1234,42 +793,13 @@ IGUIFileOpenDialog* CGUIEnvironment::addFileOpenDialog(const wchar_t* title,
 {\r
        parent = parent ? parent : this;\r
 \r
-       IGUIFileOpenDialog* d = new CGUIFileOpenDialog(title, this, parent, id,\r
-                       restoreCWD, startDir);\r
-       d->drop();\r
-\r
        if (modal)\r
-       {\r
-               // Careful, don't just set the modal as parent above. That will mess up the focus (and is hard to change because we have to be very\r
-               // careful not to get virtual function call, like OnEvent, in the window.\r
-               CGUIModalScreen * modalScreen = new CGUIModalScreen(this, parent, -1);\r
-               modalScreen->drop();\r
-               modalScreen->addChild(d);\r
-       }\r
-\r
-       return d;\r
-}\r
+               return nullptr;\r
 \r
-\r
-//! adds a color select dialog. The returned pointer must not be dropped.\r
-IGUIColorSelectDialog* CGUIEnvironment::addColorSelectDialog(const wchar_t* title,\r
-                               bool modal, IGUIElement* parent, s32 id)\r
-{\r
-       parent = parent ? parent : this;\r
-\r
-       IGUIColorSelectDialog* d = new CGUIColorSelectDialog( title,\r
-                       this, parent, id);\r
+       IGUIFileOpenDialog* d = new CGUIFileOpenDialog(title, this, parent, id,\r
+                       restoreCWD, startDir);\r
        d->drop();\r
 \r
-       if (modal)\r
-       {\r
-               // Careful, don't just set the modal as parent above. That will mess up the focus (and is hard to change because we have to be very\r
-               // careful not to get virtual function call, like OnEvent, in the window.\r
-               CGUIModalScreen * modalScreen = new CGUIModalScreen(this, parent, -1);\r
-               modalScreen->drop();\r
-               modalScreen->addChild(d);\r
-       }\r
-\r
        return d;\r
 }\r
 \r
@@ -1303,19 +833,6 @@ IGUIEditBox* CGUIEnvironment::addEditBox(const wchar_t* text,
 }\r
 \r
 \r
-//! Adds a spin box to the environment\r
-IGUISpinBox* CGUIEnvironment::addSpinBox(const wchar_t* text,\r
-                                        const core::rect<s32> &rectangle,\r
-                                        bool border,IGUIElement* parent, s32 id)\r
-{\r
-       IGUISpinBox* d = new CGUISpinBox(text, border,this,\r
-               parent ? parent : this, id, rectangle);\r
-\r
-       d->drop();\r
-       return d;\r
-}\r
-\r
-\r
 //! Adds a tab control to the environment.\r
 IGUITabControl* CGUIEnvironment::addTabControl(const core::rect<s32>& rectangle,\r
        IGUIElement* parent, bool fillbackground, bool border, s32 id)\r
@@ -1338,65 +855,6 @@ IGUITab* CGUIEnvironment::addTab(const core::rect<s32>& rectangle,
 }\r
 \r
 \r
-//! Adds a context menu to the environment.\r
-IGUIContextMenu* CGUIEnvironment::addContextMenu(const core::rect<s32>& rectangle,\r
-       IGUIElement* parent, s32 id)\r
-{\r
-       IGUIContextMenu* c = new CGUIContextMenu(this,\r
-               parent ? parent : this, id, rectangle, true);\r
-       c->drop();\r
-       return c;\r
-}\r
-\r
-\r
-//! Adds a menu to the environment.\r
-IGUIContextMenu* CGUIEnvironment::addMenu(IGUIElement* parent, s32 id)\r
-{\r
-       if (!parent)\r
-               parent = this;\r
-\r
-       IGUIContextMenu* c = new CGUIMenu(this,\r
-               parent, id, core::rect<s32>(0,0,\r
-                               parent->getAbsolutePosition().getWidth(),\r
-                               parent->getAbsolutePosition().getHeight()));\r
-\r
-       c->drop();\r
-       return c;\r
-}\r
-\r
-\r
-//! Adds a toolbar to the environment. It is like a menu is always placed on top\r
-//! in its parent, and contains buttons.\r
-IGUIToolBar* CGUIEnvironment::addToolBar(IGUIElement* parent, s32 id)\r
-{\r
-       if (!parent)\r
-               parent = this;\r
-\r
-       IGUIToolBar* b = new CGUIToolBar(this, parent, id, core::rect<s32>(0,0,10,10));\r
-       b->drop();\r
-       return b;\r
-}\r
-\r
-\r
-//! Adds an element for fading in or out.\r
-IGUIInOutFader* CGUIEnvironment::addInOutFader(const core::rect<s32>* rectangle, IGUIElement* parent, s32 id)\r
-{\r
-       core::rect<s32> rect;\r
-\r
-       if (rectangle)\r
-               rect = *rectangle;\r
-       else if (Driver)\r
-               rect = core::rect<s32>(core::dimension2di(Driver->getScreenSize()));\r
-\r
-       if (!parent)\r
-               parent = this;\r
-\r
-       IGUIInOutFader* fader = new CGUIInOutFader(this, parent, id, rect);\r
-       fader->drop();\r
-       return fader;\r
-}\r
-\r
-\r
 //! Adds a combo box to the environment.\r
 IGUIComboBox* CGUIEnvironment::addComboBox(const core::rect<s32>& rectangle,\r
        IGUIElement* parent, s32 id)\r
@@ -1431,35 +889,7 @@ IGUIFont* CGUIEnvironment::getFont(const io::path& filename)
        }\r
 \r
        IGUIFont* ifont=0;\r
-       io::IXMLReader *xml = FileSystem->createXMLReader(filename );\r
-       if (xml)\r
-       {\r
-               // this is an XML font, but we need to know what type\r
-               EGUI_FONT_TYPE t = EGFT_CUSTOM;\r
-\r
-               bool found=false;\r
-               while(!found && xml->read())\r
-               {\r
-                       if (xml->getNodeType() == io::EXN_ELEMENT)\r
-                       {\r
-                               if (core::stringw(L"font") == xml->getNodeName())\r
-                               {\r
-                                       if (core::stringw(L"vector") == xml->getAttributeValue(L"type"))\r
-                                       {\r
-                                               t = EGFT_VECTOR;\r
-                                               found=true;\r
-                                       }\r
-                                       else if (core::stringw(L"bitmap") == xml->getAttributeValue(L"type"))\r
-                                       {\r
-                                               t = EGFT_BITMAP;\r
-                                               found=true;\r
-                                       }\r
-                                       else found=true;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               if (t==EGFT_BITMAP)\r
+#if 0\r
                {\r
                        CGUIFont* font = new CGUIFont(this, filename);\r
                        ifont = (IGUIFont*)font;\r
@@ -1474,17 +904,7 @@ IGUIFont* CGUIEnvironment::getFont(const io::path& filename)
                                ifont = 0;\r
                        }\r
                }\r
-               else if (t==EGFT_VECTOR)\r
-               {\r
-                       // todo: vector fonts\r
-                       os::Printer::log("Unable to load font, XML vector fonts are not supported yet", f.NamedPath, ELL_ERROR);\r
-\r
-                       //CGUIFontVector* font = new CGUIFontVector(Driver);\r
-                       //ifont = (IGUIFont*)font;\r
-                       //if (!font->load(xml))\r
-               }\r
-               xml->drop();\r
-       }\r
+#endif\r
 \r
 \r
        if (!ifont)\r
@@ -1688,6 +1108,3 @@ IGUIEnvironment* createGUIEnvironment(io::IFileSystem* fs,
 \r
 } // end namespace gui\r
 } // end namespace irr\r
-\r
-#endif // _IRR_COMPILE_WITH_GUI_\r
-\r