1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Qwt User's Guide: qwt_picker.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.8 -->
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
<h1>qwt_picker.h</h1><pre class="fragment"><div>00001 <span class="comment">/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************</span>
00002 <span class="comment"> * Qwt Widget Library</span>
00003 <span class="comment"> * Copyright (C) 1997 Josef Wilgen</span>
00004 <span class="comment"> * Copyright (C) 2002 Uwe Rathmann</span>
00005 <span class="comment"> * </span>
00006 <span class="comment"> * This library is free software; you can redistribute it and/or</span>
00007 <span class="comment"> * modify it under the terms of the Qwt License, Version 1.0</span>
00008 <span class="comment"> *****************************************************************************/</span>
00009
00010 <span class="preprocessor">#ifndef QWT_PICKER</span>
00011 <span class="preprocessor"></span><span class="preprocessor">#define QWT_PICKER 1</span>
00012 <span class="preprocessor"></span>
00013 <span class="preprocessor">#include <qobject.h></span>
00014 <span class="preprocessor">#include <qpen.h></span>
00015 <span class="preprocessor">#include <qfont.h></span>
00016 <span class="preprocessor">#include <qrect.h></span>
00017 <span class="preprocessor">#include <qpointarray.h></span>
00018 <span class="preprocessor">#include "qwt_event_pattern.h"</span>
00019 <span class="preprocessor">#include "qwt_global.h"</span>
00020
00021 <span class="keyword">class </span>QWidget;
00022 <span class="keyword">class </span>QMouseEvent;
00023 <span class="keyword">class </span>QWheelEvent;
00024 <span class="keyword">class </span>QKeyEvent;
00025 <span class="keyword">class </span><a class="code" href="class_qwt_picker_machine.html">QwtPickerMachine</a>;
00026
<a name="l00079"></a><a class="code" href="class_qwt_picker.html">00079</a> <span class="keyword">class </span>QWT_EXPORT QwtPicker: <span class="keyword">public</span> QObject, <span class="keyword">public</span> <a class="code" href="class_qwt_event_pattern.html">QwtEventPattern</a>
00080 {
00081 Q_OBJECT
00082
00083 Q_ENUMS(RubberBand)
00084 Q_ENUMS(DisplayMode)
00085 Q_ENUMS(ResizeMode)
00086
00087 Q_PROPERTY(<span class="keywordtype">int</span> selectionFlags READ selectionFlags WRITE setSelectionFlags)
00088 Q_PROPERTY(DisplayMode cursorLabelMode
00089 READ cursorLabelMode WRITE setCursorLabelMode)
00090 Q_PROPERTY(QFont cursorLabelFont
00091 READ cursorLabelFont WRITE setCursorLabelFont)
00092 Q_PROPERTY(RubberBand rubberBand READ rubberBand WRITE setRubberBand)
00093 Q_PROPERTY(ResizeMode resizeMode READ resizeMode WRITE setResizeMode)
00094 Q_PROPERTY(<span class="keywordtype">bool</span> isEnabled READ isEnabled WRITE setEnabled)
00095
00096 #<span class="keywordflow">if</span> QT_VERSION >= 300
00097 <span class="comment">// Unfortunately moc is not aware of #ifdefs. To enable the QPen</span>
00098 <span class="comment">// attributes as properties uncomment the following lines.</span>
00099
00100 <span class="comment">//Q_PROPERTY(QPen cursorLabelPen READ cursorLabelPen WRITE setCursorLabelPen)</span>
00101 <span class="comment">//Q_PROPERTY(QPen rubberBandPen READ rubberBandPen WRITE setRubberBandPen)</span>
00102 <span class="preprocessor">#endif</span>
00103 <span class="preprocessor"></span>
00104 <span class="keyword">public</span>:
<a name="l00123"></a><a class="code" href="class_qwt_picker.html#w22">00123</a> <span class="keyword">enum</span> SelectionType
00124 {
00125 NoSelection = 0,
00126 PointSelection = 1,
00127 RectSelection = 2,
00128 PolygonSelection = 4
00129 };
00130
<a name="l00149"></a><a class="code" href="class_qwt_picker.html#w23">00149</a> <span class="keyword">enum</span> RectSelectionType
00150 {
00151 CornerToCorner = 64,
00152 CenterToCorner = 128,
00153 CenterToRadius = 256
00154 };
00155
<a name="l00163"></a><a class="code" href="class_qwt_picker.html#w24">00163</a> <span class="keyword">enum</span> SelectionMode
00164 {
00165 ClickSelection = 1024,
00166 DragSelection = 2048
00167 };
00168
<a name="l00193"></a><a class="code" href="class_qwt_picker.html#w25">00193</a> <span class="keyword">enum</span> RubberBand
00194 {
00195 NoRubberBand = 0,
00196
00197 <span class="comment">// Point</span>
00198 HLineRubberBand,
00199 VLineRubberBand,
00200 CrossRubberBand,
00201
00202 <span class="comment">// Rect</span>
00203 RectRubberBand,
00204 EllipseRubberBand,
00205
00206 <span class="comment">// Polygon</span>
00207 PolygonRubberBand,
00208
00209 UserRubberBand = 100
00210 };
00211
<a name="l00223"></a><a class="code" href="class_qwt_picker.html#w26">00223</a> <span class="keyword">enum</span> DisplayMode
00224 {
00225 AlwaysOff,
00226 AlwaysOn,
00227 ActiveOnly
00228 };
00229
<a name="l00242"></a><a class="code" href="class_qwt_picker.html#w27">00242</a> <span class="keyword">enum</span> ResizeMode
00243 {
00244 Stretch,
00245 KeepSize
00246 };
00247
00248 QwtPicker(QWidget *, <span class="keyword">const</span> <span class="keywordtype">char</span> *name = 0);
00249 QwtPicker(<span class="keywordtype">int</span> selectionFlags, RubberBand rubberBand,
00250 DisplayMode cursorLabelMode, QWidget *, <span class="keyword">const</span> <span class="keywordtype">char</span> *name = 0);
00251
00252 <span class="keyword">virtual</span> ~QwtPicker();
00253
00254 <span class="keyword">virtual</span> <span class="keywordtype">void</span> setSelectionFlags(<span class="keywordtype">int</span>);
00255 <span class="keywordtype">int</span> selectionFlags() const;
00256
00257 virtual <span class="keywordtype">void</span> setRubberBand(RubberBand);
00258 RubberBand rubberBand() const;
00259
00260 virtual <span class="keywordtype">void</span> setCursorLabelMode(DisplayMode);
00261 DisplayMode cursorLabelMode() const;
00262
00263 virtual <span class="keywordtype">void</span> setResizeMode(ResizeMode);
00264 ResizeMode resizeMode() const;
00265
00266 virtual <span class="keywordtype">void</span> setRubberBandPen(const QPen &);
00267 QPen rubberBandPen() const;
00268
00269 virtual <span class="keywordtype">void</span> setCursorLabelPen(const QPen &);
00270 QPen cursorLabelPen() const;
00271
00272 virtual <span class="keywordtype">void</span> setCursorLabelFont(const QFont &);
00273 QFont cursorLabelFont() const;
00274
00275 <span class="keywordtype">bool</span> isEnabled() const;
00276 virtual <span class="keywordtype">void</span> setEnabled(<span class="keywordtype">bool</span>);
00277
00278 <span class="keywordtype">bool</span> isActive() const;
00279
00280 virtual <span class="keywordtype">bool</span> eventFilter(QObject *, QEvent *);
00281
00282 QWidget *parentWidget();
00283 const QWidget *parentWidget() const;
00284
00285 virtual QRect pickRect() const;
00286 const QPointArray &selection() const;
00287
00288 virtual <span class="keywordtype">bool</span> event(QEvent *);
00289
00290 signals:
00297 <span class="keywordtype">void</span> selected(const QPointArray &pa);
00298
00305 <span class="keywordtype">void</span> appended(const QPoint &pos);
00306
00314 <span class="keywordtype">void</span> moved(const QPoint &pos);
00315
00323 <span class="keywordtype">void</span> changed(const QPointArray &pa);
00324
00325 protected:
00334 virtual <span class="keywordtype">bool</span> accept(QPointArray &selection) const;
00335
00336 virtual <span class="keywordtype">void</span> transition(const QEvent *);
00337
00338 virtual <span class="keywordtype">void</span> begin();
00339 virtual <span class="keywordtype">void</span> append(const QPoint &);
00340 virtual <span class="keywordtype">void</span> move(const QPoint &);
00341 virtual <span class="keywordtype">bool</span> end(<span class="keywordtype">bool</span> ok = TRUE);
00342
00343 virtual <span class="keywordtype">void</span> widgetMousePressEvent(QMouseEvent *);
00344 virtual <span class="keywordtype">void</span> widgetMouseReleaseEvent(QMouseEvent *);
00345 virtual <span class="keywordtype">void</span> widgetMouseDoubleClickEvent(QMouseEvent *);
00346 virtual <span class="keywordtype">void</span> widgetMouseMoveEvent(QMouseEvent *);
00347 virtual <span class="keywordtype">void</span> widgetWheelEvent(QWheelEvent *);
00348 virtual <span class="keywordtype">void</span> widgetKeyPressEvent(QKeyEvent *);
00349 virtual <span class="keywordtype">void</span> widgetKeyReleaseEvent(QKeyEvent *);
00350
00351 virtual <span class="keywordtype">void</span> drawRubberBand(const QRect &clipRect = QRect()) const;
00352 virtual <span class="keywordtype">void</span> drawRubberBand(QPainter *,
00353 const QRect &rect, const QPointArray &) const;
00354
00355 virtual <span class="keywordtype">void</span> drawCursorLabel(const QRect &clipRect = QRect()) const;
00356 virtual <span class="keywordtype">void</span> drawCursorLabel(QPainter *, const QRect &rect,
00357 const QPoint &, const QPointArray &) const;
00358
00359 virtual <span class="keywordtype">void</span> stretchSelection(const QSize &oldSize,
00360 const QSize &newSize);
00361
00362 virtual QString cursorLabel(const QPoint &pos) const;
00363
00364 virtual <a class="code" href="class_qwt_picker_machine.html">QwtPickerMachine</a> *stateMachine(<span class="keywordtype">int</span>) const;
00365
00366 <span class="keywordtype">void</span> repaint(const QRect &rect = QRect());
00367
00368 private:
00369 <span class="keywordtype">void</span> init(QWidget *, <span class="keywordtype">int</span> selectionFlags, RubberBand rubberBand,
00370 DisplayMode cursorLabelMode);
00371
00372 <span class="keywordtype">void</span> setStateMachine(<a class="code" href="class_qwt_picker_machine.html">QwtPickerMachine</a> *);
00373 <span class="keywordtype">void</span> setMouseTracking(<span class="keywordtype">bool</span>);
00374
00375 <span class="keywordtype">bool</span> d_enabled;
00376
00377 QwtPickerMachine *d_stateMachine;
00378
00379 <span class="keywordtype">int</span> d_selectionFlags;
00380 ResizeMode d_resizeMode;
00381
00382 RubberBand d_rubberBand;
00383 QPen d_rubberBandPen;
00384
00385 DisplayMode d_cursorLabelMode;
00386 QPen d_cursorLabelPen;
00387 QFont d_cursorLabelFont;
00388
00389 QPointArray d_selection;
00390 <span class="keywordtype">bool</span> d_isActive;
00391 QPoint d_labelPosition;
00392
00393 <span class="keywordtype">bool</span> d_mouseTracking; <span class="comment">// used to save previous value</span>
00394 };
00395
00396 #endif
</div></pre><hr size="1"><address style="align: right;"><small>Generated on Tue Nov 16 21:12:20 2004 for Qwt User's Guide by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 ></a> 1.3.8 </small></address>
</body>
</html>
|