qwt_event_pattern.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Qwt Widget Library
3  * Copyright (C) 1997 Josef Wilgen
4  * Copyright (C) 2002 Uwe Rathmann
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the Qwt License, Version 1.0
8  *****************************************************************************/
9 
10 #ifndef QWT_EVENT_PATTERN
11 #define QWT_EVENT_PATTERN
12 
13 #include "qwt_global.h"
14 
15 #include <qnamespace.h>
16 #include <qvector.h>
17 
18 class QMouseEvent;
19 class QKeyEvent;
20 
31 {
32  public:
46  {
55 
64 
73 
82 
91 
100 
102  MousePatternCount
103  };
104 
113  {
116 
119 
122 
125 
128 
131 
134 
137 
140 
143 
145  KeyPatternCount
146  };
147 
150  {
151  public:
153  MousePattern( Qt::MouseButton btn = Qt::NoButton,
154  Qt::KeyboardModifiers modifierCodes = Qt::NoModifier ):
155  button( btn ),
156  modifiers( modifierCodes )
157  {
158  }
159 
161  Qt::MouseButton button;
162 
164  Qt::KeyboardModifiers modifiers;
165  };
166 
169  {
170  public:
172  KeyPattern( int keyCode = Qt::Key_unknown,
173  Qt::KeyboardModifiers modifierCodes = Qt::NoModifier ):
174  key( keyCode ),
175  modifiers( modifierCodes )
176  {
177  }
178 
180  int key;
181 
183  Qt::KeyboardModifiers modifiers;
184  };
185 
186  QwtEventPattern();
187  virtual ~QwtEventPattern();
188 
189  void initMousePattern( int numButtons );
190  void initKeyPattern();
191 
192  void setMousePattern( MousePatternCode, Qt::MouseButton button,
193  Qt::KeyboardModifiers = Qt::NoModifier );
194 
195  void setKeyPattern( KeyPatternCode, int key,
196  Qt::KeyboardModifiers modifiers = Qt::NoModifier );
197 
198  void setMousePattern( const QVector< MousePattern >& );
199  void setKeyPattern( const QVector< KeyPattern >& );
200 
201  const QVector< MousePattern >& mousePattern() const;
202  const QVector< KeyPattern >& keyPattern() const;
203 
204  QVector< MousePattern >& mousePattern();
205  QVector< KeyPattern >& keyPattern();
206 
207  bool mouseMatch( MousePatternCode, const QMouseEvent* ) const;
208  bool keyMatch( KeyPatternCode, const QKeyEvent* ) const;
209 
210  protected:
211  virtual bool mouseMatch( const MousePattern&, const QMouseEvent* ) const;
212  virtual bool keyMatch( const KeyPattern&, const QKeyEvent* ) const;
213 
214  private:
215 
216 #if defined( _MSC_VER )
217 #pragma warning(push)
218 #pragma warning(disable: 4251)
219 #endif
222 #if defined( _MSC_VER )
223 #pragma warning(pop)
224 #endif
225 };
226 
230 {
231  return b1.button == b2.button && b1.modifiers == b2.modifiers;
232 }
233 
237 {
238  return b1.key == b2.key && b1.modifiers == b2.modifiers;
239 }
240 
241 #endif
QwtEventPattern::KeySelect2
@ KeySelect2
Qt::Key_Space.
Definition: qwt_event_pattern.h:118
QwtEventPattern::MouseSelect5
@ MouseSelect5
Definition: qwt_event_pattern.h:90
QwtEventPattern::m_mousePattern
QVector< MousePattern > m_mousePattern
Definition: qwt_event_pattern.h:220
QwtEventPattern::MouseSelect6
@ MouseSelect6
Definition: qwt_event_pattern.h:99
QwtEventPattern::MousePattern::button
Qt::MouseButton button
Button.
Definition: qwt_event_pattern.h:161
QwtEventPattern::MousePattern::MousePattern
MousePattern(Qt::MouseButton btn=Qt::NoButton, Qt::KeyboardModifiers modifierCodes=Qt::NoModifier)
Constructor.
Definition: qwt_event_pattern.h:153
QwtEventPattern::KeyRedo
@ KeyRedo
Qt::Key_Plus.
Definition: qwt_event_pattern.h:136
QVector
Definition: qwt_clipper.h:23
qwt_global.h
QwtEventPattern::KeyPattern::KeyPattern
KeyPattern(int keyCode=Qt::Key_unknown, Qt::KeyboardModifiers modifierCodes=Qt::NoModifier)
Constructor.
Definition: qwt_event_pattern.h:172
QwtEventPattern::m_keyPattern
QVector< KeyPattern > m_keyPattern
Definition: qwt_event_pattern.h:221
QwtEventPattern::KeyDown
@ KeyDown
Qt::Key_Down.
Definition: qwt_event_pattern.h:133
QwtEventPattern::MouseSelect1
@ MouseSelect1
Definition: qwt_event_pattern.h:54
QwtEventPattern::MousePatternCode
MousePatternCode
Symbolic mouse input codes.
Definition: qwt_event_pattern.h:45
QwtEventPattern::KeyRight
@ KeyRight
Qt::Key_Right.
Definition: qwt_event_pattern.h:127
QwtEventPattern::KeyAbort
@ KeyAbort
Qt::Key_Escape.
Definition: qwt_event_pattern.h:121
QwtEventPattern::KeyHome
@ KeyHome
Qt::Key_Escape.
Definition: qwt_event_pattern.h:142
QwtEventPattern::MouseSelect2
@ MouseSelect2
Definition: qwt_event_pattern.h:63
operator==
bool operator==(QwtEventPattern::MousePattern b1, QwtEventPattern::MousePattern b2)
Compare operator.
Definition: qwt_event_pattern.h:228
QwtEventPattern::KeyPattern
A pattern for key events.
Definition: qwt_event_pattern.h:168
QwtEventPattern::KeyPattern::modifiers
Qt::KeyboardModifiers modifiers
Modifiers.
Definition: qwt_event_pattern.h:183
QwtEventPattern::MouseSelect3
@ MouseSelect3
Definition: qwt_event_pattern.h:72
QwtEventPattern::MouseSelect4
@ MouseSelect4
Definition: qwt_event_pattern.h:81
QwtEventPattern::MousePattern::modifiers
Qt::KeyboardModifiers modifiers
Keyboard modifier.
Definition: qwt_event_pattern.h:164
QwtEventPattern::KeyPatternCode
KeyPatternCode
Symbolic keyboard input codes.
Definition: qwt_event_pattern.h:112
QwtEventPattern
A collection of event patterns.
Definition: qwt_event_pattern.h:30
QwtEventPattern::KeyUndo
@ KeyUndo
Qt::Key_Minus.
Definition: qwt_event_pattern.h:139
QWT_EXPORT
#define QWT_EXPORT
Definition: qwt_global.h:38
QwtEventPattern::KeyLeft
@ KeyLeft
Qt::Key_Left.
Definition: qwt_event_pattern.h:124
QwtEventPattern::KeyUp
@ KeyUp
Qt::Key_Up.
Definition: qwt_event_pattern.h:130
QwtEventPattern::KeyPattern::key
int key
Key code.
Definition: qwt_event_pattern.h:180
QwtEventPattern::KeySelect1
@ KeySelect1
Qt::Key_Return.
Definition: qwt_event_pattern.h:115
QwtEventPattern::MousePattern
A pattern for mouse events.
Definition: qwt_event_pattern.h:149


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:45