OpenLexocad  28.0
Selection.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <OpenLxApp/Element.h>
4 
5 #include <OpenLxUI/SelectionCB.h>
6 #include <OpenLxUI/UIElement.h>
8 
9 #include <QObject>
10 
11 
12 namespace OpenLxUI
13 {
14 class SelectionP;
15 
22 class LX_OPENLXUI_EXPORT Selection
23 
24 #ifndef SWIG
25  : public QObject
26 #endif
27 
28 {
29  Q_OBJECT
30 
31 public:
32  std::shared_ptr<OpenLxApp::Document> getDocument() const;
33 
34  void selectAll() const;
35  void select(std::shared_ptr<OpenLxApp::Element> aElem) const;
36  void select(const std::vector<std::shared_ptr<OpenLxApp::Element>>& aElems) const;
37  void deselectAll() const;
38  void deselect(std::shared_ptr<OpenLxApp::Element> aElem) const;
39  void deselect(const std::vector<std::shared_ptr<OpenLxApp::Element>>& aElems) const;
40  void forceUpdate() const;
41 
42  std::vector<std::shared_ptr<OpenLxApp::DocObject>> getDocObjects() const;
43  std::vector<std::shared_ptr<OpenLxApp::Element>> getAsElements() const;
44  std::vector<std::shared_ptr<OpenLxUI::UIElement>> getUIElements() const;
45 
46 
47 #ifndef SWIG
48 
49 signals:
50  // Is emitted when one or more UIElements get selected.
51  void selectedSignal(const std::vector<std::shared_ptr<OpenLxUI::UIElement>>&);
52  // Is emitted when one or more UIElements get deselected.
53  void deselectedSignal(const std::vector<std::shared_ptr<OpenLxUI::UIElement>>&);
54  // Is emitted when the selection is cleared.
56 
57 private slots:
58  void _onSelected(const std::vector<Core::DocObject*>&);
59  void _onDeselected(const std::vector<Core::DocObject*>&);
60  void _onClearedSelection();
61 #endif
62 public:
67  std::vector<OpenLxUI::SelectionCB*> getCallbacks() const;
68  std::vector<OpenLxUI::SelectionCB*> getCallbacks(OpenLxUI::UIElementFilter* aFilter) const;
69 
70  // Testing
71  void testCB();
72 
73  Selection(std::shared_ptr<OpenLxApp::Document> aDoc);
74 
76  Selection() = delete;
77 
78 private:
79  std::shared_ptr<OpenLxUI::SelectionP> _pimpl;
80 };
81 } // namespace OpenLxUI
OpenLxUI::Selection
Definition: Selection.h:28
Element.h
OpenLxUI::Selection::Selection
Selection()=delete
OpenLxUI::Selection::deselect
void deselect(std::shared_ptr< OpenLxApp::Element > aElem) const
OpenLxUI::Selection::getUIElements
std::vector< std::shared_ptr< OpenLxUI::UIElement > > getUIElements() const
OpenLxUI::Selection::Selection
Selection(std::shared_ptr< OpenLxApp::Document > aDoc)
OpenLxUI::Selection::selectAll
void selectAll() const
OpenLxUI::Selection::getCallbacks
std::vector< OpenLxUI::SelectionCB * > getCallbacks(OpenLxUI::UIElementFilter *aFilter) const
OpenLxUI::Selection::getDocument
std::shared_ptr< OpenLxApp::Document > getDocument() const
OpenLxUI::Selection::getAsElements
std::vector< std::shared_ptr< OpenLxApp::Element > > getAsElements() const
UIElementFilter.h
OpenLxUI::Selection::~Selection
~Selection()
OpenLxUI::Selection::addCallback
void addCallback(OpenLxUI::SelectionCB *aCB)
OpenLxUI::Selection::getDocObjects
std::vector< std::shared_ptr< OpenLxApp::DocObject > > getDocObjects() const
OpenLxUI::Selection::addCallback
void addCallback(OpenLxUI::SelectionCB *aCB, OpenLxUI::UIElementFilter *aFilter)
OpenLxUI::Selection::deselectedSignal
void deselectedSignal(const std::vector< std::shared_ptr< OpenLxUI::UIElement >> &)
OpenLxUI::Selection::clearedSelectionSignal
void clearedSelectionSignal()
OpenLxUI::Selection::forceUpdate
void forceUpdate() const
OpenLxUI::Selection::testCB
void testCB()
OpenLxUI::Selection::deselect
void deselect(const std::vector< std::shared_ptr< OpenLxApp::Element >> &aElems) const
OpenLxUI::Selection::select
void select(const std::vector< std::shared_ptr< OpenLxApp::Element >> &aElems) const
OpenLxUI::Selection::deselectAll
void deselectAll() const
OpenLxUI::Selection::removeCallbacks
void removeCallbacks()
SelectionCB.h
OpenLxUI::Selection::removeCallback
void removeCallback(OpenLxUI::SelectionCB *aCB)
UIElement.h
OpenLxUI::UIElementFilter
Definition: UIElementFilter.h:18
OpenLxUI
Definition: ActiveEdge.h:26
OpenLxUI::Selection::getCallbacks
std::vector< OpenLxUI::SelectionCB * > getCallbacks() const
OpenLxUI::Selection::select
void select(std::shared_ptr< OpenLxApp::Element > aElem) const
OpenLxUI::Selection::selectedSignal
void selectedSignal(const std::vector< std::shared_ptr< OpenLxUI::UIElement >> &)
OpenLxUI::SelectionCB
Definition: SelectionCB.h:39