Root/eeshow/gui/input.h

1/*
2 * gui/input.h - Input operations
3 *
4 * Written 2016 by Werner Almesberger
5 * Copyright 2016 by Werner Almesberger
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef GUI_INPUT_H
14#define GUI_NPUT_H
15
16#include <stdbool.h>
17
18#include <gtk/gtk.h>
19
20
21/*
22 * All members of input_ops are optional, i.e., can be NULL.
23 *
24 * hover_begin and drag_begin must not call input_push or input_pop.
25 */
26
27struct input_ops {
28    bool (*click)(void *user, int x, int y);
29
30    bool (*hover_begin)(void *user, int x, int y);
31    bool (*hover_update)(void *user, int x, int y);
32    bool (*hover_click)(void *user, int x, int y);
33    void (*hover_end)(void *user);
34
35    bool (*drag_begin)(void *user, int x, int y);
36    void (*drag_move)(void *user, int dx, int dy);
37    void (*drag_end)(void *user);
38
39    void (*scroll)(void *user, int x, int y, int dy);
40        /* down = 1, up = -1 */
41
42    void (*key)(void *user, int x, int y, int keyval);
43};
44
45
46bool input_accept(void *user, int x, int y);
47
48void input_update(void);
49
50void input_push(const struct input_ops *ops, void *user);
51void input_pop(void);
52void input_setup(GtkWidget *da);
53
54#endif /* !GUI_INPUT_H */
55

Archive Download this file

Branches:
master



interactive