SHAPER  9.12.0
XGUI_PropertyPanel.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_PROPERTYPANEL_H_
21 #define XGUI_PROPERTYPANEL_H_
22 
23 #include "XGUI.h"
24 
25 #include <ModuleBase_ModelWidget.h>
26 #include <ModuleBase_IPropertyPanel.h>
27 
28 #include <QList>
29 
30 class XGUI_ActionsMgr;
31 class QKeyEvent;
32 class QGridLayout;
33 class QToolButton;
36 class XGUI_OperationMgr;
37 
39 MAYBE_UNUSED const static char* PROP_PANEL = "property_panel_dock";
40 
42 MAYBE_UNUSED const static char* PROP_PANEL_OK = "property_panel_ok";
43 
45 MAYBE_UNUSED const static char* PROP_PANEL_OK_PLUS = "property_panel_ok_plus";
46 
48 MAYBE_UNUSED const static char* PROP_PANEL_CANCEL = "property_panel_cancel";
49 
51 MAYBE_UNUSED const static char* PROP_PANEL_HELP = "property_panel_help";
52 
54 MAYBE_UNUSED const static char* PROP_PANEL_PREVIEW = "property_panel_preview";
55 
61 {
62 Q_OBJECT
63  public:
64 
68  XGUI_PropertyPanel(QWidget* theParent, XGUI_OperationMgr* theMgr);
69 
70  virtual ~XGUI_PropertyPanel();
71 
73  virtual QWidget* headerWidget() const { return myHeaderWidget; }
74 
77  ModuleBase_PageBase* contentWidget();
78 
81  void setModelWidgets(const QList<ModuleBase_ModelWidget*>& theWidgets);
82 
84  virtual const QList<ModuleBase_ModelWidget*>& modelWidgets() const;
85 
87  virtual void cleanContent();
88 
93  virtual ModuleBase_ModelWidget* activeWidget(const bool isUseCustomWidget = false) const;
94 
97  virtual void activateNextWidget(ModuleBase_ModelWidget* theWidget);
98 
100  virtual void activateNextWidget();
101 
103  virtual void setFocusOnOkButton();
104 
107  virtual void setCancelEnabled(bool theEnabled);
108 
110  virtual bool isCancelEnabled() const;
111 
114  virtual void setEditingMode(bool isEditing);
115 
117  void setupActions(XGUI_ActionsMgr* theMgr);
118 
121 
123  virtual void setPreselectionWidget(ModuleBase_ModelWidget* theWidget);
124 
126  XGUI_OperationMgr* operationMgr() const { return myOperationMgr; }
127 
131  QToolButton* findButton(const char* theInternalName) const;
132 
136  bool setFocusNextPrevChild(bool theIsNext);
137 
139  virtual void onAcceptData();
140 
145  void setInternalActiveWidget(ModuleBase_ModelWidget* theWidget);
146 
147  void updateApplyPlusButton(FeaturePtr theFeature);
148 
149 public slots:
152  void updateContentWidget(FeaturePtr theFeature);
153 
157  void createContentPanel(FeaturePtr theFeature);
158 
165  virtual void activateWidget(ModuleBase_ModelWidget* theWidget, const bool theEmitSignal = true);
166 
169  void onFocusInWidget(ModuleBase_ModelWidget* theWidget);
170 
171 
174  void onActivateNextWidget(ModuleBase_ModelWidget* theWidget);
175 
176 signals:
179  void enterClicked(QObject* theObject);
180 
185 
186 protected:
190  bool setActiveWidget(ModuleBase_ModelWidget* theWidget, const bool isEmitSignal);
194  virtual bool focusNextPrevChild(bool theIsNext);
199  const bool isCheckVisibility);
200 
201  protected:
204  void closeEvent(QCloseEvent* theEvent);
205 
206 private:
207  QWidget* myHeaderWidget;
208 
209  ModuleBase_PageWidget* myPanelPage;
210  QList<ModuleBase_ModelWidget*> myWidgets;
211 
213  ModuleBase_ModelWidget* myActiveWidget;
215  ModuleBase_ModelWidget* myPreselectionWidget;
217  ModuleBase_ModelWidget* myInternalActiveWidget;
218 
219  XGUI_OperationMgr* myOperationMgr;
220 };
221 
222 #endif /* XGUI_PROPERTYPANEL_H_ */
A class for Property panel object definition.
Definition: ModuleBase_IPropertyPanel.h:35
virtual ModuleBase_ModelWidget * preselectionWidget() const =0
Returns widget processed by preselection.
virtual void setPreselectionWidget(ModuleBase_ModelWidget *theWidget)=0
Sets widget processed by preselection.
virtual ModuleBase_ModelWidget * activeWidget(const bool isUseCustomWidget=false) const =0
Returns currently active widget.
virtual void activateWidget(ModuleBase_ModelWidget *theWidget, const bool theEmitSignal=true)=0
Makes the given widget active, highlights it and removes highlighting from the previous active widget...
virtual void cleanContent()=0
Removes all widgets in the widget area of the property panel.
virtual void onAcceptData()=0
The method is called on accepting of operation.
virtual void activateNextWidget()=0
Activate the next from current widget in the property panel.
virtual void setEditingMode(bool isEditing)
Editing mode depends on mode of current operation.
Definition: ModuleBase_IPropertyPanel.h:63
virtual const QList< ModuleBase_ModelWidget * > & modelWidgets() const =0
Returns all property panel's widget created by WidgetFactory.
virtual void setCancelEnabled(bool theEnabled)=0
Set Enable/Disable state of Cancel button.
virtual bool isCancelEnabled() const =0
virtual void setFocusOnOkButton()=0
Set focus on the Ok button.
An abstract custom widget class.
Definition: ModuleBase_ModelWidget.h:60
Definition: ModuleBase_PageBase.h:35
Definition: ModuleBase_PageWidget.h:37
class XGUI_ActionsMgrA class for management of actions (features) activation/deactivation
Definition: XGUI_ActionsMgr.h:45
Operation manager.
Definition: XGUI_OperationMgr.h:49
Realization of Property panel object.
Definition: XGUI_PropertyPanel.h:61
void propertyPanelDeactivated()
Emits on deactivating property panel (e.g. by clearContent)
virtual QWidget * headerWidget() const
Returns header widget.
Definition: XGUI_PropertyPanel.h:73
void propertyPanelActivated()
Emits on widget activating.
void enterClicked(QObject *theObject)
The signal is emitted if the enter is clicked in the control of the widget.
XGUI_OperationMgr * operationMgr() const
Returns operation manager.
Definition: XGUI_PropertyPanel.h:126