From: Dan Winship Date: Wed, 30 Oct 2013 14:47:32 +0000 (-0400) Subject: add newtFormGet/SetScrollPosition X-Git-Tag: r0-52-17~11 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=7f72e4efabb20f8a296a79b06e312e432dd05635;p=thirdparty%2Fnewt.git add newtFormGet/SetScrollPosition --- diff --git a/form.c b/form.c index 215c295..2930f9f 100644 --- a/form.c +++ b/form.c @@ -517,6 +517,20 @@ static void formScroll(newtComponent co, int delta) { } } +int newtFormGetScrollPosition(newtComponent co) { + struct form * form = co->data; + + return form->vertOffset; +} + +void newtFormSetScrollPosition(newtComponent co, int position) { + struct form * form = co->data; + + if (form->numRows == 0) + newtFormSetSize(co); + formScroll(co, position - form->vertOffset); +} + void newtFormSetCurrent(newtComponent co, newtComponent subco) { struct form * form = co->data; int i, new; diff --git a/newt.0.52.ver b/newt.0.52.ver index 8dd5012..33190ef 100644 --- a/newt.0.52.ver +++ b/newt.0.52.ver @@ -167,3 +167,9 @@ NEWT_0.52.16 { newtComponentGetPosition; newtComponentGetSize; } NEWT_0.52.13; + +NEWT_0.52.17 { + global: + newtFormGetScrollPosition; + newtFormSetScrollPosition; +} NEWT_0.52.16; diff --git a/newt.h b/newt.h index 9f73006..0070c71 100644 --- a/newt.h +++ b/newt.h @@ -245,6 +245,8 @@ newtComponent newtRunForm(newtComponent form); /* obsolete */ void newtFormRun(newtComponent co, struct newtExitStruct * es); void newtDrawForm(newtComponent form); void newtFormAddHotKey(newtComponent co, int key); +int newtFormGetScrollPosition(newtComponent co); +void newtFormSetScrollPosition(newtComponent co, int position); typedef int (*newtEntryFilter)(newtComponent entry, void * data, int ch, int cursor);