Irrlicht 3D Engine
irr::gui::IGUIEnvironment Class Referenceabstract

GUI Environment. Used as factory and manager of all other GUI elements. More...

#include <IGUIEnvironment.h>

+ Inheritance diagram for irr::gui::IGUIEnvironment:

Public Member Functions

virtual IGUIButtonaddButton (const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1, const wchar_t *text=0, const wchar_t *tooltiptext=0)=0
 Adds a button element. More...
 
virtual IGUICheckBoxaddCheckBox (bool checked, const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1, const wchar_t *text=0)=0
 Adds a checkbox element. More...
 
virtual IGUIColorSelectDialogaddColorSelectDialog (const wchar_t *title=0, bool modal=true, IGUIElement *parent=0, s32 id=-1)=0
 Adds a color select dialog. More...
 
virtual IGUIComboBoxaddComboBox (const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1)=0
 Adds a combo box to the environment. More...
 
virtual IGUIContextMenuaddContextMenu (const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1)=0
 Adds a context menu to the environment. More...
 
virtual IGUIEditBoxaddEditBox (const wchar_t *text, const core::rect< s32 > &rectangle, bool border=true, IGUIElement *parent=0, s32 id=-1)=0
 Adds an edit box. More...
 
virtual IGUISpriteBankaddEmptySpriteBank (const io::path &name)=0
 Adds an empty sprite bank to the manager. More...
 
virtual IGUIFileOpenDialogaddFileOpenDialog (const wchar_t *title=0, bool modal=true, IGUIElement *parent=0, s32 id=-1, bool restoreCWD=false, io::path::char_type *startDir=0)=0
 Adds a file open dialog. More...
 
virtual IGUIFontaddFont (const io::path &name, IGUIFont *font)=0
 Adds an externally loaded font to the font list. More...
 
virtual IGUIElementaddGUIElement (const c8 *elementName, IGUIElement *parent=0)=0
 Adds a GUI element by its name. More...
 
virtual IGUIImageaddImage (video::ITexture *image, core::position2d< s32 > pos, bool useAlphaChannel=true, IGUIElement *parent=0, s32 id=-1, const wchar_t *text=0)=0
 Adds an image element. More...
 
virtual IGUIImageaddImage (const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1, const wchar_t *text=0, bool useAlphaChannel=true)=0
 Adds an image element. More...
 
virtual IGUIInOutFaderaddInOutFader (const core::rect< s32 > *rectangle=0, IGUIElement *parent=0, s32 id=-1)=0
 Adds an element for fading in or out. More...
 
virtual IGUIListBoxaddListBox (const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1, bool drawBackground=false)=0
 Adds a list box element. More...
 
virtual IGUIContextMenuaddMenu (IGUIElement *parent=0, s32 id=-1)=0
 Adds a menu to the environment. More...
 
virtual IGUIMeshVieweraddMeshViewer (const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1, const wchar_t *text=0)=0
 Adds a mesh viewer. Not 100% implemented yet. More...
 
virtual IGUIWindowaddMessageBox (const wchar_t *caption, const wchar_t *text=0, bool modal=true, s32 flags=EMBF_OK, IGUIElement *parent=0, s32 id=-1, video::ITexture *image=0)=0
 Adds a message box. More...
 
virtual IGUIElementaddModalScreen (IGUIElement *parent)=0
 Adds a modal screen. More...
 
virtual IGUIProfileraddProfilerDisplay (const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1)=0
 Adds an element to display the information from the Irrlicht profiler. More...
 
virtual IGUIScrollBaraddScrollBar (bool horizontal, const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1)=0
 Adds a scrollbar. More...
 
virtual IGUISpinBoxaddSpinBox (const wchar_t *text, const core::rect< s32 > &rectangle, bool border=true, IGUIElement *parent=0, s32 id=-1)=0
 Adds a spin box. More...
 
virtual IGUIStaticTextaddStaticText (const wchar_t *text, const core::rect< s32 > &rectangle, bool border=false, bool wordWrap=true, IGUIElement *parent=0, s32 id=-1, bool fillBackground=false)=0
 Adds a static text. More...
 
virtual IGUITabaddTab (const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1)=0
 Adds tab to the environment. More...
 
virtual IGUITabControladdTabControl (const core::rect< s32 > &rectangle, IGUIElement *parent=0, bool fillbackground=false, bool border=true, s32 id=-1)=0
 Adds a tab control to the environment. More...
 
virtual IGUITableaddTable (const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1, bool drawBackground=false)=0
 Adds a table to the environment. More...
 
virtual IGUIToolBaraddToolBar (IGUIElement *parent=0, s32 id=-1)=0
 Adds a toolbar to the environment. More...
 
virtual IGUITreeViewaddTreeView (const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1, bool drawBackground=false, bool scrollBarVertical=true, bool scrollBarHorizontal=false)=0
 Adds a tree view element. More...
 
