TDME2 1.9.121
FileDialogScreenController.cpp
Go to the documentation of this file.
2
3#include <algorithm>
4#include <string>
5#include <unordered_map>
6#include <vector>
7
8#include <tdme/tdme.h>
17#include <tdme/gui/GUI.h>
18#include <tdme/gui/GUIParser.h>
28
29using std::remove;
30using std::string;
31using std::unordered_map;
32using std::vector;
33
52
53FileDialogScreenController::FileDialogScreenController()
54{
55 this->cwd = FileSystem::getStandardFileSystem()->getCurrentWorkingPathName();
56 this->applyAction = nullptr;
57 this->enableFilter = false;
58 this->filtered = false;
59}
60
62 if (applyAction != nullptr) delete applyAction;
63 if (cancelAction != nullptr) delete cancelAction;
64}
65
67{
68 return screenNode;
69}
70
72{
73 return cwd;
74}
75
77{
79}
80
81void FileDialogScreenController::setDefaultCWD(const string& defaultCwd) {
82 this->defaultCwd = defaultCwd;
83}
84
86{
87 try {
88 screenNode = GUIParser::parse("resources/engine/gui", "popup_filedialog.xml");
89 screenNode->setVisible(false);
93 tabsHeaderNode = required_dynamic_cast<GUIElementNode*>(screenNode->getNodeById("filedialog_tabs-header"));
94 pathNode = required_dynamic_cast<GUIElementNode*>(screenNode->getNodeById("filedialog_path"));
95 filesNode = required_dynamic_cast<GUIElementNode*>(screenNode->getNodeById("filedialog_files"));
96 favoritesNode = required_dynamic_cast<GUIElementNode*>(screenNode->getNodeById("filedialog_favorites"));
97 recentsNode = required_dynamic_cast<GUIElementNode*>(screenNode->getNodeById("filedialog_recent"));
98 drivesNode = required_dynamic_cast<GUIElementNode*>(screenNode->getNodeById("filedialog_drives"));
99 fileNameNode = required_dynamic_cast<GUIElementNode*>(screenNode->getNodeById("filedialog_filename"));
100 typeDropDownNode = required_dynamic_cast<GUIElementNode*>(screenNode->getNodeById("filedialog_typedropdown"));
101 } catch (Exception& exception) {
102 Console::print(string("FileDialogScreenController::initialize(): An error occurred: "));
103 Console::println(string(exception.what()));
104 }
105}
106
108{
109 screenNode = nullptr;
110}
111
113{
114 class ExtensionFilter: public virtual FileNameFilter
115 {
116 public:
117 bool accept(const string& pathName, const string& fileName) override {
118 if (FileSystem::getStandardFileSystem()->isPath(pathName + "/" + fileName) == true) return true;
119 if (extension.empty() == false) {
120 if (StringTools::endsWith(StringTools::toLowerCase(fileName), "." + extension) == true) return true;
121 } else {
122 for (auto& extension : fileDialogScreenController->extensions) {
123 if (StringTools::endsWith(StringTools::toLowerCase(fileName), "." + extension) == true) return true;
124 }
125 }
126 return false;
127 }
128
129 /**
130 * Public constructor
131 * @param fileDialogScreenController file dialog screen controller
132 */
133 ExtensionFilter(FileDialogScreenController* fileDialogScreenController, const string& extension): fileDialogScreenController(fileDialogScreenController), extension(extension) {
134 }
135
136 private:
137 FileDialogScreenController* fileDialogScreenController;
138 string extension;
139 };
140
141 //
142 required_dynamic_cast<GUIParentNode*>(screenNode->getInnerNodeById(tabsHeaderNode->getId()))->replaceSubNodes("<tab id=\"filedialog_caption\" image=\"resources/engine/images/attention.png\" text=\"" + GUIParser::escapeQuotes(captionText)+ "\" closeable=\"true\"/>", true);
144
145 //
146 fileList.clear();
147 auto success = true;
148 try {
149 auto directory = cwd;
150 ExtensionFilter extensionsFilter(this, typeDropDownNode->getController()->getValue().getString());
151 FileSystem::getStandardFileSystem()->list(directory, fileList, &extensionsFilter);
152 } catch (Exception& exception) {
153 Console::print(string("FileDialogScreenController::setupFileDialogListBox(): An error occurred: "));
154 Console::println(string(exception.what()));
155 success = false;
156 }
158 if (enableFilter == true) fileNameNode->getController()->setValue(MutableString("Type a string to filter the list..."));
159
160 //
161 filtered = false;
162
163 //
164 return success;
165}
166
167void FileDialogScreenController::setupFiles(const vector<string>& fileNameList, const string& selectedFileName) {
168 auto filesInnerNode = required_dynamic_cast<GUIParentNode*>(filesNode->getScreenNode()->getInnerNodeById(filesNode->getId()));
169 auto idx = 1;
170 string filesInnerNodeSubNodesXML;
171 filesInnerNodeSubNodesXML+=
172 "<scrollarea width=\"100%\" height=\"100%\" background-color=\"{$color.element_midground}\">\n";
173 for (auto& fileName : fileNameList) {
174 auto fileImageName = getFileImageName(fileName);
175 try {
176 if (FileSystem::getStandardFileSystem()->isPath(cwd + "/" + fileName) == true) fileImageName = "folder";
177 } catch (Exception& exception) {
178 Console::print(string("FileDialogScreenController::setupFileDialogListBox(): An error occurred: "));
179 Console::println(string(exception.what()));
180 }
181 filesInnerNodeSubNodesXML+=
182 "<selectbox-option text=\"" +
183 GUIParser::escapeQuotes(fileName) +
184 "\" value=\"" +
185 GUIParser::escapeQuotes(fileName) +
186 "\"" +
187 (selectedFileName == fileName?" selected=\"true\"":"") + " " +
188 "image=\"{$icon.type_" + fileImageName + "}\" " +
189 "/>\n";
190 }
191 filesInnerNodeSubNodesXML+= "</scrollarea>\n";
192 try {
193 filesInnerNode->replaceSubNodes(filesInnerNodeSubNodesXML, false);
194 } catch (Exception& exception) {
195 Console::print(string("FileDialogScreenController::setupFileDialogListBox(): An error occurred: "));
196 Console::println(string(exception.what()));
197 }
198}
199
201 auto favoritesInnerNode = required_dynamic_cast<GUIParentNode*>(favoritesNode->getScreenNode()->getInnerNodeById(favoritesNode->getId()));
202 auto idx = 1;
203 string favoritesInnerNodeSubNodesXML;
204 favoritesInnerNodeSubNodesXML+=
205 "<scrollarea width=\"100%\" height=\"100%\" background-color=\"{$color.element_midground}\">\n";
206 for (auto& favorite: favorites) {
207 auto fileImageName = "folder";
208 favoritesInnerNodeSubNodesXML+=
209 "<selectbox-option text=\"" +
210 GUIParser::escapeQuotes(FileSystem::getStandardFileSystem()->getFileName(StringTools::endsWith(favorite, "/") == true?StringTools::substring(favorite, 0, favorite.size() - 1):favorite)) +
211 "\" value=\"" +
212 GUIParser::escapeQuotes(favorite) +
213 "\" " +
214 "image=\"{$icon.type_folder}\" " +
215 "/>\n";
216 }
217 favoritesInnerNodeSubNodesXML+= "</scrollarea>\n";
218 try {
219 favoritesInnerNode->replaceSubNodes(favoritesInnerNodeSubNodesXML, false);
220 } catch (Exception& exception) {
221 Console::print(string("FileDialogScreenController::setupFavorites(): An error occurred: "));
222 Console::println(string(exception.what()));
223 }
224}
225
227 auto recentsInnerNode = required_dynamic_cast<GUIParentNode*>(recentsNode->getScreenNode()->getInnerNodeById(recentsNode->getId()));
228 auto idx = 1;
229 string recentsInnerNodeSubNodesXML;
230 recentsInnerNodeSubNodesXML+=
231 "<scrollarea width=\"100%\" height=\"100%\" background-color=\"{$color.element_midground}\">\n";
232 for (auto& recent: recents) {
233 auto fileImageName = "folder";
234 recentsInnerNodeSubNodesXML+=
235 "<selectbox-option text=\"" +
236 GUIParser::escapeQuotes(FileSystem::getStandardFileSystem()->getFileName(StringTools::endsWith(recent, "/") == true?StringTools::substring(recent, 0, recent.size() - 1):recent)) +
237 "\" value=\"" +
238 GUIParser::escapeQuotes(recent) +
239 "\" " +
240 "image=\"{$icon.type_folder}\" " +
241 "/>\n";
242 }
243 recentsInnerNodeSubNodesXML+= "</scrollarea>\n";
244 try {
245 recentsInnerNode->replaceSubNodes(recentsInnerNodeSubNodesXML, false);
246 } catch (Exception& exception) {
247 Console::print(string("FileDialogScreenController::setupRecents(): An error occurred: "));
248 Console::println(string(exception.what()));
249 }
250}
251
253 vector<string> drives;
254 #if defined(_WIN32)
255 for (char drive = 'A'; drive <= 'Z'; drive++) {
256 string fileName;
257 fileName+= drive;
258 fileName+= ":";
259 try {
260 if (FileSystem::getStandardFileSystem()->fileExists(fileName + "/") == true) drives.push_back(fileName);
261 } catch (Exception& exception) {
262 Console::println(string() + "FileDialogScreenController::setupDrives(): " + exception.what());
263 }
264 }
265 #else
266 drives.push_back("/");
267 #endif
268 auto drivesInnerNode = required_dynamic_cast<GUIParentNode*>(drivesNode->getScreenNode()->getInnerNodeById(drivesNode->getId()));
269 auto idx = 1;
270 string drivesInnerNodeSubNodesXML;
271 drivesInnerNodeSubNodesXML+=
272 "<scrollarea width=\"100%\" height=\"100%\" background-color=\"{$color.element_midground}\">\n";
273 for (auto& drive: drives) {
274 drivesInnerNodeSubNodesXML+=
275 "<selectbox-option text=\"" +
276 GUIParser::escapeQuotes(drive) +
277 "\" value=\"" +
278 GUIParser::escapeQuotes(drive) +
279 "\" " +
280 "image=\"{$icon.type_drive}\" " +
281 "/>\n";
282 }
283 drivesInnerNodeSubNodesXML+= "</scrollarea>\n";
284 try {
285 drivesInnerNode->replaceSubNodes(drivesInnerNodeSubNodesXML, false);
286 } catch (Exception& exception) {
287 Console::print(string("FileDialogScreenController::setupDrives(): An error occurred: "));
288 Console::println(string(exception.what()));
289 }
290}
291
292void FileDialogScreenController::show(const string& cwd, const string& captionText, const vector<string>& extensions, const string& fileName, bool enableFilter, Action* applyAction, Action* cancelAction, const string& settingsFileName, const string& settingsPathName)
293{
294 this->settingsPathName = settingsPathName;
295 this->settingsFileName = settingsFileName;
296 loadSettings();
297 this->captionText = captionText;
298 this->extensions = extensions;
299 this->fileNameNode->getController()->setValue(fileName);
300 this->enableFilter = enableFilter;
301 auto _cwd = cwd;
302 if (cwd.empty() == true) {
303 auto defaultCwdByExtensionsIt = defaultCwdByExtensions.find(getExtensionHash());
304 if (defaultCwdByExtensionsIt != defaultCwdByExtensions.end()) {
305 _cwd = defaultCwdByExtensionsIt->second;
306 } else {
307 _cwd = defaultCwd;
308 }
309 }
310 try {
311 this->cwd = FileSystem::getStandardFileSystem()->getCanonicalPath(_cwd, "");
312 if (this->cwd.empty() == true || FileSystem::getStandardFileSystem()->isPath(this->cwd) == false) {
313 this->cwd = FileSystem::getStandardFileSystem()->getCurrentWorkingPathName();
314 }
315 } catch (Exception& exception) {
316 Console::print(string("FileDialogScreenController::show(): An error occurred: "));
317 Console::print(string(exception.what()));
318 Console::println(": using cwd!");
319 this->cwd = FileSystem::getStandardFileSystem()->getCurrentWorkingPathName();
320 }
321 setupFiles();
322 screenNode->setVisible(true);
323 if (this->applyAction != nullptr) delete this->applyAction;
324 this->applyAction = applyAction;
325 if (this->cancelAction != nullptr) delete this->cancelAction;
326 this->cancelAction = cancelAction;
327 {
328 string extensionsDropDownOptionsXML = "<dropdown-option text=\"All supported extensions\" value=\"\" selected=\"true\"/>\n";
329 for (auto& extension: extensions) {
330 extensionsDropDownOptionsXML+= "<dropdown-option text=\"" + StringTools::toUpperCase(extension) + " Files\" value=\"" + StringTools::toLowerCase(extension) + "\" selected=\"false\" />\n";
331 }
332 required_dynamic_cast<GUIParentNode*>(screenNode->getInnerNodeById(typeDropDownNode->getId()))->replaceSubNodes(extensionsDropDownOptionsXML, true);
333 }
334 setupDrives();
336 setupRecents();
337}
338
340{
341 screenNode->setVisible(false);
342 if (applyAction != nullptr) delete applyAction;
343 if (cancelAction != nullptr) delete cancelAction;
344 applyAction = nullptr;
345 cancelAction = nullptr;
346}
347
349{
350 if (node->getId() == typeDropDownNode->getId()) {
351 setupFiles();
352 } else
353 if (node->getId() == filesNode->getId()) {
354 try {
355 auto selectedFile = node->getController()->getValue().getString();
356 if (FileSystem::getStandardFileSystem()->isDrive(selectedFile) == true) {
357 auto lastCwd = cwd;
358 cwd = selectedFile;
359 if (setupFiles() == false) {
360 cwd = lastCwd;
361 setupFiles();
362 }
363 } else
364 if (FileSystem::getStandardFileSystem()->isPath(cwd + "/" + selectedFile) == true) {
365 auto lastCwd = cwd;
366 try {
367 cwd = FileSystem::getStandardFileSystem()->getCanonicalPath(cwd, selectedFile);
368 } catch (Exception& exception) {
369 Console::print(string("FileDialogScreenController::onValueChanged(): An error occurred: "));
370 Console::println(string(exception.what()));
371 }
372 if (setupFiles() == false) {
373 cwd = lastCwd;
374 setupFiles();
375 }
376 } else {
377 if (filtered == true) {
378 setupFiles(fileList, selectedFile);
379 filtered = false;
380 }
381 fileNameNode->getController()->setValue(selectedFile);
382 }
383 } catch (Exception& exception) {
384 Console::print(string("FileDialogScreenController::onValueChanged(): An error occurred: "));
385 Console::println(string(exception.what()));
387 }
388 } else
389 if (node->getId() == fileNameNode->getId()) {
390 try {
391 if (enableFilter == true) {
392 auto filterString = StringTools::toLowerCase(node->getController()->getValue().getString());
393 if (FileSystem::getStandardFileSystem()->fileExists(cwd + "/" + filterString) == true) {
394 auto selectedFile = node->getController()->getValue().getString();
395 setupFiles(fileList, selectedFile);
396 } else {
397 vector<string> fileListFiltered;
398 for (auto file: fileList) {
399 if (StringTools::toLowerCase(file).find(filterString) != -1) fileListFiltered.push_back(file);
400 }
401 setupFiles(fileListFiltered);
402 filtered = true;
403 }
404 }
405 } catch (Exception& exception) {
406 Console::print(string("FileDialogScreenController::onValueChanged(): An error occurred: "));
407 Console::println(string(exception.what()));
409 }
410 }
411}
412
414{
416 if (node->getId() == pathNode->getId()) {
417 if (StringTools::endsWith(cwd, "/") == true) cwd = StringTools::substring(cwd, 0, cwd.size() - 1);
418 auto lastCwd = cwd;
420 if (setupFiles() == true) {
421 recents.erase(remove(recents.begin(), recents.end(), cwd), recents.end());
422 recents.push_back(cwd);
423 setupRecents();
424 saveSettings();
425 } else {
426 cwd = lastCwd;
427 setupFiles();
428 }
429 } else
430 if (node->getId() == "filedialog_apply") {
431 if (StringTools::endsWith(cwd, "/") == true) cwd = StringTools::substring(cwd, 0, cwd.size() - 1);
433 recents.erase(remove(recents.begin(), recents.end(), cwd), recents.end());
434 recents.push_back(cwd);
435 setupRecents();
436 saveSettings();
437 if (applyAction != nullptr) {
439 delete applyAction;
440 applyAction = nullptr;
441 }
442 } else
443 if (node->getId() == "filedialog_abort" ||
444 StringTools::startsWith(node->getId(), "filedialog_caption_close_") == true) { // TODO: a.drewke, check with DH
445 if (defaultCwd.empty() == false) {
447 saveSettings();
448 }
449 if (cancelAction != nullptr) {
451 delete cancelAction;
452 cancelAction = nullptr;
453 }
454 close();
455 } else
456 if (node->getId() == "filedialog_favorites_add") {
457 if (StringTools::endsWith(cwd, "/") == true) cwd = StringTools::substring(cwd, 0, cwd.size() - 1);
458 favorites.erase(remove(favorites.begin(), favorites.end(), cwd), favorites.end());
459 favorites.push_back(cwd);
461 } else
462 if (node->getId() == "filedialog_favorites_remove") {
463 auto favorite = favoritesNode->getController()->getValue().getString();
464 favorites.erase(remove(favorites.begin(), favorites.end(), favorite), favorites.end());
466 } else
467 if (node->getId() == "filedialog_recent_delete") {
468 recents.clear();
469 setupRecents();
470 saveSettings();
471 } else
472 if (node == favoritesNode) {
473 auto _cwd = favoritesNode->getController()->getValue().getString();
474 if (_cwd.empty() == false) {
475 cwd = _cwd;
476 setupFiles();
477 }
478 } else
479 if (node == drivesNode) {
480 auto _cwd = drivesNode->getController()->getValue().getString();
481 if (_cwd.empty() == false) {
482 cwd = _cwd;
483 setupFiles();
484 }
485 } else
486 if (node == recentsNode) {
487 auto _cwd = recentsNode->getController()->getValue().getString();
488 if (_cwd.empty() == false) {
489 cwd = _cwd;
490 setupFiles();
491 }
492 }
493 }
494}
495
497 if (node->getId() == "filedialog_filename") {
498 if (enableFilter == true) node->getController()->setValue(MutableString(""));
499 }
500}
501
503}
504
506 // TODO: load relative paths
508 favorites.clear();
509 recents.clear();
511 try {
512 Properties settings;
513 settings.load(settingsPathName.empty() == false?settingsPathName:defaultCwd, settingsFileName, FileSystem::getStandardFileSystem());
514 {
515 auto i = 0;
516 string favorite;
517 while ((favorite = settings.get("favorite_" + to_string(i++), "")).empty() == false) {
518 favorites.push_back(favorite);
519 }
520 }
521 {
522 auto i = 0;
523 string recent;
524 while ((recent = settings.get("recent_" + to_string(i++), "")).empty() == false) {
525 recents.push_back(recent);
526 }
527 }
528 {
529 auto i = 0;
530 string defaultCwdString;
531 while ((defaultCwdString = settings.get("default_cwd_" + to_string(i++), "")).empty() == false) {
532 auto defaultCwdComponents = StringTools::tokenize(defaultCwdString, ":");
533 if (defaultCwdComponents.size() == 2) {
534 defaultCwdByExtensions[defaultCwdComponents[0]] = defaultCwdComponents[1];
535 }
536 }
537 }
538 } catch (Exception& exception) {
539 Console::println(string() + "FileDialogScreenController::setDefaultCWD(): An error occurred: " + exception.what());
540 }
541
542}
543
545 // TODO: store relative paths
546 try {
547 Properties settings;
548 {
549 auto i = 0;
550 for (auto& favorite: favorites) {
551 settings.put("favorite_" + to_string(i++), favorite);
552 }
553 }
554 {
555 auto i = 0;
556 for (auto& recent: recents) {
557 settings.put("recent_" + to_string(i++), recent);
558 }
559 }
560 {
561 auto i = 0;
562 for (auto& defaultCwdByExtensionsIt: defaultCwdByExtensions) {
563 settings.put("default_cwd_" + to_string(i++), defaultCwdByExtensionsIt.first + ":" + defaultCwdByExtensionsIt.second);
564 }
565 }
566 settings.store(settingsPathName.empty() == false?settingsPathName:defaultCwd, settingsFileName, FileSystem::getStandardFileSystem());
567 } catch (Exception& exception) {
568 Console::println(string() + "FileDialogScreenController::setDefaultCWD(): An error occurred: " + exception.what());
569 }
570}
571
572const string FileDialogScreenController::getFileImageName(const string& fileName) {
573 auto fileNameLowerCase = StringTools::toLowerCase(fileName);
574 if (StringTools::endsWith(fileNameLowerCase, ".ogg") == true) {
575 return "sound";
576 } else
577 // C++/C code
578 if (StringTools::endsWith(fileNameLowerCase, ".h") == true) {
579 return "script";
580 } else
581 if (StringTools::endsWith(fileNameLowerCase, ".cpp") == true) {
582 return "script";
583 } else
584 if (StringTools::endsWith(fileNameLowerCase, ".c") == true) {
585 return "script";
586 } else
587 if (StringTools::endsWith(fileNameLowerCase, ".fnt") == true) {
588 return "font";
589 } else
590 // images
591 if (StringTools::endsWith(fileNameLowerCase, ".ico") == true) {
592 return "texture";
593 } else
594 if (StringTools::endsWith(fileNameLowerCase, ".icns") == true) {
595 return "texture";
596 } else
597 if (StringTools::endsWith(fileNameLowerCase, ".png") == true) {
598 return "texture";
599 } else
600 // models
601 if (StringTools::endsWith(fileNameLowerCase, ".dae") == true) {
602 return "mesh";
603 } else
604 if (StringTools::endsWith(fileNameLowerCase, ".fbx") == true) {
605 return "mesh";
606 } else
607 if (StringTools::endsWith(fileNameLowerCase, ".glb") == true) {
608 return "mesh";
609 } else
610 if (StringTools::endsWith(fileNameLowerCase, ".tm") == true) {
611 return "mesh";
612 } else
613 // property files
614 if (StringTools::endsWith(fileNameLowerCase, ".properties") == true) {
615 return "script";
616 } else
617 // shader
618 if (StringTools::endsWith(fileNameLowerCase, ".cl") == true) {
619 return "script";
620 } else
621 if (StringTools::endsWith(fileNameLowerCase, ".frag") == true) {
622 return "script";
623 } else
624 if (StringTools::endsWith(fileNameLowerCase, ".glsl") == true) {
625 return "script";
626 } else
627 if (StringTools::endsWith(fileNameLowerCase, ".vert") == true) {
628 return "script";
629 } else
630 // tdme empty
631 if (StringTools::endsWith(fileNameLowerCase, ".tempty") == true) {
632 return "prototype";
633 } else
634 // tdme trigger
635 if (StringTools::endsWith(fileNameLowerCase, ".ttrigger") == true) {
636 return "prototype";
637 } else
638 // tdme envmap
639 if (StringTools::endsWith(fileNameLowerCase, ".tenvmap") == true) {
640 return "prototype";
641 } else
642 // tdme model
643 if (StringTools::endsWith(fileNameLowerCase, ".tmodel") == true) {
644 return "prototype";
645 } else
646 // tdme scene
647 if (StringTools::endsWith(fileNameLowerCase, ".tscene") == true) {
648 return "scene";
649 } else
650 // tdme particle system
651 if (StringTools::endsWith(fileNameLowerCase, ".tparticle") == true) {
652 return "particle";
653 } else
654 // tdme terrain
655 if (StringTools::endsWith(fileNameLowerCase, ".tterrain") == true) {
656 return "terrain";
657 } else
658 // tdme script
659 if (StringTools::endsWith(fileNameLowerCase, ".tscript") == true) {
660 return "script";
661 } else
662 // xml
663 if (StringTools::endsWith(fileNameLowerCase, ".xml") == true) {
664 return "gui";
665 } else
666 // files without ending
667 if (fileName.rfind(".") == string::npos ||
668 (fileName.rfind("/") != string::npos &&
669 fileName.rfind(".") < fileName.rfind("/"))) {
670 return "script";
671 }
672 return string();
673}
GUI parser.
Definition: GUIParser.h:39
GUI node controller base class.
virtual void setValue(const MutableString &value)=0
Set value.
virtual const MutableString & getValue()=0
GUI node base class.
Definition: GUINode.h:63
const string & getId()
Definition: GUINode.h:329
GUIScreenNode * getScreenNode()
Definition: GUINode.h:315
GUINodeController * getController()
Definition: GUINode.h:586
GUI parent node base class thats supporting child nodes.
Definition: GUIParentNode.h:43
GUI screen node that represents a screen that can be rendered via GUI system.
Definition: GUIScreenNode.h:57
void setVisible(bool visible)
Set visible.
void addChangeListener(GUIChangeListener *listener)
Add change listener.
GUINode * getNodeById(const string &nodeId)
Get GUI node by id.
void addActionListener(GUIActionListener *listener)
Add action listener.
GUINode * getInnerNodeById(const string &nodeId)
Get inner GUI node by id.
void addFocusListener(GUIFocusListener *listener)
Add focus listener.
File system singleton class.
Definition: FileSystem.h:14
void onValueChanged(GUIElementNode *node) override
On value changed.
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 setDefaultCWD(const string &defaultCwd)
Set default current working directory.
void onActionPerformed(GUIActionListenerType type, GUIElementNode *node) override
static const string getFileImageName(const string &fileName)
Get file image name.
Console class.
Definition: Console.h:26
Mutable string class.
Definition: MutableString.h:16
const string & getString() const
Properties class, which helps out with storeing or loading key value pairs from/to property files.
Definition: Properties.h:23
void put(const string &key, const string &value)
Add property.
Definition: Properties.h:58
const string & get(const string &key, const string &defaultValue) const
Get property value by key.
Definition: Properties.h:46
void load(const string &pathName, const string &fileName, FileSystemInterface *fileSystem=nullptr)
Load property file.
Definition: Properties.cpp:26
void store(const string &pathName, const string &fileName, FileSystemInterface *fileSystem=nullptr) const
Store property file.
Definition: Properties.cpp:43
String tools class.
Definition: StringTools.h:20
std::exception Exception
Exception base class.
Definition: Exception.h:19
File system file name filter interface.
Action Interface.
Definition: Action.h:12
virtual void performAction()=0
Perform action.