1 // Copyright (C) 2014-2017 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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef XGUI_ActiveControlMgr_H
22 #define XGUI_ActiveControlMgr_H
30 class XGUI_ActiveControlSelector;
31 class ModuleBase_IWorkshop;
34 * Interface of providing only one active control for workshop.
35 * It has container of selectors, where only one might be active at the moment.
36 * Selection in 3D view is processed by the active selector.
38 class XGUI_ActiveControlMgr : public QObject
43 /// \param theWorkshop the current workshop instance
44 XGUI_EXPORT XGUI_ActiveControlMgr(ModuleBase_IWorkshop* theWorkshop);
46 XGUI_EXPORT virtual ~XGUI_ActiveControlMgr() {};
48 /// Register selector to process activation of control
49 void addSelector(XGUI_ActiveControlSelector* theSelector);
51 /// Returns selector by type name
52 /// \param theType a selector type
53 /// \return selector instance
54 XGUI_EXPORT XGUI_ActiveControlSelector* getSelector(const QString& theType);
56 /// Returns the active selector
57 /// \return selector instance
58 XGUI_ActiveControlSelector* activeSelector() const { return myActiveSelector; }
61 /// Deactivates active selector and set the sender selector as active
62 void onSelectorActivated();
63 /// Deactivate the active selector
64 void onSelectorDeactivated();
65 /// Listens workshop selection and pass it to the active selector
66 void onSelectionChanged();
69 void activateSelector(XGUI_ActiveControlSelector* theSelector);
72 ModuleBase_IWorkshop* myWorkshop; ///< the current workshop
74 QList<XGUI_ActiveControlSelector*> mySelectors; ///< workshop selectors
75 XGUI_ActiveControlSelector* myActiveSelector; ///< active selector
77 bool myIsBlocked; ///< blocking flag to avoid cycling signals processing