Salome HOME
Update copyrights 2014.
[samples/light.git] / src / LIGHTGUI / LIGHTGUI.h
index b27d4fb0415b3fa509b2529320f0f2be3b9f50cd..8ea67791b80cc2ad38d882b88f27da2b1b0a78bc 100644 (file)
@@ -1,64 +1,88 @@
-//  LIGHT : sample (no-corba-engine) SALOME module
+// Copyright (C) 2005-2014  OPEN CASCADE
 //
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// 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 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.
+// 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.
 //
-//  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
 //
-//  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
 //
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//  Author : Julia DOROVSKIKH
-//  Date   : 01/01/2005
-//  $Header$
 
+// LIGHT : sample (no-corba-engine) SALOME module
+// File   : LIGHTGUI.h
+// Author : Julia DOROVSKIKH
+//
 #ifndef LIGHTGUI_H
 #define LIGHTGUI_H
 
+#include "LIGHTGUI_Exports.hxx"
 #include <LightApp_Module.h>
 
-class LIGHTGUI: public LightApp_Module
+class QMenu;
+class LightApp_Selection;
+class LightApp_SelectionMgr;
+
+class LIGHT_EXPORT LIGHTGUI: public LightApp_Module
 {
   Q_OBJECT
-  enum { lgLoadFile = 931, lgSaveFile, lgDisplayLine, lgEditLine, lgAddLine, lgDelLine, lgClear };
+   
+  //! Menu actions
+  enum { 
+    lgLoadFile = 931,   //!< load text file
+    lgSaveFile,         //!< save text file
+    lgDisplayLine,      //!< display selected line
+    lgEraseLine,        //!< erase selected line
+    lgEditLine,         //!< edit selected line
+    lgAddLine,          //!< insert new line
+    lgDelLine,          //!< delete selected line
+    lgClear             //!< clear all contents
+  };
 
 public:
   LIGHTGUI();
+  ~LIGHTGUI();
+
+  void                   initialize( CAM_Application* );
 
-  virtual void           initialize ( CAM_Application* );
-  virtual void           contextMenuPopup ( const QString&, QPopupMenu*, QString& );
-  virtual void           windows ( QMap<int, int>& ) const;
+  void                   windows( QMap<int, int>& ) const;
+
+  LightApp_Selection*    createSelection() const;
+
+  bool                   renameObject( const QString&, const QString& );
+  bool                   renameAllowed( const QString& ) const;
 
 protected:
-  virtual CAM_DataModel* createDataModel();
+  CAM_DataModel*         createDataModel();
   int                    selectedLine();
 
+  void                   displayLine( const int, const bool = false, const bool = true );
+  void                   eraseLine( const int, const bool = false, const bool = true );
+  void                   updateLine( const int, const bool = false, const bool = true );
+  void                   eraseLines( const QList<int>&, const bool = false );
+  void                   updateLines( const QList<int>&, const bool = false );
+
 public slots:
-  virtual bool           activateModule   ( SUIT_Study* );
-  virtual bool           deactivateModule ( SUIT_Study* );
+  bool                   activateModule( SUIT_Study* );
+  bool                   deactivateModule( SUIT_Study* );
 
 private slots:
-  void onLoadFile();
-  void onSaveFile();
-  void onDisplayLine();
-  void onEditLine();
-  void onAddLine ();
-  void onDelLine ();
-  void onClear   ();
-
-private:
-  int anIndex;
+  void                   onLoadFile();
+  void                   onSaveFile();
+  void                   onDisplayLine();
+  void                   onEraseLine();
+  void                   onEditLine();
+  void                   onAddLine();
+  void                   onDelLine();
+  void                   onClear();
 };
 
 #endif // LIGHTGUI_H