virtual IGUIWindowaddWindow (const core::rect< s32 > &rectangle, bool modal=false, const wchar_t *text=0, IGUIElement *parent=0, s32 id=-1)=0
 Adds an empty window element. More...
 
virtual void clear ()=0
 Removes all elements from the environment. More...
 
virtual IGUIImageListcreateImageList (video::ITexture *texture, core::dimension2d< s32 > imageSize, bool useAlphaChannel)=0
 Creates the image list from the given texture. More...
 
virtual IGUISkincreateSkin (EGUI_SKIN_TYPE type)=0
 Creates a new GUI Skin based on a template. More...
 
virtual void deserializeAttributes (io::IAttributes *in, io::SAttributeReadWriteOptions *options=0)=0
 Reads attributes of the gui environment. More...
 
virtual void drawAll ()=0
 Draws all gui elements by traversing the GUI environment starting at the root node. More...
 
virtual IGUIFontgetBuiltInFont () const =0
 Returns the default built-in font. More...
 
virtual IGUIElementFactorygetDefaultGUIElementFactory () const =0
 Get the default element factory which can create all built-in elements. More...
 
virtual io::IFileSystemgetFileSystem () const =0
 Returns the file system. More...
 
virtual IGUIElementgetFocus () const =0
 Returns the element which holds the focus. More...
 
virtual u32 getFocusBehavior () const =0
 Get the way the gui does handle focus changes. More...
 
virtual IGUIFontgetFont (const io::path &filename)=0
 Returns pointer to the font with the specified filename. More...
 
virtual IGUIElementFactorygetGUIElementFactory (u32 index) const =0
 Get a gui element factory by index. More...
 
virtual IGUIElementgetHovered () const =0
 Returns the element which was last under the mouse cursor. More...
 
virtual IGUIElementgetNextElement (bool reverse=false, bool group=false)=0
 Find the next element which would be selected when pressing the tab-key. More...
 
virtual IOSOperatorgetOSOperator () const =0
 returns a pointer to the OS operator More...
 
virtual u32 getRegisteredGUIElementFactoryCount () const =0
 Get amount of registered gui element factories. More...
 
virtual IGUIElementgetRootGUIElement ()=0
 Returns the root gui element. More...
 
virtual IGUISkingetSkin () const =0
 Returns pointer to the current gui skin. More...
 
virtual IGUISpriteBankgetSpriteBank (const io::path &filename)=0
 Returns pointer to the sprite bank which was added with addEmptySpriteBank. More...
 
virtual video::IVideoDrivergetVideoDriver () const =0
 Returns the current video driver. More...
 
virtual bool hasFocus (const IGUIElement *element, bool checkSubElements=false) const =0
 Returns whether the element has focus. More...
 
virtual bool loadGUI (const io::path &filename, IGUIElement *parent=0)=0
 Loads the gui. Note that the current gui is not cleared before. More...
 
virtual bool loadGUI (io::IReadFile *file, IGUIElement *parent=0)=0
 Loads the gui. Note that the current gui is not cleared before. More...
 
virtual bool postEventFromUser (const SEvent &event)=0
 Posts an input event to the environment. More...
 
virtual void readGUIElement (io::IXMLReader *reader, IGUIElement *node)=0
 reads an element More...
 
virtual void registerGUIElementFactory (IGUIElementFactory *factoryToAdd)=0
 Adds an element factory to the gui environment. More...
 
virtual bool removeFocus (IGUIElement *element)=0
 Removes the focus from an element. More...
 
virtual void removeFont (IGUIFont *font)=0
 remove loaded font More...
 
virtual bool saveGUI (const io::path &filename, IGUIElement *start=0)=0
 Saves the current gui into a file. More...
 
virtual bool saveGUI (io::IWriteFile *file, IGUIElement *start=0)=0
 Saves the current gui into a file. More...
 
virtual void serializeAttributes (io::IAttributes *out, io::SAttributeReadWriteOptions *options=0) const =0
 Writes attributes of the gui environment. More...
 
virtual bool setFocus (IGUIElement *element)=0
 Sets the focus to an element. More...
 
virtual void setFocusBehavior (u32 flags)=0
 Set the way the gui will handle automatic focus changes. More...
 
virtual void setSkin (IGUISkin *skin)=0
 Sets a new GUI Skin. More...
 
virtual void setUserEventReceiver (IEventReceiver *evr)=0
 This sets a new event receiver for gui events. More...
 
virtual void writeGUIElement (io::IXMLWriter *writer, IGUIElement *node)=0
 writes an element More...
 
- Public Member Functions inherited from irr::IReferenceCounted
 IReferenceCounted ()
 Constructor. More...
 
virtual ~IReferenceCounted ()
 Destructor. More...
 
bool drop () const
 Drops the object. Decrements the reference counter by one. More...
 
const c8getDebugName () const
 Returns the debug name of the object. More...
 
s32 getReferenceCount () const
 Get the reference count. More...
 
void grab () const
 Grabs the object. Increments the reference counter by one. More...
 

Additional Inherited Members

- Protected Member Functions inherited from irr::IReferenceCounted
void setDebugName (const c8 *newName)
 Sets the debug name of the object. More...
 

Detailed Description

GUI Environment. Used as factory and manager of all other GUI elements.

This element can create the following events of type EGUI_EVENT_TYPE (which are passed on to focused sub-elements):
  • EGET_ELEMENT_FOCUS_LOST
  • EGET_ELEMENT_FOCUSED
  • EGET_ELEMENT_LEFT
  • EGET_ELEMENT_HOVERED

Definition at line 72 of file IGUIEnvironment.h.

Member Function Documentation

◆ addButton()

virtual IGUIButton* irr::gui::IGUIEnvironment::addButton ( const core::rect< s32 > &  rectangle,
IGUIElement parent = 0,
s32  id = -1,
const wchar_t *  text = 0,
const wchar_t *  tooltiptext = 0 
)
pure virtual

Adds a button element.

Parameters
rectangleRectangle specifying the borders of the button.
parentParent gui element of the button.
idId with which the gui element can be identified.
textText displayed on the button.
tooltiptextText displayed in the tooltip.
Returns
Pointer to the created button. Returns 0 if an error occurred. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ addCheckBox()

virtual IGUICheckBox* irr::gui::IGUIEnvironment::addCheckBox ( bool  checked,
const core::rect< s32 > &  rectangle,
IGUIElement parent = 0,
s32  id = -1,
const wchar_t *  text = 0 
)
pure virtual

Adds a checkbox element.

Parameters
checkedDefine the initial state of the check box.
rectangleRectangle specifying the borders of the check box.
parentParent gui element of the check box.
idId to identify the gui element.
textTitle text of the check box.
Returns
Pointer to the created check box. Returns 0 if an error occurred. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ addColorSelectDialog()

virtual IGUIColorSelectDialog* irr::gui::IGUIEnvironment::addColorSelectDialog ( const wchar_t *  title = 0,
bool  modal = true,
IGUIElement parent = 0,
s32  id = -1 
)
pure virtual

Adds a color select dialog.

Parameters
titleThe title of the dialog.
modalDefines if the dialog is modal. This means, that all other gui elements which were created before the dialog cannot be used until it is removed.
parentThe parent of the dialog.
idThe ID of the dialog.
Returns
Pointer to the created file open dialog. Returns 0 if an error occurred. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ addComboBox()

virtual IGUIComboBox* irr::gui::IGUIEnvironment::addComboBox ( const core::rect< s32 > &  rectangle,
IGUIElement parent = 0,
s32  id = -1 
)
pure virtual

Adds a combo box to the environment.

Parameters
rectangleRectangle specifying the borders of the combo box.
parentParent item of the element, e.g. a window. Set it to 0 to place the combo box directly in the environment.
idAn identifier for the combo box.
Returns
Pointer to the created combo box. Returns 0 if an error occurred. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ addContextMenu()

virtual IGUIContextMenu* irr::gui::IGUIEnvironment::addContextMenu ( const core::rect< s32 > &  rectangle,
IGUIElement parent = 0,
s32  id = -1 
)
pure virtual

Adds a context menu to the environment.

Parameters
rectangleRectangle specifying the borders of the menu. Note that the menu is resizing itself based on what items you add.
parentParent item of the element, e.g. a window. Set it to 0 to place the menu directly in the environment.
idAn identifier for the menu.
Returns
Pointer to the created context menu. Returns 0 if an error occurred. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ addEditBox()

virtual IGUIEditBox* irr::gui::IGUIEnvironment::addEditBox ( const wchar_t *  text,
const core::rect< s32 > &  rectangle,
bool  border = true,
IGUIElement parent = 0,
s32  id = -1 
)
pure virtual

Adds an edit box.

Supports Unicode input from every keyboard around the world, scrolling, copying and pasting (exchanging data with the clipboard directly), maximum character amount, marking, and all shortcuts like ctrl+X, ctrl+V, ctrl+C, shift+Left, shift+Right, Home, End, and so on.

Parameters
textText to be displayed. Can be altered after creation by setText().
rectangleRectangle specifying the borders of the edit box.
borderSet to true if the edit box should have a 3d border.
parentParent item of the element, e.g. a window. Set it to 0 to place the edit box directly in the environment.
idThe ID of the element.
Returns
Pointer to the created edit box. Returns 0 if an error occurred. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ addEmptySpriteBank()

virtual IGUISpriteBank* irr::gui::IGUIEnvironment::addEmptySpriteBank ( const io::path name)
pure virtual

Adds an empty sprite bank to the manager.

Parameters
nameName of the new sprite bank.
Returns
Pointer to the sprite bank. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ addFileOpenDialog()

