Salome HOME
Copyright update 2022
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetExprEditor.h
index eb2ff9aa1e1d861f68b164aa0e3efc207e30d452..5fad4d76a1592f2e35da06816f45627a4ee4704e 100644 (file)
@@ -1,11 +1,21 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-/*
- * ModuleBase_WidgetExprEditor.h
- *
- *  Created on: Oct 8, 2014
- *      Author: sbh
- */
+// Copyright (C) 2014-2022  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
 
 #ifndef MODULEBASE_WIDGETEXPREDITOR_H_
 #define MODULEBASE_WIDGETEXPREDITOR_H_
@@ -45,12 +55,6 @@ class ExpressionEditor: public QPlainTextEdit
   /// Returns placeholder list
   QString placeHolderText() const;
 
-  // Returns true if the current value is modified by has not been applyed yet
-  bool isModified() const;
-
-  // Clears modified state
-  void clearModified();
-
  public slots:
   /// Insert additional string for completion
   /// \param theCompletion a string to insert
@@ -64,15 +68,13 @@ class ExpressionEditor: public QPlainTextEdit
   void onTextChanged();
 
 signals:
-  void editingFinished();
+  /// The signal about text change in the text editor
   void valueModified();
-  /// A signal that is emitted by the "Tab" key event. It is emitted before the key is processed.
-  void valueStored();
-  void focusNextPrev();
 
   /// The signal about key release on the control, that corresponds to the attribute
+  /// \param theObject a sender of the event
   /// \param theEvent key release event
-  void keyReleased(QKeyEvent* theEvent);
+  void keyReleased(QObject* theObject, QKeyEvent* theEvent);
 
  protected:
   /// Perform completion by prefix
@@ -90,19 +92,11 @@ signals:
   /// Redefinition of virtual method
   virtual void paintEvent( QPaintEvent* );
 
-  /// The parent method that processes the "Tab"/"SHIF + Tab" keyboard events
-  /// Emits a signal about focus change
-  /// If theIsNext is true, this function searches forward, if next is false, it searches backward.
-  virtual bool focusNextPrevChild(bool theIsNext);
-
- private:
+private:
   QStringListModel* myCompleterModel;
   QCompleter* myCompleter;
   bool myCompletedAndSelected;
   QString myPlaceHolderText;
-
-  /// Boolean value whether the spin box content is modified
-  bool myIsModified;
 };
 
 /**
@@ -116,28 +110,32 @@ class MODULEBASE_EXPORT ModuleBase_WidgetExprEditor : public ModuleBase_ModelWid
   /// Constructor
   /// \param theParent the parent object
   /// \param theData the widget configuration.
-  /// \param theParentId is Id of a parent of the current attribute
   /// \param thePlaceHolder a placeholder string
   ModuleBase_WidgetExprEditor( QWidget* theParent,
                                const Config_WidgetAPI* theData,
-                               const std::string& theParentId,
                                const std::string& thePlaceHolder );
   virtual ~ModuleBase_WidgetExprEditor();
 
+  /// The methiod called when widget is activated
+  virtual void activateCustom();
+
   /// Redefinition of virtual method
   virtual QList<QWidget*> getControls() const;
 
-  /// Returns true if the event is processed.
-  virtual bool processEnter();
-
 protected slots:
   /// A slot for processing text changed event
   void onTextChanged();
 
 protected:
+  /// Returns true if the event is processed.
+  virtual bool processEnter();
+
+  /// Do not initialize value on the widget activation
+  virtual void initializeValueByActivate();
+
   /// Saves the internal parameters to the given feature
   /// \return True in success
-  virtual bool storeValueCustom() const;
+  virtual bool storeValueCustom();
 
   /// Redefinition of virtual method
   virtual bool restoreValueCustom();