Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
IGUIScrollBar Class Referenceabstract

The GUI Scroll-bar, used everywhere there is a scroll-bar in the game. More...

#include <IGUIScrollBar.h>

Inheritance diagram for IGUIScrollBar:
Collaboration diagram for IGUIScrollBar:

Public Member Functions

 NONCOPYABLE (IGUIScrollBar)
 
 IGUIScrollBar (CGUI &pGUI)
 
virtual ~IGUIScrollBar ()
 
virtual void Draw (CCanvas2D &canvas)=0
 Draw the scroll-bar. More...
 
virtual void HandleMessage (SGUIMessage &Message)=0
 If an object that contains a scrollbar has got messages, send them to the scroll-bar and it will see if the message regarded itself. More...
 
virtual void SetPosFromMousePos (const CVector2D &mouse)=0
 Set m_Pos with g_mouse_x/y input, i.e. More...
 
virtual bool HoveringButtonMinus (const CVector2D &mouse)
 Hovering the scroll minus button. More...
 
virtual bool HoveringButtonPlus (const CVector2D &mouse)
 Hovering the scroll plus button. More...
 
float GetPos () const
 Get scroll-position. More...
 
virtual void SetPos (float f)
 Set scroll-position by hand. More...
 
float GetMaxPos () const
 Get the value of m_Pos that corresponds to the bottom of the scrollable region. More...
 
bool IsVisible () const
 Scrollbars without height shouldn't be visible. More...
 
virtual void ScrollPlus ()
 Increase scroll one step. More...
 
virtual void ScrollMinus ()
 Decrease scroll one step. More...
 
virtual void ScrollPlusPlenty ()
 Increase scroll three steps. More...
 
virtual void ScrollMinusPlenty ()
 Decrease scroll three steps. More...
 
void SetHostObject (IGUIScrollBarOwner *pOwner)
 Set host object, must be done almost at creation of scroll bar. More...
 
void SetWidth (float width)
 Set Width. More...
 
void SetX (float x)
 Set X Position. More...
 
void SetY (float y)
 Set Y Position. More...
 
void SetZ (float z)
 Set Z Position. More...
 
void SetLength (float length)
 Set Length of scroll bar. More...
 
void SetScrollRange (float range)
 Set content length. More...
 
void SetScrollSpace (float space)
 Set space that is visible in the scrollable control. More...
 
void SetBarPressed (bool b)
 Set bar pressed. More...
 
void SetScrollBarStyle (const CStr &style)
 Set Scroll bar style string. More...
 
const SGUIScrollBarStyleGetStyle () const
 Get style used by the scrollbar. More...
 
virtual CRect GetBarRect () const =0
 Get the rectangle of the actual BAR. More...
 
virtual CRect GetOuterRect () const =0
 Get the rectangle of the outline of the scrollbar, every component of the scroll-bar should be inside this area. More...
 

Protected Member Functions

void SetupBarSize ()
 Sets up bar size. More...
 
void UpdatePosBoundaries ()
 Call every time m_Pos has been updated. More...
 

Protected Attributes

Settings
float m_Width
 Width of the scroll bar. More...
 
float m_X
 Absolute X Position. More...
 
float m_Y
 Absolute Y Position. More...
 
float m_Z
 Absolute Z Position. More...
 
float m_Length
 Total length of scrollbar, including edge buttons. More...
 
float m_ScrollRange
 Content that can be scrolled, in pixels. More...
 
float m_ScrollSpace
 Content that can be viewed at a time, in pixels. More...
 
float m_BarSize
 Use input from the scroll-wheel? True or false. More...
 
CStr m_ScrollBarStyle
 Scroll bar style reference name. More...
 
SGUIScrollBarStylem_pStyle
 Pointer to scroll bar style used. More...
 
IGUIScrollBarOwnerm_pHostObject
 Host object, prerequisite! More...
 
CGUIm_pGUI
 Reference to CGUI object, these cannot work stand-alone. More...
 
CVector2D m_BarPressedAtPos
 Mouse position when bar was pressed. More...
 
States
bool m_BarPressed
 If the bar is currently being pressed and dragged. More...
 
bool m_BarHovered
 Bar being hovered or not. More...
 
bool m_ButtonMinusHovered
 Scroll buttons hovered. More...
 
bool m_ButtonPlusHovered
 
bool m_ButtonMinusPressed
 Scroll buttons pressed. More...
 
bool m_ButtonPlusPressed
 
float m_Pos
 Position of scroll bar, 0 means scrolled all the way to one side. More...
 
float m_PosWhenPressed
 Position from 0.f to 1.f it had when the bar was pressed. More...
 

Detailed Description

The GUI Scroll-bar, used everywhere there is a scroll-bar in the game.

To include a scroll-bar to an object, inherent the object from IGUIScrollBarOwner and call AddScrollBar() to add the scroll-bars.

It's also important that the scrollbar is located within the parent object's mouse over area. Otherwise the input won't be sent to the scroll-bar.

The class does not provide all functionality to the scroll-bar, many things the parent of the scroll-bar, must provide. Like a combo-box.

Constructor & Destructor Documentation

◆ IGUIScrollBar()

IGUIScrollBar::IGUIScrollBar ( CGUI pGUI)

◆ ~IGUIScrollBar()

IGUIScrollBar::~IGUIScrollBar ( )
virtual

Member Function Documentation

◆ Draw()

virtual void IGUIScrollBar::Draw ( CCanvas2D canvas)
pure virtual

Draw the scroll-bar.

Implemented in CGUIScrollBarVertical.

◆ GetBarRect()

virtual CRect IGUIScrollBar::GetBarRect ( ) const
pure virtual

Get the rectangle of the actual BAR.

not the whole scroll-bar.

Returns
Rectangle, CRect

Implemented in CGUIScrollBarVertical.

◆ GetMaxPos()

float IGUIScrollBar::GetMaxPos ( ) const
inline

Get the value of m_Pos that corresponds to the bottom of the scrollable region.

◆ GetOuterRect()

virtual CRect IGUIScrollBar::GetOuterRect ( ) const
pure virtual

Get the rectangle of the outline of the scrollbar, every component of the scroll-bar should be inside this area.

Returns
Rectangle, CRect

Implemented in CGUIScrollBarVertical.

◆ GetPos()

float IGUIScrollBar::GetPos ( ) const
inline

Get scroll-position.

◆ GetStyle()

const SGUIScrollBarStyle * IGUIScrollBar::GetStyle ( ) const

Get style used by the scrollbar.

Returns
Scroll bar style struct.

◆ HandleMessage()

void IGUIScrollBar::HandleMessage ( SGUIMessage Message)
pure virtual

If an object that contains a scrollbar has got messages, send them to the scroll-bar and it will see if the message regarded itself.

See also
IGUIObject::HandleMessage()

Implemented in CGUIScrollBarVertical.

◆ HoveringButtonMinus()

virtual bool IGUIScrollBar::HoveringButtonMinus ( const CVector2D mouse)
inlinevirtual

Hovering the scroll minus button.

Parameters
mousecurrent mouse position
Returns
True if mouse positions are hovering the button

Reimplemented in CGUIScrollBarVertical.

◆ HoveringButtonPlus()

virtual bool IGUIScrollBar::HoveringButtonPlus ( const CVector2D mouse)
inlinevirtual

Hovering the scroll plus button.

Parameters
mousecurrent mouse position
Returns
True if mouse positions are hovering the button

Reimplemented in CGUIScrollBarVertical.

◆ IsVisible()

bool IGUIScrollBar::IsVisible ( ) const
inline

Scrollbars without height shouldn't be visible.

◆ NONCOPYABLE()

IGUIScrollBar::NONCOPYABLE ( IGUIScrollBar  )

◆ ScrollMinus()

virtual void IGUIScrollBar::ScrollMinus ( )
inlinevirtual

Decrease scroll one step.

◆ ScrollMinusPlenty()

virtual void IGUIScrollBar::ScrollMinusPlenty ( )
inlinevirtual

Decrease scroll three steps.

◆ ScrollPlus()

virtual void IGUIScrollBar::ScrollPlus ( )
inlinevirtual

Increase scroll one step.

◆ ScrollPlusPlenty()

virtual void IGUIScrollBar::ScrollPlusPlenty ( )
inlinevirtual

Increase scroll three steps.

◆ SetBarPressed()

void IGUIScrollBar::SetBarPressed ( bool  b)
inline

Set bar pressed.

Parameters
bTrue if bar is pressed

◆ SetHostObject()

void IGUIScrollBar::SetHostObject ( IGUIScrollBarOwner pOwner)
inline

Set host object, must be done almost at creation of scroll bar.

Parameters
pOwnerPointer to host object.

◆ SetLength()

void IGUIScrollBar::SetLength ( float  length)
inline

Set Length of scroll bar.

Parameters
lengthLength

◆ SetPos()

