Root/
| 1 | /* |
| 2 | * gui/over.h - GUI: overlays |
| 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_OVER_H |
| 14 | #define GUI_OVER_H |
| 15 | |
| 16 | #include <stdbool.h> |
| 17 | #include <stdint.h> |
| 18 | |
| 19 | #include <cairo/cairo.h> |
| 20 | #include <pango/pangocairo.h> |
| 21 | |
| 22 | |
| 23 | #include "gui/aoi.h" |
| 24 | |
| 25 | |
| 26 | struct color { |
| 27 | double r, g, b, alpha; |
| 28 | }; |
| 29 | |
| 30 | |
| 31 | struct overlay_style { |
| 32 | const char *font; |
| 33 | unsigned wmin, wmax; |
| 34 | unsigned hmin, hmax; |
| 35 | unsigned radius; |
| 36 | unsigned pad; /* in x and y direction; adjust for radius ! */ |
| 37 | unsigned skip; /* should be list-specific */ |
| 38 | struct color fg; |
| 39 | struct color bg; |
| 40 | struct color frame; |
| 41 | double width; |
| 42 | }; |
| 43 | |
| 44 | struct overlay; |
| 45 | |
| 46 | |
| 47 | void overlay_draw_all_d(struct overlay *overlays, cairo_t *cr, |
| 48 | int x, int y, int dx, int dy); |
| 49 | void overlay_draw_all(struct overlay *overlays, cairo_t *cr, int x, int y); |
| 50 | |
| 51 | void overlay_size(const struct overlay *over, PangoContext *pango_context, |
| 52 | int *w, int *h); |
| 53 | void overlay_size_all(const struct overlay *overlays, |
| 54 | PangoContext *pango_context, bool dx, bool dy, int *w, int *h); |
| 55 | |
| 56 | struct overlay *overlay_add(struct overlay **overlays, struct aoi **aois, |
| 57 | bool (*hover)(void *user, bool on, int dx, int dy), |
| 58 | void (*click)(void *user), void *user); |
| 59 | |
| 60 | void overlay_text_raw(struct overlay *over, const char *s); |
| 61 | void overlay_text(struct overlay *over, const char *fmt, ...); |
| 62 | void overlay_icon(struct overlay *over, cairo_surface_t *icon); |
| 63 | void overlay_style(struct overlay *over, const struct overlay_style *style); |
| 64 | |
| 65 | void overlay_set_related(struct overlay *over, struct overlay *related); |
| 66 | void overlay_set_related_all(struct overlay *overlays, struct overlay *related); |
| 67 | |
| 68 | void overlay_remove(struct overlay **overlays, struct overlay *over); |
| 69 | void overlay_remove_all(struct overlay **overlays); |
| 70 | |
| 71 | #endif /* !GUI_OVER_H */ |
| 72 |
Branches:
master
