gui::scrollbar Class Reference

Scrollbar. More...

#include <scrollbar.hpp>

Inheritance diagram for gui::scrollbar:

Inheritance graph
[legend]
Collaboration diagram for gui::scrollbar:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 scrollbar (CVideo &video)
 Create a scrollbar.
virtual void hide (bool value=true)
unsigned get_position () const
 Determine where the scrollbar is.
unsigned get_max_position () const
void set_position (unsigned pos)
 Manually update the scrollbar.
void adjust_position (unsigned pos)
 Ensure the viewport contains the position.
void move_position (int dep)
 Move the scrollbar.
void set_shown_size (unsigned h)
 Set the relative size of the grip.
void set_full_size (unsigned h)
 Set the relative size of the scrollbar.
void set_scroll_rate (unsigned r)
 Set scroll rate.
bool is_valid_height (int height) const
 Return true if the scrollbar has a valid size.
void scroll_down ()
 Scrolls down one step.
void scroll_up ()
 Scrolls up one step.

Protected Member Functions

virtual handler_vector handler_members ()
virtual void update_location (SDL_Rect const &rect)
virtual void handle_event (const SDL_Event &event)
virtual void process_event ()
virtual void draw_contents ()

Private Types

enum  STATE { UNINIT, NORMAL, ACTIVE, DRAGGED }

Private Member Functions

SDL_Rect grip_area () const
SDL_Rect groove_area () const

Private Attributes

surface mid_scaled_
surface groove_scaled_
button uparrow_
button downarrow_
STATE state_
int minimum_grip_height_
int mousey_on_grip_
unsigned int grip_position_
unsigned int grip_height_
unsigned int old_position_
unsigned int full_height_
int scroll_rate_


Detailed Description

Scrollbar.

Definition at line 32 of file widgets/scrollbar.hpp.


Member Enumeration Documentation

enum gui::scrollbar::STATE [private]

Enumerator:
UNINIT 
NORMAL 
ACTIVE 
DRAGGED 

Definition at line 95 of file widgets/scrollbar.hpp.


Constructor & Destructor Documentation

gui::scrollbar::scrollbar ( CVideo video  ) 

Create a scrollbar.

Todo:
FIXME: parameterlist ??

Definition at line 45 of file widgets/scrollbar.cpp.

References image::get_image(), minimum_grip_height_, scrollbar_mid, and gui::widget::set_width().


Member Function Documentation

void gui::scrollbar::hide ( bool  value = true  )  [virtual]

unsigned gui::scrollbar::get_position (  )  const

Determine where the scrollbar is.

Returns:
the position.
Return values:
returns 0 if the scrollbar is at the top,
returns (full_size - shown_size) if it is at the bottom.

Definition at line 89 of file widgets/scrollbar.cpp.

References grip_position_.

Referenced by gui::scrollarea::get_position(), gui::scrollarea::process_event(), set_full_size(), and set_shown_size().

unsigned gui::scrollbar::get_max_position (  )  const

void gui::scrollbar::set_position ( unsigned  pos  ) 

void gui::scrollbar::adjust_position ( unsigned  pos  ) 

Ensure the viewport contains the position.

Definition at line 111 of file widgets/scrollbar.cpp.

References grip_height_, grip_position_, and set_position().

Referenced by gui::scrollarea::adjust_position().

void gui::scrollbar::move_position ( int  dep  ) 

void gui::scrollbar::set_shown_size ( unsigned  h  ) 

void gui::scrollbar::set_full_size ( unsigned  h  ) 

void gui::scrollbar::set_scroll_rate ( unsigned  r  ) 

Set scroll rate.

Definition at line 156 of file widgets/scrollbar.cpp.

References scroll_rate_.

Referenced by gui::scrollarea::set_scroll_rate().

bool gui::scrollbar::is_valid_height ( int  height  )  const

Return true if the scrollbar has a valid size.

Definition at line 161 of file widgets/scrollbar.cpp.

References downarrow_, gui::widget::height(), and uparrow_.

Referenced by gui::scrollarea::has_scrollbar().

void gui::scrollbar::scroll_down (  ) 

Scrolls down one step.

Definition at line 172 of file widgets/scrollbar.cpp.

References move_position(), and scroll_rate_.

Referenced by gui::scrollarea::handle_event(), and process_event().

void gui::scrollbar::scroll_up (  ) 

Scrolls up one step.

Definition at line 177 of file widgets/scrollbar.cpp.

References move_position(), and scroll_rate_.

Referenced by gui::scrollarea::handle_event(), and process_event().

handler_vector gui::scrollbar::handler_members (  )  [protected, virtual]

Reimplemented from events::handler.

Definition at line 61 of file widgets/scrollbar.cpp.

References downarrow_, and uparrow_.

void gui::scrollbar::update_location ( SDL_Rect const &  rect  )  [protected, virtual]

void gui::scrollbar::handle_event ( const SDL_Event &  event  )  [protected, virtual]

void gui::scrollbar::process_event (  )  [protected, virtual]

Reimplemented from events::handler.

Definition at line 182 of file widgets/scrollbar.cpp.

References downarrow_, gui::button::pressed(), scroll_down(), scroll_up(), and uparrow_.

void gui::scrollbar::draw_contents (  )  [protected, virtual]

SDL_Rect gui::scrollbar::grip_area (  )  const [private]

SDL_Rect gui::scrollbar::groove_area (  )  const [private]


Member Data Documentation

Definition at line 91 of file widgets/scrollbar.hpp.

Referenced by draw_contents(), and handle_event().

Definition at line 91 of file widgets/scrollbar.hpp.

Referenced by draw_contents().

Reimplemented from gui::widget.

Definition at line 96 of file widgets/scrollbar.hpp.

Referenced by draw_contents(), and handle_event().

Definition at line 98 of file widgets/scrollbar.hpp.

Referenced by grip_area(), and scrollbar().

Definition at line 98 of file widgets/scrollbar.hpp.

Referenced by handle_event().

unsigned int gui::scrollbar::grip_position_ [private]

unsigned int gui::scrollbar::grip_height_ [private]

unsigned int gui::scrollbar::old_position_ [private]

Definition at line 100 of file widgets/scrollbar.hpp.

unsigned int gui::scrollbar::full_height_ [private]

Definition at line 101 of file widgets/scrollbar.hpp.

Referenced by handle_event(), scroll_down(), scroll_up(), and set_scroll_rate().


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

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs