IrrlichtEngine
IGUIEnvironment.h
Go to the documentation of this file.
00001 // Copyright (C) 2002-2011 Nikolaus Gebhardt
00002 // This file is part of the "Irrlicht Engine".
00003 // For conditions of distribution and use, see copyright notice in irrlicht.h
00004 
00005 #ifndef __I_GUI_ENVIRONMENT_H_INCLUDED__
00006 #define __I_GUI_ENVIRONMENT_H_INCLUDED__
00007 
00008 #include "IReferenceCounted.h"
00009 #include "IGUISkin.h"
00010 #include "rect.h"
00011 #include "EMessageBoxFlags.h"
00012 #include "IEventReceiver.h"
00013 #include "IXMLReader.h"
00014 #include "path.h"
00015 
00016 namespace irr
00017 {
00018         class IOSOperator;
00019         class IEventReceiver;
00020 
00021         namespace io
00022         {
00023                 class IXMLWriter;
00024                 class IReadFile;
00025                 class IWriteFile;
00026                 class IFileSystem;
00027         } // end namespace io
00028         namespace video
00029         {
00030                 class IVideoDriver;
00031                 class ITexture;
00032         } // end namespace video
00033 
00034 namespace gui
00035 {
00036 
00037 class IGUIElement;
00038 class IGUIFont;
00039 class IGUISpriteBank;
00040 class IGUIScrollBar;
00041 class IGUIImage;
00042 class IGUIMeshViewer;
00043 class IGUICheckBox;
00044 class IGUIListBox;
00045 class IGUITreeView;
00046 class IGUIImageList;
00047 class IGUIFileOpenDialog;
00048 class IGUIColorSelectDialog;
00049 class IGUIInOutFader;
00050 class IGUIStaticText;
00051 class IGUIEditBox;
00052 class IGUISpinBox;
00053 class IGUITabControl;
00054 class IGUITab;
00055 class IGUITable;
00056 class IGUIContextMenu;
00057 class IGUIComboBox;
00058 class IGUIToolBar;
00059 class IGUIButton;
00060 class IGUIWindow;
00061 class IGUIElementFactory;
00062 
00064 class IGUIEnvironment : public virtual IReferenceCounted
00065 {
00066 public:
00067 
00069         virtual void drawAll() = 0;
00070 
00072 
00077         virtual bool setFocus(IGUIElement* element) = 0;
00078 
00080 
00081         virtual IGUIElement* getFocus() const = 0;
00082 
00084 
00088         virtual bool removeFocus(IGUIElement* element) = 0;
00089 
00091 
00093         virtual bool hasFocus(IGUIElement* element) const = 0;
00094 
00096 
00097         virtual video::IVideoDriver* getVideoDriver() const = 0;
00098 
00100 
00101         virtual io::IFileSystem* getFileSystem() const = 0;
00102 
00104 
00105         virtual IOSOperator* getOSOperator() const = 0;
00106 
00108         virtual void clear() = 0;
00109 
00111 
00115         virtual bool postEventFromUser(const SEvent& event) = 0;
00116 
00118 
00121         virtual void setUserEventReceiver(IEventReceiver* evr) = 0;
00122 
00124 
00125         virtual IGUISkin* getSkin() const = 0;
00126 
00128 
00140         virtual void setSkin(IGUISkin* skin) = 0;
00141 
00143 
00148         virtual IGUISkin* createSkin(EGUI_SKIN_TYPE type) = 0;
00149 
00150 
00152 
00158         virtual IGUIImageList* createImageList( video::ITexture* texture,
00159                                         core::dimension2d<s32> imageSize,
00160                                         bool useAlphaChannel ) = 0;
00161 
00163 
00168         virtual IGUIFont* getFont(const io::path& filename) = 0;
00169 
00171 
00176         virtual IGUIFont* addFont(const io::path& name, IGUIFont* font) = 0;
00177 
00179         virtual void removeFont(IGUIFont* font) = 0;
00180 
00182 
00185         virtual IGUIFont* getBuiltInFont() const = 0;
00186 
00188 
00192         virtual IGUISpriteBank* getSpriteBank(const io::path& filename) = 0;
00193 
00195 
00198         virtual IGUISpriteBank* addEmptySpriteBank(const io::path& name) = 0;
00199 
00201 
00208         virtual IGUIElement* getRootGUIElement() = 0;
00209 
00211 
00219         virtual IGUIButton* addButton(const core::rect<s32>& rectangle,
00220                 IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0, const wchar_t* tooltiptext = 0) = 0;
00221 
00223 
00233         virtual IGUIWindow* addWindow(const core::rect<s32>& rectangle, bool modal = false,
00234                 const wchar_t* text=0, IGUIElement* parent=0, s32 id=-1) = 0;
00235 
00237 
00243         virtual IGUIElement* addModalScreen(IGUIElement* parent) = 0;
00244 
00246 
00260         virtual IGUIWindow* addMessageBox(const wchar_t* caption, const wchar_t* text=0,
00261                 bool modal = true, s32 flags = EMBF_OK, IGUIElement* parent=0, s32 id=-1, video::ITexture* image=0) = 0;
00262 
00264 
00272         virtual IGUIScrollBar* addScrollBar(bool horizontal, const core::rect<s32>& rectangle,
00273                 IGUIElement* parent=0, s32 id=-1) = 0;
00274 
00276 
00287         virtual IGUIImage* addImage(video::ITexture* image, core::position2d<s32> pos,
00288                 bool useAlphaChannel=true, IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
00289 
00291 
00299         virtual IGUIImage* addImage(const core::rect<s32>& rectangle,
00300                 IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
00301 
00303 
00311         virtual IGUICheckBox* addCheckBox(bool checked, const core::rect<s32>& rectangle,
00312                 IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
00313 
00315 
00322         virtual IGUIListBox* addListBox(const core::rect<s32>& rectangle,
00323                 IGUIElement* parent=0, s32 id=-1, bool drawBackground=false) = 0;
00324 
00326 
00335         virtual IGUITreeView* addTreeView(const core::rect<s32>& rectangle,
00336                 IGUIElement* parent=0, s32 id=-1, bool drawBackground=false,
00337                 bool scrollBarVertical = true, bool scrollBarHorizontal = false) = 0;
00338 
00340 
00347         virtual IGUIMeshViewer* addMeshViewer(const core::rect<s32>& rectangle,
00348                         IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
00349 
00351 
00364         virtual IGUIFileOpenDialog* addFileOpenDialog(const wchar_t* title=0,
00365                 bool modal=true, IGUIElement* parent=0, s32 id=-1,
00366                 bool restoreCWD=false, io::path::char_type* startDir=0) = 0;
00367 
00369 
00378         virtual IGUIColorSelectDialog* addColorSelectDialog(const wchar_t* title = 0,
00379                 bool modal=true, IGUIElement* parent=0, s32 id=-1) = 0;
00380 
00382 
00393         virtual IGUIStaticText* addStaticText(const wchar_t* text, const core::rect<s32>& rectangle,
00394                 bool border=false, bool wordWrap=true, IGUIElement* parent=0, s32 id=-1,
00395                 bool fillBackground = false) = 0;
00396 
00398 
00412         virtual IGUIEditBox* addEditBox(const wchar_t* text, const core::rect<s32>& rectangle,
00413                 bool border=true, IGUIElement* parent=0, s32 id=-1) = 0;
00414 
00416 
00426         virtual IGUISpinBox* addSpinBox(const wchar_t* text, const core::rect<s32>& rectangle,
00427                 bool border=true,IGUIElement* parent=0, s32 id=-1) = 0;
00428 
00430 
00437         virtual IGUIInOutFader* addInOutFader(const core::rect<s32>* rectangle=0, IGUIElement* parent=0, s32 id=-1) = 0;
00438 
00440 
00452         virtual IGUITabControl* addTabControl(const core::rect<s32>& rectangle,
00453                 IGUIElement* parent=0, bool fillbackground=false,
00454                 bool border=true, s32 id=-1) = 0;
00455 
00457 
00467         virtual IGUITab* addTab(const core::rect<s32>& rectangle,
00468                 IGUIElement* parent=0, s32 id=-1) = 0;
00469 
00471 
00479         virtual IGUIContextMenu* addContextMenu(const core::rect<s32>& rectangle,
00480                 IGUIElement* parent=0, s32 id=-1) = 0;
00481 
00483 
00491         virtual IGUIContextMenu* addMenu(IGUIElement* parent=0, s32 id=-1) = 0;
00492 
00494 
00502         virtual IGUIToolBar* addToolBar(IGUIElement* parent=0, s32 id=-1) = 0;
00503 
00505 
00512         virtual IGUIComboBox* addComboBox(const core::rect<s32>& rectangle,
00513                 IGUIElement* parent=0, s32 id=-1) = 0;
00514 
00516 
00524         virtual IGUITable* addTable(const core::rect<s32>& rectangle,
00525                 IGUIElement* parent=0, s32 id=-1, bool drawBackground=false) =0;
00526 
00528 
00531         virtual IGUIElementFactory* getDefaultGUIElementFactory() const = 0;
00532 
00534 
00538         virtual void registerGUIElementFactory(IGUIElementFactory* factoryToAdd) = 0;
00539 
00541 
00542         virtual u32 getRegisteredGUIElementFactoryCount() const = 0;
00543 
00545 
00547         virtual IGUIElementFactory* getGUIElementFactory(u32 index) const = 0;
00548 
00550 
00555         virtual IGUIElement* addGUIElement(const c8* elementName, IGUIElement* parent=0) = 0;
00556 
00558 
00561         virtual bool saveGUI(const io::path& filename, IGUIElement* start=0) = 0;
00562 
00564 
00567         virtual bool saveGUI(io::IWriteFile* file, IGUIElement* start=0) = 0;
00568 
00570 
00573         virtual bool loadGUI(const io::path& filename, IGUIElement* parent=0) = 0;
00574 
00576 
00579         virtual bool loadGUI(io::IReadFile* file, IGUIElement* parent=0) = 0;
00580 
00582         virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const =0;
00583 
00585         virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)=0;
00586 
00588         virtual void writeGUIElement(io::IXMLWriter* writer, IGUIElement* node) =0;
00589 
00591         virtual void readGUIElement(io::IXMLReader* reader, IGUIElement* node) =0;
00592 };
00593 
00594 
00595 } // end namespace gui
00596 } // end namespace irr
00597 
00598 #endif
00599