$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
#include <scrollarea.h>
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 Widget * | getContent () |
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 | |
Widget * | mContent |
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 |
NOTE: A TextBox or a ListBox looks really ugly unless they exist in a ScrollArea.
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.
gcn::ScrollArea::ScrollArea | ( | ) |
Constructor.
gcn::ScrollArea::ScrollArea | ( | Widget * | content | ) |
gcn::ScrollArea::ScrollArea | ( | Widget * | content, | |
unsigned int | hPolicy, | |||
unsigned int | vPolicy | |||
) |
Constructor.
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.
void gcn::ScrollArea::setContent | ( | Widget * | widget | ) | [virtual] |
Widget * gcn::ScrollArea::getContent | ( | ) | [virtual] |
void gcn::ScrollArea::setHorizontalScrollPolicy | ( | unsigned int | hPolicy | ) | [virtual] |
Sets the horizontal scrollbar policy. See enum with policies.
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.
void gcn::ScrollArea::setVerticalScrollPolicy | ( | unsigned int | vPolicy | ) | [virtual] |
Sets the vertical scrollbar policy. See enum with policies.
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.
void gcn::ScrollArea::setScrollPolicy | ( | unsigned int | hPolicy, | |
unsigned int | vPolicy | |||
) | [virtual] |
Sets the horizontal and vertical scrollbar policy. See enum with policies.
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.
vScroll | the amount to scroll. |
int gcn::ScrollArea::getVerticalScrollAmount | ( | ) | [virtual] |
Gets the amount that is scrolled verticaly.
void gcn::ScrollArea::setHorizontalScrollAmount | ( | int | hScroll | ) | [virtual] |
Sets the amount to scroll horizontaly.
hScroll | the amount to scroll. |
int gcn::ScrollArea::getHorizontalScrollAmount | ( | ) | [virtual] |
Gets the amount that is scrolled horizontaly.
void gcn::ScrollArea::setScrollAmount | ( | int | hScroll, | |
int | vScroll | |||
) | [virtual] |
Sets the amount to scroll horizontaly and verticaly.
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.
int gcn::ScrollArea::getVerticalMaxScroll | ( | ) | [virtual] |
Gets the maximum amount of vertical scroll.
void gcn::ScrollArea::setScrollbarWidth | ( | int | width | ) | [virtual] |
Sets the width.
width | the width of the ScrollBar. |
int gcn::ScrollArea::getScrollbarWidth | ( | ) | [virtual] |
Gets the width.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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] |
void gcn::ScrollArea::drawDownButton | ( | Graphics * | graphics | ) | [protected, virtual] |
void gcn::ScrollArea::drawLeftButton | ( | Graphics * | graphics | ) | [protected, virtual] |
void gcn::ScrollArea::drawRightButton | ( | Graphics * | graphics | ) | [protected, virtual] |
void gcn::ScrollArea::drawContent | ( | Graphics * | graphics | ) | [protected, virtual] |
void gcn::ScrollArea::drawVBar | ( | Graphics * | graphics | ) | [protected, virtual] |
void gcn::ScrollArea::drawHBar | ( | Graphics * | graphics | ) | [protected, virtual] |
void gcn::ScrollArea::drawVMarker | ( | Graphics * | graphics | ) | [protected, virtual] |
void gcn::ScrollArea::drawHMarker | ( | Graphics * | graphics | ) | [protected, virtual] |
void gcn::ScrollArea::checkPolicies | ( | ) | [protected, virtual] |
Checks the policies for the scrollbars.
Rectangle gcn::ScrollArea::getUpButtonDimension | ( | ) | [protected, virtual] |
Gets the up button dimension.
Rectangle gcn::ScrollArea::getDownButtonDimension | ( | ) | [protected, virtual] |
Gets the down button dimension.
Rectangle gcn::ScrollArea::getLeftButtonDimension | ( | ) | [protected, virtual] |
Gets the left button dimension.
Rectangle gcn::ScrollArea::getRightButtonDimension | ( | ) | [protected, virtual] |
Gets the right button dimension.
Rectangle gcn::ScrollArea::getContentDimension | ( | ) | [protected, virtual] |
Gets the content dimension.
Rectangle gcn::ScrollArea::getVerticalBarDimension | ( | ) | [protected, virtual] |
Gets the vertical scrollbar dimension.
Rectangle gcn::ScrollArea::getHorizontalBarDimension | ( | ) | [protected, virtual] |
Gets the horizontal scrollbar dimension.
Rectangle gcn::ScrollArea::getVerticalMarkerDimension | ( | ) | [protected, virtual] |
Gets the vertical marker dimension.
Rectangle gcn::ScrollArea::getHorizontalMarkerDimension | ( | ) | [protected, virtual] |
Gets the horizontal marker dimension.
Widget* gcn::ScrollArea::mContent [protected] |
int gcn::ScrollArea::mVScroll [protected] |
int gcn::ScrollArea::mHScroll [protected] |
int gcn::ScrollArea::mScrollbarWidth [protected] |
unsigned int gcn::ScrollArea::mHPolicy [protected] |
unsigned int gcn::ScrollArea::mVPolicy [protected] |
bool gcn::ScrollArea::mVBarVisible [protected] |
bool gcn::ScrollArea::mHBarVisible [protected] |
bool gcn::ScrollArea::mUpButtonPressed [protected] |
bool gcn::ScrollArea::mDownButtonPressed [protected] |
bool gcn::ScrollArea::mLeftButtonPressed [protected] |
bool gcn::ScrollArea::mRightButtonPressed [protected] |
bool gcn::ScrollArea::mVerticalMarkerPressed [protected] |
int gcn::ScrollArea::mVerticalMarkerMousePosition [protected] |
bool gcn::ScrollArea::mHorizontalMarkerPressed [protected] |
int gcn::ScrollArea::mHorizontalMarkerMousePosition [protected] |