Thrive
CEGUIWindow.h
1 #pragma once
2 
3 #include <CEGUI/CEGUI.h>
4 #include <luabind/object.hpp>
5 #include <OgreVector2.h>
6 #include <OISKeyboard.h>
7 
8 
9 namespace luabind {
10 class scope;
11 }
12 
13 namespace thrive {
14 
15 class StandardItemWrapper;
16 
17 class CEGUIWindow {
18 
19 public:
20 
28  std::string layoutName
29  );
30 
41  std::string type,
42  std::string name
43  );
44 
48  virtual
49  ~CEGUIWindow();
50 
51  static CEGUIWindow
52  getRootWindow();
53 
112  static luabind::scope
113  luaBindings();
114 
115  static void
116  setGuiMoveMode(
117  bool value
118  );
119 
120  static CEGUIWindow
121  getWindowUnderMouse();
122 
123 
129  bool
130  isNull() const;
131 
143  std::string layoutName
144  );
145 
152  void
153  addChild(
154  CEGUIWindow* window
155  );
156 
163  void
164  removeChild(
165  CEGUIWindow* window
166  );
167 
171  void
172  destroy() const;
173 
180  std::string
181  getText() const;
182 
189  void
190  setText(
191  const std::string& text
192  );
193 
200  void
201  appendText(
202  const std::string& text
203  );
204 
211  void
212  setImage(
213  const std::string& image
214  );
215 
224  void
225  setProperty(
226  const std::string& parameter,
227  const std::string& property
228  );
229 
230  // Listbox has been removed from cegui.
231  // For basic use use ListWidget instead
232  // For more advanced view items use ListView
233  // In .layout files ListWidget is called Thrive/ListView
234 
238  void
240  StandardItemWrapper* item
241  );
242 
246  void
248  const std::string &text,
249  int id
250  );
251 
255  void
257  const std::string &text
258  );
259 
263  void
265  StandardItemWrapper* item,
266  const std::string &text
267  );
268 
272  void
274 
275  std::string
276  listWidgetGetFirstSelectedItemText();
277 
278  int
279  listWidgetGetFirstSelectedID();
280 
281 
282 
283 
290  void
292  float progress
293  );
294 
300  float
302 
309  void
311  float position
312  );
313 
319  void
321  CEGUIWindow* icon
322  );
323 
330  getParent() const;
331 
341  getChild(
342  const std::string& name
343  ) const;
344 
354  void
356  const std::string& eventName,
357  CEGUI::Event::Subscriber callback
358  ) const;
359 
361  void
363  const std::string& eventName,
364  const luabind::object& callback
365  ) const ;
366 
373  void
375  CEGUI::Event::Subscriber callback
376  ) const;
377 
379  void
381  const luabind::object& callback
382  ) const ;
383 
387  void
388  enable();
389 
393  void
394  disable();
395 
399  void
400  setFocus();
401 
405  void
406  show();
407 
411  void
412  hide();
413 
417  void
418  moveToFront();
419 
423  void
424  moveToBack();
425 
432  void
433  moveInFront(
434  const CEGUIWindow& target
435  );
436 
443  void
444  moveBehind(
445  const CEGUIWindow& target
446  );
447 
458  void
460  float x,
461  float y
462  );
463  void
464  setPositionRel(
465  float x,
466  float y
467  );
468 
478  void
479  setSizeAbs(
480  float width,
481  float height
482  );
483  void
484  setSizeRel(
485  float width,
486  float height
487  );
488 
493  std::string
494  getName();
495 
502  void
504  std::string name
505  );
506 
507 
508 private:
509 
510  friend class GameState;
511 
512  //Private constructor. New window is true if this is the first time a CEGUIWindow is created with the window pointer (for event subscribing)
513  CEGUIWindow(CEGUI::Window* window, bool newWindow = true);
514 
515 protected:
516 
517  CEGUI::Window* m_window = nullptr;
518 
519 };
520 
521 }
void destroy() const
Destroys the underlying CEGUI Window.
Definition: CEGUIWindow.cpp:258
void addChild(CEGUIWindow *window)
Adds a child to the window.
Definition: CEGUIWindow.cpp:247
void setSizeAbs(float width, float height)
Sets the windows size.
Definition: CEGUIWindow.cpp:567
void scrollingpaneSetVerticalPosition(float position)
Sets the vertical scroll position.
Definition: CEGUIWindow.cpp:417
void listWidgetAddTextItem(const std::string &text)
Adds a string to the window if it is a ListWidget otherwise throws bad_cast exception.
Definition: CEGUIWindow.cpp:330
void scrollingpaneAddIcon(CEGUIWindow *icon)
Adds an icon vertically to the scrollable pane.
Definition: CEGUIWindow.cpp:423
void moveBehind(const CEGUIWindow &target)
Moves the window behind target window.
Definition: CEGUIWindow.cpp:543
void appendText(const std::string &text)
Appends to the underlying cegui windows text.
Definition: CEGUIWindow.cpp:277
CEGUIWindow createChildWindow(std::string layoutName)
Creates a new windows and adds it to the underlying CEGUI window.
Definition: CEGUIWindow.cpp:236
void playAnimation(std::string name)
Plays an animation by name.
Definition: CEGUIWindow.cpp:587
void show()
Makes the window visible.
Definition: CEGUIWindow.cpp:511
CEGUIWindow getParent() const
Gets the underlying cegui windows parent, wrapped as a CEGUIWindow*.
Definition: CEGUIWindow.cpp:431
void listWidgetResetList()
Clears the list if the window is a ListWidget otherwise throws bad_cast exception.
Definition: CEGUIWindow.cpp:361
void listWidgetUpdateItem(StandardItemWrapper *item, const std::string &text)
Updates an item with the new text.
Definition: CEGUIWindow.cpp:343
void disable()
Disables interaction with the window.
Definition: CEGUIWindow.cpp:499
void setFocus()
Sets focus to the underlying cegui window.
Definition: CEGUIWindow.cpp:505
void moveToBack()
Moves the window behind all other windows.
Definition: CEGUIWindow.cpp:529
void removeChild(CEGUIWindow *window)
Removes a child from the window.
Definition: CEGUIWindow.cpp:252
Definition: CEGUIWindow.h:17
CEGUIWindow getChild(const std::string &name) const
Gets one of the underlying cegui windows children by name, wrapped as a CEGUIWindow*.
Definition: CEGUIWindow.cpp:437
void listWidgetAddStandardItem(StandardItemWrapper *item)
Adds a StandardItem to the window if it is a ListWidget otherwise throws bad_cast exception...
Definition: CEGUIWindow.cpp:299
void setProperty(const std::string &parameter, const std::string &property)
Sets the underlying windows property.
Definition: CEGUIWindow.cpp:291
void listWidgetAddItem(const std::string &text, int id)
Creates and adds a StandardItem to the window if it is a ListWidget otherwise throws bad_cast excepti...
Definition: CEGUIWindow.cpp:316
bool isNull() const
Returns whether the underlying CEGUI::Window is a nullptr.
Definition: CEGUIWindow.cpp:231
void setImage(const std::string &image)
Sets the underlying windows image property.
Definition: CEGUIWindow.cpp:284
void hide()
Hides the window.
Definition: CEGUIWindow.cpp:517
void moveToFront()
Moves the window in front of all other windows.
Definition: CEGUIWindow.cpp:523
Definition: bullet_to_ogre_system.h:5
Definition: bullet_ogre_conversion.h:6
float scrollingpaneGetVerticalPosition()
Gets the vertical scroll position.
Definition: CEGUIWindow.cpp:411
void registerKeyEventHandler(CEGUI::Event::Subscriber callback) const
Registers an callback for a given keypress CEGUI event.
Definition: CEGUIWindow.cpp:470
Represents a distinct set of active systems and entities.
Definition: game_state.h:41
std::string getText() const
Get the underlying cegui windows text if it has any.
Definition: CEGUIWindow.cpp:263
void moveInFront(const CEGUIWindow &target)
Moves the window in front of target window.
Definition: CEGUIWindow.cpp:535
void progressbarSetProgress(float progress)
Sets the progress of the progressbar.
Definition: CEGUIWindow.cpp:406
std::string getName()
Returns the windows internal name.
Definition: CEGUIWindow.cpp:582
void setText(const std::string &text)
Sets the underlying cegui windows text.
Definition: CEGUIWindow.cpp:269
Definition: script_wrappers.h:18
void enable()
Enables the window, allowing interaction.
Definition: CEGUIWindow.cpp:493
void setPositionAbs(float x, float y)
Sets the windows position.
Definition: CEGUIWindow.cpp:551
static luabind::scope luaBindings()
Lua bindings.
Definition: CEGUIWindow.cpp:170
void registerEventHandler(const std::string &eventName, CEGUI::Event::Subscriber callback) const
Registers an callback for a given generic CEGUI event.
Definition: CEGUIWindow.cpp:445
virtual ~CEGUIWindow()
Destructor.
Definition: CEGUIWindow.cpp:165
CEGUIWindow(std::string layoutName)
Constructor.
Definition: CEGUIWindow.cpp:148