#include <button.hpp>
Public Types | |
enum | TYPE { TYPE_PRESS, TYPE_CHECK, TYPE_TURBO, TYPE_IMAGE } |
enum | SPACE_CONSUMPTION { DEFAULT_SPACE, MINIMUM_SPACE } |
Public Member Functions | |
button (CVideo &video, const std::string &label, TYPE type=TYPE_PRESS, std::string button_image="", SPACE_CONSUMPTION spacing=DEFAULT_SPACE, const bool auto_join=true) | |
virtual | ~button () |
void | set_check (bool check) |
bool | checked () const |
void | set_label (const std::string &val) |
bool | pressed () |
bool | hit (int x, int y) const |
virtual void | enable (bool new_val=true) |
void | release () |
Protected Member Functions | |
virtual void | handle_event (const SDL_Event &event) |
virtual void | mouse_motion (const SDL_MouseMotionEvent &event) |
virtual void | mouse_down (const SDL_MouseButtonEvent &event) |
virtual void | mouse_up (const SDL_MouseButtonEvent &event) |
virtual void | draw_contents () |
Protected Attributes | |
TYPE | type_ |
Private Types | |
enum | STATE { UNINIT, NORMAL, ACTIVE, PRESSED, PRESSED_ACTIVE } |
Private Member Functions | |
void | calculate_size () |
Private Attributes | |
std::string | label_ |
surface | image_ |
surface | pressedImage_ |
surface | activeImage_ |
surface | pressedActiveImage_ |
SDL_Rect | textRect_ |
bool | button_ |
STATE | state_ |
bool | pressed_ |
SPACE_CONSUMPTION | spacing_ |
int | base_height_ |
int | base_width_ |
Classes | |
struct | error |
Definition at line 29 of file widgets/button.hpp.
enum gui::button::TYPE |
Definition at line 34 of file widgets/button.hpp.
enum gui::button::STATE [private] |
Definition at line 72 of file widgets/button.hpp.
gui::button::button | ( | CVideo & | video, | |
const std::string & | label, | |||
button::TYPE | type = TYPE_PRESS , |
|||
std::string | button_image = "" , |
|||
SPACE_CONSUMPTION | spacing = DEFAULT_SPACE , |
|||
const bool | auto_join = true | |||
) |
Definition at line 38 of file widgets/button.cpp.
References activeImage_, surface::assign(), base_height_, base_width_, calculate_size(), ERR_DP, image::get_image(), image_, gui::widget::location(), surface::null(), pressedActiveImage_, pressedImage_, scale_surface(), set_label(), type_, TYPE_CHECK, TYPE_IMAGE, and TYPE_PRESS.
virtual gui::button::~button | ( | ) | [inline, virtual] |
Definition at line 42 of file widgets/button.hpp.
void gui::button::set_check | ( | bool | check | ) |
Definition at line 149 of file widgets/button.cpp.
References NORMAL, PRESSED, gui::widget::set_dirty(), state_, type_, and TYPE_CHECK.
Referenced by gui::dialog::add_option(), mp::create::create(), map_editor::terrain_palette::draw(), mp::lobby::lobby(), mp::create::process_event(), and default_map_generator::user_config().
bool gui::button::checked | ( | ) | const |
Definition at line 160 of file widgets/button.cpp.
References PRESSED, PRESSED_ACTIVE, and state_.
Referenced by mp::create::get_parameters(), mp::lobby::process_event(), mp::create::process_event(), and default_map_generator::user_config().
void gui::button::set_label | ( | const std::string & | val | ) |
Definition at line 240 of file widgets/button.cpp.
References calculate_size(), COLUMN_SEPARATOR, label_, gui::not_image(), gui::widget::set_dirty(), and utils::split().
Referenced by button(), and gui::combo::set_selected_internal().
bool gui::button::pressed | ( | ) |
Definition at line 339 of file widgets/button.cpp.
References PRESSED, pressed_, PRESSED_ACTIVE, state_, type_, and TYPE_TURBO.
Referenced by map_editor::terrain_palette::draw(), gui::scrollbar::process_event(), mp::wait::process_event(), mp::lobby::process_event(), mp::create::process_event(), mp::connect::process_event(), help::help_browser::process_event(), dialogs::unit_types_preview_pane::process_event(), dialogs::units_list_preview_pane::process_event(), gui::combo::process_event(), about::show_about(), show_intro_part(), show_intro_part_helper(), gui::show_title(), and default_map_generator::user_config().
bool gui::button::hit | ( | int | x, | |
int | y | |||
) | const |
Definition at line 233 of file widgets/button.cpp.
References gui::widget::location(), and point_in_rect().
Referenced by mouse_down(), mouse_motion(), and mouse_up().
void gui::button::enable | ( | bool | new_val = true |
) | [virtual] |
Reimplemented from gui::widget.
Definition at line 165 of file widgets/button.cpp.
References gui::widget::enable(), gui::widget::enabled(), NORMAL, pressed_, state_, type_, and TYPE_CHECK.
Referenced by mp::lobby::gamelist_updated(), playmp_controller::handle_generic_event(), mp::lobby::process_event(), mp::create::process_event(), turn_info::process_network_data(), playmp_controller::set_end_scenario_button(), gui::scrollbar::set_full_size(), gui::scrollbar::set_position(), mp::connect::side::side(), leader_list_manager::update_gender_list(), leader_list_manager::update_leader_list(), and mp::connect::update_playerlist_state().
void gui::button::release | ( | ) |
Definition at line 283 of file widgets/button.cpp.
References draw_contents(), NORMAL, and state_.
Referenced by replay_controller::play_replay(), replay_controller::replay_next_side(), replay_controller::replay_next_turn(), replay_controller::reset_replay(), and replay_controller::stop_replay().
void gui::button::handle_event | ( | const SDL_Event & | event | ) | [protected, virtual] |
Reimplemented from gui::widget.
Definition at line 314 of file widgets/button.cpp.
References gui::widget::enabled(), gui::widget::hidden(), mouse_down(), mouse_motion(), mouse_up(), gui::widget::set_dirty(), and state_.
void gui::button::mouse_motion | ( | const SDL_MouseMotionEvent & | event | ) | [protected, virtual] |
Definition at line 258 of file widgets/button.cpp.
References ACTIVE, hit(), NORMAL, PRESSED, PRESSED_ACTIVE, state_, type_, TYPE_CHECK, and TYPE_IMAGE.
Referenced by handle_event().
void gui::button::mouse_down | ( | const SDL_MouseButtonEvent & | event | ) | [protected, virtual] |
Definition at line 275 of file widgets/button.cpp.
References game_config::sounds::button_press, hit(), sound::play_UI_sound(), PRESSED, state_, type_, and TYPE_CHECK.
Referenced by handle_event().
void gui::button::mouse_up | ( | const SDL_MouseButtonEvent & | event | ) | [protected, virtual] |
Definition at line 288 of file widgets/button.cpp.
References ACTIVE, game_config::sounds::checkbox_release, hit(), sound::play_UI_sound(), PRESSED, pressed_, PRESSED_ACTIVE, state_, type_, TYPE_CHECK, TYPE_IMAGE, TYPE_PRESS, and TYPE_TURBO.
Referenced by handle_event().
void gui::button::draw_contents | ( | ) | [protected, virtual] |
Reimplemented from gui::widget.
Definition at line 178 of file widgets/button.cpp.
References ACTIVE, activeImage_, blend_surface(), CVideo::blit_surface(), font::BUTTON_COLOUR, gui::checkbox_horizontal_padding, font::draw_text(), gui::widget::enabled(), gui::font_size, font::GRAY_COLOUR, greyscale_image(), image_, label_, loc, gui::widget::location(), PRESSED, PRESSED_ACTIVE, pressedActiveImage_, pressedImage_, state_, textRect_, type_, TYPE_CHECK, TYPE_IMAGE, TYPE_PRESS, update_rect(), and gui::widget::video().
Referenced by release().
void gui::button::calculate_size | ( | ) | [private] |
Definition at line 98 of file widgets/button.cpp.
References base_height_, base_width_, font::BUTTON_COLOUR, gui::checkbox_horizontal_padding, font::draw_text(), gui::font_size, gui::horizontal_padding, image_, label_, loc, gui::widget::location(), font::make_text_ellipsis(), maximum(), MINIMUM_SPACE, screen_area(), gui::widget::set_height(), gui::widget::set_location(), gui::widget::set_width(), spacing_, textRect_, type_, TYPE_IMAGE, TYPE_PRESS, and gui::vertical_padding.
Referenced by button(), and set_label().
TYPE gui::button::type_ [protected] |
Definition at line 60 of file widgets/button.hpp.
Referenced by button(), calculate_size(), draw_contents(), enable(), gui::dialog_button::is_option(), mouse_down(), mouse_motion(), mouse_up(), pressed(), and set_check().
std::string gui::button::label_ [private] |
Definition at line 66 of file widgets/button.hpp.
Referenced by calculate_size(), draw_contents(), and set_label().
surface gui::button::image_ [private] |
Definition at line 67 of file widgets/button.hpp.
Referenced by button(), calculate_size(), and draw_contents().
surface gui::button::pressedImage_ [private] |
surface gui::button::activeImage_ [private] |
surface gui::button::pressedActiveImage_ [private] |
SDL_Rect gui::button::textRect_ [private] |
Definition at line 68 of file widgets/button.hpp.
Referenced by calculate_size(), and draw_contents().
bool gui::button::button_ [private] |
Definition at line 70 of file widgets/button.hpp.
STATE gui::button::state_ [private] |
Reimplemented from gui::widget.
Definition at line 73 of file widgets/button.hpp.
Referenced by checked(), draw_contents(), enable(), handle_event(), mouse_down(), mouse_motion(), mouse_up(), pressed(), release(), and set_check().
bool gui::button::pressed_ [private] |
Definition at line 75 of file widgets/button.hpp.
Referenced by enable(), mouse_up(), and pressed().
SPACE_CONSUMPTION gui::button::spacing_ [private] |
int gui::button::base_height_ [private] |
int gui::button::base_width_ [private] |
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |