blob: 0b9977af83d8f1579e7df6d2eb339a1adf972505 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
// SPDX-License-Identifier: GPL-2.0-or-later
#ifndef INK_LIVECODE_INPUT_H
#define INK_LIVECODE_INPUT_H
/*
* Input state keeper for the livecoding tool
*
* Authors:
* Sol Bekic <s+inkscape@s-ol.nu>
* Copyright (C) 2019 Authors
*
* Released under GNU GPL v2+, read the file 'COPYING' for more information.
*/
#include <gdk/gdk.h>
#include <2geom/point.h>
#include <2geom/geom.h>
namespace Inkscape {
namespace Livecode {
class API;
enum InputState {
INPUTSTATE_NONE,
INPUTSTATE_HOVER,
INPUTSTATE_PRESSED,
INPUTSTATE_HELD,
INPUTSTATE_RELEASED,
};
class Mouse {
public:
Geom::Point pos() const;
Geom::Point delta() const;
Geom::Point ui_pos() const;
Geom::Point ui_delta() const;
InputState event(guint button = 1) const;
bool pressed(guint button = 1) const;
bool held(guint button = 1) const;
bool released(guint button = 1) const;
private:
API& api;
guint last_mask, prev_mask;
Geom::Point last_pos, prev_pos;
Mouse(API &api);
void push_event(GdkEvent *event);
void finish_frame();
friend class API;
};
}
}
#endif // INK_LIVECODE_INPUT_H
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
|