1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-20 02:05:19 +02:00
eda-tools/eeshow/gui/aoi.h
Werner Almesberger 49fe8518a5 eeshow/gui/aoi.c (aoi_set_related): AoIs can now share clicks
If A is related to B, then A can receive clicks while B is hovering,
without getting B de-hovered.

Note that in aoi_set_related(A, B), more than one A can share one B,
but an A can't have more than one B.
2016-08-19 03:25:56 -03:00

45 lines
1.1 KiB
C

/*
* gui/aoi.h - GUI: areas of interest
*
* Written 2016 by Werner Almesberger
* Copyright 2016 by Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef GUI_AOI_H
#define GUI_AOI_H
#include <stdbool.h>
struct aoi {
int x, y, w, h; /* activation box, eeschema coordinates */
/* points to hovered aoi, or NULL */
bool (*hover)(void *user, bool on);
void (*click)(void *user);
void *user;
const struct aoi *related; /* considered equal for clicks */
struct aoi *next;
};
struct aoi *aoi_add(struct aoi **aois, const struct aoi *cfg);
void aoi_update(struct aoi *aoi, const struct aoi *cfg);
bool aoi_hover(const struct aoi *aois, int x, int y);
bool aoi_click(const struct aoi *aois, int x, int y);
void aoi_set_related(struct aoi *aoi, const struct aoi *related);
void aoi_remove(struct aoi **aois, const struct aoi *aoi);
void aoi_dehover(void);
#endif /* !GUI_AOI_H */