The Battle for Wesnoth  1.19.0-dev
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
gui2::event::mouse_motion Class Reference

#include <distributor.hpp>

Inheritance diagram for gui2::event::mouse_motion:

Public Member Functions

 mouse_motion (widget &owner, const dispatcher::queue_position queue_position)
 
 ~mouse_motion ()
 
void capture_mouse (const bool capture=true)
 Captures the mouse input. More...
 

Protected Member Functions

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

Protected Attributes

widgetmouse_focus_
 The widget that currently has the mouse focus_. More...
 
bool mouse_captured_
 Did the current widget capture the focus_? More...
 
widgetowner_
 The widget that owns us. More...
 
std::size_t hover_timer_
 The timer for the hover event. More...
 
widgethover_widget_
 The widget which should get the hover event. More...
 
point 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_hover (widget *mouse_over, const point &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::ui_event event, bool &handled, const point &coordinate)
 
void signal_handler_sdl_touch_motion (const event::ui_event event, bool &handled, const point &coordinate, const point &distance)
 
void signal_handler_sdl_wheel (const event::ui_event event, bool &handled, const point &coordinate)
 
void signal_handler_show_helptip (const event::ui_event event, bool &handled, const point &coordinate)
 

Private Attributes

bool signal_handler_sdl_mouse_motion_entered_
 

Detailed Description

Definition at line 57 of file distributor.hpp.

Constructor & Destructor Documentation

◆ mouse_motion()

gui2::event::mouse_motion::mouse_motion ( widget owner,
const dispatcher::queue_position  queue_position 
)

◆ ~mouse_motion()

gui2::event::mouse_motion::~mouse_motion ( )

Definition at line 135 of file distributor.cpp.

References stop_hover_timer().

Member Function Documentation

◆ capture_mouse()

void gui2::event::mouse_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 140 of file distributor.cpp.

References mouse_captured_, and mouse_focus_.

◆ mouse_enter()

void gui2::event::mouse_motion::mouse_enter ( widget mouse_over)
protected

Called when the mouse enters a widget.

Parameters
mouse_overThe widget that should receive the event.

Definition at line 242 of file distributor.cpp.

References DBG_GUI_E, gui2::event::dispatcher::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().

◆ mouse_hover()

void gui2::event::mouse_motion::mouse_hover ( widget mouse_over,
const point 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 255 of file distributor.cpp.

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

Referenced by signal_handler_sdl_mouse_motion().

◆ mouse_leave()

void gui2::event::mouse_motion::mouse_leave ( )
protected

◆ show_tooltip()

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

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

Definition at line 271 of file distributor.cpp.

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

Referenced by start_hover_timer().

◆ signal_handler_sdl_mouse_motion()

void gui2::event::mouse_motion::signal_handler_sdl_mouse_motion ( const event::ui_event  event,
bool &  handled,
const point coordinate 
)
private

◆ signal_handler_sdl_touch_motion()

void gui2::event::mouse_motion::signal_handler_sdl_touch_motion ( const event::ui_event  event,
bool &  handled,
const point coordinate,
const point distance 
)
private

◆ signal_handler_sdl_wheel()

void gui2::event::mouse_motion::signal_handler_sdl_wheel ( const event::ui_event  event,
bool &  handled,
const point coordinate 
)
private

◆ signal_handler_show_helptip()

void gui2::event::mouse_motion::signal_handler_show_helptip ( const event::ui_event  event,
bool &  handled,
const point coordinate 
)
private

◆ start_hover_timer()

void gui2::event::mouse_motion::start_hover_timer ( widget widget,
const point coordinate 
)
protected

Starts the hover timer.

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

Definition at line 311 of file distributor.cpp.

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

Referenced by mouse_enter(), and mouse_hover().

◆ stop_hover_timer()

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

Member Data Documentation

◆ hover_position_

point gui2::event::mouse_motion::hover_position_
protected

The anchor point of the hover event.

Definition at line 90 of file distributor.hpp.

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

◆ hover_shown_

bool gui2::event::mouse_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 99 of file distributor.hpp.

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

◆ hover_timer_

std::size_t gui2::event::mouse_motion::hover_timer_
protected

The timer for the hover event.

Definition at line 84 of file distributor.hpp.

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

◆ hover_widget_

widget* gui2::event::mouse_motion::hover_widget_
protected

The widget which should get the hover event.

Definition at line 87 of file distributor.hpp.

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

◆ mouse_captured_

bool gui2::event::mouse_motion::mouse_captured_
protected

Did the current widget capture the focus_?

Definition at line 78 of file distributor.hpp.

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

◆ mouse_focus_

widget* gui2::event::mouse_motion::mouse_focus_
protected

◆ owner_

widget& gui2::event::mouse_motion::owner_
protected

◆ signal_handler_sdl_mouse_motion_entered_

bool gui2::event::mouse_motion::signal_handler_sdl_mouse_motion_entered_
private

Definition at line 134 of file distributor.hpp.

Referenced by signal_handler_sdl_mouse_motion().


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