From 68aeb65cdf4b25772be8142112cc1c00572d1629 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Mon, 6 Jul 2009 23:47:50 +0000 Subject: Merged revisions 8059-8359 via svnmerge from svn://svn.netsurf-browser.org/branches/paulblokus/textinput ........ r8337 | paulblokus | 2009-07-06 00:38:21 +0100 (Mon, 06 Jul 2009) | 2 lines added textarea_set_position ........ svn path=/trunk/netsurf/; revision=8360 --- desktop/textarea.c | 23 +++++++++++++++++++++++ desktop/textarea.h | 1 + 2 files changed, 24 insertions(+) diff --git a/desktop/textarea.c b/desktop/textarea.c index 3e0ce466a..20aaeed78 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -193,6 +193,25 @@ struct text_area *textarea_create(int x, int y, int width, int height, } +/** + * Change the position of a textarea. The text area is redrawn + * + * \param ta the textarea to change position of + * \param x X coordinate of the the new position + * \param y Y coordinate of the the new position + */ +void textarea_set_position(struct text_area *ta, int x, int y) +{ + ta->x = x; + ta->y = y; + ta->redraw_start_callback(ta->data); + textarea_redraw(ta, ta->x, ta->y, ta->x + ta->vis_width, + ta->y + ta->vis_height); + textarea_set_caret(ta, textarea_get_caret(ta)); + ta->redraw_start_callback(ta->data); +} + + /** * Destroy a text area * @@ -710,6 +729,10 @@ bool textarea_reflow(struct text_area *ta, unsigned int line) * Handle redraw requests for text areas * * \param redraw Redraw request block + * \param x0 left X coordinate of redraw area + * \param y0 top Y coordinate of redraw area + * \param x1 right X coordinate of redraw area + * \param y1 bottom Y coordinate of redraw area */ void textarea_redraw(struct text_area *ta, int x0, int y0, int x1, int y1) { diff --git a/desktop/textarea.h b/desktop/textarea.h index 4213a5484..06cd2b8ee 100644 --- a/desktop/textarea.h +++ b/desktop/textarea.h @@ -42,6 +42,7 @@ struct text_area *textarea_create(int x, int y, int width, int height, unsigned int flags, const struct css_style *style, textarea_start_redraw_callback redraw_start_callback, textarea_end_redraw_callback redraw_end_callback, void *data); +void textarea_set_position(struct text_area *ta, int x, int y); void textarea_destroy(struct text_area *ta); bool textarea_set_text(struct text_area *ta, const char *text); int textarea_get_text(struct text_area *ta, char *buf, unsigned int len); -- cgit v1.2.3