summaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-29 02:10:04 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-29 02:12:01 -0300
commit5f2414aa745a2fadd89e77fb8753d308ca4586f8 (patch)
tree0cbf2149e6064bd3949130e41b6848791c093132 /gui
parenta8384239c95cd514662c928f0b6023415024579a (diff)
downloadeeshow-5f2414aa745a2fadd89e77fb8753d308ca4586f8.tar.gz
eeshow-5f2414aa745a2fadd89e77fb8753d308ca4586f8.tar.bz2
eeshow-5f2414aa745a2fadd89e77fb8753d308ca4586f8.zip
gui/over.c (over_iterate_geometry): iterate overlays and pass geometry
This way, one can draw things in relation to overlays. E.g., the threads in the revision history.
Diffstat (limited to 'gui')
-rw-r--r--gui/over.c22
-rw-r--r--gui/over.h4
2 files changed, 26 insertions, 0 deletions
diff --git a/gui/over.c b/gui/over.c
index 415ecdc..f86b05d 100644
--- a/gui/over.c
+++ b/gui/over.c
@@ -52,6 +52,9 @@ struct overlay {
struct aoi *aoi;
const struct overlay *related;
+ int x,y; /* for over_iterate_geometry */
+ unsigned w, h;
+
struct overlay *next, *prev;
};
@@ -104,6 +107,10 @@ static void post_aoi(struct overlay *over, int x, int y, unsigned w, unsigned h)
.user = over->user,
};
+ over->x = x;
+ over->y = y;
+ over->w = w;
+ over->h = h;
if (!over->hover && !over->click)
return;
@@ -507,6 +514,21 @@ void overlay_set_related_all(struct overlay *overlays, struct overlay *related)
}
+/* ----- Iterate for geometry ---------------------------------------------- */
+
+
+void over_iterate_geometry(const struct overlay *over,
+ void (*fn)(void *user, void *user_over, int x, int y, unsigned w,
+ unsigned h, int dy), void *user)
+{
+ while (over) {
+ fn(user, over->user, over->x, over->y, over->w, over->h,
+ over->next ? over->next->y - over->y : 0);
+ over = over->next;
+ }
+}
+
+
/* ----- Removal ----------------------------------------------------------- */
diff --git a/gui/over.h b/gui/over.h
index 7bb53ad..64166eb 100644
--- a/gui/over.h
+++ b/gui/over.h
@@ -67,6 +67,10 @@ void overlay_style(struct overlay *over, const struct overlay_style *style);
void overlay_set_related(struct overlay *over, struct overlay *related);
void overlay_set_related_all(struct overlay *overlays, struct overlay *related);
+void over_iterate_geometry(const struct overlay *over,
+ void (*fn)(void *user, void *user_over, int x, int y, unsigned w,
+ unsigned h, int dy), void *user);
+
void overlay_remove(struct overlay **overlays, struct overlay *over);
void overlay_remove_all(struct overlay **overlays);