TDME2  1.9.200
ImportDialogScreenController.cpp
Go to the documentation of this file.
2 
3 #include <string>
4 
5 #include <tdme/tdme.h>
8 #include <tdme/engine/Engine.h>
9 #include <tdme/engine/Version.h>
18 #include <tdme/gui/GUI.h>
19 #include <tdme/gui/GUIParser.h>
24 #include <tdme/utilities/Console.h>
28 
30 
31 using std::string;
32 
47 using tdme::gui::GUI;
56 
57 ImportDialogScreenController::ImportDialogScreenController(PopUps* popUps): popUps(popUps)
58 {
59 }
60 
62 {
63  screenNode = nullptr;
64 }
65 
67 {
68  return screenNode;
69 }
70 
72 {
73  try {
74  screenNode = GUIParser::parse("resources/engine/gui", "popup_modelimport.xml");
75  screenNode->setEnabled(false);
79  } catch (Exception& exception) {
80  Console::println("ImportDialogScreenController::initialize(): An error occurred: " + string(exception.what()));
81  }
82 }
83 
85 {
86 }
87 
88 void ImportDialogScreenController::show(const string& fileName)
89 {
90  screenNode->getNodeById("modelimport_path")->getController()->setValue(MutableString(fileName));
91  screenNode->setEnabled(true);
92 }
93 
95 {
96  screenNode->setEnabled(false);
97 }
98 
100 {
101  if (type == GUIActionListenerType::PERFORMED) {
102  if (node->getId() == "modelimport_boundingvolume_node") {
104  } else
105  if (node->getId() == "modelimport_lod1_node") {
107  } else
108  if (node->getId() == "modelimport_lod2_node") {
110  } else
111  if (node->getId() == "modelimport_boundingvolume_open") {
113  string(),
114  "Load bounding volume model from: ",
115  ModelReader::getModelExtensions(),
116  string(),
117  true,
118  nullptr
119  );
120  } else
121  if (node->getId() == "modelimport_lod1_open") {
123  string(),
124  "Load LOD1 model from: ",
125  ModelReader::getModelExtensions(),
126  string(),
127  true,
128  nullptr
129  );
130  } else
131  if (node->getId() == "modelimport_lod2_open") {
133  string(),
134  "Load LOD2 model from: ",
135  ModelReader::getModelExtensions(),
136  string(),
137  true,
138  nullptr
139  );
140  } else
141  if (StringTools::startsWith(node->getId(), "modelimport_caption_close_") == true) { // TODO: a.drewke, check with DH) {
142  close();
143  }
144  }
145 }
146 
148  GUI::setDisableTabFocusControl(node->getScreenNode() != screenNode);
149 }
150 
152 }
153 
154 void ImportDialogScreenController::onTooltipShowRequest(GUINode* node, int mouseX, int mouseY) {
155  popUps->getTooltipScreenController()->show(mouseX, mouseY, node->getToolTip());
156 }
157 
160 }
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 controller base class.
virtual void setValue(const MutableString &value)=0
Set value.
GUI node base class.
Definition: GUINode.h:64
const string & getToolTip()
Definition: GUINode.h:346
GUINodeController * getController()
Definition: GUINode.h:661
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 show(const string &cwd, const string &captionText, const vector< string > &extensions, const string &fileName, bool enableFilter, Action *applyAction, Action *cancelAction=nullptr, const string &settingsFileName=".filedialog.properties", const string &settingsPathName=string())
Shows the file dialog pop up.
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
SelectorDialogScreenController * getSelectorDialogScreenController()
Definition: PopUps.h:124
FileDialogScreenController * getFileDialogScreenController()
Definition: PopUps.h:61
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.