Added a function for scrolling uiAreas. Implemented on OS X; stubbed elsewhere.

This commit is contained in:
Pietro Gagliardi 2016-01-24 21:41:34 -05:00
parent febb37700a
commit ab0230b428
4 changed files with 20 additions and 1 deletions

View File

@ -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;

2
ui.h
View File

@ -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;

View File

@ -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;

View File

@ -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;