Scrollbar. More...
#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_ |
Scrollbar.
Definition at line 29 of file scrollbar.hpp.
enum gui::scrollbar::STATE [private] |
Definition at line 95 of file scrollbar.hpp.
| gui::scrollbar::scrollbar | ( | CVideo & | video | ) |
Create a scrollbar.
Definition at line 46 of file scrollbar.cpp.
References image::get_image(), minimum_grip_height_, and gui::widget::set_width().

| 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().


| void gui::scrollbar::draw_contents | ( | ) | [protected, virtual] |
Reimplemented from gui::widget.
Definition at line 226 of file scrollbar.cpp.
References surface::assign(), CVideo::blit_surface(), image::get_image(), CVideo::getSurface(), grip_area(), groove_area(), groove_scaled_, mid_scaled_, NORMAL, surface::null(), scale_surface(), resources::screen, state_, update_rect(), and gui::widget::video().

| 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().

| 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 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().

| 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().


| 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().


| void gui::scrollbar::handle_event | ( | const SDL_Event & | event | ) | [protected, virtual] |
Reimplemented from gui::widget.
Definition at line 293 of file scrollbar.cpp.
References ACTIVE, surface::assign(), DRAGGED, full_height_, grip_area(), grip_height_, groove_area(), gui::widget::hidden(), mid_scaled_, gui::widget::mouse_locked(), mousey_on_grip_, move_position(), NORMAL, point_in_rect(), scroll_rate_, SDL_BUTTON_WHEELDOWN, SDL_BUTTON_WHEELUP, gui::widget::set_dirty(), and state_.

| 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().


| 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().


| 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().


| 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_.

| 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().


| 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().


| 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().


| 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().


| 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().

| 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().


| 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_.

button gui::scrollbar::downarrow_ [private] |
Definition at line 93 of file scrollbar.hpp.
Referenced by groove_area(), handler_members(), hide(), is_valid_height(), process_event(), set_full_size(), set_position(), and update_location().
unsigned int gui::scrollbar::full_height_ [private] |
Definition at line 100 of file scrollbar.hpp.
Referenced by get_max_position(), grip_area(), handle_event(), set_full_size(), set_position(), and set_shown_size().
unsigned int gui::scrollbar::grip_height_ [private] |
Definition at line 100 of file 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::grip_position_ [private] |
Definition at line 100 of file scrollbar.hpp.
Referenced by adjust_position(), get_position(), grip_area(), move_position(), set_full_size(), set_position(), and set_shown_size().
surface gui::scrollbar::groove_scaled_ [private] |
Definition at line 91 of file scrollbar.hpp.
Referenced by draw_contents().
surface gui::scrollbar::mid_scaled_ [private] |
Definition at line 91 of file scrollbar.hpp.
Referenced by draw_contents(), and handle_event().
int gui::scrollbar::minimum_grip_height_ [private] |
Definition at line 98 of file scrollbar.hpp.
Referenced by grip_area(), and scrollbar().
int gui::scrollbar::mousey_on_grip_ [private] |
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.
int gui::scrollbar::scroll_rate_ [private] |
Definition at line 101 of file scrollbar.hpp.
Referenced by handle_event(), scroll_down(), scroll_up(), and set_scroll_rate().
STATE gui::scrollbar::state_ [private] |
Reimplemented from gui::widget.
Definition at line 96 of file scrollbar.hpp.
Referenced by draw_contents(), and handle_event().
button gui::scrollbar::uparrow_ [private] |
Definition at line 93 of file scrollbar.hpp.
Referenced by groove_area(), handler_members(), hide(), is_valid_height(), process_event(), set_position(), and update_location().
| Generated by doxygen 1.7.1 on Thu May 24 2012 01:21:33 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |