#include "IReferenceCounted.h"\r
#include "IGUISkin.h"\r
#include "rect.h"\r
-#include "EMessageBoxFlags.h"\r
#include "EFocusFlags.h"\r
#include "IEventReceiver.h"\r
-#include "IXMLReader.h"\r
-#include "IXMLWriter.h"\r
#include "path.h"\r
\r
namespace irr\r
class IGUISpriteBank;\r
class IGUIScrollBar;\r
class IGUIImage;\r
-class IGUIMeshViewer;\r
class IGUICheckBox;\r
class IGUIListBox;\r
-class IGUITreeView;\r
class IGUIImageList;\r
class IGUIFileOpenDialog;\r
-class IGUIColorSelectDialog;\r
-class IGUIInOutFader;\r
class IGUIStaticText;\r
class IGUIEditBox;\r
-class IGUISpinBox;\r
class IGUITabControl;\r
class IGUITab;\r
-class IGUITable;\r
-class IGUIContextMenu;\r
class IGUIComboBox;\r
-class IGUIToolBar;\r
class IGUIButton;\r
class IGUIWindow;\r
-class IGUIProfiler;\r
-class IGUIElementFactory;\r
\r
//! GUI Environment. Used as factory and manager of all other GUI elements.\r
/** \par This element can create the following events of type EGUI_EVENT_TYPE (which are passed on to focused sub-elements):\r
virtual IGUIButton* addButton(const core::rect<s32>& rectangle,\r
IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0, const wchar_t* tooltiptext = 0) = 0;\r
\r
- //! Adds an empty window element.\r
- /** \param rectangle Rectangle specifying the borders of the window.\r
- \param modal Defines if the dialog is modal. This means, that all other\r
- gui elements which were created before the window cannot be used until\r
- it is removed.\r
- \param text Text displayed as the window title.\r
- \param parent Parent gui element of the window.\r
- \param id Id with which the gui element can be identified.\r
- \return Pointer to the created window. Returns 0 if an error occurred.\r
- This pointer should not be dropped. See IReferenceCounted::drop() for\r
- more information. */\r
- virtual IGUIWindow* addWindow(const core::rect<s32>& rectangle, bool modal = false,\r
- const wchar_t* text=0, IGUIElement* parent=0, s32 id=-1) = 0;\r
-\r
- //! Adds a modal screen.\r
- /** Input focus stays with children of the modal screen. \r
- If you have some window x which should keep the input focus you \r
- do something like: addModalScreen()->addChild(x). And x will then get the focus \r
- and not lose it anymore. \r
- The modal screen removes itself when it no longer has any children.\r
- Note that it usually works badly to pass the modal screen already as parent when creating\r
- a new element. It's better to add that new element later to the modal screen with addChild.\r
- \param parent Parent gui element of the modal.\r
- \return Pointer to the created modal. Returns 0 if an error occurred.\r
- This pointer should not be dropped. See IReferenceCounted::drop() for\r
- more information. */\r
- virtual IGUIElement* addModalScreen(IGUIElement* parent) = 0;\r
-\r
- //! Adds a message box.\r
- /** \param caption Text to be displayed the title of the message box.\r
- \param text Text to be displayed in the body of the message box.\r
- \param modal Defines if the dialog is modal. This means, that all other\r
- gui elements which were created before the message box cannot be used\r
- until this messagebox is removed.\r
- \param flags Flags specifying the layout of the message box using ::EMESSAGE_BOX_FLAG.\r
- Create a message box with an OK and CANCEL button for example with (EMBF_OK | EMBF_CANCEL).\r
- \param parent Parent gui element of the message box.\r
- \param id Id with which the gui element can be identified.\r
- \param image Optional texture which will be displayed beside the text as an image\r
- \return Pointer to the created message box. Returns 0 if an error\r
- occurred. This pointer should not be dropped. See\r
- IReferenceCounted::drop() for more information. */\r
- virtual IGUIWindow* addMessageBox(const wchar_t* caption, const wchar_t* text=0,\r
- bool modal = true, s32 flags = EMBF_OK, IGUIElement* parent=0, s32 id=-1, video::ITexture* image=0) = 0;\r
-\r
//! Adds a scrollbar.\r
/** \param horizontal Specifies if the scroll bar is drawn horizontal\r
or vertical.\r
virtual IGUIListBox* addListBox(const core::rect<s32>& rectangle,\r
IGUIElement* parent=0, s32 id=-1, bool drawBackground=false) = 0;\r
\r
- //! Adds a tree view element.\r
- /** \param rectangle Position and dimension of list box.\r
- \param parent Parent gui element of the list box.\r
- \param id Id to identify the gui element.\r
- \param drawBackground Flag whether the background should be drawn.\r
- \param scrollBarVertical Flag whether a vertical scrollbar should be used\r
- \param scrollBarHorizontal Flag whether a horizontal scrollbar should be used\r
- \return Pointer to the created list box. Returns 0 if an error occurred.\r
- This pointer should not be dropped. See IReferenceCounted::drop() for\r
- more information. */\r
- virtual IGUITreeView* addTreeView(const core::rect<s32>& rectangle,\r
- IGUIElement* parent=0, s32 id=-1, bool drawBackground=false,\r
- bool scrollBarVertical = true, bool scrollBarHorizontal = false) = 0;\r
-\r
- //! Adds a mesh viewer. Not 100% implemented yet.\r
- /** \param rectangle Rectangle specifying the borders of the mesh viewer.\r
- \param parent Parent gui element of the mesh viewer.\r
- \param id Id to identify the gui element.\r
- \param text Title text of the mesh viewer.\r
- \return Pointer to the created mesh viewer. Returns 0 if an error\r
- occurred. This pointer should not be dropped. See\r
- IReferenceCounted::drop() for more information. */\r
- virtual IGUIMeshViewer* addMeshViewer(const core::rect<s32>& rectangle,\r
- IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;\r
-\r
//! Adds a file open dialog.\r
/** \param title Text to be displayed as the title of the dialog.\r
\param modal Defines if the dialog is modal. This means, that all other\r
bool modal=true, IGUIElement* parent=0, s32 id=-1,\r
bool restoreCWD=false, io::path::char_type* startDir=0) = 0;\r
\r
- //! Adds a color select dialog.\r
- /** \param title The title of the dialog.\r
- \param modal Defines if the dialog is modal. This means, that all other\r
- gui elements which were created before the dialog cannot be used\r
- until it is removed.\r
- \param parent The parent of the dialog.\r
- \param id The ID of the dialog.\r
- \return Pointer to the created file open dialog. Returns 0 if an error\r
- occurred. This pointer should not be dropped. See\r
- IReferenceCounted::drop() for more information. */\r
- virtual IGUIColorSelectDialog* addColorSelectDialog(const wchar_t* title = 0,\r
- bool modal=true, IGUIElement* parent=0, s32 id=-1) = 0;\r
-\r
//! Adds a static text.\r
/** \param text Text to be displayed. Can be altered after creation by SetText().\r
\param rectangle Rectangle specifying the borders of the static text\r
virtual IGUIEditBox* addEditBox(const wchar_t* text, const core::rect<s32>& rectangle,\r
bool border=true, IGUIElement* parent=0, s32 id=-1) = 0;\r
\r
- //! Adds a spin box.\r
- /** An edit box with up and down buttons\r
- \param text Text to be displayed. Can be altered after creation by setText().\r
- \param rectangle Rectangle specifying the borders of the spin box.\r
- \param border Set to true if the spin box should have a 3d border.\r
- \param parent Parent item of the element, e.g. a window.\r
- Set it to 0 to place the spin box directly in the environment.\r
- \param id The ID of the element.\r
- \return Pointer to the created spin box. Returns 0 if an error occurred.\r
- This pointer should not be dropped. See IReferenceCounted::drop() for\r
- more information. */\r
- virtual IGUISpinBox* addSpinBox(const wchar_t* text, const core::rect<s32>& rectangle,\r
- bool border=true,IGUIElement* parent=0, s32 id=-1) = 0;\r
-\r
- //! Adds an element for fading in or out.\r
- /** \param rectangle Rectangle specifying the borders of the fader.\r
- If the pointer is NULL, the whole screen is used.\r
- \param parent Parent item of the element, e.g. a window.\r
- \param id An identifier for the fader.\r
- \return Pointer to the created in-out-fader. Returns 0 if an error\r
- occurred. This pointer should not be dropped. See\r
- IReferenceCounted::drop() for more information. */\r
- virtual IGUIInOutFader* addInOutFader(const core::rect<s32>* rectangle=0, IGUIElement* parent=0, s32 id=-1) = 0;\r
-\r
//! Adds a tab control to the environment.\r
/** \param rectangle Rectangle specifying the borders of the tab control.\r
\param parent Parent item of the element, e.g. a window.\r
virtual IGUITab* addTab(const core::rect<s32>& rectangle,\r
IGUIElement* parent=0, s32 id=-1) = 0;\r
\r
- //! Adds a context menu to the environment.\r
- /** \param rectangle Rectangle specifying the borders of the menu.\r
- Note that the menu is resizing itself based on what items you add.\r
- \param parent Parent item of the element, e.g. a window.\r
- Set it to 0 to place the menu directly in the environment.\r
- \param id An identifier for the menu.\r
- \return Pointer to the created context menu. Returns 0 if an\r
- error occurred. This pointer should not be dropped. See\r
- IReferenceCounted::drop() for more information. */\r
- virtual IGUIContextMenu* addContextMenu(const core::rect<s32>& rectangle,\r
- IGUIElement* parent=0, s32 id=-1) = 0;\r
-\r
- //! Adds a menu to the environment.\r
- /** This is like the menu you can find on top of most windows in modern\r
- graphical user interfaces.\r
- \param parent Parent item of the element, e.g. a window.\r
- Set it to 0 to place the menu directly in the environment.\r
- \param id An identifier for the menu.\r
- \return Pointer to the created menu. Returns 0 if an\r
- error occurred. This pointer should not be dropped. See\r
- IReferenceCounted::drop() for more information. */\r
- virtual IGUIContextMenu* addMenu(IGUIElement* parent=0, s32 id=-1) = 0;\r
-\r
- //! Adds a toolbar to the environment.\r
- /** It is like a menu that is always placed on top of its parent, and\r
- contains buttons.\r
- \param parent Parent item of the element, e.g. a window.\r
- Set it to 0 to place the tool bar directly in the environment.\r
- \param id An identifier for the tool bar.\r
- \return Pointer to the created tool bar. Returns 0 if an\r
- error occurred. This pointer should not be dropped. See\r
- IReferenceCounted::drop() for more information. */\r
- virtual IGUIToolBar* addToolBar(IGUIElement* parent=0, s32 id=-1) = 0;\r
-\r
//! Adds a combo box to the environment.\r
/** \param rectangle Rectangle specifying the borders of the combo box.\r
\param parent Parent item of the element, e.g. a window.\r
virtual IGUIComboBox* addComboBox(const core::rect<s32>& rectangle,\r
IGUIElement* parent=0, s32 id=-1) = 0;\r
\r
- //! Adds a table to the environment\r
- /** \param rectangle Rectangle specifying the borders of the table.\r
- \param parent Parent item of the element, e.g. a window. Set it to 0\r
- to place the element directly in the environment.\r
- \param id An identifier for the table.\r
- \param drawBackground Flag whether the background should be drawn.\r
- \return Pointer to the created table. Returns 0 if an error occurred.\r
- This pointer should not be dropped. See IReferenceCounted::drop() for\r
- more information. */\r
- virtual IGUITable* addTable(const core::rect<s32>& rectangle,\r
- IGUIElement* parent=0, s32 id=-1, bool drawBackground=false) =0;\r
-\r
- //! Adds an element to display the information from the Irrlicht profiler\r
- /** \param rectangle Rectangle specifying the borders of the element.\r
- \param parent Parent of the element. When 0 the environment itself will\r
- be the parent.\r
- \param id An identifier for the element. */\r
- virtual IGUIProfiler* addProfilerDisplay(const core::rect<s32>& rectangle,\r
- IGUIElement* parent=0, s32 id=-1) = 0;\r
-\r
- //! Get the default element factory which can create all built-in elements\r
- /** \return Pointer to the factory.\r
- This pointer should not be dropped. See IReferenceCounted::drop() for\r
- more information. */\r
- virtual IGUIElementFactory* getDefaultGUIElementFactory() const = 0;\r
-\r
- //! Adds an element factory to the gui environment.\r
- /** Use this to extend the gui environment with new element types which\r
- it should be able to create automatically, for example when loading\r
- data from xml files.\r
- \param factoryToAdd Pointer to new factory. */\r
- virtual void registerGUIElementFactory(IGUIElementFactory* factoryToAdd) = 0;\r
-\r
- //! Get amount of registered gui element factories.\r
- /** \return Amount of registered gui element factories. */\r
- virtual u32 getRegisteredGUIElementFactoryCount() const = 0;\r
-\r
- //! Get a gui element factory by index\r
- /** \param index Index of the factory.\r
- \return Factory at given index, or 0 if no such factory exists. */\r
- virtual IGUIElementFactory* getGUIElementFactory(u32 index) const = 0;\r
-\r
- //! Adds a GUI element by its name\r
- /** Each factory is checked if it can create an element of the given\r
- name. The first match will be created.\r
- \param elementName Name of the element to be created.\r
- \param parent Parent of the new element, if not 0.\r
- \return New GUI element, or 0 if no such element exists. */\r
- virtual IGUIElement* addGUIElement(const c8* elementName, IGUIElement* parent=0) = 0;\r
-\r
- //! Saves the current gui into a file.\r
- /** \param filename Name of the file.\r
- \param start The GUIElement to start with. Root if 0.\r
- \return True if saving succeeded, else false. */\r
- virtual bool saveGUI(const io::path& filename, IGUIElement* start=0) = 0;\r
-\r
- //! Saves the current gui into a file.\r
- /** \param file The file to write to.\r
- \param start The GUIElement to start with. Root if 0.\r
- \return True if saving succeeded, else false. */\r
- virtual bool saveGUI(io::IWriteFile* file, IGUIElement* start=0) = 0;\r
-\r
- //! Loads the gui. Note that the current gui is not cleared before.\r
- /** When a parent is set the elements will be added below the parent, the parent itself does not deserialize.\r
- When the file contains skin-settings from the gui-environment those are always serialized into the\r
- guienvironment independent of the parent setting.\r
- \param filename Name of the file.\r
- \param parent Parent for the loaded GUI, root if 0.\r
- \return True if loading succeeded, else false. */\r
- virtual bool loadGUI(const io::path& filename, IGUIElement* parent=0) = 0;\r
-\r
- //! Loads the gui. Note that the current gui is not cleared before.\r
- /** When a parent is set the elements will be added below the parent, the parent itself does not deserialize.\r
- When the file contains skin-settings from the gui-environment those are always serialized into the\r
- guienvironment independent of the parent setting.\r
- \param file The file to load from.\r
- \param parent Parent for the loaded GUI, root if 0.\r
- \return True if loading succeeded, else false. */\r
- virtual bool loadGUI(io::IReadFile* file, IGUIElement* parent=0) = 0;\r
-\r
- //! Writes attributes of the gui environment\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const =0;\r
-\r
- //! Reads attributes of the gui environment\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)=0;\r
-\r
- //! writes an element\r
- virtual void writeGUIElement(io::IXMLWriter* writer, IGUIElement* element) =0;\r
-\r
- //! reads an element\r
- virtual void readGUIElement(io::IXMLReader* reader, IGUIElement* element) =0;\r
-\r
//! Find the next element which would be selected when pressing the tab-key\r
/** If you set the focus for the result you can manually force focus-changes like they\r
would happen otherwise by the tab-keys.\r