aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/irrlicht-1.8.1/include/IGUIContextMenu.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/others/irrlicht-1.8.1/include/IGUIContextMenu.h')
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUIContextMenu.h162
1 files changed, 162 insertions, 0 deletions
diff --git a/src/others/irrlicht-1.8.1/include/IGUIContextMenu.h b/src/others/irrlicht-1.8.1/include/IGUIContextMenu.h
new file mode 100644
index 0000000..c9a0659
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUIContextMenu.h
@@ -0,0 +1,162 @@
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
10namespace irr
11{
12namespace gui
13{
14 //! Close behavior.
15 //! Default is ECMC_REMOVE
16 enum ECONTEXT_MENU_CLOSE
17 {
18 //! do nothing - menu stays open
19 ECMC_IGNORE = 0,
20
21 //! remove the gui element
22 ECMC_REMOVE = 1,
23
24 //! call setVisible(false)
25 ECMC_HIDE = 2
26
27 // note to implementors - this is planned as bitset, so continue with 4 if you need to add further flags.
28 };
29
30 //! GUI Context menu interface.
31 /** \par This element can create the following events of type EGUI_EVENT_TYPE:
32 \li EGET_ELEMENT_CLOSED
33 \li EGET_MENU_ITEM_SELECTED
34 */
35 class IGUIContextMenu : public IGUIElement
36 {
37 public:
38
39 //! constructor
40 IGUIContextMenu(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
41 : IGUIElement(EGUIET_CONTEXT_MENU, environment, parent, id, rectangle) {}
42
43 //! set behavior when menus are closed
44 virtual void setCloseHandling(ECONTEXT_MENU_CLOSE onClose) = 0;
45
46 //! get current behavior when the menu will be closed
47 virtual ECONTEXT_MENU_CLOSE getCloseHandling() const = 0;
48
49 //! Get amount of menu items
50 virtual u32 getItemCount() const = 0;
51
52 //! Adds a menu item.
53 /** \param text: Text of menu item. Set this to 0 to create
54 an separator instead of a real item, which is the same like
55 calling addSeparator();
56 \param commandId: Command id of menu item, a simple id you may
57 set to whatever you want.
58 \param enabled: Specifies if the menu item should be enabled.
59 \param hasSubMenu: Set this to true if there should be a submenu
60 at this item. You can access this submenu via getSubMenu().
61 \param checked: Specifies if the menu item should be initially checked.
62 \param autoChecking: Specifies if the item should be checked by clicking
63 \return Returns the index of the new item */
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
67 //! Insert a menu item at specified position.
68 /** \param idx: Position to insert the new element,
69 should be smaller than itemcount otherwise the item is added to the end.
70 \param text: Text of menu item. Set this to 0 to create
71 an separator instead of a real item, which is the same like
72 calling addSeparator();
73 \param commandId: Command id of menu item, a simple id you may
74 set to whatever you want.
75 \param enabled: Specifies if the menu item should be enabled.
76 \param hasSubMenu: Set this to true if there should be a submenu
77 at this item. You can access this submenu via getSubMenu().
78 \param checked: Specifies if the menu item should be initially checked.
79 \param autoChecking: Specifies if the item should be checked by clicking
80 \return Returns the index of the new item */
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
84 //! Find an item by it's CommandID
85 /**
86 \param commandId: We are looking for the first item which has this commandID
87 \param idxStartSearch: Start searching from this index.
88 \return Returns the index of the item when found or otherwise -1. */
89 virtual s32 findItemWithCommandId(s32 commandId, u32 idxStartSearch=0) const = 0;
90
91 //! Adds a separator item to the menu
92 virtual void addSeparator() = 0;
93
94 //! Get text of the menu item.
95 /** \param idx: Zero based index of the menu item */
96 virtual const wchar_t* getItemText(u32 idx) const = 0;
97
98 //! Sets text of the menu item.
99 /** \param idx: Zero based index of the menu item
100 \param text: New text of the item. */
101 virtual void setItemText(u32 idx, const wchar_t* text) = 0;
102
103 //! Check if a menu item is enabled
104 /** \param idx: Zero based index of the menu item */
105 virtual bool isItemEnabled(u32 idx) const = 0;
106
107 //! Sets if the menu item should be enabled.
108 /** \param idx: Zero based index of the menu item
109 \param enabled: True if it is enabled, otherwise false. */
110 virtual void setItemEnabled(u32 idx, bool enabled) = 0;
111
112 //! Sets if the menu item should be checked.
113 /** \param idx: Zero based index of the menu item
114 \param enabled: True if it is enabled, otherwise false. */
115 virtual void setItemChecked(u32 idx, bool enabled) = 0;
116
117 //! Check if a menu item is checked
118 /** \param idx: Zero based index of the menu item */
119 virtual bool isItemChecked(u32 idx) const = 0;
120
121 //! Removes a menu item
122 /** \param idx: Zero based index of the menu item */
123 virtual void removeItem(u32 idx) = 0;
124
125 //! Removes all menu items
126 virtual void removeAllItems() = 0;
127
128 //! Get the selected item in the menu
129 /** \return Index of the selected item, -1 if none selected. */
130 virtual s32 getSelectedItem() const = 0;
131
132 //! Get the command id of a menu item
133 /** \param idx: Zero based index of the menu item */
134 virtual s32 getItemCommandId(u32 idx) const = 0;
135
136 //! Sets the command id of a menu item
137 /** \param idx: Zero based index of the menu item
138 \param id: Command id of menu item, a simple id you may
139 set to whatever you want. */
140 virtual void setItemCommandId(u32 idx, s32 id) = 0;
141
142 //! Get a pointer to the submenu of an item.
143 /** 0 is returned if there is no submenu
144 \param idx: Zero based index of the menu item
145 \return Returns a pointer to the submenu of an item. */
146 virtual IGUIContextMenu* getSubMenu(u32 idx) const = 0;
147
148 //! should the element change the checked status on clicking
149 virtual void setItemAutoChecking(u32 idx, bool autoChecking) = 0;
150
151 //! does the element change the checked status on clicking
152 virtual bool getItemAutoChecking(u32 idx) const = 0;
153
154 //! When an eventparent is set it receives events instead of the usual parent element
155 virtual void setEventParent(IGUIElement *parent) = 0;
156 };
157
158} // end namespace gui
159} // end namespace irr
160
161#endif
162