TDME2
1.9.121
src
tdme
gui
elements
GUIContextMenuController.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <string>
4
#include <vector>
5
6
#include <
tdme/tdme.h
>
7
#include <
tdme/gui/elements/fwd-tdme.h
>
8
#include <
tdme/gui/events/fwd-tdme.h
>
9
#include <
tdme/gui/nodes/fwd-tdme.h
>
10
#include <
tdme/gui/nodes/GUIElementController.h
>
11
#include <
tdme/utilities/MutableString.h
>
12
13
using
std::string;
14
using
std::vector;
15
16
using
tdme::gui::events::GUIKeyboardEvent
;
17
using
tdme::gui::events::GUIMouseEvent
;
18
using
tdme::gui::nodes::GUIElementController
;
19
using
tdme::gui::nodes::GUIElementNode
;
20
using
tdme::gui::nodes::GUINode
;
21
using
tdme::gui::nodes::GUINodeController
;
22
using
tdme::gui::nodes::GUIParentNode
;
23
using
tdme::utilities::MutableString
;
24
25
/**
26
* GUI context menu controller
27
* @author Andreas Drewke
28
* @version $Id$
29
*/
30
class
tdme::gui::elements::GUIContextMenuController
final
31
:
public
GUIElementController
32
{
33
friend
class
GUIContextMenu
;
34
friend
class
GUIContextMenuItemController
;
35
36
private
:
37
STATIC_DLL_IMPEXT
static
string
CONDITION_OPENED
;
38
STATIC_DLL_IMPEXT
static
string
CONDITION_CLOSED
;
39
STATIC_DLL_IMPEXT
static
string
CONDITION_SELECTED
;
40
STATIC_DLL_IMPEXT
static
string
CONDITION_UNSELECTED
;
41
vector<GUIContextMenuItemController*>
menuItemControllers
;
42
MutableString
value
;
43
int
selectedMenuItemControllerIdx
{ -1 };
44
45
private
:
46
/**
47
* Private constructor
48
* @param node node
49
*/
50
GUIContextMenuController
(
GUINode
*
node
);
51
52
/**
53
* @return menu open state
54
*/
55
bool
isOpen
();
56
57
/**
58
* Determine menu item controllers
59
*/
60
void
determineMenuItemControllers
();
61
62
/**
63
* Unselect selection
64
*/
65
void
unselectSelection
();
66
67
/**
68
* Select first menu item
69
*/
70
void
selectFirst
();
71
72
/**
73
* Select next menu item
74
*/
75
void
selectNext
();
76
77
/**
78
* Select previous menu item
79
*/
80
void
selectPrevious
();
81
82
/**
83
* Handle current menu item keyboard event
84
* @param event event
85
*/
86
void
handleCurrentMenuItemKeyboardEvent
(
GUIKeyboardEvent
* event);
87
88
public
:
89
// overridden methods
90
void
initialize
()
override
;
91
void
dispose
()
override
;
92
void
postLayout
()
override
;
93
void
handleMouseEvent
(
GUINode
*
node
,
GUIMouseEvent
* event)
override
;
94
void
handleKeyboardEvent
(
GUIKeyboardEvent
* event)
override
;
95
void
tick
()
override
;
96
void
onFocusGained
()
override
;
97
void
onFocusLost
()
override
;
98
bool
hasValue
()
override
;
99
const
MutableString
&
getValue
()
override
;
100
void
setValue
(
const
MutableString
&
value
)
override
;
101
void
onSubTreeChange
()
override
;
102
103
};
GUIElementController.h
MutableString.h
tdme::gui::elements::GUIContextMenuController
GUI context menu controller.
Definition:
GUIContextMenuController.h:32
tdme::gui::elements::GUIContextMenuController::onFocusGained
void onFocusGained() override
On focus gained.
Definition:
GUIContextMenuController.cpp:165
tdme::gui::elements::GUIContextMenuController::dispose
void dispose() override
Dispose controller.
Definition:
GUIContextMenuController.cpp:43
tdme::gui::elements::GUIContextMenuController::CONDITION_SELECTED
static STATIC_DLL_IMPEXT string CONDITION_SELECTED
Definition:
GUIContextMenuController.h:39
tdme::gui::elements::GUIContextMenuController::CONDITION_UNSELECTED
static STATIC_DLL_IMPEXT string CONDITION_UNSELECTED
Definition:
GUIContextMenuController.h:40
tdme::gui::elements::GUIContextMenuController::postLayout
void postLayout() override
Post layout event.
Definition:
GUIContextMenuController.cpp:48
tdme::gui::elements::GUIContextMenuController::initialize
void initialize() override
Initialize controller after element has been created.
Definition:
GUIContextMenuController.cpp:37
tdme::gui::elements::GUIContextMenuController::isOpen
bool isOpen()
tdme::gui::elements::GUIContextMenuController::handleKeyboardEvent
void handleKeyboardEvent(GUIKeyboardEvent *event) override
Handle keyboard event.
Definition:
GUIContextMenuController.cpp:138
tdme::gui::elements::GUIContextMenuController::selectedMenuItemControllerIdx
int selectedMenuItemControllerIdx
Definition:
GUIContextMenuController.h:43
tdme::gui::elements::GUIContextMenuController::handleCurrentMenuItemKeyboardEvent
void handleCurrentMenuItemKeyboardEvent(GUIKeyboardEvent *event)
Handle current menu item keyboard event.
Definition:
GUIContextMenuController.cpp:126
tdme::gui::elements::GUIContextMenuController::determineMenuItemControllers
void determineMenuItemControllers()
Determine menu item controllers.
Definition:
GUIContextMenuController.cpp:52
tdme::gui::elements::GUIContextMenuController::selectNext
void selectNext()
Select next menu item.
Definition:
GUIContextMenuController.cpp:82
tdme::gui::elements::GUIContextMenuController::onFocusLost
void onFocusLost() override
On focus lost.
Definition:
GUIContextMenuController.cpp:169
tdme::gui::elements::GUIContextMenuController::setValue
void setValue(const MutableString &value) override
Set value.
Definition:
GUIContextMenuController.cpp:184
tdme::gui::elements::GUIContextMenuController::handleMouseEvent
void handleMouseEvent(GUINode *node, GUIMouseEvent *event) override
Handle mouse event.
Definition:
GUIContextMenuController.cpp:133
tdme::gui::elements::GUIContextMenuController::selectFirst
void selectFirst()
Select first menu item.
Definition:
GUIContextMenuController.cpp:74
tdme::gui::elements::GUIContextMenuController::tick
void tick() override
Tick method will be executed once per frame.
Definition:
GUIContextMenuController.cpp:160
tdme::gui::elements::GUIContextMenuController::unselectSelection
void unselectSelection()
Unselect selection.
Definition:
GUIContextMenuController.cpp:67
tdme::gui::elements::GUIContextMenuController::value
MutableString value
Definition:
GUIContextMenuController.h:42
tdme::gui::elements::GUIContextMenuController::CONDITION_OPENED
static STATIC_DLL_IMPEXT string CONDITION_OPENED
Definition:
GUIContextMenuController.h:37
tdme::gui::elements::GUIContextMenuController::CONDITION_CLOSED
static STATIC_DLL_IMPEXT string CONDITION_CLOSED
Definition:
GUIContextMenuController.h:38
tdme::gui::elements::GUIContextMenuController::GUIContextMenuController
GUIContextMenuController(GUINode *node)
Private constructor.
Definition:
GUIContextMenuController.cpp:32
tdme::gui::elements::GUIContextMenuController::getValue
const MutableString & getValue() override
Definition:
GUIContextMenuController.cpp:178
tdme::gui::elements::GUIContextMenuController::onSubTreeChange
void onSubTreeChange() override
On sub tree change.
Definition:
GUIContextMenuController.cpp:189
tdme::gui::elements::GUIContextMenuController::hasValue
bool hasValue() override
Definition:
GUIContextMenuController.cpp:173
tdme::gui::elements::GUIContextMenuController::menuItemControllers
vector< GUIContextMenuItemController * > menuItemControllers
Definition:
GUIContextMenuController.h:41
tdme::gui::elements::GUIContextMenuController::selectPrevious
void selectPrevious()
Select previous menu item.
Definition:
GUIContextMenuController.cpp:104
tdme::gui::elements::GUIContextMenuItemController
GUI context menu item controller.
Definition:
GUIContextMenuItemController.h:29
tdme::gui::elements::GUIContextMenu
GUI context menu element.
Definition:
GUIContextMenu.h:28
tdme::gui::events::GUIKeyboardEvent
GUI keyboard event.
Definition:
GUIKeyboardEvent.h:13
tdme::gui::events::GUIMouseEvent
GUI mouse event.
Definition:
GUIMouseEvent.h:13
tdme::gui::nodes::GUIElementController
GUI element controller.
Definition:
GUIElementController.h:26
tdme::gui::nodes::GUIElementNode
GUI element node.
Definition:
GUIElementNode.h:38
tdme::gui::nodes::GUINodeController
GUI node controller base class.
Definition:
GUINodeController.h:19
tdme::gui::nodes::GUINodeController::node
GUINode * node
Definition:
GUINodeController.h:21
tdme::gui::nodes::GUINode
GUI node base class.
Definition:
GUINode.h:63
tdme::gui::nodes::GUIParentNode
GUI parent node base class thats supporting child nodes.
Definition:
GUIParentNode.h:43
tdme::utilities::MutableString
Mutable string class.
Definition:
MutableString.h:16
fwd-tdme.h
fwd-tdme.h
fwd-tdme.h
tdme.h
STATIC_DLL_IMPEXT
#define STATIC_DLL_IMPEXT
Definition:
tdme.h:11
Generated by
1.9.3