gui2::tevent_handler Class Reference

#include <event_handler.hpp>

Inheritance diagram for gui2::tevent_handler:

Inheritance graph
[legend]
Collaboration diagram for gui2::tevent_handler:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 tevent_handler ()
 At construction we should get the state and from that moment on we keep track of the changes ourselves, not yet sure what happens when an input blocker is used.
virtual ~tevent_handler ()
void process_events ()
void handle_event (const SDL_Event &event)
 Implement events::handler::handle_event().
virtual twindowget_window ()=0
virtual const twindowget_window () const =0
virtual twidgetfind_widget (const tpoint &coordinate, const bool must_be_active)=0
 See twidget::find_widget() for the description.
virtual const twidgetfind_widget (const tpoint &coordinate, const bool must_be_active) const =0
 The const version of find_widget.
void mouse_capture (const bool capture=true)
void keyboard_capture (twidget *widget)
tpoint get_mouse () const
void show_tooltip (const t_string &tooltip, const unsigned timeout)
 We impement the handling of the tip, but call the do functions which are virtual.
void remove_tooltip ()
void show_help_popup (const t_string &help_popup, const unsigned timeout)
void remove_help_popup ()

Private Member Functions

void mouse_enter (const SDL_Event &event, twidget *mouse_over)
void mouse_move (const SDL_Event &event, twidget *mouse_over)
void mouse_hover (const SDL_Event &event, twidget *mouse_over)
void mouse_leave (const SDL_Event &event, twidget *mouse_over)
void mouse_button_down (const SDL_Event &event, twidget *mouse_over, tmouse_button &button)
void mouse_button_up (const SDL_Event &event, twidget *mouse_over, tmouse_button &button)
void mouse_click (twidget *widget, tmouse_button &button)
void set_hover (const bool test_on_widget=false)
void key_down (const SDL_Event &event)
virtual void do_show_tooltip (const tpoint &location, const t_string &tooltip)=0
virtual void do_remove_tooltip ()=0
virtual void do_show_help_popup (const tpoint &location, const t_string &help_popup)=0
virtual void do_remove_help_popup ()=0

Private Attributes

events::event_context event_context_
 we create a new event context so we're always modal.
int mouse_x_
int mouse_y_
 The current mouse x.
tmouse_button left_
 The current mouse y.
tmouse_button middle_
tmouse_button right_
bool hover_pending_
unsigned hover_id_
 Is there a hover event pending?
SDL_Rect hover_box_
 Id of the pending hover event.
bool had_hover_
 The area the mouse can move in, moving outside invalidates the pending hover event.
twidgettooltip_
 A widget only gets one hover event per enter cycle.
twidgethelp_popup_
twidgetmouse_focus_
bool mouse_captured_
twidgetkeyboard_focus_

Classes

struct  tmouse_button


Detailed Description

Definition at line 33 of file event_handler.hpp.


Constructor & Destructor Documentation

gui2::tevent_handler::tevent_handler (  ) 

At construction we should get the state and from that moment on we keep track of the changes ourselves, not yet sure what happens when an input blocker is used.

Definition at line 79 of file event_handler.cpp.

References events::handler::join().

virtual gui2::tevent_handler::~tevent_handler (  )  [inline, virtual]

Definition at line 38 of file event_handler.hpp.

References events::handler::leave().


Member Function Documentation

void gui2::tevent_handler::process_events (  )  [inline]

Definition at line 40 of file event_handler.hpp.

References events::pump().

Referenced by gui2::twindow::show().

void gui2::tevent_handler::handle_event ( const SDL_Event &  event  )  [virtual]

virtual twindow& gui2::tevent_handler::get_window (  )  [pure virtual]

virtual const twindow& gui2::tevent_handler::get_window (  )  const [pure virtual]

Implemented in gui2::twindow.

virtual twidget* gui2::tevent_handler::find_widget ( const tpoint coordinate,
const bool  must_be_active 
) [pure virtual]

See twidget::find_widget() for the description.

Implemented in gui2::twindow.

Referenced by handle_event().

virtual const twidget* gui2::tevent_handler::find_widget ( const tpoint coordinate,
const bool  must_be_active 
) const [pure virtual]

The const version of find_widget.

Implemented in gui2::twindow.

void gui2::tevent_handler::mouse_capture ( const bool  capture = true  ) 

Definition at line 232 of file event_handler.cpp.

References mouse_captured_, and mouse_focus_.

void gui2::tevent_handler::keyboard_capture ( twidget widget  )  [inline]

Definition at line 57 of file event_handler.hpp.

References keyboard_focus_.

Referenced by gui2::tmp_method_selection::show(), and gui2::taddon_connect::show().

tpoint gui2::tevent_handler::get_mouse (  )  const

Definition at line 238 of file event_handler.cpp.

References gui2::twindow::client_position(), get_window(), mouse_x_, and mouse_y_.

