Irrlicht 3D Engine
IGUIContextMenu.h
Go to the documentation of this file.
00001 // Copyright (C) 2002-2012 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_CONTEXT_MENU_H_INCLUDED__
00006 #define __I_GUI_CONTEXT_MENU_H_INCLUDED__
00007 
00008 #include "IGUIElement.h"
00009 
00010 namespace irr
00011 {
00012 namespace gui
00013 {
00016     enum ECONTEXT_MENU_CLOSE
00017     {
00019         ECMC_IGNORE = 0,
00020 
00022         ECMC_REMOVE = 1,
00023 
00025         ECMC_HIDE = 2
00026 
00027         // note to implementors - this is planned as bitset, so continue with 4 if you need to add further flags.
00028     };
00029 
00031 
00035     class IGUIContextMenu : public IGUIElement
00036     {
00037     public:
00038 
00040         IGUIContextMenu(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
00041             : IGUIElement(EGUIET_CONTEXT_MENU, environment, parent, id, rectangle) {}
00042 
00044         virtual void setCloseHandling(ECONTEXT_MENU_CLOSE onClose) = 0;
00045 
00047         virtual ECONTEXT_MENU_CLOSE getCloseHandling() const = 0;
00048 
00050         virtual u32 getItemCount() const = 0;
00051 
00053 
00064         virtual u32 addItem(const wchar_t* text, s32 commandId=-1, bool enabled=true,
00065             bool hasSubMenu=false, bool checked=false, bool autoChecking=false) = 0;
00066 
00068 
00081         virtual u32 insertItem(u32 idx, const wchar_t* text, s32 commandId=-1, bool enabled=true,
00082             bool hasSubMenu=false, bool checked=false, bool autoChecking=false) = 0;
00083 
00085 
00089         virtual s32 findItemWithCommandId(s32 commandId, u32 idxStartSearch=0) const = 0;
00090 
00092         virtual void addSeparator() = 0;
00093 
00095 
00096         virtual const wchar_t* getItemText(u32 idx) const = 0;
00097 
00099 
00101         virtual void setItemText(u32 idx, const wchar_t* text) = 0;
00102 
00104 
00105         virtual bool isItemEnabled(u32 idx) const = 0;
00106 
00108 
00110         virtual void setItemEnabled(u32 idx, bool enabled) = 0;
00111 
00113 
00115         virtual void setItemChecked(u32 idx, bool enabled) = 0;
00116 
00118 
00119         virtual bool isItemChecked(u32 idx) const = 0;
00120 
00122 
00123         virtual void removeItem(u32 idx) = 0;
00124 
00126         virtual void removeAllItems() = 0;
00127 
00129 
00130         virtual s32 getSelectedItem() const = 0;
00131 
00133 
00134         virtual s32 getItemCommandId(u32 idx) const = 0;
00135 
00137 
00140         virtual void setItemCommandId(u32 idx, s32 id) = 0;
00141 
00143 
00146         virtual IGUIContextMenu* getSubMenu(u32 idx) const = 0;
00147 
00149         virtual void setItemAutoChecking(u32 idx, bool autoChecking) = 0;
00150 
00152         virtual bool getItemAutoChecking(u32 idx) const = 0;
00153 
00155         virtual void setEventParent(IGUIElement *parent) = 0;
00156     };
00157 
00158 } // end namespace gui
00159 } // end namespace irr
00160 
00161 #endif
00162