The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
gui2::event::tmouse_motion Class Reference

#include <distributor.hpp>

Inheritance diagram for gui2::event::tmouse_motion:
Inheritance graph

Public Member Functions

 tmouse_motion (twidget &owner, const tdispatcher::tposition queue_position)
 
 ~tmouse_motion ()
 
void capture_mouse (const bool capture=true)
 Captures the mouse input. More...
 

Protected Member Functions

void start_hover_timer (twidget *widget, const tpoint &coordinate)
 Starts the hover timer. More...
 
void stop_hover_timer ()
 Stops the current hover timer. More...
 
void mouse_enter (twidget *mouse_over)
 Called when the mouse enters a widget. More...
 
void mouse_leave ()
 Called when the mouse leaves the current widget. More...
 

Protected Attributes

twidgetmouse_focus_
 The widget that currently has the mouse focus_. More...
 
bool mouse_captured_
 Did the current widget capture the focus_? More...
 
twidgetowner_
 The widget that owns us. More...
 
size_t hover_timer_
 The timer for the hover event. More...
 
twidgethover_widget_
 The widget which should get the hover event. More...
 
tpoint hover_position_
 The anchor point of the hover event. More...
 
bool hover_shown_
 Has the hover been shown for the widget? More...
 

Private Member Functions

void mouse_motion (twidget *mouse_over, const tpoint &coordinate)
 Called when the mouse moves over a widget. More...
 
void show_tooltip ()
 Called when the mouse wants the widget to show its tooltip. More...
 
void signal_handler_sdl_mouse_motion (const event::tevent event, bool &handled, const tpoint &coordinate)
 
void signal_handler_sdl_wheel (const event::tevent event, bool &handled, const tpoint &coordinate)
 
void signal_handler_show_helptip (const event::tevent event, bool &handled, const tpoint &coordinate)
 

Private Attributes

bool signal_handler_sdl_mouse_motion_entered_
 

Detailed Description

Definition at line 60 of file distributor.hpp.

Constructor & Destructor Documentation

gui2::event::tmouse_motion::tmouse_motion ( twidget owner,
const tdispatcher::tposition  queue_position 
)
gui2::event::tmouse_motion::~tmouse_motion ( )

Definition at line 149 of file distributor.cpp.

References stop_hover_timer().

Member Function Documentation

void gui2::event::tmouse_motion::capture_mouse ( const bool  capture = true)

Captures the mouse input.

When capturing the widget that has the mouse focus_ does the capturing.

Parameters
captureSet or release the capturing.

Definition at line 154 of file distributor.cpp.

References mouse_captured_, and mouse_focus_.

void gui2::event::tmouse_motion::mouse_enter ( twidget mouse_over)
protected

Called when the mouse enters a widget.

Parameters
mouse_overThe widget that should receive the event.

Definition at line 247 of file distributor.cpp.

References DBG_GUI_E, gui2::event::tdispatcher::fire(), gui2::get_mouse_position(), hover_shown_, LOG_HEADER, gui2::event::MOUSE_ENTER, mouse_focus_, owner_, and start_hover_timer().

Referenced by signal_handler_sdl_mouse_motion().

void gui2::event::tmouse_motion::mouse_leave ( )
protected
void gui2::event::tmouse_motion::mouse_motion ( twidget mouse_over,
const tpoint coordinate 
)
private

Called when the mouse moves over a widget.

Parameters
mouse_overThe widget that should receive the event.
coordinateThe current screen coordinate of the mouse.

Definition at line 260 of file distributor.cpp.

References DBG_GUI_E, gui2::event::tdispatcher::fire(), hover_position_, hover_timer_, LOG_HEADER, gui2::event::MOUSE_MOTION, owner_, start_hover_timer(), stop_hover_timer(), gui2::tpoint::x, and gui2::tpoint::y.

Referenced by signal_handler_sdl_mouse_motion().

void gui2::event::tmouse_motion::show_tooltip ( )
private

Called when the mouse wants the widget to show its tooltip.

Definition at line 278 of file distributor.cpp.

References DBG_GUI_E, ERR_GUI_E, gui2::event::tdispatcher::fire(), hover_position_, hover_shown_, hover_timer_, hover_widget_, LOG_HEADER, owner_, and gui2::event::SHOW_TOOLTIP.

Referenced by start_hover_timer().

void gui2::event::tmouse_motion::signal_handler_sdl_mouse_motion ( const event::tevent  event,
bool &  handled,
const tpoint coordinate 
)
private
void gui2::event::tmouse_motion::signal_handler_sdl_wheel ( const event::tevent  event,
bool &  handled,
const tpoint coordinate 
)
private
void gui2::event::tmouse_motion::signal_handler_show_helptip ( const event::tevent  event,
bool &  handled,
const tpoint coordinate 
)
private
void gui2::event::tmouse_motion::start_hover_timer ( twidget widget,
const tpoint coordinate 
)
protected

Starts the hover timer.

Parameters
widgetThe widget that wants the tooltip.
coordinateThe anchor coordinate.

Definition at line 319 of file distributor.cpp.

References gui2::add_timer(), DBG_GUI_E, ERR_GUI_E, hover_position_, hover_shown_, hover_timer_, hover_widget_, gui2::twidget::id(), LOG_HEADER, show_tooltip(), stop_hover_timer(), and gui2::tevent_executor::wants_mouse_hover().

Referenced by mouse_enter(), and mouse_motion().

void gui2::event::tmouse_motion::stop_hover_timer ( )
protected

Member Data Documentation

tpoint gui2::event::tmouse_motion::hover_position_
protected

The anchor point of the hover event.

Definition at line 94 of file distributor.hpp.

Referenced by mouse_motion(), show_tooltip(), start_hover_timer(), and stop_hover_timer().

bool gui2::event::tmouse_motion::hover_shown_
protected

Has the hover been shown for the widget?

A widget won't get a second hover event after the tooltip has been triggered. Only after (shortly) entering another widget it will be shown again for this widget.

Definition at line 103 of file distributor.hpp.

Referenced by mouse_enter(), show_tooltip(), and start_hover_timer().

size_t gui2::event::tmouse_motion::hover_timer_
protected

The timer for the hover event.

Definition at line 88 of file distributor.hpp.

Referenced by mouse_motion(), show_tooltip(), start_hover_timer(), and stop_hover_timer().

twidget* gui2::event::tmouse_motion::hover_widget_
protected

The widget which should get the hover event.

Definition at line 91 of file distributor.hpp.

Referenced by show_tooltip(), gui2::event::tdistributor::signal_handler_notify_removal(), start_hover_timer(), and stop_hover_timer().

bool gui2::event::tmouse_motion::mouse_captured_
protected

Did the current widget capture the focus_?

Definition at line 82 of file distributor.hpp.

Referenced by capture_mouse(), signal_handler_sdl_mouse_motion(), signal_handler_sdl_wheel(), and signal_handler_show_helptip().

twidget* gui2::event::tmouse_motion::mouse_focus_
protected
twidget& gui2::event::tmouse_motion::owner_
protected
bool gui2::event::tmouse_motion::signal_handler_sdl_mouse_motion_entered_
private

Definition at line 138 of file distributor.hpp.

Referenced by signal_handler_sdl_mouse_motion().


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