Salome HOME
Issue #273: Add copyright string
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetEditor.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModuleBase_WidgetEditor.h
4 // Created:     25 Apr 2014
5 // Author:      Natalia ERMOLAEVA
6
7 #ifndef ModuleBase_WidgetEditor_H
8 #define ModuleBase_WidgetEditor_H
9
10 #include <ModuleBase.h>
11 #include "ModuleBase_WidgetDoubleValue.h"
12
13 #include <QObject>
14 #include <QStringList>
15
16 class ModelAPI_Feature;
17 class QLineEdit;
18
19 /**\class ModuleBase_WidgetEditor
20  * \ingroup GUI
21  * \brief Custom widget. An abstract class to be redefined to fill with some GUI controls
22  */
23 class MODULEBASE_EXPORT ModuleBase_WidgetEditor : public ModuleBase_WidgetDoubleValue
24 {
25 Q_OBJECT
26  public:
27   /// Constructor
28   /// \theParent the parent object
29   /// \theParent the parent object
30   /// \theData the widget configuation. The attribute of the model widget is obtained from
31   ModuleBase_WidgetEditor(QWidget* theParent, const Config_WidgetAPI* theData,
32                           const std::string& theParentId);
33   /// Constructor
34   /// \theParent the parent object
35   /// \theParent the parent object
36   /// \theData the widget configuation. The attribute of the model widget is obtained from
37   ModuleBase_WidgetEditor(QWidget* theParent, const std::string& theAttribute);
38
39   /// Destructor
40   virtual ~ModuleBase_WidgetEditor();
41
42   /// Set focus to the first control of the current widget. The focus policy of the control is checked.
43   /// If the widget has the NonFocus focus policy, it is skipped.
44   /// \return the state whether the widget can accept the focus
45   virtual bool focusTo();
46
47   /// Creates an editor for the real value and set the new value to the feature
48   /// \param theFeature the model feature
49   /// \param theAttribute the feature attribute
50   static void editFeatureValue(FeaturePtr theFeature, const std::string theAttribute);
51
52  private slots:
53    /// Shous popup window under cursor for data editing
54    void showPopupEditor();
55
56  private:
57   FeaturePtr myFeature;  ///< the current widget feature
58   QStringList myFeatureKinds;  ///< the kinds of possible features
59 };
60
61 #endif