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