Salome HOME
This file is given from DESCARTES project
[modules/gui.git] / src / GLViewer / GLViewer_Selector2d.h
1 //  Copyright (C) 2005 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.
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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
18 //
19 //  Author : OPEN CASCADE
20 //
21
22 // File:      GLViewer_Selector2d.h
23 // Created:   November, 2004
24
25 /****************************************************************************
26 **  Class:   GLViewer_Selector2d 
27 **  Descr:   OpenGL Selector 2D
28 **  Module:  GLViewer
29 **  Created: UI team, 20.09.02
30 *****************************************************************************/
31 #ifndef GLVIEWER_SELECTOR2D_H
32 #define GLVIEWER_SELECTOR2D_H
33
34 #ifdef WNT
35 #include "windows.h"
36 #endif
37
38 #include "GLViewer_Selector.h"
39
40 #include <Quantity_NameOfColor.hxx>
41
42 class GLViewer_Viewer2d;
43 class GLViewer_Context;
44
45 /*! Class GLViewer_Selector2d
46 *   2D select manager for GLViewer
47 */
48 class GLVIEWER_API GLViewer_Selector2d : public GLViewer_Selector
49 {
50   Q_OBJECT
51
52 public:
53   GLViewer_Selector2d( GLViewer_Viewer2d*, GLViewer_Context* );
54   ~GLViewer_Selector2d();
55
56 public:
57   //! Sets context from Viewer2d
58   void                    setContext( GLViewer_Context* glc ) { myGLContext = glc; }
59   GLViewer_Context*       getContext() const { return myGLContext; }
60
61   // Redefined methods
62   virtual void            setHilightColor( Quantity_NameOfColor );
63   virtual void            setSelectColor( Quantity_NameOfColor );
64
65   virtual void            detect( int, int );
66   virtual void            undetectAll();
67
68   virtual void            select( bool append = false );
69   virtual void            select( const QRect&, bool append = false );    
70   virtual void            unselectAll();    
71   virtual int             numSelected() const;    
72
73   virtual void            checkSelection( int, bool, int );
74
75 protected:
76   GLViewer_Context*       myGLContext;
77 };
78
79 #endif