#include <scrollbar.hpp>
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_ |
Definition at line 32 of file widgets/scrollbar.hpp.
enum gui::scrollbar::STATE [private] |
gui::scrollbar::scrollbar | ( | CVideo & | video | ) |
Create a scrollbar.
Definition at line 45 of file widgets/scrollbar.cpp.
References image::get_image(), minimum_grip_height_, scrollbar_mid, and gui::widget::set_width().
void gui::scrollbar::hide | ( | bool | value = true |
) | [virtual] |
Reimplemented from gui::widget.
Definition at line 82 of file widgets/scrollbar.cpp.
References downarrow_, gui::widget::hide(), and uparrow_.
Referenced by gui::scrollarea::hide(), gui::scrollarea::scrollarea(), and gui::scrollarea::update_location().
unsigned gui::scrollbar::get_position | ( | ) | const |
Determine where the scrollbar is.
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 |
Definition at line 94 of file widgets/scrollbar.cpp.
References full_height_, and grip_height_.
Referenced by gui::scrollarea::get_max_position(), set_full_size(), and set_shown_size().
void gui::scrollbar::set_position | ( | unsigned | pos | ) |
Manually update the scrollbar.
Definition at line 99 of file widgets/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().
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 | ) |
Move the scrollbar.
Definition at line 119 of file widgets/scrollbar.cpp.
References grip_position_, pos, and set_position().
Referenced by handle_event(), gui::scrollarea::move_position(), scroll_down(), and scroll_up().
void gui::scrollbar::set_shown_size | ( | unsigned | h | ) |
Set the relative size of the grip.
Definition at line 128 of file widgets/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().
void gui::scrollbar::set_full_size | ( | unsigned | h | ) |
Set the relative size of the scrollbar.
Definition at line 142 of file widgets/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().
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] |
Reimplemented from gui::widget.
Definition at line 69 of file widgets/scrollbar.cpp.
References downarrow_, gui::widget::height(), r, gui::widget::set_location(), uparrow_, and gui::widget::update_location().
void gui::scrollbar::handle_event | ( | const SDL_Event & | event | ) | [protected, virtual] |
Reimplemented from gui::widget.
Definition at line 285 of file widgets/scrollbar.cpp.
References ACTIVE, surface::assign(), DRAGGED, full_height_, grip_area(), grip_height_, groove_area(), gui::widget::hidden(), mid_scaled_, mousey_on_grip_, move_position(), NORMAL, point_in_rect(), scroll_rate_, SDL_BUTTON_WHEELDOWN, SDL_BUTTON_WHEELUP, gui::widget::set_dirty(), and state_.
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] |
Reimplemented from gui::widget.
Definition at line 218 of file widgets/scrollbar.cpp.
References surface::assign(), CVideo::blit_surface(), image::get_image(), CVideo::getSurface(), grip_area(), groove_area(), groove_bottom, groove_mid, groove_scaled_, groove_top, mid_scaled_, NORMAL, surface::null(), scale_surface_blended(), screen, scrollbar_bottom, scrollbar_bottom_hl, scrollbar_mid, scrollbar_mid_hl, scrollbar_top, scrollbar_top_hl, state_, update_rect(), and gui::widget::video().
SDL_Rect gui::scrollbar::grip_area | ( | ) | const [private] |
Definition at line 205 of file widgets/scrollbar.cpp.
References full_height_, grip_height_, grip_position_, groove_area(), loc, and minimum_grip_height_.
Referenced by draw_contents(), and handle_event().
SDL_Rect gui::scrollbar::groove_area | ( | ) | const [private] |
Definition at line 191 of file widgets/scrollbar.cpp.
References downarrow_, gui::widget::height(), loc, gui::widget::location(), and uparrow_.
Referenced by draw_contents(), grip_area(), and handle_event().
surface gui::scrollbar::mid_scaled_ [private] |
Definition at line 91 of file widgets/scrollbar.hpp.
Referenced by draw_contents(), and handle_event().
surface gui::scrollbar::groove_scaled_ [private] |
button gui::scrollbar::uparrow_ [private] |
Definition at line 93 of file widgets/scrollbar.hpp.
Referenced by groove_area(), handler_members(), hide(), is_valid_height(), process_event(), set_position(), and update_location().
button gui::scrollbar::downarrow_ [private] |
Definition at line 93 of file widgets/scrollbar.hpp.
Referenced by groove_area(), handler_members(), hide(), is_valid_height(), process_event(), set_full_size(), set_position(), and update_location().
STATE gui::scrollbar::state_ [private] |
Reimplemented from gui::widget.
Definition at line 96 of file widgets/scrollbar.hpp.
Referenced by draw_contents(), and handle_event().
int gui::scrollbar::minimum_grip_height_ [private] |
int gui::scrollbar::mousey_on_grip_ [private] |
unsigned int gui::scrollbar::grip_position_ [private] |
Definition at line 100 of file widgets/scrollbar.hpp.
Referenced by adjust_position(), get_position(), grip_area(), move_position(), set_full_size(), set_position(), and set_shown_size().
unsigned int gui::scrollbar::grip_height_ [private] |
Definition at line 100 of file widgets/scrollbar.hpp.
Referenced by adjust_position(), get_max_position(), grip_area(), handle_event(), set_full_size(), set_position(), and set_shown_size().
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 100 of file widgets/scrollbar.hpp.
Referenced by get_max_position(), grip_area(), handle_event(), set_full_size(), set_position(), and set_shown_size().
int gui::scrollbar::scroll_rate_ [private] |
Definition at line 101 of file widgets/scrollbar.hpp.
Referenced by handle_event(), scroll_down(), scroll_up(), and set_scroll_rate().
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |