arsa  2.7
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 "EFocusFlags.h"
13 #include "IEventReceiver.h"
14 #include "IXMLReader.h"
15 #include "IXMLWriter.h"
16 #include "path.h"
17 
18 namespace irr
19 {
20  class IOSOperator;
21  class IEventReceiver;
22 
23  namespace io
24  {
25  class IReadFile;
26  class IWriteFile;
27  class IFileSystem;
28  } // end namespace io
29  namespace video
30  {
31  class IVideoDriver;
32  class ITexture;
33  } // end namespace video
34 
35 namespace gui
36 {
37 
38 class IGUIElement;
39 class IGUIFont;
40 class IGUISpriteBank;
41 class IGUIScrollBar;
42 class IGUIImage;
43 class IGUIMeshViewer;
44 class IGUICheckBox;
45 class IGUIListBox;
46 class IGUITreeView;
47 class IGUIImageList;
48 class IGUIFileOpenDialog;
49 class IGUIColorSelectDialog;
50 class IGUIInOutFader;
51 class IGUIStaticText;
52 class IGUIEditBox;
53 class IGUISpinBox;
54 class IGUITabControl;
55 class IGUITab;
56 class IGUITable;
57 class IGUIContextMenu;
58 class IGUIComboBox;
59 class IGUIToolBar;
60 class IGUIButton;
61 class IGUIWindow;
62 class IGUIProfiler;
63 class IGUIElementFactory;
64 
66 
72 class IGUIEnvironment : public virtual IReferenceCounted
73 {
74 public:
75 
77  virtual void drawAll() = 0;
78 
80 
85  virtual bool setFocus(IGUIElement* element) = 0;
86 
88 
89  virtual IGUIElement* getFocus() const = 0;
90 
92 
97  virtual IGUIElement* getHovered() const = 0;
98 
100 
104  virtual bool removeFocus(IGUIElement* element) = 0;
105 
107 
110  virtual bool hasFocus(const IGUIElement* element, bool checkSubElements=false) const = 0;
111 
113 
114  virtual video::IVideoDriver* getVideoDriver() const = 0;
115 
117 
118  virtual io::IFileSystem* getFileSystem() const = 0;
119 
121 
122  virtual IOSOperator* getOSOperator() const = 0;
123 
125  virtual void clear() = 0;
126 
128 
132  virtual bool postEventFromUser(const SEvent& event) = 0;
133 
135 
138  virtual void setUserEventReceiver(IEventReceiver* evr) = 0;
139 
141 
142  virtual IGUISkin* getSkin() const = 0;
143 
145 
157  virtual void setSkin(IGUISkin* skin) = 0;
158 
160 
165  virtual IGUISkin* createSkin(EGUI_SKIN_TYPE type) = 0;
166 
167 
169 
177  bool useAlphaChannel ) = 0;
178 
180 
185  virtual IGUIFont* getFont(const io::path& filename) = 0;
186 
188 
193  virtual IGUIFont* addFont(const io::path& name, IGUIFont* font) = 0;
194 
196  virtual void removeFont(IGUIFont* font) = 0;
197 
199 
202  virtual IGUIFont* getBuiltInFont() const = 0;
203 
205 
209  virtual IGUISpriteBank* getSpriteBank(const io::path& filename) = 0;
210 
212 
215  virtual IGUISpriteBank* addEmptySpriteBank(const io::path& name) = 0;
216 
218 
224  virtual IGUIElement* getRootGUIElement() = 0;
225 
227 
235  virtual IGUIButton* addButton(const core::rect<s32>& rectangle,
236  IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0, const wchar_t* tooltiptext = 0) = 0;
237 
239 
249  virtual IGUIWindow* addWindow(const core::rect<s32>& rectangle, bool modal = false,
250  const wchar_t* text=0, IGUIElement* parent=0, s32 id=-1) = 0;
251 
253 
264  virtual IGUIElement* addModalScreen(IGUIElement* parent) = 0;
265 
267 
280  virtual IGUIWindow* addMessageBox(const wchar_t* caption, const wchar_t* text=0,
281  bool modal = true, s32 flags = EMBF_OK, IGUIElement* parent=0, s32 id=-1, video::ITexture* image=0) = 0;
282 
284 
292  virtual IGUIScrollBar* addScrollBar(bool horizontal, const core::rect<s32>& rectangle,
293  IGUIElement* parent=0, s32 id=-1) = 0;
294 
296 
307  virtual IGUIImage* addImage(video::ITexture* image, core::position2d<s32> pos,
308  bool useAlphaChannel=true, IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
309 
311 
321  virtual IGUIImage* addImage(const core::rect<s32>& rectangle,
322  IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0, bool useAlphaChannel=true) = 0;
323 
325 
333  virtual IGUICheckBox* addCheckBox(bool checked, const core::rect<s32>& rectangle,
334  IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
335 
337 
344  virtual IGUIListBox* addListBox(const core::rect<s32>& rectangle,
345  IGUIElement* parent=0, s32 id=-1, bool drawBackground=false) = 0;
346 
348 
357  virtual IGUITreeView* addTreeView(const core::rect<s32>& rectangle,
358  IGUIElement* parent=0, s32 id=-1, bool drawBackground=false,
359  bool scrollBarVertical = true, bool scrollBarHorizontal = false) = 0;
360 
362 
369  virtual IGUIMeshViewer* addMeshViewer(const core::rect<s32>& rectangle,
370  IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
371 
373 
386  virtual IGUIFileOpenDialog* addFileOpenDialog(const wchar_t* title=0,
387  bool modal=true, IGUIElement* parent=0, s32 id=-1,
388  bool restoreCWD=false, io::path::char_type* startDir=0) = 0;
389 
391 
400  virtual IGUIColorSelectDialog* addColorSelectDialog(const wchar_t* title = 0,
401  bool modal=true, IGUIElement* parent=0, s32 id=-1) = 0;
402 
404 
415  virtual IGUIStaticText* addStaticText(const wchar_t* text, const core::rect<s32>& rectangle,
416  bool border=false, bool wordWrap=true, IGUIElement* parent=0, s32 id=-1,
417  bool fillBackground = false) = 0;
418 
420 
434  virtual IGUIEditBox* addEditBox(const wchar_t* text, const core::rect<s32>& rectangle,
435  bool border=true, IGUIElement* parent=0, s32 id=-1) = 0;
436 
438 
448  virtual IGUISpinBox* addSpinBox(const wchar_t* text, const core::rect<s32>& rectangle,
449  bool border=true,IGUIElement* parent=0, s32 id=-1) = 0;
450 
452 
459  virtual IGUIInOutFader* addInOutFader(const core::rect<s32>* rectangle=0, IGUIElement* parent=0, s32 id=-1) = 0;
460 
462 
474  virtual IGUITabControl* addTabControl(const core::rect<s32>& rectangle,
475  IGUIElement* parent=0, bool fillbackground=false,
476  bool border=true, s32 id=-1) = 0;
477 
479 
489  virtual IGUITab* addTab(const core::rect<s32>& rectangle,
490  IGUIElement* parent=0, s32 id=-1) = 0;
491 
493 
501  virtual IGUIContextMenu* addContextMenu(const core::rect<s32>& rectangle,
502  IGUIElement* parent=0, s32 id=-1) = 0;
503 
505 
513  virtual IGUIContextMenu* addMenu(IGUIElement* parent=0, s32 id=-1) = 0;
514 
516 
524  virtual IGUIToolBar* addToolBar(IGUIElement* parent=0, s32 id=-1) = 0;
525 
527 
534  virtual IGUIComboBox* addComboBox(const core::rect<s32>& rectangle,
535  IGUIElement* parent=0, s32 id=-1) = 0;
536 
538 
546  virtual IGUITable* addTable(const core::rect<s32>& rectangle,
547  IGUIElement* parent=0, s32 id=-1, bool drawBackground=false) =0;
548 
550 
554  virtual IGUIProfiler* addProfilerDisplay(const core::rect<s32>& rectangle,
555  IGUIElement* parent=0, s32 id=-1) = 0;
556 
558 
561  virtual IGUIElementFactory* getDefaultGUIElementFactory() const = 0;
562 
564 
568  virtual void registerGUIElementFactory(IGUIElementFactory* factoryToAdd) = 0;
569 
571 
572  virtual u32 getRegisteredGUIElementFactoryCount() const = 0;
573 
575 
577  virtual IGUIElementFactory* getGUIElementFactory(u32 index) const = 0;
578 
580 
585  virtual IGUIElement* addGUIElement(const c8* elementName, IGUIElement* parent=0) = 0;
586 
588 
591  virtual bool saveGUI(const io::path& filename, IGUIElement* start=0) = 0;
592 
594 
597  virtual bool saveGUI(io::IWriteFile* file, IGUIElement* start=0) = 0;
598 
600 
606  virtual bool loadGUI(const io::path& filename, IGUIElement* parent=0) = 0;
607 
609 
615  virtual bool loadGUI(io::IReadFile* file, IGUIElement* parent=0) = 0;
616 
618  virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const =0;
619 
622 
624  virtual void writeGUIElement(io::IXMLWriter* writer, IGUIElement* node) =0;
625 
627  virtual void readGUIElement(io::IXMLReader* reader, IGUIElement* node) =0;
628 
630 
635  virtual IGUIElement* getNextElement(bool reverse=false, bool group=false) = 0;
636 
638 
642  virtual void setFocusBehavior(u32 flags) = 0;
643 
645 
646  virtual u32 getFocusBehavior() const = 0;
647 };
648 
649 
650 } // end namespace gui
651 } // end namespace irr
652 
653 #endif
654 
virtual bool postEventFromUser(const SEvent &event)=0
Posts an input event to the environment.
virtual void setSkin(IGUISkin *skin)=0
Sets a new GUI Skin.
The FileSystem manages files and archives and provides access to them.
Definition: IFileSystem.h:32
Default moveable window GUI element with border, caption and close icons.
Definition: IGUIWindow.h:21
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.
GLboolean GLuint group
virtual u32 getRegisteredGUIElementFactoryCount() const =0
Get amount of registered gui element factories.
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.
Element for fading out or in.
3d mesh viewing GUI element.
Provides a generic interface for attributes and their values and the possibility to serialize them.
Definition: IAttributes.h:41
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.
SEvents hold information about an event. See irr::IEventReceiver for details on event handling.
GUI Button interface.
Definition: IGUIButton.h:109
Single line edit box + spin buttons.
Definition: IGUISpinBox.h:35
Interface providing read access to a file.
Definition: IReadFile.h:18
virtual IGUIElement * addGUIElement(const c8 *elementName, IGUIElement *parent=0)=0
Adds a GUI element by its name.
EGUI_SKIN_TYPE
Enumeration of available default skins.
Definition: IGUISkin.h:30
GLeglImageOES image
Definition: SDL_opengl.h:2148
virtual IGUIScrollBar * addScrollBar(bool horizontal, const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1)=0
Adds a scrollbar.
Sprite bank interface.
virtual u32 getFocusBehavior() const =0
Get the way the gui does handle focus changes.
virtual video::IVideoDriver * getVideoDriver() const =0
Returns the current video driver.
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.
GLenum GLenum GLuint texture
char c8
8 bit character variable.
Definition: irrTypes.h:35
virtual IGUIContextMenu * addContextMenu(const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1)=0
Adds a context menu to the environment.
virtual IGUIElement * addModalScreen(IGUIElement *parent)=0
Adds a modal screen.
virtual IGUIImageList * createImageList(video::ITexture *texture, core::dimension2d< s32 > imageSize, bool useAlphaChannel)=0
Creates the image list from the given texture.
virtual void registerGUIElementFactory(IGUIElementFactory *factoryToAdd)=0
Adds an element factory to the gui environment.
virtual IGUISpriteBank * getSpriteBank(const io::path &filename)=0
Returns pointer to the sprite bank which was added with addEmptySpriteBank.
virtual IGUIElement * getNextElement(bool reverse=false, bool group=false)=0
Find the next element which would be selected when pressing the tab-key.
virtual bool hasFocus(const IGUIElement *element, bool checkSubElements=false) const =0
Returns whether the element has focus.
virtual IGUIElementFactory * getGUIElementFactory(u32 index) const =0
Get a gui element factory by index.
struct holding data describing options
virtual IGUIToolBar * addToolBar(IGUIElement *parent=0, s32 id=-1)=0
Adds a toolbar to the environment.
Combobox widget.
Definition: IGUIComboBox.h:19
GUI Check box interface.
Definition: IGUICheckBox.h:19
virtual void clear()=0
Removes all elements from the environment.
virtual IGUIElement * getRootGUIElement()=0
Returns the root gui element.
GLuint start
Definition: SDL_opengl.h:1571
virtual IGUIInOutFader * addInOutFader(const core::rect< s32 > *rectangle=0, IGUIElement *parent=0, s32 id=-1)=0
Adds an element for fading in or out.
GLuint const GLchar * name
virtual IGUIElement * getHovered() const =0
Returns the element which was last under the mouse cursor.
Everything in the Irrlicht Engine can be found in this namespace.
Definition: CARSADPad.h:6
virtual bool setFocus(IGUIElement *element)=0
Sets the focus to an element.
A standard tab control.
virtual void deserializeAttributes(io::IAttributes *in, io::SAttributeReadWriteOptions *options=0)=0
Reads attributes of the gui environment.
virtual IGUIColorSelectDialog * addColorSelectDialog(const wchar_t *title=0, bool modal=true, IGUIElement *parent=0, s32 id=-1)=0
Adds a color select dialog.
GUI Environment. Used as factory and manager of all other GUI elements.
Interface providing write access to a file.
Definition: IWriteFile.h:17
Specifies a 2 dimensional size.
Definition: dimension2d.h:20
A skin modifies the look of the GUI elements.
Definition: IGUISkin.h:384
virtual void readGUIElement(io::IXMLReader *reader, IGUIElement *node)=0
reads an element
Multi or single line text label.
A tab-page, onto which other gui elements could be added.
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.
Interface of an object which can receive events.
Default list box GUI element.
Definition: IGUIListBox.h:39
Font interface.
Definition: IGUIFont.h:39
signed int s32
32 bit signed variable.
Definition: irrTypes.h:70
Default scroll bar GUI element.
Definition: IGUIScrollBar.h:19
virtual void writeGUIElement(io::IXMLWriter *writer, IGUIElement *node)=0
writes an element
virtual IGUIContextMenu * addMenu(IGUIElement *parent=0, s32 id=-1)=0
Adds a menu to the environment.
virtual IGUITable * addTable(const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1, bool drawBackground=false)=0
Adds a table to the environment.
Flag for the OK button.
virtual bool saveGUI(const io::path &filename, IGUIElement *start=0)=0
Saves the current gui into a file.
struct _cl_event * event
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
Interface providing easy read access to a XML file.
Definition: irrXML.h:277
virtual IGUISkin * createSkin(EGUI_SKIN_TYPE type)=0
Creates a new GUI Skin based on a template.
virtual IGUITab * addTab(const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1)=0
Adds tab to the environment.
virtual IGUISkin * getSkin() const =0
Returns pointer to the current gui skin.
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.
Interface to driver which is able to perform 2d and 3d graphics functions.
Definition: IVideoDriver.h:151
virtual IGUIFont * getFont(const io::path &filename)=0
Returns pointer to the font with the specified filename.
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei imageSize
Definition: SDL_opengl.h:1974
The Operating system operator provides operation system specific methods and information.
Definition: IOSOperator.h:15
virtual IGUISpriteBank * addEmptySpriteBank(const io::path &name)=0
Adds an empty sprite bank to the manager.
virtual void removeFont(IGUIFont *font)=0
remove loaded font
virtual void drawAll()=0
Draws all gui elements by traversing the GUI environment starting at the root node.
GLuint index
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 void serializeAttributes(io::IAttributes *out, io::SAttributeReadWriteOptions *options=0) const =0
Writes attributes of the gui environment.
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 IGUIFont * addFont(const io::path &name, IGUIFont *font)=0
Adds an externally loaded font to the font list.
Interface making it possible to dynamically create GUI elements.
Base class of all GUI elements.
Definition: IGUIElement.h:23
GUI Context menu interface.
Default list box GUI element.
Definition: IGUITable.h:89
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 IGUIProfiler * addProfilerDisplay(const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1)=0
Adds an element to display the information from the Irrlicht profiler.
Interface providing methods for making it easier to write XML files.
Definition: irrXML.h:377
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 setUserEventReceiver(IEventReceiver *evr)=0
This sets a new event receiver for gui events.
virtual IOSOperator * getOSOperator() const =0
returns a pointer to the OS operator
virtual IGUIListBox * addListBox(const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1, bool drawBackground=false)=0
Adds a list box element.
Standard file chooser dialog.
Single line edit box for editing simple text.
Definition: IGUIEditBox.h:23
Stays at the top of its parent like the menu bar and contains tool buttons.
Definition: IGUIToolbar.h:21
Interface of a Video Driver dependent Texture.
Definition: ITexture.h:177
Base class of most objects of the Irrlicht Engine.
GLint GLint GLsizei GLsizei GLsizei GLint border
Definition: SDL_opengl.h:1572
GLuint GLuint GLsizei GLenum type
Definition: SDL_opengl.h:1571
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.
GLbitfield flags
Default tree view GUI element.
Definition: IGUITreeView.h:226
virtual io::IFileSystem * getFileSystem() const =0
Returns the file system.
virtual IGUIElementFactory * getDefaultGUIElementFactory() const =0
Get the default element factory which can create all built-in elements.
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 bool loadGUI(const io::path &filename, IGUIElement *parent=0)=0
Loads the gui. Note that the current gui is not cleared before.
Element to display profiler information.
Definition: IGUIProfiler.h:19
virtual IGUIElement * getFocus() const =0
Returns the element which holds the focus.
Standard color chooser dialog.
GUI element displaying an image.
Definition: IGUIImage.h:19
GLuint in
virtual bool removeFocus(IGUIElement *element)=0
Removes the focus from an element.
virtual IGUIFont * getBuiltInFont() const =0
Returns the default built-in font.
virtual IGUIComboBox * addComboBox(const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1)=0
Adds a combo box to the environment.
virtual void setFocusBehavior(u32 flags)=0
Set the way the gui will handle automatic focus changes.