#include <tristate_button.hpp>
Classes | |
struct | error |
Public Types | |
enum | PRESSED_STATE { LEFT, RIGHT, BOTH, NONE } |
Public Member Functions | |
tristate_button (CVideo &video, editor::tristate_palette *palette, std::string button_image="", const bool auto_join=true) | |
virtual | ~tristate_button () |
Default implementation, but defined out-of-line for efficiency reasons. More... | |
void | set_pressed (PRESSED_STATE new_pressed_state) |
bool | pressed () |
PRESSED_STATE | pressed_state () const |
void | set_label (const std::string &val) |
bool | hit (int x, int y) const |
virtual void | enable (bool new_val=true) |
void | release () |
void | set_item_image (const surface &image) |
void | set_item_id (const std::string &id) |
void | draw () |
Public Member Functions inherited from gui::widget | |
SDL_Rect const & | location () const |
virtual void | set_location (SDL_Rect const &rect) |
void | set_location (int x, int y) |
void | set_width (int w) |
void | set_height (int h) |
void | set_measurements (int w, int h) |
int | width () const |
int | height () const |
bool | focus (const SDL_Event *event) |
void | set_focus (bool focus) |
virtual void | hide (bool value=true) |
bool | hidden () const |
bool | enabled () const |
void | set_clip_rect (const SDL_Rect &rect) |
void | set_volatile (bool val=true) |
void | set_dirty (bool dirty=true) |
bool | dirty () const |
const std::string & | id () const |
void | set_id (const std::string &id) |
void | set_help_string (const std::string &str) |
void | set_tooltip_string (const std::string &str) |
virtual void | process_help_string (int mousex, int mousey) |
virtual void | process_tooltip_string (int mousex, int mousey) |
Public Member Functions inherited from events::sdl_handler | |
virtual void | process_event () |
virtual bool | requires_event_focus (const SDL_Event *=nullptr) const |
virtual void | join () |
virtual void | join (context &c) |
virtual void | join_same (sdl_handler *parent) |
virtual void | leave () |
virtual void | join_global () |
virtual void | leave_global () |
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 Member Functions inherited from gui::widget | |
widget (widget const &o) | |
widget (CVideo &video, const bool auto_join=true) | |
virtual | ~widget () |
void | bg_register (SDL_Rect const &rect) |
void | bg_restore () const |
void | bg_restore (SDL_Rect const &rect) const |
void | bg_update () |
void | bg_cancel () |
CVideo & | video () const |
virtual void | update_location (SDL_Rect const &rect) |
const SDL_Rect * | clip_rect () const |
virtual sdl_handler_vector | member_handlers () |
virtual void | handle_window_event (SDL_Event const &event) |
bool | mouse_locked () const |
void | aquire_mouse_lock () |
void | free_mouse_lock () |
Protected Member Functions inherited from events::sdl_handler | |
sdl_handler (const bool auto_join=true) | |
virtual | ~sdl_handler () |
virtual std::vector < sdl_handler * > | handler_members () |
Private Types | |
enum | STATE { UNINIT, NORMAL, ACTIVE, PRESSED_ACTIVE_LEFT, PRESSED_ACTIVE_RIGHT, PRESSED_ACTIVE_BOTH, TOUCHED_RIGHT, TOUCHED_BOTH_RIGHT, TOUCHED_BOTH_LEFT, TOUCHED_LEFT, PRESSED_LEFT, PRESSED_RIGHT, PRESSED_BOTH } |
Private Member Functions | |
void | calculate_size () |
Additional Inherited Members | |
Protected Attributes inherited from gui::widget | |
bool | focus_ |
Definition at line 25 of file tristate_button.hpp.
Enumerator | |
---|---|
LEFT | |
RIGHT | |
BOTH | |
NONE |
Definition at line 36 of file tristate_button.hpp.
|
private |
Enumerator | |
---|---|
UNINIT | |
NORMAL | |
ACTIVE | |
PRESSED_ACTIVE_LEFT | |
PRESSED_ACTIVE_RIGHT | |
PRESSED_ACTIVE_BOTH | |
TOUCHED_RIGHT | |
TOUCHED_BOTH_RIGHT | |
TOUCHED_BOTH_LEFT | |
TOUCHED_LEFT | |
PRESSED_LEFT | |
PRESSED_RIGHT | |
PRESSED_BOTH |
Definition at line 98 of file tristate_button.hpp.
gui::tristate_button::tristate_button | ( | CVideo & | video, |
editor::tristate_palette * | palette, | ||
std::string | button_image = "" , |
||
const bool | auto_join = true |
||
) |
Definition at line 40 of file tristate_button.cpp.
References activeBaseImage_, surface::assign(), base_height_, base_width_, baseImage_, image::get_image(), pressedBothActiveImage_, pressedBothImage_, pressedDownActiveImage_, pressedDownImage_, pressedUpActiveImage_, pressedUpImage_, touchedBaseImage_, touchedBothImage_, touchedDownImage_, and touchedUpImage_.
|
virtual |
Default implementation, but defined out-of-line for efficiency reasons.
Definition at line 99 of file tristate_button.cpp.
|
private |
|
inlinevirtual |
Reimplemented from gui::widget.
Definition at line 69 of file tristate_button.hpp.
References gui::widget::draw().
Referenced by editor::editor_palette< Item >::draw_contents().
|
protectedvirtual |
Reimplemented from gui::widget.
Definition at line 165 of file tristate_button.cpp.
References ACTIVE, activeBaseImage_, surface::assign(), baseImage_, gui::widget::bg_restore(), CVideo::blit_surface(), blit_surface(), font::BUTTON_COLOR, gui::checkbox_horizontal_padding, sdl::create_rect(), font::draw_text(), itemImage_, label_, gui::widget::location(), make_neutral_surface(), NORMAL, surface::null(), PRESSED_ACTIVE_BOTH, PRESSED_ACTIVE_LEFT, PRESSED_ACTIVE_RIGHT, PRESSED_BOTH, PRESSED_LEFT, PRESSED_RIGHT, pressedBothActiveImage_, pressedBothImage_, pressedDownActiveImage_, pressedDownImage_, pressedUpActiveImage_, pressedUpImage_, scale_surface(), state_, textRect_, TOUCHED_BOTH_LEFT, TOUCHED_BOTH_RIGHT, TOUCHED_LEFT, TOUCHED_RIGHT, touchedBaseImage_, touchedBothImage_, touchedDownImage_, touchedUpImage_, UNINIT, update_rect(), and gui::widget::video().
Referenced by release().
|
virtual |
Reimplemented from gui::widget.
Definition at line 155 of file tristate_button.cpp.
References gui::widget::enable(), gui::widget::enabled(), NORMAL, pressed_, and state_.
|
protectedvirtual |
Reimplemented from gui::widget.
Definition at line 408 of file tristate_button.cpp.
References gui::widget::enabled(), gui::widget::handle_event(), gui::widget::hidden(), mouse_down(), gui::widget::mouse_locked(), mouse_motion(), mouse_up(), gui::widget::set_dirty(), and state_.
Definition at line 275 of file tristate_button.cpp.
References gui::widget::location(), and sdl::point_in_rect().
Referenced by mouse_down(), mouse_motion(), and mouse_up().
|
protectedvirtual |
Definition at line 334 of file tristate_button.cpp.
References ACTIVE, hit(), PRESSED_ACTIVE_LEFT, PRESSED_ACTIVE_RIGHT, state_, TOUCHED_BOTH_LEFT, TOUCHED_BOTH_RIGHT, TOUCHED_LEFT, and TOUCHED_RIGHT.
Referenced by handle_event().
|
protectedvirtual |
Definition at line 279 of file tristate_button.cpp.
References ACTIVE, hit(), NORMAL, PRESSED_ACTIVE_BOTH, PRESSED_ACTIVE_LEFT, PRESSED_ACTIVE_RIGHT, PRESSED_BOTH, PRESSED_LEFT, PRESSED_RIGHT, state_, TOUCHED_BOTH_LEFT, TOUCHED_BOTH_RIGHT, TOUCHED_LEFT, TOUCHED_RIGHT, and UNINIT.
Referenced by handle_event().
|
protectedvirtual |
Definition at line 360 of file tristate_button.cpp.
References game_config::sounds::checkbox_release, hit(), item_id_, palette_, sound::play_UI_sound(), pressed_, PRESSED_ACTIVE_BOTH, PRESSED_ACTIVE_LEFT, PRESSED_ACTIVE_RIGHT, editor::tristate_palette::select_bg_item(), editor::tristate_palette::select_fg_item(), state_, TOUCHED_BOTH_LEFT, TOUCHED_BOTH_RIGHT, TOUCHED_LEFT, and TOUCHED_RIGHT.
Referenced by handle_event().
bool gui::tristate_button::pressed | ( | ) |
Definition at line 437 of file tristate_button.cpp.
References pressed_.
tristate_button::PRESSED_STATE gui::tristate_button::pressed_state | ( | ) | const |
Definition at line 136 of file tristate_button.cpp.
References BOTH, LEFT, NONE, PRESSED_ACTIVE_BOTH, PRESSED_ACTIVE_LEFT, PRESSED_ACTIVE_RIGHT, PRESSED_BOTH, PRESSED_LEFT, PRESSED_RIGHT, RIGHT, state_, TOUCHED_BOTH_LEFT, and TOUCHED_BOTH_RIGHT.
void gui::tristate_button::release | ( | ) |
Definition at line 355 of file tristate_button.cpp.
References draw_contents(), NORMAL, and state_.
|
inline |
Definition at line 65 of file tristate_button.hpp.
References gui::widget::id(), and item_id_.
Referenced by editor::editor_palette< Item >::draw_contents().
Definition at line 59 of file tristate_button.hpp.
References itemImage_.
Referenced by editor::editor_palette< Item >::draw_contents().
void gui::tristate_button::set_label | ( | const std::string & | val | ) |
void gui::tristate_button::set_pressed | ( | PRESSED_STATE | new_pressed_state | ) |
Definition at line 101 of file tristate_button.cpp.
References BOTH, LEFT, NONE, NORMAL, PRESSED_ACTIVE_BOTH, PRESSED_ACTIVE_LEFT, PRESSED_ACTIVE_RIGHT, PRESSED_BOTH, PRESSED_LEFT, PRESSED_RIGHT, RIGHT, gui::widget::set_dirty(), and state_.
Referenced by editor::editor_palette< Item >::draw_contents().
|
private |
Definition at line 88 of file tristate_button.hpp.
Referenced by draw_contents(), and tristate_button().
|
private |
Definition at line 110 of file tristate_button.hpp.
Referenced by tristate_button().
|
private |
Definition at line 110 of file tristate_button.hpp.
Referenced by tristate_button().
|
private |
Definition at line 88 of file tristate_button.hpp.
Referenced by draw_contents(), and tristate_button().
|
private |
Definition at line 114 of file tristate_button.hpp.
Referenced by mouse_up(), and set_item_id().
|
private |
Definition at line 88 of file tristate_button.hpp.
Referenced by draw_contents(), and set_item_image().
|
private |
Definition at line 86 of file tristate_button.hpp.
Referenced by draw_contents().
|
private |
Definition at line 112 of file tristate_button.hpp.
Referenced by mouse_up().
|
private |
Definition at line 108 of file tristate_button.hpp.
Referenced by enable(), mouse_up(), and pressed().
|
private |
Definition at line 88 of file tristate_button.hpp.
Referenced by draw_contents(), and tristate_button().
|
private |
Definition at line 88 of file tristate_button.hpp.
Referenced by draw_contents(), and tristate_button().
|
private |
Definition at line 88 of file tristate_button.hpp.
Referenced by draw_contents(), and tristate_button().
|
private |
Definition at line 88 of file tristate_button.hpp.
Referenced by draw_contents(), and tristate_button().
|
private |
Definition at line 88 of file tristate_button.hpp.
Referenced by draw_contents(), and tristate_button().
|
private |
Definition at line 88 of file tristate_button.hpp.
Referenced by draw_contents(), and tristate_button().
|
private |
Definition at line 106 of file tristate_button.hpp.
Referenced by draw_contents(), enable(), handle_event(), mouse_down(), mouse_motion(), mouse_up(), pressed_state(), release(), and set_pressed().
|
private |
Definition at line 96 of file tristate_button.hpp.
Referenced by draw_contents().
|
private |
Definition at line 88 of file tristate_button.hpp.
Referenced by draw_contents(), and tristate_button().
|
private |
Definition at line 88 of file tristate_button.hpp.
Referenced by draw_contents(), and tristate_button().
|
private |
Definition at line 88 of file tristate_button.hpp.
Referenced by draw_contents(), and tristate_button().
|
private |
Definition at line 88 of file tristate_button.hpp.
Referenced by draw_contents(), and tristate_button().