OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
aObjectManager.h
Go to the documentation of this file.
1/*
2 * File: aObjectManager.h
3 * Package: akGui
4 *
5 * Created on: July 14, 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 // AK header
17#include <akCore/akCore.h>
18
19// C++ header
20#include <map> // map
21#include <exception>
22
23// Qt header
24#include <qstring.h>
25#include <qicon.h>
26#include <qtoolbutton.h> // QToolButton popup mode
27#include <qpixmap.h>
28
29namespace ak {
30
31 class aObject;
32 class aNotifierObjectManager;
33 class aMessenger;
34 class aUidManager;
35 class aSignalLinker;
36 class aToolButtonWidget;
37
41 public:
46 aMessenger * _messenger,
47 aUidManager * _uidManager
48 );
49
51 virtual ~aObjectManager();
52
53 // ###############################################################################################################################################
54
55 // Object creation
56
62 UID createAction(
63 UID _creatorUid,
64 const QString & _text,
65 const QIcon & _icon,
66 QToolButton::ToolButtonPopupMode _popupMode = QToolButton::ToolButtonPopupMode::InstantPopup
67 );
68
72 UID createCheckBox(
73 UID _creatorUid,
74 const QString & _text = QString(""),
75 bool _checked = false
76 );
77
81 UID createLineEdit(
82 UID _creatorUid,
83 const QString & _initialText = QString("")
84 );
85
89 UID createNiceLineEdit(
90 UID _creatorUid,
91 const QString & _initialText,
92 const QString & _infoLabelText
93 );
94
97 UID createTimer(
98 UID _creatorUid
99 );
100
103 UID createToolButton(
104 UID _creatorUid
105 );
106
110 UID createToolButton(
111 UID _creatorUid,
112 const QString & _text
113 );
114
119 UID createToolButton(
120 UID _creatorUid,
121 const QString & _text,
122 const QIcon & _icon
123 );
124
129 UID createTabToolBarSubContainer(
130 UID _creatorUid,
131 UID _parentUid,
132 const QString & _text = QString("")
133 );
134
139 UID createTabToolBarPage(
140 UID _creatorUid,
141 UID _uiManagerUid,
142 const QString & _text = QString("")
143 );
144
145 /*
148 UID createWelcomeScreen(
149 UID _creatorUid
150 );
151 */
152
155 UID createWindow(
156 UID _creatorUid
157 );
158
159 // ###############################################################################################################################################
160
161 // Object manipulation
162
165 aObject * object(
166 UID _objectUid
167 );
168
171 aObject * object(
172 const QString & _objectUniqueName
173 );
174
175 // ###############################################################################################################################################
176
177 // Special events
178
181 void creatorDestroyed(
182 UID _creatorUid
183 );
184
185 void destroy(
186 UID _objectUID,
187 bool _ignoreIfObjectHasChildObjects = false
188 );
189
191 void destroyAll(void);
192
198 void setObjectUniqueName(
199 UID _objectUid,
200 const QString & _uniqueName
201 );
202
205 UID objectCreator(
206 UID _objectUID
207 );
208
211 bool objectExists(
212 UID _objectUID
213 );
214
215 private:
216
220 void addCreatedUid(
221 UID _creatorUid,
222 UID _createdUid
223 );
224
226 QWidget * castToWidget(
227 UID _objectUid
228 );
229
230 // ###############################################################################################################################################
231
232 // Object storing
233
234 std::map<UID, aObject *> m_mapObjects;
235 std::map<QString, aObject *> m_mapUniqueNames;
236
237 std::map<UID, std::vector<UID> *> m_mapCreators;
238 std::map<UID, UID> m_mapOwners;
239
240 // ###############################################################################################################################################
241
244 aSignalLinker * m_signalLinker;
245 aNotifierObjectManager * m_notifier;
246
247 aObjectManager() = delete;
248 aObjectManager(const aObjectManager &) = delete;
249 aObjectManager & operator = (aObjectManager &) = delete;
250
251 };
252
253 class UICORE_API_EXPORT ObjectNotFoundException : public std::exception {
254 public:
256 };
257
258} // namespace ak
#define UICORE_API_EXPORT
Definition globalDataTypes.h:20
Definition aObjectManager.h:253
Class used to forward messages to receivers This class is used to forward a message to receivers....
Definition aMessenger.h:34
This notifier is used to notify the core application about incoming events and errors.
Definition aNotifierObjectManager.h:25
This class is used to store the main information of any object used Information contained is the UID ...
Definition aObject.h:34
The objectManager is used for creating and manipulating objects and widgets All objects created here ...
Definition aObjectManager.h:40
Used to link [Widget] signals to the messaging system Every added widget will get all its possible/mo...
Definition aSignalLinker.h:46
This class is used to manage UIDs. This UID manager is incrementing the UID on each getId call.
Definition aUidMangager.h:25
Definition uiAPI.h:45
unsigned long long UID
The UID datatype used for objects.
Definition globalDataTypes.h:65
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