Nirtcpp 2.1.0
Nirtcpp is a high-performance c++ graphics engine.
Loading...
Searching...
No Matches
IGUIEnvironment.hpp
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 nirtcpp/nirtcpp.hpp
4
5#ifndef NIRT_I_GUI_ENVIRONMENT_HPP_INCLUDED
6#define NIRT_I_GUI_ENVIRONMENT_HPP_INCLUDED
7
8#include <nirtcpp/core/engine/IReferenceCounted.hpp>
9#include <nirtcpp/core/engine/IGUISkin.hpp>
10#include <nirtcpp/core/engine/rect.hpp>
11#include <nirtcpp/core/engine/EMessageBoxFlags.hpp>
12#include <nirtcpp/core/engine/EFocusFlags.hpp>
13#include <nirtcpp/core/engine/IEventReceiver.hpp>
14#include <nirtcpp/core/engine/IXMLReader.hpp>
15#include <nirtcpp/core/engine/IXMLWriter.hpp>
16#include <nirtcpp/core/engine/path.hpp>
17
18namespace nirt
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
35namespace gui
36{
37
38class IGUIElement;
39class IGUIFont;
40class IGUISpriteBank;
41class IGUIScrollBar;
42class IGUIImage;
43class IGUIMeshViewer;
44class IGUICheckBox;
45class IGUIListBox;
46class IGUITreeView;
47class IGUIImageList;
48class IGUIFileOpenDialog;
49class IGUIColorSelectDialog;
50class IGUIInOutFader;
51class IGUIStaticText;
52class IGUIEditBox;
53class IGUISpinBox;
54class IGUITabControl;
55class IGUITab;
56class IGUITable;
57class IGUIContextMenu;
58class IGUIComboBox;
59class IGUIToolBar;
60class IGUIButton;
61class IGUIWindow;
62class IGUIProfiler;
63class IGUIElementFactory;
64
66
72class IGUIEnvironment : public virtual IReferenceCounted
73{
74public:
75
77
79 virtual void drawAll(bool useScreenSize=true) = 0;
80
82
87 virtual bool setFocus(IGUIElement* element) = 0;
88
90
91 virtual IGUIElement* getFocus() const = 0;
92
94
99 virtual IGUIElement* getHovered() const = 0;
100
102
106 virtual bool removeFocus(IGUIElement* element) = 0;
107
109
112 virtual bool hasFocus(const IGUIElement* element, bool checkSubElements=false) const = 0;
113
115
117
119
120 virtual io::IFileSystem* getFileSystem() const = 0;
121
123
124 virtual IOSOperator* getOSOperator() const = 0;
125
127 virtual void clear() = 0;
128
130
134 virtual bool postEventFromUser(const SEvent& event) = 0;
135
137
140 virtual void setUserEventReceiver(IEventReceiver* evr) = 0;
141
143
144 virtual IGUISkin* getSkin() const = 0;
145
147
159 virtual void setSkin(IGUISkin* skin) = 0;
160
162
168
169
171
178 core::dimension2d<s32> imageSize,
179 bool useAlphaChannel ) = 0;
180
182
187 virtual IGUIFont* getFont(const io::path& filename) = 0;
188
190
195 virtual IGUIFont* addFont(const io::path& name, IGUIFont* font) = 0;
196
198 virtual void removeFont(IGUIFont* font) = 0;
199
201
204 virtual IGUIFont* getBuiltInFont() const = 0;
205
207
211 virtual IGUISpriteBank* getSpriteBank(const io::path& filename) = 0;
212
214
217 virtual IGUISpriteBank* addEmptySpriteBank(const io::path& name) = 0;
218
220
227
229
237 virtual IGUIButton* addButton(const core::rect<s32>& rectangle,
238 IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0, const wchar_t* tooltiptext = 0) = 0;
239
241
251 virtual IGUIWindow* addWindow(const core::rect<s32>& rectangle, bool modal = false,
252 const wchar_t* text=0, IGUIElement* parent=0, s32 id=-1) = 0;
253
255
270 virtual IGUIElement* addModalScreen(IGUIElement* parent, int blinkMode = 3) = 0;
271
273
286 virtual IGUIWindow* addMessageBox(const wchar_t* caption, const wchar_t* text=0,
287 bool modal = true, s32 flags = EMBF_OK, IGUIElement* parent=0, s32 id=-1, video::ITexture* image=0) = 0;
288
290
298 virtual IGUIScrollBar* addScrollBar(bool horizontal, const core::rect<s32>& rectangle,
299 IGUIElement* parent=0, s32 id=-1) = 0;
300
302
314 bool useAlphaChannel=true, IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
315
317
327 virtual IGUIImage* addImage(const core::rect<s32>& rectangle,
328 IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0, bool useAlphaChannel=true) = 0;
329
331
339 virtual IGUICheckBox* addCheckBox(bool checked, const core::rect<s32>& rectangle,
340 IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
341
343
350 virtual IGUIListBox* addListBox(const core::rect<s32>& rectangle,
351 IGUIElement* parent=0, s32 id=-1, bool drawBackground=false) = 0;
352
354
363 virtual IGUITreeView* addTreeView(const core::rect<s32>& rectangle,
364 IGUIElement* parent=0, s32 id=-1, bool drawBackground=false,
365 bool scrollBarVertical = true, bool scrollBarHorizontal = false) = 0;
366
368
376 IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
377
379
392 virtual IGUIFileOpenDialog* addFileOpenDialog(const wchar_t* title=0,
393 bool modal=true, IGUIElement* parent=0, s32 id=-1,
394 bool restoreCWD=false, io::path::char_type* startDir=0) = 0;
395
397
406 virtual IGUIColorSelectDialog* addColorSelectDialog(const wchar_t* title = 0,
407 bool modal=true, IGUIElement* parent=0, s32 id=-1) = 0;
408
410
421 virtual IGUIStaticText* addStaticText(const wchar_t* text, const core::rect<s32>& rectangle,
422 bool border=false, bool wordWrap=true, IGUIElement* parent=0, s32 id=-1,
423 bool fillBackground = false) = 0;
424
426
440 virtual IGUIEditBox* addEditBox(const wchar_t* text, const core::rect<s32>& rectangle,
441 bool border=true, IGUIElement* parent=0, s32 id=-1) = 0;
442
444
454 virtual IGUISpinBox* addSpinBox(const wchar_t* text, const core::rect<s32>& rectangle,
455 bool border=true,IGUIElement* parent=0, s32 id=-1) = 0;
456
458
465 virtual IGUIInOutFader* addInOutFader(const core::rect<s32>* rectangle=0, IGUIElement* parent=0, s32 id=-1) = 0;
466
468
481 IGUIElement* parent=0, bool fillbackground=false,
482 bool border=true, s32 id=-1) = 0;
483
485
495 virtual IGUITab* addTab(const core::rect<s32>& rectangle,
496 IGUIElement* parent=0, s32 id=-1) = 0;
497
499
508 IGUIElement* parent=0, s32 id=-1) = 0;
509
511
519 virtual IGUIContextMenu* addMenu(IGUIElement* parent=0, s32 id=-1) = 0;
520
522
530 virtual IGUIToolBar* addToolBar(IGUIElement* parent=0, s32 id=-1) = 0;
531
533
540 virtual IGUIComboBox* addComboBox(const core::rect<s32>& rectangle,
541 IGUIElement* parent=0, s32 id=-1) = 0;
542
544
552 virtual IGUITable* addTable(const core::rect<s32>& rectangle,
553 IGUIElement* parent=0, s32 id=-1, bool drawBackground=false) =0;
554
556
561 IGUIElement* parent=0, s32 id=-1) = 0;
562
564
568
570
574 virtual void registerGUIElementFactory(IGUIElementFactory* factoryToAdd) = 0;
575
577
579
581
583 virtual IGUIElementFactory* getGUIElementFactory(u32 index) const = 0;
584
586
591 virtual IGUIElement* addGUIElement(const c8* elementName, IGUIElement* parent=0) = 0;
592
594
597 virtual bool saveGUI(const io::path& filename, IGUIElement* start=0) = 0;
598
600
603 virtual bool saveGUI(io::IWriteFile* file, IGUIElement* start=0) = 0;
604
606
612 virtual bool loadGUI(const io::path& filename, IGUIElement* parent=0) = 0;
613
615
621 virtual bool loadGUI(io::IReadFile* file, IGUIElement* parent=0) = 0;
622
625
628
630 virtual void writeGUIElement(io::IXMLWriter* writer, IGUIElement* element) =0;
631
633 virtual void readGUIElement(io::IXMLReader* reader, IGUIElement* element) =0;
634
636
641 virtual IGUIElement* getNextElement(bool reverse=false, bool group=false) = 0;
642
644
648 virtual void setFocusBehavior(u32 flags) = 0;
649
651
652 virtual u32 getFocusBehavior() const = 0;
653
655
663 virtual void addToDeletionQueue(IGUIElement* element) = 0;
664};
665
666
667} // end namespace gui
668} // end namespace nirt
669
670#endif
Interface of an object which can receive events.
Definition IEventReceiver.hpp:484
The Operating system operator provides operation system specific methods and information.
Definition IOSOperator.hpp:16
Base class of most objects of the Nirtcpp Engine.
Definition IReferenceCounted.hpp:46
SEvents hold information about an event. See nirt::IEventReceiver for details on event handling.
Definition IEventReceiver.hpp:282
Axis aligned bounding box in 3d dimensional space.
Definition aabbox3d.hpp:22
GUI Button interface.
Definition IGUIButton.hpp:110
GUI Check box interface.
Definition IGUICheckBox.hpp:20
Standard color chooser dialog.
Definition IGUIColorSelectDialog.hpp:17
Combobox widget.
Definition IGUIComboBox.hpp:20
GUI Context menu interface.
Definition IGUIContextMenu.hpp:36
Single line edit box for editing simple text.
Definition IGUIEditBox.hpp:24
Interface making it possible to dynamically create GUI elements.
Definition IGUIElementFactory.hpp:27
Base class of all GUI elements.
Definition IGUIElement.hpp:24
GUI Environment. Used as factory and manager of all other GUI elements.
Definition IGUIEnvironment.hpp:73
virtual bool removeFocus(IGUIElement *element)=0
Removes the focus from an element.
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 IGUIColorSelectDialog * addColorSelectDialog(const wchar_t *title=0, bool modal=true, IGUIElement *parent=0, s32 id=-1)=0
Adds a color select dialog.
virtual void setFocusBehavior(u32 flags)=0
Set the way the gui will handle automatic focus changes.
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 void removeFont(IGUIFont *font)=0
remove loaded font
virtual bool postEventFromUser(const SEvent &event)=0
Posts an input event to the environment.
virtual void addToDeletionQueue(IGUIElement *element)=0
Adds a IGUIElement to deletion queue.
virtual video::IVideoDriver * getVideoDriver() const =0
Returns the current video driver.
virtual IGUISkin * getSkin() const =0
Returns pointer to the current gui skin.
virtual u32 getFocusBehavior() const =0
Get the way the gui does handle focus changes.
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 bool setFocus(IGUIElement *element)=0
Sets the focus to an element.
virtual io::IFileSystem * getFileSystem() const =0
Returns the file system.
virtual IGUITab * addTab(const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1)=0
Adds tab to the environment.
virtual u32 getRegisteredGUIElementFactoryCount() const =0
Get amount of registered gui element factories.
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 IGUIFont * addFont(const io::path &name, IGUIFont *font)=0
Adds an externally loaded font to the font list.
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 void drawAll(bool useScreenSize=true)=0
Draws all gui elements by traversing the GUI environment starting at the root node.
virtual IGUIFont * getBuiltInFont() const =0
Returns the default built-in font.
virtual void writeGUIElement(io::IXMLWriter *writer, IGUIElement *element)=0
writes an element
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 void clear()=0
Removes all elements from the environment.
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 void registerGUIElementFactory(IGUIElementFactory *factoryToAdd)=0
Adds an element factory to the gui environment.
virtual void setUserEventReceiver(IEventReceiver *evr)=0
This sets a new event receiver for gui events.
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 IGUIElement * addModalScreen(IGUIElement *parent, int blinkMode=3)=0
Adds a modal screen.
virtual IGUIScrollBar * addScrollBar(bool horizontal, const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1)=0
Adds a scrollbar.
virtual IGUISkin * createSkin(EGUI_SKIN_TYPE type)=0
Creates a new GUI Skin based on a template.
virtual bool hasFocus(const IGUIElement *element, bool checkSubElements=false) const =0
Returns whether the element has focus.
virtual void deserializeAttributes(io::IAttributes *in, io::SAttributeReadWriteOptions *options=0)=0
Reads attributes of the gui environment.
virtual IGUIElementFactory * getGUIElementFactory(u32 index) const =0
Get a gui element factory by index.
virtual IGUIElement * getHovered() const =0
Returns the element which was last under the mouse cursor.
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 void setSkin(IGUISkin *skin)=0
Sets a new GUI Skin.
virtual IGUIElementFactory * getDefaultGUIElementFactory() const =0
Get the default element factory which can create all built-in elements.
virtual void readGUIElement(io::IXMLReader *reader, IGUIElement *element)=0
reads an element
virtual IGUIContextMenu * addContextMenu(const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1)=0
Adds a context menu to the environment.
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 IGUIElement * getRootGUIElement()=0
Returns the root gui element.
virtual IGUIElement * getFocus() const =0
Returns the element which holds the focus.
virtual IGUIToolBar * addToolBar(IGUIElement *parent=0, s32 id=-1)=0
Adds a toolbar to the environment.
virtual IGUISpriteBank * addEmptySpriteBank(const io::path &name)=0
Adds an empty sprite bank to the manager.
virtual IOSOperator * getOSOperator() const =0
returns a pointer to the OS operator
virtual bool saveGUI(const io::path &filename, IGUIElement *start=0)=0
Saves the current gui into a file.
virtual IGUIElement * getNextElement(bool reverse=false, bool group=false)=0
Find the next element which would be selected when pressing the tab-key.
virtual IGUIElement * addGUIElement(const c8 *elementName, IGUIElement *parent=0)=0
Adds a GUI element by its name.
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 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 IGUIListBox * addListBox(const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1, bool drawBackground=false)=0
Adds a list box element.
virtual IGUIImageList * createImageList(video::ITexture *texture, core::dimension2d< s32 > imageSize, bool useAlphaChannel)=0
Creates the image list from the given texture.
virtual void serializeAttributes(io::IAttributes *out, io::SAttributeReadWriteOptions *options=0) const =0
Writes attributes of the gui environment.
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 IGUISpriteBank * getSpriteBank(const io::path &filename)=0
Returns pointer to the sprite bank which was added with addEmptySpriteBank.
virtual IGUIComboBox * addComboBox(const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1)=0
Adds a combo box to the environment.
virtual IGUIFont * getFont(const io::path &filename)=0
Returns pointer to the font with the specified filename.
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 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 bool loadGUI(const io::path &filename, IGUIElement *parent=0)=0
Loads the gui. Note that the current gui is not cleared before.
virtual IGUIContextMenu * addMenu(IGUIElement *parent=0, s32 id=-1)=0
Adds a menu to the environment.
virtual bool loadGUI(io::IReadFile *file, IGUIElement *parent=0)=0
Loads the gui. Note that the current gui is not cleared before.
virtual IGUIProfiler * addProfilerDisplay(const core::rect< s32 > &rectangle, IGUIElement *parent=0, s32 id=-1)=0
Adds an element to display the information from the Nirtcpp profiler.
virtual bool saveGUI(io::IWriteFile *file, IGUIElement *start=0)=0
Saves the current gui into a file.
Standard file chooser dialog.
Definition IGUIFileOpenDialog.hpp:25
Font interface.
Definition IGUIFont.hpp:40
Font interface.
Definition IGUIImageList.hpp:18
GUI element displaying an image.
Definition IGUIImage.hpp:20
Element for fading out or in.
Definition IGUIInOutFader.hpp:28
Default list box GUI element.
Definition IGUIListBox.hpp:40
3d mesh viewing GUI element.
Definition IGUIMeshViewer.hpp:28
Element to display profiler information.
Definition IGUIProfiler.hpp:20
Default scroll bar GUI element.
Definition IGUIScrollBar.hpp:20
A skin modifies the look of the GUI elements.
Definition IGUISkin.hpp:385
Single line edit box + spin buttons.
Definition IGUISpinBox.hpp:36
Sprite bank interface.
Definition IGUISpriteBank.hpp:71
Multi or single line text label.
Definition IGUIStaticText.hpp:19
A standard tab control.
Definition IGUITabControl.hpp:23
A tab-page, onto which other gui elements could be added.
Definition IGUITabControl.hpp:125
Default list box GUI element.
Definition IGUITable.hpp:90
Stays at the top of its parent like the menu bar and contains tool buttons.
Definition IGUIToolbar.hpp:22
Default tree view GUI element.
Definition IGUITreeView.hpp:227
Default moveable window GUI element with border, caption and close icons.
Definition IGUIWindow.hpp:22
Provides a generic interface for attributes and their values and the possibility to serialize them.
Definition IAttributes.hpp:42
The FileSystem manages files and archives and provides access to them.
Definition IFileSystem.hpp:33
Interface providing easy read access to a XML file.
Definition irrXML.hpp:277
Interface providing methods for making it easier to write XML files.
Definition irrXML.hpp:377
Interface providing read access to a file.
Definition IReadFile.hpp:19
Interface providing write access to a file.
Definition IWriteFile.hpp:18
struct holding data describing options
Definition IAttributeExchangingObject.hpp:35
Interface of a Video Driver dependent Texture.
Definition ITexture.hpp:186
Interface to driver which is able to perform 2d and 3d graphics functions.
Definition IVideoDriver.hpp:152
EGUI_SKIN_TYPE
Enumeration of available default skins.
Definition IGUISkin.hpp:31
@ EMBF_OK
Flag for the OK button.
Definition EMessageBoxFlags.hpp:17
As of Nirtcpp 1.6, position2d is a synonym for vector2d.
Definition vector3d.hpp:11
signed int s32
32 bit signed variable.
Definition irrTypes.hpp:72
unsigned int u32
32 bit unsigned variable.
Definition irrTypes.hpp:64
char c8
8 bit character variable.
Definition irrTypes.hpp:37

Nirtcpp    @cppfx.xyz

Utxcpp    utx::print