TDME2  1.9.200
AboutDialogScreenController.cpp
Go to the documentation of this file.
2 
3 #include <string>
4 
5 #include <tdme/tdme.h>
7 #include <tdme/engine/Engine.h>
8 #include <tdme/engine/Version.h>
16 #include <tdme/gui/GUI.h>
17 #include <tdme/gui/GUIParser.h>
20 #include <tdme/utilities/Console.h>
24 
25 using std::string;
26 
39 using tdme::gui::GUI;
47 
48 AboutDialogScreenController::AboutDialogScreenController(PopUps* popUps): popUps(popUps)
49 {
50 }
51 
53 {
54  screenNode = nullptr;
55 }
56 
58 {
59  return screenNode;
60 }
61 
63 {
64  try {
65  screenNode = GUIParser::parse("resources/engine/gui", "popup_about.xml");
66  screenNode->setEnabled(false);
69  required_dynamic_cast<GUITextNode*>(screenNode->getNodeById("about_version"))->setText(MutableString(Version::getVersion()));
70  required_dynamic_cast<GUITextNode*>(screenNode->getNodeById("about_platform"))->setText(MutableString("Platform: " + Application::getOSName() + "/" + Application::getCPUName()));
71  required_dynamic_cast<GUIStyledTextNode*>(screenNode->getNodeById("about_graphics"))->setText(MutableString("Graphics: " + StringTools::replace(StringTools::replace(Engine::getInstance()->getGraphicsRenderer(), "[", "\\["), "]", "\\]")));
73  } catch (Exception& exception) {
74  Console::println("AboutDialogScreenController::initialize(): An error occurred: " + string(exception.what()));
75  }
76 }
77 
79 {
80 }
81 
83 {
84  screenNode->setEnabled(true);
85 }
86 
88 {
89  screenNode->setEnabled(false);
90 }
91 
93 {
95  if (StringTools::startsWith(node->getId(), "about_caption_close_") == true) { // TODO: a.drewke, check with DH) {
96  close();
97  }
98  }
99 }
100 
102  GUI::setDisableTabFocusControl(node->getScreenNode() != screenNode);
103 }
104 
106 }
107 
108 void AboutDialogScreenController::onTooltipShowRequest(GUINode* node, int mouseX, int mouseY) {
109  popUps->getTooltipScreenController()->show(mouseX, mouseY, node->getToolTip());
110 }
111 
114 }
Application base class, please make sure to allocate application on heap to have correct application ...
Definition: Application.h:41
Engine main class.
Definition: Engine.h:131
GUI parser.
Definition: GUIParser.h:40
GUI module class.
Definition: GUI.h:64
GUI node base class.
Definition: GUINode.h:64
const string & getToolTip()
Definition: GUINode.h:346
GUIScreenNode * getScreenNode()
Definition: GUINode.h:325
const string & getId()
Definition: GUINode.h:339
GUI screen node that represents a screen that can be rendered via GUI system.
Definition: GUIScreenNode.h:72
void setEnabled(bool enabled)
Set enabled.
void addTooltipRequestListener(GUITooltipRequestListener *listener)
Add tooltip request listener.
void addActionListener(GUIActionListener *listener)
Add action listener.
void invalidateLayouts()
Actually do the nodes marked for layout invalidation.
GUINode * getNodeById(const string &nodeId)
Get GUI node by id.
void onAction(GUIActionListenerType type, GUIElementNode *node) override
void onTooltipShowRequest(GUINode *node, int mouseX, int mouseY) override
On tooltip show request.
void show(int mouseX, int mouseY, const string &tooltip)
Show tooltip.
Pop ups controller accessor class.
Definition: PopUps.h:29
TooltipScreenController * getTooltipScreenController()
Definition: PopUps.h:131
Console class.
Definition: Console.h:29
Mutable utf8 aware string class.
Definition: MutableString.h:23
String tools class.
Definition: StringTools.h:22
std::exception Exception
Exception base class.
Definition: Exception.h:18
GUI action listener interface.
GUI focus listener interface.