TDME2
1.9.200
src
tdme
tools
editor
controllers
DraggingScreenController.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <memory>
4
#include <string>
5
6
#include <
tdme/tdme.h
>
7
#include <
tdme/gui/events/GUIMoveListener.h
>
8
#include <
tdme/gui/nodes/fwd-tdme.h
>
9
#include <
tdme/tools/editor/controllers/ScreenController.h
>
10
#include <
tdme/utilities/fwd-tdme.h
>
11
12
using
std::string;
13
using
std::unique_ptr;
14
15
using
tdme::gui::events::GUIMoveListener
;
16
using
tdme::gui::nodes::GUINode
;
17
using
tdme::gui::nodes::GUIParentNode
;
18
using
tdme::gui::nodes::GUIScreenNode
;
19
using
tdme::tools::editor::controllers::ScreenController
;
20
using
tdme::utilities::Action
;
21
22
/**
23
* Dragging screen controller
24
* @author Andreas Drewke
25
*/
26
class
tdme::tools::editor::controllers::DraggingScreenController
final
27
:
public
ScreenController
28
,
public
GUIMoveListener
29
{
30
31
private
:
32
GUIScreenNode
*
screenNode
{
nullptr
};
33
GUIParentNode
*
draggableNode
{
nullptr
};
34
35
string
payload
;
36
37
int
dragReleaseMouseX
{ -1 };
38
int
dragReleaseMouseY
{ -1 };
39
40
unique_ptr<Action>
onReleaseAction
;
41
42
public
:
43
// forbid class copy
44
FORBID_CLASS_COPY
(
DraggingScreenController
)
45
46
/**
47
* Public constructor
48
*/
49
DraggingScreenController
();
50
51
/**
52
* Destructor
53
*/
54
virtual
~DraggingScreenController
();
55
56
/**
57
* @return current payload
58
*/
59
inline
const
string
&
getPayload
() {
60
return
payload
;
61
}
62
63
/**
64
* @return unscaled drag release mouse X position
65
*/
66
inline
int
getDragReleaseMouseX
() {
67
return
dragReleaseMouseX
;
68
}
69
70
/**
71
* @return unscaled drag release mouse Y position
72
*/
73
inline
int
getDragReleaseMouseY
() {
74
return
dragReleaseMouseY
;
75
}
76
77
// overridden methods
78
GUIScreenNode
*
getScreenNode
()
override
;
79
void
initialize
()
override
;
80
void
dispose
()
override
;
81
bool
accept
(
GUINode
* node)
override
;
82
void
onMove
(
GUINode
* node)
override
;
83
void
onRelease
(
GUINode
* node,
int
mouseX,
int
mouseY)
override
;
84
85
/**
86
* Show dragging screen and a dragging image from given source
87
* @param mouseX mouse X
88
* @param mouseY mouse Y
89
* @param xml xml
90
* @param payload payload
91
* @param onReleaseAction on release action
92
*/
93
void
start
(
int
mouseX,
int
mouseY,
const
string
& xml,
const
string
&
payload
,
Action
*
onReleaseAction
);
94
95
/**
96
* Close dragging screen
97
*/
98
void
close
();
99
100
};
GUIMoveListener.h
ScreenController.h
tdme::gui::nodes::GUINode
GUI node base class.
Definition:
GUINode.h:64
tdme::gui::nodes::GUIParentNode
GUI parent node base class thats supporting child nodes.
Definition:
GUIParentNode.h:42
tdme::gui::nodes::GUIScreenNode
GUI screen node that represents a screen that can be rendered via GUI system.
Definition:
GUIScreenNode.h:72
tdme::tools::editor::controllers::DraggingScreenController
Dragging screen controller.
Definition:
DraggingScreenController.h:29
tdme::tools::editor::controllers::DraggingScreenController::dispose
void dispose() override
Dispose.
Definition:
DraggingScreenController.cpp:73
tdme::tools::editor::controllers::DraggingScreenController::initialize
void initialize() override
Init.
Definition:
DraggingScreenController.cpp:61
tdme::tools::editor::controllers::DraggingScreenController::DraggingScreenController
DraggingScreenController()
Public constructor.
Definition:
DraggingScreenController.cpp:47
tdme::tools::editor::controllers::DraggingScreenController::onReleaseAction
unique_ptr< Action > onReleaseAction
Definition:
DraggingScreenController.h:40
tdme::tools::editor::controllers::DraggingScreenController::getScreenNode
GUIScreenNode * getScreenNode() override
Definition:
DraggingScreenController.cpp:56
tdme::tools::editor::controllers::DraggingScreenController::close
void close()
Close dragging screen.
Definition:
DraggingScreenController.cpp:128
tdme::tools::editor::controllers::DraggingScreenController::getDragReleaseMouseY
int getDragReleaseMouseY()
Definition:
DraggingScreenController.h:73
tdme::tools::editor::controllers::DraggingScreenController::accept
bool accept(GUINode *node) override
Accept move.
Definition:
DraggingScreenController.cpp:77
tdme::tools::editor::controllers::DraggingScreenController::~DraggingScreenController
virtual ~DraggingScreenController()
Destructor.
Definition:
DraggingScreenController.cpp:51
tdme::tools::editor::controllers::DraggingScreenController::onMove
void onMove(GUINode *node) override
On move.
Definition:
DraggingScreenController.cpp:81
tdme::tools::editor::controllers::DraggingScreenController::screenNode
GUIScreenNode * screenNode
Definition:
DraggingScreenController.h:32
tdme::tools::editor::controllers::DraggingScreenController::start
void start(int mouseX, int mouseY, const string &xml, const string &payload, Action *onReleaseAction)
Show dragging screen and a dragging image from given source.
Definition:
DraggingScreenController.cpp:94
tdme::tools::editor::controllers::DraggingScreenController::dragReleaseMouseX
int dragReleaseMouseX
Definition:
DraggingScreenController.h:37
tdme::tools::editor::controllers::DraggingScreenController::draggableNode
GUIParentNode * draggableNode
Definition:
DraggingScreenController.h:33
tdme::tools::editor::controllers::DraggingScreenController::getDragReleaseMouseX
int getDragReleaseMouseX()
Definition:
DraggingScreenController.h:66
tdme::tools::editor::controllers::DraggingScreenController::getPayload
const string & getPayload()
Definition:
DraggingScreenController.h:59
tdme::tools::editor::controllers::DraggingScreenController::dragReleaseMouseY
int dragReleaseMouseY
Definition:
DraggingScreenController.h:38
tdme::tools::editor::controllers::DraggingScreenController::payload
string payload
Definition:
DraggingScreenController.h:35
tdme::tools::editor::controllers::DraggingScreenController::onRelease
void onRelease(GUINode *node, int mouseX, int mouseY) override
On release.
Definition:
DraggingScreenController.cpp:84
fwd-tdme.h
tdme::gui::events::GUIMoveListener
GUI move listener interface.
Definition:
GUIMoveListener.h:15
tdme::tools::editor::controllers::ScreenController
Screen controller, which connects GUI screen definition with code.
Definition:
ScreenController.h:14
tdme::utilities::Action
Action Interface.
Definition:
Action.h:11
tdme.h
FORBID_CLASS_COPY
#define FORBID_CLASS_COPY(CLASS)
Definition:
tdme.h:6
fwd-tdme.h
Generated by
1.9.1