arsa  2.7
IGUIContextMenu.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2012 Nikolaus Gebhardt
2 // This file is part of the "Irrlicht Engine".
3 // For conditions of distribution and use, see copyright notice in irrlicht.h
4 
5 #ifndef __I_GUI_CONTEXT_MENU_H_INCLUDED__
6 #define __I_GUI_CONTEXT_MENU_H_INCLUDED__
7 
8 #include "IGUIElement.h"
9 
10 namespace irr
11 {
12 namespace gui
13 {
17  {
20 
23 
26 
27  // note to implementers - this is planned as bitset, so continue with 4 if you need to add further flags.
28  };
29 
31 
36  {
37  public:
38 
40  IGUIContextMenu(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
41  : IGUIElement(EGUIET_CONTEXT_MENU, environment, parent, id, rectangle) {}
42 
44  virtual void setCloseHandling(ECONTEXT_MENU_CLOSE onClose) = 0;
45 
47  virtual ECONTEXT_MENU_CLOSE getCloseHandling() const = 0;
48 
50  virtual u32 getItemCount() const = 0;
51 
53 
64  virtual u32 addItem(const wchar_t* text, s32 commandId=-1, bool enabled=true,
65  bool hasSubMenu=false, bool checked=false, bool autoChecking=false) = 0;
66 
68 
81  virtual u32 insertItem(u32 idx, const wchar_t* text, s32 commandId=-1, bool enabled=true,
82  bool hasSubMenu=false, bool checked=false, bool autoChecking=false) = 0;
83 
85 
89  virtual s32 findItemWithCommandId(s32 commandId, u32 idxStartSearch=0) const = 0;
90 
92  virtual void addSeparator() = 0;
93 
95 
96  virtual const wchar_t* getItemText(u32 idx) const = 0;
97 
99 
101  virtual void setItemText(u32 idx, const wchar_t* text) = 0;
102 
104 
105  virtual bool isItemEnabled(u32 idx) const = 0;
106 
108 
110  virtual void setItemEnabled(u32 idx, bool enabled) = 0;
111 
113 
115  virtual void setItemChecked(u32 idx, bool enabled) = 0;
116 
118 
119  virtual bool isItemChecked(u32 idx) const = 0;
120 
122 
123  virtual void removeItem(u32 idx) = 0;
124 
126  virtual void removeAllItems() = 0;
127 
129 
130  virtual s32 getSelectedItem() const = 0;
131 
133 
134  virtual s32 getItemCommandId(u32 idx) const = 0;
135 
137 
140  virtual void setItemCommandId(u32 idx, s32 id) = 0;
141 
143 
146  virtual IGUIContextMenu* getSubMenu(u32 idx) const = 0;
147 
149  virtual void setItemAutoChecking(u32 idx, bool autoChecking) = 0;
150 
152  virtual bool getItemAutoChecking(u32 idx) const = 0;
153 
155  virtual void setEventParent(IGUIElement *parent) = 0;
156  };
157 
158 } // end namespace gui
159 } // end namespace irr
160 
161 #endif
162 
virtual s32 getSelectedItem() const =0
Get the selected item in the menu.
GLuint id
virtual u32 getItemCount() const =0
Get amount of menu items.
virtual void removeItem(u32 idx)=0
Removes a menu item.
virtual void setItemCommandId(u32 idx, s32 id)=0
Sets the command id of a menu item.
virtual bool isItemChecked(u32 idx) const =0
Check if a menu item is checked.
remove the gui element
do nothing - menu stays open
Everything in the Irrlicht Engine can be found in this namespace.
Definition: CARSADPad.h:6
virtual s32 getItemCommandId(u32 idx) const =0
Get the command id of a menu item.
GUI Environment. Used as factory and manager of all other GUI elements.
virtual s32 findItemWithCommandId(s32 commandId, u32 idxStartSearch=0) const =0
Find an item by its CommandID.
virtual void setItemText(u32 idx, const wchar_t *text)=0
Sets text of the menu item.
signed int s32
32 bit signed variable.
Definition: irrTypes.h:70
virtual IGUIContextMenu * getSubMenu(u32 idx) const =0
Get a pointer to the submenu of an item.
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
virtual void setEventParent(IGUIElement *parent)=0
When an eventparent is set it receives events instead of the usual parent element.
virtual bool isItemEnabled(u32 idx) const =0
Check if a menu item is enabled.
virtual void removeAllItems()=0
Removes all menu items.
virtual u32 addItem(const wchar_t *text, s32 commandId=-1, bool enabled=true, bool hasSubMenu=false, bool checked=false, bool autoChecking=false)=0
Adds a menu item.
GLenum GLenum GLsizei const GLuint GLboolean enabled
Base class of all GUI elements.
Definition: IGUIElement.h:23
GUI Context menu interface.
virtual ECONTEXT_MENU_CLOSE getCloseHandling() const =0
get current behavior when the menu will be closed
call setVisible(false)
virtual void addSeparator()=0
Adds a separator item to the menu.
virtual void setItemEnabled(u32 idx, bool enabled)=0
Sets if the menu item should be enabled.
virtual bool getItemAutoChecking(u32 idx) const =0
does the element change the checked status on clicking
virtual void setItemChecked(u32 idx, bool enabled)=0
Sets if the menu item should be checked.
A context menu (IGUIContextMenu)
virtual void setItemAutoChecking(u32 idx, bool autoChecking)=0
should the element change the checked status on clicking
virtual void setCloseHandling(ECONTEXT_MENU_CLOSE onClose)=0
set behavior when menus are closed
virtual u32 insertItem(u32 idx, const wchar_t *text, s32 commandId=-1, bool enabled=true, bool hasSubMenu=false, bool checked=false, bool autoChecking=false)=0
Insert a menu item at specified position.
IGUIContextMenu(IGUIEnvironment *environment, IGUIElement *parent, s32 id, core::rect< s32 > rectangle)
constructor
virtual const wchar_t * getItemText(u32 idx) const =0
Get text of the menu item.