Irrlicht 3D Engine
Loading...
Searching...
No Matches
IGUIEnvironment.h
Go to the documentation of this file.
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GUI_ENVIRONMENT_H_INCLUDED__
6#define __I_GUI_ENVIRONMENT_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "IGUISkin.h"
10#include "rect.h"
11#include "EMessageBoxFlags.h"
12#include "IEventReceiver.h"
13#include "IXMLReader.h"
14#include "path.h"
15
16namespace irr
17{
18 class IOSOperator;
19 class IEventReceiver;
20
21 namespace io
22 {
23 class IXMLWriter;
24 class IReadFile;
25 class IWriteFile;
26 class IFileSystem;
27 } // end namespace io
28 namespace video
29 {
30 class IVideoDriver;
31 class ITexture;
32 } // end namespace video
33
34namespace gui
35{
36
37class IGUIElement;
38class IGUIFont;
39class IGUISpriteBank;
40class IGUIScrollBar;
41class IGUIImage;
42class IGUIMeshViewer;
43class IGUICheckBox;
44class IGUIListBox;
45class IGUITreeView;
46class IGUIImageList;
49class IGUIInOutFader;
50class IGUIStaticText;
51class IGUIEditBox;
52class IGUISpinBox;
53class IGUITabControl;
54class IGUITab;
55class IGUITable;
56class IGUIContextMenu;
57class IGUIComboBox;
58class IGUIToolBar;
59class IGUIButton;
60class IGUIWindow;
62
64
70class IGUIEnvironment : public virtual IReferenceCounted
71{
72public:
73
75 virtual void drawAll() = 0;
76
78
83 virtual bool setFocus(IGUIElement* element) = 0;
84
86
87 virtual IGUIElement* getFocus() const = 0;
88
90
95 virtual IGUIElement* getHovered() const = 0;
96
98
102 virtual bool removeFocus(IGUIElement* element) = 0;
103
105
107 virtual bool hasFocus(IGUIElement* element) const = 0;
108
110
112
114
115 virtual io::IFileSystem* getFileSystem() const = 0;
116
118
119 virtual IOSOperator* getOSOperator() const = 0;
120
122 virtual void clear() = 0;
123
125
129 virtual bool postEventFromUser(const SEvent& event) = 0;
130
132
135 virtual void setUserEventReceiver(IEventReceiver* evr) = 0;
136
138
139 virtual IGUISkin* getSkin() const = 0;
140
142
154 virtual void setSkin(IGUISkin* skin) = 0;
155
157
163
164
166
173 core::dimension2d<s32> imageSize,
174 bool useAlphaChannel ) = 0;
175
177
182 virtual IGUIFont* getFont(const io::path& filename) = 0;
183
185
190 virtual IGUIFont* addFont(const io::path& name, IGUIFont* font) = 0;
191
193 virtual void removeFont(IGUIFont* font) = 0;
194
196
199 virtual IGUIFont* getBuiltInFont() const = 0;
200
202
206 virtual IGUISpriteBank* getSpriteBank(const io::path& filename) = 0;
207
209
212 virtual IGUISpriteBank* addEmptySpriteBank(const io::path& name) = 0;
213
215
222
224
232 virtual IGUIButton* addButton(const core::rect<s32>& rectangle,
233 IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0, const wchar_t* tooltiptext = 0) = 0;
234
236
246 virtual IGUIWindow* addWindow(const core::rect<s32>& rectangle, bool modal = false,
247 const wchar_t* text=0, IGUIElement* parent=0, s32 id=-1) = 0;
248
250
257
259
273 virtual IGUIWindow* addMessageBox(const wchar_t* caption, const wchar_t* text=0,
274 bool modal = true, s32 flags = EMBF_OK, IGUIElement* parent=0, s32 id=-1, video::ITexture* image=0) = 0;
275
277
285 virtual IGUIScrollBar* addScrollBar(bool horizontal, const core::rect<s32>& rectangle,
286 IGUIElement* parent=0, s32 id=-1) = 0;
287
289
300 virtual IGUIImage* addImage(video::ITexture* image, core::position2d<s32> pos,
301 bool useAlphaChannel=true, IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
302
304
314 virtual IGUIImage* addImage(const core::rect<s32>& rectangle,
315 IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0, bool useAlphaChannel=true) = 0;
316
318
326 virtual IGUICheckBox* addCheckBox(bool checked, const core::rect<s32>& rectangle,
327 IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
328
330
337 virtual IGUIListBox* addListBox(const core::rect<s32>& rectangle,
338 IGUIElement* parent=0, s32 id=-1, bool drawBackground=false) = 0;
339
341
350 virtual IGUITreeView* addTreeView(const core::rect<s32>& rectangle,
351 IGUIElement* parent=0, s32 id=-1, bool drawBackground=false,
352 bool scrollBarVertical = true, bool scrollBarHorizontal = false) = 0;
353
355
363 IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
364
366
379 virtual IGUIFileOpenDialog* addFileOpenDialog(const wchar_t* title=0,
380 bool modal=true, IGUIElement* parent=0, s32 id=-1,
381 bool restoreCWD=false, io::path::char_type* startDir=0) = 0;
382
384
393 virtual IGUIColorSelectDialog* addColorSelectDialog(const wchar_t* title = 0,
394 bool modal=true, IGUIElement* parent=0, s32 id=-1) = 0;
395
397
408 virtual IGUIStaticText* addStaticText(const wchar_t* text, const core::rect<s32>& rectangle,
409 bool border=false, bool wordWrap=true, IGUIElement* parent=0, s32 id=-1,
410 bool fillBackground = false) = 0;
411
413
427 virtual IGUIEditBox* addEditBox(const wchar_t* text, const core::rect<s32>& rectangle,
428 bool border=true, IGUIElement* parent=0, s32 id=-1) = 0;
429
431
441 virtual IGUISpinBox* addSpinBox(const wchar_t* text, const core::rect<s32>& rectangle,
442 bool border=true,IGUIElement* parent=0, s32 id=-1) = 0;
443
445
452 virtual IGUIInOutFader* addInOutFader(const core::rect<s32>* rectangle=0, IGUIElement* parent=0, s32 id=-1) = 0;
453
455
468 IGUIElement* parent=0, bool fillbackground=false,
469 bool border=true, s32 id=-1) = 0;
470
472
482 virtual IGUITab* addTab(const core::rect<s32>& rectangle,
483 IGUIElement* parent=0, s32 id=-1) = 0;
484
486
495 IGUIElement* parent=0, s32 id=-1) = 0;
496
498
506 virtual IGUIContextMenu* addMenu(IGUIElement* parent=0, s32 id=-1) = 0;
507
509
517 virtual IGUIToolBar* addToolBar(IGUIElement* parent=0, s32 id=-1) = 0;
518
520
527 virtual IGUIComboBox* addComboBox(const core::rect<s32>& rectangle,
528 IGUIElement* parent=0, s32 id=-1) = 0;
529
531
539 virtual IGUITable* addTable(const core::rect<s32>& rectangle,
540 IGUIElement* parent=0, s32 id=-1, bool drawBackground=false) =0;
541
543
547
549
553 virtual void registerGUIElementFactory(IGUIElementFactory* factoryToAdd) = 0;
554
556
558
560
562 virtual IGUIElementFactory* getGUIElementFactory(u32 index) const = 0;
563
565
570 virtual IGUIElement* addGUIElement(const c8* elementName, IGUIElement* parent=0) = 0;
571
573
576 virtual bool saveGUI(const io::path& filename, IGUIElement* start=0) = 0;
577
579
582 virtual bool saveGUI(io::IWriteFile* file, IGUIElement* start=0) = 0;
583
585
591 virtual bool loadGUI(const io::path& filename, IGUIElement* parent=0) = 0;
592
594
600 virtual bool loadGUI(io::IReadFile* file, IGUIElement* parent=0) = 0;
601
604
607
609 virtual void writeGUIElement(io::IXMLWriter* writer, IGUIElement* node) =0;
610
612 virtual void readGUIElement(io::IXMLReader* reader, IGUIElement* node) =0;
613};
614
615
616} // end namespace gui
617} // end namespace irr
618
619#endif
620
Interface of an object which can receive events.
The Operating system operator provides operation system specific methods and informations.
Definition IOSOperator.h:16
IReferenceCounted()
Constructor.
Specifies a 2 dimensional size.
Definition dimension2d.h:21
Rectangle template.
Definition rect.h:27
GUI Button interface.
Definition IGUIButton.h:59
GUI Check box interface.
Standard color chooser dialog.
Combobox widget.
GUI Context menu interface.
Single line edit box for editing simple text.
Definition IGUIEditBox.h:24
Interface making it possible to dynamically create GUI elements.
Base class of all GUI elements.
Definition IGUIElement.h:26
GUI Environment. Used as factory and manager of all other GUI elements.
virtual u32 getRegisteredGUIElementFactoryCount() const =0
Get amount of registered gui element factories.
virtual IGUIImage * addImage(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.
virtual IGUITabControl * addTabControl(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.
virtual IGUISpinBox * addSpinBox(const wchar_t *text, const core::rect< s32 > &rectangle, bool border=true, IGUIElement *parent=0, s32 id=-1)=0
Adds a spin box.
virtual IGUIFont * getFont(const io::path &filename)=0
Returns pointer to the font with the specified filename.
virtual IGUITable * addTable(const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1, bool drawBackground=false)=0
Adds a table to the environment.
virtual IGUIScrollBar * addScrollBar(bool horizontal, const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1)=0
Adds a scrollbar.
virtual IGUIListBox * addListBox(const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1, bool drawBackground=false)=0
Adds a list box element.
virtual IGUIElementFactory * getDefaultGUIElementFactory() const =0
Get the default element factory which can create all built-in elements.
virtual bool loadGUI(io::IReadFile *file, IGUIElement *parent=0)=0
Loads the gui. Note that the current gui is not cleared before.
virtual void setUserEventReceiver(IEventReceiver *evr)=0
This sets a new event receiver for gui events.
virtual IGUIImage * addImage(const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1, const wchar_t *text=0, bool useAlphaChannel=true)=0
Adds an image element.
virtual bool setFocus(IGUIElement *element)=0
Sets the focus to an element.
virtual IGUICheckBox * addCheckBox(bool checked, const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1, const wchar_t *text=0)=0
Adds a checkbox element.
virtual void writeGUIElement(io::IXMLWriter *writer, IGUIElement *node)=0
writes an element
virtual IGUISpriteBank * addEmptySpriteBank(const io::path &name)=0
Adds an empty sprite bank to the manager.
virtual IGUIMeshViewer * addMeshViewer(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.
virtual bool saveGUI(io::IWriteFile *file, IGUIElement *start=0)=0
Saves the current gui into a file.
virtual io::IFileSystem * getFileSystem() const =0
Returns the file system.
virtual IGUIWindow * 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)=0
Adds a message box.
virtual void removeFont(IGUIFont *font)=0
remove loaded font
virtual IGUISkin * createSkin(EGUI_SKIN_TYPE type)=0
Creates a new GUI Skin based on a template.
virtual video::IVideoDriver * getVideoDriver() const =0
Returns the current video driver.
virtual void serializeAttributes(io::IAttributes *out, io::SAttributeReadWriteOptions *options=0) const =0
Writes attributes of the gui environment.
virtual void registerGUIElementFactory(IGUIElementFactory *factoryToAdd)=0
Adds an element factory to the gui environment.
virtual IGUIContextMenu * addMenu(IGUIElement *parent=0, s32 id=-1)=0
Adds a menu to the environment.
virtual IGUIFont * addFont(const io::path &name, IGUIFont *font)=0
Adds an externally loaded font to the font list.
virtual bool loadGUI(const io::path &filename, IGUIElement *parent=0)=0
Loads the gui. Note that the current gui is not cleared before.
virtual IGUITab * addTab(const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1)=0
Adds tab to the environment.
virtual IGUIElement * getRootGUIElement()=0
Returns the root gui element.
virtual IGUIFont * getBuiltInFont() const =0
Returns the default built-in font.
virtual void clear()=0
Removes all elements from the environment.
virtual IGUIComboBox * addComboBox(const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1)=0
Adds a combo box to the environment.
virtual IGUIElement * getFocus() const =0
Returns the element which holds the focus.
virtual void deserializeAttributes(io::IAttributes *in, io::SAttributeReadWriteOptions *options=0)=0
Reads attributes of the gui environment.
virtual bool hasFocus(IGUIElement *element) const =0
Returns whether the element has focus.
virtual IGUIInOutFader * addInOutFader(const core::rect< s32 > *rectangle=0, IGUIElement *parent=0, s32 id=-1)=0
Adds an element for fading in or out.
virtual IOSOperator * getOSOperator() const =0
returns a pointer to the OS operator
virtual IGUIColorSelectDialog * addColorSelectDialog(const wchar_t *title=0, bool modal=true, IGUIElement *parent=0, s32 id=-1)=0
Adds a color select dialog.
virtual IGUIEditBox * addEditBox(const wchar_t *text, const core::rect< s32 > &rectangle, bool border=true, IGUIElement *parent=0, s32 id=-1)=0
Adds an edit box.
virtual IGUIStaticText * 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)=0
Adds a static text.
virtual IGUIElement * getHovered() const =0
Returns the element which was last under the mouse cursor.
virtual void drawAll()=0
Draws all gui elements by traversing the GUI environment starting at the root node.
virtual bool removeFocus(IGUIElement *element)=0
Removes the focus from an element.
virtual IGUISkin * getSkin() const =0
Returns pointer to the current gui skin.
virtual IGUIWindow * addWindow(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.
virtual bool saveGUI(const io::path &filename, IGUIElement *start=0)=0
Saves the current gui into a file.
virtual IGUIImageList * createImageList(video::ITexture *texture, core::dimension2d< s32 > imageSize, bool useAlphaChannel)=0
Creates the image list from the given texture.
virtual IGUIContextMenu * addContextMenu(const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1)=0
Adds a context menu to the environment.
virtual IGUIElement * addGUIElement(const c8 *elementName, IGUIElement *parent=0)=0
Adds a GUI element by its name.
virtual void readGUIElement(io::IXMLReader *reader, IGUIElement *node)=0
reads an element
virtual IGUISpriteBank * getSpriteBank(const io::path &filename)=0
Returns pointer to the sprite bank with the specified file name.
virtual IGUIFileOpenDialog * addFileOpenDialog(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.
virtual IGUIElementFactory * getGUIElementFactory(u32 index) const =0
Get a gui element factory by index.
virtual IGUIButton * addButton(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.
virtual void setSkin(IGUISkin *skin)=0
Sets a new GUI Skin.
virtual IGUITreeView * addTreeView(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.
virtual IGUIToolBar * addToolBar(IGUIElement *parent=0, s32 id=-1)=0
Adds a toolbar to the environment.
virtual IGUIElement * addModalScreen(IGUIElement *parent)=0
Adds a modal screen.
virtual bool postEventFromUser(const SEvent &event)=0
Posts an input event to the environment.
Standard file chooser dialog.
Font interface.
Definition IGUIFont.h:40
GUI element displaying an image.
Definition IGUIImage.h:21
Element for fading out or in.
Default list box GUI element.
Definition IGUIListBox.h:39
3d mesh viewing GUI element.
Default scroll bar GUI element.
A skin modifies the look of the GUI elements.
Definition IGUISkin.h:379
Single line edit box + spin buttons.
Definition IGUISpinBox.h:21
Sprite bank interface.
Multi or single line text label.
A standard tab control.
A tab-page, onto which other gui elements could be added.
Default list box GUI element.
Definition IGUITable.h:90
Stays at the top of its parent like the menu bar and contains tool buttons.
Definition IGUIToolbar.h:22
Default tree view GUI element.
Default moveable window GUI element with border, caption and close icons.
Definition IGUIWindow.h:22
Provides a generic interface for attributes and their values and the possiblity to serialize them.
Definition IAttributes.h:42
The FileSystem manages files and archives and provides access to them.
Definition IFileSystem.h:33
Interface providing read acess to a file.
Definition IReadFile.h:18
Interface providing write access to a file.
Definition IWriteFile.h:18
Interface providing methods for making it easier to write XML files.
Definition IXMLWriter.h:21
Interface of a Video Driver dependent Texture.
Definition ITexture.h:99
Interface to driver which is able to perform 2d and 3d graphics functions.
The gui namespace contains useful classes for easy creation of a graphical user interface.
EGUI_SKIN_TYPE
Enumeration of available default skins.
Definition IGUISkin.h:31
@ EMBF_OK
Flag for the ok button.
This namespace provides interfaces for input/output: Reading and writing files, accessing zip archive...
Definition EAttributes.h:11
IIrrXMLReader< wchar_t, IReferenceCounted > IXMLReader
An xml reader for wide characters, derived from IReferenceCounted.
Definition IXMLReader.h:19
core::string< fschar_t > path
Type used for all file system related strings.
Definition path.h:17
The video namespace contains classes for accessing the video driver. All 2d and 3d rendering is done ...
Everything in the Irrlicht Engine can be found in this namespace.
Definition aabbox3d.h:13
unsigned int u32
32 bit unsigned variable.
Definition irrTypes.h:58
char c8
8 bit character variable.
Definition irrTypes.h:31
signed int s32
32 bit signed variable.
Definition irrTypes.h:66
SEvents hold information about an event. See irr::IEventReceiver for details on event handling.
struct holding data describing options