void gui2::tevent_handler::show_tooltip ( const t_string tooltip,
const unsigned  timeout 
)

We impement the handling of the tip, but call the do functions which are virtual.

Definition at line 243 of file event_handler.cpp.

References DBG_G_E, do_show_tooltip(), get_window(), help_popup_, mouse_focus_, mouse_x_, mouse_y_, gui2::popup_callback(), remove_help_popup(), and tooltip_.

void gui2::tevent_handler::remove_tooltip (  ) 

Definition at line 262 of file event_handler.cpp.

References do_remove_tooltip(), and tooltip_.

Referenced by handle_event(), mouse_leave(), and show_help_popup().

void gui2::tevent_handler::show_help_popup ( const t_string help_popup,
const unsigned  timeout 
)

void gui2::tevent_handler::remove_help_popup (  ) 

Definition at line 299 of file event_handler.cpp.

References do_remove_help_popup(), and help_popup_.

Referenced by handle_event(), mouse_leave(), and show_tooltip().

void gui2::tevent_handler::mouse_enter ( const SDL_Event &  event,
twidget mouse_over 
) [private]

void gui2::tevent_handler::mouse_move ( const SDL_Event &  event,
twidget mouse_over 
) [private]

void gui2::tevent_handler::mouse_hover ( const SDL_Event &  event,
twidget mouse_over 
) [private]

void gui2::tevent_handler::mouse_leave ( const SDL_Event &  event,
twidget mouse_over 
) [private]

void gui2::tevent_handler::mouse_button_down ( const SDL_Event &  event,
twidget mouse_over,
tmouse_button button 
) [private]

void gui2::tevent_handler::mouse_button_up ( const SDL_Event &  event,
twidget mouse_over,
tmouse_button button 
) [private]

void gui2::tevent_handler::mouse_click ( twidget widget,
tmouse_button button 
) [private]

void gui2::tevent_handler::set_hover ( const bool  test_on_widget = false  )  [private]

void gui2::tevent_handler::key_down ( const SDL_Event &  event  )  [private]

virtual void gui2::tevent_handler::do_show_tooltip ( const tpoint location,
const t_string tooltip 
) [private, pure virtual]

Implemented in gui2::twindow.

Referenced by show_tooltip().

virtual void gui2::tevent_handler::do_remove_tooltip (  )  [private, pure virtual]

Implemented in gui2::twindow.

Referenced by remove_tooltip().

virtual void gui2::tevent_handler::do_show_help_popup ( const tpoint location,
const t_string help_popup 
) [private, pure virtual]

Implemented in gui2::twindow.

Referenced by show_help_popup().

virtual void gui2::tevent_handler::do_remove_help_popup (  )  [private, pure virtual]

Implemented in gui2::twindow.

Referenced by remove_help_popup().


Member Data Documentation

we create a new event context so we're always modal.

Maybe this has to change, but not sure yet.

Definition at line 115 of file event_handler.hpp.

Definition at line 117 of file event_handler.hpp.

Referenced by get_mouse(), handle_event(), set_hover(), show_help_popup(), and show_tooltip().

The current mouse x.

Definition at line 118 of file event_handler.hpp.

Referenced by get_mouse(), handle_event(), set_hover(), show_help_popup(), and show_tooltip().

The current mouse y.

Definition at line 120 of file event_handler.hpp.

Referenced by handle_event(), mouse_button_up(), and set_hover().

Definition at line 121 of file event_handler.hpp.

Referenced by handle_event(), mouse_button_up(), and set_hover().

Definition at line 122 of file event_handler.hpp.

Referenced by handle_event(), mouse_button_up(), and set_hover().

unsigned gui2::tevent_handler::hover_id_ [private]

Is there a hover event pending?

Definition at line 125 of file event_handler.hpp.

Referenced by mouse_hover(), and set_hover().

Id of the pending hover event.

Definition at line 126 of file event_handler.hpp.

Referenced by set_hover().

The area the mouse can move in, moving outside invalidates the pending hover event.

Definition at line 128 of file event_handler.hpp.

Referenced by mouse_hover(), mouse_leave(), set_hover(), and show_help_popup().

A widget only gets one hover event per enter cycle.

The widget that created the tooltip / tooltip.

Reimplemented in gui2::twindow.

Definition at line 131 of file event_handler.hpp.

Referenced by remove_tooltip(), show_help_popup(), and show_tooltip().

Reimplemented in gui2::twindow.

Definition at line 132 of file event_handler.hpp.

Referenced by remove_help_popup(), show_help_popup(), and show_tooltip().

Definition at line 136 of file event_handler.hpp.

Referenced by mouse_button_down(), mouse_button_up(), mouse_capture(), and mouse_move().

Definition at line 138 of file event_handler.hpp.

Referenced by key_down(), and keyboard_capture().


The documentation for this class was generated from the following files:

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs