From 66d0f14b32d11042872f6bfe33152521bf470e6a Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Tue, 14 Jun 2016 12:39:54 +0100 Subject: move the public form API --- desktop/selection.c | 2 +- desktop/textinput.c | 2 +- frontends/amiga/selectmenu.c | 2 +- frontends/beos/scaffolding.cpp | 6 ++-- frontends/cocoa/FormSelectMenu.m | 2 +- frontends/gtk/window.c | 2 +- frontends/riscos/save.c | 2 +- frontends/riscos/window.c | 2 +- include/netsurf/form.h | 77 ++++++++++++++++++++++++++++++++++++++++ render/form.c | 8 ++--- render/form.h | 76 --------------------------------------- render/form_internal.h | 4 +-- 12 files changed, 93 insertions(+), 92 deletions(-) create mode 100644 include/netsurf/form.h delete mode 100644 render/form.h diff --git a/desktop/selection.c b/desktop/selection.c index b2c7837c5..7506af0ef 100644 --- a/desktop/selection.c +++ b/desktop/selection.c @@ -31,8 +31,8 @@ #include "utils/log.h" #include "utils/utf8.h" #include "utils/utils.h" +#include "netsurf/form.h" #include "render/box.h" -#include "render/form.h" #include "render/html_internal.h" #include "render/font.h" #include "render/textplain.h" diff --git a/desktop/textinput.c b/desktop/textinput.c index 0e98e03d5..d4a8bf8b4 100644 --- a/desktop/textinput.c +++ b/desktop/textinput.c @@ -33,8 +33,8 @@ #include "utils/talloc.h" #include "utils/utf8.h" #include "utils/utils.h" +#include "netsurf/form.h" #include "render/box.h" -#include "render/form.h" #include "render/html_internal.h" #include "render/layout.h" diff --git a/frontends/amiga/selectmenu.c b/frontends/amiga/selectmenu.c index ffd48032e..f3a11b67a 100644 --- a/frontends/amiga/selectmenu.c +++ b/frontends/amiga/selectmenu.c @@ -28,7 +28,7 @@ #include "utils/errors.h" #include "utils/log.h" #include "utils/messages.h" -#include "render/form.h" +#include "netsurf/form.h" #include "netsurf/mouse.h" #include "amiga/gui.h" diff --git a/frontends/beos/scaffolding.cpp b/frontends/beos/scaffolding.cpp index b3e4293df..8f3baacb1 100644 --- a/frontends/beos/scaffolding.cpp +++ b/frontends/beos/scaffolding.cpp @@ -57,19 +57,19 @@ extern "C" { #include "utils/utils.h" #include "utils/log.h" #include "utils/nsurl.h" +#include "utils/nsoption.h" #include "netsurf/netsurf.h" #include "netsurf/plotters.h" #include "netsurf/clipboard.h" #include "netsurf/content.h" #include "netsurf/content_type.h" -#include "desktop/browser_history.h" #include "netsurf/browser_window.h" +#include "netsurf/form.h" +#include "desktop/browser_history.h" #include "desktop/version.h" #include "desktop/searchweb.h" #include "desktop/search.h" -#include "utils/nsoption.h" #include "desktop/textinput.h" -#include "render/form.h" } #include "beos/about.h" diff --git a/frontends/cocoa/FormSelectMenu.m b/frontends/cocoa/FormSelectMenu.m index ab8add9cb..3ffd4cb48 100644 --- a/frontends/cocoa/FormSelectMenu.m +++ b/frontends/cocoa/FormSelectMenu.m @@ -21,7 +21,7 @@ #import "utils/utils.h" #import "netsurf/browser_window.h" -#import "render/form.h" +#import "netsurf/form.h" static inline NSRect cocoa_rect_for_control( struct browser_window *bw, struct form_control *control) { diff --git a/frontends/gtk/window.c b/frontends/gtk/window.c index a98d529c2..b4af64821 100644 --- a/frontends/gtk/window.c +++ b/frontends/gtk/window.c @@ -41,9 +41,9 @@ #include "netsurf/mouse.h" #include "netsurf/window.h" #include "netsurf/plotters.h" +#include "netsurf/form.h" #include "desktop/searchweb.h" #include "desktop/textinput.h" -#include "render/form.h" #include "gtk/window.h" #include "gtk/selection.h" diff --git a/frontends/riscos/save.c b/frontends/riscos/save.c index af74b51b0..37474b85c 100644 --- a/frontends/riscos/save.c +++ b/frontends/riscos/save.c @@ -46,12 +46,12 @@ #include "netsurf/window.h" #include "netsurf/bitmap.h" #include "netsurf/content.h" +#include "netsurf/form.h" #include "desktop/hotlist.h" #include "desktop/global_history.h" #include "desktop/version.h" #include "desktop/save_complete.h" #include "desktop/save_text.h" -#include "render/form.h" #include "riscos/bitmap.h" #include "riscos/dialog.h" diff --git a/frontends/riscos/window.c b/frontends/riscos/window.c index 152bff351..fe36da527 100644 --- a/frontends/riscos/window.c +++ b/frontends/riscos/window.c @@ -58,11 +58,11 @@ #include "netsurf/window.h" #include "netsurf/bitmap.h" #include "netsurf/url_db.h" +#include "netsurf/form.h" #include "desktop/browser_history.h" #include "desktop/cookie_manager.h" #include "desktop/scrollbar.h" #include "desktop/textinput.h" -#include "render/form.h" #include "riscos/bitmap.h" #include "riscos/buffer.h" diff --git a/include/netsurf/form.h b/include/netsurf/form.h new file mode 100644 index 000000000..bffa13e29 --- /dev/null +++ b/include/netsurf/form.h @@ -0,0 +1,77 @@ +/* + * Copyright 2003 Phil Mellor + * Copyright 2003 James Bursa + * Copyright 2009 Paul Blokus + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * NetSurf is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * NetSurf is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file + * Form handling public interface. + */ + +#ifndef _NETSURF_FORM_H_ +#define _NETSURF_FORM_H_ + +struct form_control; +struct rect; + +/** Option in a select. */ +struct form_option { + void *node; /**< Corresponding DOM node */ + bool selected; + bool initial_selected; + char *value; + char *text; /**< NUL terminated. */ + struct form_option* next; +}; + +/** + * Process a selection from a form select menu. + * + * \param control form control with menu. + * \param item index of item selected from the menu. + */ +nserror form_select_process_selection(struct form_control *control, int item); + +/** + * get a form select menus option. + * + * \param control The form control. + * \param item The index of the menu entry to return. + * \return The form option at that index. + */ +struct form_option *form_select_get_option(struct form_control *control, int item); + +/** + * Get a form control name + * + * \param control The form control + * \return The form control name + */ +char *form_control_get_name(struct form_control *control); + + +/** + * Get a form control bounding rectangle + * + * \param[in] control The form control + * \param[out] r The rectangle to place the bounds in. + * \return NSERROR_OK on success or error code. + */ +nserror form_control_bounding_rect(struct form_control *control, struct rect *r); + +#endif diff --git a/render/form.c b/render/form.c index a9944265f..f8d0ce5fd 100644 --- a/render/form.c +++ b/render/form.c @@ -1402,7 +1402,7 @@ static nserror form__select_process_selection(html_content *html, return ret; } -/* exported interface documented in render/form.h */ +/* exported interface documented in netsurf/form.h */ nserror form_select_process_selection(struct form_control *control, int item) { assert(control != NULL); @@ -1410,7 +1410,7 @@ nserror form_select_process_selection(struct form_control *control, int item) return form__select_process_selection(control->html, control, item); } -/* exported interface documented in render/form.h */ +/* exported interface documented in netsurf/form.h */ struct form_option * form_select_get_option(struct form_control *control, int item) { @@ -1424,13 +1424,13 @@ form_select_get_option(struct form_control *control, int item) return opt; } -/* exported interface documented in render/form.h */ +/* exported interface documented in netsurf/form.h */ char *form_control_get_name(struct form_control *control) { return control->name; } -/* exported interface documented in render/form.h */ +/* exported interface documented in netsurf/form.h */ nserror form_control_bounding_rect(struct form_control *control, struct rect *r) { box_bounds( control->box, r ); diff --git a/render/form.h b/render/form.h deleted file mode 100644 index 744ac32e7..000000000 --- a/render/form.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2003 Phil Mellor - * Copyright 2003 James Bursa - * Copyright 2009 Paul Blokus - * - * This file is part of NetSurf, http://www.netsurf-browser.org/ - * - * NetSurf is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * NetSurf is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** \file - * Form handling functions (interface). - */ - -#ifndef _NETSURF_RENDER_FORM_H_ -#define _NETSURF_RENDER_FORM_H_ - -struct form_control; -struct rect; - -/** Option in a select. */ -struct form_option { - void *node; /**< Corresponding DOM node */ - bool selected; - bool initial_selected; - char *value; - char *text; /**< NUL terminated. */ - struct form_option* next; -}; - -/** - * Process a selection from a form select menu. - * - * \param control form control with menu. - * \param item index of item selected from the menu. - */ -nserror form_select_process_selection(struct form_control *control, int item); - -/** - * get a form select menus option. - * - * \param control The form control. - * \param item The index of the menu entry to return. - * \return The form option at that index. - */ -struct form_option *form_select_get_option(struct form_control *control, int item); - -/** - * Get a form control name - * - * \param control The form control - * \return The form control name - */ -char *form_control_get_name(struct form_control *control); - - -/** - * Get a form control bounding rectangle - * - * \param[in] control The form control - * \param[out] r The rectangle to place the bounds in. - * \return NSERROR_OK on success or error code. - */ -nserror form_control_bounding_rect(struct form_control *control, struct rect *r); - -#endif diff --git a/render/form_internal.h b/render/form_internal.h index ea46b6a78..0ffb6b46c 100644 --- a/render/form_internal.h +++ b/render/form_internal.h @@ -24,10 +24,10 @@ #ifndef _NETSURF_RENDER_FORM_INTERNAL_H_ #define _NETSURF_RENDER_FORM_INTERNAL_H_ -#include "render/form.h" - #include +#include "netsurf/form.h" + struct box; struct form_control; struct form_option; -- cgit v1.2.3