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

gcn::ScrollArea Class Reference

#include <scrollarea.h>

Inheritance diagram for gcn::ScrollArea:

gcn::BasicContainer gcn::MouseListener gcn::Widget ListBoxWidget ScrollingWidget

List of all members.


Public Types

enum  { SHOW_ALWAYS, SHOW_NEVER, SHOW_AUTO }

Public Member Functions

 ScrollArea ()
 ScrollArea (Widget *content)
 ScrollArea (Widget *content, unsigned int hPolicy, unsigned int vPolicy)
virtual ~ScrollArea ()
virtual void setContent (Widget *widget)
virtual WidgetgetContent ()
virtual void setHorizontalScrollPolicy (unsigned int hPolicy)
virtual unsigned int getHorizontalScrollPolicy ()
virtual void setVerticalScrollPolicy (unsigned int vPolicy)
virtual unsigned int getVerticalScrollPolicy ()
virtual void setScrollPolicy (unsigned int hPolicy, unsigned int vPolicy)
virtual void setVerticalScrollAmount (int vScroll)
virtual int getVerticalScrollAmount ()
virtual void setHorizontalScrollAmount (int hScroll)
virtual int getHorizontalScrollAmount ()
virtual void setScrollAmount (int hScroll, int vScroll)
virtual int getHorizontalMaxScroll ()
virtual int getVerticalMaxScroll ()
virtual void setScrollbarWidth (int width)
virtual int getScrollbarWidth ()
virtual void scrollToRectangle (const Rectangle &rectangle)
virtual void draw (Graphics *graphics)
virtual void drawBorder (Graphics *graphics)
virtual void logic ()
virtual void _mouseInputMessage (const MouseInput &mouseInput)
virtual void _mouseOutMessage ()
virtual void _setFocusHandler (FocusHandler *focusHandler)
virtual void _announceDeath (Widget *widget)
virtual void getDrawSize (int &width, int &height, Widget *widget)
virtual void moveToBottom (Widget *widget)
virtual void moveToTop (Widget *widget)
virtual void mousePress (int x, int y, int button)
virtual void mouseRelease (int x, int y, int button)
virtual void mouseMotion (int x, int y)
virtual void mouseWheelUp (int x, int y)
virtual void mouseWheelDown (int x, int y)

Protected Member Functions

virtual void drawUpButton (Graphics *graphics)
virtual void drawDownButton (Graphics *graphics)
virtual void drawLeftButton (Graphics *graphics)
virtual void drawRightButton (Graphics *graphics)
virtual void drawContent (Graphics *graphics)
virtual void drawVBar (Graphics *graphics)
virtual void drawHBar (Graphics *graphics)
virtual void drawVMarker (Graphics *graphics)
virtual void drawHMarker (Graphics *graphics)
virtual void checkPolicies ()
virtual Rectangle getUpButtonDimension ()
virtual Rectangle getDownButtonDimension ()
virtual Rectangle getLeftButtonDimension ()
virtual Rectangle getRightButtonDimension ()
virtual Rectangle getContentDimension ()
virtual Rectangle getVerticalBarDimension ()
virtual Rectangle getHorizontalBarDimension ()
virtual Rectangle getVerticalMarkerDimension ()
virtual Rectangle getHorizontalMarkerDimension ()

Protected Attributes

WidgetmContent
int mVScroll
int mHScroll
int mScrollbarWidth
unsigned int mHPolicy
unsigned int mVPolicy
bool mVBarVisible
bool mHBarVisible
bool mUpButtonPressed
bool mDownButtonPressed
bool mLeftButtonPressed
bool mRightButtonPressed
bool mVerticalMarkerPressed
int mVerticalMarkerMousePosition
bool mHorizontalMarkerPressed
int mHorizontalMarkerMousePosition

Detailed Description

A ScrollArea in which another Widget can be added. It the other Widget is bigger then the ScrollArea, the ScrollArea will only display the part of the Widget that fits the ScrollArea and make it possible to scroll to the other areas of the Widget.

NOTE: A TextBox or a ListBox looks really ugly unless they exist in a ScrollArea.


Member Enumeration Documentation

anonymous enum

Scrollpolicies for the horizontal and vertical scrollbar. The policies are:

SHOW_ALWAYS - Always show the scrollbars no matter what. SHOW_NEVER - Never show the scrollbars no matter waht. SHOW_AUTO - Show the scrollbars only when needed. That is if the content grows larger then the ScrollArea.

