TDME2
1.9.121
src
tdme
tools
editor
controllers
ContextMenuScreenController.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <string>
4
#include <unordered_map>
5
6
#include <
tdme/tdme.h
>
7
#include <
tdme/gui/events/fwd-tdme.h
>
8
#include <
tdme/gui/events/GUIActionListener.h
>
9
#include <
tdme/gui/events/GUIFocusListener.h
>
10
#include <
tdme/gui/nodes/fwd-tdme.h
>
11
#include <
tdme/tools/editor/controllers/ScreenController.h
>
12
#include <
tdme/utilities/fwd-tdme.h
>
13
14
using
std::string;
15
using
std::unordered_map;
16
17
using
tdme::gui::events::GUIActionListener
;
18
using
tdme::gui::events::GUIActionListenerType
;
19
using
tdme::gui::events::GUIFocusListener
;
20
using
tdme::gui::nodes::GUIElementNode
;
21
using
tdme::gui::nodes::GUIScreenNode
;
22
using
tdme::tools::editor::controllers::ScreenController
;
23
using
tdme::utilities::Action
;
24
25
/**
26
* Context menu screen controller
27
* @author Andreas Drewke
28
* @version $Id$
29
*/
30
class
tdme::tools::editor::controllers::ContextMenuScreenController
final
31
:
public
ScreenController
32
,
public
virtual
GUIActionListener
33
,
public
virtual
GUIFocusListener
34
{
35
36
private
:
37
GUIScreenNode
*
screenNode
{
nullptr
};
38
GUIElementNode
*
contextMenuNode
{
nullptr
};
39
unordered_map<string, Action*>
actions
;
40
41
public
:
42
/**
43
* Public constructor
44
*/
45
ContextMenuScreenController
();
46
47
/**
48
* Destructor
49
*/
50
virtual
~ContextMenuScreenController
();
51
52
/**
53
* Clear
54
*/
55
void
clear
();
56
57
/**
58
* Add menu item
59
* @param text text
60
* @param id id
61
* @param action action
62
*/
63
void
addMenuItem
(
const
string
& text,
const
string
&
id
,
Action
* action =
nullptr
);
64
65
/**
66
* Add menu separator
67
*/
68
void
addMenuSeparator
();
69
70
// overriden methods
71
GUIScreenNode
*
getScreenNode
()
override
;
72
void
initialize
()
override
;
73
void
dispose
()
override
;
74
void
onActionPerformed
(
GUIActionListenerType
type,
GUIElementNode
* node)
override
;
75
void
onFocus
(
GUIElementNode
* node)
override
;
76
void
onUnfocus
(
GUIElementNode
* node)
override
;
77
78
/**
79
* Shows the pop up
80
* @param mouseX mouse X
81
* @param mouseY mouse Y
82
*/
83
void
show
(
int
mouseX,
int
mouseY);
84
85
/**
86
* Closes the pop up
87
*/
88
void
close
();
89
90
};
GUIActionListener.h
GUIFocusListener.h
ScreenController.h
tdme::gui::nodes::GUIElementNode
GUI element node.
Definition:
GUIElementNode.h:38
tdme::gui::nodes::GUIScreenNode
GUI screen node that represents a screen that can be rendered via GUI system.
Definition:
GUIScreenNode.h:57
tdme::tools::editor::controllers::ContextMenuScreenController
Context menu screen controller.
Definition:
ContextMenuScreenController.h:34
tdme::tools::editor::controllers::ContextMenuScreenController::dispose
void dispose() override
Dispose.
Definition:
ContextMenuScreenController.cpp:77
tdme::tools::editor::controllers::ContextMenuScreenController::show
void show(int mouseX, int mouseY)
Shows the pop up.
Definition:
ContextMenuScreenController.cpp:81
tdme::tools::editor::controllers::ContextMenuScreenController::initialize
void initialize() override
Init.
Definition:
ContextMenuScreenController.cpp:63
tdme::tools::editor::controllers::ContextMenuScreenController::~ContextMenuScreenController
virtual ~ContextMenuScreenController()
Destructor.
Definition:
ContextMenuScreenController.cpp:51
tdme::tools::editor::controllers::ContextMenuScreenController::getScreenNode
GUIScreenNode * getScreenNode() override
Definition:
ContextMenuScreenController.cpp:58
tdme::tools::editor::controllers::ContextMenuScreenController::close
void close()
Closes the pop up.
Definition:
ContextMenuScreenController.cpp:96
tdme::tools::editor::controllers::ContextMenuScreenController::actions
unordered_map< string, Action * > actions
Definition:
ContextMenuScreenController.h:39
tdme::tools::editor::controllers::ContextMenuScreenController::onUnfocus
void onUnfocus(GUIElementNode *node) override
On unfocus.
Definition:
ContextMenuScreenController.cpp:113
tdme::tools::editor::controllers::ContextMenuScreenController::onActionPerformed
void onActionPerformed(GUIActionListenerType type, GUIElementNode *node) override
Definition:
ContextMenuScreenController.cpp:101
tdme::tools::editor::controllers::ContextMenuScreenController::screenNode
GUIScreenNode * screenNode
Definition:
ContextMenuScreenController.h:37
tdme::tools::editor::controllers::ContextMenuScreenController::onFocus
void onFocus(GUIElementNode *node) override
On focus.
Definition:
ContextMenuScreenController.cpp:110
tdme::tools::editor::controllers::ContextMenuScreenController::addMenuSeparator
void addMenuSeparator()
Add menu separator.
Definition:
ContextMenuScreenController.cpp:132
tdme::tools::editor::controllers::ContextMenuScreenController::clear
void clear()
Clear.
Definition:
ContextMenuScreenController.cpp:116
tdme::tools::editor::controllers::ContextMenuScreenController::ContextMenuScreenController
ContextMenuScreenController()
Public constructor.
Definition:
ContextMenuScreenController.cpp:47
tdme::tools::editor::controllers::ContextMenuScreenController::addMenuItem
void addMenuItem(const string &text, const string &id, Action *action=nullptr)
Add menu item.
Definition:
ContextMenuScreenController.cpp:122
tdme::tools::editor::controllers::ContextMenuScreenController::contextMenuNode
GUIElementNode * contextMenuNode
Definition:
ContextMenuScreenController.h:38
fwd-tdme.h
fwd-tdme.h
tdme::gui::events::GUIActionListenerType
GUIActionListenerType
Definition:
GUIActionListener.h:12
tdme::gui::events::GUIActionListener
GUI action listener interface.
Definition:
GUIActionListener.h:26
tdme::gui::events::GUIFocusListener
GUI focus listener interface.
Definition:
GUIFocusListener.h:15
tdme::tools::editor::controllers::ScreenController
Screen controller, which connects GUI screen definition with code.
Definition:
ScreenController.h:15
tdme::utilities::Action
Action Interface.
Definition:
Action.h:12
tdme.h
fwd-tdme.h
Generated by
1.9.3