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
00175 virtual IGUIFont* addFont(const io::path& name, IGUIFont* font) = 0;
00176
00178
00181 virtual IGUIFont* getBuiltInFont() const = 0;
00182
00184
00188 virtual IGUISpriteBank* getSpriteBank(const io::path& filename) = 0;
00189
00191
00194 virtual IGUISpriteBank* addEmptySpriteBank(const io::path& name) = 0;
00195
00197
00204 virtual IGUIElement* getRootGUIElement() = 0;
00205
00207
00215 virtual IGUIButton* addButton(const core::rect<s32>& rectangle,
00216 IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0, const wchar_t* tooltiptext = 0) = 0;
00217
00219
00229 virtual IGUIWindow* addWindow(const core::rect<s32>& rectangle, bool modal = false,
00230 const wchar_t* text=0, IGUIElement* parent=0, s32 id=-1) = 0;
00231
00233
00239 virtual IGUIElement* addModalScreen(IGUIElement* parent) = 0;
00240
00242
00256 virtual IGUIWindow* addMessageBox(const wchar_t* caption, const wchar_t* text=0,
00257 bool modal = true, s32 flags = EMBF_OK, IGUIElement* parent=0, s32 id=-1, video::ITexture* image=0) = 0;
00258
00260
00268 virtual IGUIScrollBar* addScrollBar(bool horizontal, const core::rect<s32>& rectangle,
00269 IGUIElement* parent=0, s32 id=-1) = 0;
00270
00272
00283 virtual IGUIImage* addImage(video::ITexture* image, core::position2d<s32> pos,
00284 bool useAlphaChannel=true, IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
00285
00287
00295 virtual IGUIImage* addImage(const core::rect<s32>& rectangle,
00296 IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
00297
00299
00307 virtual IGUICheckBox* addCheckBox(bool checked, const core::rect<s32>& rectangle,
00308 IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
00309
00311
00318 virtual IGUIListBox* addListBox(const core::rect<s32>& rectangle,
00319 IGUIElement* parent=0, s32 id=-1, bool drawBackground=false) = 0;
00320
00322
00331 virtual IGUITreeView* addTreeView(const core::rect<s32>& rectangle,
00332 IGUIElement* parent=0, s32 id=-1, bool drawBackground=false,
00333 bool scrollBarVertical = true, bool scrollBarHorizontal = false) = 0;
00334
00336
00343 virtual IGUIMeshViewer* addMeshViewer(const core::rect<s32>& rectangle,
00344 IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
00345
00347
00356 virtual IGUIFileOpenDialog* addFileOpenDialog(const wchar_t* title = 0,
00357 bool modal=true, IGUIElement* parent=0, s32 id=-1) = 0;
00358
00360
00369 virtual IGUIColorSelectDialog* addColorSelectDialog(const wchar_t* title = 0,
00370 bool modal=true, IGUIElement* parent=0, s32 id=-1) = 0;
00371
00373
00384 virtual IGUIStaticText* addStaticText(const wchar_t* text, const core::rect<s32>& rectangle,
00385 bool border=false, bool wordWrap=true, IGUIElement* parent=0, s32 id=-1,
00386 bool fillBackground = false) = 0;
00387
00389
00403 virtual IGUIEditBox* addEditBox(const wchar_t* text, const core::rect<s32>& rectangle,
00404 bool border=true, IGUIElement* parent=0, s32 id=-1) = 0;
00405
00407
00417 virtual IGUISpinBox* addSpinBox(const wchar_t* text, const core::rect<s32>& rectangle,
00418 bool border=true,IGUIElement* parent=0, s32 id=-1) = 0;
00419
00421
00428 virtual IGUIInOutFader* addInOutFader(const core::rect<s32>* rectangle=0, IGUIElement* parent=0, s32 id=-1) = 0;
00429
00431
00443 virtual IGUITabControl* addTabControl(const core::rect<s32>& rectangle,
00444 IGUIElement* parent=0, bool fillbackground=false,
00445 bool border=true, s32 id=-1) = 0;
00446
00448
00458 virtual IGUITab* addTab(const core::rect<s32>& rectangle,
00459 IGUIElement* parent=0, s32 id=-1) = 0;
00460
00462
00470 virtual IGUIContextMenu* addContextMenu(const core::rect<s32>& rectangle,
00471 IGUIElement* parent=0, s32 id=-1) = 0;
00472
00474
00482 virtual IGUIContextMenu* addMenu(IGUIElement* parent=0, s32 id=-1) = 0;
00483
00485
00493 virtual IGUIToolBar* addToolBar(IGUIElement* parent=0, s32 id=-1) = 0;
00494
00496
00503 virtual IGUIComboBox* addComboBox(const core::rect<s32>& rectangle,
00504 IGUIElement* parent=0, s32 id=-1) = 0;
00505
00507
00515 virtual IGUITable* addTable(const core::rect<s32>& rectangle,
00516 IGUIElement* parent=0, s32 id=-1, bool drawBackground=false) =0;
00517
00519
00522 virtual IGUIElementFactory* getDefaultGUIElementFactory() const = 0;
00523
00525
00529 virtual void registerGUIElementFactory(IGUIElementFactory* factoryToAdd) = 0;
00530
00532
00533 virtual u32 getRegisteredGUIElementFactoryCount() const = 0;
00534
00536
00538 virtual IGUIElementFactory* getGUIElementFactory(u32 index) const = 0;
00539
00541
00546 virtual IGUIElement* addGUIElement(const c8* elementName, IGUIElement* parent=0) = 0;
00547
00549
00552 virtual bool saveGUI(const io::path& filename, IGUIElement* start=0) = 0;
00553
00555
00558 virtual bool saveGUI(io::IWriteFile* file, IGUIElement* start=0) = 0;
00559
00561
00564 virtual bool loadGUI(const io::path& filename, IGUIElement* parent=0) = 0;
00565
00567
00570 virtual bool loadGUI(io::IReadFile* file, IGUIElement* parent=0) = 0;
00571
00573 virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const =0;
00574
00576 virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)=0;
00577
00579 virtual void writeGUIElement(io::IXMLWriter* writer, IGUIElement* node) =0;
00580
00582 virtual void readGUIElement(io::IXMLReader* reader, IGUIElement* node) =0;
00583 };
00584
00585
00586 }
00587 }
00588
00589 #endif
00590