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 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373
|
<!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_machine.cpp 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_machine.cpp</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">#include <qevent.h></span>
00011 <span class="preprocessor">#include "qwt_event_pattern.h"</span>
00012 <span class="preprocessor">#include "qwt_picker_machine.h"</span>
00013
<a name="l00015"></a><a class="code" href="class_qwt_picker_machine.html#b0">00015</a> <a class="code" href="class_qwt_picker_machine.html#b0">QwtPickerMachine::QwtPickerMachine</a>():
00016 d_state(0)
00017 {
00018 }
00019
<a name="l00021"></a><a class="code" href="class_qwt_picker_machine.html#a0">00021</a> <a class="code" href="class_qwt_picker_machine.html#a0">QwtPickerMachine::~QwtPickerMachine</a>()
00022 {
00023 }
00024
<a name="l00026"></a><a class="code" href="class_qwt_picker_machine.html#b1">00026</a> <span class="keywordtype">int</span> <a class="code" href="class_qwt_picker_machine.html#b1">QwtPickerMachine::state</a>()<span class="keyword"> const</span>
00027 <span class="keyword"></span>{
00028 <span class="keywordflow">return</span> d_state;
00029 }
00030
<a name="l00032"></a><a class="code" href="class_qwt_picker_machine.html#b2">00032</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_picker_machine.html#b2">QwtPickerMachine::setState</a>(<span class="keywordtype">int</span> state)
00033 {
00034 d_state = state;
00035 }
00036
<a name="l00038"></a><a class="code" href="class_qwt_picker_machine.html#a2">00038</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_picker_machine.html#a2">QwtPickerMachine::reset</a>()
00039 {
00040 <a class="code" href="class_qwt_picker_machine.html#b2">setState</a>(0);
00041 }
00042
<a name="l00044"></a><a class="code" href="class_qwt_picker_click_point_machine.html#a0">00044</a> QValueList<QwtPickerMachine::Command> <a class="code" href="class_qwt_picker_click_point_machine.html#a0">QwtPickerClickPointMachine::transition</a>(
00045 <span class="keyword">const</span> <a class="code" href="class_qwt_event_pattern.html">QwtEventPattern</a> &eventPattern, <span class="keyword">const</span> QEvent *e)
00046 {
00047 QValueList<QwtPickerMachine::Command> cmdList;
00048
00049 <span class="keywordflow">switch</span>(e->type())
00050 {
00051 <span class="keywordflow">case</span> QEvent::MouseButtonPress:
00052 {
00053 <span class="keywordflow">if</span> ( eventPattern.<a class="code" href="class_qwt_event_pattern.html#a12">mouseMatch</a>(
00054 QwtEventPattern::MouseSelect1, (<span class="keyword">const</span> QMouseEvent *)e) )
00055 {
00056 cmdList += Begin;
00057 cmdList += Append;
00058 cmdList += End;
00059 }
00060 <span class="keywordflow">break</span>;
00061 }
00062 <span class="keywordflow">case</span> QEvent::KeyPress:
00063 {
00064 <span class="keywordflow">if</span> ( eventPattern.<a class="code" href="class_qwt_event_pattern.html#a13">keyMatch</a>(
00065 QwtEventPattern::KeySelect1, (<span class="keyword">const</span> QKeyEvent *)e) )
00066 {
00067 cmdList += Begin;
00068 cmdList += Append;
00069 cmdList += End;
00070 }
00071 <span class="keywordflow">break</span>;
00072 }
00073 <span class="keywordflow">default</span>:
00074 <span class="keywordflow">break</span>;
00075 }
00076
00077 <span class="keywordflow">return</span> cmdList;
00078 }
00079
<a name="l00081"></a><a class="code" href="class_qwt_picker_drag_point_machine.html#a0">00081</a> QValueList<QwtPickerMachine::Command> <a class="code" href="class_qwt_picker_drag_point_machine.html#a0">QwtPickerDragPointMachine::transition</a>(
00082 <span class="keyword">const</span> <a class="code" href="class_qwt_event_pattern.html">QwtEventPattern</a> &eventPattern, <span class="keyword">const</span> QEvent *e)
00083 {
00084 QValueList<QwtPickerMachine::Command> cmdList;
00085
00086 <span class="keywordflow">switch</span>(e->type())
00087 {
00088 <span class="keywordflow">case</span> QEvent::MouseButtonPress:
00089 {
00090 <span class="keywordflow">if</span> ( eventPattern.<a class="code" href="class_qwt_event_pattern.html#a12">mouseMatch</a>(
00091 QwtEventPattern::MouseSelect1, (<span class="keyword">const</span> QMouseEvent *)e) )
00092 {
00093 <span class="keywordflow">if</span> ( <a class="code" href="class_qwt_picker_machine.html#b1">state</a>() == 0 )
00094 {
00095 cmdList += Begin;
00096 cmdList += Append;
00097 <a class="code" href="class_qwt_picker_machine.html#b2">setState</a>(1);
00098 }
00099 }
00100 <span class="keywordflow">break</span>;
00101 }
00102 <span class="keywordflow">case</span> QEvent::MouseMove:
00103 <span class="keywordflow">case</span> QEvent::Wheel:
00104 {
00105 <span class="keywordflow">if</span> ( <a class="code" href="class_qwt_picker_machine.html#b1">state</a>() != 0 )
00106 cmdList += Move;
00107 <span class="keywordflow">break</span>;
00108 }
00109 <span class="keywordflow">case</span> QEvent::MouseButtonRelease:
00110 {
00111 <span class="keywordflow">if</span> ( <a class="code" href="class_qwt_picker_machine.html#b1">state</a>() != 0 )
00112 {
00113 cmdList += End;
00114 <a class="code" href="class_qwt_picker_machine.html#b2">setState</a>(0);
00115 }
00116 <span class="keywordflow">break</span>;
00117 }
00118 <span class="keywordflow">case</span> QEvent::KeyPress:
00119 {
00120 <span class="keywordflow">if</span> ( eventPattern.<a class="code" href="class_qwt_event_pattern.html#a13">keyMatch</a>(
00121 QwtEventPattern::KeySelect1, (<span class="keyword">const</span> QKeyEvent *)e) )
00122 {
00123 <span class="keywordflow">if</span> ( <a class="code" href="class_qwt_picker_machine.html#b1">state</a>() == 0 )
00124 {
00125 cmdList += Begin;
00126 cmdList += Append;
00127 <a class="code" href="class_qwt_picker_machine.html#b2">setState</a>(1);
00128 }
00129 <span class="keywordflow">else</span>
00130 {
00131 cmdList += End;
00132 <a class="code" href="class_qwt_picker_machine.html#b2">setState</a>(0);
00133 }
00134 }
00135 <span class="keywordflow">break</span>;
00136 }
00137 <span class="keywordflow">default</span>:
00138 <span class="keywordflow">break</span>;
00139 }
00140
00141 <span class="keywordflow">return</span> cmdList;
00142 }
00143
<a name="l00145"></a><a class="code" href="class_qwt_picker_click_rect_machine.html#a0">00145</a> QValueList<QwtPickerMachine::Command> <a class="code" href="class_qwt_picker_click_rect_machine.html#a0">QwtPickerClickRectMachine::transition</a>(
00146 <span class="keyword">const</span> <a class="code" href="class_qwt_event_pattern.html">QwtEventPattern</a> &eventPattern, <span class="keyword">const</span> QEvent *e)
00147 {
00148 QValueList<QwtPickerMachine::Command> cmdList;
00149
00150 <span class="keywordflow">switch</span>(e->type())
00151 {
00152 <span class="keywordflow">case</span> QEvent::MouseButtonPress:
00153 {
00154 <span class="keywordflow">if</span> ( eventPattern.<a class="code" href="class_qwt_event_pattern.html#a12">mouseMatch</a>(
00155 QwtEventPattern::MouseSelect1, (<span class="keyword">const</span> QMouseEvent *)e) )
00156 {
00157 <span class="keywordflow">switch</span>(<a class="code" href="class_qwt_picker_machine.html#b1">state</a>())
00158 {
00159 <span class="keywordflow">case</span> 0:
00160 {
00161 cmdList += Begin;
00162 cmdList += Append;
00163 <a class="code" href="class_qwt_picker_machine.html#b2">setState</a>(1);
00164 <span class="keywordflow">break</span>;
00165 }
00166 <span class="keywordflow">case</span> 1:
00167 {
00168 <span class="comment">// Uh, strange we missed the MouseButtonRelease</span>
00169 <span class="keywordflow">break</span>;
00170 }
00171 <span class="keywordflow">default</span>:
00172 {
00173 cmdList += End;
00174 <a class="code" href="class_qwt_picker_machine.html#b2">setState</a>(0);
00175 }
00176 }
00177 }
00178 }
00179 <span class="keywordflow">case</span> QEvent::MouseMove:
00180 <span class="keywordflow">case</span> QEvent::Wheel:
00181 {
00182 <span class="keywordflow">if</span> ( <a class="code" href="class_qwt_picker_machine.html#b1">state</a>() != 0 )
00183 cmdList += Move;
00184 <span class="keywordflow">break</span>;
00185 }
00186 <span class="keywordflow">case</span> QEvent::MouseButtonRelease:
00187 {
00188 <span class="keywordflow">if</span> ( eventPattern.<a class="code" href="class_qwt_event_pattern.html#a12">mouseMatch</a>(
00189 QwtEventPattern::MouseSelect1, (<span class="keyword">const</span> QMouseEvent *)e) )
00190 {
00191 <span class="keywordflow">if</span> ( <a class="code" href="class_qwt_picker_machine.html#b1">state</a>() == 1 )
00192 {
00193 cmdList += Append;
00194 <a class="code" href="class_qwt_picker_machine.html#b2">setState</a>(2);
00195 }
00196 }
00197 <span class="keywordflow">break</span>;
00198 }
00199 <span class="keywordflow">case</span> QEvent::KeyPress:
00200 {
00201 <span class="keywordflow">if</span> ( eventPattern.<a class="code" href="class_qwt_event_pattern.html#a13">keyMatch</a>(
00202 QwtEventPattern::KeySelect1, (<span class="keyword">const</span> QKeyEvent *)e) )
00203 {
00204 <span class="keywordflow">if</span> ( <a class="code" href="class_qwt_picker_machine.html#b1">state</a>() == 0 )
00205 {
00206 cmdList += Begin;
00207 cmdList += Append;
00208 <a class="code" href="class_qwt_picker_machine.html#b2">setState</a>(1);
00209 }
00210 <span class="keywordflow">else</span>
00211 {
00212 <span class="keywordflow">if</span> ( <a class="code" href="class_qwt_picker_machine.html#b1">state</a>() == 1 )
00213 {
00214 cmdList += Append;
00215 <a class="code" href="class_qwt_picker_machine.html#b2">setState</a>(2);
00216 }
00217 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="class_qwt_picker_machine.html#b1">state</a>() == 2 )
00218 {
00219 cmdList += End;
00220 <a class="code" href="class_qwt_picker_machine.html#b2">setState</a>(0);
00221 }
00222 }
00223 }
00224 <span class="keywordflow">break</span>;
00225 }
00226 <span class="keywordflow">default</span>:
00227 <span class="keywordflow">break</span>;
00228 }
00229
00230 <span class="keywordflow">return</span> cmdList;
00231 }
00232
<a name="l00234"></a><a class="code" href="class_qwt_picker_drag_rect_machine.html#a0">00234</a> QValueList<QwtPickerMachine::Command> <a class="code" href="class_qwt_picker_drag_rect_machine.html#a0">QwtPickerDragRectMachine::transition</a>(
00235 <span class="keyword">const</span> <a class="code" href="class_qwt_event_pattern.html">QwtEventPattern</a> &eventPattern, <span class="keyword">const</span> QEvent *e)
00236 {
00237 QValueList<QwtPickerMachine::Command> cmdList;
00238
00239 <span class="keywordflow">switch</span>(e->type())
00240 {
00241 <span class="keywordflow">case</span> QEvent::MouseButtonPress:
00242 {
00243 <span class="keywordflow">if</span> ( eventPattern.<a class="code" href="class_qwt_event_pattern.html#a12">mouseMatch</a>(
00244 QwtEventPattern::MouseSelect1, (<span class="keyword">const</span> QMouseEvent *)e) )
00245 {
00246 <span class="keywordflow">if</span> ( <a class="code" href="class_qwt_picker_machine.html#b1">state</a>() == 0 )
00247 {
00248 cmdList += Begin;
00249 cmdList += Append;
00250 cmdList += Append;
00251 <a class="code" href="class_qwt_picker_machine.html#b2">setState</a>(2);
00252 }
00253 }
00254 <span class="keywordflow">break</span>;
00255 }
00256 <span class="keywordflow">case</span> QEvent::MouseMove:
00257 <span class="keywordflow">case</span> QEvent::Wheel:
00258 {
00259 <span class="keywordflow">if</span> ( <a class="code" href="class_qwt_picker_machine.html#b1">state</a>() != 0 )
00260 cmdList += Move;
00261 <span class="keywordflow">break</span>;
00262 }
00263 <span class="keywordflow">case</span> QEvent::MouseButtonRelease:
00264 {
00265 <span class="keywordflow">if</span> ( <a class="code" href="class_qwt_picker_machine.html#b1">state</a>() == 2 )
00266 {
00267 cmdList += End;
00268 <a class="code" href="class_qwt_picker_machine.html#b2">setState</a>(0);
00269 }
00270 <span class="keywordflow">break</span>;
00271 }
00272 <span class="keywordflow">case</span> QEvent::KeyPress:
00273 {
00274 <span class="keywordflow">if</span> ( eventPattern.<a class="code" href="class_qwt_event_pattern.html#a13">keyMatch</a>(
00275 QwtEventPattern::KeySelect1, (<span class="keyword">const</span> QKeyEvent *)e) )
00276 {
00277 <span class="keywordflow">if</span> ( <a class="code" href="class_qwt_picker_machine.html#b1">state</a>() == 0 )
00278 {
00279 cmdList += Begin;
00280 cmdList += Append;
00281 cmdList += Append;
00282 <a class="code" href="class_qwt_picker_machine.html#b2">setState</a>(2);
00283 }
00284 <span class="keywordflow">else</span>
00285 {
00286 cmdList += End;
00287 <a class="code" href="class_qwt_picker_machine.html#b2">setState</a>(0);
00288 }
00289 }
00290 <span class="keywordflow">break</span>;
00291 }
00292 <span class="keywordflow">default</span>:
00293 <span class="keywordflow">break</span>;
00294 }
00295
00296 <span class="keywordflow">return</span> cmdList;
00297 }
00298
<a name="l00300"></a><a class="code" href="class_qwt_picker_polygon_machine.html#a0">00300</a> QValueList<QwtPickerMachine::Command> <a class="code" href="class_qwt_picker_polygon_machine.html#a0">QwtPickerPolygonMachine::transition</a>(
00301 <span class="keyword">const</span> <a class="code" href="class_qwt_event_pattern.html">QwtEventPattern</a> &eventPattern, <span class="keyword">const</span> QEvent *e)
00302 {
00303 QValueList<QwtPickerMachine::Command> cmdList;
00304
00305 <span class="keywordflow">switch</span>(e->type())
00306 {
00307 <span class="keywordflow">case</span> QEvent::MouseButtonPress:
00308 {
00309 <span class="keywordflow">if</span> ( eventPattern.<a class="code" href="class_qwt_event_pattern.html#a12">mouseMatch</a>(
00310 QwtEventPattern::MouseSelect1, (<span class="keyword">const</span> QMouseEvent *)e) )
00311 {
00312 <span class="keywordflow">if</span> (<a class="code" href="class_qwt_picker_machine.html#b1">state</a>() == 0)
00313 {
00314 cmdList += Begin;
00315 cmdList += Append;
00316 cmdList += Append;
00317 <a class="code" href="class_qwt_picker_machine.html#b2">setState</a>(1);
00318 }
00319 <span class="keywordflow">else</span>
00320 {
00321 cmdList += End;
00322 <a class="code" href="class_qwt_picker_machine.html#b2">setState</a>(0);
00323 }
00324 }
00325 <span class="keywordflow">if</span> ( eventPattern.<a class="code" href="class_qwt_event_pattern.html#a12">mouseMatch</a>(
00326 QwtEventPattern::MouseSelect2, (<span class="keyword">const</span> QMouseEvent *)e) )
00327 {
00328 <span class="keywordflow">if</span> (<a class="code" href="class_qwt_picker_machine.html#b1">state</a>() == 1)
00329 cmdList += Append;
00330 }
00331 <span class="keywordflow">break</span>;
00332 }
00333 <span class="keywordflow">case</span> QEvent::MouseMove:
00334 <span class="keywordflow">case</span> QEvent::Wheel:
00335 {
00336 <span class="keywordflow">if</span> ( <a class="code" href="class_qwt_picker_machine.html#b1">state</a>() != 0 )
00337 cmdList += Move;
00338 <span class="keywordflow">break</span>;
00339 }
00340 <span class="keywordflow">case</span> QEvent::KeyPress:
00341 {
00342 <span class="keywordflow">if</span> ( eventPattern.<a class="code" href="class_qwt_event_pattern.html#a13">keyMatch</a>(
00343 QwtEventPattern::KeySelect1, (<span class="keyword">const</span> QKeyEvent *)e) )
00344 {
00345 <span class="keywordflow">if</span> ( <a class="code" href="class_qwt_picker_machine.html#b1">state</a>() == 0 )
00346 {
00347 cmdList += Begin;
00348 cmdList += Append;
00349 cmdList += Append;
00350 <a class="code" href="class_qwt_picker_machine.html#b2">setState</a>(1);
00351 }
00352 <span class="keywordflow">else</span>
00353 {
00354 cmdList += End;
00355 <a class="code" href="class_qwt_picker_machine.html#b2">setState</a>(0);
00356 }
00357 }
00358 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( eventPattern.<a class="code" href="class_qwt_event_pattern.html#a13">keyMatch</a>(
00359 QwtEventPattern::KeySelect2, (<span class="keyword">const</span> QKeyEvent *)e) )
00360 {
00361 <span class="keywordflow">if</span> ( <a class="code" href="class_qwt_picker_machine.html#b1">state</a>() == 1 )
00362 cmdList += Append;
00363 }
00364 <span class="keywordflow">break</span>;
00365 }
00366 <span class="keywordflow">default</span>:
00367 <span class="keywordflow">break</span>;
00368 }
00369
00370 <span class="keywordflow">return</span> cmdList;
00371 }
</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>
|