Enumerator:
SHOW_ALWAYS 
SHOW_NEVER 
SHOW_AUTO 


Constructor & Destructor Documentation

gcn::ScrollArea::ScrollArea (  ) 

Constructor.

gcn::ScrollArea::ScrollArea ( Widget content  ) 

Constructor.

Parameters:
content the content of the ScrollArea.

gcn::ScrollArea::ScrollArea ( Widget content,
unsigned int  hPolicy,
unsigned int  vPolicy 
)

Constructor.

Parameters:
content the content of the ScrollArea.
hPolicy the policy for the horizontal scrollbar. See enum with policies.
vPolicy the policy for the vertical scrollbar. See enum with policies.

gcn::ScrollArea::~ScrollArea (  )  [virtual]

Destructor.


Member Function Documentation

void gcn::ScrollArea::setContent ( Widget widget  )  [virtual]

Sets the content.

Parameters:
widget the content of the ScrollArea.

Widget * gcn::ScrollArea::getContent (  )  [virtual]

Gets the content.

Returns:
the content of the ScrollArea.

void gcn::ScrollArea::setHorizontalScrollPolicy ( unsigned int  hPolicy  )  [virtual]

Sets the horizontal scrollbar policy. See enum with policies.

Parameters:
hPolicy the policy for the horizontal scrollbar. See enum with policies.

unsigned int gcn::ScrollArea::getHorizontalScrollPolicy (  )  [virtual]

Gets the horizontal scrollbar policy. See enum with policies.

Returns:
the policy for the horizontal scrollbar policy. See enum with policies.

void gcn::ScrollArea::setVerticalScrollPolicy ( unsigned int  vPolicy  )  [virtual]

Sets the vertical scrollbar policy. See enum with policies.

Parameters:
vPolicy the policy for the vertical scrollbar. See enum with policies.

unsigned int gcn::ScrollArea::getVerticalScrollPolicy (  )  [virtual]

Gets the vertical scrollbar policy. See enum with policies.

Returns:
the policy for the vertical scrollbar. See enum with policies.

void gcn::ScrollArea::setScrollPolicy ( unsigned int  hPolicy,
unsigned int  vPolicy 
) [virtual]

Sets the horizontal and vertical scrollbar policy. See enum with policies.

Parameters:
hPolicy the policy for the horizontal scrollbar. See enum with policies.
vPolicy the policy for the vertical scrollbar. See enum with policies.

void gcn::ScrollArea::setVerticalScrollAmount ( int  vScroll  )  [virtual]

Sets the amount to scroll verticaly.

Parameters:
vScroll the amount to scroll.

int gcn::ScrollArea::getVerticalScrollAmount (  )  [virtual]

Gets the amount that is scrolled verticaly.

Returns:
the scroll amount on vertical scroll.

void gcn::ScrollArea::setHorizontalScrollAmount ( int  hScroll  )  [virtual]

Sets the amount to scroll horizontaly.

Parameters:
hScroll the amount to scroll.

int gcn::ScrollArea::getHorizontalScrollAmount (  )  [virtual]

Gets the amount that is scrolled horizontaly.

Returns:
the scroll amount on horizontal scroll.

void gcn::ScrollArea::setScrollAmount ( int  hScroll,
int  vScroll 
) [virtual]

Sets the amount to scroll horizontaly and verticaly.

Parameters:
hScroll the amount to scroll on horizontal scroll.
vScroll the amount to scroll on vertical scroll.

int gcn::ScrollArea::getHorizontalMaxScroll (  )  [virtual]

Gets the maximum amount of horizontal scroll.

Returns:
the horizontal max scroll.

int gcn::ScrollArea::getVerticalMaxScroll (  )  [virtual]

Gets the maximum amount of vertical scroll.

Returns:
the vertical max scroll.

void gcn::ScrollArea::setScrollbarWidth ( int  width  )  [virtual]

Sets the width.

Parameters:
width the width of the ScrollBar.

int gcn::ScrollArea::getScrollbarWidth (  )  [virtual]

Gets the width.

Returns:
the width of the ScrollBar.

void gcn::ScrollArea::scrollToRectangle ( const Rectangle rectangle  )  [virtual]

Tries to scroll to a specific rectangle. If the rectangle is to large to be visible as much as possibly, begining in the rectangles upper corner, will be visible.

Parameters:
rectangle the Rectangle to scroll to.

void gcn::ScrollArea::draw ( Graphics graphics  )  [virtual]

Draws the Widget. It is called by the parent widget when it is time for the Widget to draw itself. The graphics object is set up so that all drawing is relative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not possible to draw outside of a Widgets dimension.

Parameters:
graphics a Graphics object to draw with.

Implements gcn::Widget.

void gcn::ScrollArea::drawBorder ( Graphics  )  [virtual]

Draws a the Widget border. A border is drawn around a Widget. The width and height of the border is therefore the Widgets height+2*bordersize. Think of a painting that has a certain size, the border surrounds the painting.

Parameters:
graphics a Graphics object to draw with.

Reimplemented from gcn::Widget.

void gcn::ScrollArea::logic (  )  [virtual]

Called for all Widgets in the gui each time Gui::logic is called. You can do logic stuff here like playing an animation.

See also:
Gui

Reimplemented from gcn::Widget.

void gcn::ScrollArea::_mouseInputMessage ( const MouseInput mouseInput  )  [virtual]

Called when a Widget recieves a MouseInput.

WARNING: This function is used internally to handle all mouse messages. Don't call or overload it unless you know what you are doing.

Parameters:
mouseInput the MouseInput message.

Reimplemented from gcn::Widget.

void gcn::ScrollArea::_mouseOutMessage (  )  [virtual]

Called when the mouse leaves the Widget area.

WARNING: This function is used internally be to handle mouse out messages. Don't call or overload this function unless you know what you are doing.

Reimplemented from gcn::Widget.

void gcn::ScrollArea::_setFocusHandler ( FocusHandler focusHandler  )  [virtual]

Sets the FocusHandler to be used.

WARNING: This function is used internally and should not be called or overloaded unless you know what you are doing.

Parameters:
focusHandler the FocusHandler to use.

Reimplemented from gcn::Widget.

void gcn::ScrollArea::_announceDeath ( Widget widget  )  [virtual]

Called when a child of the BasicContainer gets destroyed.

Parameters:
widget the destroyed Widget.

Implements gcn::BasicContainer.

void gcn::ScrollArea::getDrawSize ( int &  width,
int &  height,
Widget widget 
) [virtual]

Gets the drawing space size a Widget has in the BasicContainer. It may not be the same size as the Widgets width and height.

NOTE: Size is not checked recursively all the way back to the top Widget. If the BasicContainer itself is clipped, the size may be inaccurate.

Parameters:
width the width the Widget's draw space has.
height the height the Widget's draw space has.
widget the Widget calling the function.

Implements gcn::BasicContainer.

void gcn::ScrollArea::moveToBottom ( Widget widget  )  [virtual]

Moves a widget to the bottom of the BasicContainer. The Widget will be drawn below all other Widgets in the BasicContainer.

Parameters:
widget the Widget to move.

Implements gcn::BasicContainer.

void gcn::ScrollArea::moveToTop ( Widget widget  )  [virtual]

Moves a Widget to the top of the BasicContainer. The widget will be drawn above all other Widgets in the BasicContainer.

Parameters:
widget the Widget to move.

Implements gcn::BasicContainer.

void gcn::ScrollArea::mousePress ( int  ,
int  ,
int   
) [virtual]

Called when a mouse button is pressed when the mouse is in the Widget area or if the Widget has focus.

NOTE: A mouse press is NOT equal to a mouse click. Use mouseClickMessage to check for mouse clicks.

Parameters:
x the x coordinate of the mouse relative to the Widget itself.
y the y coordinate of the mouse relative to the Widget itself.
button the button pressed.

Reimplemented from gcn::MouseListener.

void gcn::ScrollArea::mouseRelease ( int  ,
int  ,
int   
) [virtual]

Called when a mouse button is released when the mouse is in the Widget area or if the Widget has focus.

Parameters:
x the x coordinate of the mouse relative to the Widget itself.
y the y coordinate of the mouse relative to the Widget itself.
button the button released.

Reimplemented from gcn::MouseListener.

void gcn::ScrollArea::mouseMotion ( int  ,
int   
) [virtual]

Called when the mouse moves and the mouse is in the Widget area or if the Widget has focus.

Parameters:
x the x coordinate of the mouse relative to the Widget itself.
y the y coordinate of the mouse relative to the Widget itself.

Reimplemented from gcn::MouseListener.

void gcn::ScrollArea::mouseWheelUp ( int  ,
int   
) [virtual]

Called on a mouse wheel up when the mouse is in the Widget area or if the Widget has focus.

Parameters:
x the x coordinate of the mouse relative to the Widget itself.
y the y coordinate of the mouse relative to the Widget itself.

Reimplemented from gcn::MouseListener.

void gcn::ScrollArea::mouseWheelDown ( int  ,
int   
) [virtual]

Called on a mouse wheel down when the mouse is in the Widget area or if the Widget has focus.

Parameters:
x the x coordinate of the mouse relative to the Widget itself.
y the y coordinate of the mouse relative to the Widget itself.

Reimplemented from gcn::MouseListener.

void gcn::ScrollArea::drawUpButton ( Graphics graphics  )  [protected, virtual]

Draws the up button.

Parameters:
graphics a Graphics object to draw with.

void gcn::ScrollArea::drawDownButton ( Graphics graphics  )  [protected, virtual]

Draws the down button.

Parameters:
graphics a Graphics object to draw with.

void gcn::ScrollArea::drawLeftButton ( Graphics graphics  )  [protected, virtual]

Draws the left button.

Parameters:
graphics a Graphics object to draw with.

void gcn::ScrollArea::drawRightButton ( Graphics graphics  )  [protected, virtual]

Draws the right button.

Parameters:
graphics a Graphics object to draw with.

void gcn::ScrollArea::drawContent ( Graphics graphics  )  [protected, virtual]

Draws the content in the ScrollArea.

Parameters:
graphics a Graphics object to draw with.

void gcn::ScrollArea::drawVBar ( Graphics graphics  )  [protected, virtual]

Draws the vertical scrollbar.

Parameters:
graphics a Graphics object to draw with.

void gcn::ScrollArea::drawHBar ( Graphics graphics  )  [protected, virtual]

Draws the horizontal scrollbar.

Parameters:
graphics a Graphics object to draw with.

void gcn::ScrollArea::drawVMarker ( Graphics graphics  )  [protected, virtual]

Draws the vertical marker.

Parameters:
graphics a Graphics object to draw with.

void gcn::ScrollArea::drawHMarker ( Graphics graphics  )  [protected, virtual]

Draws the horizontal marker.

Parameters:
graphics a Graphics object to draw with.

void gcn::ScrollArea::checkPolicies (  )  [protected, virtual]

Checks the policies for the scrollbars.

Rectangle gcn::ScrollArea::getUpButtonDimension (  )  [protected, virtual]

Gets the up button dimension.

Returns:
the dimension of the up button.

Rectangle gcn::ScrollArea::getDownButtonDimension (  )  [protected, virtual]

Gets the down button dimension.

Returns:
the dimension of the down button.

Rectangle gcn::ScrollArea::getLeftButtonDimension (  )  [protected, virtual]

Gets the left button dimension.

Returns:
the dimension of the left button.

Rectangle gcn::ScrollArea::getRightButtonDimension (  )  [protected, virtual]

Gets the right button dimension.

Returns:
the dimension of the right button.

Rectangle gcn::ScrollArea::getContentDimension (  )  [protected, virtual]

Gets the content dimension.

Returns:
the dimension of the content.

Rectangle gcn::ScrollArea::getVerticalBarDimension (  )  [protected, virtual]

Gets the vertical scrollbar dimension.

Returns:
the dimension of the vertical scrollbar.

Rectangle gcn::ScrollArea::getHorizontalBarDimension (  )  [protected, virtual]

Gets the horizontal scrollbar dimension.

Returns:
the dimension of the horizontal scrollbar.

Rectangle gcn::ScrollArea::getVerticalMarkerDimension (  )  [protected, virtual]

Gets the vertical marker dimension.

Returns:
the dimension of the vertical marker.

Rectangle gcn::ScrollArea::getHorizontalMarkerDimension (  )  [protected, virtual]

Gets the horizontal marker dimension.

Returns:
the dimension of the horizontal marker.


Member Data Documentation

int gcn::ScrollArea::mVScroll [protected]

int gcn::ScrollArea::mHScroll [protected]

unsigned int gcn::ScrollArea::mHPolicy [protected]

unsigned int gcn::ScrollArea::mVPolicy [protected]


The documentation for this class was generated from the following files:
(C) Copyright 1998-2011 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.