summaryrefslogtreecommitdiff
path: root/desktop/local_history.h
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2017-06-10 18:34:05 +0100
committerVincent Sanders <vince@kyllikki.org>2017-06-10 18:37:21 +0100
commit653ccb78a9d819d21dc8d3e6d57d724215f50605 (patch)
tree0490bc5d0e85dafdc59949a1f65f6724a5217029 /desktop/local_history.h
parent92ecc77768dc86ed6a8d2d9aa1b0f49567878b2c (diff)
downloadnetsurf-653ccb78a9d819d21dc8d3e6d57d724215f50605.tar.gz
netsurf-653ccb78a9d819d21dc8d3e6d57d724215f50605.tar.bz2
Split local history data from viewer in headers
This separates the local history data object API from the viewing API. It also changes the api to return nsurl references instead of strings.
Diffstat (limited to 'desktop/local_history.h')
-rw-r--r--desktop/local_history.h100
1 files changed, 77 insertions, 23 deletions
diff --git a/desktop/local_history.h b/desktop/local_history.h
index 2ce2a5c22..9bfe0f2c1 100644
--- a/desktop/local_history.h
+++ b/desktop/local_history.h
@@ -35,14 +35,15 @@ struct browser_window;
/**
* Initialise the local history.
*
- * This iterates through the URL database, generating the local history data,
- * and creates a treeview.
+ * This iterates through the history object of a browser window and
+ * creates tree of visited pages with thumbnails which may be selected
+ * to cause navigation.
*
* This must be called before any other local_history_* function.
*
- * \param cw_t Callback table for core_window containing the treeview.
- * \param core_window_handle The core_window in which the treeview is shown.
- * \param bw browser window to show history of.
+ * \param[in] cw_t Callback table for core_window containing the treeview.
+ * \param[in] core_window_handle The core_window in which the treeview is shown.
+ * \param[in] bw browser window to show history of.
* \param[out] session The created local history session context.
* \return NSERROR_OK on success and session set, appropriate error code otherwise
*/
@@ -54,12 +55,12 @@ nserror local_history_init(struct core_window_callback_table *cw_t,
/**
* Finalise the local history.
*
- * This destroys the local history treeview and the local history module's
- * internal data. After calling this if ocall history is required again,
- * local_history_init must be called.
+ * This destroys the local history view and the local history module's
+ * internal data. After calling this if local history is required again,
+ * local_history_init must be called to create a new session.
*
* \param session The local history session to finalise.
- * \return NSERROR_OK on success, appropriate error otherwise
+ * \return NSERROR_OK on success and session freed appropriate error otherwise
*/
nserror local_history_fini(struct local_history_session *session);
@@ -67,42 +68,49 @@ nserror local_history_fini(struct local_history_session *session);
/**
* Redraw the local history.
*
- * \param session The local history session context.
- * \param x X coordinate to render history at
- * \param y Y coordinate to render history at
- * \param clip Current clip rectangle (wrt tree origin)
- * \param ctx Current redraw context
+ * Causes the local history viewer to issue plot operations to redraw
+ * the specified area of the viewport.
+ *
+ * \param[in] session The local history session context.
+ * \param[in] x X coordinate to render history at
+ * \param[in] y Y coordinate to render history at
+ * \param[in] clip Current clip rectangle (wrt tree origin)
+ * \param[in] ctx Current redraw context
*/
nserror local_history_redraw(struct local_history_session *session, int x, int y, struct rect *clip, const struct redraw_context *ctx);
+
/**
* Handles all kinds of mouse action
*
- * \param session The local history session context.
- * \param mouse The current mouse state
- * \param x X coordinate
- * \param y Y coordinate
+ * \param[in] session The local history session context.
+ * \param[in] mouse The current mouse state
+ * \param[in] x The current mouse X coordinate
+ * \param[in] y The current mouse Y coordinate
*/
void local_history_mouse_action(struct local_history_session *session, enum browser_mouse_state mouse, int x, int y);
+
/**
* Key press handling.
*
- * \param session The local history session context.
- * \param key The ucs4 character codepoint
+ * \param[in] session The local history session context.
+ * \param[in] key The ucs4 character codepoint
* \return true if the keypress is dealt with, false otherwise.
*/
bool local_history_keypress(struct local_history_session *session, uint32_t key);
+
/**
* Change the browser window to draw local history for.
*
- * \param session The local history session context.
+ * \param[in] session The local history session context.
* \param bw browser window to show history of.
* \return NSERROR_OK or appropriate error code.
*/
nserror local_history_set(struct local_history_session *session, struct browser_window *bw);
+
/**
* get size of local history content area.
*
@@ -113,6 +121,7 @@ nserror local_history_set(struct local_history_session *session, struct browser_
*/
nserror local_history_get_size(struct local_history_session *session, int *width, int *height);
+
/**
* get url of entry at position in local history content area.
*
@@ -121,10 +130,55 @@ nserror local_history_get_size(struct local_history_session *session, int *width
* \param[in] session The local history session context.
* \param[in] x The x coordinate to get url of.
* \param[in] y The y coordinate to get url of.
- * \param[out] url_out string representation of the url at the coordinates.
+ * \param[out] url_out referenced url.
* \return NSERROR_OK and url_out updated or NSERROR_NOT_FOUND if no url at
* location.
*/
-nserror local_history_get_url(struct local_history_session *session, int x, int y, const char **url_out);
+nserror local_history_get_url(struct local_history_session *session, int x, int y, struct nsurl **url_out);
+
+
+/* depricated local history viewing interfaces */
+
+/**
+ * Get the dimensions of a history.
+ *
+ * \param bw browser window with history object.
+ * \param width updated to width
+ * \param height updated to height
+ */
+void browser_window_history_size(struct browser_window *bw, int *width, int *height);
+
+/**
+ * Redraw part of a history area.
+ *
+ * \param bw browser window with history object.
+ * \param clip redraw area
+ * \param x start X co-ordinate on plot canvas
+ * \param y start Y co-ordinate on plot canvas
+ * \param ctx current redraw context
+ */
+bool browser_window_history_redraw_rectangle(struct browser_window *bw, struct rect *clip, int x, int y, const struct redraw_context *ctx);
+
+/**
+ * Handle a mouse click in a history.
+ *
+ * \param bw browser window containing history
+ * \param x click coordinate
+ * \param y click coordinate
+ * \param new_window open a new window instead of using bw
+ * \return true if action was taken, false if click was not on an entry
+ */
+bool browser_window_history_click(struct browser_window *bw, int x, int y, bool new_window);
+
+/**
+ * Determine the URL of the entry at a position.
+ *
+ * \param bw browser window containing history
+ * \param x x coordinate.
+ * \param y y coordinate.
+ * \return nsurl at position or NULL if no entry.
+ */
+struct nsurl *browser_window_history_position_url(struct browser_window *bw, int x, int y);
+
#endif