~ubuntu-branches/ubuntu/oneiric/soqt/oneiric

« back to all changes in this revision

Viewing changes to build/msvc6/src/Inventor/Qt/devices/SoQtMouseCommon.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Steve M. Robbins
  • Date: 2009-03-01 11:41:00 UTC
  • mfrom: (1.1.4 upstream) (5.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20090301114100-f4zz3n1oasa52fgk
Tags: 1.4.2~svn20090224-2
* Upload upstream SVN head version containing fixes to build with Coin 3
  (Closes: #515729, #515736, #515742).  Upstream indicated to me that
  SVN is stable enough to release.

* control: Update Standards-Version to 3.8.0; no changes required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**************************************************************************\
2
 
 *
3
 
 *  This file is part of the Coin 3D visualization library.
4
 
 *  Copyright (C) 1998-2005 by Systems in Motion.  All rights reserved.
5
 
 *
6
 
 *  This library is free software; you can redistribute it and/or
7
 
 *  modify it under the terms of the GNU General Public License
8
 
 *  ("GPL") version 2 as published by the Free Software Foundation.
9
 
 *  See the file LICENSE.GPL at the root directory of this source
10
 
 *  distribution for additional information about the GNU GPL.
11
 
 *
12
 
 *  For using Coin with software that can not be combined with the GNU
13
 
 *  GPL, and for taking advantage of the additional benefits of our
14
 
 *  support services, please contact Systems in Motion about acquiring
15
 
 *  a Coin Professional Edition License.
16
 
 *
17
 
 *  See <URL:http://www.coin3d.org/> for more information.
18
 
 *
19
 
 *  Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
20
 
 *  <URL:http://www.sim.no/>.
21
 
 *
22
 
\**************************************************************************/
23
 
 
24
 
#ifdef HAVE_CONFIG_H
25
 
#include <config.h>
26
 
#endif // HAVE_CONFIG_H
27
 
 
28
 
#include <Inventor/Qt/devices/SoQtMouse.h>
29
 
#include <Inventor/Qt/devices/SoGuiMouseP.h>
30
 
#include <Inventor/events/SoMouseButtonEvent.h>
31
 
#include <Inventor/events/SoLocation2Event.h>
32
 
 
33
 
/*!
34
 
  \class SoQtMouse SoQtMouse.h Inventor/Qt/devices/SoQtMouse.h
35
 
  \brief The SoQtMouse class is the mouse input device abstraction.
36
 
  \ingroup devices
37
 
 
38
 
  The SoQtMouse class is the glue between native mouse handling and
39
 
  mouse interaction in the Inventor scenegraph.
40
 
 
41
 
  All components derived from the SoQtRenderArea have got an
42
 
  SoQtMouse device attached by default.
43
 
 
44
 
  One important note for application programmers: our mappings to
45
 
  SoMouseButtonEvent::BUTTON2 and SoMouseButtonEvent::BUTTON3 do not
46
 
  match the mappings in SGI's InventorXt library or TGS's SoWin
47
 
  library for 3-button mice. They map mouse buttons like this:
48
 
 
49
 
  <ul>
50
 
  <li>left button: SoMouseButtonEvent::BUTTON1</li>
51
 
  <li>middle button: SoMouseButtonEvent::BUTTON2</li>
52
 
  <li>right button: SoMouseButtonEvent::BUTTON3</li>
53
 
  </ul>
54
 
 
55
 
  While in this SIM SoQt library the mappings are:
56
 
 
57
 
  <ul>
58
 
  <li>left button: SoMouseButtonEvent::BUTTON1</li>
59
 
  <li>middle button: SoMouseButtonEvent::BUTTON3</li>
60
 
  <li>right button: SoMouseButtonEvent::BUTTON2</li>
61
 
  </ul>
62
 
 
63
 
  This is a conscious design decision we've made.  The reason is that
64
 
  BUTTON2 should be the right mouse button whether you have a 2-button
65
 
  mouse or a 3-button mouse.
66
 
*/
67
 
 
68
 
// *************************************************************************
69
 
 
70
 
SOQT_OBJECT_SOURCE(SoQtMouse);
71
 
 
72
 
// *************************************************************************
73
 
 
74
 
/*!
75
 
  \enum SoQtMouse::Events
76
 
  Enumeration over supported mouse events.
77
 
*/
78
 
/*!
79
 
  \var SoQtMouse::Events SoQtMouse::BUTTON_PRESS
80
 
  Maskbit for mousebutton press events.
81
 
*/
82
 
/*!
83
 
  \var SoQtMouse::Events SoQtMouse::BUTTON_RELEASE
84
 
  Maskbit for mousebutton release events.
85
 
*/
86
 
/*!
87
 
  \var SoQtMouse::Events SoQtMouse::POINTER_MOTION
88
 
  Maskbit for mousepointer motion events.
89
 
*/
90
 
/*!
91
 
  \var SoQtMouse::Events SoQtMouse::BUTTON_MOTION
92
 
  Maskbit for mousepointer motion events with one or more mousebuttons
93
 
  pressed.
94
 
*/
95
 
/*!
96
 
  \var SoQtMouse::Events SoQtMouse::ALL_EVENTS
97
 
 
98
 
  Mask which includes all the maskbits in the enum (ie use this to
99
 
  signal interest in all kinds of events for the mouse device).
100
 
*/
101
 
 
102
 
// *************************************************************************
103
 
 
104
 
/*!
105
 
  \fn SoQtMouse::SoQtMouse(int mask)
106
 
 
107
 
  Constructor. The \a mask argument should contain the set of
108
 
  SoQtMouse::Events one is interested in tracking.
109
 
*/
110
 
 
111
 
/*!
112
 
  \fn SoQtMouse::~SoQtMouse()
113
 
  Destructor.
114
 
*/
115
 
 
116
 
/*!
117
 
  \fn const SoEvent * SoQtMouse::translateEvent(QEvent * event)
118
 
 
119
 
  Translates a native event from the underlying toolkit into a generic
120
 
  event.
121
 
 
122
 
  This is then returned in the form of an instance of a subclass of
123
 
  the Inventor API's SoEvent class, either an SoMouseButtonEvent or an
124
 
  SoLocation2Event, depending on whether the native event is a
125
 
  mousebutton press / release, or a mousecursor movement event.
126
 
 
127
 
  The mapping of the mousebuttons upon generation of
128
 
  SoMouseButtonEvent events will be done as follows:
129
 
 
130
 
  <ul>
131
 
  <li>left mousebutton: SoMouseButtonEvent::BUTTON1</li>
132
 
  <li>right mousebutton: SoMouseButtonEvent::BUTTON2</li>
133
 
  <li>middle mousebutton, if available: SoMouseButtonEvent::BUTTON3</li>
134
 
  <li>forward motion on a wheel mouse: SoMouseButtonEvent::BUTTON4</li>
135
 
  <li>backward motion on a wheel mouse: SoMouseButtonEvent::BUTTON5</li>
136
 
  </ul>
137
 
 
138
 
  Note that the rightmost mousebutton will always map to
139
 
  SoMouseButtonEvent::BUTTON2, even on a 3-button mouse.
140
 
*/
141
 
 
142
 
// *************************************************************************
143
 
 
144
 
#ifndef DOXYGEN_SKIP_THIS
145
 
 
146
 
SoGuiMouseP::SoGuiMouseP(SoQtMouse * p)
147
 
{
148
 
  this->pub = p;
149
 
 
150
 
  // Allocate system-neutral event objects once and reuse.
151
 
  this->buttonevent = new SoMouseButtonEvent;
152
 
  this->locationevent = new SoLocation2Event;
153
 
}
154
 
 
155
 
SoGuiMouseP::~SoGuiMouseP()
156
 
{
157
 
  delete this->buttonevent;
158
 
  delete this->locationevent;
159
 
}
160
 
 
161
 
#endif // !DOXYGEN_SKIP_THIS
162
 
 
163
 
// *************************************************************************