<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>FXScrollArea.h</h1><div class="fragment"><pre>00001 <span class="comment">/********************************************************************************</span> 00002 <span class="comment">* *</span> 00003 <span class="comment">* S c r o l l A r e a W i d g e t *</span> 00004 <span class="comment">* *</span> 00005 <span class="comment">*********************************************************************************</span> 00006 <span class="comment">* Copyright (C) 1997,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: FXScrollArea.h,v 1.27 2004/02/08 17:17:34 fox Exp $ *</span> 00023 <span class="comment">********************************************************************************/</span> 00024 <span class="preprocessor">#ifndef FXSCROLLAREA_H</span> 00025 <span class="preprocessor"></span><span class="preprocessor">#define FXSCROLLAREA_H</span> 00026 <span class="preprocessor"></span> 00027 <span class="preprocessor">#ifndef FXCOMPOSITE_H</span> 00028 <span class="preprocessor"></span><span class="preprocessor">#include "FXComposite.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">/// Scrollbar options</span> 00035 <span class="comment"></span><span class="keyword">enum</span> { 00036 <a class="code" href="group__FXScrollArea__0.html#a0a1976">SCROLLERS_NORMAL</a> = 0, <span class="comment">/// Show the scrollbars when needed</span> 00037 <span class="comment"></span> <a class="code" href="group__FXScrollArea__0.html#a0a1977">HSCROLLER_ALWAYS</a> = 0x00008000, <span class="comment">/// Always show horizontal scrollers</span> 00038 <span class="comment"></span> <a class="code" href="group__FXScrollArea__0.html#a0a1978">HSCROLLER_NEVER</a> = 0x00010000, <span class="comment">/// Never show horizontal scrollers</span> 00039 <span class="comment"></span> <a class="code" href="group__FXScrollArea__0.html#a0a1979">VSCROLLER_ALWAYS</a> = 0x00020000, <span class="comment">/// Always show vertical scrollers</span> 00040 <span class="comment"></span> <a class="code" href="group__FXScrollArea__0.html#a0a1980">VSCROLLER_NEVER</a> = 0x00040000, <span class="comment">/// Never show vertical scrollers</span> 00041 <span class="comment"></span> <a class="code" href="group__FXScrollArea__0.html#a0a1981">HSCROLLING_ON</a> = 0, <span class="comment">/// Horizontal scrolling turned on (default)</span> 00042 <span class="comment"></span> <a class="code" href="group__FXScrollArea__0.html#a0a1982">HSCROLLING_OFF</a> = <a class="code" href="group__FXScrollArea__0.html#a0a1978">HSCROLLER_NEVER</a>|<a class="code" href="group__FXScrollArea__0.html#a0a1977">HSCROLLER_ALWAYS</a>, <span class="comment">/// Horizontal scrolling turned off</span> 00043 <span class="comment"></span> <a class="code" href="group__FXScrollArea__0.html#a0a1983">VSCROLLING_ON</a> = 0, <span class="comment">/// Vertical scrolling turned on (default)</span> 00044 <span class="comment"></span> <a class="code" href="group__FXScrollArea__0.html#a0a1984">VSCROLLING_OFF</a> = <a class="code" href="group__FXScrollArea__0.html#a0a1980">VSCROLLER_NEVER</a>|<a class="code" href="group__FXScrollArea__0.html#a0a1979">VSCROLLER_ALWAYS</a>, <span class="comment">/// Vertical scrolling turned off</span> 00045 <span class="comment"></span> <a class="code" href="group__FXScrollArea__0.html#a0a1985">SCROLLERS_TRACK</a> = 0, <span class="comment">/// Scrollers track continuously for smooth scrolling</span> 00046 <span class="comment"></span> <a class="code" href="group__FXScrollArea__0.html#a0a1986">SCROLLERS_DONT_TRACK</a> = 0x00080000 <span class="comment">/// Scrollers don't track continuously</span> 00047 <span class="comment"></span> }; 00048 00049 00050 <span class="keyword">class </span>FXScrollBar; 00051 <span class="keyword">class </span>FXScrollCorner; 00052 00053 <span class="comment"></span> 00054 <span class="comment">/**</span> 00055 <span class="comment">* The scroll area widget manages a content area and a viewport</span> 00056 <span class="comment">* area through which the content is viewed. When the content area</span> 00057 <span class="comment">* becomes larger than the viewport area, scrollbars are placed to</span> 00058 <span class="comment">* permit viewing of the entire content by scrolling the content.</span> 00059 <span class="comment">* Depending on the mode, scrollbars may be displayed on an as-needed</span> 00060 <span class="comment">* basis, always, or never.</span> 00061 <span class="comment">* Normally, the scroll area's size and the content's size are independent;</span> 00062 <span class="comment">* however, it is possible to disable scrolling in the horizontal</span> 00063 <span class="comment">* (vertical) direction. In this case, the content width (height)</span> 00064 <span class="comment">* will influence the width (height) of the scroll area widget.</span> 00065 <span class="comment">* For content which is time-consuming to repaint, continuous</span> 00066 <span class="comment">* scrolling may be turned off.</span> 00067 <span class="comment">*/</span> 00068 <span class="keyword">class </span>FXAPI FXScrollArea : <span class="keyword">public</span> FXComposite { 00069 FXDECLARE(FXScrollArea) 00070 <span class="keyword">protected</span>: 00071 FXScrollBar *horizontal; <span class="comment">// Horizontal scroll bar</span> 00072 FXScrollBar *vertical; <span class="comment">// Vertical scroll bar</span> 00073 FXScrollCorner *corner; <span class="comment">// Scroll corner</span> 00074 FXint viewport_w; <span class="comment">// Viewport width</span> <a name="l00075"></a><a class="code" href="classFX_1_1FXScrollArea.html">00075</a> FXint viewport_h; <span class="comment">// Viewport height</span> 00076 FXint pos_x; <span class="comment">// X scroll position (pos_x<=0)</span> 00077 FXint pos_y; <span class="comment">// Y scroll position (pos_y<=0)</span> 00078 <span class="keyword">protected</span>: 00079 FXScrollArea(); 00080 FXbool startAutoScroll(<a class="code" href="structFX_1_1FXEvent.html">FXEvent</a> *event,FXbool onlywheninside=FALSE); 00081 <span class="keywordtype">void</span> stopAutoScroll(); 00082 FXScrollArea(<a class="code" href="classFX_1_1FXComposite.html">FXComposite</a>* p,FXuint opts,FXint x,FXint y,FXint w,FXint h); 00083 <span class="keyword">virtual</span> <span class="keywordtype">void</span> moveContents(FXint x,FXint y); 00084 <span class="keyword">private</span>: 00085 FXScrollArea(<span class="keyword">const</span> FXScrollArea&); 00086 FXScrollArea &operator=(<span class="keyword">const</span> FXScrollArea&); 00087 <span class="keyword">public</span>: 00088 <span class="keywordtype">long</span> onHMouseWheel(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*); 00089 <span class="keywordtype">long</span> onVMouseWheel(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*); 00090 <span class="keywordtype">long</span> onHScrollerChanged(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*); 00091 <span class="keywordtype">long</span> onVScrollerChanged(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*); 00092 <span class="keywordtype">long</span> onHScrollerDragged(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*); 00093 <span class="keywordtype">long</span> onVScrollerDragged(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*); 00094 <span class="keywordtype">long</span> onAutoScroll(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*); 00095 <span class="keyword">public</span>: 00096 <span class="comment"></span> 00097 <span class="comment"> /// Return default width</span> 00098 <span class="comment"></span> <span class="keyword">virtual</span> FXint getDefaultWidth(); 00099 <span class="comment"></span> 00100 <span class="comment"> /// Return default height</span> 00101 <span class="comment"></span> <span class="keyword">virtual</span> FXint getDefaultHeight(); 00102 <span class="comment"></span> 00103 <span class="comment"> /// Perform layout</span> 00104 <span class="comment"></span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> layout(); 00105 <span class="comment"></span> 00106 <span class="comment"> /// Return viewport height</span> 00107 <span class="comment"></span> <span class="keyword">virtual</span> FXint getViewportHeight(); 00108 <span class="comment"></span> 00109 <span class="comment"> /// Return viewport width</span> 00110 <span class="comment"></span> <span class="keyword">virtual</span> FXint getViewportWidth(); 00111 <span class="comment"></span> 00112 <span class="comment"> /// Return content width</span> 00113 <span class="comment"></span> <span class="keyword">virtual</span> FXint getContentWidth(); 00114 <span class="comment"></span> 00115 <span class="comment"> /// Return content height</span> 00116 <span class="comment"></span> <span class="keyword">virtual</span> FXint getContentHeight(); 00117 <span class="comment"></span> 00118 <span class="comment"> /// Change scroll style</span> 00119 <span class="comment"></span> <span class="keywordtype">void</span> setScrollStyle(FXuint style); 00120 <span class="comment"></span> <a name="l00121"></a><a class="code" href="classFX_1_1FXScrollArea.html#a11">00121</a> <span class="comment"> /// Return scroll style</span> 00122 <span class="comment"></span> FXuint getScrollStyle() <span class="keyword">const</span>; 00123 <span class="comment"></span> <a name="l00124"></a><a class="code" href="classFX_1_1FXScrollArea.html#a12">00124</a> <span class="comment"> /// Return TRUE if horizontally scrollable</span> 00125 <span class="comment"></span> FXbool isHorizontalScrollable() <span class="keyword">const</span>; 00126 <span class="comment"></span> <a name="l00127"></a><a class="code" href="classFX_1_1FXScrollArea.html#a13">00127</a> <span class="comment"> /// Return TRUE if vertically scrollable</span> 00128 <span class="comment"></span> FXbool isVerticalScrollable() <span class="keyword">const</span>; 00129 <span class="comment"></span> <a name="l00130"></a><a class="code" href="classFX_1_1FXScrollArea.html#a14">00130</a> <span class="comment"> /// Return a pointer to the horizontal scrollbar</span> 00131 <span class="comment"></span> <a class="code" href="classFX_1_1FXScrollBar.html">FXScrollBar</a>* horizontalScrollBar()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> horizontal; } 00132 <span class="comment"></span> 00133 <span class="comment"> /// Return a pointer to the vertical scrollbar</span> 00134 <span class="comment"></span> FXScrollBar* verticalScrollBar()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> vertical; } 00135 <span class="comment"></span> <a name="l00136"></a><a class="code" href="classFX_1_1FXScrollArea.html#a16">00136</a> <span class="comment"> /// Return the current x-position</span> 00137 <span class="comment"></span> FXint getXPosition()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> pos_x; } 00138 <span class="comment"></span> 00139 <span class="comment"> /// Return the current y-position</span> 00140 <span class="comment"></span> FXint getYPosition()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> pos_y; } 00141 <span class="comment"></span> 00142 <span class="comment"> /// Set the current position</span> 00143 <span class="comment"></span> <span class="keywordtype">void</span> setPosition(FXint x,FXint y); 00144 <span class="comment"></span> 00145 <span class="comment"> /// Get the current position</span> 00146 <span class="comment"></span> <span class="keywordtype">void</span> getPosition(FXint& x,FXint& y)<span class="keyword"> const </span>{ x=pos_x; y=pos_y; } 00147 <span class="comment"></span> 00148 <span class="comment"> /// Destructor</span> 00149 <span class="comment"></span> <span class="keyword">virtual</span> ~FXScrollArea(); 00150 }; 00151 00152 } 00153 00154 <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>