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