Mana
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ScrollArea Class Reference

A scroll area. More...

#include <scrollarea.h>

Inheritance diagram for ScrollArea:
PlayerBox

Public Member Functions

 ScrollArea ()
 Constructor that takes no content.
 
 ScrollArea (gcn::Widget *content)
 Constructor.
 
 ~ScrollArea () override
 Destructor.
 
void setShowButtons (bool showButtons)
 Sets whether the scroll bar buttons are shown.
 
void logic () override
 Logic function optionally adapts width or height of contents.
 
void draw (gcn::Graphics *graphics) override
 Overridden to draw the frame if its size is 0.
 
void drawFrame (gcn::Graphics *graphics) override
 Draws the background and border of the scroll area.
 
void drawChildren (gcn::Graphics *graphics) override
 Applies clipping to the contents.
 
void setOpaque (bool opaque)
 Sets whether the widget should draw its background or not.
 
bool isOpaque () const
 Returns whether the widget draws its background or not.
 
void mouseMoved (gcn::MouseEvent &event) override
 Called when the mouse moves in the widget area.
 
void mouseEntered (gcn::MouseEvent &event) override
 Called when the mouse enteres the widget area.
 
void mouseExited (gcn::MouseEvent &event) override
 Called when the mouse leaves the widget area.
 
void mousePressed (gcn::MouseEvent &mouseEvent) override
 Code copied from gcn::ScrollArea::mousePressed to make it call our custom getVerticalMarkerDimension and getHorizontalMarkerDimension functions.
 
void mouseDragged (gcn::MouseEvent &mouseEvent) override
 Code copied from gcn::ScrollArea::mouseDragged to make it call our custom getVerticalMarkerDimension and getHorizontalMarkerDimension functions.
 

Protected Member Functions

void init ()
 Initializes the scroll area.
 
void drawBackground (gcn::Graphics *graphics) override
 
void drawUpButton (gcn::Graphics *graphics) override
 
void drawDownButton (gcn::Graphics *graphics) override
 
void drawLeftButton (gcn::Graphics *graphics) override
 
void drawRightButton (gcn::Graphics *graphics) override
 
void drawVBar (gcn::Graphics *graphics) override
 
void drawHBar (gcn::Graphics *graphics) override
 
void drawVMarker (gcn::Graphics *graphics) override
 
void drawHMarker (gcn::Graphics *graphics) override
 
void checkPolicies () override
 Code copied from gcn::ScrollArea::checkPolicies to make sure it takes the frame size of the content into account.
 
gcn::Rectangle getUpButtonDimension ()
 Shadowing these functions from gcn::ScrollArea with versions that support hiding the buttons.
 
gcn::Rectangle getDownButtonDimension ()
 
gcn::Rectangle getLeftButtonDimension ()
 
gcn::Rectangle getRightButtonDimension ()
 
gcn::Rectangle getVerticalBarDimension ()
 
gcn::Rectangle getHorizontalBarDimension ()
 
gcn::Rectangle getVerticalMarkerDimension ()
 Shadowing these functions from gcn::ScrollArea with versions that supports fixed-size scroll bar markers.
 
gcn::Rectangle getHorizontalMarkerDimension ()
 

Protected Attributes

int mX = 0
 
int mY = 0
 
bool mHasMouse = false
 
bool mShowButtons = true
 

Detailed Description

A scroll area.

Contrary to Guichan's scroll area, this scroll area takes ownership over its content. However, it won't delete a previously set content widget when setContent is called!

Also overrides several functions to support fixed-size scroll bar markers.

Definition at line 37 of file scrollarea.h.

Constructor & Destructor Documentation

◆ ScrollArea() [1/2]

ScrollArea::ScrollArea ( )

Constructor that takes no content.

Needed for use with the DropDown class.

Definition at line 30 of file scrollarea.cpp.

◆ ScrollArea() [2/2]

ScrollArea::ScrollArea ( gcn::Widget *  content)

Constructor.

Parameters
contentthe initial content to show in the scroll area

Definition at line 35 of file scrollarea.cpp.

◆ ~ScrollArea()

ScrollArea::~ScrollArea ( )
override

Destructor.

Also deletes the content.

Definition at line 41 of file scrollarea.cpp.

Member Function Documentation

◆ checkPolicies()

void ScrollArea::checkPolicies ( )
overrideprotected

Code copied from gcn::ScrollArea::checkPolicies to make sure it takes the frame size of the content into account.

Definition at line 260 of file scrollarea.cpp.

◆ draw()

void ScrollArea::draw ( gcn::Graphics *  graphics)
override

Overridden to draw the frame if its size is 0.

Definition at line 125 of file scrollarea.cpp.

◆ drawBackground()

void ScrollArea::drawBackground ( gcn::Graphics *  graphics)
overrideprotected

Definition at line 165 of file scrollarea.cpp.

◆ drawChildren()

void ScrollArea::drawChildren ( gcn::Graphics *  graphics)
override

Applies clipping to the contents.

Definition at line 147 of file scrollarea.cpp.

◆ drawDownButton()

void ScrollArea::drawDownButton ( gcn::Graphics *  graphics)
overrideprotected

Definition at line 190 of file scrollarea.cpp.

◆ drawFrame()

void ScrollArea::drawFrame ( gcn::Graphics *  graphics)
override

Draws the background and border of the scroll area.

Definition at line 133 of file scrollarea.cpp.

◆ drawHBar()

