Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[modules/gui.git] / src / GLViewer / GLViewer_Selector.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.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 //  Author : OPEN CASCADE
20 //
21
22 // File:      GLViewer_Selector.h
23 // Created:   November, 2004
24
25 #ifndef GLVIEWER_SELECTOR_H
26 #define GLVIEWER_SELECTOR_H
27
28 #include "GLViewer.h"
29 #include "GLViewer_Defs.h"
30
31 #include <qsize.h>
32 #include <qobject.h>
33
34 #include <Quantity_NameOfColor.hxx>
35
36 class GLViewer_Viewer;
37
38 /*!
39   \Class GLViewer_Selector
40   Base class for object selection in SUIT-based application
41 */
42 class GLVIEWER_API GLViewer_Selector : public QObject
43 {
44     Q_OBJECT
45
46 public:
47     GLViewer_Selector( GLViewer_Viewer* );
48     ~GLViewer_Selector();
49
50 public:
51     //! Sets lock status (enable/disable interavtive)
52     void                  lock( bool );
53     void                  setMinRectSize( const QSize& minSize );
54
55     //! Highlights in point (x,y)
56     virtual void          detect( int x, int y ) = 0;    
57     virtual void          undetectAll() = 0;
58
59     //! Selects highlight objects
60     virtual void          select( bool append = false ) = 0;
61     //! Selects by rect
62     virtual void          select( const QRect&, bool append = false ) = 0;
63     virtual void          unselectAll() = 0;
64     virtual int           numSelected() const = 0;
65
66     virtual void          setHilightColor( Quantity_NameOfColor ) = 0;
67     virtual void          setSelectColor( Quantity_NameOfColor ) = 0;
68     //!Checks selection state and emits  'selSelectionDone' or 'selSelectionCancel'     
69     /*!Should be called by after non-interactive selection. */
70     virtual void          checkSelection( int, bool, int ) = 0;
71
72     /*! Sets/returns the key for appending selected objects ( SHIFT by default ) */
73     static int            appendKey() { return apppendKey; }
74     static void           setAppendKey( int k ) { apppendKey = k; }
75
76 signals:
77     void                  selSelectionCancel();
78     void                  selSelectionDone( bool append, SelectionChangeStatus status );
79
80 protected:
81 //    void                  setStatus( SelectionChangeStatus theStatus ){ myStatus = theStatus; }
82 //    SelectionChangeStatus status( return myStatus; }
83
84     GLViewer_Viewer*      myViewer;
85     bool                  myLocked;
86     QSize                 myMinRectSize;
87
88 private:
89 //    SelectionChangeStatus myStatus;
90     static int            apppendKey;
91 };
92
93 #endif