Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * Copyright 2006 James Bursa <bursa@users.sourceforge.net>
  3.  *
  4.  * This file is part of NetSurf, http://www.netsurf-browser.org/
  5.  *
  6.  * NetSurf is free software; you can redistribute it and/or modify
  7.  * it under the terms of the GNU General Public License as published by
  8.  * the Free Software Foundation; version 2 of the License.
  9.  *
  10.  * NetSurf is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  * GNU General Public License for more details.
  14.  *
  15.  * You should have received a copy of the GNU General Public License
  16.  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  17.  */
  18.  
  19. /** \file
  20.  * Browser history tree (interface).
  21.  */
  22.  
  23. #ifndef _NETSURF_DESKTOP_HISTORY_H_
  24. #define _NETSURF_DESKTOP_HISTORY_H_
  25.  
  26. #include <stdbool.h>
  27.  
  28. struct hlcache_handle;
  29. struct history;
  30. struct browser_window;
  31. struct history_entry;
  32. struct redraw_context;
  33.  
  34. struct history *history_create(void);
  35. struct history *history_clone(struct history *history);
  36. void history_add(struct history *history, struct hlcache_handle *content,
  37.                 const char *frag_id);
  38. void history_update(struct history *history, struct hlcache_handle *content);
  39. void history_destroy(struct history *history);
  40. void history_back(struct browser_window *bw, struct history *history);
  41. void history_forward(struct browser_window *bw, struct history *history);
  42. bool history_back_available(struct history *history);
  43. bool history_forward_available(struct history *history);
  44. void history_size(struct history *history, int *width, int *height);
  45. bool history_redraw(struct history *history, const struct redraw_context *ctx);
  46. bool history_redraw_rectangle(struct history *history,
  47.                 int x0, int y0, int x1, int y1, int x, int y,
  48.                 const struct redraw_context *ctx);
  49. bool history_click(struct browser_window *bw, struct history *history,
  50.                 int x, int y, bool new_window);
  51. const char *history_position_url(struct history *history, int x, int y);
  52.  
  53. /**
  54.  * Callback function type for history enumeration
  55.  *
  56.  * \param       history                 history being enumerated
  57.  * \param       x0, y0, x1, y1  Coordinates of entry in history tree view
  58.  * \param       entry                   Current history entry
  59.  * \return      true to continue enumeration, false to cancel enumeration
  60.  */
  61. typedef bool (*history_enumerate_cb)(const struct history *history, int x0, int y0,
  62.          int x1, int y1,
  63.          const struct history_entry *entry, void *user_data);
  64.  
  65. /**
  66.  * Enumerate all entries in the history.
  67.  * Do not change the history while it is being enumerated.
  68.  *
  69.  * \param       history         history to enumerate
  70.  * \param       cb                      callback function
  71.  * \param       user_data       context pointer passed to cb
  72.  */
  73. void history_enumerate(const struct history *history, history_enumerate_cb cb, void *user_data);
  74.  
  75. /**
  76.  * Enumerate all entries that will be reached by the 'forward' button
  77.  *
  78.  * \param       history         The history object to enumerate in
  79.  * \param       cb                      The callback function
  80.  * \param       user_data       Data passed to the callback
  81.  */
  82. void history_enumerate_forward( struct history *history,
  83.                 history_enumerate_cb cb, void *user_data );
  84.  
  85. /**
  86.  * Enumerate all entries that will be reached by the 'back' button
  87.  *
  88.  * \param       history         The history object to enumerate in
  89.  * \param       cb                      The callback function
  90.  * \param       user_data       Data passed to the callback
  91.  */
  92. void history_enumerate_back( struct history *history,
  93.                 history_enumerate_cb cb, void *user_data );
  94.  
  95. /**
  96.  * Returns the URL to a history entry
  97.  *
  98.  * \param       entry           the history entry to retrieve the URL from
  99.  * \return      the URL
  100.  */
  101. const char *history_entry_get_url(const struct history_entry *entry);
  102.  
  103. /**
  104.  * Returns the URL to a history entry
  105.  *
  106.  * \param       entry           the history entry to retrieve the fragment id from
  107.  * \return      the fragment id
  108.  */
  109. const char *history_entry_get_fragment_id(const struct history_entry *entry);
  110.  
  111. /**
  112.  * Returns the title of a history entry
  113.  *
  114.  * \param       entry           the history entry to retrieve the title from
  115.  * \return      the title
  116.  */
  117. const char *history_entry_get_title(const struct history_entry *entry);
  118.  
  119. /**
  120.  * Open a history entry in the specified browser window
  121.  *
  122.  * \param  bw          browser window
  123.  * \param  history     history containing entry
  124.  * \param  entry       entry to open
  125.  * \param  new_window  open entry in new window
  126.  */
  127. void history_go(struct browser_window *bw, struct history *history,
  128.                                 struct history_entry *entry, bool new_window);
  129.  
  130. #endif
  131.