1// Aseprite
2// Copyright (C) 2020 Igara Studio S.A.
3// Copyright (C) 2016 David Capello
4//
5// This program is distributed under the terms of
6// the End-User License Agreement for Aseprite.
7
8#ifndef APP_TOOLS_POINTER_H_INCLUDED
9#define APP_TOOLS_POINTER_H_INCLUDED
10#pragma once
11
12#include "base/vector2d.h"
13#include "gfx/point.h"
14#include "ui/pointer_type.h"
15
16namespace app {
17namespace tools {
18
19using Vec2 = base::Vector2d<float>;
20
21// Simple container of mouse events information.
22class Pointer {
23public:
24 enum Button { None, Left, Middle, Right };
25 typedef ui::PointerType Type;
26
27 Pointer()
28 : m_point(0, 0)
29 , m_velocity(0.0, 0.0)
30 , m_button(None)
31 , m_type(Type::Unknown)
32 , m_pressure(0.0f) { }
33
34 Pointer(const gfx::Point& point,
35 const Vec2& velocity,
36 const Button button,
37 const Type type,
38 const float pressure)
39 : m_point(point)
40 , m_velocity(velocity)
41 , m_button(button)
42 , m_type(type)
43 , m_pressure(pressure) { }
44
45 const gfx::Point& point() const { return m_point; }
46 const Vec2& velocity() const { return m_velocity; }
47 Button button() const { return m_button; }
48 Type type() const { return m_type; }
49 float pressure() const { return m_pressure; }
50
51private:
52 gfx::Point m_point;
53 Vec2 m_velocity;
54 Button m_button;
55 Type m_type;
56 float m_pressure;
57};
58
59} // namespace tools
60} // namespace app
61
62#endif
63