virtual IGUIFileOpenDialog* irr::gui::IGUIEnvironment::addFileOpenDialog ( const wchar_t *  title = 0,
bool  modal = true,
IGUIElement parent = 0,
s32  id = -1,
bool  restoreCWD = false,
io::path::char_type startDir = 0 
)
pure virtual

Adds a file open dialog.

Parameters
titleText to be displayed as the title of the dialog.
modalDefines if the dialog is modal. This means, that all other gui elements which were created before the message box cannot be used until this messagebox is removed.
parentParent gui element of the dialog.
idId to identify the gui element.
restoreCWDIf set to true, the current working directory will be restored after the dialog is closed in some way. Otherwise the working directory will be the one that the file dialog was last showing.
startDirOptional path for which the file dialog will be opened.
Returns
Pointer to the created file open dialog. Returns 0 if an error occurred. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ addFont()

virtual IGUIFont* irr::gui::IGUIEnvironment::addFont ( const io::path name,
IGUIFont font 
)
pure virtual

Adds an externally loaded font to the font list.

This method allows to attach an already loaded font to the list of existing fonts. The font is grabbed if non-null and adding was successful.

Parameters
nameName the font should be stored as.
fontPointer to font to add.
Returns
Pointer to the font stored. This can differ from given parameter if the name previously existed.

◆ addGUIElement()

virtual IGUIElement* irr::gui::IGUIEnvironment::addGUIElement ( const c8 elementName,
IGUIElement parent = 0 
)
pure virtual

Adds a GUI element by its name.

Each factory is checked if it can create an element of the given name. The first match will be created.

Parameters
elementNameName of the element to be created.
parentParent of the new element, if not 0.
Returns
New GUI element, or 0 if no such element exists.

◆ addImage() [1/2]

virtual IGUIImage* irr::gui::IGUIEnvironment::addImage ( video::ITexture image,
core::position2d< s32 pos,
bool  useAlphaChannel = true,
IGUIElement parent = 0,
s32  id = -1,
const wchar_t *  text = 0 
)
pure virtual

Adds an image element.

Parameters
imageImage to be displayed.
posPosition of the image. The width and height of the image is taken from the image.
useAlphaChannelSets if the image should use the alpha channel of the texture to draw itself.
parentParent gui element of the image.
idId to identify the gui element.
textTitle text of the image (not displayed).
Returns
Pointer to the created image element. Returns 0 if an error occurred. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ addImage() [2/2]

virtual IGUIImage* irr::gui::IGUIEnvironment::addImage ( const core::rect< s32 > &  rectangle,
IGUIElement parent = 0,
s32  id = -1,
const wchar_t *  text = 0,
bool  useAlphaChannel = true 
)
pure virtual

Adds an image element.

Use IGUIImage::setImage later to set the image to be displayed.

Parameters
rectangleRectangle specifying the borders of the image.
parentParent gui element of the image.
idId to identify the gui element.
textTitle text of the image (not displayed).
useAlphaChannelSets if the image should use the alpha channel of the texture to draw itself.
Returns
Pointer to the created image element. Returns 0 if an error occurred. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ addInOutFader()

virtual IGUIInOutFader* irr::gui::IGUIEnvironment::addInOutFader ( const core::rect< s32 > *  rectangle = 0,
IGUIElement parent = 0,
s32  id = -1 
)
pure virtual

Adds an element for fading in or out.

Parameters
rectangleRectangle specifying the borders of the fader. If the pointer is NULL, the whole screen is used.
parentParent item of the element, e.g. a window.
idAn identifier for the fader.
Returns
Pointer to the created in-out-fader. Returns 0 if an error occurred. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ addListBox()

virtual IGUIListBox* irr::gui::IGUIEnvironment::addListBox ( const core::rect< s32 > &  rectangle,
IGUIElement parent = 0,
s32  id = -1,
bool  drawBackground = false 
)
pure virtual

Adds a list box element.

Parameters
rectangleRectangle specifying the borders of the list box.
parentParent gui element of the list box.
idId to identify the gui element.
drawBackgroundFlag whether the background should be drawn.
Returns
Pointer to the created list box. Returns 0 if an error occurred. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ addMenu()

virtual IGUIContextMenu* irr::gui::IGUIEnvironment::addMenu ( IGUIElement parent = 0,
s32  id = -1 
)
pure virtual

Adds a menu to the environment.

This is like the menu you can find on top of most windows in modern graphical user interfaces.

Parameters
parentParent item of the element, e.g. a window. Set it to 0 to place the menu directly in the environment.
idAn identifier for the menu.
Returns
Pointer to the created menu. Returns 0 if an error occurred. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ addMeshViewer()

virtual IGUIMeshViewer* irr::gui::IGUIEnvironment::addMeshViewer ( const core::rect< s32 > &  rectangle,
IGUIElement parent = 0,
s32  id = -1,
const wchar_t *  text = 0 
)
pure virtual

Adds a mesh viewer. Not 100% implemented yet.

Parameters
rectangleRectangle specifying the borders of the mesh viewer.
parentParent gui element of the mesh viewer.
idId to identify the gui element.
textTitle text of the mesh viewer.
Returns
Pointer to the created mesh viewer. Returns 0 if an error occurred. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ addMessageBox()

virtual IGUIWindow* irr::gui::IGUIEnvironment::addMessageBox ( const wchar_t *  caption,
const wchar_t *  text = 0,
bool  modal = true,
s32  flags = EMBF_OK,
IGUIElement parent = 0,
s32  id = -1,
video::ITexture image = 0 
)
pure virtual

Adds a message box.

Parameters
captionText to be displayed the title of the message box.
textText to be displayed in the body of the message box.
modalDefines if the dialog is modal. This means, that all other gui elements which were created before the message box cannot be used until this messagebox is removed.
flagsFlags specifying the layout of the message box using EMESSAGE_BOX_FLAG. Create a message box with an OK and CANCEL button for example with (EMBF_OK | EMBF_CANCEL).
parentParent gui element of the message box.
idId with which the gui element can be identified.
imageOptional texture which will be displayed beside the text as an image
Returns
Pointer to the created message box. Returns 0 if an error occurred. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ addModalScreen()

virtual IGUIElement* irr::gui::IGUIEnvironment::addModalScreen ( IGUIElement parent)
pure virtual

Adds a modal screen.

This control stops its parent's members from being able to receive input until its last child is removed, it then deletes itself.

Parameters
parentParent gui element of the modal.
Returns
Pointer to the created modal. Returns 0 if an error occurred. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ addProfilerDisplay()

virtual IGUIProfiler* irr::gui::IGUIEnvironment::addProfilerDisplay ( const core::rect< s32 > &  rectangle,
IGUIElement parent = 0,
s32  id = -1 
)
pure virtual

Adds an element to display the information from the Irrlicht profiler.

Parameters
rectangleRectangle specifying the borders of the element.
parentParent of the element. When 0 the environment itself will be the parent.
idAn identifier for the element.

◆ addScrollBar()

virtual IGUIScrollBar* irr::gui::IGUIEnvironment::addScrollBar ( bool  horizontal,
const core::rect< s32 > &  rectangle,
IGUIElement parent = 0,
s32  id = -1 
)
pure virtual

Adds a scrollbar.

Parameters
horizontalSpecifies if the scroll bar is drawn horizontal or vertical.
rectangleRectangle specifying the borders of the scrollbar.
parentParent gui element of the scroll bar.
idId to identify the gui element.
Returns
Pointer to the created scrollbar. Returns 0 if an error occurred. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ addSpinBox()

virtual IGUISpinBox* irr::gui::IGUIEnvironment::addSpinBox ( const wchar_t *  text,
const core::rect< s32 > &  rectangle,
bool  border = true,
IGUIElement parent = 0,
s32  id = -1 
)
pure virtual

Adds a spin box.

An edit box with up and down buttons

Parameters
textText to be displayed. Can be altered after creation by setText().
rectangleRectangle specifying the borders of the spin box.
borderSet to true if the spin box should have a 3d border.
parentParent item of the element, e.g. a window. Set it to 0 to place the spin box directly in the environment.
idThe ID of the element.
Returns
Pointer to the created spin box. Returns 0 if an error occurred. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ addStaticText()

virtual IGUIStaticText* irr::gui::IGUIEnvironment::addStaticText ( const wchar_t *  text,
const core::rect< s32 > &  rectangle,
bool  border = false,
bool  wordWrap = true,
IGUIElement parent = 0,
s32  id = -1,
bool  fillBackground = false 
)
pure virtual

Adds a static text.

Parameters
textText to be displayed. Can be altered after creation by SetText().
rectangleRectangle specifying the borders of the static text
borderSet to true if the static text should have a 3d border.
wordWrapEnable if the text should wrap into multiple lines.
parentParent item of the element, e.g. a window.
idThe ID of the element.
fillBackgroundEnable if the background shall be filled. Defaults to false.
Returns
Pointer to the created static text. Returns 0 if an error occurred. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ addTab()

virtual IGUITab* irr::gui::IGUIEnvironment::addTab ( const core::rect< s32 > &  rectangle,
IGUIElement parent = 0,
s32  id = -1 
)
pure virtual

Adds tab to the environment.

You can use this element to group other elements. This is not used for creating tabs on tab controls, please use IGUITabControl::addTab() for this instead.

Parameters
rectangleRectangle specifying the borders of the tab.
parentParent item of the element, e.g. a window. Set it to 0 to place the tab directly in the environment.
idAn identifier for the tab.
Returns
Pointer to the created tab. Returns 0 if an error occurred. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ addTabControl()

virtual IGUITabControl* irr::gui::IGUIEnvironment::addTabControl ( const core::rect< s32 > &  rectangle,
IGUIElement parent = 0,
bool  fillbackground = false,
bool  border = true,
s32  id = -1 
)
pure virtual

Adds a tab control to the environment.

Parameters
rectangleRectangle specifying the borders of the tab control.
parentParent item of the element, e.g. a window. Set it to 0 to place the tab control directly in the environment.
fillbackgroundSpecifies if the background of the tab control should be drawn.
borderSpecifies if a flat 3d border should be drawn. This is usually not necessary unless you place the control directly into the environment without a window as parent.
idAn identifier for the tab control.
Returns
Pointer to the created tab control element. Returns 0 if an error occurred. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ addTable()

virtual IGUITable* irr::gui::IGUIEnvironment::addTable ( const core::rect< s32 > &  rectangle,
IGUIElement parent = 0,
s32  id = -1,
bool  drawBackground = false 
)
pure virtual

Adds a table to the environment.

Parameters
rectangleRectangle specifying the borders of the table.
parentParent item of the element, e.g. a window. Set it to 0 to place the element directly in the environment.
idAn identifier for the table.
drawBackgroundFlag whether the background should be drawn.
Returns
Pointer to the created table. Returns 0 if an error occurred. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ addToolBar()

virtual IGUIToolBar* irr::gui::IGUIEnvironment::addToolBar ( IGUIElement parent = 0,
s32  id = -1 
)
pure virtual

Adds a toolbar to the environment.

It is like a menu that is always placed on top of its parent, and contains buttons.

Parameters
parentParent item of the element, e.g. a window. Set it to 0 to place the tool bar directly in the environment.
idAn identifier for the tool bar.
Returns
Pointer to the created tool bar. Returns 0 if an error occurred. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ addTreeView()

virtual IGUITreeView* irr::gui::IGUIEnvironment::addTreeView ( const core::rect< s32 > &  rectangle,
IGUIElement parent = 0,
s32  id = -1,
bool  drawBackground = false,
bool  scrollBarVertical = true,
bool  scrollBarHorizontal = false 
)
pure virtual

Adds a tree view element.

Parameters
rectanglePosition and dimension of list box.
parentParent gui element of the list box.
idId to identify the gui element.
drawBackgroundFlag whether the background should be drawn.
scrollBarVerticalFlag whether a vertical scrollbar should be used
scrollBarHorizontalFlag whether a horizontal scrollbar should be used
Returns
Pointer to the created list box. Returns 0 if an error occurred. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ addWindow()

virtual IGUIWindow* irr::gui::IGUIEnvironment::addWindow ( const core::rect< s32 > &  rectangle,
bool  modal = false,
const wchar_t *  text = 0,
IGUIElement parent = 0,
s32  id = -1 
)
pure virtual

Adds an empty window element.

Parameters
rectangleRectangle specifying the borders of the window.
modalDefines if the dialog is modal. This means, that all other gui elements which were created before the window cannot be used until it is removed.
textText displayed as the window title.
parentParent gui element of the window.
idId with which the gui element can be identified.
Returns
Pointer to the created window. Returns 0 if an error occurred. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ clear()

virtual void irr::gui::IGUIEnvironment::clear ( )
pure virtual

Removes all elements from the environment.

◆ createImageList()

virtual IGUIImageList* irr::gui::IGUIEnvironment::createImageList ( video::ITexture texture,
core::dimension2d< s32 imageSize,
bool  useAlphaChannel 
)
pure virtual

Creates the image list from the given texture.

Parameters
textureTexture to split into images
imageSizeDimension of each image
useAlphaChannelFlag whether alpha channel of the texture should be honored.
Returns
Pointer to the font. Returns 0 if the font could not be loaded. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ createSkin()

virtual IGUISkin* irr::gui::IGUIEnvironment::createSkin ( EGUI_SKIN_TYPE  type)
pure virtual

Creates a new GUI Skin based on a template.

Use setSkin() to set the created skin.

Parameters
typeThe type of the new skin.
Returns
Pointer to the created skin. If you no longer need it, you should call IGUISkin::drop(). See IReferenceCounted::drop() for more information.

◆ deserializeAttributes()

virtual void irr::gui::IGUIEnvironment::deserializeAttributes ( io::IAttributes in,
io::SAttributeReadWriteOptions options = 0 
)
pure virtual

Reads attributes of the gui environment.

◆ drawAll()

virtual void irr::gui::IGUIEnvironment::drawAll ( )
pure virtual

Draws all gui elements by traversing the GUI environment starting at the root node.

◆ getBuiltInFont()

virtual IGUIFont* irr::gui::IGUIEnvironment::getBuiltInFont ( ) const
pure virtual

Returns the default built-in font.

Returns
Pointer to the default built-in font. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ getDefaultGUIElementFactory()

virtual IGUIElementFactory* irr::gui::IGUIEnvironment::getDefaultGUIElementFactory ( ) const
pure virtual

Get the default element factory which can create all built-in elements.

Returns
Pointer to the factory. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ getFileSystem()

virtual io::IFileSystem* irr::gui::IGUIEnvironment::getFileSystem ( ) const
pure virtual

Returns the file system.

Returns
Pointer to the file system.

◆ getFocus()

virtual IGUIElement* irr::gui::IGUIEnvironment::getFocus ( ) const
pure virtual

Returns the element which holds the focus.

Returns
Pointer to the element with focus.

◆ getFocusBehavior()

virtual u32 irr::gui::IGUIEnvironment::getFocusBehavior ( ) const
pure virtual

Get the way the gui does handle focus changes.

Returns
A bitmask which is a combination of EFOCUS_FLAG flags.

◆ getFont()

virtual IGUIFont* irr::gui::IGUIEnvironment::getFont ( const io::path filename)
pure virtual

Returns pointer to the font with the specified filename.

Loads the font if it was not loaded before.

Parameters
filenameFilename of the Font.
Returns
Pointer to the font. Returns 0 if the font could not be loaded. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ getGUIElementFactory()

virtual IGUIElementFactory* irr::gui::IGUIEnvironment::getGUIElementFactory ( u32  index) const
pure virtual

Get a gui element factory by index.

Parameters
indexIndex of the factory.
Returns
Factory at given index, or 0 if no such factory exists.

◆ getHovered()

virtual IGUIElement* irr::gui::IGUIEnvironment::getHovered ( ) const
pure virtual

Returns the element which was last under the mouse cursor.

NOTE: This information is updated after the user-eventreceiver received it's mouse-events. To find the hovered element while catching mouse events you have to use instead: IGUIEnvironment::getRootGUIElement()->getElementFromPoint(mousePos);

Returns
Pointer to the element under the mouse.

◆ getNextElement()

virtual IGUIElement* irr::gui::IGUIEnvironment::getNextElement ( bool  reverse = false,
bool  group = false 
)
pure virtual

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 would happen otherwise by the tab-keys.

Parameters
reverseWhen true it will search backward (toward lower TabOrder numbers, like shift+tab)
groupWhen true it will search for the next tab-group (like ctrl+tab)

◆ getOSOperator()

virtual IOSOperator* irr::gui::IGUIEnvironment::getOSOperator ( ) const
pure virtual

returns a pointer to the OS operator

Returns
Pointer to the OS operator.

◆ getRegisteredGUIElementFactoryCount()

virtual u32 irr::gui::IGUIEnvironment::getRegisteredGUIElementFactoryCount ( ) const
pure virtual

Get amount of registered gui element factories.

Returns
Amount of registered gui element factories.

◆ getRootGUIElement()

virtual IGUIElement* irr::gui::IGUIEnvironment::getRootGUIElement ( )
pure virtual

Returns the root gui element.

This is the first gui element, the (direct or indirect) parent of all other gui elements. It is a valid IGUIElement, with dimensions the same size as the screen.

Returns
Pointer to the root element of the GUI. The returned pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ getSkin()

virtual IGUISkin* irr::gui::IGUIEnvironment::getSkin ( ) const
pure virtual

Returns pointer to the current gui skin.

Returns
Pointer to the GUI skin.

◆ getSpriteBank()

virtual IGUISpriteBank* irr::gui::IGUIEnvironment::getSpriteBank ( const io::path filename)
pure virtual

Returns pointer to the sprite bank which was added with addEmptySpriteBank.

TODO: This should load files in the future, but not implemented so far.

Parameters
filenameName of a spritebank added with addEmptySpriteBank
Returns
Pointer to the sprite bank. Returns 0 if it could not be loaded. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ getVideoDriver()

virtual video::IVideoDriver* irr::gui::IGUIEnvironment::getVideoDriver ( ) const
pure virtual

Returns the current video driver.

Returns
Pointer to the video driver.

◆ hasFocus()

virtual bool irr::gui::IGUIEnvironment::hasFocus ( const IGUIElement element,
bool  checkSubElements = false 
) const
pure virtual

Returns whether the element has focus.

Parameters
elementPointer to the element which is tested.
checkSubElementsWhen true and focus is on a sub-element of element then it will still count as focused and return true
Returns
True if the element has focus, else false.

◆ loadGUI() [1/2]

virtual bool irr::gui::IGUIEnvironment::loadGUI ( const io::path filename,
IGUIElement parent = 0 
)
pure virtual

Loads the gui. Note that the current gui is not cleared before.

When a parent is set the elements will be added below the parent, the parent itself does not deserialize. When the file contains skin-settings from the gui-environment those are always serialized into the guienvironment independent of the parent setting.

Parameters
filenameName of the file.
parentParent for the loaded GUI, root if 0.
Returns
True if loading succeeded, else false.

◆ loadGUI() [2/2]

virtual bool irr::gui::IGUIEnvironment::loadGUI ( io::IReadFile file,
IGUIElement parent = 0 
)
pure virtual

Loads the gui. Note that the current gui is not cleared before.

When a parent is set the elements will be added below the parent, the parent itself does not deserialize. When the file contains skin-settings from the gui-environment those are always serialized into the guienvironment independent of the parent setting.

Parameters
fileThe file to load from.
parentParent for the loaded GUI, root if 0.
Returns
True if loading succeeded, else false.

◆ postEventFromUser()

virtual bool irr::gui::IGUIEnvironment::postEventFromUser ( const SEvent event)
pure virtual

Posts an input event to the environment.

Usually you do not have to use this method, it is used by the engine internally.

Parameters
eventThe event to post.
Returns
True if succeeded, else false.

◆ readGUIElement()

virtual void irr::gui::IGUIEnvironment::readGUIElement ( io::IXMLReader reader,
IGUIElement node 
)
pure virtual

reads an element

◆ registerGUIElementFactory()

virtual void irr::gui::IGUIEnvironment::registerGUIElementFactory ( IGUIElementFactory factoryToAdd)
pure virtual

Adds an element factory to the gui environment.

Use this to extend the gui environment with new element types which it should be able to create automatically, for example when loading data from xml files.

Parameters
factoryToAddPointer to new factory.

◆ removeFocus()

virtual bool irr::gui::IGUIEnvironment::removeFocus ( IGUIElement element)
pure virtual

Removes the focus from an element.

Causes a EGET_ELEMENT_FOCUS_LOST event. If the event is absorbed then the focus will not be changed.

Parameters
elementPointer to the element which shall lose the focus.
Returns
True on success, false on failure

◆ removeFont()

virtual void irr::gui::IGUIEnvironment::removeFont ( IGUIFont font)
pure virtual

remove loaded font

◆ saveGUI() [1/2]

virtual bool irr::gui::IGUIEnvironment::saveGUI ( const io::path filename,
IGUIElement start = 0 
)
pure virtual

Saves the current gui into a file.

Parameters
filenameName of the file.
startThe GUIElement to start with. Root if 0.
Returns
True if saving succeeded, else false.

◆ saveGUI() [2/2]

virtual bool irr::gui::IGUIEnvironment::saveGUI ( io::IWriteFile file,
IGUIElement start = 0 
)
pure virtual

Saves the current gui into a file.

Parameters
fileThe file to write to.
startThe GUIElement to start with. Root if 0.
Returns
True if saving succeeded, else false.

◆ serializeAttributes()

virtual void irr::gui::IGUIEnvironment::serializeAttributes ( io::IAttributes out,
io::SAttributeReadWriteOptions options = 0 
) const
pure virtual

Writes attributes of the gui environment.

◆ setFocus()

virtual bool irr::gui::IGUIEnvironment::setFocus ( IGUIElement element)
pure virtual

Sets the focus to an element.

Causes a EGET_ELEMENT_FOCUS_LOST event followed by a EGET_ELEMENT_FOCUSED event. If someone absorbed either of the events, then the focus will not be changed.

Parameters
elementPointer to the element which shall get the focus.
Returns
True on success, false on failure

◆ setFocusBehavior()

virtual void irr::gui::IGUIEnvironment::setFocusBehavior ( u32  flags)
pure virtual

Set the way the gui will handle automatic focus changes.

The default is (EFF_SET_ON_LMOUSE_DOWN | EFF_SET_ON_TAB). with the left mouse button. This does not affect the setFocus function itself - users can still call that whenever they want on any element.

Parameters
flagsA bitmask which is a combination of EFOCUS_FLAG flags.

◆ setSkin()

virtual void irr::gui::IGUIEnvironment::setSkin ( IGUISkin skin)
pure virtual

Sets a new GUI Skin.

You can use this to change the appearance of the whole GUI Environment. You can set one of the built-in skins or implement your own class derived from IGUISkin and enable it using this method. To set for example the built-in Windows classic skin, use the following code:

gui::IGUISkin* newskin = environment->createSkin(gui::EGST_WINDOWS_CLASSIC);
environment->setSkin(newskin);
newskin->drop();
Parameters
skinNew skin to use.

◆ setUserEventReceiver()

virtual void irr::gui::IGUIEnvironment::setUserEventReceiver ( IEventReceiver evr)
pure virtual

This sets a new event receiver for gui events.

Usually you do not have to use this method, it is used by the engine internally.

Parameters
evrPointer to the new receiver.

◆ writeGUIElement()

virtual void irr::gui::IGUIEnvironment::writeGUIElement ( io::IXMLWriter writer,
IGUIElement node 
)
pure virtual

writes an element


The documentation for this class was generated from the following file: