Salome HOME
Issue #1648: Dump Python in the High Level Parameterized Geometry API
[modules/shaper.git] / src / ModuleBase / ModuleBase_DoubleSpinBox.h
index 87cbe6e84e665075d2fe425b3cafbd8834b9a4af..c26d17f038ecc4627ca46c3f128ea8bb5c9a93f6 100644 (file)
@@ -11,6 +11,9 @@
 #include <QDoubleSpinBox>
 #include <QValidator>
 
+#include <QColor>
+
+class QKeyEvent;
 
 /**
 * \ingroup GUI
@@ -48,6 +51,19 @@ Q_OBJECT
   /// Validate current value
   virtual QValidator::State validate(QString&, int&) const;
 
+  /// Change enable/disable internal state to emit key press event
+  /// \param theEnable if true, the signal is emitted
+  /// \return the previous value
+  bool enableKeyPressEvent(const bool& theEnable);
+
+  /// Imitation of disable control value. If theEnable is false, the control becomes
+  /// read only and base color is disabled. 
+  void setValueEnabled(const bool& theEnable);
+
+signals:
+  /// The signal about key release on the control, that corresponds to the attribute
+  void enterReleased();
+
  protected slots:
    /// Called on text changed
   virtual void onTextChanged(const QString&);
@@ -55,13 +71,24 @@ Q_OBJECT
  protected:
    /// Removes extra trailing zero symbols
   QString removeTrailingZeroes(const QString&) const;
+  /// Called on key press event
+  virtual void keyReleaseEvent(QKeyEvent* theEvent);
+
+  /// Called on key press event
+  virtual void keyPressEvent(QKeyEvent* theEvent);
 
  private:
+  // boolen flag whether the key event is emitted. The default value is false
+  bool myIsEmitKeyPressEvent;
+
    /// Is clear flag
   bool myCleared;
 
   /// Precision value
   int myPrecision;
+
+  /// Cashed color of active base palette
+  QColor myEnabledBaseColor;
 };
 
 #endif