Salome HOME
Update copyrights 2014.
[samples/light.git] / src / LIGHTGUI / LIGHTGUI.h
1 // Copyright (C) 2005-2014  OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // LIGHT : sample (no-corba-engine) SALOME module
21 // File   : LIGHTGUI.h
22 // Author : Julia DOROVSKIKH
23 //
24 #ifndef LIGHTGUI_H
25 #define LIGHTGUI_H
26
27 #include "LIGHTGUI_Exports.hxx"
28 #include <LightApp_Module.h>
29
30 class QMenu;
31 class LightApp_Selection;
32 class LightApp_SelectionMgr;
33
34 class LIGHT_EXPORT LIGHTGUI: public LightApp_Module
35 {
36   Q_OBJECT
37    
38   //! Menu actions
39   enum { 
40     lgLoadFile = 931,   //!< load text file
41     lgSaveFile,         //!< save text file
42     lgDisplayLine,      //!< display selected line
43     lgEraseLine,        //!< erase selected line
44     lgEditLine,         //!< edit selected line
45     lgAddLine,          //!< insert new line
46     lgDelLine,          //!< delete selected line
47     lgClear             //!< clear all contents
48   };
49
50 public:
51   LIGHTGUI();
52   ~LIGHTGUI();
53
54   void                   initialize( CAM_Application* );
55
56   void                   windows( QMap<int, int>& ) const;
57
58   LightApp_Selection*    createSelection() const;
59
60   bool                   renameObject( const QString&, const QString& );
61   bool                   renameAllowed( const QString& ) const;
62
63 protected:
64   CAM_DataModel*         createDataModel();
65   int                    selectedLine();
66
67   void                   displayLine( const int, const bool = false, const bool = true );
68   void                   eraseLine( const int, const bool = false, const bool = true );
69   void                   updateLine( const int, const bool = false, const bool = true );
70   void                   eraseLines( const QList<int>&, const bool = false );
71   void                   updateLines( const QList<int>&, const bool = false );
72
73 public slots:
74   bool                   activateModule( SUIT_Study* );
75   bool                   deactivateModule( SUIT_Study* );
76
77 private slots:
78   void                   onLoadFile();
79   void                   onSaveFile();
80   void                   onDisplayLine();
81   void                   onEraseLine();
82   void                   onEditLine();
83   void                   onAddLine();
84   void                   onDelLine();
85   void                   onClear();
86 };
87
88 #endif // LIGHTGUI_H