Handling of system events. More...
Classes | |
class | chat_command_handler |
class | chat_handler |
class | cmd_arg_parser |
struct | command_disabler |
class | console_handler |
struct | context |
struct | event_context |
class | generic_event |
class | map_command_handler |
class | menu_handler |
class | mouse_handler |
class | mouse_handler_base |
class | observer |
struct | pump_info |
class | pump_monitor |
struct | save_id_matches |
class | sdl_handler |
Functions | |
void | focus_handler (const sdl_handler *ptr) |
bool | has_focus (const sdl_handler *hand, const SDL_Event *event) |
static bool | remove_on_resize (const SDL_Event &a) |
void | pump () |
void | raise_process_event () |
void | raise_resize_event () |
void | raise_draw_event () |
void | raise_draw_all_event () |
void | raise_volatile_draw_event () |
void | raise_volatile_draw_all_event () |
void | raise_volatile_undraw_event () |
void | raise_help_string_event (int mousex, int mousey) |
bool | is_input (const SDL_Event &event) |
Is the event an input event? More... | |
void | discard_input () |
Discards all input events. More... | |
void | peek_for_resize () |
void | cycle_focus () |
static bool | command_active () |
Variables | |
std::deque< context > | event_contexts |
context | global_context |
std::vector< pump_monitor * > | pump_monitors |
const Uint32 | resize_timeout = 100 |
SDL_Event | last_resize_event |
bool | last_resize_event_used = true |
static const boost::thread::id | main_thread = boost::this_thread::get_id() |
int | commands_disabled = 0 |
Handling of system events.
System events include mouse and key events, and other events which are not domain specific. The program maintains a stack of event_context objects, the top of the stack being the active event_context.
When an object of a type inheriting from handler is instantiated, it will be associated with the active event_context (unless auto_join has been set false, in which case it can manually be instructed to join a later context). As long as its event_context remains active, and only then, it will receive all system events.
|
static |
Definition at line 42 of file mouse_handler_base.cpp.
Referenced by events::mouse_handler_base::is_left_click(), and events::mouse_handler_base::is_right_click().
void events::cycle_focus | ( | ) |
void events::discard_input | ( | ) |
Discards all input events.
Definition at line 657 of file events.cpp.
References INPUT_MAX, and INPUT_MIN.
Referenced by game_launcher::play_multiplayer(), and game_launcher::play_multiplayer_commandline().
void events::focus_handler | ( | const sdl_handler * | ptr | ) |
Definition at line 262 of file events.cpp.
Referenced by gui::textbox::handle_event(), has_focus(), and gui::widget::set_focus().
bool events::has_focus | ( | const sdl_handler * | hand, |
const SDL_Event * | event | ||
) |
Definition at line 269 of file events.cpp.
References focus_handler(), i, and events::sdl_handler::requires_event_focus().
Referenced by gui::widget::focus().
bool events::is_input | ( | const SDL_Event & | event | ) |
Is the event an input event?
Definition at line 652 of file events.cpp.
References INPUT_MAX, and INPUT_MIN.
Referenced by pump().
void events::peek_for_resize | ( | ) |
Definition at line 662 of file events.cpp.
References CVideo::get_singleton(), i, and CVideo::update_framebuffer().
Referenced by pump(), and hotkey::show_binding_dialog().
void events::pump | ( | ) |
Definition at line 336 of file events.cpp.
References DOUBLE_CLICK_EVENT, DRAW_ALL_EVENT, hotkey::get_id(), desktop::clipboard::handle_system_event(), windows_tray_notification::handle_system_event(), events::context::handlers, i, lg::info(), is_input(), last_resize_event, last_resize_event_used, peek_for_resize(), quit_confirmation::quit_to_desktop(), raise_help_string_event(), remove_on_resize(), events::pump_info::resize_dimensions, resize_timeout, cursor::set_focus(), and events::pump_info::ticks().
Referenced by dialogs::animate_unit_advancement(), storyscreen::part_ui::handle_interface(), actions::place_recruit(), controller_base::play_slice(), mp::run_lobby_loop(), display::scroll_to_xy(), gui2::twindow::show(), gui::dialog::show(), about::show_about(), help::show_help(), gui2::twindow::show_non_modal(), teleport_unit_between(), the_end(), and default_map_generator::user_config().
void events::raise_draw_all_event | ( | ) |
Definition at line 579 of file events.cpp.
References i.
void events::raise_draw_event | ( | ) |
Definition at line 565 of file events.cpp.
Referenced by gui::dialog::draw_contents(), editor::editor_controller::editor_controller(), storyscreen::part_ui::handle_interface(), playsingle_controller::init_gui(), controller_base::play_slice(), play_controller::play_turn(), gui::dialog::process(), storyscreen::part_ui::render_floating_images(), mp::run_lobby_loop(), about::show_about(), help::show_help(), play_controller::start_game(), the_end(), replay_controller::update_gui(), and default_map_generator::user_config().
Definition at line 627 of file events.cpp.
Referenced by pump().
void events::raise_process_event | ( | ) |
Definition at line 539 of file events.cpp.
Referenced by storyscreen::part_ui::handle_interface(), controller_base::play_slice(), gui::dialog::process(), mp::run_lobby_loop(), about::show_about(), help::show_help(), the_end(), and default_map_generator::user_config().
void events::raise_resize_event | ( | ) |
Definition at line 553 of file events.cpp.
References CVideo::get_singleton(), CVideo::getx(), and CVideo::gety().
Referenced by gui2::tpreferences::handle_res_select().
void events::raise_volatile_draw_all_event | ( | ) |
Definition at line 603 of file events.cpp.
References i.
void events::raise_volatile_draw_event | ( | ) |
Definition at line 589 of file events.cpp.
Referenced by display::flip().
void events::raise_volatile_undraw_event | ( | ) |
Definition at line 613 of file events.cpp.
Referenced by display::flip().
|
static |
Definition at line 317 of file events.cpp.
References DRAW_ALL_EVENT, DRAW_EVENT, and SHOW_HELPTIP_EVENT.
Referenced by pump().
int events::commands_disabled = 0 |
Definition at line 40 of file mouse_handler_base.cpp.
Referenced by playsingle_controller::hotkey_handler::can_execute_command(), replay_controller::can_execute_command(), play_controller::hotkey_handler::can_execute_command(), play_controller::can_redo(), play_controller::can_undo(), play_controller::can_use_synced_wml_menu(), events::command_disabler::command_disabler(), events::console_handler::do_unit(), events::mouse_handler::move_action(), events::mouse_handler::select_hex(), and events::command_disabler::~command_disabler().
std::deque<context> events::event_contexts |
Definition at line 122 of file events.cpp.
context events::global_context |
Definition at line 126 of file events.cpp.
SDL_Event events::last_resize_event |
Definition at line 314 of file events.cpp.
Referenced by pump().
bool events::last_resize_event_used = true |
Definition at line 315 of file events.cpp.
Referenced by pump().
|
static |
Definition at line 335 of file events.cpp.
std::vector<pump_monitor*> events::pump_monitors |
Definition at line 128 of file events.cpp.
const Uint32 events::resize_timeout = 100 |
Definition at line 313 of file events.cpp.
Referenced by pump().