i6engine  1.0
GUIFacade.h
Go to the documentation of this file.
1 /*
2  * i6engine
3  * Copyright (2016) Daniel Bonrath, Michael Baer, All rights reserved.
4  *
5  * This file is part of i6engine; i6engine is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
25 #ifndef __I6ENGINE_API_GUIFACADE_H__
26 #define __I6ENGINE_API_GUIFACADE_H__
27 
28 #include <map>
29 
30 #include "i6engine/api/KeyCodes.h"
31 
32 #include "boost/function.hpp"
33 
34 namespace i6e {
35 namespace api {
36 namespace gui {
37  enum class Alignment;
38 } /* namespace gui */
39 
40  class GUIWidget;
41 
50  public:
51  GUIFacade();
52 
54  }
55 
64  void startGUI(const std::string & strScheme, const std::string & strFont, const std::string & strDefaultFont, const std::string & strDefaultMouseImageSet, const std::string & strDefaultMouseImageName) const;
65 
72  void addToRootWindow(const std::string & child_window) const;
73 
78  void setMouseVisibility(const bool visibility) const;
79 
83  void clearAllWindows() const;
84 
91  void subscribeEvent(const std::string & windowname, const std::string & eventType, const boost::function<void(void)> & ptrEventMethod) const;
92 
97  void changeEvent(const std::string & windowname, bool b) const;
98 
102  void setMouseCursorImage(const std::string & image) const;
103 
107  void addImageset(const std::string & imageset) const;
108 
112  void loadCanvas(const std::string & name, const std::string & file) const;
113 
123  void addPrint(const std::string & name, const std::string & type, const double x, const double y, const std::string & message, gui::Alignment alignment, const int64_t lifetime = -1) const;
124 
134  void addProgressBar(const std::string & name, const std::string & type, const double x, const double y, const double w, const double h) const;
135 
147  void addEditbox(const std::string & name, const std::string & type, double x, double y, double w, double h, const std::string & defaultText, const std::function<void(std::string)> & enterCallback) const;
148 
159  void addTextButton(const std::string & name, const std::string & type, double x, double y, double w, double h, const std::string & text) const;
160 
173  void addImageButton(const std::string & name, const std::string & type, double x, double y, double w, double h, const std::string & normalImage, const std::string & hoverImage, const std::string & pushedImage) const;
174 
186  void addToggleButton(const std::string & name, const std::string & type, double x, double y, double w, double h, bool selected, const std::function<void(bool)> & selectedCallback) const;
187 
196  void addStatusList(const std::string & name, const std::string & type, const double x, const double y, const int64_t lifetime) const;
197 
208  void addImage(const std::string & name, const std::string & type, const std::string & imageSetName, const std::string & imageName, const double x, const double y, const double w, const double h) const;
209 
218  void addMultiColumnList(const std::string & name, const std::string & type, const double x, const double y, const double w, const double h) const;
219 
229  void addComboBox(const std::string & name, const std::string & type, const double x, const double y, const double w, const double h, const std::function<void(std::string)> & selectedCallback) const;
230 
240  void addChat(const std::string & name, const std::string & type, const double x, const double y, const double w, const double h, const std::function<std::string(std::string)> & acceptedCallback) const;
241 
247  void setText(const std::string & name, const std::string & text) const;
248 
255  void setPosition(const std::string & name, const double x, const double y) const;
256 
263  void setSize(const std::string & name, const double w, const double h) const;
264 
270  void setVisibility(const std::string & windowname, const bool visibility) const;
271 
277  void setAmount(const std::string & name, const uint32_t amount) const;
278 
287  void setColour(const std::string & name, double alpha, double red, double green, double blue) const;
288 
294  void setFont(const std::string & name, const std::string & font) const;
295 
301  void setLifetime(const std::string & name, const int64_t time) const;
302 
308  void setAlignment(const std::string & name, gui::Alignment alignment) const;
309 
315  void enableDropTarget(const std::string & name, bool target, const std::function<bool(std::string)> & func) const;
316 
322  void setDragable(const std::string & name, bool enabled) const;
323 
329  void setDropCallback(const std::string & name, const std::function<void(const std::string &, const std::string &)> & callback) const;
330 
336  void setProgress(const std::string & name, const double progress) const;
337 
342  void addRowToList(const std::string & name) const;
343 
347  void addRowEntry(const std::string & name, const uint32_t row, const uint32_t column, const std::string & entry) const;
348 
356  void addColumn(const std::string & name, const std::string & columnHeader, uint32_t column, double width) const;
357 
363  void clearWidget(const std::string & name) const;
364 
371  void setImage(const std::string & name, const std::string & imageSetName, const std::string & imageSet) const;
372 
378  void setEnterTextCallback(const std::string & name, const std::function<void(std::string)> & enterCallback) const;
379 
386  void setProperty(const std::string & name, const std::string & prop, const std::string & value) const;
387 
393  void setSelected(const std::string & name, bool selected) const;
394 
400  void setSelectedCallback(const std::string & name, const std::function<void(bool)> & selectedCallback) const;
401 
407  void setAcceptedTextCallback(const std::string & name, const std::function<std::string(std::string)> & acceptedCallback) const;
408 
414  void setTooltip(const std::string & name, const std::string & tooltip) const;
415 
420  void addTextToWidget(const std::string & name, const std::string & text) const;
421 
427  void setSelectedStringCallback(const std::string & name, const std::function<void(std::string)> & selectedCallback) const;
428 
434  void playAnimation(const std::string & name, const std::string & animation) const;
435 
441  void stopAnimation(const std::string & name, const std::string & animation) const;
442 
448  void pauseAnimation(const std::string & name, const std::string & animation) const;
449 
455  void unpauseAnimation(const std::string & name, const std::string & animation) const;
456 
460  void setAutoLineBreak(const std::string & name, bool enabled) const;
461 
468  void registerWidgetTemplate(const std::string & name, const boost::function<api::GUIWidget * (const std::string & name, const std::string & style)> & createFunc) const;
469 
476  void createWidget(const std::string & name, const std::string & type, const std::string & style) const;
477 
482  void deleteWidget(const std::string & name) const;
483 
487  void addTicker(GUIWidget * widget);
488 
492  void removeTicker(GUIWidget * widget);
493 
497  void registerAddTickerCallback(const boost::function<void(GUIWidget *)> & func);
498 
502  void registerRemoveTickerCallback(const boost::function<void(GUIWidget *)> & func);
503 
507  void resetSubSystem();
508 
513  void setInputCaptured(bool captured) {
514  _captured = captured;
515  }
516 
520  bool getInputCaptured() const {
521  return _captured;
522  }
523 
528  void setOnWindow(bool onWindow) {
529  _onWindow = onWindow;
530  }
531 
536  bool getOnWindow() const {
537  return _onWindow;
538  }
539 
543  void setDefaultFont(const std::string & font) const;
544 
548  void addWidgetAsChildTo(const std::string & child, const std::string & parent) const;
549 
550  private:
551  bool _onWindow;
552  bool _captured;
553 
557  GUIFacade(const GUIFacade &) = delete;
558 
562  GUIFacade & operator=(const GUIFacade &) = delete;
563 
564  boost::function<void(GUIWidget *)> _addTickerCallback;
565 
566  boost::function<void(GUIWidget *)> _removeTickerCallback;
567  };
568 
569 } /* namespace api */
570 } /* namespace i6e */
571 
572 #endif /* __I6ENGINE_API_GUIFACADE_H__ */
573 
bool getOnWindow() const
returns true if mouse is above a visible GUI widget element transparent GUI parts aren't recognized ...
Definition: GUIFacade.h:536
#define ISIXE_MODULES_API
This class manages the GUIWindows and provides some general API methods that aren't related to a spec...
Definition: GUIFacade.h:49
bool getInputCaptured() const
returns true, if the input is captured in a GUI widget
Definition: GUIFacade.h:520
void setInputCaptured(bool captured)
called only by GUI subsystem setting state whether input is captured or not call this only from withi...
Definition: GUIFacade.h:513
void setOnWindow(bool onWindow)
sets whether mouse in on a GUI window or not call this only from within GUIManager ...
Definition: GUIFacade.h:528
Superclass for all GUI widgets.
Definition: GUIWidget.h:65