TDME2
1.9.121
src
tdme
tools
editor
controllers
InfoDialogScreenController.cpp
Go to the documentation of this file.
1
#include <
tdme/tools/editor/controllers/InfoDialogScreenController.h
>
2
3
#include <string>
4
5
#include <
tdme/tdme.h
>
6
#include <
tdme/gui/events/GUIActionListener.h
>
7
#include <
tdme/gui/nodes/GUIElementNode.h
>
8
#include <
tdme/gui/nodes/GUINode.h
>
9
#include <
tdme/gui/nodes/GUIScreenNode.h
>
10
#include <
tdme/gui/nodes/GUIStyledTextNode.h
>
11
#include <
tdme/gui/nodes/GUITextNode.h
>
12
#include <
tdme/gui/GUI.h
>
13
#include <
tdme/gui/GUIParser.h
>
14
#include <
tdme/utilities/Console.h
>
15
#include <
tdme/utilities/Exception.h
>
16
#include <
tdme/utilities/MutableString.h
>
17
#include <
tdme/utilities/StringTools.h
>
18
19
using
std::string;
20
21
using
tdme::gui::events::GUIActionListenerType
;
22
using
tdme::gui::nodes::GUIElementNode
;
23
using
tdme::gui::nodes::GUINode
;
24
using
tdme::gui::nodes::GUIScreenNode
;
25
using
tdme::gui::nodes::GUIStyledTextNode
;
26
using
tdme::gui::nodes::GUITextNode
;
27
using
tdme::gui::GUIParser
;
28
using
tdme::tools::editor::controllers::InfoDialogScreenController
;
29
using
tdme::utilities::Console
;
30
using
tdme::utilities::Exception
;
31
using
tdme::utilities::MutableString
;
32
using
tdme::utilities::StringTools
;
33
34
InfoDialogScreenController::InfoDialogScreenController()
35
{
36
}
37
38
InfoDialogScreenController::~InfoDialogScreenController
()
39
{
40
screenNode
=
nullptr
;
41
}
42
43
GUIScreenNode
*
InfoDialogScreenController::getScreenNode
()
44
{
45
return
screenNode
;
46
}
47
48
void
InfoDialogScreenController::initialize
()
49
{
50
try
{
51
screenNode
= GUIParser::parse(
"resources/engine/gui"
,
"popup_infodialog.xml"
);
52
screenNode
->
setVisible
(
false
);
53
screenNode
->
addActionListener
(
this
);
54
tabsHeaderNode
= required_dynamic_cast<GUIElementNode*>(
screenNode
->
getNodeById
(
"infodialog_tabs-header"
));
55
messageNode
=
dynamic_cast<
GUIStyledTextNode
*
>
(
screenNode
->
getNodeById
(
"infodialog_message"
));
56
}
catch
(
Exception
& exception) {
57
Console::print(
string
(
"InfoDialogScreenController::initialize(): An error occurred: "
));
58
Console::println(
string
(exception.what()));
59
}
60
}
61
62
void
InfoDialogScreenController::dispose
()
63
{
64
}
65
66
void
InfoDialogScreenController::show
(
const
string
& caption,
const
string
& message)
67
{
68
screenNode
->
setVisible
(
true
);
69
required_dynamic_cast<GUIParentNode*>(
screenNode
->
getInnerNodeById
(
tabsHeaderNode
->
getId
()))->replaceSubNodes(
"<tab id=\"infodialog_caption\" image=\"resources/engine/images/attention.png\" text=\""
+ caption +
"\" closeable=\"true\"/>"
,
true
);
70
messageNode
->
setText
(message);
71
screenNode
->
layout
();
72
}
73
74
void
InfoDialogScreenController::close
()
75
{
76
screenNode
->
setVisible
(
false
);
77
}
78
79
void
InfoDialogScreenController::onActionPerformed
(
GUIActionListenerType
type,
GUIElementNode
* node)
80
{
81
if
(type ==
GUIActionListenerType::PERFORMED
) {
82
if
(node->
getId
() ==
"infodialog_button1"
||
83
StringTools::startsWith(node->
getId
(),
"infodialog_caption_close_"
) ==
true
) {
// TODO: a.drewke, check with DH) {
84
close
();
85
}
86
}
87
}
Console.h
Exception.h
GUIActionListener.h
GUIElementNode.h
GUINode.h
GUIParser.h
GUIScreenNode.h
GUIStyledTextNode.h
GUITextNode.h
GUI.h
InfoDialogScreenController.h
MutableString.h
StringTools.h
tdme::gui::GUIParser
GUI parser.
Definition:
GUIParser.h:39
tdme::gui::nodes::GUIElementNode
GUI element node.
Definition:
GUIElementNode.h:38
tdme::gui::nodes::GUINode
GUI node base class.
Definition:
GUINode.h:63
tdme::gui::nodes::GUINode::getId
const string & getId()
Definition:
GUINode.h:329
tdme::gui::nodes::GUIScreenNode
GUI screen node that represents a screen that can be rendered via GUI system.
Definition:
GUIScreenNode.h:57
tdme::gui::nodes::GUIScreenNode::setVisible
void setVisible(bool visible)
Set visible.
Definition:
GUIScreenNode.cpp:120
tdme::gui::nodes::GUIScreenNode::getNodeById
GUINode * getNodeById(const string &nodeId)
Get GUI node by id.
Definition:
GUIScreenNode.h:345
tdme::gui::nodes::GUIScreenNode::layout
void layout() override
Layout.
Definition:
GUIScreenNode.cpp:159
tdme::gui::nodes::GUIScreenNode::addActionListener
void addActionListener(GUIActionListener *listener)
Add action listener.
Definition:
GUIScreenNode.cpp:443
tdme::gui::nodes::GUIScreenNode::getInnerNodeById
GUINode * getInnerNodeById(const string &nodeId)
Get inner GUI node by id.
Definition:
GUIScreenNode.h:365
tdme::gui::nodes::GUIStyledTextNode
GUI styled text node.
Definition:
GUIStyledTextNode.h:44
tdme::gui::nodes::GUIStyledTextNode::setText
void setText(const MutableString &text)
Set text.
Definition:
GUIStyledTextNode.cpp:190
tdme::gui::nodes::GUITextNode
GUI text node.
Definition:
GUITextNode.h:42
tdme::tools::editor::controllers::InfoDialogScreenController
Info dialog screen controller.
Definition:
InfoDialogScreenController.h:31
tdme::tools::editor::controllers::InfoDialogScreenController::messageNode
GUIStyledTextNode * messageNode
Definition:
InfoDialogScreenController.h:36
tdme::tools::editor::controllers::InfoDialogScreenController::dispose
void dispose() override
Dispose.
Definition:
InfoDialogScreenController.cpp:62
tdme::tools::editor::controllers::InfoDialogScreenController::show
void show(const string &caption, const string &message)
Shows the pop up.
Definition:
InfoDialogScreenController.cpp:66
tdme::tools::editor::controllers::InfoDialogScreenController::initialize
void initialize() override
Init.
Definition:
InfoDialogScreenController.cpp:48
tdme::tools::editor::controllers::InfoDialogScreenController::getScreenNode
GUIScreenNode * getScreenNode() override
Definition:
InfoDialogScreenController.cpp:43
tdme::tools::editor::controllers::InfoDialogScreenController::close
void close()
Closes the pop up.
Definition:
InfoDialogScreenController.cpp:74
tdme::tools::editor::controllers::InfoDialogScreenController::~InfoDialogScreenController
virtual ~InfoDialogScreenController()
Destructor.
Definition:
InfoDialogScreenController.cpp:38
tdme::tools::editor::controllers::InfoDialogScreenController::onActionPerformed
void onActionPerformed(GUIActionListenerType type, GUIElementNode *node) override
Definition:
InfoDialogScreenController.cpp:79
tdme::tools::editor::controllers::InfoDialogScreenController::screenNode
GUIScreenNode * screenNode
Definition:
InfoDialogScreenController.h:34
tdme::tools::editor::controllers::InfoDialogScreenController::tabsHeaderNode
GUIElementNode * tabsHeaderNode
Definition:
InfoDialogScreenController.h:35
tdme::utilities::Console
Console class.
Definition:
Console.h:26
tdme::utilities::MutableString
Mutable string class.
Definition:
MutableString.h:16
tdme::utilities::StringTools
String tools class.
Definition:
StringTools.h:20
tdme::gui::events::GUIActionListenerType
GUIActionListenerType
Definition:
GUIActionListener.h:12
tdme::gui::events::PERFORMED
@ PERFORMED
Definition:
GUIActionListener.h:13
tdme::utilities::Exception
std::exception Exception
Exception base class.
Definition:
Exception.h:19
tdme.h
Generated by
1.9.3