Commit 4c06c2fd authored by Jan Möbius's avatar Jan Möbius
Browse files

Mouse Interface Documentation

git-svn-id: 383ad7c9-94d9-4d36-a494-682f7c89f535
parent c31dbdfd
......@@ -44,23 +44,22 @@
#include <QtGui>
/** \brief Interface for all plugins which have to react on mouse events
* When using mouse events in your plugins implement this interface. Remember that
* all plugins may get these signals. Therefore you hav to check if the current pickingMode
* you want to react on is active before doing anything. Only the slotMouseEventIdentify is
* independent of picking modes.
* The slotMouseWheelEvent and slotMouseEvent only get called when the system is in picking
* mode.
* slotMouseEventIdentify will be used when question mode is active.
* See our tutorial \ref ex3 for an example of how to use mouse and keyboard events
* within a plugin.
#include <QtGui>
/** \file MouseInterface.hh
* Interface for registering types in OpenFlipper. \ref mouseInterfacePage
/** \brief Interface class for receiving mouse events
* \n
* \ref mouseInterfacePage "Detailed description"
* \n
class MouseInterface {
private slots :
......@@ -116,6 +115,72 @@ class MouseInterface {
/** \page mouseInterfacePage Mouse Interface
\image html mouseInterface.png
The mouse interface can be used to receive mouse events which occur in the glViewer.
There are 4 main viewer modes:
<li> <b>Move Mode</b> events are never passed to one of the plugins and is only used for scene navigation
inside the viewers.
<li> <b>Picking Mode</b> events where passed through the MouseInterface::slotMouseEvent() and MouseInterface::slotMouseWheelEvent().
<li> <b>Light Mode</b> events where passed through the MouseInterface::slotMouseEventLight()
<li> <b>Identify Mode</b> events where passed through the MouseInterface::slotMouseEventIdentify()
You can add handlers for these mouse events in your plugin. Remember that all plugins receive these signals.\n
The picking mode is only a global mode which is devided into several other picking modes that can be managed
through the PickingInterface. If you react on mouse events from picking mode, you should check if the current
picking mode is yours.
void MousePlugin::slotMouseEvent(QMouseEvent* _event) {
// Check if your pick mode is currently active
if ( PluginFunctions::pickMode() == "YourPickMode" && PluginFunctions::actionMode() == Viewer::PickingMode ) {
// If double click has been performed
if (_event->type() == QEvent::MouseButtonDblClick) {
unsigned int node_idx, target_idx;
OpenMesh::Vec3d hitPoint;
// Get picked object's identifier by picking in scenegraph
if ( PluginFunctions::scenegraphPick(ACG::SceneGraph::PICK_ANYTHING,_event->pos(), node_idx, target_idx, &hitPoint) ) {
BaseObjectData* object;
// Get picked object
if ( PluginFunctions::getPickedObject(node_idx, object) ) {
// Do something with the object
See our tutorial \ref ex3 for an example of how to use mouse and keyboard events
within a plugin.
To use the MouseInterface:
<li> include MouseInterface.hh in your plugins header file
<li> derive your plugin from the class MouseInterface
<li> add Q_INTERFACES(MouseInterface) to your plugin class
<li> And add the signals or slots you want to use to your plugin class (You don't need to implement all of them)
......@@ -59,7 +59,6 @@ FileInterface
......@@ -77,18 +76,12 @@ This page gives an overview over the available interfaces which control other pa
You have to provide this interface if you want to get key events in your plugin ( KeyInterface ).\n
\subsection MousePlugin Mouse Interface
\image html mouseInterface.png
This interface is used to deliver mouse events to a plugin ( MouseInterface ).\n
\subsection LoadSavePlugin Load / Save Interface
\image html loadSaveInterface.png
Provides functions to handle mesh files and load / unload geometry
objects into the scene graph ( LoadSaveInterface ).
\subsection TexturePlugin Texture Interface
\image html TextureInterface.png
Allows your plugin to provide a texture. ( TextureInterface )
......@@ -181,6 +174,15 @@ to other plugins ( \ref typeInterfacePage ).
/** \page pluginInterfacesInputDevices Input Devices
This page shows interfaces which could be used to get data from input devices.
\subpage mouseInterfacePage
\image html mouseInterface.png
This interface is used to deliver mouse events to a plugin ( \ref mouseInterfacePage ).\n
/** \page pluginInterfacesOtherInterfaces Other Interfaces
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment