neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
mouse.hpp
Go to the documentation of this file.
1// mouse.hpp
2/*
3 neogfx C++ App/Game Engine
4 Copyright (c) 2015, 2020 Leigh Johnston. All Rights Reserved.
5
6 This program is free software: you can redistribute it and / or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#pragma once
21
22#include <neogfx/neogfx.hpp>
26
27namespace neogfx
28{
29 class mouse;
30
32 {
33 public:
35 public:
36 bool mouse_wheel_scrolled(mouse_wheel aWheel, const point& aPosition, delta aDelta, key_modifiers_e aKeyModifiers) override;
37 private:
38 mouse& iMouse;
39 };
40
41 class mouse : public hid_device<i_mouse>
42 {
43 public:
44 define_declared_event(ButtonPressed, button_pressed, mouse_button)
46 private:
47 friend class mouse_grabber;
48 public:
49 mouse(const i_string& aName = string{ "Generic Mouse" });
50 public:
51 bool is_mouse_grabbed() const override;
52 bool is_mouse_grabbed_by(i_mouse_handler& aMouseHandler) const override;
53 bool is_front_grabber(i_mouse_handler& aMouseHandler) const override;
54 void grab_mouse(i_mouse_handler& aMouseHandler) override;
55 void ungrab_mouse(i_mouse_handler& aMouseHandler) override;
56 i_mouse_handler& grabber() const override;
57 private:
58 mutable mouse_grabber iGrabber;
59 std::deque<i_mouse_handler*> iGrabs;
60 };
61}
mouse_grabber(mouse &aMouse)
bool mouse_wheel_scrolled(mouse_wheel aWheel, const point &aPosition, delta aDelta, key_modifiers_e aKeyModifiers) override
bool is_mouse_grabbed() const override
define_declared_event(ButtonPressed, button_pressed, mouse_button) define_declared_event(ButtonReleased
bool is_front_grabber(i_mouse_handler &aMouseHandler) const override
void grab_mouse(i_mouse_handler &aMouseHandler) override
bool is_mouse_grabbed_by(i_mouse_handler &aMouseHandler) const override
i_mouse_handler & grabber() const override
void ungrab_mouse(i_mouse_handler &aMouseHandler) override
mouse_wheel
Definition i_mouse.hpp:42
mouse_button
Definition i_mouse.hpp:31
#define define_declared_event(name, declName,...)
Definition event.hpp:195