From ab0230b428ada2c5d1c0a1c70c2ff503696fc45b Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sun, 24 Jan 2016 21:41:34 -0500 Subject: [PATCH] Added a function for scrolling uiAreas. Implemented on OS X; stubbed elsewhere. --- darwin/area.m | 8 ++++++++ ui.h | 2 +- unix/area.c | 6 ++++++ windows/area.c | 5 +++++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/darwin/area.m b/darwin/area.m index 890602dc..fee1044c 100644 --- a/darwin/area.m +++ b/darwin/area.m @@ -346,6 +346,14 @@ void uiAreaQueueRedrawAll(uiArea *a) [a->area setNeedsDisplay:YES]; } +void uiAreaScrollTo(uiArea *a, double x, double y, double with, double height) +{ + if (!a->scrolling) + complain("attempt to call uiAreaScrollTo() on a non-scrolling uiArea"); + [a->area scrollRectToVisible:NSMakeRect(x, y, width, height)]; + // don't worry about the return value; it just says whether scrolling was needed +} + uiArea *uiNewArea(uiAreaHandler *ah) { uiArea *a; diff --git a/ui.h b/ui.h index 50964e4d..62f10b4b 100644 --- a/ui.h +++ b/ui.h @@ -284,6 +284,7 @@ _UI_EXTERN uintmax_t uiMenuItemType(void); _UI_EXTERN void uiAreaSetSize(uiArea *a, intmax_t width, intmax_t height); // TODO uiAreaQueueRedraw() _UI_EXTERN void uiAreaQueueRedrawAll(uiArea *a); +_UI_EXTERN void uiAreaScrollTo(uiArea *a, double x, double y, double with, double height); _UI_EXTERN uiArea *uiNewArea(uiAreaHandler *ah); _UI_EXTERN uiArea *uiNewScrollingArea(uiAreaHandler *ah, intmax_t width, intmax_t height); @@ -294,7 +295,6 @@ struct uiAreaDrawParams { double AreaWidth; double AreaHeight; - // TODO keep this? double ClipX; double ClipY; double ClipWidth; diff --git a/unix/area.c b/unix/area.c index 712d05d2..ca26e666 100644 --- a/unix/area.c +++ b/unix/area.c @@ -501,6 +501,12 @@ void uiAreaQueueRedrawAll(uiArea *a) gtk_widget_queue_draw(a->areaWidget); } +void uiAreaScrollTo(uiArea *a, double x, double y, double with, double height) +{ + // TODO + // TODO adjust adjustments and find source for that +} + uiArea *uiNewArea(uiAreaHandler *ah) { uiArea *a; diff --git a/windows/area.c b/windows/area.c index a2d4ff17..17070158 100644 --- a/windows/area.c +++ b/windows/area.c @@ -98,6 +98,11 @@ void uiAreaQueueRedrawAll(uiArea *a) logLastError("error queueing uiArea redraw in uiAreaQueueRedrawAll()"); } +void uiAreaScrollTo(uiArea *a, double x, double y, double with, double height) +{ + // TODO +} + uiArea *uiNewArea(uiAreaHandler *ah) { uiArea *a;