Overview   Project   Class   Tree   Deprecated   Index 
0 A.D.
FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD

gui
Class IGUIScrollBar

   in IGUIScrollBar.h
   in IGUIScrollBar.cpp
Direct Known Subclasses:
CGUIScrollBarVertical

class IGUIScrollBar

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.


Field Summary
protected bool m_BarHovered
          Bar being hovered or not
protected bool m_BarPressed
          If the bar is currently being pressed and dragged.
protected CPos m_BarPressedAtPos
          Mouse position when bar was pressed
protected float m_BarSize
          Use input from the scroll-wheel? True or false.
protected bool m_ButtonMinusHovered
          Scroll buttons hovered
protected bool m_ButtonMinusPressed
          Scroll buttons pressed
protected bool m_ButtonPlusHovered
          Scroll buttons hovered
protected bool m_ButtonPlusPressed
          Scroll buttons pressed
protected float m_Length
          Total length of scrollbar, including edge buttons.
protected CGUI* m_pGUI
          Reference to CGUI object, these cannot work stand-alone
protected IGUIScrollBarOwner* m_pHostObject
          Host object, prerequisite!
protected float m_Pos
          Position of scroll bar, 0 means scrolled all the way to one side.
protected float m_PosWhenPressed
          Position from 0.
protected SGUIScrollBarStyle* m_pStyle
          Pointer to scroll bar style used.
protected CStr m_ScrollBarStyle
          Scroll bar style reference name
protected float m_ScrollRange
          Content that can be scrolled, in pixels
protected float m_ScrollSpace
          Content that can be viewed at a time, in pixels
protected bool m_UseEdgeButtons
          True if you want edge buttons, i.
protected float m_Width
          Width of the scroll bar
protected float m_X
          Absolute X Position
protected float m_Y
          Absolute Y Position
protected float m_Z
          Absolute Z Position
 
Constructor Summary
IGUIScrollBar()
          
