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 1
12 
13 #include "qwt_global.h"
14 #include <qnamespace.h>
15 #include <qvector.h>
16 
17 class QMouseEvent;
18 class QKeyEvent;
19 
30 {
31 public:
45  {
54 
63 
72 
81 
90 
99 
101  MousePatternCount
102  };
103 
112  {
115 
118 
121 
124 
127 
130 
133 
136 
139 
142 
144  KeyPatternCount
145  };
146 
149  {
150  public:
152  MousePattern( Qt::MouseButton btn = Qt::NoButton,
153  Qt::KeyboardModifiers modifierCodes = Qt::NoModifier ):
154  button( btn ),
155  modifiers( modifierCodes )
156  {
157  }
158 
160  Qt::MouseButton button;
161 
163  Qt::KeyboardModifiers modifiers;
164  };
165 
168  {
169  public:
171  KeyPattern( int keyCode = Qt::Key_unknown,
172  Qt::KeyboardModifiers modifierCodes = Qt::NoModifier ):
173  key( keyCode ),
174  modifiers( modifierCodes )
175  {
176  }
177 
179  int key;
180 
182  Qt::KeyboardModifiers modifiers;
183  };
184 
185  QwtEventPattern();
186  virtual ~QwtEventPattern();
187 
188  void initMousePattern( int numButtons );
189  void initKeyPattern();
190 
191  void setMousePattern( MousePatternCode, Qt::MouseButton button,
192  Qt::KeyboardModifiers = Qt::NoModifier );
193 
194  void setKeyPattern( KeyPatternCode, int keyCode,
195  Qt::KeyboardModifiers modifierCodes = Qt::NoModifier );
196 
197  void setMousePattern( const QVector<MousePattern> & );
198  void setKeyPattern( const QVector<KeyPattern> & );
199 
200  const QVector<MousePattern> &mousePattern() const;
201  const QVector<KeyPattern> &keyPattern() const;
202 
203  QVector<MousePattern> &mousePattern();
204  QVector<KeyPattern> &keyPattern();
205 
206  bool mouseMatch( MousePatternCode, const QMouseEvent * ) const;
207  bool keyMatch( KeyPatternCode, const QKeyEvent * ) const;
208 
209 protected:
210  virtual bool mouseMatch( const MousePattern &, const QMouseEvent * ) const;
211  virtual bool keyMatch( const KeyPattern &, const QKeyEvent * ) const;
212 
213 private:
214 
215 #if defined(_MSC_VER)
216 #pragma warning(push)
217 #pragma warning(disable: 4251)
218 #endif
219  QVector<MousePattern> d_mousePattern;
220  QVector<KeyPattern> d_keyPattern;
221 #if defined(_MSC_VER)
222 #pragma warning(pop)
223 #endif
224 };
225 
229 {
230  return b1.button == b2.button && b1.modifiers == b2.modifiers;
231 }
232 
236 {
237  return b1.key == b2.key && b1.modifiers == b2.modifiers;
238 }
239 
240 #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 Sat Jul 6 2019 03:44:17