16 #ifndef MOUSE_HANDLER_BASE_H_INCLUDED
17 #define MOUSE_HANDLER_BASE_H_INCLUDED
20 #include <SDL_events.h>
21 #include <SDL_version.h>
79 virtual void mouse_press(
const SDL_MouseButtonEvent&
event,
const bool browse);
87 virtual void mouse_wheel(
int xscroll,
int yscroll,
bool browse);
103 virtual bool left_click(
int x,
int y,
const bool browse);
127 virtual bool right_click(
int x,
int y,
const bool browse);
bool mouse_motion_default(int x, int y, bool update)
This handles minimap scrolling and click-drag.
const map_location get_scroll_start()
int drag_from_x_
Drag start position x.
void clear_dragging(const SDL_MouseButtonEvent &event, bool browse)
virtual void left_mouse_up(int x, int y, const bool browse)
Called when the left mouse button is up.
bool is_left_click(const SDL_MouseButtonEvent &event) const
bool dragging_right_
RMB drag init flag.
void set_scroll_start(int x, int y)
Called when the middle click scrolling.
bool dragging_started_
Actual drag flag.
virtual bool right_click_show_menu(int x, int y, const bool browse)
Called in the default right_click when the context menu is about to be shown, can be used for preproc...
virtual void right_drag_end(int x, int y, const bool browse)
Called whenever the right mouse drag has "ended".
virtual void mouse_wheel_down(int x, int y, const bool browse)
Called when the mouse wheel is scrolled down.
virtual bool allow_mouse_wheel_scroll(int x, int y)
Derived classes can override this to disable mousewheel scrolling under some circumstances, e.g.
GLint GLint GLint GLint GLint GLint y
virtual void mouse_motion(int x, int y, const bool browse, bool update=false, map_location new_loc=map_location::null_location())=0
Called when a mouse motion event takes place.
void mouse_motion_event(const SDL_MouseMotionEvent &event, const bool browse)
virtual ~mouse_handler_base()
virtual void mouse_wheel_up(int x, int y, const bool browse)
Called when the mouse wheel is scrolled up.
virtual void mouse_press(const SDL_MouseButtonEvent &event, const bool browse)
virtual bool left_click(int x, int y, const bool browse)
Overridden in derived classes, called on a left click (mousedown).
bool get_show_menu() const
virtual bool right_click(int x, int y, const bool browse)
Overridden in derived classes, called on a right click (mousedown).
bool minimap_scrolling_
minimap scrolling (scroll-drag) state flag
virtual void right_mouse_up(int x, int y, const bool browse)
Called when the right mouse button is up.
virtual void mouse_wheel_right(int x, int y, const bool browse)
Called when the mouse wheel is scrolled right.
bool show_menu_
Show context menu flag.
map_location drag_from_hex_
Drag start map location.
static const map_location & null_location()
bool dragging_left_
LMB drag init flag.
Encapsulates the map of the game.
int scroll_start_x_
Relative to middle click scrolling.
virtual void mouse_wheel_left(int x, int y, const bool browse)
Called when the mouse wheel is scrolled left.
GLint GLint GLint GLint GLint x
virtual void mouse_wheel(int xscroll, int yscroll, bool browse)
Called when scrolling with the mouse wheel.
Handling of system events.
map_location last_hex_
last highlighted hex
void init_dragging(bool &dragging_flag)
virtual display & gui()=0
Reference to the used display objects.
virtual int drag_threshold() const
bool is_right_click(const SDL_MouseButtonEvent &event) const
virtual void move_action(bool browse)
Overridden in derived class.
void mouse_update(const bool browse, map_location loc)
update the mouse with a fake mouse motion
virtual void left_drag_end(int x, int y, const bool browse)
Called whenever the left mouse drag has "ended".
bool simple_warp_
MMB click (on game map) state flag.
bool is_middle_click(const SDL_MouseButtonEvent &event) const
int drag_from_y_
Drag start position y.