virtual ~IGUIScrollBar()
          
 
Method Summary
 virtual void Draw()= 0
          Draw the scroll-bar
 virtual CRect GetBarRect() const = 0
          Get the rectangle of the actual BAR.
 CGUI* GetGUI() const
          Get GUI pointer
 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.
 float GetPos() const
          Get scroll-position
 SGUIScrollBarStyle* GetStyle() const
          Get style used by the scrollbar
 virtual void HandleMessage( const 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.
 virtual bool HoveringButtonMinus( const CPos& UNUSED( mouse ) )
          Hovering the scroll minus button
 virtual bool HoveringButtonPlus( const CPos& UNUSED( mouse ) )
          Hovering the scroll plus button
 virtual void ScrollMinus()
          Scroll towards 0.0 one step
 virtual void ScrollMinusPlenty()
          Scroll towards 0.0 one step
 virtual void ScrollPlus()
          Scroll towards 1.0 one step
 virtual void ScrollPlusPlenty()
          Scroll towards 1.0 one step
 void SetBarPressed( const bool& b )
          Set bar pressed
 void SetGUI( CGUI* pGUI )
          Set GUI pointer
 void SetHostObject( IGUIScrollBarOwner* pOwner )
          Set host object, must be done almost at creation of scroll bar.
 void SetLength( const float& length )
          Set Length of scroll bar
 virtual void SetPos( const float& f )
          Set scroll-position by hand
 virtual void SetPosFromMousePos( const CPos& mouse )= 0
          Set m_Pos with g_mouse_x/y input, i.
 void SetScrollBarStyle( const CStr& style )
          Set Scroll bar style string
 void SetScrollRange( const float& range )
          Set content length
 void SetScrollSpace( const float& space )
          Set space that is visible in the scrollable control.
protected void SetupBarSize()
          Sets up bar size
 void SetUseEdgeButtons( const bool& b )
          Set use edge buttons
 void SetWidth( const float& width )
          Set Width
 void SetX( const float& x )
          Set X Position
 void SetY( const float& y )
          Set Y Position
 void SetZ( const float& z )
          Set Z Position
protected void UpdatePosBoundaries()
          Call every time m_Pos has been updated.
 

Field Detail

m_BarHovered

protected bool m_BarHovered;
Bar being hovered or not

m_BarPressed

protected bool m_BarPressed;
If the bar is currently being pressed and dragged.

m_BarPressedAtPos

protected CPos m_BarPressedAtPos;
Mouse position when bar was pressed

m_BarSize

protected float m_BarSize;
Use input from the scroll-wheel? True or false.

m_ButtonMinusHovered

protected bool m_ButtonMinusHovered;
Scroll buttons hovered

m_ButtonMinusPressed

protected bool m_ButtonMinusPressed;
Scroll buttons pressed

m_ButtonPlusHovered

protected bool m_ButtonPlusHovered;
Scroll buttons hovered

m_ButtonPlusPressed

protected bool m_ButtonPlusPressed;
Scroll buttons pressed

m_Length

protected float m_Length;
Total length of scrollbar, including edge buttons.

m_pGUI

protected CGUI* m_pGUI;
Reference to CGUI object, these cannot work stand-alone

m_pHostObject

protected IGUIScrollBarOwner* m_pHostObject;
Host object, prerequisite!

m_Pos

protected float m_Pos;
Position of scroll bar, 0 means scrolled all the way to one side. It is meassured in pixels, it is up to the host to make it actually apply in pixels.

m_PosWhenPressed

protected float m_PosWhenPressed;
Position from 0.f to 1.f it had when the bar was pressed.

m_pStyle

protected SGUIScrollBarStyle* m_pStyle;
Pointer to scroll bar style used.

m_ScrollBarStyle

protected CStr m_ScrollBarStyle;
Scroll bar style reference name

m_ScrollRange

protected float m_ScrollRange;
Content that can be scrolled, in pixels

m_ScrollSpace

protected float m_ScrollSpace;
Content that can be viewed at a time, in pixels

m_UseEdgeButtons

protected bool m_UseEdgeButtons;
True if you want edge buttons, i.e. buttons that can be pressed in order to scroll.

m_Width

protected float m_Width;
Width of the scroll bar

m_X

protected float m_X;
Absolute X Position

m_Y

protected float m_Y;
Absolute Y Position

m_Z

protected float m_Z;
Absolute Z Position


Constructor Detail

IGUIScrollBar

public IGUIScrollBar();

~IGUIScrollBar

public virtual ~IGUIScrollBar();


Method Detail

Draw

public virtual void Draw()= 0;
Draw the scroll-bar

GetBarRect

public virtual CRect GetBarRect() const = 0;
Get the rectangle of the actual BAR. not the whole scroll-bar.
Returns:
Rectangle, CRect

GetGUI

public CGUI* GetGUI() const;
Get GUI pointer
Returns:
CGUI pointer

GetOuterRect

public 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.
Returns:
Rectangle, CRect

GetPos

public float GetPos() const;
Get scroll-position

GetStyle

public SGUIScrollBarStyle* GetStyle() const;
Get style used by the scrollbar
Returns:
Scroll bar style struct.

HandleMessage

public virtual void HandleMessage( const 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.
Parameters:
Message - SGUIMessage
Returns:
true if messages handled the scroll-bar some. False if the message should be processed by the object.

HoveringButtonMinus

public virtual bool HoveringButtonMinus( const CPos& UNUSED( mouse ) );
Hovering the scroll minus button
Parameters:
m_x - mouse x
m_y - mouse y
Returns:
True if mouse positions are hovering the button

HoveringButtonPlus

public virtual bool HoveringButtonPlus( const CPos& UNUSED( mouse ) );
Hovering the scroll plus button
Parameters:
m_x - mouse x
m_y - mouse y
Returns:
True if mouse positions are hovering the button

ScrollMinus

public virtual void ScrollMinus();
Scroll towards 0.0 one step

ScrollMinusPlenty

public virtual void ScrollMinusPlenty();
Scroll towards 0.0 one step

ScrollPlus

public virtual void ScrollPlus();
Scroll towards 1.0 one step

ScrollPlusPlenty

public virtual void ScrollPlusPlenty();
Scroll towards 1.0 one step

SetBarPressed

public void SetBarPressed( const bool& b );
Set bar pressed
Parameters:
pressed - True if bar is pressed

SetGUI

public void SetGUI( CGUI* pGUI );
Set GUI pointer
Parameters:
pGUI - pointer to CGUI object.

SetHostObject

public void SetHostObject( IGUIScrollBarOwner* pOwner );
Set host object, must be done almost at creation of scroll bar.
Parameters:
pOwner - Pointer to host object.

SetLength

public void SetLength( const float& length );
Set Length of scroll bar
Parameters:
length - Length

SetPos

public virtual void SetPos( const float& f );
Set scroll-position by hand

SetPosFromMousePos

public virtual void SetPosFromMousePos( const CPos& mouse )= 0;
Set m_Pos with g_mouse_x/y input, i.e. when draggin.

SetScrollBarStyle

public void SetScrollBarStyle( const CStr& style );
Set Scroll bar style string
Parameters:
style - String with scroll bar style reference name

SetScrollRange

public void SetScrollRange( const float& range );
Set content length
Parameters:
range - Maximum scrollable range

SetScrollSpace

public void SetScrollSpace( const float& space );
Set space that is visible in the scrollable control.
Parameters:
space - Visible area in the scrollable control.

SetupBarSize

protected void SetupBarSize();
Sets up bar size

SetUseEdgeButtons

public void SetUseEdgeButtons( const bool& b );
Set use edge buttons
Parameters:
b - True if edge buttons should be used

SetWidth

public void SetWidth( const float& width );
Set Width
Parameters:
width - Width

SetX

public void SetX( const float& x );
Set X Position
Parameters:
x - Position in this axis

SetY

public void SetY( const float& y );
Set Y Position
Parameters:
y - Position in this axis

SetZ

public void SetZ( const float& z );
Set Z Position
Parameters:
z - Position in this axis

UpdatePosBoundaries

protected void UpdatePosBoundaries();
Call every time m_Pos has been updated.

 Overview   Project   Class   Tree   Deprecated   Index 
0 A.D.
Generated on September 04, 2007 at 18:13
CppDoc v2.4.0
FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD