Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes

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 29 of file scrollbar.hpp.


Member Enumeration Documentation

enum gui::scrollbar::STATE [private]
Enumerator:
UNINIT 
NORMAL 
ACTIVE 
DRAGGED 

Definition at line 95 of file scrollbar.hpp.


Constructor & Destructor Documentation

gui::scrollbar::scrollbar ( CVideo video  ) 

Create a scrollbar.

Todo:
FIXME: parameterlist ??

Definition at line 46 of file scrollbar.cpp.

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

Here is the call graph for this function:


Member Function Documentation

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

Ensure the viewport contains the position.

Definition at line 120 of file scrollbar.cpp.

References grip_height_, grip_position_, and set_position().

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 103 of file scrollbar.cpp.

References full_height_, and grip_height_.

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

Here is the caller graph for this function:

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 98 of file scrollbar.cpp.

References grip_position_.

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

Here is the caller graph for this function:

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

Definition at line 214 of file scrollbar.cpp.

References gui2::create_rect(), full_height_, grip_height_, grip_position_, groove_area(), h, and minimum_grip_height_.

Referenced by draw_contents(), and handle_event().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 200 of file scrollbar.cpp.

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

Referenced by draw_contents(), grip_area(), and handle_event().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from events::handler.

Definition at line 70 of file scrollbar.cpp.

References downarrow_, h, and uparrow_.

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

Reimplemented from gui::widget.

Definition at line 91 of file scrollbar.cpp.

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

Referenced by gui::scrollarea::hide(), gui::scrollarea::scrollarea(), and gui::scrollarea::update_location().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Return true if the scrollbar has a valid size.

Definition at line 170 of file scrollbar.cpp.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Move the scrollbar.

Definition at line 128 of file scrollbar.cpp.

References grip_position_, pos, and set_position().

Referenced by handle_event(), gui::scrollarea::move_position(), scroll_down(), and scroll_up().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from events::handler.

Definition at line 191 of file scrollbar.cpp.

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

Here is the call graph for this function:

void gui::scrollbar::scroll_down (  ) 

Scrolls down one step.

Definition at line 181 of file scrollbar.cpp.

References move_position(), and scroll_rate_.

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

Here is the call graph for this function:

Here is the caller graph for this function:

void gui::scrollbar::scroll_up (  ) 

Scrolls up one step.

Definition at line 186 of file scrollbar.cpp.

References move_position(), and scroll_rate_.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Set the relative size of the scrollbar.

Definition at line 151 of file scrollbar.cpp.

References downarrow_, gui::button::enable(), full_height_, get_max_position(), get_position(), grip_height_, grip_position_, gui::widget::set_dirty(), set_position(), and set_shown_size().

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Manually update the scrollbar.

Definition at line 108 of file scrollbar.cpp.

References downarrow_, gui::button::enable(), full_height_, grip_height_, grip_position_, gui::widget::set_dirty(), and uparrow_.

Referenced by adjust_position(), move_position(), set_full_size(), gui::scrollarea::set_position(), and set_shown_size().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Set scroll rate.

Definition at line 165 of file scrollbar.cpp.

References scroll_rate_.

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

Here is the caller graph for this function:

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

Set the relative size of the grip.

Definition at line 137 of file scrollbar.cpp.

References full_height_, get_max_position(), get_position(), grip_height_, grip_position_, gui::widget::set_dirty(), and set_position().

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from gui::widget.

Definition at line 78 of file scrollbar.cpp.

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

Here is the call graph for this function:


Member Data Documentation

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

Definition at line 91 of file scrollbar.hpp.

Referenced by draw_contents().

Definition at line 91 of file scrollbar.hpp.

Referenced by draw_contents(), and handle_event().

Definition at line 98 of file scrollbar.hpp.

Referenced by grip_area(), and scrollbar().

Definition at line 98 of file scrollbar.hpp.

Referenced by handle_event().

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

Definition at line 100 of file scrollbar.hpp.

Definition at line 101 of file scrollbar.hpp.

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

Reimplemented from gui::widget.

Definition at line 96 of file scrollbar.hpp.

Referenced by draw_contents(), and handle_event().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:21:33 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs