MouseInterface.hh 3.63 KB
Newer Older
Jan Möbius's avatar
 
Jan Möbius committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
//=============================================================================
//
//                               OpenFlipper
//        Copyright (C) 2008 by Computer Graphics Group, RWTH Aachen
//                           www.openflipper.org
//
//-----------------------------------------------------------------------------
//
//                                License
//
//  OpenFlipper is free software: you can redistribute it and/or modify
//  it under the terms of the GNU Lesser General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
Jan Möbius's avatar
Jan Möbius committed
15
//
Jan Möbius's avatar
 
Jan Möbius committed
16 17 18 19
//  OpenFlipper is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU Lesser General Public License for more details.
Jan Möbius's avatar
Jan Möbius committed
20
//
Jan Möbius's avatar
 
Jan Möbius committed
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
//  You should have received a copy of the GNU Lesser General Public License
//  along with OpenFlipper.  If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
//
//   $Revision$
//   $Author$
//   $Date$
//
//=============================================================================




//
// C++ Interface: Basic Interface for mouse events
//
Jan Möbius's avatar
Jan Möbius committed
38
// Description:
Jan Möbius's avatar
 
Jan Möbius committed
39 40 41 42 43 44
//
//
// Author: Jan Moebius <moebius@informatik.rwth-aachen.de>, (C) 2007



Jan Möbius's avatar
Jan Möbius committed
45 46
#ifndef MOUSEINTERFACE_HH
#define MOUSEINTERFACE_HH
Jan Möbius's avatar
 
Jan Möbius committed
47 48

 #include <QtGui>
Jan Möbius's avatar
Jan Möbius committed
49 50 51 52

/** \brief Interface for all plugins which have to react on mouse events
  *
  * When using mouse events in your plugins implement this interface. Remember that
Jan Möbius's avatar
 
Jan Möbius committed
53
  * all plugins may get these signals. Therefore you hav to check if the current pickingMode
Jan Möbius's avatar
Jan Möbius committed
54 55 56
  * you want to react on is active before doing anything. Only the slotMouseEventIdentify is
  * independent of picking modes.
  *
57
  * The slotMouseWheelEvent and slotMouseEvent only get called when the system is in picking
Jan Möbius's avatar
Jan Möbius committed
58 59 60
  * mode.
  *
  * slotMouseEventIdentify will be used when question mode is active.
61 62 63
  *
  * See our tutorial \ref ex3 for an example of how to use mouse and keyboard events
  * within a plugin.
Jan Möbius's avatar
Jan Möbius committed
64
  */
Jan Möbius's avatar
 
Jan Möbius committed
65
class MouseInterface {
Jan Möbius's avatar
Jan Möbius committed
66

Jan Möbius's avatar
 
Jan Möbius committed
67
  private slots :
Jan Möbius's avatar
Jan Möbius committed
68

Jan Möbius's avatar
 
Jan Möbius committed
69
    /**  \brief Wheel Event from Main App
Jan Möbius's avatar
Jan Möbius committed
70
      *
Jan Möbius's avatar
 
Jan Möbius committed
71 72
      *  This slot is called if a wheel event occured in the Viewer and is extended by
      *  the current Mode set in the Viewer. You can add additional Picking Modes to
Jan Möbius's avatar
Jan Möbius committed
73
      *  the Viewer by using the picking interface.
Jan Möbius's avatar
 
Jan Möbius committed
74 75 76 77
      *  This slot will only get called in pickingMode.
      *  @param _event Mousevent
      *  @param _mode Name of the current Picking Mode.
    */
Dirk Wilden's avatar
Dirk Wilden committed
78
    virtual void slotMouseWheelEvent(QWheelEvent * /*_event*/, const std::string & /*_mode*/) {};
Jan Möbius's avatar
Jan Möbius committed
79

Jan Möbius's avatar
 
Jan Möbius committed
80
    /**  \brief Mouse Event from Main App ( Picking Mode )
Jan Möbius's avatar
Jan Möbius committed
81 82 83
      *
      *  This slot is called if a mouse event occured in the Viewer
      *  This slot will only get called in pickingMode.
Jan Möbius's avatar
 
Jan Möbius committed
84
      *  Right button clicks will not be passed to the plugins as this is reserved for
Jan Möbius's avatar
Jan Möbius committed
85 86
      *  the context Menu.
      *
Jan Möbius's avatar
 
Jan Möbius committed
87 88
      *  @param _event Mousevent
    */
Dirk Wilden's avatar
Dirk Wilden committed
89
    virtual void slotMouseEvent( QMouseEvent* /*_event*/ ) {};
Jan Möbius's avatar
Jan Möbius committed
90

Jan Möbius's avatar
 
Jan Möbius committed
91
    /**  \brief Mouse Event from Main App ( Identify Mode )
Jan Möbius's avatar
Jan Möbius committed
92 93 94
      *
      *  This slot is called if a mouse event occured in the Viewer
      *  This slot will only get called in identifyMode.
Jan Möbius's avatar
 
Jan Möbius committed
95
      *  Right button clicks will not be passed to the plugins as this is reserved for
Jan Möbius's avatar
Jan Möbius committed
96 97
      *  the context Menu.
      *
Jan Möbius's avatar
 
Jan Möbius committed
98
      *  @param _event Mousevent
Jan Möbius's avatar
Jan Möbius committed
99
    */
Jan Möbius's avatar
 
Jan Möbius committed
100
    virtual void slotMouseEventIdentify() {};
Jan Möbius's avatar
Jan Möbius committed
101 102 103

  public :

Jan Möbius's avatar
 
Jan Möbius committed
104 105
    /// Destructor
    virtual ~MouseInterface() {};
Jan Möbius's avatar
Jan Möbius committed
106

Jan Möbius's avatar
 
Jan Möbius committed
107 108 109
};

Q_DECLARE_INTERFACE(MouseInterface,"OpenFlipper.MouseInterface/1.0")
Jan Möbius's avatar
Jan Möbius committed
110

Jan Möbius's avatar
 
Jan Möbius committed
111
#endif // MOUSEINTERFACE_HH