#include <scrollarea.hpp>
Inheritance diagram for gcn::ScrollArea:
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.
Definition at line 75 of file scrollarea.hpp.
Public Types | |
enum | { SHOW_ALWAYS, SHOW_NEVER, SHOW_AUTO } |
Scrollpolicies for the horizontal and vertical scrollbar. More... | |
Public Member Functions | |
ScrollArea () | |
Constructor. | |
ScrollArea (Widget *content) | |
Constructor. | |
ScrollArea (Widget *content, unsigned int hPolicy, unsigned int vPolicy) | |
Constructor. | |
virtual | ~ScrollArea () |
Destructor. | |
virtual void | setContent (Widget *widget) |
Sets the content. | |
virtual Widget * | getContent () |
Gets the content. | |
virtual void | setHorizontalScrollPolicy (unsigned int hPolicy) |
Sets the horizontal scrollbar policy. | |
virtual unsigned int | getHorizontalScrollPolicy () |
Gets the horizontal scrollbar policy. | |
virtual void | setVerticalScrollPolicy (unsigned int vPolicy) |
Sets the vertical scrollbar policy. | |
virtual unsigned int | getVerticalScrollPolicy () |
Gets the vertical scrollbar policy. | |
virtual void | setScrollPolicy (unsigned int hPolicy, unsigned int vPolicy) |
Sets the horizontal and vertical scrollbar policy. | |
virtual void | setVerticalScrollAmount (int vScroll) |
Sets the amount to scroll verticaly. | |
virtual int | getVerticalScrollAmount () |
Gets the amount that is scrolled verticaly. | |
virtual void | setHorizontalScrollAmount (int hScroll) |
Sets the amount to scroll horizontaly. | |
virtual int | getHorizontalScrollAmount () |
Gets the amount that is scrolled horizontaly. | |
virtual void | setScrollAmount (int hScroll, int vScroll) |
Sets the amount to scroll horizontaly and verticaly. | |
virtual int | getHorizontalMaxScroll () |
Gets the maximum amount of horizontal scroll. | |
virtual int | getVerticalMaxScroll () |
Gets the maximum amount of vertical scroll. | |
virtual void | setScrollbarWidth (int width) |
Sets the width. | |
virtual int | getScrollbarWidth () |
Gets the width. | |
virtual void | scrollToRectangle (const Rectangle &rectangle) |
Tries to scroll to a specific rectangle. | |
virtual void | draw (Graphics *graphics) |
Draws the Widget. | |
virtual void | drawBorder (Graphics *graphics) |
Draws a the Widget border. | |
virtual void | logic () |
Called for all Widgets in the gui each time Gui::logic is called. | |
virtual void | _mouseInputMessage (const MouseInput &mouseInput) |
Called when a Widget recieves a MouseInput. | |
virtual void | _mouseOutMessage () |
Called when the mouse leaves the Widget area. | |
virtual void | _setFocusHandler (FocusHandler *focusHandler) |
Sets the FocusHandler to be used. | |
virtual void | _announceDeath (Widget *widget) |
Called when a child of the BasicContainer gets destroyed. | |
virtual void | getDrawSize (int &width, int &height, Widget *widget) |
Gets the drawing space size a Widget has in the BasicContainer. | |
virtual void | moveToBottom (Widget *widget) |
Moves a widget to the bottom of the BasicContainer. | |
virtual void | moveToTop (Widget *widget) |
Moves a Widget to the top of the BasicContainer. | |
virtual void | mousePress (int x, int y, int button) |
Called when a mouse button is pressed when the mouse is in the Widget area or if the Widget has focus. | |
virtual void | mouseRelease (int x, int y, int button) |
Called when a mouse button is released when the mouse is in the Widget area or if the Widget has focus. | |
virtual void | mouseMotion (int x, int y) |
Called when the mouse moves and the mouse is in the Widget area or if the Widget has focus. | |
virtual void | mouseWheelUp (int x, int y) |
Called on a mouse wheel up when the mouse is in the Widget area or if the Widget has focus. | |
virtual void | mouseWheelDown (int x, int y) |
Called on a mouse wheel down when the mouse is in the Widget area or if the Widget has focus. | |
Protected Member Functions | |
virtual void | drawUpButton (Graphics *graphics) |
Draws the up button. | |
virtual void | drawDownButton (Graphics *graphics) |
Draws the down button. | |
virtual void | drawLeftButton (Graphics *graphics) |
Draws the left button. | |
virtual void | drawRightButton (Graphics *graphics) |
Draws the right button. | |
virtual void | drawContent (Graphics *graphics) |
Draws the content in the ScrollArea. | |
virtual void | drawVBar (Graphics *graphics) |
Draws the vertical scrollbar. | |
virtual void | drawHBar (Graphics *graphics) |
Draws the horizontal scrollbar. | |
virtual void | drawVMarker (Graphics *graphics) |
Draws the vertical marker. | |
virtual void | drawHMarker (Graphics *graphics) |
Draws the horizontal marker. | |
virtual void | checkPolicies () |
Checks the policies for the scrollbars. | |
virtual Rectangle | getUpButtonDimension () |
Gets the up button dimension. | |
virtual Rectangle | getDownButtonDimension () |
Gets the down button dimension. | |
virtual Rectangle | getLeftButtonDimension () |
Gets the left button dimension. | |
virtual Rectangle | getRightButtonDimension () |
Gets the right button dimension. | |
virtual Rectangle | getContentDimension () |
Gets the content dimension. | |
virtual Rectangle | getVerticalBarDimension () |
Gets the vertical scrollbar dimension. | |
virtual Rectangle | getHorizontalBarDimension () |
Gets the horizontal scrollbar dimension. | |
virtual Rectangle | getVerticalMarkerDimension () |
Gets the vertical marker dimension. | |
virtual Rectangle | getHorizontalMarkerDimension () |
Gets the horizontal marker dimension. | |
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 |
|
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. Definition at line 286 of file scrollarea.hpp. |
|
Constructor.
Definition at line 84 of file scrollarea.cpp. References gcn::Widget::addMouseListener(), and setContent(). |
|
Constructor.
Definition at line 105 of file scrollarea.cpp. References gcn::Widget::addMouseListener(), and setContent(). |
|
Called when a child of the BasicContainer gets destroyed.
Implements gcn::BasicContainer. Definition at line 889 of file scrollarea.cpp. References checkPolicies(). |
|
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.
Reimplemented from gcn::Widget. Definition at line 300 of file scrollarea.cpp. References gcn::Widget::_mouseInMessage(), gcn::Widget::_mouseInputMessage(), gcn::Widget::_mouseOutMessage(), getContentDimension(), gcn::Widget::getX(), gcn::Widget::getY(), gcn::Widget::hasMouse(), gcn::MouseInput::x, and gcn::MouseInput::y. Referenced by gcn::DropDown::_mouseInputMessage(). |
|
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. Definition at line 327 of file scrollarea.cpp. References gcn::Widget::_mouseOutMessage(), and gcn::Widget::hasMouse(). |
|
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.
Reimplemented from gcn::Widget. Definition at line 290 of file scrollarea.cpp. References gcn::Widget::_setFocusHandler(). Referenced by gcn::DropDown::DropDown(), gcn::DropDown::setScrollArea(), and gcn::DropDown::~DropDown(). |
|
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.
Implements gcn::Widget. Definition at line 419 of file scrollarea.cpp. References gcn::Color::a, gcn::Widget::draw(), gcn::Widget::drawBorder(), drawDownButton(), drawHBar(), drawHMarker(), drawLeftButton(), drawRightButton(), drawUpButton(), drawVBar(), drawVMarker(), gcn::Widget::getBackgroundColor(), gcn::Widget::getBaseColor(), gcn::Widget::getBorderSize(), getContentDimension(), gcn::Widget::getDimension(), gcn::Widget::getHeight(), gcn::Widget::getWidth(), gcn::Rectangle::height, gcn::Rectangle::width, gcn::Rectangle::x, and gcn::Rectangle::y. Referenced by gcn::DropDown::draw(). |
|
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.
Reimplemented from gcn::Widget. Definition at line 479 of file scrollarea.cpp. References gcn::Color::a, gcn::Widget::getBaseColor(), gcn::Widget::getBorderSize(), gcn::Widget::getHeight(), and gcn::Widget::getWidth(). |
|
Draws the content in the ScrollArea.
Definition at line 915 of file scrollarea.cpp. References gcn::Widget::draw(). |
|
Draws the down button.
Definition at line 606 of file scrollarea.cpp. References gcn::Color::a, gcn::Widget::getBaseColor(), getDownButtonDimension(), gcn::Widget::getForegroundColor(), gcn::Rectangle::height, and gcn::Rectangle::width. Referenced by draw(). |
|
Draws the horizontal scrollbar.
Definition at line 503 of file scrollarea.cpp. References gcn::Color::a, gcn::Widget::getBaseColor(), getHorizontalBarDimension(), gcn::Rectangle::height, and gcn::Rectangle::width. Referenced by draw(). |
|
Draws the horizontal marker.
Definition at line 816 of file scrollarea.cpp. References gcn::Color::a, gcn::Widget::getBaseColor(), getHorizontalMarkerDimension(), gcn::Rectangle::height, and gcn::Rectangle::width. Referenced by draw(). |
|
Draws the left button.
Definition at line 667 of file scrollarea.cpp. References gcn::Color::a, gcn::Widget::getBaseColor(), gcn::Widget::getForegroundColor(), getLeftButtonDimension(), gcn::Rectangle::height, and gcn::Rectangle::width. Referenced by draw(). |
|
Draws the right button.
Definition at line 728 of file scrollarea.cpp. References gcn::Color::a, gcn::Widget::getBaseColor(), gcn::Widget::getForegroundColor(), getRightButtonDimension(), gcn::Rectangle::height, and gcn::Rectangle::width. Referenced by draw(). |
|
Draws the up button.
Definition at line 545 of file scrollarea.cpp. References gcn::Color::a, gcn::Widget::getBaseColor(), gcn::Widget::getForegroundColor(), getUpButtonDimension(), gcn::Rectangle::height, and gcn::Rectangle::width. Referenced by draw(). |
|
Draws the vertical scrollbar.
Definition at line 524 of file scrollarea.cpp. References gcn::Color::a, gcn::Widget::getBaseColor(), getVerticalBarDimension(), gcn::Rectangle::height, and gcn::Rectangle::width. Referenced by draw(). |
|
Draws the vertical marker.
Definition at line 789 of file scrollarea.cpp. References gcn::Color::a, gcn::Widget::getBaseColor(), getVerticalMarkerDimension(), gcn::Rectangle::height, and gcn::Rectangle::width. Referenced by draw(). |
|
Gets the content.
Definition at line 150 of file scrollarea.cpp. Referenced by gcn::DropDown::_keyInputMessage(), gcn::DropDown::_mouseInputMessage(), gcn::DropDown::adjustHeight(), gcn::DropDown::draw(), gcn::DropDown::dropDown(), gcn::DropDown::getListModel(), gcn::DropDown::getSelected(), gcn::DropDown::keyPress(), gcn::DropDown::logic(), gcn::DropDown::setListBox(), gcn::DropDown::setListModel(), and gcn::DropDown::setSelected(). |
|
Gets the content dimension.
Definition at line 1086 of file scrollarea.cpp. References gcn::Widget::getHeight(), and gcn::Widget::getWidth(). Referenced by _mouseInputMessage(), draw(), getDrawSize(), getHorizontalMarkerDimension(), getHorizontalMaxScroll(), getVerticalMarkerDimension(), getVerticalMaxScroll(), logic(), mouseWheelDown(), mouseWheelUp(), and scrollToRectangle(). |
|
Gets the down button dimension.
Definition at line 1031 of file scrollarea.cpp. References gcn::Widget::getHeight(), and gcn::Widget::getWidth(). Referenced by drawDownButton(), getVerticalBarDimension(), and mousePress(). |
|
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.
Implements gcn::BasicContainer. Definition at line 902 of file scrollarea.cpp. References getContentDimension(), gcn::Rectangle::height, and gcn::Rectangle::width. |
|
Gets the horizontal scrollbar dimension.
Definition at line 1133 of file scrollarea.cpp. References gcn::Widget::getHeight(), getLeftButtonDimension(), getRightButtonDimension(), and gcn::Widget::getWidth(). Referenced by drawHBar(), getHorizontalMarkerDimension(), and mouseMotion(). |
|
Gets the horizontal marker dimension.
Definition at line 1202 of file scrollarea.cpp. References getContentDimension(), getHorizontalBarDimension(), getHorizontalMaxScroll(), getHorizontalScrollAmount(), gcn::Widget::getWidth(), gcn::Rectangle::width, gcn::Rectangle::x, and gcn::Rectangle::y. Referenced by drawHMarker(), mouseMotion(), and mousePress(). |
|
Gets the maximum amount of horizontal scroll.
Definition at line 233 of file scrollarea.cpp. References checkPolicies(), gcn::Widget::getBorderSize(), getContentDimension(), gcn::Widget::getWidth(), and gcn::Rectangle::width. Referenced by getHorizontalMarkerDimension(), mouseMotion(), and setHorizontalScrollAmount(). |
|
Gets the amount that is scrolled horizontaly.
Definition at line 222 of file scrollarea.cpp. Referenced by getHorizontalMarkerDimension(), logic(), mousePress(), and scrollToRectangle(). |
|
Gets the horizontal scrollbar policy. See enum with policies.
Definition at line 161 of file scrollarea.cpp. |
|
Gets the left button dimension.
Definition at line 1052 of file scrollarea.cpp. References gcn::Widget::getHeight(). Referenced by drawLeftButton(), getHorizontalBarDimension(), and mousePress(). |
|
Gets the right button dimension.
Definition at line 1065 of file scrollarea.cpp. References gcn::Widget::getHeight(), and gcn::Widget::getWidth(). Referenced by drawRightButton(), getHorizontalBarDimension(), and mousePress(). |
|
Gets the width.
Definition at line 285 of file scrollarea.cpp. |
|
Gets the up button dimension.
Definition at line 1018 of file scrollarea.cpp. References gcn::Widget::getWidth(). Referenced by drawUpButton(), getVerticalBarDimension(), and mousePress(). |
|
Gets the vertical scrollbar dimension.
Definition at line 1107 of file scrollarea.cpp. References getDownButtonDimension(), gcn::Widget::getHeight(), getUpButtonDimension(), and gcn::Widget::getWidth(). Referenced by drawVBar(), getVerticalMarkerDimension(), and mouseMotion(). |
|
Gets the vertical marker dimension.
Definition at line 1159 of file scrollarea.cpp. References getContentDimension(), gcn::Widget::getHeight(), getVerticalBarDimension(), getVerticalMaxScroll(), getVerticalScrollAmount(), gcn::Rectangle::height, gcn::Rectangle::x, and gcn::Rectangle::y. Referenced by drawVMarker(), mouseMotion(), and mousePress(). |
|
Gets the maximum amount of vertical scroll.
Definition at line 252 of file scrollarea.cpp. References checkPolicies(), gcn::Widget::getBorderSize(), getContentDimension(), gcn::Widget::getHeight(), and gcn::Rectangle::height. Referenced by getVerticalMarkerDimension(), mouseMotion(), and setVerticalScrollAmount(). |
|
Gets the amount that is scrolled verticaly.
Definition at line 201 of file scrollarea.cpp. Referenced by getVerticalMarkerDimension(), logic(), mousePress(), mouseWheelDown(), mouseWheelUp(), and scrollToRectangle(). |
|
Gets the vertical scrollbar policy. See enum with policies.
Definition at line 172 of file scrollarea.cpp. |
|
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. Definition at line 843 of file scrollarea.cpp. References checkPolicies(), gcn::Widget::getBorderSize(), getContentDimension(), getHorizontalScrollAmount(), getVerticalScrollAmount(), gcn::Widget::logic(), setHorizontalScrollAmount(), gcn::Widget::setPosition(), setVerticalScrollAmount(), and gcn::Rectangle::y. Referenced by gcn::DropDown::logic(). |
|
Called when the mouse moves and the mouse is in the Widget area or if the Widget has focus.
Reimplemented from gcn::MouseListener. Definition at line 381 of file scrollarea.cpp. References getHorizontalBarDimension(), getHorizontalMarkerDimension(), getHorizontalMaxScroll(), getVerticalBarDimension(), getVerticalMarkerDimension(), getVerticalMaxScroll(), gcn::Rectangle::height, setHorizontalScrollAmount(), setVerticalScrollAmount(), gcn::Rectangle::width, gcn::Rectangle::x, and gcn::Rectangle::y. |
|
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.
Reimplemented from gcn::MouseListener. Definition at line 337 of file scrollarea.cpp. References getDownButtonDimension(), getHorizontalMarkerDimension(), getHorizontalScrollAmount(), getLeftButtonDimension(), getRightButtonDimension(), getUpButtonDimension(), getVerticalMarkerDimension(), getVerticalScrollAmount(), setHorizontalScrollAmount(), setVerticalScrollAmount(), gcn::Rectangle::x, and gcn::Rectangle::y. |
|
Called when a mouse button is released when the mouse is in the Widget area or if the Widget has focus.
Reimplemented from gcn::MouseListener. Definition at line 371 of file scrollarea.cpp. |
|
Called on a mouse wheel down when the mouse is in the Widget area or if the Widget has focus.
Reimplemented from gcn::MouseListener. Definition at line 1280 of file scrollarea.cpp. References getContentDimension(), getVerticalScrollAmount(), gcn::Widget::hasMouse(), and setVerticalScrollAmount(). |
|
Called on a mouse wheel up when the mouse is in the Widget area or if the Widget has focus.
Reimplemented from gcn::MouseListener. Definition at line 1272 of file scrollarea.cpp. References getContentDimension(), getVerticalScrollAmount(), gcn::Widget::hasMouse(), and setVerticalScrollAmount(). |
|
Moves a widget to the bottom of the BasicContainer. The Widget will be drawn below all other Widgets in the BasicContainer.
Implements gcn::BasicContainer. Definition at line 874 of file scrollarea.cpp. References gcn::Widget::getParent(), and gcn::BasicContainer::moveToBottom(). |
|
Moves a Widget to the top of the BasicContainer. The widget will be drawn above all other Widgets in the BasicContainer.
Implements gcn::BasicContainer. Definition at line 859 of file scrollarea.cpp. References gcn::Widget::getParent(), and gcn::BasicContainer::moveToTop(). |
|
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.
Definition at line 1245 of file scrollarea.cpp. References getContentDimension(), getHorizontalScrollAmount(), getVerticalScrollAmount(), gcn::Rectangle::height, setHorizontalScrollAmount(), setVerticalScrollAmount(), and gcn::Rectangle::width. Referenced by gcn::TextBox::scrollToCaret(), and gcn::ListBox::setSelected(). |
|
Sets the content.
Definition at line 131 of file scrollarea.cpp. References gcn::Widget::_getFocusHandler(), gcn::Widget::_setFocusHandler(), gcn::Widget::_setParent(), and checkPolicies(). Referenced by gcn::DropDown::DropDown(), ScrollArea(), gcn::DropDown::setListBox(), gcn::DropDown::setScrollArea(), and ~ScrollArea(). |
|
Sets the amount to scroll horizontaly.
Definition at line 206 of file scrollarea.cpp. References getHorizontalMaxScroll(). Referenced by logic(), mouseMotion(), mousePress(), scrollToRectangle(), and setScrollAmount(). |
|
Sets the horizontal scrollbar policy. See enum with policies.
Definition at line 155 of file scrollarea.cpp. References checkPolicies(). Referenced by gcn::DropDown::DropDown(). |
|
Sets the amount to scroll horizontaly and verticaly.
Definition at line 227 of file scrollarea.cpp. References setHorizontalScrollAmount(), and setVerticalScrollAmount(). |
|
Sets the width.
Definition at line 273 of file scrollarea.cpp. |
|
Sets the horizontal and vertical scrollbar policy. See enum with policies.
Definition at line 177 of file scrollarea.cpp. References checkPolicies(). |
|
Sets the amount to scroll verticaly.
Definition at line 184 of file scrollarea.cpp. References getVerticalMaxScroll(). Referenced by logic(), mouseMotion(), mousePress(), mouseWheelDown(), mouseWheelUp(), scrollToRectangle(), and setScrollAmount(). |
|
Sets the vertical scrollbar policy. See enum with policies.
Definition at line 166 of file scrollarea.cpp. References checkPolicies(). |