#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 |
bool | hit (int x, int y) const |
virtual void | enable (bool new_val=true) override |
void | release () |
void | set_item_image (const surface &image) |
void | set_item_id (const std::string &id) |
void | draw () override |
![]() | |
const SDL_Rect & | location () const |
virtual void | set_location (const SDL_Rect &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) |
![]() | |
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 () |
virtual bool | has_joined () |
virtual bool | has_joined_global () |
sdl_handler & | operator= (sdl_handler &&)=delete |
Moving would require two instances' context membership to be handled, it's simpler to delete these and require the two instances to be separately constructed / destructed. More... | |
sdl_handler (sdl_handler &&)=delete | |
Protected Member Functions | |
virtual void | handle_event (const SDL_Event &event) override |
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 () override |
![]() | |
widget (CVideo &video, const bool auto_join=true) | |
virtual | ~widget () |
void | bg_register (const SDL_Rect &rect) |
void | bg_restore () const |
void | bg_restore (const SDL_Rect &rect) const |
void | bg_update () |
void | bg_cancel () |
CVideo & | video () const |
virtual void | update_location (const SDL_Rect &rect) |
const SDL_Rect * | clip_rect () const |
virtual sdl_handler_vector | member_handlers () |
virtual void | handle_window_event (const SDL_Event &event) |
bool | mouse_locked () const |
void | aquire_mouse_lock () |
void | free_mouse_lock () |
![]() | |
sdl_handler (const bool auto_join=true) | |
sdl_handler (const sdl_handler &) | |
sdl_handler & | operator= (const sdl_handler &) |
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 | |
![]() | |
bool | focus_ |
Definition at line 26 of file tristate_button.hpp.
Enumerator | |
---|---|
LEFT | |
RIGHT | |
BOTH | |
NONE |
Definition at line 37 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 95 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 32 of file tristate_button.cpp.
References activeBaseImage_, 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 91 of file tristate_button.cpp.
|
private |
Referenced by draw().
|
inlineoverridevirtual |
Reimplemented from gui::widget.
Definition at line 68 of file tristate_button.hpp.
References calculate_size(), gui::widget::draw(), draw_contents(), handle_event(), mouse_down(), mouse_motion(), and mouse_up().
Referenced by editor::editor_palette< overlay >::draw_contents().
|
overrideprotectedvirtual |
Reimplemented from gui::widget.
Definition at line 157 of file tristate_button.cpp.
References ACTIVE, activeBaseImage_, baseImage_, gui::widget::bg_restore(), CVideo::blit_surface(), surface::clone(), itemImage_, gui::widget::location(), NORMAL, PRESSED_ACTIVE_BOTH, PRESSED_ACTIVE_LEFT, PRESSED_ACTIVE_RIGHT, PRESSED_BOTH, PRESSED_LEFT, PRESSED_RIGHT, pressedBothActiveImage_, pressedBothImage_, pressedDownActiveImage_, pressedDownImage_, pressedUpActiveImage_, pressedUpImage_, scale_surface(), sdl_blit(), state_, TOUCHED_BOTH_LEFT, TOUCHED_BOTH_RIGHT, TOUCHED_LEFT, TOUCHED_RIGHT, touchedBaseImage_, touchedBothImage_, touchedDownImage_, touchedUpImage_, UNINIT, and gui::widget::video().
|
overridevirtual |
Reimplemented from gui::widget.
Definition at line 147 of file tristate_button.cpp.
References gui::widget::enable(), gui::widget::enabled(), NORMAL, pressed_, and state_.
|
overrideprotectedvirtual |
Reimplemented from gui::widget.
Definition at line 371 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_.
Referenced by draw().
bool gui::tristate_button::hit | ( | int | x, |
int | y | ||
) | const |
Definition at line 238 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 297 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 draw(), and handle_event().
|
protectedvirtual |
Definition at line 242 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 draw(), and handle_event().
|
protectedvirtual |
Definition at line 323 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 draw(), and handle_event().
bool gui::tristate_button::pressed | ( | ) |
Definition at line 400 of file tristate_button.cpp.
References pressed_.
tristate_button::PRESSED_STATE gui::tristate_button::pressed_state | ( | ) | const |
Definition at line 128 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 318 of file tristate_button.cpp.
References draw_contents(), NORMAL, and state_.
|
inline |
Definition at line 64 of file tristate_button.hpp.
References gui::widget::id(), and item_id_.
Referenced by editor::editor_palette< overlay >::draw_contents().
|
inline |
Definition at line 58 of file tristate_button.hpp.
References itemImage_.
Referenced by editor::editor_palette< overlay >::draw_contents().
void gui::tristate_button::set_pressed | ( | PRESSED_STATE | new_pressed_state | ) |
Definition at line 93 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< overlay >::draw_contents().
|
private |
Definition at line 85 of file tristate_button.hpp.
Referenced by draw_contents(), and tristate_button().
|
private |
Definition at line 107 of file tristate_button.hpp.
Referenced by tristate_button().
|
private |
Definition at line 107 of file tristate_button.hpp.
Referenced by tristate_button().
|
private |
Definition at line 85 of file tristate_button.hpp.
Referenced by draw_contents(), and tristate_button().
|
private |
Definition at line 111 of file tristate_button.hpp.
Referenced by mouse_up(), and set_item_id().
|
private |
Definition at line 85 of file tristate_button.hpp.
Referenced by draw_contents(), and set_item_image().
|
private |
Definition at line 109 of file tristate_button.hpp.
Referenced by mouse_up().
|
private |
Definition at line 105 of file tristate_button.hpp.
Referenced by enable(), mouse_up(), and pressed().
|
private |
Definition at line 85 of file tristate_button.hpp.
Referenced by draw_contents(), and tristate_button().
|
private |
Definition at line 85 of file tristate_button.hpp.
Referenced by draw_contents(), and tristate_button().
|
private |
Definition at line 85 of file tristate_button.hpp.
Referenced by draw_contents(), and tristate_button().
|
private |
Definition at line 85 of file tristate_button.hpp.
Referenced by draw_contents(), and tristate_button().
|
private |
Definition at line 85 of file tristate_button.hpp.
Referenced by draw_contents(), and tristate_button().
|
private |
Definition at line 85 of file tristate_button.hpp.
Referenced by draw_contents(), and tristate_button().
|
private |
Definition at line 103 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 93 of file tristate_button.hpp.
|
private |
Definition at line 85 of file tristate_button.hpp.
Referenced by draw_contents(), and tristate_button().
|
private |
Definition at line 85 of file tristate_button.hpp.
Referenced by draw_contents(), and tristate_button().
|
private |
Definition at line 85 of file tristate_button.hpp.
Referenced by draw_contents(), and tristate_button().
|
private |
Definition at line 85 of file tristate_button.hpp.
Referenced by draw_contents(), and tristate_button().