Salome HOME
New item (FontItem), allowing to show information about font setting and to select...
[modules/gui.git] / src / GLViewer / GLViewer_Selector.h
1 // File:      GLViewer_Selector.h
2 // Created:   November, 2004
3 // Author:    OCC team
4 // Copyright (C) CEA 2004
5
6 /****************************************************************************
7 **  Class:   GLViewer_Selector
8 **  Descr:   Base class for object selection in QAD-based application
9 **  Module:  GLViewer
10 **  Created: UI team, 22.09.00
11 *****************************************************************************/
12 #ifndef GLVIEWER_SELECTOR_H
13 #define GLVIEWER_SELECTOR_H
14
15 #include "GLViewer.h"
16 #include "GLViewer_Defs.h"
17
18 #include <qsize.h>
19 #include <qobject.h>
20
21 #include <Quantity_NameOfColor.hxx>
22
23 class GLViewer_Viewer;
24
25 /*! Class GLViewer_Selector
26 *   Based select manager for GLViewer
27 */
28
29 class GLVIEWER_API GLViewer_Selector : public QObject
30 {
31     Q_OBJECT
32
33 public:
34     GLViewer_Selector( GLViewer_Viewer* );
35     ~GLViewer_Selector();
36
37 public:
38     //! Sets lock status (enable/disable interavtive)
39     void                  lock( bool );
40     void                  setMinRectSize( const QSize& minSize );
41
42     //! Highlights in point (x,y)
43     virtual void          detect( int x, int y ) = 0;    
44     virtual void          undetectAll() = 0;
45
46     //! Selects highlight objects
47     virtual void          select( bool append = false ) = 0;
48     //! Selects by rect
49     virtual void          select( const QRect&, bool append = false ) = 0;
50     virtual void          unselectAll() = 0;
51     virtual int           numSelected() const = 0;
52
53     virtual void          setHilightColor( Quantity_NameOfColor ) = 0;
54     virtual void          setSelectColor( Quantity_NameOfColor ) = 0;
55     //!Checks selection state and emits  'selSelectionDone' or 'selSelectionCancel'     
56     /*!Should be called by after non-interactive selection. */
57     virtual void          checkSelection( int, bool, int ) = 0;
58
59     /*! Sets/returns the key for appending selected objects ( SHIFT by default ) */
60     static int            appendKey() { return apppendKey; }
61     static void           setAppendKey( int k ) { apppendKey = k; }
62
63 signals:
64     void                  selSelectionCancel();
65     void                  selSelectionDone( bool append, SelectionChangeStatus status );
66
67 protected:
68 //    void                  setStatus( SelectionChangeStatus theStatus ){ myStatus = theStatus; }
69 //    SelectionChangeStatus status( return myStatus; }
70
71     GLViewer_Viewer*      myViewer;
72     bool                  myLocked;
73     QSize                 myMinRectSize;
74
75 private:
76 //    SelectionChangeStatus myStatus;
77     static int            apppendKey;
78 };
79
80 #endif