virtual void IGUIScrollBar::SetPos ( float  f)
inlinevirtual

Set scroll-position by hand.

◆ SetPosFromMousePos()

virtual void IGUIScrollBar::SetPosFromMousePos ( const CVector2D mouse)
pure virtual

Set m_Pos with g_mouse_x/y input, i.e.

when draggin.

Implemented in CGUIScrollBarVertical.

◆ SetScrollBarStyle()

void IGUIScrollBar::SetScrollBarStyle ( const CStr &  style)
inline

Set Scroll bar style string.

Parameters
styleString with scroll bar style reference name

◆ SetScrollRange()

void IGUIScrollBar::SetScrollRange ( float  range)
inline

Set content length.

Parameters
rangeMaximum scrollable range

◆ SetScrollSpace()

void IGUIScrollBar::SetScrollSpace ( float  space)
inline

Set space that is visible in the scrollable control.

Parameters
spaceVisible area in the scrollable control.

◆ SetupBarSize()

void IGUIScrollBar::SetupBarSize ( )
protected

Sets up bar size.

◆ SetWidth()

void IGUIScrollBar::SetWidth ( float  width)
inline

Set Width.

Parameters
widthWidth

◆ SetX()

void IGUIScrollBar::SetX ( float  x)
inline

Set X Position.

Parameters
xPosition in this axis

◆ SetY()

void IGUIScrollBar::SetY ( float  y)
inline

Set Y Position.

Parameters
yPosition in this axis

◆ SetZ()

void IGUIScrollBar::SetZ ( float  z)
inline

Set Z Position.

Parameters
zPosition in this axis

◆ UpdatePosBoundaries()

void IGUIScrollBar::UpdatePosBoundaries ( )
protected

Call every time m_Pos has been updated.

Member Data Documentation

◆ m_BarHovered

bool IGUIScrollBar::m_BarHovered
protected

Bar being hovered or not.

◆ m_BarPressed

bool IGUIScrollBar::m_BarPressed
protected

If the bar is currently being pressed and dragged.

◆ m_BarPressedAtPos

CVector2D IGUIScrollBar::m_BarPressedAtPos
protected

Mouse position when bar was pressed.

◆ m_BarSize

float IGUIScrollBar::m_BarSize
protected

Use input from the scroll-wheel? True or false.

◆ m_ButtonMinusHovered

bool IGUIScrollBar::m_ButtonMinusHovered
protected

Scroll buttons hovered.

◆ m_ButtonMinusPressed

bool IGUIScrollBar::m_ButtonMinusPressed
protected

Scroll buttons pressed.

◆ m_ButtonPlusHovered

bool IGUIScrollBar::m_ButtonPlusHovered
protected

◆ m_ButtonPlusPressed

bool IGUIScrollBar::m_ButtonPlusPressed
protected

◆ m_Length

float IGUIScrollBar::m_Length
protected

Total length of scrollbar, including edge buttons.

◆ m_pGUI

CGUI& IGUIScrollBar::m_pGUI
protected

Reference to CGUI object, these cannot work stand-alone.

◆ m_pHostObject

IGUIScrollBarOwner* IGUIScrollBar::m_pHostObject
protected

Host object, prerequisite!

◆ m_Pos

float IGUIScrollBar::m_Pos
protected

Position of scroll bar, 0 means scrolled all the way to one side.

It is measured in pixels, it is up to the host to make it actually apply in pixels.

◆ m_PosWhenPressed

float IGUIScrollBar::m_PosWhenPressed
protected

Position from 0.f to 1.f it had when the bar was pressed.

◆ m_pStyle

SGUIScrollBarStyle* IGUIScrollBar::m_pStyle
protected

Pointer to scroll bar style used.

◆ m_ScrollBarStyle

CStr IGUIScrollBar::m_ScrollBarStyle
protected

Scroll bar style reference name.

◆ m_ScrollRange

float IGUIScrollBar::m_ScrollRange
protected

Content that can be scrolled, in pixels.

◆ m_ScrollSpace

float IGUIScrollBar::m_ScrollSpace
protected

Content that can be viewed at a time, in pixels.

◆ m_Width

float IGUIScrollBar::m_Width
protected

Width of the scroll bar.

◆ m_X

float IGUIScrollBar::m_X
protected

Absolute X Position.

◆ m_Y

float IGUIScrollBar::m_Y
protected

Absolute Y Position.

◆ m_Z

float IGUIScrollBar::m_Z
protected

Absolute Z Position.


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