$treeview $search $mathjax
Stratagus
2.2.7
$projectbrief
|
$projectbrief
|
$searchbox |
_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
00001 /* _______ __ __ __ ______ __ __ _______ __ __ 00002 * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ 00003 * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / 00004 * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / 00005 * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / 00006 * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / 00007 * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ 00008 * 00009 * Copyright (c) 2004, 2005 darkbits Js_./ 00010 * Per Larsson a.k.a finalman _RqZ{a<^_aa 00011 * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// 00012 * _Qhm`] _f "'c 1!5m 00013 * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ 00014 * .)j(] .d_/ '-( P . S 00015 * License: (BSD) <Td/Z <fP"5(\"??"\a. .L 00016 * Redistribution and use in source and _dV>ws?a-?' ._/L #' 00017 * binary forms, with or without )4d[#7r, . ' )d`)[ 00018 * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' 00019 * that the following conditions are met: j<<WP+k/);. _W=j f 00020 * 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ 00021 * retain the above copyright notice, ]E.pYY(Q]>. a J@\ 00022 * this list of conditions and the j(]1u<sE"L,. . ./^ ]{a 00023 * following disclaimer. 4'_uomm\. )L);-4 (3= 00024 * 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ 00025 * reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m 00026 * this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ 00027 * following disclaimer in the <B!</]C)d_, '(<' .f. =C+m 00028 * documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' 00029 * provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" 00030 * 3. Neither the name of Guichan nor the :$we` _! + _/ . j? 00031 * names of its contributors may be used =3)= _f (_yQmWW$#( " 00032 * to endorse or promote products derived - W, sQQQQmZQ#Wwa].. 00033 * from this software without specific (js, \[QQW$QWW#?!V"". 00034 * prior written permission. ]y:.<\.. . 00035 * -]n w/ ' [. 00036 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! 00037 * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' 00038 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % 00039 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r 00040 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La 00041 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L 00042 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a 00043 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'., 00044 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?" 00045 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. . 00046 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _, 00047 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ^ 00048 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 00049 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00050 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00051 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 00052 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00053 */ 00054 00055 #ifndef GCN_SCROLLAREA_HPP 00056 #define GCN_SCROLLAREA_HPP 00057 00058 #include <string> 00059 00060 #include "guichan/basiccontainer.h" 00061 #include "guichan/mouselistener.h" 00062 #include "guichan/platform.h" 00063 00064 namespace gcn 00065 { 00075 class GCN_CORE_DECLSPEC ScrollArea: 00076 public BasicContainer, 00077 public MouseListener 00078 { 00079 public: 00080 00084 ScrollArea(); 00085 00091 ScrollArea(Widget *content); 00092 00102 ScrollArea(Widget *content, unsigned int hPolicy, unsigned int vPolicy); 00103 00107 virtual ~ScrollArea(); 00108 00114 virtual void setContent(Widget* widget); 00115 00121 virtual Widget* getContent(); 00122 00129 virtual void setHorizontalScrollPolicy(unsigned int hPolicy); 00130 00137 virtual unsigned int getHorizontalScrollPolicy(); 00138 00145 virtual void setVerticalScrollPolicy(unsigned int vPolicy); 00146 00153 virtual unsigned int getVerticalScrollPolicy(); 00154 00163 virtual void setScrollPolicy(unsigned int hPolicy, unsigned int vPolicy); 00164 00170 virtual void setVerticalScrollAmount(int vScroll); 00171 00176 virtual int getVerticalScrollAmount(); 00177 00183 virtual void setHorizontalScrollAmount(int hScroll); 00184 00190 virtual int getHorizontalScrollAmount(); 00191 00198 virtual void setScrollAmount(int hScroll, int vScroll); 00199 00205 virtual int getHorizontalMaxScroll(); 00206 00212 virtual int getVerticalMaxScroll(); 00213 00219 virtual void setScrollbarWidth(int width); 00220 00226 virtual int getScrollbarWidth(); 00227 00235 virtual void scrollToRectangle(const Rectangle& rectangle); 00236 00237 00238 // Inherited from Widget 00239 00240 virtual void draw(Graphics *graphics); 00241 00242 virtual void drawBorder(Graphics* graphics); 00243 00244 virtual void logic(); 00245 00246 virtual void _mouseInputMessage(const MouseInput &mouseInput); 00247 00248 virtual void _mouseOutMessage(); 00249 00250 virtual void _setFocusHandler(FocusHandler* focusHandler); 00251 00252 00253 // Inherited from BasicContainer 00254 00255 virtual void _announceDeath(Widget *widget); 00256 00257 virtual void getDrawSize(int& width, int& height, Widget* widget); 00258 00259 virtual void moveToBottom(Widget* widget); 00260 00261 virtual void moveToTop(Widget* widget); 00262 00263 00264 // Inherited from MouseListener 00265 00266 virtual void mousePress(int x, int y, int button); 00267 00268 virtual void mouseRelease(int x, int y, int button); 00269 00270 virtual void mouseMotion(int x, int y); 00271 00272 virtual void mouseWheelUp(int x, int y); 00273 00274 virtual void mouseWheelDown(int x, int y); 00275 00276 00286 enum 00287 { 00288 SHOW_ALWAYS, 00289 SHOW_NEVER, 00290 SHOW_AUTO 00291 }; 00292 00293 protected: 00299 virtual void drawUpButton(Graphics *graphics); 00300 00306 virtual void drawDownButton(Graphics *graphics); 00307 00313 virtual void drawLeftButton(Graphics *graphics); 00314 00320 virtual void drawRightButton(Graphics *graphics); 00321 00327 virtual void drawContent(Graphics* graphics); 00328 00334 virtual void drawVBar(Graphics* graphics); 00335 00341 virtual void drawHBar(Graphics* graphics); 00342 00348 virtual void drawVMarker(Graphics* graphics); 00349 00355 virtual void drawHMarker(Graphics* graphics); 00356 00360 virtual void checkPolicies(); 00361 00367 virtual Rectangle getUpButtonDimension(); 00368 00374 virtual Rectangle getDownButtonDimension(); 00375 00381 virtual Rectangle getLeftButtonDimension(); 00382 00388 virtual Rectangle getRightButtonDimension(); 00389 00395 virtual Rectangle getContentDimension(); 00396 00402 virtual Rectangle getVerticalBarDimension(); 00403 00409 virtual Rectangle getHorizontalBarDimension(); 00410 00416 virtual Rectangle getVerticalMarkerDimension(); 00417 00423 virtual Rectangle getHorizontalMarkerDimension(); 00424 00425 Widget *mContent; 00426 int mVScroll; 00427 int mHScroll; 00428 int mScrollbarWidth; 00429 unsigned int mHPolicy; 00430 unsigned int mVPolicy; 00431 bool mVBarVisible; 00432 bool mHBarVisible; 00433 bool mUpButtonPressed; 00434 bool mDownButtonPressed; 00435 bool mLeftButtonPressed; 00436 bool mRightButtonPressed; 00437 bool mVerticalMarkerPressed; 00438 int mVerticalMarkerMousePosition; 00439 bool mHorizontalMarkerPressed; 00440 int mHorizontalMarkerMousePosition; 00441 }; 00442 } 00443 00444 #endif // end GCN_SCROLLAREA_HPP