summaryrefslogtreecommitdiff
path: root/desktop/textarea.h
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2013-01-29 17:34:08 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2013-01-29 17:34:08 +0000
commit93cc123200f1e4856ad5b5c608d8deeb34522053 (patch)
treea928ff03d0a1086901c259f9e148587ef4840347 /desktop/textarea.h
parent75a24f7838896910db7d0fa549d6101d9ad65719 (diff)
downloadnetsurf-93cc123200f1e4856ad5b5c608d8deeb34522053.tar.gz
netsurf-93cc123200f1e4856ad5b5c608d8deeb34522053.tar.bz2
Update textarea to inform client what it's doing with drags.
Now single callback for both redraw requests and drag reports. Update treeview to use new textarea API. Update Atari URL bar to use new textarea API. (Ignores drag reports, currently.) Minor textarea fixes.
Diffstat (limited to 'desktop/textarea.h')
-rw-r--r--desktop/textarea.h52
1 files changed, 33 insertions, 19 deletions
diff --git a/desktop/textarea.h b/desktop/textarea.h
index 7624c3187..fb8b13425 100644
--- a/desktop/textarea.h
+++ b/desktop/textarea.h
@@ -29,13 +29,37 @@
#include "desktop/browser.h"
#include "desktop/plot_style.h"
+
+struct textarea;
+
/* Text area flags */
-typedef enum textarea_flags {
+typedef enum {
TEXTAREA_DEFAULT = (1 << 0),
TEXTAREA_MULTILINE = (1 << 1),
TEXTAREA_READONLY = (1 << 2)
} textarea_flags;
+typedef enum {
+ TEXTAREA_DRAG_NONE,
+ TEXTAREA_DRAG_SCROLLBAR,
+ TEXTAREA_DRAG_SELECTION
+} textarea_drag_type;
+
+typedef enum {
+ TEXTAREA_MSG_DRAG_REPORT, /**< Textarea drag start/end report */
+ TEXTAREA_MSG_REDRAW_REQUEST /**< Textarea redraw request */
+} textarea_msg_type;
+
+struct textarea_msg {
+ struct textarea *ta;
+
+ textarea_msg_type type;
+ union {
+ textarea_drag_type drag;
+ struct rect redraw;
+ } data;
+};
+
typedef struct textarea_setup {
textarea_flags flags; /**< Setup flags */
@@ -56,11 +80,13 @@ typedef struct textarea_setup {
} textarea_setup;
-
-struct textarea;
-
-typedef void(*textarea_redraw_request_callback)(void *data, int x, int y,
- int width, int height);
+/**
+ * Client callback for the textarea
+ *
+ * \param data user data passed at textarea creation
+ * \param textarea_msg textarea message data
+ */
+typedef void(*textarea_client_callback)(void *data, struct textarea_msg *msg);
/**
* Create a text area
@@ -71,7 +97,7 @@ typedef void(*textarea_redraw_request_callback)(void *data, int x, int y,
* \return Opaque handle for textarea or 0 on error
*/
struct textarea *textarea_create(const textarea_setup *setup,
- textarea_redraw_request_callback redraw_request, void *data);
+ textarea_client_callback callback, void *data);
/**
* Destroy a text area
@@ -153,18 +179,6 @@ bool textarea_mouse_action(struct textarea *ta, browser_mouse_state mouse,
int x, int y);
/**
- * Handles the end of a drag operation
- *
- * \param ta Text area
- * \param mouse the mouse state at drag end moment
- * \param x X coordinate
- * \param y Y coordinate
- * \return true if drag end was handled false otherwise
- */
-bool textarea_drag_end(struct textarea *ta, browser_mouse_state mouse,
- int x, int y);
-
-/**
* Gets the dimensions of a textarea
*
* \param width if not NULL, gets updated to the width of the textarea