OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
WidgetManager.h
Go to the documentation of this file.
1
4// ###########################################################################################################################################################################################################################################################################################################################
5
6#pragma once
7
8// OpenTwin header
9#include "OTCore/OTObject.h"
11#include "OTGui/GuiTypes.h"
13
14// std header
15#include <map>
16#include <list>
17
18namespace ot {
19
20 class Widget;
21
25 public:
27 virtual ~WidgetManager();
28
29 void registerWidget(Widget* _widget);
30 void deregisterWidget(Widget* _widget);
31
32 void ownerDisconnected(const BasicServiceInformation& _owner);
33
34 Widget* findWidget(const std::string& _name) const;
35
36 void lock(const BasicServiceInformation& _owner, const ot::LockTypeFlags& _lockFlags);
37 void unlock(const BasicServiceInformation& _owner, const ot::LockTypeFlags& _lockFlags);
38
39 protected:
40 virtual void objectWasDestroyed(OTObject* _object) override;
41
42 private:
43 struct OwnerData {
44 std::list<Widget*> widgets;
45 std::map<LockTypeFlag, int> lockData;
46 };
47
49 std::map<std::string, Widget*> m_widgets;
50
52 std::map<BasicServiceInformation, OwnerData> m_ownerData;
53
55 std::map<LockTypeFlag, int> m_lockData;
56
58 void clearWidgetInfo(Widget* _widget);
59
60 OwnerData& findOrCreateOwnerData(const BasicServiceInformation& _owner);
61
62 int& getLockCount(OwnerData& _ownerData, LockTypeFlag _lockFlag);
63 };
64
65}
#define OT_DECL_NOMOVE(___class)
Removes the default move constructor and move operator.
Definition OTClassHelper.h:18
#define OT_DECL_NOCOPY(___class)
Removes the default copy constructor and assignment operator.
Definition OTClassHelper.h:14
#define OT_WIDGETS_API_EXPORT
Definition OTWidgetsAPIExport.h:12
The BasicServiceInformation class is used to hold a service name and type. The BasicServiceInformatio...
Definition BasicServiceInformation.h:21
Definition OTObject.h:18
Definition Widget.h:16
Definition WidgetManager.h:22
Definition Connector.h:8
LockTypeFlag
Describes the object type to lock in the UI.
Definition GuiTypes.h:156