21 #include <SDL2/SDL_events.h> 54 bool dragging_started()
const;
59 bool is_dragging()
const;
67 void mouse_motion_event(
const SDL_MouseMotionEvent& event,
const bool browse);
69 void touch_motion_event(
const SDL_TouchFingerEvent& event,
const bool browse);
84 bool mouse_motion_default(
int x,
int y,
bool update);
90 virtual void mouse_motion(
94 virtual void touch_motion(
98 virtual void mouse_press(
const SDL_MouseButtonEvent& event,
const bool browse);
99 bool is_left_click(
const SDL_MouseButtonEvent& event)
const;
100 bool is_middle_click(
const SDL_MouseButtonEvent& event)
const;
101 bool is_right_click(
const SDL_MouseButtonEvent& event)
const;
102 bool is_touch_click(
const SDL_MouseButtonEvent& event)
const;
105 virtual void mouse_wheel(
int xscroll,
int yscroll,
bool browse);
125 virtual bool left_click(
int x,
int y,
const bool browse);
133 virtual void touch_action(
const map_location hex,
bool browse);
136 virtual void left_drag_end(
int ,
int ,
const bool );
153 return right_click_show_menu(x, y, browse);
177 virtual void right_mouse_up(
int ,
int ,
const bool );
208 return {scroll_start_x_, scroll_start_y_};
213 return scroll_started_;
217 void cancel_dragging();
218 void clear_dragging(
const SDL_MouseButtonEvent& event,
bool browse);
219 void init_dragging(
bool& dragging_flag);
int drag_from_x_
Drag start position x.
const SDL_Point get_scroll_start() const
bool dragging_right_
RMB drag init flag.
void set_scroll_start(int x, int y)
Called when the middle click scrolling.
bool dragging_touch_
Finger drag init flag.
virtual int drag_threshold() const
Minimum dragging distance to fire the drag&drop.
bool dragging_started_
Actual drag flag.
virtual void mouse_wheel_right(int, int, const bool)
Called when the mouse wheel is scrolled right.
virtual bool right_click(int x, int y, const bool browse)
Overridden in derived classes, called on a right click (mousedown).
virtual void mouse_wheel_down(int, int, const bool)
Called when the mouse wheel is scrolled down.
virtual ~mouse_handler_base()
virtual bool right_click_show_menu(int, int, const bool)
Called in the default right_click when the context menu is about to be shown, can be used for preproc...
bool minimap_scrolling_
minimap scrolling (scroll-drag) state flag
bool scroll_started() const
virtual bool allow_mouse_wheel_scroll(int, int)
Derived classes can override this to disable mousewheel scrolling under some circumstances, e.g.
bool show_menu_
Show context menu flag.
virtual void mouse_wheel_up(int, int, const bool)
Called when the mouse wheel is scrolled up.
map_location drag_from_hex_
Drag start map location.
bool dragging_left_
LMB drag init flag.
virtual void move_action(bool)
Overridden in derived class.
Encapsulates the map of the game.
virtual void right_drag_end(int, int, const bool)
Called whenever the right mouse drag has "ended".
int scroll_start_x_
Relative to middle click scrolling.
bool get_show_menu() const
Handling of system events.
map_location last_hex_
last highlighted hex
virtual void mouse_wheel_left(int, int, const bool)
Called when the mouse wheel is scrolled left.
static const map_location & null_location()
bool simple_warp_
MMB click (on game map) state flag.
int drag_from_y_
Drag start position y.
virtual void left_mouse_up(int, int, const bool)
Called when the left mouse button is up.