TDME2  1.9.200
InputDialogScreenController.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 #include <string>
5 
6 #include <tdme/tdme.h>
16 
17 using std::string;
18 using std::unique_ptr;
19 
31 
32 /**
33  * Input dialog screen controller
34  * @author Andreas Drewke
35  */
37  : public ScreenController
38  , public virtual GUIActionListener
39  , public virtual GUIChangeListener
40  , public virtual GUIFocusListener
41  , public virtual GUITooltipRequestListener
42 {
43 
44 private:
45  PopUps* popUps { nullptr };
46  GUIScreenNode* screenNode { nullptr };
48  GUIElementNode* inputNode { nullptr };
49  unique_ptr<Action> applyAction;
50  unique_ptr<Action> cancelAction;
51 
52 public:
53  // forbid class copy
55 
56  /**
57  * Public constructor
58  * @param popUps pop ups
59  */
61 
62  /**
63  * Destructor
64  */
66 
67  // overridden methods
68  GUIScreenNode* getScreenNode() override;
69 
70  /**
71  * @return input text
72  */
73  const string getInputText();
74 
75  /**
76  * Shows the input dialog pop up
77  * @param captionText caption text
78  * @param inputText input text
79  * @param applyAction apply action
80  * @param cancelAction cancel action
81  */
82  void show(const string& captionText, const string& inputText, Action* applyAction, Action* cancelAction = nullptr);
83 
84  /**
85  * Abort the file dialog pop up
86  */
87  void close();
88 
89  // overridden methods
90  void initialize() override;
91  void dispose() override;
92  void onChange(GUIElementNode* node) override;
93  void onAction(GUIActionListenerType type, GUIElementNode* node) override;
94  void onFocus(GUIElementNode* node) override;
95  void onUnfocus(GUIElementNode* node) override;
96  void onTooltipShowRequest(GUINode* node, int mouseX, int mouseY) override;
97  void onTooltipCloseRequest() override;
98 
99 };
GUI node base class.
Definition: GUINode.h:64
GUI screen node that represents a screen that can be rendered via GUI system.
Definition: GUIScreenNode.h:72
void show(const string &captionText, const string &inputText, Action *applyAction, Action *cancelAction=nullptr)
Shows the input dialog pop up.
void onAction(GUIActionListenerType type, GUIElementNode *node) override
void onTooltipShowRequest(GUINode *node, int mouseX, int mouseY) override
On tooltip show request.
Pop ups controller accessor class.
Definition: PopUps.h:29
GUI action listener interface.
GUI change listener interface.
GUI focus listener interface.
Screen controller, which connects GUI screen definition with code.
Action Interface.
Definition: Action.h:11
#define FORBID_CLASS_COPY(CLASS)
Definition: tdme.h:6