_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
scrollarea.h
Go to the documentation of this file.
1 /* _______ __ __ __ ______ __ __ _______ __ __
2  * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
3  * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
4  * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
5  * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
6  * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
7  * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
8  *
9  * Copyright (c) 2004, 2005 darkbits Js_./
10  * Per Larsson a.k.a finalman _RqZ{a<^_aa
11  * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a//
12  * _Qhm`] _f "'c 1!5m
13  * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[
14  * .)j(] .d_/ '-( P . S
15  * License: (BSD) <Td/Z <fP"5(\"??"\a. .L
16  * Redistribution and use in source and _dV>ws?a-?' ._/L #'
17  * binary forms, with or without )4d[#7r, . ' )d`)[
18  * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam'
19  * that the following conditions are met: j<<WP+k/);. _W=j f
20  * 1. Redistributions of source code must .$%w\/]Q . ."' . mj$
21  * retain the above copyright notice, ]E.pYY(Q]>. a J@\
22  * this list of conditions and the j(]1u<sE"L,. . ./^ ]{a
23  * following disclaimer. 4'_uomm\. )L);-4 (3=
24  * 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[
25  * reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m
26  * this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/
27  * following disclaimer in the <B!</]C)d_, '(<' .f. =C+m
28  * documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]'
29  * provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W"
30  * 3. Neither the name of Guichan nor the :$we` _! + _/ . j?
31  * names of its contributors may be used =3)= _f (_yQmWW$#( "
32  * to endorse or promote products derived - W, sQQQQmZQ#Wwa]..
33  * from this software without specific (js, \[QQW$QWW#?!V"".
34  * prior written permission. ]y:.<\.. .
35  * -]n w/ ' [.
36  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ !
37  * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , '
38  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- %
39  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r
40  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
41  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
42  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
43  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
44  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
45  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
46  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
47  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ^
48  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
49  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
50  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
51  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
52  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53  */
54 
55 #ifndef GCN_SCROLLAREA_HPP
56 #define GCN_SCROLLAREA_HPP
57 
58 #include <string>
59 
60 #include "guichan/basiccontainer.h"
61 #include "guichan/mouselistener.h"
62 #include "guichan/platform.h"
63 
64 namespace gcn
65 {
76  public BasicContainer,
77  public MouseListener
78  {
79  public:
80 
84  ScrollArea();
85 
91  ScrollArea(Widget *content);
92 
102  ScrollArea(Widget *content, unsigned int hPolicy, unsigned int vPolicy);
103 
107  virtual ~ScrollArea();
108 
114  virtual void setContent(Widget* widget);
115 
121  virtual Widget* getContent();
122 
129  virtual void setHorizontalScrollPolicy(unsigned int hPolicy);
130 
137  virtual unsigned int getHorizontalScrollPolicy();
138 
145  virtual void setVerticalScrollPolicy(unsigned int vPolicy);
146 
153  virtual unsigned int getVerticalScrollPolicy();
154 
163  virtual void setScrollPolicy(unsigned int hPolicy, unsigned int vPolicy);
164 
170  virtual void setVerticalScrollAmount(int vScroll);
171 
176  virtual int getVerticalScrollAmount();
177 
183  virtual void setHorizontalScrollAmount(int hScroll);
184 
190  virtual int getHorizontalScrollAmount();
191 
198  virtual void setScrollAmount(int hScroll, int vScroll);
199 
205  virtual int getHorizontalMaxScroll();
206 
212  virtual int getVerticalMaxScroll();
213 
219  virtual void setScrollbarWidth(int width);
220 
226  virtual int getScrollbarWidth();
227 
235  virtual void scrollToRectangle(const Rectangle& rectangle);
236 
237 
238  // Inherited from Widget
239 
240  virtual void draw(Graphics *graphics);
241 
242  virtual void drawBorder(Graphics* graphics);
243 
244  virtual void logic();
245 
246  virtual void _mouseInputMessage(const MouseInput &mouseInput);
247 
248  virtual void _mouseOutMessage();
249 
250  virtual void _setFocusHandler(FocusHandler* focusHandler);
251 
252 
253  // Inherited from BasicContainer
254 
255  virtual void _announceDeath(Widget *widget);
256 
257  virtual void getDrawSize(int& width, int& height, Widget* widget);
258 
259  virtual void moveToBottom(Widget* widget);
260 
261  virtual void moveToTop(Widget* widget);
262 
263 
264  // Inherited from MouseListener
265 
266  virtual void mousePress(int x, int y, int button);
267 
268  virtual void mouseRelease(int x, int y, int button);
269 
270  virtual void mouseMotion(int x, int y);
271 
272  virtual void mouseWheelUp(int x, int y);
273 
274  virtual void mouseWheelDown(int x, int y);
275 
276 
286  enum
287  {
290  SHOW_AUTO
291  };
292 
293  protected:
299  virtual void drawUpButton(Graphics *graphics);
300 
306  virtual void drawDownButton(Graphics *graphics);
307 
313  virtual void drawLeftButton(Graphics *graphics);
314 
320  virtual void drawRightButton(Graphics *graphics);
321 
327  virtual void drawContent(Graphics* graphics);
328 
334  virtual void drawVBar(Graphics* graphics);
335 
341  virtual void drawHBar(Graphics* graphics);
342 
348  virtual void drawVMarker(Graphics* graphics);
349 
355  virtual void drawHMarker(Graphics* graphics);
356 
360  virtual void checkPolicies();
361 
367  virtual Rectangle getUpButtonDimension();
368 
374  virtual Rectangle getDownButtonDimension();
375 
381  virtual Rectangle getLeftButtonDimension();
382 
388  virtual Rectangle getRightButtonDimension();
389 
395  virtual Rectangle getContentDimension();
396 
402  virtual Rectangle getVerticalBarDimension();
403 
409  virtual Rectangle getHorizontalBarDimension();
410 
416  virtual Rectangle getVerticalMarkerDimension();
417 
423  virtual Rectangle getHorizontalMarkerDimension();
424 
426  int mVScroll;
427  int mHScroll;
429  unsigned int mHPolicy;
430  unsigned int mVPolicy;
441  };
442 }
443 
444 #endif // end GCN_SCROLLAREA_HPP
bool mUpButtonPressed
Definition: scrollarea.h:433
bool mHBarVisible
Definition: scrollarea.h:432
bool mVerticalMarkerPressed
Definition: scrollarea.h:437
int mHorizontalMarkerMousePosition
Definition: scrollarea.h:440
Definition: mouseinput.h:67
Definition: graphics.h:97
int mVScroll
Definition: scrollarea.h:426
Definition: scrollarea.h:75
Definition: scrollarea.h:289
Definition: basiccontainer.h:73
Widget * mContent
Definition: scrollarea.h:425
Definition: widget.h:93
int mScrollbarWidth
Definition: scrollarea.h:428
bool mHorizontalMarkerPressed
Definition: scrollarea.h:439
int mHScroll
Definition: scrollarea.h:427
int mVerticalMarkerMousePosition
Definition: scrollarea.h:438
Definition: cliprectangle.cpp:61
#define GCN_CORE_DECLSPEC
Definition: platform.h:59
Definition: rectangle.h:65
Definition: focushandler.h:80
Definition: mouselistener.h:72
bool mRightButtonPressed
Definition: scrollarea.h:436
bool mVBarVisible
Definition: scrollarea.h:431
unsigned int mHPolicy
Definition: scrollarea.h:429
bool mDownButtonPressed
Definition: scrollarea.h:434
bool mLeftButtonPressed
Definition: scrollarea.h:435
unsigned int mVPolicy
Definition: scrollarea.h:430
Definition: scrollarea.h:288
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.