TDME2
1.9.121
src
tdme
tools
editor
controllers
ColorPickerScreenController.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <string>
4
5
#include <
tdme/tdme.h
>
6
#include <
tdme/engine/model/Color4Base.h
>
7
#include <
tdme/gui/events/fwd-tdme.h
>
8
#include <
tdme/gui/events/GUIActionListener.h
>
9
#include <
tdme/gui/events/GUIChangeListener.h
>
10
#include <
tdme/gui/events/GUIFocusListener.h
>
11
#include <
tdme/gui/nodes/fwd-tdme.h
>
12
#include <
tdme/tools/editor/controllers/ScreenController.h
>
13
#include <
tdme/utilities/fwd-tdme.h
>
14
15
using
std::string;
16
17
using
tdme::engine::model::Color4Base
;
18
using
tdme::gui::events::GUIActionListener
;
19
using
tdme::gui::events::GUIActionListenerType
;
20
using
tdme::gui::events::GUIChangeListener
;
21
using
tdme::gui::events::GUIFocusListener
;
22
using
tdme::gui::nodes::GUIElementNode
;
23
using
tdme::gui::nodes::GUIScreenNode
;
24
using
tdme::tools::editor::controllers::ScreenController
;
25
using
tdme::utilities::Action
;
26
27
/**
28
* Color picker screen controller
29
* @author Andreas Drewke
30
* @version $Id$
31
*/
32
class
tdme::tools::editor::controllers::ColorPickerScreenController
final
33
:
public
ScreenController
34
,
public
virtual
GUIActionListener
35
,
public
virtual
GUIChangeListener
36
,
public
virtual
GUIFocusListener
37
{
38
39
private
:
40
GUIScreenNode
*
screenNode
{
nullptr
};
41
GUIElementNode
*
redInput
{
nullptr
};
42
GUIElementNode
*
greenInput
{
nullptr
};
43
GUIElementNode
*
blueInput
{
nullptr
};
44
GUIElementNode
*
alphaInput
{
nullptr
};
45
GUIElementNode
*
hexInput
{
nullptr
};
46
GUIElementNode
*
brightnessSlider
{
nullptr
};
47
Color4Base
color
;
48
Action
*
onColorChangeAction
{
nullptr
};
49
50
/**
51
* Update color
52
*/
53
void
updateColor
();
54
55
/**
56
* Update color hex
57
*/
58
void
updateColorHex
();
59
60
public
:
61
/**
62
* Public constructor
63
*/
64
ColorPickerScreenController
();
65
66
/**
67
* Public denstructor
68
*/
69
virtual
~ColorPickerScreenController
();
70
71
// overriden methods
72
GUIScreenNode
*
getScreenNode
()
override
;
73
void
initialize
()
override
;
74
void
dispose
()
override
;
75
#if defined(_WIN32) && defined(_MSC_VER)
76
// I do not get it currently, somehow it does not accept override whereas everything works fine
77
void
onValueChanged
(
GUIElementNode
* node);
78
void
onActionPerformed
(
GUIActionListenerType
type,
GUIElementNode
* node);
79
void
onFocus
(
GUIElementNode
* node);
80
void
onUnfocus
(
GUIElementNode
* node);
81
#else
82
void
onValueChanged
(
GUIElementNode
* node)
override
;
83
void
onActionPerformed
(
GUIActionListenerType
type,
GUIElementNode
* node)
override
;
84
void
onFocus
(
GUIElementNode
* node)
override
;
85
void
onUnfocus
(
GUIElementNode
* node)
override
;
86
#endif
87
88
/**
89
* Shows the pop up
90
* @param color color
91
* @param onColorChangeAction on color change action
92
*/
93
void
show
(
const
Color4Base
&
color
,
Action
*
onColorChangeAction
);
94
95
/**
96
* Closes the pop up
97
*/
98
void
close
();
99
100
/**
101
* Set color
102
* @param color color
103
*/
104
void
setColor
(
const
Color4Base
&
color
);
105
106
/**
107
* @return color
108
*/
109
inline
Color4Base
getColor
() {
110
return
color
;
111
}
112
113
};
Color4Base.h
GUIActionListener.h
GUIChangeListener.h
GUIFocusListener.h
ScreenController.h
tdme::engine::model::Color4Base
Color 4 base definition class.
Definition:
Color4Base.h:19
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::ColorPickerScreenController
Color picker screen controller.
Definition:
ColorPickerScreenController.h:37
tdme::tools::editor::controllers::ColorPickerScreenController::dispose
void dispose() override
Dispose.
Definition:
ColorPickerScreenController.cpp:90
tdme::tools::editor::controllers::ColorPickerScreenController::initialize
void initialize() override
Init.
Definition:
ColorPickerScreenController.cpp:68
tdme::tools::editor::controllers::ColorPickerScreenController::getColor
Color4Base getColor()
Definition:
ColorPickerScreenController.h:109
tdme::tools::editor::controllers::ColorPickerScreenController::updateColor
void updateColor()
Update color.
Definition:
ColorPickerScreenController.cpp:183
tdme::tools::editor::controllers::ColorPickerScreenController::setColor
void setColor(const Color4Base &color)
Set color.
Definition:
ColorPickerScreenController.cpp:203
tdme::tools::editor::controllers::ColorPickerScreenController::color
Color4Base color
Definition:
ColorPickerScreenController.h:47
tdme::tools::editor::controllers::ColorPickerScreenController::getScreenNode
GUIScreenNode * getScreenNode() override
Definition:
ColorPickerScreenController.cpp:63
tdme::tools::editor::controllers::ColorPickerScreenController::close
void close()
Closes the pop up.
Definition:
ColorPickerScreenController.cpp:104
tdme::tools::editor::controllers::ColorPickerScreenController::onUnfocus
void onUnfocus(GUIElementNode *node) override
On unfocus.
Definition:
ColorPickerScreenController.cpp:176
tdme::tools::editor::controllers::ColorPickerScreenController::onColorChangeAction
Action * onColorChangeAction
Definition:
ColorPickerScreenController.h:48
tdme::tools::editor::controllers::ColorPickerScreenController::onValueChanged
void onValueChanged(GUIElementNode *node) override
On value changed.
Definition:
ColorPickerScreenController.cpp:113
tdme::tools::editor::controllers::ColorPickerScreenController::show
void show(const Color4Base &color, Action *onColorChangeAction)
Shows the pop up.
Definition:
ColorPickerScreenController.cpp:95
tdme::tools::editor::controllers::ColorPickerScreenController::alphaInput
GUIElementNode * alphaInput
Definition:
ColorPickerScreenController.h:44
tdme::tools::editor::controllers::ColorPickerScreenController::ColorPickerScreenController
ColorPickerScreenController()
Public constructor.
Definition:
ColorPickerScreenController.cpp:54
tdme::tools::editor::controllers::ColorPickerScreenController::onActionPerformed
void onActionPerformed(GUIActionListenerType type, GUIElementNode *node) override
Definition:
ColorPickerScreenController.cpp:164
tdme::tools::editor::controllers::ColorPickerScreenController::screenNode
GUIScreenNode * screenNode
Definition:
ColorPickerScreenController.h:40
tdme::tools::editor::controllers::ColorPickerScreenController::onFocus
void onFocus(GUIElementNode *node) override
On focus.
Definition:
ColorPickerScreenController.cpp:173
tdme::tools::editor::controllers::ColorPickerScreenController::blueInput
GUIElementNode * blueInput
Definition:
ColorPickerScreenController.h:43
tdme::tools::editor::controllers::ColorPickerScreenController::greenInput
GUIElementNode * greenInput
Definition:
ColorPickerScreenController.h:42
tdme::tools::editor::controllers::ColorPickerScreenController::brightnessSlider
GUIElementNode * brightnessSlider
Definition:
ColorPickerScreenController.h:46
tdme::tools::editor::controllers::ColorPickerScreenController::~ColorPickerScreenController
virtual ~ColorPickerScreenController()
Public denstructor.
Definition:
ColorPickerScreenController.cpp:58
tdme::tools::editor::controllers::ColorPickerScreenController::hexInput
GUIElementNode * hexInput
Definition:
ColorPickerScreenController.h:45
tdme::tools::editor::controllers::ColorPickerScreenController::redInput
GUIElementNode * redInput
Definition:
ColorPickerScreenController.h:41
tdme::tools::editor::controllers::ColorPickerScreenController::updateColorHex
void updateColorHex()
Update color hex.
Definition:
ColorPickerScreenController.cpp:191
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::GUIChangeListener
GUI change listener interface.
Definition:
GUIChangeListener.h:15
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