Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members

IGUIEnvironment.h

Go to the documentation of this file.
00001 // Copyright (C) 2002-2008 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 
00015 namespace irr
00016 {
00017         class IOSOperator;
00018         class IEventReceiver;
00019 
00020         namespace io
00021         {
00022                 class IXMLWriter;
00023                 class IReadFile;
00024                 class IWriteFile;
00025                 class IFileSystem;
00026         } // end namespace io
00027         namespace video
00028         {
00029                 class IVideoDriver;
00030                 class ITexture;
00031         } // end namespace video
00032 
00033 namespace gui
00034 {
00035 
00036 class IGUIElement;
00037 class IGUIFont;
00038 class IGUISpriteBank;
00039 class IGUIScrollBar;
00040 class IGUIImage;
00041 class IGUIMeshViewer;
00042 class IGUICheckBox;
00043 class IGUIListBox;
00044 class IGUIFileOpenDialog;
00045 class IGUIColorSelectDialog;
00046 class IGUIInOutFader;
00047 class IGUIStaticText;
00048 class IGUIEditBox;
00049 class IGUISpinBox;
00050 class IGUITabControl;
00051 class IGUITab;
00052 class IGUIContextMenu;
00053 class IGUIComboBox;
00054 class IGUIToolBar;
00055 class IGUIButton;
00056 class IGUIWindow;
00057 class IGUIElementFactory;
00058 
00060 class IGUIEnvironment : public virtual IReferenceCounted
00061 {
00062 public:
00063 
00066         virtual void drawAll() = 0;
00067 
00069 
00074         virtual bool setFocus(IGUIElement* element) = 0;
00075 
00078         virtual IGUIElement* getFocus() const = 0;
00079 
00081 
00085         virtual bool removeFocus(IGUIElement* element) = 0;
00086 
00088 
00090         virtual bool hasFocus(IGUIElement* element) const = 0;
00091 
00094         virtual video::IVideoDriver* getVideoDriver() const = 0;
00095 
00098         virtual io::IFileSystem* getFileSystem() const = 0;
00099 
00102         virtual IOSOperator* getOSOperator() const = 0;
00103 
00105         virtual void clear() = 0;
00106 
00108 
00112         virtual bool postEventFromUser(const SEvent& event) = 0;
00113 
00115 
00118         virtual void setUserEventReceiver(IEventReceiver* evr) = 0;
00119 
00122         virtual IGUISkin* getSkin() const = 0;
00123 
00125 
00137         virtual void setSkin(IGUISkin* skin) = 0;
00138 
00140 
00145         virtual IGUISkin* createSkin(EGUI_SKIN_TYPE type) = 0;
00146 
00148 
00153         virtual IGUIFont* getFont(const c8* filename) = 0;
00154 
00156 
00159         virtual IGUIFont* getBuiltInFont() const = 0;
00160 
00162 
00166         virtual IGUISpriteBank* getSpriteBank(const c8* filename) = 0;
00167 
00169 
00172         virtual IGUISpriteBank* addEmptySpriteBank(const c8 *name) = 0;
00173 
00175 
00182         virtual IGUIElement* getRootGUIElement() = 0;
00183 
00185 
00193         virtual IGUIButton* addButton(const core::rect<s32>& rectangle,
00194                 IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0, const wchar_t* tooltiptext = 0) = 0;
00195 
00197 
00207         virtual IGUIWindow* addWindow(const core::rect<s32>& rectangle, bool modal = false,
00208                 const wchar_t* text=0, IGUIElement* parent=0, s32 id=-1) = 0;
00209 
00213 
00217         virtual IGUIElement* addModalScreen(IGUIElement* parent) = 0;
00218 
00220 
00233         virtual IGUIWindow* addMessageBox(const wchar_t* caption, const wchar_t* text=0,
00234                 bool modal = true, s32 flags = EMBF_OK, IGUIElement* parent=0, s32 id=-1) = 0;
00235 
00237 
00245         virtual IGUIScrollBar* addScrollBar(bool horizontal, const core::rect<s32>& rectangle,
00246                 IGUIElement* parent=0, s32 id=-1) = 0;
00247 
00249 
00260         virtual IGUIImage* addImage(video::ITexture* image, core::position2d<s32> pos,
00261                 bool useAlphaChannel=true, IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
00262 
00264 
00272         virtual IGUIImage* addImage(const core::rect<s32>& rectangle,
00273                 IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
00274 
00276 
00284         virtual IGUICheckBox* addCheckBox(bool checked, const core::rect<s32>& rectangle,
00285                 IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
00286 
00288 
00295         virtual IGUIListBox* addListBox(const core::rect<s32>& rectangle,
00296                 IGUIElement* parent=0, s32 id=-1, bool drawBackground=false) = 0;
00297 
00299 
00306         virtual IGUIMeshViewer* addMeshViewer(const core::rect<s32>& rectangle,
00307                         IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
00308 
00310 
00319         virtual IGUIFileOpenDialog* addFileOpenDialog(const wchar_t* title = 0,
00320                 bool modal=true, IGUIElement* parent=0, s32 id=-1) = 0;
00321 
00323 
00332         virtual IGUIColorSelectDialog* addColorSelectDialog(const wchar_t* title = 0,
00333                 bool modal=true, IGUIElement* parent=0, s32 id=-1) = 0;
00334 
00336 
00347         virtual IGUIStaticText* addStaticText(const wchar_t* text, const core::rect<s32>& rectangle,
00348                 bool border=false, bool wordWrap=true, IGUIElement* parent=0, s32 id=-1,
00349                 bool fillBackground = false) = 0;
00350 
00352 
00366         virtual IGUIEditBox* addEditBox(const wchar_t* text, const core::rect<s32>& rectangle,
00367                 bool border=true, IGUIElement* parent=0, s32 id=-1) = 0;
00368 
00370 
00379         virtual IGUISpinBox* addSpinBox(const wchar_t* text, const core::rect<s32>& rectangle,
00380                 IGUIElement* parent=0, s32 id=-1) = 0;
00381 
00383         /* \param rectangle Rectangle specifying the borders of the element.
00384         If the pointer is NULL, the whole screen is used.
00385         \param parent Parent item of the element, e.g. a window.
00386         \param id An identifier for the fader.
00387         \return Pointer to the created in-out-fader. Returns 0 if an error
00388         occured. This pointer should not be dropped. See
00389         IReferenceCounted::drop() for more information. */
00390         virtual IGUIInOutFader* addInOutFader(const core::rect<s32>* rectangle=0, IGUIElement* parent=0, s32 id=-1) = 0;
00391 
00393 
00405         virtual IGUITabControl* addTabControl(const core::rect<s32>& rectangle,
00406                 IGUIElement* parent=0, bool fillbackground=false,
00407                 bool border=true, s32 id=-1) = 0;
00408 
00410 
00420         virtual IGUITab* addTab(const core::rect<s32>& rectangle,
00421                 IGUIElement* parent=0, s32 id=-1) = 0;
00422 
00424 
00432         virtual IGUIContextMenu* addContextMenu(const core::rect<s32>& rectangle,
00433                 IGUIElement* parent=0, s32 id=-1) = 0;
00434 
00436         /* This is like the menu you can find on top of most windows in modern
00437         graphical user interfaces.
00438         \param parent Parent item of the element, e.g. a window.
00439         Set it to 0 to place the menu directly in the environment.
00440         \param id An identifier for the menu.
00441         \return Pointer to the created menu. Returns 0 if an
00442         error occured. This pointer should not be dropped. See
00443         IReferenceCounted::drop() for more information. */
00444         virtual IGUIContextMenu* addMenu(IGUIElement* parent=0, s32 id=-1) = 0;
00445 
00447 
00455         virtual IGUIToolBar* addToolBar(IGUIElement* parent=0, s32 id=-1) = 0;
00456 
00458 
00465         virtual IGUIComboBox* addComboBox(const core::rect<s32>& rectangle,
00466                 IGUIElement* parent=0, s32 id=-1) = 0;
00467 
00469 
00472         virtual IGUIElementFactory* getDefaultGUIElementFactory() const = 0;
00473 
00475 
00479         virtual void registerGUIElementFactory(IGUIElementFactory* factoryToAdd) = 0;
00480 
00483         virtual u32 getRegisteredGUIElementFactoryCount() const = 0;
00484 
00486         virtual IGUIElementFactory* getGUIElementFactory(u32 index) const = 0;
00487 
00489         virtual IGUIElement* addGUIElement(const c8* elementName, IGUIElement* parent=0) = 0;
00490 
00494         virtual bool saveGUI(const c8* filename, IGUIElement* start=0) = 0;
00495 
00499         virtual bool saveGUI(io::IWriteFile* file, IGUIElement* start=0) = 0;
00500 
00504         virtual bool loadGUI(const c8* filename, IGUIElement* parent=0) = 0;
00505 
00509         virtual bool loadGUI(io::IReadFile* file, IGUIElement* parent=0) = 0;
00510 
00512         virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const =0;
00513 
00515         virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)=0;
00516 
00518         virtual void writeGUIElement(io::IXMLWriter* writer, IGUIElement* node) =0;
00519 
00521         virtual void readGUIElement(io::IXMLReader* reader, IGUIElement* parent) =0;
00522 };
00523 
00524 
00525 } // end namespace gui
00526 } // end namespace irr
00527 
00528 #endif
00529 

The Irrlicht Engine
The Irrlicht Engine Documentation © 2003-2008 by Nikolaus Gebhardt. Generated on Sun Sep 21 08:57:41 2008 by Doxygen (1.4.2)