OpendTect  6.6
mouseevent.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*+
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: K. Tingdahl
8  Date: September 2005
9  RCS: $Id$
10 ________________________________________________________________________
11 
12 -*/
13 
14 #include "generalmod.h"
15 #include "keyenum.h"
16 #include "gendefs.h"
17 #include "geometry.h"
18 #include "position.h"
19 #include "trckeyvalue.h"
20 
21 
23 {
24  friend class QtTabletEventFilter;
25 
26 public:
28 
29  enum EventType { None=0, Move=87, Press=92, Release=93,
30  EnterProximity=171, LeaveProximity=172 };
32  // Use mouse event-type if possible. The two might
33  // mismatch because of a QTabletEvent bug for Linux.
34 
35  enum PointerType { UnknownPointer, Pen, Cursor, Eraser };
37 
38  enum TabletDevice { NoDevice, Puck, Stylus, Airbrush,
39  FourDMouse, RotationStylus };
41 
44 
45  double pressure_;
46  double rotation_;
48 
50 
51  int xtilt_;
52  int ytilt_;
53  int z_;
54 
55  int postPressTime() const;
56  float postPressDist() const;
57  float maxPostPressDist() const;
58 
59  static const TabletInfo* currentState();
60 
61 protected:
62 
66 
69 };
70 
71 
73 {
74 public:
75 
77  int xx=0, int yy=0, float aa=0 )
78  : butstate_(st), pressed_(false)
79  , angle_(aa), tabletinfo_(nullptr)
80  {
81  pos_.setXY( xx, yy );
82  dpos_.setXY( xx, yy );
83  }
84 
86  float xx, float yy, float aa=0 )
87  : butstate_(st), pressed_(false)
88  , angle_(aa), tabletinfo_(nullptr)
89  {
91  dpos.setXY( xx, yy );
92  setPos( dpos );
93  }
94 
96  double xx, double yy, float aa=0 )
97  : butstate_(st), pressed_(false)
98  , angle_(aa), tabletinfo_(nullptr)
99  {
101  dpos.setXY( xx, yy );
102  setPos( dpos );
103  }
104 
106  : tabletinfo_(nullptr)
107  { *this = me; }
108 
111 
112  OD::ButtonState buttonState() const { return butstate_; }
114 
115  bool isPressed() const { return pressed_; }
116  void setPressed(bool yn) { pressed_ = yn; }
117 
119  const Geom::Point2D<int>& pos() const { return pos_; }
122  int x() const { return pos_.x; }
123  int y() const { return pos_.y; }
124  float angle() const { return angle_; }
126 
127  bool leftButton() const;
128  bool rightButton() const;
129  bool middleButton() const;
130  bool ctrlStatus() const;
131  bool altStatus() const;
132  bool shiftStatus() const;
133 
134  bool operator ==( const MouseEvent& ev ) const;
135  bool operator !=( const MouseEvent& ev ) const
136  { return !(*this==ev); }
137 
139  const TabletInfo* tabletInfo() const;
140  void setTabletInfo(const TabletInfo*);
141 
144 
145 protected:
146 
148  bool pressed_;
151  float angle_;
153 };
154 
189 {
190 public:
193 
198  void triggerWheel(const MouseEvent&);
199 
205 
206  bool hasEvent() const { return event_; }
207  const MouseEvent& event() const { return *event_; }
211  bool isHandled() const { return ishandled_; }
212  void setHandled(bool yn) { ishandled_ = yn; }
213 
214 protected:
215 
216  void setEvent(const MouseEvent*);
218 
220 };
221 
222 
229 {
230 public:
232  mExpClass(General) Info
233  {
234  public:
236  float offset=mUdf(float));
237 
239  float offset_;
240  };
241 
243 };
244 
245 
248 {
249 public:
250  GestureEvent( int xx, int yy, float sc, float angl )
251  : pos_(xx,yy),scale_(sc),angle_(angl)
252  {}
253 
254 
255  const Geom::Point2D<int>& pos() const { return pos_; }
256  int x() const { return pos_.x; }
257  int y() const { return pos_.y; }
258  float scale() const { return scale_; }
259  float angle() const { return angle_; }
260 
261  enum State{ Started, Moving, Finished };
262  State getState() const { return state_; }
263  void setState(State st) { state_ = st; }
264 
265 protected:
266 
268  float scale_;
269  float angle_;
271 };
272 
273 
302 {
303 public:
306 
307 
309  const GestureEvent& pinchevnt);
312  bool isHandled() const { return ishandled_; }
313  void setHandled(bool yn) { ishandled_ = yn; }
314 
316 
317 private:
318 
321 };
322 
MouseEvent::angle_
float angle_
Definition: mouseevent.h:151
TabletInfo::TabletDevice
TabletDevice
Definition: mouseevent.h:38
MouseEventHandler::ishandled_
bool ishandled_
Definition: mouseevent.h:219
MouseEvent::getDefaultTrackpadZoomFactor
static float getDefaultTrackpadZoomFactor()
MouseEvent::setButtonState
void setButtonState(const OD::ButtonState &)
MouseEventHandler::MouseEventHandler
MouseEventHandler()
MouseEvent::setPos
void setPos(const Geom::Point2D< double > &)
MouseEventHandler::event_
MouseEvent * event_
Definition: mouseevent.h:217
TabletInfo::PointerType
PointerType
Definition: mouseevent.h:35
MouseEvent::shiftStatus
bool shiftStatus() const
MouseEvent::rightButton
bool rightButton() const
geometry.h
GestureEvent::angle_
float angle_
Definition: mouseevent.h:269
MouseEvent::MouseEvent
MouseEvent(OD::ButtonState st, double xx, double yy, float aa=0)
Definition: mouseevent.h:95
trckeyvalue.h
MouseEventHandler::event
const MouseEvent & event() const
Definition: mouseevent.h:207
TabletInfo::postPressDist
float postPressDist() const
GestureEvent
Stores event information from gesture event.
Definition: mouseevent.h:248
MouseEvent::setPressed
void setPressed(bool yn)
Definition: mouseevent.h:116
od_int64
#define od_int64
Definition: plftypes.h:35
TabletInfo::latestState
static TabletInfo & latestState()
MouseEventHandler::wheelMove
Notifier< MouseEventHandler > wheelMove
Definition: mouseevent.h:204
GestureEventHandler::ishandled_
bool ishandled_
Definition: mouseevent.h:320
MouseEvent::tabletinfo_
TabletInfo * tabletinfo_
Definition: mouseevent.h:152
MouseEvent::getDefaultMouseWheelZoomFactor
static float getDefaultMouseWheelZoomFactor()
GestureEventHandler::~GestureEventHandler
~GestureEventHandler()
mExpClass
#define mExpClass(module)
Definition: commondefs.h:177
MouseEvent::butstate_
OD::ButtonState butstate_
Definition: mouseevent.h:147
GestureEvent::x
int x() const
Definition: mouseevent.h:256
MouseEvent::altStatus
bool altStatus() const
MouseEvent::tabletInfo
const TabletInfo * tabletInfo() const
TabletInfo::currentState
static const TabletInfo * currentState()
MouseCursorExchange::Info::trkv_
TrcKeyValue trkv_
Definition: mouseevent.h:238
GestureEvent::GestureEvent
GestureEvent(int xx, int yy, float sc, float angl)
Definition: mouseevent.h:250
TabletInfo::uniqueid_
od_int64 uniqueid_
Definition: mouseevent.h:49
TabletInfo::device_
TabletDevice device_
Definition: mouseevent.h:40
CallBacker
Inherit from this class to be able to send and/or receive CallBacks.
Definition: callback.h:185
GestureEventHandler::triggerPinchEvent
void triggerPinchEvent(const GestureEvent &pinchevnt)
Only available during events.
operator==
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:81
GestureEventHandler
Handles gesture event and triggers notifier with GestureEventInfo.
Definition: mouseevent.h:302
OD::ButtonState
ButtonState
Definition: keyenum.h:20
keyenum.h
TabletInfo::postPressTime
int postPressTime() const
MouseEventHandler::setEvent
void setEvent(const MouseEvent *)
MouseEventHandler::triggerWheel
void triggerWheel(const MouseEvent &)
MouseCursorExchange::MouseCursorExchange
MouseCursorExchange()
TabletInfo::xtilt_
int xtilt_
Definition: mouseevent.h:51
MouseEvent::pressed_
bool pressed_
Definition: mouseevent.h:148
MouseEvent::MouseEvent
MouseEvent(OD::ButtonState st, float xx, float yy, float aa=0)
Definition: mouseevent.h:85
TabletInfo::pointertype_
PointerType pointertype_
Definition: mouseevent.h:36
GestureEvent::pos_
Geom::Point2D< int > pos_
Definition: mouseevent.h:267
TabletInfo::updatePressData
void updatePressData()
GestureEventHandler::currentevent_
const GestureEvent * currentevent_
Definition: mouseevent.h:319
MouseEvent::~MouseEvent
~MouseEvent()
TabletInfo::EventType
EventType
Definition: mouseevent.h:29
MouseCursorExchange::notifier
CNotifier< MouseCursorExchange, const Info & > notifier
Definition: mouseevent.h:242
MouseEvent::dpos_
Geom::Point2D< double > dpos_
Definition: mouseevent.h:150
TabletInfo::globalpresspos_
Geom::Point2D< int > globalpresspos_
Definition: mouseevent.h:65
TabletInfo::presstimestamp_
int presstimestamp_
Definition: mouseevent.h:63
GestureEvent::State
State
Definition: mouseevent.h:261
MouseEventHandler::triggerButtonReleased
void triggerButtonReleased(const MouseEvent &)
MouseEventHandler::hasEvent
bool hasEvent() const
Definition: mouseevent.h:206
operator!=
bool operator!=(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:90
TabletInfo::z_
int z_
Definition: mouseevent.h:53
GestureEvent::angle
float angle() const
Definition: mouseevent.h:259
TrcKeyValue
Definition: trckeyvalue.h:27
MouseCursorExchange::Info
Definition: mouseevent.h:233
GestureEventHandler::getPinchEventInfo
const GestureEvent * getPinchEventInfo() const
GestureEvent::scale
float scale() const
Definition: mouseevent.h:258
GestureEvent::getState
State getState() const
Definition: mouseevent.h:262
gendefs.h
Notifier< MouseEventHandler >
GestureEvent::y
int y() const
Definition: mouseevent.h:257
MouseCursorExchange::Info::offset_
float offset_
Definition: mouseevent.h:239
GestureEvent::pos
const Geom::Point2D< int > & pos() const
Definition: mouseevent.h:255
MouseEvent::MouseEvent
MouseEvent(OD::ButtonState st=OD::NoButton, int xx=0, int yy=0, float aa=0)
Definition: mouseevent.h:76
GestureEvent::setState
void setState(State st)
Definition: mouseevent.h:263
TabletInfo::maxPostPressDist
float maxPostPressDist() const
MouseEventHandler::buttonPressed
Notifier< MouseEventHandler > buttonPressed
Definition: mouseevent.h:200
MouseEvent::pos_
Geom::Point2D< int > pos_
Definition: mouseevent.h:149
position.h
MouseEventHandler::doubleClick
Notifier< MouseEventHandler > doubleClick
Definition: mouseevent.h:203
TabletInfo::pressure_
double pressure_
Definition: mouseevent.h:45
MouseEvent::ctrlStatus
bool ctrlStatus() const
TabletInfo::pos_
Geom::Point2D< int > pos_
Definition: mouseevent.h:43
Network::None
@ None
Definition: networkcommon.h:33
MouseEvent::leftButton
bool leftButton() const
MouseEventHandler
Definition: mouseevent.h:189
MouseEventHandler::setHandled
void setHandled(bool yn)
Definition: mouseevent.h:212
OD::NoButton
@ NoButton
Qt's mouse/keyboard state values.
Definition: keyenum.h:21
Geom::Point2D< int >
GestureEvent::state_
State state_
Definition: mouseevent.h:270
MouseEventHandler::isHandled
bool isHandled() const
Definition: mouseevent.h:211
TabletInfo
Definition: mouseevent.h:23
MouseEvent::angle
float angle() const
used for wheel events
Definition: mouseevent.h:124
TabletInfo::maxpostpressdist_
float maxpostpressdist_
Definition: mouseevent.h:64
Geom::Point2D::setXY
void setXY(TT xx, TT yy)
Definition: geometry.h:287
GestureEventHandler::isHandled
bool isHandled() const
Definition: mouseevent.h:312
TabletInfo::UnknownPointer
@ UnknownPointer
Definition: mouseevent.h:35
MouseEvent::tabletInfo
TabletInfo * tabletInfo()
mUdf
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:274
MouseCursorExchange::Info::Info
Info(const TrcKeyValue &, float offset=mUdf(float))
TabletInfo::eventtype_
EventType eventtype_
Definition: mouseevent.h:31
GestureEventHandler::GestureEventHandler
GestureEventHandler()
MouseCursorExchange
Definition: mouseevent.h:229
TabletInfo::tangentialpressure_
double tangentialpressure_
Definition: mouseevent.h:47
GestureEventHandler::pinchnotifier
Notifier< GestureEventHandler > pinchnotifier
Definition: mouseevent.h:315
TabletInfo::globalpos_
Geom::Point2D< int > globalpos_
Definition: mouseevent.h:42
MouseEvent::x
int x() const
Definition: mouseevent.h:122
MouseEventHandler::buttonReleased
Notifier< MouseEventHandler > buttonReleased
Definition: mouseevent.h:201
MouseEventHandler::triggerDoubleClick
void triggerDoubleClick(const MouseEvent &)
MouseEvent::middleButton
bool middleButton() const
MouseEvent::buttonState
OD::ButtonState buttonState() const
Definition: mouseevent.h:112
MouseEvent::getDPos
const Geom::Point2D< double > & getDPos() const
MouseEvent::isPressed
bool isPressed() const
Definition: mouseevent.h:115
GestureEvent::scale_
float scale_
Definition: mouseevent.h:268
MouseEvent::MouseEvent
MouseEvent(const MouseEvent &me)
Definition: mouseevent.h:105
MouseEvent
Definition: mouseevent.h:73
TabletInfo::ytilt_
int ytilt_
Definition: mouseevent.h:52
MouseEventHandler::triggerMovement
void triggerMovement(const MouseEvent &)
MouseEventHandler::movement
Notifier< MouseEventHandler > movement
Definition: mouseevent.h:202
GestureEventHandler::setHandled
void setHandled(bool yn)
Definition: mouseevent.h:313
MouseEventHandler::triggerButtonPressed
void triggerButtonPressed(const MouseEvent &)
MouseEventHandler::~MouseEventHandler
~MouseEventHandler()
TabletInfo::rotation_
double rotation_
Definition: mouseevent.h:46
CNotifier
Notifier with automatic capsule creation.
Definition: notify.h:171
TabletInfo::TabletInfo
TabletInfo()
MouseEvent::setTabletInfo
void setTabletInfo(const TabletInfo *)
MouseEvent::operator=
MouseEvent & operator=(const MouseEvent &)
MouseEvent::getFPos
Geom::Point2D< float > getFPos() const
MouseEvent::y
int y() const
Definition: mouseevent.h:123
MouseEvent::pos
const Geom::Point2D< int > & pos() const
Definition: mouseevent.h:119

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2021