]> git.ipfire.org Git - thirdparty/newt.git/commitdiff
add newtFormGet/SetScrollPosition
authorDan Winship <danw@gnome.org>
Wed, 30 Oct 2013 14:47:32 +0000 (10:47 -0400)
committerMiroslav Lichvar <mlichvar@redhat.com>
Thu, 21 Nov 2013 15:02:06 +0000 (16:02 +0100)
form.c
newt.0.52.ver
newt.h

diff --git a/form.c b/form.c
index 215c2954ceb49c53762c7d94b4e32eb4e5ae0a86..2930f9f2642500434055e47f26e8c973007a8720 100644 (file)
--- 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;
index 8dd5012d8c0b3a37f42e9f59f85a02f49bc55486..33190ef3d4aa83c570cd634e36bc0b8edd71c586 100644 (file)
@@ -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 9f73006929d73b0727314f9ec3fba04ebc0e0385..0070c7129a360cd33c12e20132f046b7a25ad691 100644 (file)
--- 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);