OpenWalnut  1.5.0dev
WOnscreenSelectionHandler.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WONSCREENSELECTIONHANDLER_H
26 #define WONSCREENSELECTIONHANDLER_H
27 
28 #include <osg/Viewport>
29 #include <osgGA/GUIEventHandler>
30 #include <osgViewer/Viewer>
31 
32 #include "WOnscreenSelection.h"
33 
34 /**
35  * Forward declaration of the WOnscreenSelection.
36  */
37 class WOnscreenSelection;
38 
39 /**
40  * Handles the GUIEvents in context of the WOnscreenSelection.
41  */
42 class WOnscreenSelectionHandler : public osgGA::GUIEventHandler
43 {
44 public:
45  /**
46  * Construct a new WDrawHandler object.
47  *
48  * \param manager The WOnscreenSelection this belongs to.
49  */
50  explicit WOnscreenSelectionHandler( WOnscreenSelection* manager );
51 
52  /**
53  * Handles the incoming events.
54  *
55  * \param ea The EventAdapter of the event.
56  * \param aa The ActionAdapter of the event.
57  * \return true Don't propagate the event.
58  * \return false Propagate the event.
59  */
60  bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa );
61 
62 private:
63  WOnscreenSelection* m_manager; //!< The WOnscreenSelection this belongs to.
64 
65  bool m_mousePressed; //!< Whether the mouse is pressed or not.
66  bool m_shiftPressed; //!< Whether shift is pressed or not.
67 };
68 
69 #endif // WONSCREENSELECTIONHANDLER_H
Handles the GUIEvents in context of the WOnscreenSelection.
bool m_shiftPressed
Whether shift is pressed or not.
bool m_mousePressed
Whether the mouse is pressed or not.
WOnscreenSelection * m_manager
The WOnscreenSelection this belongs to.
bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa)
Handles the incoming events.
WOnscreenSelectionHandler(WOnscreenSelection *manager)
Construct a new WDrawHandler object.
Manages different types of selection.