00001
00002
00003
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 }
00028 namespace video
00029 {
00030 class IVideoDriver;
00031 class ITexture;
00032 }
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, bool useAlphaChannel ) = 0;
00160
00162
00167 virtual IGUIFont* getFont(const io::path& filename) = 0;
00168
00170
00173 virtual IGUIFont* getBuiltInFont() const = 0;
00174
00176
00180 virtual IGUISpriteBank* getSpriteBank(const io::path& filename) = 0;
00181
00183
00186 virtual IGUISpriteBank* addEmptySpriteBank(const io::path& name) = 0;
00187
00189
00196 virtual IGUIElement* getRootGUIElement() = 0;
00197
00199
00207 virtual IGUIButton* addButton(const core::rect<s32>& rectangle,
00208 IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0, const wchar_t* tooltiptext = 0) = 0;
00209
00211
00221 virtual IGUIWindow* addWindow(const core::rect<s32>& rectangle, bool modal = false,
00222 const wchar_t* text=0, IGUIElement* parent=0, s32 id=-1) = 0;
00223
00225
00231 virtual IGUIElement* addModalScreen(IGUIElement* parent) = 0;
00232
00234
00247 virtual IGUIWindow* addMessageBox(const wchar_t* caption, const wchar_t* text=0,
00248 bool modal = true, s32 flags = EMBF_OK, IGUIElement* parent=0, s32 id=-1) = 0;
00249
00251
00259 virtual IGUIScrollBar* addScrollBar(bool horizontal, const core::rect<s32>& rectangle,
00260 IGUIElement* parent=0, s32 id=-1) = 0;
00261
00263
00274 virtual IGUIImage* addImage(video::ITexture* image, core::position2d<s32> pos,
00275 bool useAlphaChannel=true, IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
00276
00278
00286 virtual IGUIImage* addImage(const core::rect<s32>& rectangle,
00287 IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
00288
00290
00298 virtual IGUICheckBox* addCheckBox(bool checked, const core::rect<s32>& rectangle,
00299 IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
00300
00302
00309 virtual IGUIListBox* addListBox(const core::rect<s32>& rectangle,
00310 IGUIElement* parent=0, s32 id=-1, bool drawBackground=false) = 0;
00311
00313
00322 virtual IGUITreeView* addTreeView(const core::rect<s32>& rectangle,
00323 IGUIElement* parent=0, s32 id=-1, bool drawBackground=false,
00324 bool scrollBarVertical = true, bool scrollBarHorizontal = false) = 0;
00325
00327
00334 virtual IGUIMeshViewer* addMeshViewer(const core::rect<s32>& rectangle,
00335 IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
00336
00338
00347 virtual IGUIFileOpenDialog* addFileOpenDialog(const wchar_t* title = 0,
00348 bool modal=true, IGUIElement* parent=0, s32 id=-1) = 0;
00349
00351
00360 virtual IGUIColorSelectDialog* addColorSelectDialog(const wchar_t* title = 0,
00361 bool modal=true, IGUIElement* parent=0, s32 id=-1) = 0;
00362
00364
00375 virtual IGUIStaticText* addStaticText(const wchar_t* text, const core::rect<s32>& rectangle,
00376 bool border=false, bool wordWrap=true, IGUIElement* parent=0, s32 id=-1,
00377 bool fillBackground = false) = 0;
00378
00380
00394 virtual IGUIEditBox* addEditBox(const wchar_t* text, const core::rect<s32>& rectangle,
00395 bool border=true, IGUIElement* parent=0, s32 id=-1) = 0;
00396
00398
00408 virtual IGUISpinBox* addSpinBox(const wchar_t* text, const core::rect<s32>& rectangle,
00409 bool border=true,IGUIElement* parent=0, s32 id=-1) = 0;
00410
00412
00419 virtual IGUIInOutFader* addInOutFader(const core::rect<s32>* rectangle=0, IGUIElement* parent=0, s32 id=-1) = 0;
00420
00422
00434 virtual IGUITabControl* addTabControl(const core::rect<s32>& rectangle,
00435 IGUIElement* parent=0, bool fillbackground=false,
00436 bool border=true, s32 id=-1) = 0;
00437
00439
00449 virtual IGUITab* addTab(const core::rect<s32>& rectangle,
00450 IGUIElement* parent=0, s32 id=-1) = 0;
00451
00453
00461 virtual IGUIContextMenu* addContextMenu(const core::rect<s32>& rectangle,
00462 IGUIElement* parent=0, s32 id=-1) = 0;
00463
00465
00473 virtual IGUIContextMenu* addMenu(IGUIElement* parent=0, s32 id=-1) = 0;
00474
00476
00484 virtual IGUIToolBar* addToolBar(IGUIElement* parent=0, s32 id=-1) = 0;
00485
00487
00494 virtual IGUIComboBox* addComboBox(const core::rect<s32>& rectangle,
00495 IGUIElement* parent=0, s32 id=-1) = 0;
00496
00498
00506 virtual IGUITable* addTable(const core::rect<s32>& rectangle,
00507 IGUIElement* parent=0, s32 id=-1, bool drawBackground=false) =0;
00508
00510
00513 virtual IGUIElementFactory* getDefaultGUIElementFactory() const = 0;
00514
00516
00520 virtual void registerGUIElementFactory(IGUIElementFactory* factoryToAdd) = 0;
00521
00523
00524 virtual u32 getRegisteredGUIElementFactoryCount() const = 0;
00525
00527
00529 virtual IGUIElementFactory* getGUIElementFactory(u32 index) const = 0;
00530
00532
00537 virtual IGUIElement* addGUIElement(const c8* elementName, IGUIElement* parent=0) = 0;
00538
00540
00543 virtual bool saveGUI(const io::path& filename, IGUIElement* start=0) = 0;
00544
00546
00549 virtual bool saveGUI(io::IWriteFile* file, IGUIElement* start=0) = 0;
00550
00552
00555 virtual bool loadGUI(const io::path& filename, IGUIElement* parent=0) = 0;
00556
00558
00561 virtual bool loadGUI(io::IReadFile* file, IGUIElement* parent=0) = 0;
00562
00564 virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const =0;
00565
00567 virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)=0;
00568
00570 virtual void writeGUIElement(io::IXMLWriter* writer, IGUIElement* node) =0;
00571
00573 virtual void readGUIElement(io::IXMLReader* reader, IGUIElement* node) =0;
00574 };
00575
00576
00577 }
00578 }
00579
00580 #endif
00581