Salome HOME
Issue #653 - Double and triple click edges -- Fix Debian dynamic_pointer_cast problem...
[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);
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   /// Removes all widgets in the widget area of the property panel
39   virtual void cleanContent() = 0;
40
41   /// Editing mode depends on mode of current operation. This value is defined by it.
42   /// \param isEditing state of editing mode flag
43   virtual void setEditingMode(bool isEditing) { myIsEditing = isEditing; }
44
45   /// \return State of editing mode flag
46   bool isEditingMode() const { return myIsEditing; }
47
48   /// Set Enable/Disable state of Cancel button
49   /// \param theEnabled Enable/Disable state of Cancel button
50   virtual void setCancelEnabled(bool theEnabled) = 0;
51
52   /// \return Enable/Disable state of Cancel button
53   virtual bool isCancelEnabled() const = 0;
54
55   /// Returns widget processed by preselection
56   virtual ModuleBase_ModelWidget* preselectionWidget() const = 0;
57
58   /// Sets widget processed by preselection
59   virtual void setPreselectionWidget(ModuleBase_ModelWidget* theWidget) = 0;
60
61 signals:
62   /// The signal about key release on the control, that corresponds to the attribute
63   /// \param theEvent key release event
64   void keyReleased(QKeyEvent* theEvent);
65
66   /// The signal about the widget activation
67   /// \param theWidget the activated widget
68   void beforeWidgetActivated(ModuleBase_ModelWidget* theWidget);
69
70   /// The signal about the widget activation
71   /// \param theWidget the activated widget
72   void widgetActivated(ModuleBase_ModelWidget* theWidget);
73
74   /// Emited when there is no next widget
75   void noMoreWidgets();
76
77 public slots:
78   /// Activate the next widget in the property panel
79   /// \param theWidget a widget. The next widget should be activated
80   virtual void activateNextWidget(ModuleBase_ModelWidget* theWidget) = 0;
81
82   /// Activate the next from current widget in the property panel
83   virtual void activateNextWidget() = 0;
84
85   /**
86   * Makes the given widget active, highlights it and removes
87   * highlighting from the previous active widget
88   * emits widgetActivated(theWidget) signal
89   * \param theWidget which has to be activated
90   */
91   virtual void activateWidget(ModuleBase_ModelWidget* theWidget) = 0;
92
93 protected:
94
95   /// Flag which shows that current operation is in editing mode
96   bool myIsEditing;
97 };
98
99 #endif