OpenLexocad  27.1
UIApplication.h
Go to the documentation of this file.
1 // //
3 // LEXOCAD API //
4 // //
5 // ©2005-2016 Cadwork Informatik. All rights reserved. //
6 // //
7 // ONLY INCLUDE OTHER INTERFACES! //
8 // Lexocad provides API Classes for public use and //
9 // Implementation Classes for private use. //
10 // //
11 // - Do ONLY include and use the LEXOCAD API in this header. //
12 // - Do not change existing interfaces. //
13 // - Document your code! //
14 // //
15 // - All types from Base, Core, Geom, Topo are allowed here. //
16 // - In the Gui modules the use of Qt types is allowed. //
17 // //
19 
20 #pragma once
21 
22 #include <Gui/PropertyTree.h>
23 #include <OpenLxApp/Application.h>
24 #include <OpenLxApp/Document.h>
25 
27 #include <OpenLxUI/UIDocument.h>
28 #include <OpenLxUI/UIElement.h>
30 
31 #include <QObject>
32 
37 namespace OpenLxUI
38 {
39 class UIApplicationP;
40 class UIApplicationCB;
41 class Viewer;
42 
49 class LX_OPENLXUI_EXPORT UIApplication
50 
51 #ifndef SWIG
52  : public QObject
53 #endif
54 
55 {
56  Q_OBJECT
57 
58 public:
59  OpenLxApp::Application* getApplication() const;
60  std::shared_ptr<OpenLxUI::UIDocument> getUIDocument(std::shared_ptr<OpenLxApp::Document> aDoc) const;
61 
62  static UIApplication* getInstance();
63 
64 #ifndef SWIG
65 signals:
66  // This signal is emitted when the UIProperties in the Modify Panel are about to be displayed.
67  void displayUIPropertiesSignal(Gui::PropertyTree*, std::shared_ptr<OpenLxUI::UIElement>);
68  // This signal is emitted when a UIProperty has been changed by the user.
69  void changedUIPropertySignal(Gui::PropertyTreeItem*, std::shared_ptr<OpenLxUI::UIElement>);
70 
71 private slots:
72 
73  void _onLexocadDisplayUIProperties(Gui::PropertyTree*, Core::DocObject*);
74  void _onLexocadChangedUIProperty(Gui::PropertyTreeItem*, Core::DocObject*);
75 
76 public:
77  void installCustomEventFilter(QObject* aFilterObj);
78  void removeCustomEventFilter(QObject* aFilterObj);
79 
80 
81 #endif
82 public:
83  ~UIApplication();
84 
85 public:
86  void processEvents();
87 
88  void addCallback(OpenLxUI::UIApplicationCB* aCB);
89  void addCallback(OpenLxUI::UIApplicationCB* aCB, OpenLxUI::UIElementFilter* aFilter);
90  void removeCallback(OpenLxUI::UIApplicationCB* aCB);
91  void removeCallbacks();
92 
93  std::shared_ptr<OpenLxUI::Viewer> getActiveViewer() const;
94 
95  // Testing
96  void testCB();
97  void onLexocadChangedUIProperty(Gui::PropertyTreeItem*, std::shared_ptr<OpenLxUI::UIElement>);
98 
99  UIApplication() = delete;
100 
101 private:
103  static UIApplication* instance;
104  std::shared_ptr<UIApplicationP> _pimpl;
105 };
106 
107 } // namespace OpenLxUI
Definition: UIApplicationCB.h:39
Definition: UIElementFilter.h:17
#define slots
Definition: PyExport.h:22
#define signals
Definition: pythonize.h:40
Definition: ActiveEdge.h:25
Definition: UIApplication.h:49
The one and only Application.
Definition: Application.h:49
Definition: DocObject.h:51