PixelLightAPI  .
Classes | Public Member Functions | Protected Member Functions | Protected Attributes
PLGui::ScrollBar Class Reference

Scroll bar widget. More...

#include <ScrollBar.h>

Inheritance diagram for PLGui::ScrollBar:
Inheritance graph
[legend]

List of all members.

Classes

struct  SScrollBarButton
 Scroll bar button. More...
struct  SScrollBarSlider
 Scroll bar slider. More...

Public Member Functions

PLGUI_API ScrollBar (Widget *pParent=nullptr)
 Constructor.
virtual PLGUI_API ~ScrollBar ()
 Destructor.
PLGUI_API EOrientation GetOrientation () const
 Get orientation.
PLGUI_API void SetOrientation (EOrientation nOrientation)
 Set orientation.
virtual PLGUI_API void OnDraw (Graphics &cGraphics) override
 Called to draw the widget.
virtual PLGUI_API PLMath::Vector2i OnPreferredSize (const PLMath::Vector2i &vRefSize) const override
 Called when the widget is to calculate it's preferred size.
virtual PLGUI_API void OnDisable () override
 Called when the widget gets disabled.
virtual PLGUI_API void OnMouseLeave () override
 Called when the mouse has left the widget.
virtual PLGUI_API void OnMouseMove (const PLMath::Vector2i &vPos) override
 Called when the mouse is moved within the widget or captured by it.
virtual PLGUI_API void OnMouseButtonDown (PLCore::uint32 nButton, const PLMath::Vector2i &vPos) override
 Called when a mouse button is pressed.
virtual PLGUI_API void OnMouseButtonUp (PLCore::uint32 nButton, const PLMath::Vector2i &vPos) override
 Called when a mouse button is released.

Protected Member Functions

virtual PLGUI_API void OnChangeValue (int nValue) override
 Called when a new value has been set.
void CalculateMinusButtonPos ()
 Calculate position of minus button.
void CalculatePlusButtonPos ()
 Calculate position of plus button.
void CalculateHandlePos ()
 Calculate position of scrollbar handle.
PLCore::uint32 GetMinusButtonState ()
 Get widget state for the minus button.
PLCore::uint32 GetPlusButtonState ()
 Get widget state for the plus button.
PLCore::uint32 GetHandleState ()
 Get widget state for the handle.
void CheckButtons (const PLMath::Vector2i &vPos, bool bSlider)
 Check if a button has been pressed.
void OnTimer ()
 Called when the timer has fired.

Protected Attributes

EOrientation m_nOrientation
PLCore::uint64 m_nRepeatInterval
SScrollBarButton m_sButtonMinus
SScrollBarButton m_sButtonPlus
SScrollBarSlider m_sHandle
PLMath::Vector2i m_vMousePos
Timer m_cTimer

Detailed Description

Scroll bar widget.


Constructor & Destructor Documentation

PLGUI_API PLGui::ScrollBar::ScrollBar ( Widget pParent = nullptr)

Constructor.

Parameters:
[in]pParentPointer to the parent widget
virtual PLGUI_API PLGui::ScrollBar::~ScrollBar ( ) [virtual]

Destructor.


Member Function Documentation

Get orientation.

Returns:
Orientation
PLGUI_API void PLGui::ScrollBar::SetOrientation ( EOrientation  nOrientation)

Set orientation.

Parameters:
[in]nOrientationOrientation
virtual PLGUI_API void PLGui::ScrollBar::OnChangeValue ( int  nValue) [override, protected, virtual]

Called when a new value has been set.

Parameters:
[in]nValueValue

Reimplemented from PLGui::AbstractSlider.

virtual PLGUI_API void PLGui::ScrollBar::OnDraw ( Graphics cGraphics) [override, virtual]

Called to draw the widget.

Parameters:
[in]cGraphicsGraphics object used for painting

Reimplemented from PLGui::WidgetFunctions.

virtual PLGUI_API PLMath::Vector2i PLGui::ScrollBar::OnPreferredSize ( const PLMath::Vector2i vRefSize) const [override, virtual]

Called when the widget is to calculate it's preferred size.

Parameters:
[in]vRefSizePrecalculated reference size, can be (-1, -1) if no reference size is available
Returns:
Preferred size
Remarks:
If the widget returns -1 in a component (X/Y), it means that there is no preferred size in that direction. A layout will in that case use 'as much space as possible', while the FitSize() functions will use the current size.

Reimplemented from PLGui::Widget.

virtual PLGUI_API void PLGui::ScrollBar::OnDisable ( ) [override, virtual]

Called when the widget gets disabled.

Reimplemented from PLGui::WidgetFunctions.

virtual PLGUI_API void PLGui::ScrollBar::OnMouseLeave ( ) [override, virtual]

Called when the mouse has left the widget.

Reimplemented from PLGui::WidgetFunctions.

virtual PLGUI_API void PLGui::ScrollBar::OnMouseMove ( const PLMath::Vector2i vPos) [override, virtual]

Called when the mouse is moved within the widget or captured by it.

Parameters:
[in]vPosMouse position within the widget

Reimplemented from PLGui::WidgetFunctions.

virtual PLGUI_API void PLGui::ScrollBar::OnMouseButtonDown ( PLCore::uint32  nButton,
const PLMath::Vector2i vPos 
) [override, virtual]

Called when a mouse button is pressed.

Parameters:
[in]nButtonMouse button that is pressed
[in]vPosMouse position within the widget

Reimplemented from PLGui::WidgetFunctions.

virtual PLGUI_API void PLGui::ScrollBar::OnMouseButtonUp ( PLCore::uint32  nButton,
const PLMath::Vector2i vPos 
) [override, virtual]

Called when a mouse button is released.

Parameters:
[in]nButtonMouse button that is released
[in]vPosMouse position within the widget

Reimplemented from PLGui::WidgetFunctions.

Calculate position of minus button.

Calculate position of plus button.

Calculate position of scrollbar handle.

PLCore::uint32 PLGui::ScrollBar::GetMinusButtonState ( ) [protected]

Get widget state for the minus button.

Returns:
Widget state of minus button (combination of EWidgetState values)
PLCore::uint32 PLGui::ScrollBar::GetPlusButtonState ( ) [protected]

Get widget state for the plus button.

Returns:
Widget state of plus button (combination of EWidgetState values)
PLCore::uint32 PLGui::ScrollBar::GetHandleState ( ) [protected]

Get widget state for the handle.

Returns:
Widget state of handle (combination of EWidgetState values)
void PLGui::ScrollBar::CheckButtons ( const PLMath::Vector2i vPos,
bool  bSlider 
) [protected]

Check if a button has been pressed.

Parameters:
[in]vPosMouse position
[in]bSliderAllow selection of slider?
void PLGui::ScrollBar::OnTimer ( ) [protected]

Called when the timer has fired.


Member Data Documentation

Scrollbar orientation

PLCore::uint64 PLGui::ScrollBar::m_nRepeatInterval [protected]

Interval (in ms) between repeated clicks

Button 'minus'

Button 'plus'

Handle

Last mouse position

Timer for repeated clicks


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


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:09:33
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported