summaryrefslogtreecommitdiff
path: root/framebuffer/fbtk/scroll.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2014-07-26 22:12:55 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2014-07-26 22:12:55 +0100
commit31def6a33878b1ca8f5340d30708c853cdafefa1 (patch)
treee8ec8b84db672163a1a01ee93937adefe6b1cc57 /framebuffer/fbtk/scroll.c
parent989e82544e3a5b2f74216e91d269e3572c8053ce (diff)
downloadnetsurf-31def6a33878b1ca8f5340d30708c853cdafefa1.tar.gz
netsurf-31def6a33878b1ca8f5340d30708c853cdafefa1.tar.bz2
Add rudimentary support for resizing.
- Currently only libnsfb's SDL surface supports resizing. - Flickers like crazy while resizing. Possibly because the SDL surface is not set to use double buffering. - The internal widget library, fbtk, was never intended for this, as such it has no knowledge of how a widget should be positioned with respect to its parent. This means the top level window has to track everything and move them itself.
Diffstat (limited to 'framebuffer/fbtk/scroll.c')
-rw-r--r--framebuffer/fbtk/scroll.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/framebuffer/fbtk/scroll.c b/framebuffer/fbtk/scroll.c
index 0ce56a6ee..e91c3ef6e 100644
--- a/framebuffer/fbtk/scroll.c
+++ b/framebuffer/fbtk/scroll.c
@@ -18,6 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <assert.h>
+
#include <stdbool.h>
#include <libnsfb.h>
@@ -272,6 +274,26 @@ fbtk_create_vscroll(fbtk_widget_t *parent,
return neww;
}
+
+/* exported function documented in fbtk.h */
+void
+fbtk_reposition_vscroll(fbtk_widget_t *vscroll,
+ int x,
+ int y,
+ int width,
+ int height)
+{
+ assert(vscroll->type == FB_WIDGET_TYPE_VSCROLL);
+
+ fbtk_set_pos_and_size(vscroll, x, y + scrollu.height,
+ width, height - scrollu.height - scrolld.height);
+ fbtk_set_pos_and_size(vscroll->u.scroll.btnul,
+ x, y, width, scrollu.height);
+ fbtk_set_pos_and_size(vscroll->u.scroll.btndr,
+ x, y + height - scrolld.height,
+ width, scrolld.height);
+}
+
/* Horizontal scroll widget */
static int
@@ -488,6 +510,25 @@ fbtk_create_hscroll(fbtk_widget_t *parent,
return neww;
}
+/* exported function documented in fbtk.h */
+void
+fbtk_reposition_hscroll(fbtk_widget_t *scrollh,
+ int x,
+ int y,
+ int width,
+ int height)
+{
+ assert(scrollh->type == FB_WIDGET_TYPE_HSCROLL);
+
+ fbtk_set_pos_and_size(scrollh, x + scrolll.width, y,
+ width - scrolll.width - scrollr.width, height);
+ fbtk_set_pos_and_size(scrollh->u.scroll.btnul,
+ x, y, scrolll.width, height);
+ fbtk_set_pos_and_size(scrollh->u.scroll.btndr,
+ x + width - scrollr.width, y,
+ scrollr.width, height);
+}
+
/* exported function documented in fbtk.h */
bool