MouseInterface.hh 5.43 KB
Newer Older
1 2 3
/*===========================================================================*\
 *                                                                           *
 *                              OpenFlipper                                  *
Jan Möbius's avatar
Jan Möbius committed
4
 *      Copyright (C) 2001-2010 by Computer Graphics Group, RWTH Aachen      *
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
 *                           www.openflipper.org                             *
 *                                                                           *
 *---------------------------------------------------------------------------*
 *  This file is part of OpenFlipper.                                        *
 *                                                                           *
 *  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 with the              *
 *  following exceptions:                                                    *
 *                                                                           *
 *  If other files instantiate templates or use macros                       *
 *  or inline functions from this file, or you compile this file and         *
 *  link it with other files to produce an executable, this file does        *
 *  not by itself cause the resulting executable to be covered by the        *
 *  GNU Lesser General Public License. This exception does not however       *
 *  invalidate any other reasons why the executable file might be            *
 *  covered by the GNU Lesser General Public License.                        *
 *                                                                           *
 *  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.                      *
 *                                                                           *
 *  You should have received a copy of the GNU LesserGeneral Public          *
 *  License along with OpenFlipper. If not,                                  *
 *  see <http://www.gnu.org/licenses/>.                                      *
 *                                                                           *
\*===========================================================================*/

/*===========================================================================*\
 *                                                                           *
 *   $Revision$                                                         *
 *   $Author$                                                      *
 *   $Date$                   *
 *                                                                           *
\*===========================================================================*/
Jan Möbius's avatar
 
Jan Möbius committed
42 43 44 45 46 47 48




//
// C++ Interface: Basic Interface for mouse events
//
Jan Möbius's avatar
Jan Möbius committed
49
// Description:
Jan Möbius's avatar
 
Jan Möbius committed
50 51 52 53 54 55
//
//
// Author: Jan Moebius <moebius@informatik.rwth-aachen.de>, (C) 2007



Jan Möbius's avatar
Jan Möbius committed
56 57
#ifndef MOUSEINTERFACE_HH
#define MOUSEINTERFACE_HH
Jan Möbius's avatar
 
Jan Möbius committed
58 59

 #include <QtGui>
Jan Möbius's avatar
Jan Möbius committed
60 61 62 63

/** \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
64
  * all plugins may get these signals. Therefore you hav to check if the current pickingMode
Jan Möbius's avatar
Jan Möbius committed
65 66 67
  * you want to react on is active before doing anything. Only the slotMouseEventIdentify is
  * independent of picking modes.
  *
68
  * The slotMouseWheelEvent and slotMouseEvent only get called when the system is in picking
Jan Möbius's avatar
Jan Möbius committed
69 70 71
  * mode.
  *
  * slotMouseEventIdentify will be used when question mode is active.
72 73 74
  *
  * 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
75
  */
Jan Möbius's avatar
 
Jan Möbius committed
76
class MouseInterface {
Jan Möbius's avatar
Jan Möbius committed
77

Jan Möbius's avatar
 
Jan Möbius committed
78
  private slots :
Jan Möbius's avatar
Jan Möbius committed
79

Jan Möbius's avatar
 
Jan Möbius committed
80
    /**  \brief Wheel Event from Main App
Jan Möbius's avatar
Jan Möbius committed
81
      *
Jan Möbius's avatar
 
Jan Möbius committed
82 83
      *  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
84
      *  the Viewer by using the picking interface.
Jan Möbius's avatar
 
Jan Möbius committed
85 86 87 88
      *  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
89
    virtual void slotMouseWheelEvent(QWheelEvent * /*_event*/, const std::string & /*_mode*/) {};
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 ( Picking 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 pickingMode.
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 99
      *  @param _event Mousevent
    */
Dirk Wilden's avatar
Dirk Wilden committed
100
    virtual void slotMouseEvent( QMouseEvent* /*_event*/ ) {};
Jan Möbius's avatar
Jan Möbius committed
101

Jan Möbius's avatar
 
Jan Möbius committed
102
    /**  \brief Mouse Event from Main App ( Identify Mode )
Jan Möbius's avatar
Jan Möbius committed
103 104 105
      *
      *  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
106
      *  Right button clicks will not be passed to the plugins as this is reserved for
Jan Möbius's avatar
Jan Möbius committed
107 108
      *  the context Menu.
      *
Jan Möbius's avatar
 
Jan Möbius committed
109
      *  @param _event Mousevent
Jan Möbius's avatar
Jan Möbius committed
110
    */
Jan Möbius's avatar
 
Jan Möbius committed
111
    virtual void slotMouseEventIdentify() {};
Jan Möbius's avatar
Jan Möbius committed
112 113 114

  public :

Jan Möbius's avatar
 
Jan Möbius committed
115 116
    /// Destructor
    virtual ~MouseInterface() {};
Jan Möbius's avatar
Jan Möbius committed
117

Jan Möbius's avatar
 
Jan Möbius committed
118 119 120
};

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

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