Salome HOME
Merge branch 'Dev_1.2.0' of newgeom:newgeom into Dev_1.2.0
[modules/shaper.git] / src / XGUI / XGUI_PropertyPanel.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 /*
4  * XGUI_PropertyPanel.h
5  *
6  *  Created on: Apr 29, 2014
7  *      Author: sbh
8  */
9
10 #ifndef XGUI_PROPERTYPANEL_H_
11 #define XGUI_PROPERTYPANEL_H_
12
13 #include "XGUI.h"
14
15 #include <ModuleBase_ModelWidget.h>
16 #include <ModuleBase_IPropertyPanel.h>
17
18 #include <QList>
19
20 class XGUI_ActionsMgr;
21 class QKeyEvent;
22 class QGridLayout;
23 class ModuleBase_PageBase;
24 class ModuleBase_PageWidget;
25
26 /// Internal name of property panel widget
27 const static char* PROP_PANEL = "property_panel_dock";
28
29 /// Internal name of Ok button
30 const static char* PROP_PANEL_OK = "property_panel_ok";
31
32 /// Internal name of Cancel button
33 const static char* PROP_PANEL_CANCEL = "property_panel_cancel";
34
35 /// Internal name of Help button
36 const static char* PROP_PANEL_HELP = "property_panel_help";
37
38 /**
39 * \ingroup GUI
40 * Realization of Property panel object.
41 */
42 class XGUI_EXPORT XGUI_PropertyPanel : public ModuleBase_IPropertyPanel
43 {
44 Q_OBJECT
45  public:
46
47   /// Constructor
48   /// \param theParent is a parent of the property panel
49   XGUI_PropertyPanel(QWidget* theParent);
50
51   virtual ~XGUI_PropertyPanel();
52
53   /// Returns main widget of the property panel, which children will be created
54   /// by WidgetFactory using the XML definition
55   ModuleBase_PageBase* contentWidget();
56
57   /// Brings back all widget created by widget factory for signal/slot
58   /// connections and further processing
59   void setModelWidgets(const QList<ModuleBase_ModelWidget*>& theWidgets);
60
61   /// Returns all property panel's widget created by WidgetFactory
62   virtual const QList<ModuleBase_ModelWidget*>& modelWidgets() const;
63
64   /// Removes all widgets in the widget area of the property panel
65   virtual void cleanContent();
66
67   /// Returns currently active widget
68   virtual ModuleBase_ModelWidget* activeWidget() const { return myActiveWidget; }
69
70   /// Activate the next widget in the property panel
71   /// \param theWidget a widget. The next widget should be activated
72   virtual void activateNextWidget(ModuleBase_ModelWidget* theWidget);
73
74   /// Activate the next from current widget in the property panel
75   virtual void activateNextWidget();
76
77   /// Set Enable/Disable state of Cancel button
78   /// \param theEnabled Enable/Disable state of Cancel button
79   virtual void setCancelEnabled(bool theEnabled);
80
81   /// \return Enable/Disable state of Cancel button
82   virtual bool isCancelEnabled() const;
83
84   /// Editing mode depends on mode of current operation. This value is defined by it.
85   /// \param isEditing state of editing mode flag
86   virtual void setEditingMode(bool isEditing);
87
88   //! Allows to set predefined actions for the property panel fetched from the ActionsMgr
89   void setupActions(XGUI_ActionsMgr* theMgr);
90
91  public slots:
92
93    /// \brief Update all widgets in property panel with values from the given feature
94    /// \param theFeature a Feature to update values in widgets
95   void updateContentWidget(FeaturePtr theFeature);
96
97   /**
98   * Makes the given widget active, highlights it and removes
99   * highlighting from the previous active widget
100   * emits widgetActivated(theWidget) signal
101   * \param theWidget which has to be activated
102   */
103   virtual void activateWidget(ModuleBase_ModelWidget* theWidget);
104
105  private:
106   ModuleBase_PageWidget* myPanelPage;
107   QList<ModuleBase_ModelWidget*> myWidgets;
108
109   /// Currently active widget
110   ModuleBase_ModelWidget* myActiveWidget;
111 };
112
113 #endif /* XGUI_PROPERTYPANEL_H_ */