From 3f395ec3bf1e439eaa95f22219fce2f6e37c292f Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Mon, 21 Nov 2011 09:09:28 +0000 Subject: Committing textarea_set_dimensions patch from Ole Loots. svn path=/trunk/netsurf/; revision=13160 --- desktop/textarea.c | 15 +++++++++++++++ desktop/textarea.h | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/desktop/textarea.c b/desktop/textarea.c index ccde1d976..1e94c7f1b 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -1444,3 +1444,18 @@ void textarea_get_dimensions(struct text_area *ta, int *width, int *height) if (height != NULL) *height = ta->vis_height; } + +/** + * Set the dimensions of a textarea, causing a reflow and + * emitting a redraw request. + * + * \param width the new width of the textarea + * \param height the new height of the textarea + */ +void textarea_set_dimensions(struct text_area *ta, int width, int height) +{ + ta->vis_width = width; + ta->vis_height = height; + textarea_reflow(ta, 0); + ta->redraw_request(ta->data, 0, 0, ta->vis_width, ta->vis_height); +} diff --git a/desktop/textarea.h b/desktop/textarea.h index d8ec5c588..1cbe5fa43 100644 --- a/desktop/textarea.h +++ b/desktop/textarea.h @@ -54,6 +54,6 @@ bool textarea_mouse_action(struct text_area *ta, browser_mouse_state mouse, bool textarea_drag_end(struct text_area *ta, browser_mouse_state mouse, int x, int y); void textarea_get_dimensions(struct text_area *ta, int *width, int *height); - +void textarea_set_dimensions(struct text_area *ta, int width, int height); #endif -- cgit v1.2.3