TDME2  1.9.200
TextEditorTabController.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 #include <string>
5 #include <vector>
6 
7 #include <tdme/tdme.h>
20 
21 #include <ext/tinyxml/tinyxml.h>
22 
23 using std::string;
24 using std::unique_ptr;
25 using std::vector;
26 
42 
46 
47 /**
48  * Text editor tab controller
49  * @author Andreas Drewke
50  */
52  : public TabController
53 {
54 public:
56  EngineMiniScript::Script::ScriptType type;
57  string condition;
58  string name;
59  EngineMiniScript::ScriptSyntaxTreeNode conditionSyntaxTree;
60  vector<EngineMiniScript::ScriptSyntaxTreeNode> syntaxTree;
61  };
62 
64 private:
65  TextEditorTabView* view { nullptr };
66  GUIScreenNode* screenNode { nullptr };
67  PopUps* popUps { nullptr };
68  vector<MiniScriptScriptSyntaxTree> miniScriptSyntaxTrees;
69  bool firstSearch { true };
70  int searchIndex { -1 };
72  int contextMenuX { -1 };
73  int contextMenuY { -1 };
75 
76  int addNodeX { -1 };
77  int addNodeY { -1 };
78 
79  unique_ptr<EngineMiniScript> scriptInstance;
80 
81 public:
82  // forbid class copy
84 
85  /**
86  * Public constructor
87  * @param view view
88  */
90 
91  /**
92  * Destructor
93  */
94  virtual ~TextEditorTabController();
95 
96  /**
97  * Get view
98  * @return view
99  */
101  return view;
102  }
103 
104  // overridden method
105  inline GUIScreenNode* getScreenNode() override {
106  return screenNode;
107  }
108 
109  /**
110  * @return EngineMiniScript
111  */
113  return scriptInstance.get();
114  }
115 
116  /**
117  * Reset context menu
118  */
119  inline void resetContextMenu() {
121  contextMenuX = -1;
122  contextMenuY = -1;
123  contextMenuNodeId.clear();
124  }
125 
126  /**
127  * @return context menu type
128  */
130  return contextMenuType;
131  }
132 
133  /**
134  * @return context menu x
135  */
136  inline int getContextMenuX() {
137  return contextMenuX;
138  }
139 
140  /**
141  * @return context menu y
142  */
143  inline int getContextMenuY() {
144  return contextMenuY;
145  }
146 
147  /**
148  * @return context menu node id
149  */
150  inline const string& getContextMenuNodeId() {
151  return contextMenuNodeId;
152  }
153 
154  /**
155  * @return add node x
156  */
157  inline int getAddNodeX() {
158  return addNodeX;
159  }
160 
161  /**
162  * @return add node y
163  */
164  inline int getAddNodeY() {
165  return addNodeY;
166  }
167 
168  // overridden methods
169  void initialize(GUIScreenNode* screenNode) override;
170  void dispose() override;
171  void onChange(GUIElementNode* node) override;
172  void onAction(GUIActionListenerType type, GUIElementNode* node) override;
173  void onFocus(GUIElementNode* node) override;
174  void onUnfocus(GUIElementNode* node) override;
175  void onContextMenuRequest(GUIElementNode* node, int mouseX, int mouseY) override;
176  void onTooltipShowRequest(GUINode* node, int mouseX, int mouseY) override;
177  void onTooltipCloseRequest() override;
178  void onCommand(TabControllerCommand command) override;
179  void onDrop(const string& payload, int mouseX, int mouseY) override;
180 
181  /**
182  * Set outliner content
183  */
184  void setOutlinerContent();
185 
186  /**
187  * Set outliner add drop down content
188  */
190 
191  /**
192  * @return miniscript syntax trees
193  */
194  inline const vector<MiniScriptScriptSyntaxTree>& getMiniScriptSyntaxTrees() {
195  return miniScriptSyntaxTrees;
196  }
197 
198  /**
199  * Update EngineMiniScript syntax tree
200  * @param miniScriptScriptIdx EngineMiniScript script index
201  */
202  void updateMiniScriptSyntaxTree(int miniScriptScriptIdx);
203 
204  /**
205  * Close find/replace window
206  */
207  void closeFindReplaceWindow();
208 
209  /**
210  * Show the information pop up / modal
211  * @param caption caption
212  * @param message message
213  */
214  void showInfoPopUp(const string& caption, const string& message);
215 
216 };
GUI node base class.
Definition: GUINode.h:64
GUI parent node base class thats supporting child nodes.
Definition: GUIParentNode.h:42
GUI screen node that represents a screen that can be rendered via GUI system.
Definition: GUIScreenNode.h:72
Pop ups controller accessor class.
Definition: PopUps.h:29
void onContextMenuRequest(GUIElementNode *node, int mouseX, int mouseY) override
On context menu request.
void onDrop(const string &payload, int mouseX, int mouseY) override
On drop.
void setOutlinerAddDropDownContent()
Set outliner add drop down content.
const vector< MiniScriptScriptSyntaxTree > & getMiniScriptSyntaxTrees()
void onCommand(TabControllerCommand command) override
On command.
void onUnfocus(GUIElementNode *node) override
On unfocus.
void updateMiniScriptSyntaxTree(int miniScriptScriptIdx)
Update EngineMiniScript syntax tree.
void showInfoPopUp(const string &caption, const string &message)
Show the information pop up / modal.
void onAction(GUIActionListenerType type, GUIElementNode *node) override
TextEditorTabController(TextEditorTabView *view)
Public constructor.
void onTooltipShowRequest(GUINode *node, int mouseX, int mouseY) override
On tooltip show request.
An attribute is a name-value pair.
Definition: tinyxml.h:734
Always the top level node.
Definition: tinyxml.h:1317
The element is a container class.
Definition: tinyxml.h:886
GUI action listener interface.
GUI change listener interface.
GUI focus listener interface.
Tab controller, which connects UI with logic.
Definition: TabController.h:34
#define FORBID_CLASS_COPY(CLASS)
Definition: tdme.h:6