Salome HOME
Merge branch 'Dev_0.7.1' of newgeom:newgeom.git into Dev_0.7.1
[modules/shaper.git] / src / ModuleBase / ModuleBase_IPropertyPanel.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 /*
4  * ModuleBase_IPropertyPanel.h
5  *
6  *  Created on: Oct 01, 2014
7  *      Author: vsv
8  */
9
10 #ifndef ModuleBase_PROPERTYPANEL_H_
11 #define ModuleBase_PROPERTYPANEL_H_
12
13 #include "ModuleBase.h"
14
15 #include <QDockWidget>
16 #include <QKeyEvent>
17
18 class ModuleBase_ModelWidget;
19
20 /**
21 * \ingroup GUI
22 * A class for Property panel object definition
23 */
24 class MODULEBASE_EXPORT ModuleBase_IPropertyPanel : public QDockWidget
25 {
26 Q_OBJECT
27 public:
28   /// Constructor
29   /// \param theParent is a parent of the property panel
30   ModuleBase_IPropertyPanel(QWidget* theParent) : QDockWidget(theParent), myIsEditing(false) {}
31
32   /// Returns currently active widget
33   virtual ModuleBase_ModelWidget* activeWidget() const = 0;
34
35   /// Returns all property panel's widget created by WidgetFactory
36   virtual const QList<ModuleBase_ModelWidget*>& modelWidgets() const = 0;
37
38   /// Editing mode depends on mode of current operation. This value is defined by it.
39   /// \param isEditing state of editing mode flag
40   virtual void setEditingMode(bool isEditing) { myIsEditing = isEditing; }
41
42   /// \return State of editing mode flag
43   bool isEditingMode() const { return myIsEditing; }
44
45   /// Set Enable/Disable state of Cancel button
46   /// \param theEnabled Enable/Disable state of Cancel button
47   virtual void setCancelEnabled(bool theEnabled) = 0;
48
49   /// \return Enable/Disable state of Cancel button
50   virtual bool isCancelEnabled() const = 0;
51
52 signals:
53   /// The signal about key release on the control, that corresponds to the attribute
54   /// \param theEvent key release event
55   void keyReleased(QKeyEvent* theEvent);
56
57   /// The signal about the widget activation
58   /// \param theWidget the activated widget
59   void beforeWidgetActivated(ModuleBase_ModelWidget* theWidget);
60
61   /// The signal about the widget activation
62   /// \param theWidget the activated widget
63   void widgetActivated(ModuleBase_ModelWidget* theWidget);
64
65   /// Emited when there is no next widget
66   void noMoreWidgets();
67
68 public slots:
69   /// Activate the next widget in the property panel
70   /// \param theWidget a widget. The next widget should be activated
71   virtual void activateNextWidget(ModuleBase_ModelWidget* theWidget) = 0;
72
73   /// Activate the next from current widget in the property panel
74   virtual void activateNextWidget() = 0;
75
76   /**
77   * Makes the given widget active, highlights it and removes
78   * highlighting from the previous active widget
79   * emits widgetActivated(theWidget) signal
80   * \param theWidget which has to be activated
81   */
82   virtual void activateWidget(ModuleBase_ModelWidget* theWidget) = 0;
83
84 protected:
85
86   /// Flag which shows that current operation is in editing mode
87   bool myIsEditing;
88 };
89
90 #endif