roviz  0.7
Code Documentation of roviz
gui_manager.h
Go to the documentation of this file.
1 #ifndef GUI_MANAGER_H
2 #define GUI_MANAGER_H
3 
4 #include <QObject>
5 #include <QMainWindow>
6 
7 #include <functional>
8 #include "appcore.h"
9 #include "helper/singleton.h"
10 
13 enum class WidgetType {
15  DockWidget,
16  ToolBar,
18  MenuBar,
19  StatusBar
20 };
22 enum class WidgetArea {
23  NoArea = 0,
24  Left = 0x1,
25  Right = 0x2,
26  Top = 0x4,
27  Bottom = 0x8,
28  AllAreas = 0xf
29 
30 };
31 
32 enum class GuiMode {
33  ShowGui = 0,
34  Headless
35 };
36 
40 class ITEMFRAMEWORK_EXPORT GuiManager : public QObject, public Singleton<GuiManager>
41 {
42  //------------------Singleton Stuff---------------------------
43  Q_OBJECT
44  Q_INTERFACES(AbstractSingleton)
45  Q_CLASSINFO("guiModule", "true")
46  Q_CLASSINFO("dependsOn", "PluginManager")
47 
48 public:
49  Q_INVOKABLE GuiManager();
50  ~GuiManager();
51 
52 protected:
53  bool postInit();
54  bool preDestroy();
55  //------------------End Singleton Stuff---------------------------
56 
57 public:
62  void setMode(GuiMode mode);
69  QWidget* removeWidget(QString const& name);
70 
82  bool addWidget(QWidget* widget, QString const& name, WidgetArea area, WidgetType type = WidgetType::DockWidget);
83 
95  QString addWidget(QWidget* widget, WidgetArea area, WidgetType type = WidgetType::DockWidget);
96 
103  bool moveWidget(QString const& name, WidgetArea area);
104 
110  void setVisible(QString const& name, bool visible);
111 
116  QWidget* widgetReference();
117 
126  bool addAction(QAction* action, QString const& name, QString const& parent);
127 
135  bool addActionToParent(QString const& name, QString const& parent);
136 
145  QString addAction(QAction* action, QString const& parent);
146 
152  QAction* action(QString const& name) const;
153 
160  QAction* removeAction(QString const& name, QString const& parent = QString());
161 
168  void registerCloseHandler(std::function<bool()> callback);
169 
175  QStringList parents(QString const& name);
176 
182  QStringList children(QString const& name) const;
183 
188  QStringList registeredActions()const;
189 
194  QStringList registeredWidgets() const;
195 
201  QStringList registeredWidgets(WidgetType type) const;
202 
207  bool mainWindowIsActive() const;
208 
209 signals:
213  void mainWindowActivationChange();
214 
215 private:
216  QScopedPointer<class GuiManagerPrivate> const d_ptr;
217  Q_DECLARE_PRIVATE(GuiManager)
218 
219 };
220 #endif // GUI_MANAGER_H
No area, use for widget that don&#39;t need an area.
Widget that can be casted into a QMenuBar, only one can exist within a QMainWindow.
GuiMode
Definition: gui_manager.h:32
Mask for all areas.
Left Area.
Widget that can be casted into a QStatusBar, only one can exist within a QMainWindow.
The AbstractSingleton class defines functions that every singleton must implement Every Singleton mus...
Definition: singleton.h:12
Right Area.
WidgetArea
Information about the area where a widget should be placed, Compatible with Qt::DockWidgetArea and Qt...
Definition: gui_manager.h:22
WidgetType
Information about the type of a widget.
Definition: gui_manager.h:14
Show GUI (default)
Top Area.
Do not show GUI. Useful for non-interactive usage, e.g. in tests.
Widget that can be casted into a Toolbar.
Widget that is placed in the center, only one can exist within a QMainWindow.
The Singleton Template figures as baseclass for all Singletons. It provides a instance() functions wh...
Definition: singleton.h:54
Bottom Area.
Widget that can be casted to a QDockwidget.
The GuiManager class handels widgets and actions on the main window.
Definition: gui_manager.h:40