Salome HOME
Merge branch 'master' of newgeom:newgeom.git into BR_PYTHON_PLUGIN
[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 class XGUI_EXPORT XGUI_PropertyPanel : public ModuleBase_IPropertyPanel
22 {
23 Q_OBJECT
24  public:
25   XGUI_PropertyPanel(QWidget* theParent);
26   virtual ~XGUI_PropertyPanel();
27
28   /// Returns main widget of the property panel, which children will be created
29   /// by WidgetFactory using the XML definition
30   QWidget* contentWidget();
31
32   /// Brings back all widget created by widget factory for signal/slot
33   /// connections and further processing
34   void setModelWidgets(const QList<ModuleBase_ModelWidget*>& theWidgets);
35
36   /// Returns all property panel's widget created by WidgetFactory
37   virtual const QList<ModuleBase_ModelWidget*>& modelWidgets() const;
38
39   /// Removes all widgets in the widget area of the property panel
40   void cleanContent();
41
42   /// Returns currently active widget
43   virtual ModuleBase_ModelWidget* activeWidget() const { return myActiveWidget; }
44
45   /// Activate the next widget in the property panel
46   /// \param theWidget a widget. The next widget should be activated
47   virtual void activateNextWidget(ModuleBase_ModelWidget* theWidget);
48
49   /// Activate the next from current widget in the property panel
50   virtual void activateNextWidget();
51
52  public slots:
53   void updateContentWidget(FeaturePtr theFeature);
54   // Enables / disables "ok" ("accept") button
55   void setAcceptEnabled(bool);
56
57  protected slots:
58   // Makes the given widget active, highlights it and removes
59   // highlighting from the previous active widget
60   // emits widgetActivated(theWidget) signal
61   void activateWidget(ModuleBase_ModelWidget* theWidget);
62
63  signals:
64   /// Signal about the point 2d set to the feature
65   /// \param the feature
66   /// \param the attribute of the feature
67   void storedPoint2D(ObjectPtr theFeature, const std::string& theAttribute);
68
69
70  private:
71   QWidget* myCustomWidget;
72   QList<ModuleBase_ModelWidget*> myWidgets;
73   QVBoxLayout* myMainLayout;
74   ModuleBase_ModelWidget* myActiveWidget;
75 };
76
77 #endif /* XGUI_PROPERTYPANEL_H_ */