OpendTect-6_4  6.4
mouseevent.h
Go to the documentation of this file.
1 #ifndef mouseevent_h
2 #define mouseevent_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: K. Tingdahl
9  Date: September 2005
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "generalmod.h"
16 #include "keyenum.h"
17 #include "gendefs.h"
18 #include "geometry.h"
19 #include "position.h"
20 #include "trckeyvalue.h"
21 
22 
24 {
25  friend class QtTabletEventFilter;
26 
27 public:
28  TabletInfo();
29 
30  enum EventType { None=0, Move=87, Press=92, Release=93,
31  EnterProximity=171, LeaveProximity=172 };
33  // Use mouse event-type if possible. The two might
34  // mismatch because of a QTabletEvent bug for Linux.
35 
36  enum PointerType { UnknownPointer, Pen, Cursor, Eraser };
38 
39  enum TabletDevice { NoDevice, Puck, Stylus, Airbrush,
40  FourDMouse, RotationStylus };
42 
45 
46  double pressure_;
47  double rotation_;
49 
51 
52  int xtilt_;
53  int ytilt_;
54  int z_;
55 
56  int postPressTime() const;
57  float postPressDist() const;
58  float maxPostPressDist() const;
59 
60  static const TabletInfo* currentState();
61 
62 protected:
63 
67 
68  static TabletInfo& latestState();
69  void updatePressData();
70 };
71 
72 
74 {
75 public:
76 
78  int xx=0, int yy=0, float aa=0 )
79  : butstate_(st), pos_(xx,yy), angle_(aa)
80  , pressed_(false), tabletinfo_(0)
81  {}
82 
83  MouseEvent(const MouseEvent& me)
84  : tabletinfo_(0)
85  { *this = me; }
86 
87  ~MouseEvent();
88  MouseEvent& operator=(const MouseEvent&);
89 
90  OD::ButtonState buttonState() const { return butstate_; }
91  void setButtonState(const OD::ButtonState&);
92 
93  bool isPressed() const { return pressed_; }
94  void setPressed(bool yn) { pressed_ = yn; }
95 
96  const Geom::Point2D<int>& pos() const { return pos_; }
97  int x() const { return pos_.x; }
98  int y() const { return pos_.y; }
99  float angle() const { return angle_; }
101 
102  bool leftButton() const;
103  bool rightButton() const;
104  bool middleButton() const;
105  bool ctrlStatus() const;
106  bool altStatus() const;
107  bool shiftStatus() const;
108 
109  bool operator ==( const MouseEvent& ev ) const;
110  bool operator !=( const MouseEvent& ev ) const
111  { return !(*this==ev); }
112 
113  TabletInfo* tabletInfo();
114  const TabletInfo* tabletInfo() const;
115  void setTabletInfo(const TabletInfo*);
116 
117  static float getDefaultTrackpadZoomFactor();
118  static float getDefaultMouseWheelZoomFactor();
119 
120 protected:
121 
123  bool pressed_;
125  float angle_;
127 };
128 
163 {
164 public:
167 
168  void triggerMovement(const MouseEvent&);
169  void triggerButtonPressed(const MouseEvent&);
170  void triggerButtonReleased(const MouseEvent&);
171  void triggerDoubleClick(const MouseEvent&);
172  void triggerWheel(const MouseEvent&);
173 
179 
180  bool hasEvent() const { return event_; }
181  const MouseEvent& event() const { return *event_; }
185  bool isHandled() const { return ishandled_; }
186  void setHandled(bool yn) { ishandled_ = yn; }
187 
188 protected:
189 
190  void setEvent(const MouseEvent*);
192 
194 };
195 
196 
203 {
204 public:
206  mExpClass(General) Info
207  {
208  public:
209  Info(const TrcKeyValue&,
210  float offset=mUdf(float));
211 
213  float offset_;
214  };
215 
217 };
218 
219 
222 {
223 public:
224  GestureEvent( int xx, int yy, float sc, float angl )
225  : pos_(xx,yy),scale_(sc),angle_(angl)
226  {}
227 
228 
229  const Geom::Point2D<int>& pos() const { return pos_; }
230  int x() const { return pos_.x; }
231  int y() const { return pos_.y; }
232  float scale() const { return scale_; }
233  float angle() const { return angle_; }
234 
235  enum State{ Started, Moving, Finished };
236  State getState() const { return state_; }
237  void setState(State st) { state_ = st; }
238 
239 protected:
240 
242  float scale_;
243  float angle_;
245 };
246 
247 
276 {
277 public:
280 
281 
282  void triggerPinchEvent(
283  const GestureEvent& pinchevnt);
285  const GestureEvent* getPinchEventInfo() const;
286  bool isHandled() const { return ishandled_; }
287  void setHandled(bool yn) { ishandled_ = yn; }
288 
290 
291 private:
292 
295 };
296 
297 
298 
299 
300 #endif
Handles gesture event and triggers notifier with GestureEventInfo.
Definition: mouseevent.h:275
#define mExpClass(module)
Definition: commondefs.h:160
Definition: trckeyvalue.h:27
double pressure_
Definition: mouseevent.h:46
Geom::Point2D< int > pos_
Definition: mouseevent.h:44
float offset_
Definition: mouseevent.h:213
int xtilt_
Definition: mouseevent.h:52
To be able to send and/or receive CallBacks, inherit from this class.
Definition: callback.h:272
TabletDevice device_
Definition: mouseevent.h:41
const Geom::Point2D< int > & pos() const
Definition: mouseevent.h:229
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:53
EventType
Definition: mouseevent.h:30
EventType eventtype_
Definition: mouseevent.h:32
bool pressed_
Definition: mouseevent.h:123
Geom::Point2D< int > globalpos_
Definition: mouseevent.h:43
void setState(State st)
Definition: mouseevent.h:237
const Geom::Point2D< int > & pos() const
Definition: mouseevent.h:96
Definition: mouseevent.h:36
float maxpostpressdist_
Definition: mouseevent.h:65
PointerType pointertype_
Definition: mouseevent.h:37
#define od_int64
Definition: plftypes.h:36
double tangentialpressure_
Definition: mouseevent.h:48
void setHandled(bool yn)
Definition: mouseevent.h:287
int ytilt_
Definition: mouseevent.h:53
float angle_
Definition: mouseevent.h:243
Geom::Point2D< int > pos_
Definition: mouseevent.h:241
State getState() const
Definition: mouseevent.h:236
Definition: mouseevent.h:23
TrcKeyValue trkv_
Definition: mouseevent.h:212
Definition: mouseevent.h:202
PointerType
Definition: mouseevent.h:36
FixedString None()
Definition: keystrs.h:90
Definition: mouseevent.h:206
float angle_
Definition: mouseevent.h:125
Notifier< MouseEventHandler > buttonPressed
Definition: mouseevent.h:174
bool ishandled_
Definition: mouseevent.h:193
float angle() const
Definition: mouseevent.h:233
ButtonState
Definition: keyenum.h:20
Stores event information from gesture event.
Definition: mouseevent.h:221
bool isPressed() const
Definition: mouseevent.h:93
void setHandled(bool yn)
Definition: mouseevent.h:186
bool hasEvent() const
Definition: mouseevent.h:180
Notifier< MouseEventHandler > wheelMove
Definition: mouseevent.h:178
OD::ButtonState butstate_
Definition: mouseevent.h:122
int y() const
Definition: mouseevent.h:98
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:272
void setPressed(bool yn)
Definition: mouseevent.h:94
State state_
Definition: mouseevent.h:244
float angle() const
used for wheel events
Definition: mouseevent.h:99
int x() const
Definition: mouseevent.h:97
const MouseEvent & event() const
Definition: mouseevent.h:181
Qt&#39;s mouse/keyboard state values.
Definition: keyenum.h:22
MouseEvent(const MouseEvent &me)
Definition: mouseevent.h:83
bool operator!=(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:62
Definition: mouseevent.h:162
bool isHandled() const
Definition: mouseevent.h:286
Notifier< MouseEventHandler > buttonReleased
Definition: mouseevent.h:175
bool isHandled() const
Definition: mouseevent.h:185
int y() const
Definition: mouseevent.h:231
double rotation_
Definition: mouseevent.h:47
State
Definition: mouseevent.h:235
Notifier< GestureEventHandler > pinchnotifier
Definition: mouseevent.h:289
Geom::Point2D< int > globalpresspos_
Definition: mouseevent.h:66
MouseEvent * event_
Definition: mouseevent.h:191
float scale_
Definition: mouseevent.h:242
TabletDevice
Definition: mouseevent.h:39
CNotifier< MouseCursorExchange, const Info & > notifier
Definition: mouseevent.h:216
int presstimestamp_
Definition: mouseevent.h:64
Notifier< MouseEventHandler > movement
Definition: mouseevent.h:176
GestureEvent(int xx, int yy, float sc, float angl)
Definition: mouseevent.h:224
Notifier with automatic capsule creation.
Definition: callback.h:395
Notifier< MouseEventHandler > doubleClick
Definition: mouseevent.h:177
OD::ButtonState buttonState() const
Definition: mouseevent.h:90
float scale() const
Definition: mouseevent.h:232
int z_
Definition: mouseevent.h:54
MouseEvent(OD::ButtonState st=OD::NoButton, int xx=0, int yy=0, float aa=0)
Definition: mouseevent.h:77
bool ishandled_
Definition: mouseevent.h:294
Definition: mouseevent.h:73
od_int64 uniqueid_
Definition: mouseevent.h:50
int x() const
Definition: mouseevent.h:230
TabletInfo * tabletinfo_
Definition: mouseevent.h:126
const GestureEvent * currentevent_
Definition: mouseevent.h:293
Geom::Point2D< int > pos_
Definition: mouseevent.h:124

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