OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
aWindowManager.h
Go to the documentation of this file.
1/*
2 * File: aWindowManager.h
3 * Package: akWidgets
4 *
5 * Created on: January 30, 2020
6 * Author: Alexander Kuester
7 * Copyright (c) 2022 Alexander Kuester
8 * This file is part of the uiCore component.
9 * This file is subject to the terms and conditions defined in
10 * file 'LICENSE', which is part of this source code package.
11 */
12
13#pragma once
14
15// C++ header
16#include <map>
17
18// Qt header
19#include <qobject.h>
20#include <qstring.h> // QString
21#include <qbytearray.h>
22#include <qsize.h>
23#include <qstringlist.h>
24
25// AK header
27#include <akCore/akCore.h>
28#include <akCore/aObject.h>
29
30// Forward declaration
31class QWidget;
32class QDockWidget;
33class QLabel;
34class QProgressBar;
35class QTimer;
36class QMovie;
37namespace tt { class TabToolbar; }
38
39namespace ak {
40
41 // Forward declaration
42 class aMessenger;
43 class aObjectManager;
44 class aTtbContainer;
45 class aTtbPage;
46 class aUidManager;
47 class aWindow;
48 class aWidget;
49 class aWindowEventHandler;
50 class aWindowManagerTimerSignalLinker;
51
55 class UICORE_API_EXPORT aWindowManager : public QObject, public aObject {
56 Q_OBJECT
57 public:
58 // #############################################################################################################
59
60 // Constructors
61
66 aMessenger * _messenger,
67 aUidManager * _uidManager
68 );
69
71 virtual ~aWindowManager();
72
75 virtual void removeChildObject(
76 aObject * _child
77 ) override;
78
81 void SetObjectName(
82 const QString & _alias
83 );
84
85 // #############################################################################################################
86 // #############################################################################################################
87 // #############################################################################################################
88 // ELEMENT CREATION
89
90 void setCentralWidget(
91 QWidget * _centralWidget
92 );
93
94 // #############################################################################################################
95
96 // Status
97
100 void setStatusLabelText(
101 const QString & _status
102 );
103
108 void setStatusLabelVisible(
109 bool _visible = true,
110 bool _hideDelayed = true
111 );
112
115 void setStatusBarProgress(
116 int _progress
117 );
118
124 void setStatusBarVisible(
125 bool _visible,
126 bool _showDelayed = true
127 );
128
130 void setStatusBarContinuous(
131 bool _continuos = true
132 );
133
134 bool getStatusBarVisible(void) const;
135
136 bool getStatusLabelVisible(void) const;
137
138 QString getStatusLabelText(void) const;
139
140 int getStatusBarProgress(void) const;
141
142 bool getStatusBarContinuous(void) const;
143
146 void setShowStatusObjectDelayTimerInterval(int _interval);
147
150 void setHideStatusObjectDelayTimerInterval(int _interval);
151
153 int getShowStatusObjectDelayTimerInterval(void) const;
154
156 int getHideStatusObjectDelayTimerInterval(void) const;
157
158 void setWaitingAnimationVisible(
159 bool _visible
160 );
161
162 void setWaitingAnimation(
163 QMovie * _movie
164 );
165
166 // #############################################################################################################
167
168 // TabToolbar
169
172 void setTabToolBarVisible(
173 bool _vis = true
174 );
175
177 void setTabToolbarDoubleClickEnabled(
178 bool _isEnabled
179 );
180
183 aTtbPage * createTabToolbarSubContainer(
184 const QString & _text = QString("")
185 );
186
190 aTtbContainer * getTabToolBarSubContainer(
191 const QString & _text
192 );
193
194 QString getTabToolBarTabText(ak::ID _tabId);
195
201
202 void addTabToolbarWidget(
203 UID _parentUid,
204 UID _objectUid
205 );
206
208 ID currentTabToolbarTab(void) const;
209
211 int tabToolbarTabCount(void) const;
212
214 void enableTabToolbar(bool flag) const;
215
218 void setCurrentTabToolBarTab(
219 ID _tabID
220 );
221
222 void setCurrentTabToolBarTab(
223 const QString& _tabName
224 );
225
228 void setCentralWidgetMinimumSize(
229 const QSize & _size
230 );
231
232 // #############################################################################################################
233
234 // Window
235
237 aWindow * window(void) const;
238
241 void setWindowTitle(
242 const QString & _title
243 );
244
247 void setWindowIcon(
248 const QIcon & _tcon
249 );
250
252 QString windowTitle(void) const;
253
256 void addEventHandler(
257 aWindowEventHandler * _eventHandler
258 );
259
262 void removeEventHandler(
263 aWindowEventHandler * _eventHandler
264 );
265
266 // #############################################################################################################
267 // #############################################################################################################
268 // #############################################################################################################
269
270 // ELEMENT MANIPULATION
271
273 void showMaximized(void);
274
276 void showMinimized(void);
277
279 void showNormal(void);
280
282 void close(void);
283
284 void resize(
285 int _width,
286 int _height
287 );
288
290 std::string saveState(std::string currentState);
291
292 bool restoreState(
293 const std::string & _state,
294 bool _setPositionAndSize = true
295 );
296
297 void setTabToolBarTabOrder(const QStringList& _list);
298
299 Q_SIGNALS:
300 void tabToolBarTabChanged(int _index);
301
302 private Q_SLOTS:
303 void slotRestoreSetting(const QByteArray & _actualState);
304 void slotTabToolbarTabClicked(int _index);
305 void slotTabToolbarTabCurrentTabChanged(int _index);
306
307 private:
308 // Variables
309
310 void resortTabToolBarTabOrder(void);
311
312 aWindow * m_window;
313
314 QLabel * m_statusLabel;
315 QProgressBar * m_progressBar;
316
319 tt::TabToolbar * m_tabToolBar;
320 aWindowManagerTimerSignalLinker * m_timerSignalLinker;
321
322 QStringList m_tabToolBarTabOrder;
323 bool m_progressBarContinuous;
324
325 QTimer * m_timerProgressShow;
326 QTimer * m_timerProgressHide;
327 QTimer * m_timerLabelShow;
328 QTimer * m_timerLabelHide;
329 QTimer * m_timerShowMainWindow;
330
331 std::vector<aTtbContainer *> m_tabToolBarContainer;
332 };
333} // namespace ak
#define UICORE_API_EXPORT
Definition globalDataTypes.h:20
void close(int _exitCode)
Definition main.cpp:178
Class used to forward messages to receivers This class is used to forward a message to receivers....
Definition aMessenger.h:34
This class is used to store the main information of any object used Information contained is the UID ...
Definition aObject.h:34
This class provides a interface that represents a tab toolbar container.
Definition aTtbContainer.h:36
Definition aTtbPage.h:35
This class is used to manage UIDs. This UID manager is incrementing the UID on each getId call.
Definition aUidMangager.h:25
Definition aWindowEventHandler.h:19
Definition aWindow.h:38
This class is used to manage a QMainWindow It provides several functions to create and manipulate the...
Definition aWindowManager.h:55
void tabToolBarTabChanged(int _index)
This class is used to link the timer signals of the ui manager to the corresponding callback function...
Definition aWindowManagerTimerSignalLinker.h:32
Definition uiAPI.h:45
unsigned long long UID
The UID datatype used for objects.
Definition globalDataTypes.h:65
int ID
The ID datatype used for items.
Definition globalDataTypes.h:68
Definition TabToolBar.h:18
static ak::aMessenger * m_messenger
The object manager used in this API.
Definition uiAPI.cpp:58
static ak::aUidManager * m_uidManager
The messenger used in this API.
Definition uiAPI.cpp:59