2016-08-04 13:19:18 +03:00
|
|
|
/*
|
2016-08-18 02:54:25 +03:00
|
|
|
* gui/aoi.h - GUI: areas of interest
|
2016-08-04 13:19:18 +03:00
|
|
|
*
|
|
|
|
* 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 {
|
2016-08-05 01:25:31 +03:00
|
|
|
int x, y, w, h; /* activation box, eeschema coordinates */
|
2016-08-04 13:19:18 +03:00
|
|
|
/* points to hovered aoi, or NULL */
|
|
|
|
|
2016-08-22 04:31:52 +03:00
|
|
|
bool (*hover)(void *user, bool on, int dx, int dy);
|
2016-08-04 13:19:18 +03:00
|
|
|
void (*click)(void *user);
|
|
|
|
void *user;
|
|
|
|
|
2016-08-19 09:25:56 +03:00
|
|
|
const struct aoi *related; /* considered equal for clicks */
|
|
|
|
|
2016-08-04 13:19:18 +03:00
|
|
|
struct aoi *next;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-08-07 11:09:34 +03:00
|
|
|
struct aoi *aoi_add(struct aoi **aois, const struct aoi *cfg);
|
|
|
|
void aoi_update(struct aoi *aoi, const struct aoi *cfg);
|
2016-08-21 02:39:08 +03:00
|
|
|
bool aoi_hover(struct aoi *const *aois, int x, int y);
|
2016-08-14 18:30:24 +03:00
|
|
|
|
2016-08-21 02:42:34 +03:00
|
|
|
bool aoi_click(struct aoi *const *aois, int x, int y);
|
2016-08-14 18:30:24 +03:00
|
|
|
|
2016-08-19 09:25:56 +03:00
|
|
|
void aoi_set_related(struct aoi *aoi, const struct aoi *related);
|
|
|
|
|
2016-08-04 13:53:25 +03:00
|
|
|
void aoi_remove(struct aoi **aois, const struct aoi *aoi);
|
2016-08-11 03:50:07 +03:00
|
|
|
void aoi_dehover(void);
|
2016-08-04 13:19:18 +03:00
|
|
|
|
|
|
|
#endif /* !GUI_AOI_H */
|