<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>FXRuler.h</h1><div class="fragment"><pre>00001 <span class="comment">/********************************************************************************</span> 00002 <span class="comment">* *</span> 00003 <span class="comment">* R u l e r W i d g e t *</span> 00004 <span class="comment">* *</span> 00005 <span class="comment">*********************************************************************************</span> 00006 <span class="comment">* Copyright (C) 2002,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: FXRuler.h,v 1.19 2004/02/08 17:17:34 fox Exp $ *</span> 00023 <span class="comment">********************************************************************************/</span> 00024 <span class="preprocessor">#ifndef FXRULER_H</span> 00025 <span class="preprocessor"></span><span class="preprocessor">#define FXRULER_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 <span class="comment"></span> 00034 <span class="comment">/// Ruler options</span> 00035 <span class="comment"></span><span class="keyword">enum</span> { 00036 <a class="code" href="group__FXRuler__0.html#a0a1962">RULER_NORMAL</a> = 0, <span class="comment">/// Default appearance (default)</span> 00037 <span class="comment"></span> <a class="code" href="group__FXRuler__0.html#a0a1963">RULER_HORIZONTAL</a> = 0, <span class="comment">/// Ruler is horizontal (default)</span> 00038 <span class="comment"></span> <a class="code" href="group__FXRuler__0.html#a0a1964">RULER_VERTICAL</a> = 0x00008000, <span class="comment">/// Ruler is vertical</span> 00039 <span class="comment"></span> <a class="code" href="group__FXRuler__0.html#a0a1965">RULER_TICKS_OFF</a> = 0, <span class="comment">/// Tick marks off (default)</span> 00040 <span class="comment"></span> <a class="code" href="group__FXRuler__0.html#a0a1966">RULER_TICKS_TOP</a> = 0x00010000, <span class="comment">/// Ticks on the top (if horizontal)</span> 00041 <span class="comment"></span> <a class="code" href="group__FXRuler__0.html#a0a1967">RULER_TICKS_BOTTOM</a> = 0x00020000, <span class="comment">/// Ticks on the bottom (if horizontal)</span> 00042 <span class="comment"></span> <a class="code" href="group__FXRuler__0.html#a0a1968">RULER_TICKS_LEFT</a> = <a class="code" href="group__FXRuler__0.html#a0a1966">RULER_TICKS_TOP</a>, <span class="comment">/// Ticks on the left (if vertical)</span> 00043 <span class="comment"></span> <a class="code" href="group__FXRuler__0.html#a0a1969">RULER_TICKS_RIGHT</a> = <a class="code" href="group__FXRuler__0.html#a0a1967">RULER_TICKS_BOTTOM</a>, <span class="comment">/// Ticks on the right (if vertical)</span> 00044 <span class="comment"></span> <a class="code" href="group__FXRuler__0.html#a0a1970">RULER_TICKS_CENTER</a> = <a class="code" href="group__FXRuler__0.html#a0a1966">RULER_TICKS_TOP</a>|<a class="code" href="group__FXRuler__0.html#a0a1967">RULER_TICKS_BOTTOM</a>, <span class="comment">/// Tickmarks centered</span> 00045 <span class="comment"></span> <a class="code" href="group__FXRuler__0.html#a0a1971">RULER_NUMBERS</a> = 0x00040000, <span class="comment">/// Show numbers</span> 00046 <span class="comment"></span> <a class="code" href="group__FXRuler__0.html#a0a1972">RULER_ARROW</a> = 0x00080000, <span class="comment">/// Draw small arrow for cursor position</span> 00047 <span class="comment"></span> <a class="code" href="group__FXRuler__0.html#a0a1973">RULER_MARKERS</a> = 0x00100000, <span class="comment">/// Draw markers for indentation settings</span> 00048 <span class="comment"></span> <a class="code" href="group__FXRuler__0.html#a0a1974">RULER_METRIC</a> = 0, <span class="comment">/// Metric subdivision (default)</span> 00049 <span class="comment"></span> <a class="code" href="group__FXRuler__0.html#a0a1975">RULER_ENGLISH</a> = 0x00200000 <span class="comment">/// English subdivision</span> 00050 <span class="comment"></span> }; 00051 00052 00053 <span class="keyword">class </span>FXFont; 00054 00055 <span class="comment"></span> 00056 <span class="comment">/**</span> 00057 <span class="comment">* The Ruler widget is placed alongside a document to measure position</span> 00058 <span class="comment">* and size of entities within the document.</span> 00059 <span class="comment">*/</span> 00060 <span class="keyword">class </span>FXAPI FXRuler : <span class="keyword">public</span> FXFrame { 00061 FXDECLARE(FXRuler) 00062 <span class="keyword">protected</span>: 00063 FXFont *font; <span class="comment">// Font for numbers</span> 00064 FXColor textColor; <span class="comment">// Color for numbers and ticks</span> 00065 FXint lowerMargin; <span class="comment">// Lower margin</span> 00066 FXint upperMargin; <span class="comment">// Upper margin</span> <a name="l00067"></a><a class="code" href="classFX_1_1FXRuler.html">00067</a> FXint firstPara; <span class="comment">// First line paragraph indent</span> 00068 FXint lowerPara; <span class="comment">// Lower paragraph indent</span> 00069 FXint upperPara; <span class="comment">// Upper paragraph indent</span> 00070 FXint docSpace; <span class="comment">// Empty space around document</span> 00071 FXint docSize; <span class="comment">// Size of document</span> 00072 FXint contentSize; <span class="comment">// Size of content</span> 00073 FXint arrowPos; <span class="comment">// Arrow position</span> 00074 FXdouble pixelPerTick; <span class="comment">// Number of pixels between ticks</span> 00075 FXint majorTicks; <span class="comment">// Interval between major ticks</span> 00076 FXint mediumTicks; <span class="comment">// Interval between medium ticks</span> 00077 FXint tinyTicks; <span class="comment">// Interval between tiny ticks</span> 00078 FXint shift; <span class="comment">// Shift amount</span> 00079 <a class="code" href="classFX_1_1FXString.html">FXString</a> tip; <span class="comment">// Tooltip text</span> 00080 <a class="code" href="classFX_1_1FXString.html">FXString</a> help; <span class="comment">// Help text</span> 00081 <span class="keyword">protected</span>: 00082 FXRuler(); 00083 <span class="keywordtype">void</span> drawLeftArrow(<a class="code" href="classFX_1_1FXDCWindow.html">FXDCWindow</a>& dc,FXint x,FXint y); 00084 <span class="keywordtype">void</span> drawRightArrow(<a class="code" href="classFX_1_1FXDCWindow.html">FXDCWindow</a>& dc,FXint x,FXint y); 00085 <span class="keywordtype">void</span> drawUpArrow(<a class="code" href="classFX_1_1FXDCWindow.html">FXDCWindow</a>& dc,FXint x,FXint y); 00086 <span class="keywordtype">void</span> drawDownArrow(<a class="code" href="classFX_1_1FXDCWindow.html">FXDCWindow</a>& dc,FXint x,FXint y); 00087 <span class="keywordtype">void</span> drawLeftMarker(<a class="code" href="classFX_1_1FXDCWindow.html">FXDCWindow</a>& dc,FXint x,FXint y); 00088 <span class="keywordtype">void</span> drawRightMarker(<a class="code" href="classFX_1_1FXDCWindow.html">FXDCWindow</a>& dc,FXint x,FXint y); 00089 <span class="keywordtype">void</span> drawUpMarker(<a class="code" href="classFX_1_1FXDCWindow.html">FXDCWindow</a>& dc,FXint x,FXint y); 00090 <span class="keywordtype">void</span> drawDownMarker(<a class="code" href="classFX_1_1FXDCWindow.html">FXDCWindow</a>& dc,FXint x,FXint y); 00091 <span class="comment">// void drawHzTicks(FXDCWindow& dc</span> 00092 <span class="keyword">private</span>: 00093 FXRuler(<span class="keyword">const</span> FXRuler&); 00094 FXRuler &operator=(<span class="keyword">const</span> FXRuler&); 00095 <span class="keyword">public</span>: 00096 <span class="keywordtype">long</span> onPaint(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*); 00097 <span class="keywordtype">long</span> onLeftBtnPress(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*); 00098 <span class="keywordtype">long</span> onLeftBtnRelease(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*); 00099 <span class="keywordtype">long</span> onMotion(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*); 00100 <span class="keywordtype">long</span> onCmdSetValue(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*); 00101 <span class="keywordtype">long</span> onCmdSetIntValue(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*); 00102 <span class="keywordtype">long</span> onCmdGetIntValue(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*); 00103 <span class="keywordtype">long</span> onCmdSetHelp(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*); 00104 <span class="keywordtype">long</span> onCmdGetHelp(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*); <a name="l00105"></a><a class="code" href="classFX_1_1FXRuler.html#a6">00105</a> <span class="keywordtype">long</span> onCmdSetTip(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*); 00106 <span class="keywordtype">long</span> onCmdGetTip(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*); 00107 <span class="keywordtype">long</span> onQueryHelp(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*); 00108 <span class="keywordtype">long</span> onQueryTip(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*); 00109 <span class="keyword">public</span>: 00110 <span class="keyword">enum</span> { <a name="l00111"></a><a class="code" href="classFX_1_1FXRuler.html#a8">00111</a> ID_ARROW=FXFrame::ID_LAST, 00112 ID_LAST 00113 }; 00114 <span class="keyword">public</span>: 00115 <span class="comment"></span> 00116 <span class="comment"> /// Construct label with given text and icon</span> 00117 <span class="comment"></span> FXRuler(FXComposite* p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=RULER_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); 00118 <span class="comment"></span> 00119 <span class="comment"> /// Create server-side resources</span> <a name="l00120"></a><a class="code" href="classFX_1_1FXRuler.html#a11">00120</a> <span class="comment"></span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> create(); 00121 <span class="comment"></span> 00122 <span class="comment"> /// Detach server-side resources</span> 00123 <span class="comment"></span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> detach(); 00124 <span class="comment"></span> 00125 <span class="comment"> /// Return default width</span> 00126 <span class="comment"></span> <span class="keyword">virtual</span> FXint getDefaultWidth(); 00127 <span class="comment"></span> 00128 <span class="comment"> /// Return default height</span> <a name="l00129"></a><a class="code" href="classFX_1_1FXRuler.html#a14">00129</a> <span class="comment"></span> <span class="keyword">virtual</span> FXint getDefaultHeight(); 00130 <span class="comment"></span> 00131 <span class="comment"> /// Set the text font</span> 00132 <span class="comment"></span> <span class="keywordtype">void</span> setFont(<a class="code" href="classFX_1_1FXFont.html">FXFont</a> *fnt); 00133 <span class="comment"></span> 00134 <span class="comment"> /// Get the text font</span> <a name="l00135"></a><a class="code" href="classFX_1_1FXRuler.html#a16">00135</a> <span class="comment"></span> <a class="code" href="classFX_1_1FXFont.html">FXFont</a>* getFont()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> font; } 00136 <span class="comment"></span> 00137 <span class="comment"> /// Change slider value</span> 00138 <span class="comment"></span> <span class="keywordtype">void</span> setValue(FXint value); 00139 <span class="comment"></span> 00140 <span class="comment"> /// Return slider value</span> 00141 <span class="comment"></span> FXint getValue()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> arrowPos; } 00142 <span class="comment"></span> 00143 <span class="comment"> /// Set ruler style</span> 00144 <span class="comment"></span> <span class="keywordtype">void</span> setRulerStyle(FXuint style); 00145 <span class="comment"></span> 00146 <span class="comment"> /// Get ruler style</span> 00147 <span class="comment"></span> FXuint getRulerStyle() <span class="keyword">const</span>; 00148 <span class="comment"></span> 00149 <span class="comment"> /// Get the current text color</span> 00150 <span class="comment"></span> FXColor getTextColor()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> textColor; } 00151 <span class="comment"></span> 00152 <span class="comment"> /// Set the current text color</span> 00153 <span class="comment"></span> <span class="keywordtype">void</span> setTextColor(FXColor clr); 00154 <span class="comment"></span> 00155 <span class="comment"> /// Set the status line help text for this label</span> 00156 <span class="comment"></span> <span class="keywordtype">void</span> setHelpText(<span class="keyword">const</span> FXString& text); 00157 <span class="comment"></span> 00158 <span class="comment"> /// Get the status line help text for this label</span> 00159 <span class="comment"></span> FXString getHelpText()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> help; } 00160 <span class="comment"></span> 00161 <span class="comment"> /// Set the tool tip message for this label</span> 00162 <span class="comment"></span> <span class="keywordtype">void</span> setTipText(<span class="keyword">const</span> FXString& text); 00163 <span class="comment"></span> 00164 <span class="comment"> /// Get the tool tip message for this label</span> 00165 <span class="comment"></span> FXString getTipText()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> tip; } 00166 <span class="comment"></span> 00167 <span class="comment"> /// Save label to a stream</span> 00168 <span class="comment"></span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> save(FXStream& store) <span class="keyword">const</span>; 00169 <span class="comment"></span> 00170 <span class="comment"> /// Load label from a stream</span> 00171 <span class="comment"></span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> load(FXStream& store); 00172 <span class="comment"></span> 00173 <span class="comment"> /// Destructor</span> 00174 <span class="comment"></span> <span class="keyword">virtual</span> ~FXRuler(); 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>