<html> <head> <link rel="stylesheet" href="page.css" type="text/css"> <title>fox-toolkit.org - Documentation</title> </head> <body bgcolor=#ffffff link=#990033 vlink=#990033 alink=#990033 text=#000000> <font face='verdana,sans-serif' size=2 > <!---- TOPIC TITLE WITH LOGO---> <table border=0 cellpadding= cellspacing=2 width=100% ><tr><td><a href='http://www.fox-toolkit.org/doc.html'><img src='../art/foxlogo_small.jpg' border=0></a></td><td width=100% valign=bottom><font face='verdana,sans-serif' size=2 ><b> <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">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <br><img src='../art/line.gif' width=100% height=1></b></font></td></tr></table> <p> <!--- TOPIC TITLE WITH LOGO ---> <!-- Generated by Doxygen 1.3.3 --> <h1>FXDial.h</h1><div class="fragment"><pre>00001 <span class="comment">/********************************************************************************</span> 00002 <span class="comment">* *</span> 00003 <span class="comment">* D i a l W i d g e t *</span> 00004 <span class="comment">* *</span> 00005 <span class="comment">*********************************************************************************</span> 00006 <span class="comment">* Copyright (C) 1998,2004 by Jeroen van der Zijp. All Rights Reserved. *</span> 00007 <span class="comment">*********************************************************************************</span> 00008 <span class="comment">* This library is free software; you can redistribute it and/or *</span> 00009 <span class="comment">* modify it under the terms of the GNU Lesser General Public *</span> 00010 <span class="comment">* License as published by the Free Software Foundation; either *</span> 00011 <span class="comment">* version 2.1 of the License, or (at your option) any later version. *</span> 00012 <span class="comment">* *</span> 00013 <span class="comment">* This library is distributed in the hope that it will be useful, *</span> 00014 <span class="comment">* but WITHOUT ANY WARRANTY; without even the implied warranty of *</span> 00015 <span class="comment">* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *</span> 00016 <span class="comment">* Lesser General Public License for more details. *</span> 00017 <span class="comment">* *</span> 00018 <span class="comment">* You should have received a copy of the GNU Lesser General Public *</span> 00019 <span class="comment">* License along with this library; if not, write to the Free Software *</span> 00020 <span class="comment">* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *</span> 00021 <span class="comment">*********************************************************************************</span> 00022 <span class="comment">* $Id: FXDial.h,v 1.27 2004/02/08 17:17:33 fox Exp $ *</span> 00023 <span class="comment">********************************************************************************/</span> 00024 <span class="preprocessor">#ifndef FXDIAL_H</span> 00025 <span class="preprocessor"></span><span class="preprocessor">#define FXDIAL_H</span> 00026 <span class="preprocessor"></span> 00027 <span class="preprocessor">#ifndef FXFRAME_H</span> 00028 <span class="preprocessor"></span><span class="preprocessor">#include "FXFrame.h"</span> 00029 <span class="preprocessor">#endif</span> 00030 <span class="preprocessor"></span> 00031 <span class="keyword">namespace </span>FX { 00032 00033 00034 <span class="comment">// Dial style options</span> 00035 <span class="keyword">enum</span> { 00036 <a class="code" href="group__FXDial__0.html#a0a308">DIAL_VERTICAL</a> = 0, <span class="comment">// Vertically oriented</span> 00037 <a class="code" href="group__FXDial__0.html#a0a309">DIAL_HORIZONTAL</a> = 0x00008000, <span class="comment">// Horizontal oriented</span> 00038 <a class="code" href="group__FXDial__0.html#a0a310">DIAL_CYCLIC</a> = 0x00010000, <span class="comment">// Value wraps around</span> 00039 <a class="code" href="group__FXDial__0.html#a0a311">DIAL_HAS_NOTCH</a> = 0x00020000, <span class="comment">// Dial has a Center Notch</span> 00040 DIAL_NORMAL = <a class="code" href="group__FXDial__0.html#a0a308">DIAL_VERTICAL</a> 00041 }; 00042 00043 <span class="comment"></span> 00044 <span class="comment">/**</span> 00045 <span class="comment">* The dial widget is a valuator widget which is able to provide a cyclic</span> 00046 <span class="comment">* value range, or a simple linear value range. Optionally, the zero point</span> 00047 <span class="comment">* may be displayed by means of a colored notch.</span> 00048 <span class="comment">* While being turned, the dial sends a SEL_CHANGED message to its target;</span> 00049 <span class="comment">* at the end of the interaction, a SEL_COMMAND message is sent.</span> 00050 <span class="comment">* The message data represents the current value, of type FXint.</span> 00051 <span class="comment">*/</span> 00052 <span class="keyword">class </span>FXAPI FXDial : <span class="keyword">public</span> FXFrame { 00053 FXDECLARE(FXDial) 00054 <span class="keyword">protected</span>: 00055 FXint range[2]; <span class="comment">// Reported data range</span> 00056 FXColor notchColor; <span class="comment">// Main notch color</span> 00057 FXint notchangle; <span class="comment">// Angle of main notch</span> 00058 FXint notchspacing; <span class="comment">// Angle between notches</span> <a name="l00059"></a><a class="code" href="classFX_1_1FXDial.html">00059</a> FXint notchoffset; <span class="comment">// Notch offset</span> 00060 FXint dragpoint; <span class="comment">// Place where clicked</span> 00061 FXint dragpos; <span class="comment">// Value where clicked</span> 00062 FXint incr; <span class="comment">// Rate of change/revolution</span> 00063 FXint pos; <span class="comment">// Reported data position</span> 00064 <a class="code" href="classFX_1_1FXString.html">FXString</a> help; <span class="comment">// Help string</span> 00065 <a class="code" href="classFX_1_1FXString.html">FXString</a> tip; <span class="comment">// Tip string</span> 00066 <span class="keyword">protected</span>: 00067 FXDial(){} 00068 <span class="keyword">private</span>: 00069 FXDial(<span class="keyword">const</span> FXDial&); 00070 FXDial &operator=(<span class="keyword">const</span> FXDial&); 00071 <span class="keyword">public</span>: 00072 <span class="keywordtype">long</span> onPaint(FXObject*,FXSelector,<span class="keywordtype">void</span>*); 00073 <span class="keywordtype">long</span> onMotion(FXObject*,FXSelector,<span class="keywordtype">void</span>*); 00074 <span class="keywordtype">long</span> onMouseWheel(FXObject*,FXSelector,<span class="keywordtype">void</span>*); 00075 <span class="keywordtype">long</span> onLeftBtnPress(FXObject*,FXSelector,<span class="keywordtype">void</span>* ); 00076 <span class="keywordtype">long</span> onLeftBtnRelease(FXObject*,FXSelector,<span class="keywordtype">void</span>*); 00077 <span class="keywordtype">long</span> onUngrabbed(FXObject*,FXSelector,<span class="keywordtype">void</span>*); 00078 <span class="keywordtype">long</span> onCmdSetValue(FXObject*,FXSelector,<span class="keywordtype">void</span>*); 00079 <span class="keywordtype">long</span> onCmdSetIntValue(FXObject*,FXSelector,<span class="keywordtype">void</span>*); 00080 <span class="keywordtype">long</span> onCmdGetIntValue(FXObject*,FXSelector,<span class="keywordtype">void</span>*); 00081 <span class="keywordtype">long</span> onCmdSetRealValue(FXObject*,FXSelector,<span class="keywordtype">void</span>*); 00082 <span class="keywordtype">long</span> onCmdGetRealValue(FXObject*,FXSelector,<span class="keywordtype">void</span>*); 00083 <span class="keywordtype">long</span> onCmdSetIntRange(FXObject*,FXSelector,<span class="keywordtype">void</span>*); 00084 <span class="keywordtype">long</span> onCmdGetIntRange(FXObject*,FXSelector,<span class="keywordtype">void</span>*); 00085 <span class="keywordtype">long</span> onCmdSetRealRange(FXObject*,FXSelector,<span class="keywordtype">void</span>*); 00086 <span class="keywordtype">long</span> onCmdGetRealRange(FXObject*,FXSelector,<span class="keywordtype">void</span>*); 00087 <span class="keywordtype">long</span> onCmdSetHelp(FXObject*,FXSelector,<span class="keywordtype">void</span>*); 00088 <span class="keywordtype">long</span> onCmdGetHelp(FXObject*,FXSelector,<span class="keywordtype">void</span>*); 00089 <span class="keywordtype">long</span> onCmdSetTip(FXObject*,FXSelector,<span class="keywordtype">void</span>*); 00090 <span class="keywordtype">long</span> onCmdGetTip(FXObject*,FXSelector,<span class="keywordtype">void</span>*); 00091 <span class="keywordtype">long</span> onQueryHelp(FXObject*,FXSelector,<span class="keywordtype">void</span>*); 00092 <span class="keywordtype">long</span> onQueryTip(FXObject*,FXSelector,<span class="keywordtype">void</span>*); 00093 <span class="keyword">public</span>: 00094 <span class="comment"></span> 00095 <span class="comment"> /// Construct a dial widget</span> 00096 <span class="comment"></span> FXDial(FXComposite *p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=DIAL_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD); 00097 <span class="comment"></span> <a name="l00098"></a><a class="code" href="classFX_1_1FXDial.html#a4">00098</a> <span class="comment"> /// Return default width</span> 00099 <span class="comment"></span> <span class="keyword">virtual</span> FXint getDefaultWidth(); 00100 <span class="comment"></span> 00101 <span class="comment"> /// Return default height</span> 00102 <span class="comment"></span> <span class="keyword">virtual</span> FXint getDefaultHeight(); 00103 <span class="comment"></span> <a name="l00104"></a><a class="code" href="classFX_1_1FXDial.html#a6">00104</a> <span class="comment"> /// Set the dial value</span> 00105 <span class="comment"></span> <span class="keywordtype">void</span> setValue(FXint value); 00106 <span class="comment"></span> 00107 <span class="comment"> /// Return the dial value</span> 00108 <span class="comment"></span> FXint getValue()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> pos; } 00109 <span class="comment"></span> 00110 <span class="comment"> /// Change the dial's range</span> 00111 <span class="comment"></span> <span class="keywordtype">void</span> setRange(FXint lo,FXint hi); 00112 <span class="comment"></span> 00113 <span class="comment"> /// Obtain the current range of the dial</span> <a name="l00114"></a><a class="code" href="classFX_1_1FXDial.html#a8">00114</a> <span class="comment"></span> <span class="keywordtype">void</span> getRange(FXint& lo,FXint& hi)<span class="keyword"> const </span>{ lo=range[0]; hi=range[1]; } 00115 <span class="comment"></span> 00116 <span class="comment"> /**</span> 00117 <span class="comment"> * Set the revolution increment, which is the amount of change</span> 00118 <span class="comment"> * in the position for revolution of the dial; the dial may go</span> 00119 <span class="comment"> * through multiple revolutions to go through its whole range</span> 00120 <span class="comment"> */</span> 00121 <span class="keywordtype">void</span> setRevolutionIncrement(FXint i); 00122 <span class="comment"></span> 00123 <span class="comment"> /// Get the current value of the revolution increment</span> <a name="l00124"></a><a class="code" href="classFX_1_1FXDial.html#a10">00124</a> <span class="comment"></span> FXint getRevolutionIncrement()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> incr; } 00125 <span class="comment"></span> 00126 <span class="comment"> /**</span> 00127 <span class="comment"> * Change the spacing for the small notches; this should be set</span> 00128 <span class="comment"> * in tenths of degrees in the range [1,3600], and the value should</span> 00129 <span class="comment"> * be a divisor of 3600, so as to make the notches come out evenly</span> 00130 <span class="comment"> */</span> 00131 <span class="keywordtype">void</span> setNotchSpacing(FXint spacing); 00132 <span class="comment"></span> 00133 <span class="comment"> /// Get the current notch spacing</span> <a name="l00134"></a><a class="code" href="classFX_1_1FXDial.html#a12">00134</a> <span class="comment"></span> FXint getNotchSpacing()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> notchspacing; } 00135 <span class="comment"></span> 00136 <span class="comment"> /**</span> 00137 <span class="comment"> * Change the notch offset, which is the position of the</span> 00138 <span class="comment"> * center notch; the value should be tenths of degrees</span> 00139 <span class="comment"> * in the range [-3600,3600]</span> 00140 <span class="comment"> */</span> 00141 <span class="keywordtype">void</span> setNotchOffset(FXint offset); 00142 <span class="comment"></span> 00143 <span class="comment"> /// Get the current center notch offset</span> 00144 <span class="comment"></span> FXint getNotchOffset()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> notchoffset; } 00145 <span class="comment"></span> <a name="l00146"></a><a class="code" href="classFX_1_1FXDial.html#a16">00146</a> <span class="comment"> /// Changes the dial style.</span> 00147 <span class="comment"></span> <span class="keywordtype">void</span> setDialStyle(FXuint opts); 00148 <span class="comment"></span> 00149 <span class="comment"> /// Get the current dial style.</span> 00150 <span class="comment"></span> FXuint getDialStyle() <span class="keyword">const</span>; 00151 <span class="comment"></span> <a name="l00152"></a><a class="code" href="classFX_1_1FXDial.html#a18">00152</a> <span class="comment"> /// Change the center notch color</span> 00153 <span class="comment"></span> <span class="keywordtype">void</span> setNotchColor(FXColor clr); 00154 <span class="comment"></span> 00155 <span class="comment"> /// Get the current center notch color</span> 00156 <span class="comment"></span> FXColor getNotchColor()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> notchColor; } 00157 <span class="comment"></span> <a name="l00158"></a><a class="code" href="classFX_1_1FXDial.html#a20">00158</a> <span class="comment"> /// Set the help text to be displayed on the status line</span> 00159 <span class="comment"></span> <span class="keywordtype">void</span> setHelpText(<span class="keyword">const</span> <a class="code" href="classFX_1_1FXString.html">FXString</a>& text); 00160 <span class="comment"></span> 00161 <span class="comment"> /// Get the current help text</span> 00162 <span class="comment"></span> <a class="code" href="classFX_1_1FXString.html">FXString</a> getHelpText()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> help; } 00163 <span class="comment"></span> 00164 <span class="comment"> /// Set the tip text to be displayed in the tooltip</span> 00165 <span class="comment"></span> <span class="keywordtype">void</span> setTipText(<span class="keyword">const</span> FXString& text); 00166 <span class="comment"></span> 00167 <span class="comment"> /// Get the current tooltip text value</span> 00168 <span class="comment"></span> FXString getTipText()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> tip; } 00169 <span class="comment"></span> 00170 <span class="comment"> /// Save to stream</span> 00171 <span class="comment"></span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> save(FXStream& store) <span class="keyword">const</span>; 00172 <span class="comment"></span> 00173 <span class="comment"> /// Load from stream</span> 00174 <span class="comment"></span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> load(FXStream& store); 00175 }; 00176 00177 } 00178 00179 <span class="preprocessor">#endif</span> </pre></div></font> <!--- COPYRIGHT --> <p> <table width=100% cellpadding=0 cellspacing=0><tr><td width=100% valign=top id=HEADLINE align=right> <img src='../art/line.gif' width=100% height=1><font size=-1> Copyright © 1997-2004 Jeroen van der Zijp</font> </td></tr></table> </p> <!--- COPYRIGHT --> </body> </html>