Root/eeshow/gui/aoi.h

1/*
2 * gui/aoi.h - GUI: areas of interest
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_AOI_H
14#define GUI_AOI_H
15
16#include <stdbool.h>
17
18
19struct aoi {
20    int x, y, w, h; /* activation box, eeschema coordinates */
21                /* points to hovered aoi, or NULL */
22
23    bool (*hover)(void *user, bool on, int dx, int dy);
24    void (*click)(void *user);
25    void *user;
26
27    const struct aoi *related; /* considered equal for clicks */
28
29    struct aoi *next;
30};
31
32
33struct aoi *aoi_add(struct aoi **aois, const struct aoi *cfg);
34void aoi_update(struct aoi *aoi, const struct aoi *cfg);
35bool aoi_hover(struct aoi *const *aois, int x, int y);
36
37bool aoi_click(struct aoi *const *aois, int x, int y);
38
39void aoi_set_related(struct aoi *aoi, const struct aoi *related);
40
41void aoi_remove(struct aoi **aois, const struct aoi *aoi);
42void aoi_dehover(void);
43
44#endif /* !GUI_AOI_H */
45

Archive Download this file

Branches:
master



interactive