Root/gui_over.h

Source at commit 1d7eccb06b61f239b9671617488f33910286f0f1 created 5 years 6 months ago.
By Werner Almesberger, dump.c: add dumping of %iprint
1/*
2 * gui_over.h - GUI, canvas overlays
3 *
4 * Written 2009 by Werner Almesberger
5 * Copyright 2009 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
14#ifndef GUI_OVER_H
15#define GUI_OVER_H
16
17/*
18 * Dynamic changes around the pointer are affected by the following events:
19 *
20 * - enter: enter a circle where we're hovering
21 * - leave: leave a circle where we've been hovering
22 * - begin: begin dragging
23 * - move: move with or without dragging
24 * - end: end dragging
25 * - reset: we got a redraw, just drop everything
26 *
27 * We have the following states:
28 *
29 * - NOTHING: neither hovering nor dragging
30 * - HOVER: we're hovering but not dragging
31 * - DRAG: we're dragging but not hovering, e.g., when searching for a place to
32 * end the drag
33 * - BOTH: we're dragging and hovering
34 *
35 * Both drag and hover save the area being changed and restore it after a
36 * change. We have to make sure the save/draw/restore operations are properly
37 * sequenced. We call the hover area H, the drag area D. This is the state
38 * machine that does the sequencing:
39 *
40 * NOTHING (saved: -)
41 * enter -> save H, draw H, HOVER
42 * begin -> save D, draw D, DRAG
43 * move -> NOTHING
44 * reset -> NOTHING
45 *
46 * HOVER: (saved: H)
47 * leave -> restore H, NOTHING
48 * begin -> save D, draw D, BOTH
49 * move -> HOVER
50 * reset -> drop H, NOTHING
51 *
52 * DRAG: (saved: D)
53 * end -> restore D, NOTHING
54 * enter -> restore D, save H, draw H, save D, draw D, BOTH
55 * move -> restore D, update, save D, draw D, DRAG
56 * reset -> drop D, NOTHING
57 *
58 * BOTH: (saved: D on top of H)
59 * end -> restore D, HOVER
60 * leave -> restore D, restore H, save D, draw D, DRAG
61 * move -> restore D, update, save D, draw D, BOTH
62 * reset -> drop D, drop H, NOTHING
63 */
64
65#include "coord.h"
66#include "inst.h"
67
68
69void over_enter(struct pix_buf *(*save_and_draw)(void *user), void *user);
70void over_leave(void);
71
72void over_begin(struct pix_buf *(*save_and_draw)(void *user, struct coord pos),
73    void *user, struct coord pos);
74void over_move(struct coord pos);
75void over_end(void);
76
77void over_reset(void);
78
79#endif /* !GUI_OVER_H */
80

Archive Download this file

Branches:
master



interactive