qwt_event_pattern.h
Go to the documentation of this file.
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
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
A pattern for mouse events.
MousePattern(Qt::MouseButton btn=Qt::NoButton, Qt::KeyboardModifiers modifierCodes=Qt::NoModifier)
Constructor.
#define QWT_EXPORT
Definition: qwt_global.h:38
QVector< KeyPattern > d_keyPattern
QVector< MousePattern > d_mousePattern
KeyPattern(int keyCode=Qt::Key_unknown, Qt::KeyboardModifiers modifierCodes=Qt::NoModifier)
Constructor.
A pattern for key events.
Qt::KeyboardModifiers modifiers
Keyboard modifier.
KeyPatternCode
Symbolic keyboard input codes.
Qt::KeyboardModifiers modifiers
Modifiers.
bool operator==(QwtEventPattern::MousePattern b1, QwtEventPattern::MousePattern b2)
Compare operator.
A collection of event patterns.
MousePatternCode
Symbolic mouse input codes.
Qt::MouseButton button
Button.


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 03:48:10