SHAPER  9.12.0
XGUI_ActiveControlMgr.h
1 // Copyright (C) 2014-2023 CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef XGUI_ActiveControlMgr_H
21 #define XGUI_ActiveControlMgr_H
22 
23 #include "XGUI.h"
24 
25 #include <QList>
26 #include <QObject>
27 
28 
31 
38 {
39  Q_OBJECT
40 public:
43  XGUI_EXPORT XGUI_ActiveControlMgr(ModuleBase_IWorkshop* theWorkshop);
44 
45  XGUI_EXPORT virtual ~XGUI_ActiveControlMgr() {};
46 
48  void addSelector(XGUI_ActiveControlSelector* theSelector);
49 
53  XGUI_EXPORT XGUI_ActiveControlSelector* getSelector(const QString& theType);
54 
58 
59  void deactivateSelector(XGUI_ActiveControlSelector* theSelector);
60 
61 protected slots:
63  void onSelectorActivated();
65  void onSelectorDeactivated();
67  void onSelectionChanged();
68 
69 protected:
70  void activateSelector(XGUI_ActiveControlSelector* theSelector);
71 
72 protected:
74 
75  QList<XGUI_ActiveControlSelector*> mySelectors;
77 
78  bool myIsBlocked;
79 };
80 
81 #endif
Class which provides access to Workshop object services.
Definition: ModuleBase_IWorkshop.h:48
Interface of providing only one active control for workshop.
Definition: XGUI_ActiveControlMgr.h:38
void onSelectionChanged()
Listens workshop selection and pass it to the active selector.
Definition: XGUI_ActiveControlMgr.cpp:131
ModuleBase_IWorkshop * myWorkshop
the current workshop
Definition: XGUI_ActiveControlMgr.h:73
XGUI_ActiveControlSelector * myActiveSelector
active selector
Definition: XGUI_ActiveControlMgr.h:76
XGUI_ActiveControlMgr(ModuleBase_IWorkshop *theWorkshop)
Constructor.
Definition: XGUI_ActiveControlMgr.cpp:41
QList< XGUI_ActiveControlSelector * > mySelectors
workshop selectors
Definition: XGUI_ActiveControlMgr.h:75
void addSelector(XGUI_ActiveControlSelector *theSelector)
Register selector to process activation of control.
Definition: XGUI_ActiveControlMgr.cpp:48
XGUI_ActiveControlSelector * activeSelector() const
Returns the active selector.
Definition: XGUI_ActiveControlMgr.h:57
bool myIsBlocked
blocking flag to avoid cycling signals processing
Definition: XGUI_ActiveControlMgr.h:78
void onSelectorDeactivated()
Deactivate the active selector.
Definition: XGUI_ActiveControlMgr.cpp:93
XGUI_ActiveControlSelector * getSelector(const QString &theType)
Returns selector by type name.
Definition: XGUI_ActiveControlMgr.cpp:56
void onSelectorActivated()
Deactivates active selector and set the sender selector as active.
Definition: XGUI_ActiveControlMgr.cpp:70
Interface to have an active control and process selection by the control.
Definition: XGUI_ActiveControlSelector.h:32