1 // Copyright (C) 2014-2019 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef XGUI_ActiveControlMgr_H
21 #define XGUI_ActiveControlMgr_H
29 class XGUI_ActiveControlSelector;
30 class ModuleBase_IWorkshop;
33 * Interface of providing only one active control for workshop.
34 * It has container of selectors, where only one might be active at the moment.
35 * Selection in 3D view is processed by the active selector.
37 class XGUI_ActiveControlMgr : public QObject
42 /// \param theWorkshop the current workshop instance
43 XGUI_EXPORT XGUI_ActiveControlMgr(ModuleBase_IWorkshop* theWorkshop);
45 XGUI_EXPORT virtual ~XGUI_ActiveControlMgr() {};
47 /// Register selector to process activation of control
48 void addSelector(XGUI_ActiveControlSelector* theSelector);
50 /// Returns selector by type name
51 /// \param theType a selector type
52 /// \return selector instance
53 XGUI_EXPORT XGUI_ActiveControlSelector* getSelector(const QString& theType);
55 /// Returns the active selector
56 /// \return selector instance
57 XGUI_ActiveControlSelector* activeSelector() const { return myActiveSelector; }
60 /// Deactivates active selector and set the sender selector as active
61 void onSelectorActivated();
62 /// Deactivate the active selector
63 void onSelectorDeactivated();
64 /// Listens workshop selection and pass it to the active selector
65 void onSelectionChanged();
68 void activateSelector(XGUI_ActiveControlSelector* theSelector);
71 ModuleBase_IWorkshop* myWorkshop; ///< the current workshop
73 QList<XGUI_ActiveControlSelector*> mySelectors; ///< workshop selectors
74 XGUI_ActiveControlSelector* myActiveSelector; ///< active selector
76 bool myIsBlocked; ///< blocking flag to avoid cycling signals processing