Nirtcpp 2.1.0
Nirtcpp is a high-performance c++ graphics engine.
Loading...
Searching...
No Matches
IGUIContextMenu.hpp
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 nirtcpp/nirtcpp.hpp
4
5#ifndef NIRT_I_GUI_CONTEXT_MENU_HPP_INCLUDED
6#define NIRT_I_GUI_CONTEXT_MENU_HPP_INCLUDED
7
8#include <nirtcpp/core/engine/IGUIElement.hpp>
9
10namespace nirt
11{
12namespace gui
13{
17 {
20
23
25 ECMC_HIDE = 2
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
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 nirt
160
161#endif
Axis aligned bounding box in 3d dimensional space.
Definition aabbox3d.hpp:22
GUI Context menu interface.
Definition IGUIContextMenu.hpp:36
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.
virtual void setCloseHandling(ECONTEXT_MENU_CLOSE onClose)=0
set behavior when menus are closed
virtual ECONTEXT_MENU_CLOSE getCloseHandling() const =0
get current behavior when the menu will be closed
virtual bool getItemAutoChecking(u32 idx) const =0
does the element change the checked status on clicking
virtual bool isItemChecked(u32 idx) const =0
Check if a menu item is checked.
virtual bool isItemEnabled(u32 idx) const =0
Check if a menu item is enabled.
virtual void setEventParent(IGUIElement *parent)=0
When an eventparent is set it receives events instead of the usual parent element.
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.
virtual s32 getItemCommandId(u32 idx) const =0
Get the command id of a menu item.
virtual void setItemText(u32 idx, const wchar_t *text)=0
Sets text of the menu item.
virtual void setItemChecked(u32 idx, bool enabled)=0
Sets if the menu item should be checked.
IGUIContextMenu(IGUIEnvironment *environment, IGUIElement *parent, s32 id, core::rect< s32 > rectangle)
constructor
Definition IGUIContextMenu.hpp:40
virtual void removeItem(u32 idx)=0
Removes a menu item.
virtual void setItemEnabled(u32 idx, bool enabled)=0
Sets if the menu item should be enabled.
virtual s32 findItemWithCommandId(s32 commandId, u32 idxStartSearch=0) const =0
Find an item by its CommandID.
virtual void setItemAutoChecking(u32 idx, bool autoChecking)=0
should the element change the checked status on clicking
virtual void setItemCommandId(u32 idx, s32 id)=0
Sets the command id of a menu item.
virtual u32 getItemCount() const =0
Get amount of menu items.
virtual void addSeparator()=0
Adds a separator item to the menu.
virtual void removeAllItems()=0
Removes all menu items.
virtual const wchar_t * getItemText(u32 idx) const =0
Get text of the menu item.
virtual IGUIContextMenu * getSubMenu(u32 idx) const =0
Get a pointer to the submenu of an item.
virtual s32 getSelectedItem() const =0
Get the selected item in the menu.
Base class of all GUI elements.
Definition IGUIElement.hpp:24
GUI Environment. Used as factory and manager of all other GUI elements.
Definition IGUIEnvironment.hpp:73
@ EGUIET_CONTEXT_MENU
A context menu (IGUIContextMenu)
Definition EGUIElementTypes.hpp:29
ECONTEXT_MENU_CLOSE
Definition IGUIContextMenu.hpp:17
@ ECMC_REMOVE
remove the gui element
Definition IGUIContextMenu.hpp:22
@ ECMC_IGNORE
do nothing - menu stays open
Definition IGUIContextMenu.hpp:19
@ ECMC_HIDE
call setVisible(false)
Definition IGUIContextMenu.hpp:25
As of Nirtcpp 1.6, position2d is a synonym for vector2d.
Definition vector3d.hpp:11
signed int s32
32 bit signed variable.
Definition irrTypes.hpp:72
unsigned int u32
32 bit unsigned variable.
Definition irrTypes.hpp:64

Nirtcpp    @cppfx.xyz

Utxcpp    utx::print