Subversion Repositories Kolibri OS

Rev

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

  1. /*
  2.  * Copyright 2009 Mark Benjamin <netsurf-browser.org.MarkBenjamin@dfgh.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. #ifndef _NETSURF_DESKTOP_SEARCH_H_
  20. #define _NETSURF_DESKTOP_SEARCH_H_
  21.  
  22. #include <ctype.h>
  23. #include <string.h>
  24.  
  25. typedef enum {
  26.         SEARCH_FLAG_CASE_SENSITIVE = (1 << 0),
  27.         SEARCH_FLAG_FORWARDS = (1 << 1),
  28.         SEARCH_FLAG_SHOWALL = (1 << 2)
  29. } search_flags_t;
  30.  
  31. /**
  32.  * Change the displayed search status.
  33.  * \param found  search pattern matched in text
  34.  * \param p gui private data pointer provided with search callbacks
  35.  */
  36. typedef void (*gui_search_status)(bool found, void *p);
  37.  
  38. /**
  39.  * display hourglass while searching
  40.  * \param active start/stop indicator
  41.  * \param p gui private data pointer provided with search callbacks
  42.  */
  43. typedef void (*gui_search_hourglass)(bool active, void *p);
  44.  
  45. /**
  46.  * add search string to recent searches list
  47.  * front has full liberty how to implement the bare notification;
  48.  * core gives no guarantee of the integrity of the const char *
  49.  * \param string search pattern
  50.  * \param p gui private data pointer provided with search callbacks
  51.  */
  52. typedef void (*gui_search_add_recent)(const char *string, void *p);
  53.  
  54. /**
  55.  * activate search forwards button in gui
  56.  * \param active activate/inactivate
  57.  * \param p gui private data pointer provided with search callbacks
  58.  */
  59. typedef void (*gui_search_forward_state)(bool active, void *p);
  60.  
  61. /**
  62.  * activate search back button in gui
  63.  * \param active activate/inactivate
  64.  * \param p gui private data pointer provided with search callbacks
  65.  */
  66. typedef void (*gui_search_back_state)(bool active, void *p);
  67.  
  68. struct gui_search_callbacks {
  69.         gui_search_forward_state        forward_state;
  70.         gui_search_back_state           back_state;
  71.         gui_search_status               status;
  72.         gui_search_hourglass            hourglass;
  73.         gui_search_add_recent           add_recent;
  74. };
  75.  
  76.  
  77. bool browser_window_search_create_context(struct browser_window *bw,
  78.                 struct gui_search_callbacks *gui_callbacks, void *gui_p);
  79. void browser_window_search_destroy_context(struct browser_window *bw);
  80. bool browser_window_search_verify_new(struct browser_window *bw,
  81.                 struct gui_search_callbacks *gui_callbacks, void *gui_p);
  82. void browser_window_search_step(struct browser_window *bw,
  83.                 search_flags_t flags, const char *string);
  84. void browser_window_search_show_all(bool all, struct browser_window *bw);
  85.  
  86. #endif
  87.