]> SALOME platform Git repositories - modules/superv.git/blob - src/SUPERVGUI/SUPERVGUI_Clipboard.h
Salome HOME
bcefab4377680b8f908fc1c8b7849688d6d9775c
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI_Clipboard.h
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  SUPERV SUPERVGUI : GUI for Supervisor component
23 //  File   : SUPERVGUI_Clipboard.h
24 //  Author : Alexander SLADKOV
25 //  Module : SUPERV
26 //
27 #ifndef SUPERVGUI_Clipboard_H
28 #define SUPERVGUI_Clipboard_H
29
30 #include <qobject.h>
31
32 #include "utilities.h"
33 #include "SALOME_LifeCycleCORBA.hxx"
34 #include "SUIT_Session.h"
35 #include "SUIT_Desktop.h"
36 #include CORBA_CLIENT_HEADER(SUPERV)
37
38 class SUPERVGUI_CanvasNode;
39
40 class SUPERVGUI_Clipboard : public QObject {
41
42 Q_OBJECT
43
44 protected:
45   // constructor made protected.  Access via getClipboard() member function.
46   SUPERVGUI_Clipboard( QObject* parent );
47   virtual ~SUPERVGUI_Clipboard();
48
49 public:
50
51   static SUPERVGUI_Clipboard* getClipboard() {
52     if ( !myCB )
53       myCB = new SUPERVGUI_Clipboard( SUIT_Session::session()->activeApplication()->desktop() );
54     return myCB;
55   }
56
57   static void setNullClipboard() {
58     if ( myCB ) myCB = 0;
59   }
60
61   bool isCopyPort() const { return ( myCopyPort && !CORBA::is_nil( myCopyPort ) ); }
62   SUPERV::Port_var getCopyPort() const            { return myCopyPort;   }
63   void setCopyPort( SUPERV::Port_var theObj )     { myCopyPort = theObj; }
64
65   bool isCopyNode() const { return ( myCopyNode && !CORBA::is_nil( myCopyNode ) ); }
66   SUPERV::CNode_var getCopyNode() const           { return myCopyNode;   }
67   void setCopyNode( SUPERV::CNode_var theObj )    { myCopyNode = theObj; }
68
69 public slots:
70   void pasteNode();
71   void pastePort( SUPERVGUI_CanvasNode* node );
72
73 private:
74   static SUPERVGUI_Clipboard* myCB;
75
76   SUPERV::Port_var        myCopyPort;
77   SUPERV::CNode_var       myCopyNode;
78   int                     myXCopyNode;
79   int                     myYCopyNode;
80 };
81
82 #endif