Salome HOME
Issue #273: A package AppElements is added to store sources which are not used in...
[modules/shaper.git] / src / XGUI / XGUI_PropertyPanel.h
1 /*
2  * XGUI_PropertyPanel.h
3  *
4  *  Created on: Apr 29, 2014
5  *      Author: sbh
6  */
7
8 #ifndef XGUI_PROPERTYPANEL_H_
9 #define XGUI_PROPERTYPANEL_H_
10
11 #include "XGUI.h"
12
13 #include <ModuleBase_ModelWidget.h>
14 #include <ModuleBase_IPropertyPanel.h>
15
16 #include <QList>
17
18 class QKeyEvent;
19 class QVBoxLayout;
20
21 const static char* PROP_PANEL = "property_panel_dock";
22 const static char* PROP_PANEL_OK = "property_panel_ok";
23 const static char* PROP_PANEL_CANCEL = "property_panel_cancel";
24
25 class XGUI_EXPORT XGUI_PropertyPanel : public ModuleBase_IPropertyPanel
26 {
27 Q_OBJECT
28  public:
29
30
31   XGUI_PropertyPanel(QWidget* theParent);
32   virtual ~XGUI_PropertyPanel();
33
34   /// Returns main widget of the property panel, which children will be created
35   /// by WidgetFactory using the XML definition
36   QWidget* contentWidget();
37
38   /// Brings back all widget created by widget factory for signal/slot
39   /// connections and further processing
40   void setModelWidgets(const QList<ModuleBase_ModelWidget*>& theWidgets);
41
42   /// Returns all property panel's widget created by WidgetFactory
43   virtual const QList<ModuleBase_ModelWidget*>& modelWidgets() const;
44
45   /// Removes all widgets in the widget area of the property panel
46   void cleanContent();
47
48   /// Returns currently active widget
49   virtual ModuleBase_ModelWidget* activeWidget() const { return myActiveWidget; }
50
51   /// Activate the next widget in the property panel
52   /// \param theWidget a widget. The next widget should be activated
53   virtual void activateNextWidget(ModuleBase_ModelWidget* theWidget);
54
55   /// Activate the next from current widget in the property panel
56   virtual void activateNextWidget();
57
58   void setStretchEnabled(bool isEnabled);
59
60  public slots:
61   void updateContentWidget(FeaturePtr theFeature);
62   // Enables / disables "ok" ("accept") button
63   void setAcceptEnabled(bool);
64
65   // Makes the given widget active, highlights it and removes
66   // highlighting from the previous active widget
67   // emits widgetActivated(theWidget) signal
68   virtual void activateWidget(ModuleBase_ModelWidget* theWidget);
69
70  signals:
71   /// Signal about the point 2d set to the feature
72   /// \param the feature
73   /// \param the attribute of the feature
74   //void storedPoint2D(ObjectPtr theFeature, const std::string& theAttribute);
75
76
77  private:
78   QWidget* myCustomWidget;
79   QList<ModuleBase_ModelWidget*> myWidgets;
80   QVBoxLayout* myMainLayout;
81   ModuleBase_ModelWidget* myActiveWidget;
82 };
83
84 #endif /* XGUI_PROPERTYPANEL_H_ */