<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>Qwt User's Guide: qwt_picker.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.7.3 --> <div id="top"> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">Qwt User's Guide <span id="projectnumber">6.0.1</span></div> </td> </tr> </tbody> </table> </div> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File List</span></a></li> </ul> </div> <div class="header"> <div class="headertitle"> <h1>qwt_picker.h</h1> </div> </div> <div class="contents"> <div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************</span> <a name="l00002"></a>00002 <span class="comment"> * Qwt Widget Library</span> <a name="l00003"></a>00003 <span class="comment"> * Copyright (C) 1997 Josef Wilgen</span> <a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002 Uwe Rathmann</span> <a name="l00005"></a>00005 <span class="comment"> *</span> <a name="l00006"></a>00006 <span class="comment"> * This library is free software; you can redistribute it and/or</span> <a name="l00007"></a>00007 <span class="comment"> * modify it under the terms of the Qwt License, Version 1.0</span> <a name="l00008"></a>00008 <span class="comment"> *****************************************************************************/</span> <a name="l00009"></a>00009 <a name="l00010"></a>00010 <span class="preprocessor">#ifndef QWT_PICKER</span> <a name="l00011"></a>00011 <span class="preprocessor"></span><span class="preprocessor">#define QWT_PICKER 1</span> <a name="l00012"></a>00012 <span class="preprocessor"></span> <a name="l00013"></a>00013 <span class="preprocessor">#include "qwt_global.h"</span> <a name="l00014"></a>00014 <span class="preprocessor">#include "qwt_text.h"</span> <a name="l00015"></a>00015 <span class="preprocessor">#include "qwt_event_pattern.h"</span> <a name="l00016"></a>00016 <span class="preprocessor">#include <qobject.h></span> <a name="l00017"></a>00017 <span class="preprocessor">#include <qpen.h></span> <a name="l00018"></a>00018 <span class="preprocessor">#include <qfont.h></span> <a name="l00019"></a>00019 <span class="preprocessor">#include <qrect.h></span> <a name="l00020"></a>00020 <a name="l00021"></a>00021 <span class="keyword">class </span>QWidget; <a name="l00022"></a>00022 <span class="keyword">class </span>QMouseEvent; <a name="l00023"></a>00023 <span class="keyword">class </span>QWheelEvent; <a name="l00024"></a>00024 <span class="keyword">class </span>QKeyEvent; <a name="l00025"></a>00025 <span class="keyword">class </span><a class="code" href="class_qwt_picker_machine.html" title="A state machine for QwtPicker selections.">QwtPickerMachine</a>; <a name="l00026"></a>00026 <a name="l00093"></a><a class="code" href="class_qwt_picker.html">00093</a> <span class="keyword">class </span>QWT_EXPORT <a class="code" href="class_qwt_picker.html" title="QwtPicker provides selections on a widget.">QwtPicker</a>: <span class="keyword">public</span> QObject, <span class="keyword">public</span> <a class="code" href="class_qwt_event_pattern.html" title="A collection of event patterns.">QwtEventPattern</a> <a name="l00094"></a>00094 { <a name="l00095"></a>00095 Q_OBJECT <a name="l00096"></a>00096 <a name="l00097"></a>00097 Q_ENUMS( <a class="code" href="class_qwt_picker.html#ab36c79d8ff20aba5b778d2823c1f7894">RubberBand</a> ) <a name="l00098"></a>00098 Q_ENUMS( <a class="code" href="class_qwt_picker.html#a01be4d404ffc3a7b238b0d0aaeb66b93" title="Display mode.">DisplayMode</a> ) <a name="l00099"></a>00099 Q_ENUMS( <a class="code" href="class_qwt_picker.html#ab3c894deed026f392496dd07809a6fd3">ResizeMode</a> ) <a name="l00100"></a>00100 <a name="l00101"></a>00101 Q_PROPERTY( <span class="keywordtype">bool</span> isEnabled READ isEnabled WRITE setEnabled ) <a name="l00102"></a>00102 Q_PROPERTY( <a class="code" href="class_qwt_picker.html#ab3c894deed026f392496dd07809a6fd3">ResizeMode</a> resizeMode READ resizeMode WRITE setResizeMode ) <a name="l00103"></a>00103 <a name="l00104"></a>00104 Q_PROPERTY( <a class="code" href="class_qwt_picker.html#a01be4d404ffc3a7b238b0d0aaeb66b93" title="Display mode.">DisplayMode</a> trackerMode READ trackerMode WRITE setTrackerMode ) <a name="l00105"></a>00105 Q_PROPERTY( QPen trackerPen READ trackerPen WRITE setTrackerPen ) <a name="l00106"></a>00106 Q_PROPERTY( QFont trackerFont READ trackerFont WRITE setTrackerFont ) <a name="l00107"></a>00107 <a name="l00108"></a>00108 Q_PROPERTY( <a class="code" href="class_qwt_picker.html#ab36c79d8ff20aba5b778d2823c1f7894">RubberBand</a> rubberBand READ rubberBand WRITE setRubberBand ) <a name="l00109"></a>00109 Q_PROPERTY( QPen rubberBandPen READ rubberBandPen WRITE setRubberBandPen ) <a name="l00110"></a>00110 <a name="l00111"></a>00111 <span class="keyword">public</span>: <a name="l00119"></a><a class="code" href="class_qwt_picker.html#ab36c79d8ff20aba5b778d2823c1f7894">00119</a> <span class="keyword">enum</span> <a class="code" href="class_qwt_picker.html#ab36c79d8ff20aba5b778d2823c1f7894">RubberBand</a> <a name="l00120"></a>00120 { <a name="l00122"></a><a class="code" href="class_qwt_picker.html#ab36c79d8ff20aba5b778d2823c1f7894abe995b2c285314bf9fc459581e100934">00122</a> NoRubberBand = 0, <a name="l00123"></a>00123 <a name="l00125"></a><a class="code" href="class_qwt_picker.html#ab36c79d8ff20aba5b778d2823c1f7894a9f3ab0ea1294b4eb2cae7b919ce0ffb0">00125</a> <a class="code" href="class_qwt_picker.html#ab36c79d8ff20aba5b778d2823c1f7894a9f3ab0ea1294b4eb2cae7b919ce0ffb0" title="A horizontal line ( only for QwtPicker::PointSelection )">HLineRubberBand</a>, <a name="l00126"></a>00126 <a name="l00128"></a><a class="code" href="class_qwt_picker.html#ab36c79d8ff20aba5b778d2823c1f7894a0eb6ef7b155e41ea015afc7f68940a86">00128</a> <a class="code" href="class_qwt_picker.html#ab36c79d8ff20aba5b778d2823c1f7894a0eb6ef7b155e41ea015afc7f68940a86" title="A vertical line ( only for QwtPicker::PointSelection )">VLineRubberBand</a>, <a name="l00129"></a>00129 <a name="l00131"></a><a class="code" href="class_qwt_picker.html#ab36c79d8ff20aba5b778d2823c1f7894a1b90615892fec7ff6bb3352ce887b097">00131</a> <a class="code" href="class_qwt_picker.html#ab36c79d8ff20aba5b778d2823c1f7894a1b90615892fec7ff6bb3352ce887b097" title="A crosshair ( only for QwtPicker::PointSelection )">CrossRubberBand</a>, <a name="l00132"></a>00132 <a name="l00134"></a><a class="code" href="class_qwt_picker.html#ab36c79d8ff20aba5b778d2823c1f7894ae4dc32fb99b4fe2058bb594ab5e8c70a">00134</a> <a class="code" href="class_qwt_picker.html#ab36c79d8ff20aba5b778d2823c1f7894ae4dc32fb99b4fe2058bb594ab5e8c70a" title="A rectangle ( only for QwtPicker::RectSelection )">RectRubberBand</a>, <a name="l00135"></a>00135 <a name="l00137"></a><a class="code" href="class_qwt_picker.html#ab36c79d8ff20aba5b778d2823c1f7894a6a548d259f7f04ae868419431883e7ef">00137</a> <a class="code" href="class_qwt_picker.html#ab36c79d8ff20aba5b778d2823c1f7894a6a548d259f7f04ae868419431883e7ef" title="An ellipse ( only for QwtPicker::RectSelection )">EllipseRubberBand</a>, <a name="l00138"></a>00138 <a name="l00140"></a><a class="code" href="class_qwt_picker.html#ab36c79d8ff20aba5b778d2823c1f7894a8b78b6221f2808abe027569c790f0945">00140</a> <a class="code" href="class_qwt_picker.html#ab36c79d8ff20aba5b778d2823c1f7894a8b78b6221f2808abe027569c790f0945" title="A polygon ( only for QwtPicker::&amp;PolygonSelection )">PolygonRubberBand</a>, <a name="l00141"></a>00141 <a name="l00146"></a><a class="code" href="class_qwt_picker.html#ab36c79d8ff20aba5b778d2823c1f7894a96f40f8cc50bd940f0338a68ba159b8e">00146</a> UserRubberBand = 100 <a name="l00147"></a>00147 }; <a name="l00148"></a>00148 <a name="l00153"></a><a class="code" href="class_qwt_picker.html#a01be4d404ffc3a7b238b0d0aaeb66b93">00153</a> <span class="keyword">enum</span> <a class="code" href="class_qwt_picker.html#a01be4d404ffc3a7b238b0d0aaeb66b93" title="Display mode.">DisplayMode</a> <a name="l00154"></a>00154 { <a name="l00156"></a><a class="code" href="class_qwt_picker.html#a01be4d404ffc3a7b238b0d0aaeb66b93a94fcf579dddb78a1c88fd4136d3a673a">00156</a> <a class="code" href="class_qwt_picker.html#a01be4d404ffc3a7b238b0d0aaeb66b93a94fcf579dddb78a1c88fd4136d3a673a" title="Display never.">AlwaysOff</a>, <a name="l00157"></a>00157 <a name="l00159"></a><a class="code" href="class_qwt_picker.html#a01be4d404ffc3a7b238b0d0aaeb66b93a07a7513aa69633c1a3b04fdbfe4674e0">00159</a> <a class="code" href="class_qwt_picker.html#a01be4d404ffc3a7b238b0d0aaeb66b93a07a7513aa69633c1a3b04fdbfe4674e0" title="Display always.">AlwaysOn</a>, <a name="l00160"></a>00160 <a name="l00162"></a><a class="code" href="class_qwt_picker.html#a01be4d404ffc3a7b238b0d0aaeb66b93a973f3446b39ea41b5dc3b31593ecb64a">00162</a> ActiveOnly <a name="l00163"></a>00163 }; <a name="l00164"></a>00164 <a name="l00173"></a><a class="code" href="class_qwt_picker.html#ab3c894deed026f392496dd07809a6fd3">00173</a> <span class="keyword">enum</span> <a class="code" href="class_qwt_picker.html#ab3c894deed026f392496dd07809a6fd3">ResizeMode</a> <a name="l00174"></a>00174 { <a name="l00176"></a><a class="code" href="class_qwt_picker.html#ab3c894deed026f392496dd07809a6fd3a86899007b306839db254d6d9712af588">00176</a> <a class="code" href="class_qwt_picker.html#ab3c894deed026f392496dd07809a6fd3a86899007b306839db254d6d9712af588" title="All points are scaled according to the new size,.">Stretch</a>, <a name="l00177"></a>00177 <a name="l00179"></a><a class="code" href="class_qwt_picker.html#ab3c894deed026f392496dd07809a6fd3ae873df582534c398b2f753763b0eb780">00179</a> KeepSize <a name="l00180"></a>00180 }; <a name="l00181"></a>00181 <a name="l00182"></a>00182 <span class="keyword">explicit</span> <a class="code" href="class_qwt_picker.html" title="QwtPicker provides selections on a widget.">QwtPicker</a>( QWidget *parent ); <a name="l00183"></a>00183 <span class="keyword">explicit</span> <a class="code" href="class_qwt_picker.html" title="QwtPicker provides selections on a widget.">QwtPicker</a>( RubberBand rubberBand, <a name="l00184"></a>00184 DisplayMode trackerMode, QWidget * ); <a name="l00185"></a>00185 <a name="l00186"></a>00186 <span class="keyword">virtual</span> ~<a class="code" href="class_qwt_picker.html" title="QwtPicker provides selections on a widget.">QwtPicker</a>(); <a name="l00187"></a>00187 <a name="l00188"></a>00188 <span class="keywordtype">void</span> setStateMachine( <a class="code" href="class_qwt_picker_machine.html" title="A state machine for QwtPicker selections.">QwtPickerMachine</a> * ); <a name="l00189"></a>00189 <span class="keyword">const</span> <a class="code" href="class_qwt_picker_machine.html" title="A state machine for QwtPicker selections.">QwtPickerMachine</a> *stateMachine() <span class="keyword">const</span>; <a name="l00190"></a>00190 <a class="code" href="class_qwt_picker_machine.html" title="A state machine for QwtPicker selections.">QwtPickerMachine</a> *stateMachine(); <a name="l00191"></a>00191 <a name="l00192"></a>00192 <span class="keywordtype">void</span> setRubberBand( RubberBand ); <a name="l00193"></a>00193 RubberBand rubberBand() <span class="keyword">const</span>; <a name="l00194"></a>00194 <a name="l00195"></a>00195 <span class="keywordtype">void</span> setTrackerMode( DisplayMode ); <a name="l00196"></a>00196 DisplayMode trackerMode() <span class="keyword">const</span>; <a name="l00197"></a>00197 <a name="l00198"></a>00198 <span class="keywordtype">void</span> setResizeMode( ResizeMode ); <a name="l00199"></a>00199 ResizeMode resizeMode() <span class="keyword">const</span>; <a name="l00200"></a>00200 <a name="l00201"></a>00201 <span class="keywordtype">void</span> setRubberBandPen( <span class="keyword">const</span> QPen & ); <a name="l00202"></a>00202 QPen rubberBandPen() <span class="keyword">const</span>; <a name="l00203"></a>00203 <a name="l00204"></a>00204 <span class="keywordtype">void</span> setTrackerPen( <span class="keyword">const</span> QPen & ); <a name="l00205"></a>00205 QPen trackerPen() <span class="keyword">const</span>; <a name="l00206"></a>00206 <a name="l00207"></a>00207 <span class="keywordtype">void</span> setTrackerFont( <span class="keyword">const</span> QFont & ); <a name="l00208"></a>00208 QFont trackerFont() <span class="keyword">const</span>; <a name="l00209"></a>00209 <a name="l00210"></a>00210 <span class="keywordtype">bool</span> isEnabled() <span class="keyword">const</span>; <a name="l00211"></a>00211 <span class="keywordtype">bool</span> isActive() <span class="keyword">const</span>; <a name="l00212"></a>00212 <a name="l00213"></a>00213 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> eventFilter( QObject *, QEvent * ); <a name="l00214"></a>00214 <a name="l00215"></a>00215 QWidget *parentWidget(); <a name="l00216"></a>00216 <span class="keyword">const</span> QWidget *parentWidget() <span class="keyword">const</span>; <a name="l00217"></a>00217 <a name="l00218"></a>00218 <span class="keyword">virtual</span> QRect pickRect() <span class="keyword">const</span>; <a name="l00219"></a>00219 <a name="l00220"></a>00220 <span class="keyword">virtual</span> <span class="keywordtype">void</span> drawRubberBand( QPainter * ) <span class="keyword">const</span>; <a name="l00221"></a>00221 <span class="keyword">virtual</span> <span class="keywordtype">void</span> drawTracker( QPainter * ) <span class="keyword">const</span>; <a name="l00222"></a>00222 <a name="l00223"></a>00223 <span class="keyword">virtual</span> <a class="code" href="class_qwt_text.html" title="A class representing a text.">QwtText</a> trackerText( <span class="keyword">const</span> QPoint &pos ) <span class="keyword">const</span>; <a name="l00224"></a>00224 QPoint trackerPosition() <span class="keyword">const</span>; <a name="l00225"></a>00225 <span class="keyword">virtual</span> QRect trackerRect( <span class="keyword">const</span> QFont & ) <span class="keyword">const</span>; <a name="l00226"></a>00226 <a name="l00227"></a>00227 QPolygon selection() <span class="keyword">const</span>; <a name="l00228"></a>00228 <a name="l00229"></a>00229 <span class="keyword">public</span> Q_SLOTS: <a name="l00230"></a>00230 <span class="keywordtype">void</span> setEnabled( <span class="keywordtype">bool</span> ); <a name="l00231"></a>00231 <a name="l00232"></a>00232 Q_SIGNALS: <a name="l00240"></a>00240 <span class="keywordtype">void</span> activated( <span class="keywordtype">bool</span> on ); <a name="l00241"></a>00241 <a name="l00248"></a>00248 <span class="keywordtype">void</span> selected( <span class="keyword">const</span> QPolygon &polygon ); <a name="l00249"></a>00249 <a name="l00256"></a>00256 <span class="keywordtype">void</span> appended( <span class="keyword">const</span> QPoint &pos ); <a name="l00257"></a>00257 <a name="l00265"></a>00265 <span class="keywordtype">void</span> moved( <span class="keyword">const</span> QPoint &pos ); <a name="l00266"></a>00266 <a name="l00273"></a>00273 <span class="keywordtype">void</span> removed( <span class="keyword">const</span> QPoint &pos ); <a name="l00281"></a>00281 <span class="keywordtype">void</span> changed( <span class="keyword">const</span> QPolygon &selection ); <a name="l00282"></a>00282 <a name="l00283"></a>00283 <span class="keyword">protected</span>: <a name="l00284"></a>00284 <span class="keyword">virtual</span> QPolygon adjustedPoints( <span class="keyword">const</span> QPolygon & ) <span class="keyword">const</span>; <a name="l00285"></a>00285 <a name="l00286"></a>00286 <span class="keyword">virtual</span> <span class="keywordtype">void</span> transition( <span class="keyword">const</span> QEvent * ); <a name="l00287"></a>00287 <a name="l00288"></a>00288 <span class="keyword">virtual</span> <span class="keywordtype">void</span> begin(); <a name="l00289"></a>00289 <span class="keyword">virtual</span> <span class="keywordtype">void</span> append( <span class="keyword">const</span> QPoint & ); <a name="l00290"></a>00290 <span class="keyword">virtual</span> <span class="keywordtype">void</span> move( <span class="keyword">const</span> QPoint & ); <a name="l00291"></a>00291 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <span class="keyword">remove</span>(); <a name="l00292"></a>00292 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> end( <span class="keywordtype">bool</span> ok = <span class="keyword">true</span> ); <a name="l00293"></a>00293 <a name="l00294"></a>00294 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> accept( QPolygon & ) <span class="keyword">const</span>; <a name="l00295"></a>00295 <span class="keyword">virtual</span> <span class="keywordtype">void</span> reset(); <a name="l00296"></a>00296 <a name="l00297"></a>00297 <span class="keyword">virtual</span> <span class="keywordtype">void</span> widgetMousePressEvent( QMouseEvent * ); <a name="l00298"></a>00298 <span class="keyword">virtual</span> <span class="keywordtype">void</span> widgetMouseReleaseEvent( QMouseEvent * ); <a name="l00299"></a>00299 <span class="keyword">virtual</span> <span class="keywordtype">void</span> widgetMouseDoubleClickEvent( QMouseEvent * ); <a name="l00300"></a>00300 <span class="keyword">virtual</span> <span class="keywordtype">void</span> widgetMouseMoveEvent( QMouseEvent * ); <a name="l00301"></a>00301 <span class="keyword">virtual</span> <span class="keywordtype">void</span> widgetWheelEvent( QWheelEvent * ); <a name="l00302"></a>00302 <span class="keyword">virtual</span> <span class="keywordtype">void</span> widgetKeyPressEvent( QKeyEvent * ); <a name="l00303"></a>00303 <span class="keyword">virtual</span> <span class="keywordtype">void</span> widgetKeyReleaseEvent( QKeyEvent * ); <a name="l00304"></a>00304 <span class="keyword">virtual</span> <span class="keywordtype">void</span> widgetEnterEvent( QEvent * ); <a name="l00305"></a>00305 <span class="keyword">virtual</span> <span class="keywordtype">void</span> widgetLeaveEvent( QEvent * ); <a name="l00306"></a>00306 <a name="l00307"></a>00307 <span class="keyword">virtual</span> <span class="keywordtype">void</span> stretchSelection( <span class="keyword">const</span> QSize &oldSize, <a name="l00308"></a>00308 <span class="keyword">const</span> QSize &newSize ); <a name="l00309"></a>00309 <a name="l00310"></a>00310 <span class="keyword">virtual</span> <span class="keywordtype">void</span> updateDisplay(); <a name="l00311"></a>00311 <a name="l00312"></a>00312 <span class="keyword">const</span> QWidget *rubberBandWidget() <span class="keyword">const</span>; <a name="l00313"></a>00313 <span class="keyword">const</span> QWidget *trackerWidget() <span class="keyword">const</span>; <a name="l00314"></a>00314 <a name="l00315"></a>00315 <span class="keyword">const</span> QPolygon &pickedPoints() <span class="keyword">const</span>; <a name="l00316"></a>00316 <a name="l00317"></a>00317 <span class="keyword">private</span>: <a name="l00318"></a>00318 <span class="keywordtype">void</span> init( QWidget *, RubberBand rubberBand, DisplayMode trackerMode ); <a name="l00319"></a>00319 <a name="l00320"></a>00320 <span class="keywordtype">void</span> setMouseTracking( <span class="keywordtype">bool</span> ); <a name="l00321"></a>00321 <a name="l00322"></a>00322 <span class="keyword">class </span>PickerWidget; <a name="l00323"></a>00323 <span class="keyword">class </span>PrivateData; <a name="l00324"></a>00324 PrivateData *d_data; <a name="l00325"></a>00325 }; <a name="l00326"></a>00326 <a name="l00327"></a>00327 <span class="preprocessor">#endif</span> </pre></div></div> </div> <hr class="footer"/><address class="footer"><small>Generated by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </small></address> </body> </html>