void ScrollArea::drawHBar ( gcn::Graphics *  graphics)
overrideprotected

Definition at line 223 of file scrollarea.cpp.

◆ drawHMarker()

void ScrollArea::drawHMarker ( gcn::Graphics *  graphics)
overrideprotected

Definition at line 244 of file scrollarea.cpp.

◆ drawLeftButton()

void ScrollArea::drawLeftButton ( gcn::Graphics *  graphics)
overrideprotected

Definition at line 198 of file scrollarea.cpp.

◆ drawRightButton()

void ScrollArea::drawRightButton ( gcn::Graphics *  graphics)
overrideprotected

Definition at line 206 of file scrollarea.cpp.

◆ drawUpButton()

void ScrollArea::drawUpButton ( gcn::Graphics *  graphics)
overrideprotected

Definition at line 182 of file scrollarea.cpp.

◆ drawVBar()

void ScrollArea::drawVBar ( gcn::Graphics *  graphics)
overrideprotected

Definition at line 214 of file scrollarea.cpp.

◆ drawVMarker()

void ScrollArea::drawVMarker ( gcn::Graphics *  graphics)
overrideprotected

Definition at line 232 of file scrollarea.cpp.

◆ getDownButtonDimension()

gcn::Rectangle ScrollArea::getDownButtonDimension ( )
protected

Definition at line 502 of file scrollarea.cpp.

◆ getHorizontalBarDimension()

gcn::Rectangle ScrollArea::getHorizontalBarDimension ( )
protected

Definition at line 563 of file scrollarea.cpp.

◆ getHorizontalMarkerDimension()

gcn::Rectangle ScrollArea::getHorizontalMarkerDimension ( )
protected

Definition at line 643 of file scrollarea.cpp.

◆ getLeftButtonDimension()

gcn::Rectangle ScrollArea::getLeftButtonDimension ( )
protected

Definition at line 518 of file scrollarea.cpp.

◆ getRightButtonDimension()

gcn::Rectangle ScrollArea::getRightButtonDimension ( )
protected

Definition at line 526 of file scrollarea.cpp.

◆ getUpButtonDimension()

gcn::Rectangle ScrollArea::getUpButtonDimension ( )
protected

Shadowing these functions from gcn::ScrollArea with versions that support hiding the buttons.

We need to make sure we always use these versions.

Definition at line 494 of file scrollarea.cpp.

◆ getVerticalBarDimension()

gcn::Rectangle ScrollArea::getVerticalBarDimension ( )
protected

Definition at line 542 of file scrollarea.cpp.

◆ getVerticalMarkerDimension()

gcn::Rectangle ScrollArea::getVerticalMarkerDimension ( )
protected

Shadowing these functions from gcn::ScrollArea with versions that supports fixed-size scroll bar markers.

We need to make sure we always use these versions.

Definition at line 615 of file scrollarea.cpp.

◆ init()

void ScrollArea::init ( )
protected

Initializes the scroll area.

Definition at line 51 of file scrollarea.cpp.

◆ isOpaque()

bool ScrollArea::isOpaque ( ) const
inline

Returns whether the widget draws its background or not.

Definition at line 92 of file scrollarea.h.

◆ logic()

void ScrollArea::logic ( )
override

Logic function optionally adapts width or height of contents.

This depends on the scrollbar settings.

Definition at line 79 of file scrollarea.cpp.

◆ mouseDragged()

void ScrollArea::mouseDragged ( gcn::MouseEvent &  mouseEvent)
override

Code copied from gcn::ScrollArea::mouseDragged to make it call our custom getVerticalMarkerDimension and getHorizontalMarkerDimension functions.

Definition at line 453 of file scrollarea.cpp.

◆ mouseEntered()

void ScrollArea::mouseEntered ( gcn::MouseEvent &  event)
override

Called when the mouse enteres the widget area.

Definition at line 364 of file scrollarea.cpp.

◆ mouseExited()

void ScrollArea::mouseExited ( gcn::MouseEvent &  event)
override

Called when the mouse leaves the widget area.

Definition at line 369 of file scrollarea.cpp.

◆ mouseMoved()

void ScrollArea::mouseMoved ( gcn::MouseEvent &  event)
override

Called when the mouse moves in the widget area.

Definition at line 358 of file scrollarea.cpp.

◆ mousePressed()

void ScrollArea::mousePressed ( gcn::MouseEvent &  mouseEvent)
override

Code copied from gcn::ScrollArea::mousePressed to make it call our custom getVerticalMarkerDimension and getHorizontalMarkerDimension functions.

Definition at line 378 of file scrollarea.cpp.

◆ setOpaque()

void ScrollArea::setOpaque ( bool  opaque)

Sets whether the widget should draw its background or not.

Definition at line 157 of file scrollarea.cpp.

◆ setShowButtons()

void ScrollArea::setShowButtons ( bool  showButtons)

Sets whether the scroll bar buttons are shown.

Definition at line 46 of file scrollarea.cpp.

Member Data Documentation

◆ mHasMouse

bool ScrollArea::mHasMouse = false
protected

Definition at line 152 of file scrollarea.h.

◆ mShowButtons

bool ScrollArea::mShowButtons = true
protected

Definition at line 153 of file scrollarea.h.

◆ mX

int ScrollArea::mX = 0
protected

Definition at line 150 of file scrollarea.h.

◆ mY

int ScrollArea::mY = 0
protected

Definition at line 151 of file scrollarea.h.


The documentation for this class was generated from the following files: