Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

PG_ScrollBar Class Reference

A vertical or horizontal scrollbar. More...

#include <pgscrollbar.h>

Inheritance diagram for PG_ScrollBar:

Inheritance graph
[legend]
List of all members.

Public Types

enum  ScrollDirection { VERTICAL, HORIZONTAL }
 ScrollbarType. More...
enum  {
  IDSCROLLBAR_UP = PG_WIDGETID_INTERNAL + 1, IDSCROLLBAR_DOWN = PG_WIDGETID_INTERNAL + 2, IDSCROLLBAR_LEFT = PG_WIDGETID_INTERNAL + 3, IDSCROLLBAR_RIGHT = PG_WIDGETID_INTERNAL + 4,
  IDSCROLLBAR_DRAG = PG_WIDGETID_INTERNAL + 5
}
 Widget ID's. More...

Public Member Functions

 PG_ScrollBar (PG_Widget *parent, const PG_Rect &r=PG_Rect::null, ScrollDirection direction=VERTICAL, int id=-1, const std::string &style="Scrollbar")
virtual ~PG_ScrollBar ()
void LoadThemeStyle (const std::string &widgettype)
 Load a specific themestyle.
void SetPosition (int pos)
int GetPosition ()
void SetRange (Uint32 min, Uint32 max)
 The range in which the scrollbar operates.
int GetMinRange ()
int GetMaxRange ()
void SetLineSize (int ls)
 Linesize is the scroll distance that is scrolled if one of the arrow buttons is pressed.
int GetLineSize ()
void SetPageSize (int ps)

Public Attributes

SignalScrollPos< long > sigScrollPos
SignalScrollTrack< long > sigScrollTrack

Protected Member Functions

void eventSizeWidget (Uint16 w, Uint16 h)
 Callback for the SizeWidget event.
bool eventMouseMotion (const SDL_MouseMotionEvent *motion)
 Overridable Eventhandler for a SDL_MouseMotionEvent message.
bool eventMouseButtonDown (const SDL_MouseButtonEvent *button)
 Overridable Eventhandler for a SDL_MouseButtonEvent message.
virtual bool handleButtonClick (PG_Button *button)
bool eventMouseButtonUp (const SDL_MouseButtonEvent *button)
 Overridable Eventhandler for a SDL_MouseButtonEvent message.
virtual void RecalcPositions ()

Protected Attributes

int scroll_min
int scroll_max
int scroll_current
int my_linesize
int my_pagesize
PG_Buttonscrollbutton [2]
ScrollButtondragbutton
PG_Rect position [4]
 the positions of the elements the scrollbar exists of:
ScrollDirection sb_direction

Friends

class ScrollButton

Classes

class  ScrollButton
class  SignalScrollPos
 Signal type declaration. More...
class  SignalScrollTrack

Detailed Description

A vertical or horizontal scrollbar.

Author:
Alexander Pipelka
Doesn't actually tie itself to any object to be scrolled, just get's told it's current state through function calls.

Definition at line 48 of file pgscrollbar.h.


Member Enumeration Documentation

anonymous enum
 

Widget ID's.

Enumeration values:
IDSCROLLBAR_UP  ID Scrollbar Button "up".
IDSCROLLBAR_DOWN  ID Scrollbar Button "down".
IDSCROLLBAR_LEFT  ID Scrollbar Button "left".
IDSCROLLBAR_RIGHT  ID Scrollbar Button "right".
IDSCROLLBAR_DRAG  ID Scrollbar Button "drag".

Definition at line 95 of file pgscrollbar.h.

enum PG_ScrollBar::ScrollDirection
 

ScrollbarType.

Enumeration values:
VERTICAL  vertical scrollbar
HORIZONTAL  horizontal scrollbar

Definition at line 89 of file pgscrollbar.h.


Constructor & Destructor Documentation

PG_ScrollBar::PG_ScrollBar PG_Widget parent,
const PG_Rect r = PG_Rect::null,
ScrollDirection  direction = VERTICAL,
int  id = -1,
const std::string &  style = "Scrollbar"
 

Definition at line 37 of file pgscrollbar.cpp.

References dragbutton, handleButtonClick(), IDSCROLLBAR_DOWN, IDSCROLLBAR_DRAG, IDSCROLLBAR_LEFT, IDSCROLLBAR_RIGHT, IDSCROLLBAR_UP, LoadThemeStyle(), my_linesize, my_pagesize, sb_direction, scroll_current, scroll_max, scroll_min, PG_PropStr::Scrollbar, ScrollButton, scrollbutton, PG_Widget::SetID(), SetPosition(), PG_Button::sigClick, and VERTICAL.

PG_ScrollBar::~PG_ScrollBar  )  [virtual]
 

Definition at line 68 of file pgscrollbar.cpp.


Member Function Documentation

bool PG_ScrollBar::eventMouseButtonDown const SDL_MouseButtonEvent *  button  )  [protected, virtual]
 

Overridable Eventhandler for a SDL_MouseButtonEvent message.

This handler is called when a mouse button is pressed. The default implementation returns 'false' which indicates that this message is not processed by this object.

Parameters:
button SDL_MouseButtonEvent message
Returns:
Notifies the message pump if this message is processed by this object or it should be routed to the next message receiver.

Reimplemented from PG_MessageObject.

Definition at line 401 of file pgscrollbar.cpp.

bool PG_ScrollBar::eventMouseButtonUp const SDL_MouseButtonEvent *  button  )  [protected, virtual]
 

Overridable Eventhandler for a SDL_MouseButtonEvent message.

This handler is called when a mouse button is released. The default implementation returns 'false' which indicates that this message is not processed by this object.

Parameters:
button SDL_MouseButtonEvent message
Returns:
Notifies the message pump if this message is processed by this object or it should be routed to the next message receiver.

Reimplemented from PG_MessageObject.

Reimplemented in PG_Slider.

Definition at line 220 of file pgscrollbar.cpp.

References dragbutton, PG_MessageObject::eventMouseButtonUp(), PG_Application::GetEventSupplier(), PG_Rect::my_height, my_linesize, my_pagesize, PG_Rect::my_width, PG_Rect::my_xpos, PG_Rect::my_ypos, sb_direction, scroll_current, scroll_min, SetPosition(), sigScrollPos, and VERTICAL.

bool PG_ScrollBar::eventMouseMotion const SDL_MouseMotionEvent *  motion  )  [protected, virtual]
 

Overridable Eventhandler for a SDL_MouseMotionEvent message.

This handler is called when mouse movement is detected. The default implementation returns 'false' which indicates that this message is not processed by this object.

Parameters:
motion SDL_MouseMotionEvent message
Returns:
Notifies the message pump if this message is processed by this object or it should be routed to the next message receiver.

Reimplemented from PG_MessageObject.

Definition at line 215 of file pgscrollbar.cpp.

References PG_MessageObject::eventMouseMotion().

void PG_ScrollBar::eventSizeWidget Uint16  w,
Uint16  h
[protected, virtual]
 

Callback for the SizeWidget event.

Parameters:
w new width
h new height This virtual function can be used to implement custom behavior for SizeWidget events.

Reimplemented from PG_ThemeWidget.

Definition at line 202 of file pgscrollbar.cpp.

References PG_ThemeWidget::eventSizeWidget(), PG_Rect::my_height, PG_Rect::my_width, RecalcPositions(), scroll_current, and SetPosition().

int PG_ScrollBar::GetLineSize  ) 
 

Definition at line 493 of file pgscrollbar.cpp.

References my_linesize.

Referenced by PG_ScrollWidget::eventMouseButtonDown().

int PG_ScrollBar::GetMaxRange  ) 
 

Definition at line 439 of file pgscrollbar.cpp.

References scroll_max.

Referenced by PG_MultiLineEdit::SetVPosition().

int PG_ScrollBar::GetMinRange  ) 
 

Definition at line 434 of file pgscrollbar.cpp.

References scroll_min.

int PG_ScrollBar::GetPosition  ) 
 

Definition at line 371 of file pgscrollbar.cpp.

References scroll_current.

Referenced by PG_MultiLineEdit::handleScroll(), PG_ColorSelector::SetBaseColor(), and PG_MultiLineEdit::SetVPosition().

bool PG_ScrollBar::handleButtonClick PG_Button button  )  [protected, virtual]
 

Definition at line 376 of file pgscrollbar.cpp.

References my_linesize, scroll_current, scroll_max, scroll_min, scrollbutton, SetPosition(), and sigScrollPos.

Referenced by PG_ScrollBar().

void PG_ScrollBar::LoadThemeStyle const std::string &  widgettype  ) 
 

Load a specific themestyle.

Parameters:
widgettype name of widget type to load

Reimplemented from PG_ThemeWidget.

Reimplemented in PG_Slider.

Definition at line 70 of file pgscrollbar.cpp.

References dragbutton, PG_Button::LoadThemeStyle(), PG_ThemeWidget::LoadThemeStyle(), RecalcPositions(), sb_direction, PG_PropStr::Scrollbar, PG_PropStr::ScrollbarDown, PG_PropStr::ScrollbarDrag, PG_PropStr::ScrollbarDragH, PG_PropStr::ScrollbarDragV, PG_PropStr::ScrollbarH, PG_PropStr::ScrollbarLeft, PG_PropStr::ScrollbarRight, PG_PropStr::ScrollbarUp, PG_PropStr::ScrollbarV, scrollbutton, and VERTICAL.

Referenced by PG_ScrollWidget::LoadThemeStyle(), and PG_ScrollBar().

void PG_ScrollBar::RecalcPositions  )  [protected, virtual]
 

Reimplemented in PG_Slider.

Definition at line 94 of file pgscrollbar.cpp.

References dragbutton, PG_Widget::MoveWidget(), PG_Widget::my_bordersize, my_pagesize, position, sb_direction, scroll_current, scroll_max, scroll_min, scrollbutton, and VERTICAL.

Referenced by eventSizeWidget(), LoadThemeStyle(), SetPageSize(), and SetPosition().

void PG_ScrollBar::SetLineSize int  ls  ) 
 

Linesize is the scroll distance that is scrolled if one of the arrow buttons is pressed.

Definition at line 489 of file pgscrollbar.cpp.

References my_linesize.

Referenced by PG_ScrollWidget::CheckScrollBars(), PG_RichEdit::PG_RichEdit(), and SetScrollBarAtts().

void PG_ScrollBar::SetPageSize int  ps  ) 
 

Definition at line 499 of file pgscrollbar.cpp.

References my_pagesize, and RecalcPositions().

Referenced by PG_ScrollWidget::CheckScrollBars(), ASC_MainScreenWidget::eventKeyDown(), and SetScrollBarAtts().

void PG_ScrollBar::SetPosition int  pos  ) 
 

Definition at line 350 of file pgscrollbar.cpp.

References dragbutton, PG_Button::GetPressed(), RecalcPositions(), scroll_current, scroll_max, and scroll_min.

Referenced by PG_ScrollWidget::CheckScrollBars(), PG_Slider::eventMouseButtonUp(), eventMouseButtonUp(), eventSizeWidget(), handleButtonClick(), InternalAmmoTransferWidget::InternalAmmoTransferWidget(), MapInfoPanel::MapInfoPanel(), PG_ScrollBar(), PG_Slider::PG_Slider(), ResourcePlacementDialog::ResourcePlacementDialog(), SetRange(), SetScrollBarAtts(), PG_MultiLineEdit::SetVPosition(), SoundSettings::SoundSettings(), and MatterAndMiningBaseWindow::update().

void PG_ScrollBar::SetRange Uint32  min,
Uint32  max
 

The range in which the scrollbar operates.

The whole scrolling area is (max - min) + pagesize

Definition at line 426 of file pgscrollbar.cpp.

References scroll_current, scroll_max, scroll_min, and SetPosition().

Referenced by PG_ScrollWidget::CheckScrollBars(), ASC_MainScreenWidget::eventKeyDown(), InternalAmmoTransferWidget::InternalAmmoTransferWidget(), MapInfoPanel::MapInfoPanel(), PG_ColorSelector::PG_ColorSelector(), PG_ScrollWidget::PG_ScrollWidget(), ResourcePlacementDialog::ResourcePlacementDialog(), SetScrollBarAtts(), SoundSettings::SoundSettings(), and MatterAndMiningBaseWindow::update().


Friends And Related Function Documentation

friend class ScrollButton [friend]
 

Definition at line 190 of file pgscrollbar.h.

Referenced by PG_ScrollBar().


Member Data Documentation

ScrollButton* PG_ScrollBar::dragbutton [protected]
 

Definition at line 176 of file pgscrollbar.h.

Referenced by eventMouseButtonUp(), PG_Slider::LoadThemeStyle(), LoadThemeStyle(), PG_ScrollBar(), PG_Slider::RecalcPositions(), RecalcPositions(), and SetPosition().

int PG_ScrollBar::my_linesize [protected]
 

Definition at line 170 of file pgscrollbar.h.

Referenced by PG_Slider::eventMouseButtonUp(), eventMouseButtonUp(), GetLineSize(), handleButtonClick(), PG_ScrollBar(), and SetLineSize().

int PG_ScrollBar::my_pagesize [protected]
 

Definition at line 172 of file pgscrollbar.h.

Referenced by eventMouseButtonUp(), PG_ScrollBar(), RecalcPositions(), and SetPageSize().

PG_Rect PG_ScrollBar::position[4] [protected]
 

the positions of the elements the scrollbar exists of:

  • position[0] is the position of the first button ( left / upper )
  • position[1] is the position of the second button ( right / lower )
  • position[2] is the position of the sliding area
  • position[3] is the position of the slider

Definition at line 184 of file pgscrollbar.h.

Referenced by PG_ScrollBar::ScrollButton::eventMouseMotion(), PG_ScrollBar::ScrollButton::GetPosFromPoint(), PG_Slider::RecalcPositions(), and RecalcPositions().

ScrollDirection PG_ScrollBar::sb_direction [protected]
 

Definition at line 186 of file pgscrollbar.h.

Referenced by eventMouseButtonUp(), PG_Slider::LoadThemeStyle(), LoadThemeStyle(), PG_ScrollBar(), PG_Slider::RecalcPositions(), and RecalcPositions().

int PG_ScrollBar::scroll_current [protected]
 

Definition at line 168 of file pgscrollbar.h.

Referenced by PG_Slider::eventMouseButtonUp(), eventMouseButtonUp(), eventSizeWidget(), GetPosition(), handleButtonClick(), PG_ScrollBar(), PG_Slider::RecalcPositions(), RecalcPositions(), SetPosition(), and SetRange().

int PG_ScrollBar::scroll_max [protected]
 

Definition at line 166 of file pgscrollbar.h.

Referenced by GetMaxRange(), handleButtonClick(), PG_ScrollBar(), PG_Slider::RecalcPositions(), RecalcPositions(), SetPosition(), and SetRange().

int PG_ScrollBar::scroll_min [protected]
 

Definition at line 164 of file pgscrollbar.h.

Referenced by PG_Slider::eventMouseButtonUp(), eventMouseButtonUp(), GetMinRange(), handleButtonClick(), PG_ScrollBar(), PG_Slider::PG_Slider(), PG_Slider::RecalcPositions(), RecalcPositions(), SetPosition(), and SetRange().

PG_Button* PG_ScrollBar::scrollbutton[2] [protected]
 

Definition at line 174 of file pgscrollbar.h.

Referenced by handleButtonClick(), LoadThemeStyle(), PG_ScrollBar(), PG_Slider::PG_Slider(), PG_Slider::RecalcPositions(), and RecalcPositions().

SignalScrollPos<long> PG_ScrollBar::sigScrollPos
 

Definition at line 144 of file pgscrollbar.h.

Referenced by eventMouseButtonUp(), handleButtonClick(), PG_MultiLineEdit::PG_MultiLineEdit(), PG_RichEdit::PG_RichEdit(), PG_ScrollWidget::PG_ScrollWidget(), PG_Slider::PG_Slider(), and MatterAndMiningBaseWindow::update().

SignalScrollTrack<long> PG_ScrollBar::sigScrollTrack
 

Definition at line 145 of file pgscrollbar.h.

Referenced by CargoWidget::CargoWidget(), PG_MultiLineEdit::PG_MultiLineEdit(), PG_RichEdit::PG_RichEdit(), PG_ScrollWidget::PG_ScrollWidget(), PG_Slider::PG_Slider(), SoundSettings::SoundSettings(), and MatterAndMiningBaseWindow::update().


The documentation for this class was generated from the following files:
Generated on Tue Jun 24 02:19:24 2008 for Advanced Strategic Command by  doxygen 1.4.2