Add clav-mutation-find to installation
[clav.git] / ui.h
blob36178b1478e168a1ee7a33440b912ab3e4831abb
1 /*
2 * Copyright (c) 2016, S. Gilles <sgilles@math.umd.edu>
4 * Permission to use, copy, modify, and/or distribute this software
5 * for any purpose with or without fee is hereby granted, provided
6 * that the above copyright notice and this permission notice appear
7 * in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
13 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
14 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
15 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 enum event_type {
19 ET_NONE = 0,
20 ET_CHANGE_FATNESS,
21 ET_DELETE_EDGE,
22 ET_DELETE_VERTEX,
23 ET_LOAD,
24 ET_MUTATE,
25 ET_NEW_EDGE,
26 ET_NEW_VERTEX,
27 ET_QUIT,
28 ET_RENAME,
29 ET_SAVE,
32 struct ui_event {
33 /* What event this is */
34 enum event_type type;
36 /* Event-specific data */
37 size_t idx_1;
38 size_t idx_2;
39 int int_1;
40 int int_2;
41 int_fast8_t a;
42 uint_fast8_t b;
43 char *str;
46 /* Initialize whatever UI is present */
47 int
48 ui_init(struct quiver *q);
50 /* Tear down whatever UI was made */
51 int
52 ui_teardown(void);
54 /* Deal with the fact that the quiver was changed */
55 int
56 ui_respond_quiver_change(void);
58 /* Record that a frame has been started */
59 int
60 ui_start_frame(void);
62 /* Draw a frame, sleep to framelimit */
63 int
64 ui_finish_frame(void);
66 /* Get some kind of ui-agnostic event (like `quit' or `mutate' */
67 int
68 ui_get_event(struct ui_event *e, uint_fast8_t *more);