Duckcpp 2.1.0
Duckcpp 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 duckcpp/duckcpp.hpp
4
5#ifndef DCPP_I_GUI_CONTEXT_MENU_HPP_INCLUDED
6#define DCPP_I_GUI_CONTEXT_MENU_HPP_INCLUDED
7
8#include <duckcpp/core/engine/IGUIElement.hpp>
9
10namespace dcpp
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
41 : IGUIElement(EGUIET_CONTEXT_MENU, environment, parent, id, rectangle) {}
42
44 virtual void setCloseHandling(ECONTEXT_MENU_CLOSE onClose) = 0;
45
48
50 virtual dcpp::uint32_kt getItemCount() const = 0;
51
53
64 virtual dcpp::uint32_kt addItem(const wchar_t* text, dcpp::int32_kt commandId=-1, bool enabled=true,
65 bool hasSubMenu=false, bool checked=false, bool autoChecking=false) = 0;
66
68
81 virtual dcpp::uint32_kt insertItem(dcpp::uint32_kt idx, const wchar_t* text, dcpp::int32_kt commandId=-1, bool enabled=true,
82 bool hasSubMenu=false, bool checked=false, bool autoChecking=false) = 0;
83
85
89 virtual dcpp::int32_kt findItemWithCommandId(dcpp::int32_kt commandId, dcpp::uint32_kt idxStartSearch=0) const = 0;
90
92 virtual void addSeparator() = 0;
93
95
96 virtual const wchar_t* getItemText(dcpp::uint32_kt idx) const = 0;
97
99
101 virtual void setItemText(dcpp::uint32_kt idx, const wchar_t* text) = 0;
102
104
105 virtual bool isItemEnabled(dcpp::uint32_kt idx) const = 0;
106
108
110 virtual void setItemEnabled(dcpp::uint32_kt idx, bool enabled) = 0;
111
113
115 virtual void setItemChecked(dcpp::uint32_kt idx, bool enabled) = 0;
116
118
119 virtual bool isItemChecked(dcpp::uint32_kt idx) const = 0;
120
122
123 virtual void removeItem(dcpp::uint32_kt idx) = 0;
124
126 virtual void removeAllItems() = 0;
127
129
130 virtual dcpp::int32_kt getSelectedItem() const = 0;
131
133
135
137
141
143
147
149 virtual void setItemAutoChecking(dcpp::uint32_kt idx, bool autoChecking) = 0;
150
152 virtual bool getItemAutoChecking(dcpp::uint32_kt idx) const = 0;
153
155 virtual void setEventParent(IGUIElement *parent) = 0;
156 };
157
158} // end namespace gui
159} // end namespace dcpp
160
161#endif
GUI Context menu interface.
Definition IGUIContextMenu.hpp:36
virtual void setItemEnabled(dcpp::uint32_kt idx, bool enabled)=0
Sets if the menu item should be enabled.
virtual dcpp::uint32_kt getItemCount() const =0
Get amount of menu items.
virtual bool isItemEnabled(dcpp::uint32_kt idx) const =0
Check if a menu item is enabled.
virtual void setItemAutoChecking(dcpp::uint32_kt 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 void addSeparator()=0
Adds a separator item to the menu.
virtual dcpp::uint32_kt insertItem(dcpp::uint32_kt idx, const wchar_t *text, dcpp::int32_kt commandId=-1, bool enabled=true, bool hasSubMenu=false, bool checked=false, bool autoChecking=false)=0
Insert a menu item at specified position.
virtual dcpp::int32_kt getItemCommandId(dcpp::uint32_kt idx) const =0
Get the command id of a menu item.
virtual IGUIContextMenu * getSubMenu(dcpp::uint32_kt idx) const =0
Get a pointer to the submenu of an item.
virtual void setItemCommandId(dcpp::uint32_kt idx, dcpp::int32_kt id)=0
Sets the command id of a menu item.
virtual void setItemText(dcpp::uint32_kt idx, const wchar_t *text)=0
Sets text of the menu item.
virtual dcpp::int32_kt findItemWithCommandId(dcpp::int32_kt commandId, dcpp::uint32_kt idxStartSearch=0) const =0
Find an item by its CommandID.
virtual bool isItemChecked(dcpp::uint32_kt idx) const =0
Check if a menu item is checked.
virtual ECONTEXT_MENU_CLOSE getCloseHandling() const =0
get current behavior when the menu will be closed
virtual void removeAllItems()=0
Removes all menu items.
virtual void setItemChecked(dcpp::uint32_kt idx, bool enabled)=0
Sets if the menu item should be checked.
virtual void removeItem(dcpp::uint32_kt idx)=0
Removes a menu item.
IGUIContextMenu(IGUIEnvironment *environment, IGUIElement *parent, dcpp::int32_kt id, dcpp::nub::recti rectangle)
constructor
Definition IGUIContextMenu.hpp:40
virtual dcpp::int32_kt getSelectedItem() const =0
Get the selected item in the menu.
virtual dcpp::uint32_kt addItem(const wchar_t *text, dcpp::int32_kt commandId=-1, bool enabled=true, bool hasSubMenu=false, bool checked=false, bool autoChecking=false)=0
Adds a menu item.
virtual bool getItemAutoChecking(dcpp::uint32_kt idx) const =0
does the element change the checked status on clicking
virtual const wchar_t * getItemText(dcpp::uint32_kt idx) const =0
Get text of the menu item.
virtual void setEventParent(IGUIElement *parent)=0
When an eventparent is set it receives events instead of the usual parent element.
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
Rectangle template.
Definition rect.hpp:27
@ 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 Duckcpp 1.6, position2d is a synonym for vector2d.
Definition vector3d.hpp:11
unsigned int uint32_kt
32 bit unsigned variable.
Definition irrTypes.hpp:64
signed int int32_kt
32 bit signed variable.
Definition irrTypes.hpp:72

Duckcpp    @cppfx.xyz