From 44c5aef1c8a79a3a9afbd472d1f6e6e238c8ed5c Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 1 Mar 2017 23:30:29 +0000 Subject: make scrollbar redraw signal errors correctly allow scrollbar redraw to return error codes and update documentation commenst appropriately. --- desktop/scrollbar.h | 88 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 53 insertions(+), 35 deletions(-) (limited to 'desktop/scrollbar.h') diff --git a/desktop/scrollbar.h b/desktop/scrollbar.h index d277be26c..f7153318f 100644 --- a/desktop/scrollbar.h +++ b/desktop/scrollbar.h @@ -16,12 +16,13 @@ * along with this program. If not, see . */ -/** \file - * Scrollbar widget (interface). +/** + * \file + * Scrollbar widget interface. */ -#ifndef _NETSURF_DESKTOP_SCROLLBAR_H_ -#define _NETSURF_DESKTOP_SCROLLBAR_H_ +#ifndef NETSURF_DESKTOP_SCROLLBAR_H +#define NETSURF_DESKTOP_SCROLLBAR_H #include #include @@ -36,16 +37,22 @@ struct scrollbar; +/** + * scrollbar message types + */ typedef enum { - SCROLLBAR_MSG_MOVED, /* the scroll value has changed */ - SCROLLBAR_MSG_SCROLL_START, /* a scrollbar drag has started, all - * mouse events should be passed to + SCROLLBAR_MSG_MOVED, /**< the scroll value has changed */ + SCROLLBAR_MSG_SCROLL_START, /**< a scrollbar drag has started, all + * mouse events should be passed to * the scrollbar regardless of the * coordinates */ - SCROLLBAR_MSG_SCROLL_FINISHED, /* cancel the above */ + SCROLLBAR_MSG_SCROLL_FINISHED, /**< cancel a scrollbar drag */ } scrollbar_msg; +/** + * scrollbar message context data + */ struct scrollbar_msg_data { struct scrollbar *scrollbar; scrollbar_msg msg; @@ -53,9 +60,30 @@ struct scrollbar_msg_data { int x0, y0, x1, y1; }; + +/** + * Scrollbar mouse input status flags + */ +typedef enum { + SCROLLBAR_MOUSE_NONE = 0, /**< Not relevant */ + SCROLLBAR_MOUSE_USED = (1 << 0), /**< Took action with input */ + SCROLLBAR_MOUSE_BOTH = (1 << 1), /**< Scrolling both bars */ + SCROLLBAR_MOUSE_UP = (1 << 2), /**< Hover: scroll up */ + SCROLLBAR_MOUSE_PUP = (1 << 3), /**< Hover: scroll page up */ + SCROLLBAR_MOUSE_VRT = (1 << 4), /**< Hover: vert. drag bar */ + SCROLLBAR_MOUSE_PDWN = (1 << 5), /**< Hover: scroll page down */ + SCROLLBAR_MOUSE_DWN = (1 << 6), /**< Hover: scroll down */ + SCROLLBAR_MOUSE_LFT = (1 << 7), /**< Hover: scroll left */ + SCROLLBAR_MOUSE_PLFT = (1 << 8), /**< Hover: scroll page left */ + SCROLLBAR_MOUSE_HRZ = (1 << 9), /**< Hover: horiz. drag bar */ + SCROLLBAR_MOUSE_PRGT = (1 << 10), /**< Hover: scroll page right */ + SCROLLBAR_MOUSE_RGT = (1 << 11) /**< Hover: scroll right */ +} scrollbar_mouse_status; + + /** * Client callback for the scrollbar. - * + * * \param client_data user data passed at scroll creation * \param scrollbar_data scrollbar message data */ @@ -84,7 +112,7 @@ nserror scrollbar_create(bool horizontal, int length, int full_size, /** * Destroy a scrollbar. * - * \param s the scrollbar to be destroyed + * \param s the scrollbar to be destroyed */ void scrollbar_destroy(struct scrollbar *s); @@ -97,9 +125,9 @@ void scrollbar_destroy(struct scrollbar *s); * \param clip the clipping rectangle * \param scale scale for the redraw * \param ctx current redraw context - * \return true on succes false otherwise + * \return NSERROR_OK on success otherwise error code */ -bool scrollbar_redraw(struct scrollbar *s, int x, int y, +nserror scrollbar_redraw(struct scrollbar *s, int x, int y, const struct rect *clip, float scale, const struct redraw_context *ctx); @@ -125,8 +153,8 @@ bool scrollbar_scroll(struct scrollbar *s, int change); /** * Get the current scroll offset to the visible part of the full area. * - * \param s the scrollbar to get the scroll offset value from - * \return current scroll offset + * \param s the scrollbar to get the scroll offset value from + * \return current scroll offset */ int scrollbar_get_offset(struct scrollbar *s); @@ -150,22 +178,6 @@ void scrollbar_set_extents(struct scrollbar *s, int length, */ bool scrollbar_is_horizontal(struct scrollbar *s); -/* Scrollbar mouse input status flags */ -typedef enum { - SCROLLBAR_MOUSE_NONE = 0, /**< Not relevant */ - SCROLLBAR_MOUSE_USED = (1 << 0), /**< Took action with input */ - SCROLLBAR_MOUSE_BOTH = (1 << 1), /**< Scrolling both bars */ - SCROLLBAR_MOUSE_UP = (1 << 2), /**< Hover: scroll up */ - SCROLLBAR_MOUSE_PUP = (1 << 3), /**< Hover: scroll page up */ - SCROLLBAR_MOUSE_VRT = (1 << 4), /**< Hover: vert. drag bar */ - SCROLLBAR_MOUSE_PDWN = (1 << 5), /**< Hover: scroll page down */ - SCROLLBAR_MOUSE_DWN = (1 << 6), /**< Hover: scroll down */ - SCROLLBAR_MOUSE_LFT = (1 << 7), /**< Hover: scroll left */ - SCROLLBAR_MOUSE_PLFT = (1 << 8), /**< Hover: scroll page left */ - SCROLLBAR_MOUSE_HRZ = (1 << 9), /**< Hover: horiz. drag bar */ - SCROLLBAR_MOUSE_PRGT = (1 << 10), /**< Hover: scroll page right */ - SCROLLBAR_MOUSE_RGT = (1 << 11) /**< Hover: scroll right */ -} scrollbar_mouse_status; /** * Handle mouse actions other then drag ends. @@ -179,6 +191,7 @@ typedef enum { scrollbar_mouse_status scrollbar_mouse_action(struct scrollbar *s, browser_mouse_state mouse, int x, int y); + /** * Get a status bar message from a scrollbar mouse input status. * @@ -187,6 +200,7 @@ scrollbar_mouse_status scrollbar_mouse_action(struct scrollbar *s, */ const char *scrollbar_mouse_status_to_message(scrollbar_mouse_status status); + /** * Handle end of mouse drags. * @@ -198,18 +212,21 @@ const char *scrollbar_mouse_status_to_message(scrollbar_mouse_status status); void scrollbar_mouse_drag_end(struct scrollbar *s, browser_mouse_state mouse, int x, int y); + /** * Called when the content is being dragged to the scrollbars have to adjust. + * * If the content has both scrollbars, and scrollbar_make_pair has beed called * before, only the one scroll which will receive further mouse events has to be * passed. * - * \param s one of the the scrollbars owned by the dragged content - * \param x X coordinate of mouse during drag start - * \param y Y coordinate of mouse during drag start + * \param s one of the the scrollbars owned by the dragged content + * \param x X coordinate of mouse during drag start + * \param y Y coordinate of mouse during drag start */ void scrollbar_start_content_drag(struct scrollbar *s, int x, int y); + /** * Connect a horizontal and a vertical scrollbar into a pair so that they * co-operate during 2D drags. @@ -220,11 +237,12 @@ void scrollbar_start_content_drag(struct scrollbar *s, int x, int y); void scrollbar_make_pair(struct scrollbar *horizontal, struct scrollbar *vertical); + /** * Get the scrollbar's client data * - * \param s the scrollbar to get the client data from - * \return client data + * \param s the scrollbar to get the client data from + * \return client data */ void *scrollbar_get_data(struct scrollbar *s); -- cgit v1.2.3