From 5772d91183ad4f3a8dc1d5c469bc7d295764b80c Mon Sep 17 00:00:00 2001 From: defanor Date: Sat, 17 Aug 2019 23:22:42 +0300 Subject: Add the prototype --- src/browserbox.h | 133 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 src/browserbox.h (limited to 'src/browserbox.h') diff --git a/src/browserbox.h b/src/browserbox.h new file mode 100644 index 0000000..5016c67 --- /dev/null +++ b/src/browserbox.h @@ -0,0 +1,133 @@ +/* WWWLite, a lightweight web browser. + Copyright (C) 2019 defanor + + This program 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, either version 3 of the License, or + (at your option) any later version. + + This program 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 . +*/ + +#ifndef BROWSER_BOX_H +#define BROWSER_BOX_H + +#include +#include +#include "documentbox.h" +#include "inlinebox.h" +#include "blockbox.h" +#include + +G_BEGIN_DECLS + +typedef struct _FormField FormField; +struct _FormField +{ + gchar *name; + GtkWidget *widget; +}; + +enum { + ENCTYPE_URLENCODED, + ENCTYPE_MULTIPART, + ENCTYPE_PLAIN +}; + +typedef struct _Form Form; +struct _Form +{ + gchar *method; + int enctype; + SoupURI *action; + GList *fields; + gpointer *submission_data; +}; + +#define BUILDER_STATE_TYPE (builder_state_get_type()) +G_DECLARE_FINAL_TYPE (BuilderState, builder_state, BUILDER, STATE, GObject); + +struct _BuilderState +{ + GObject parent_instance; + gboolean active; + GtkWidget *root; + DocumentBox *docbox; + GtkWidget *vbox; + GSList *stack; + GdkRGBA link_color; + guint text_position; + PangoAttrList *current_attrs; + IBLink *current_link; + gchar *current_word; + gboolean ignore_text; + gboolean prev_space; + gboolean pre; + htmlParserCtxtPtr parser; + SoupURI *uri; + GSList *queued_identifiers; + GHashTable *identifiers; + gulong anchor_handler_id; + gchar *option_value; + GSList *ol_numbers; + Form *current_form; +}; + +#define BROWSER_BOX_TYPE (browser_box_get_type()) +#define BROWSER_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), BROWSER_BOX_TYPE, BrowserBox)) +#define BROWSER_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), BROWSER_BOX_TYPE, BrowserBoxClass)) +#define IS_BROWSER_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), BROWSER_BOX_TYPE)) +#define IS_BROWSER_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), BROWSER_BOX_TYPE)) + + +typedef struct _BrowserBox BrowserBox; +typedef struct _BrowserBoxClass BrowserBoxClass; + +struct _BrowserBox +{ + BlockBox parent_instance; + SoupSession *soup_session; + BuilderState *builder_state; + GtkWidget *address_bar; + GtkWidget *docbox_root; + GtkWidget *status_bar; + GList *forms; + GList *history; + GList *history_position; + GtkStack *tabs; + /* GHashTable *word_cache; */ +}; + +struct _BrowserBoxClass +{ + BlockBoxClass parent_class; +}; + +GType browser_box_get_type(void) G_GNUC_CONST; +BrowserBox *browser_box_new(gchar *uri_str); + +typedef struct _WordCacheKey WordCacheKey; +struct _WordCacheKey +{ + gchar *text; + PangoAttrList *attrs; +}; +guint wck_hash (WordCacheKey *wck); +gboolean wck_equal (WordCacheKey *wck1, WordCacheKey *wck2); + +void document_request_sm (BrowserBox *bb, SoupMessage *sm); +void document_request (BrowserBox *bb, SoupURI *uri); +gboolean history_back (BrowserBox *bb); +gboolean history_forward (BrowserBox *bb); + +GHashTable *word_cache; + +G_END_DECLS + +#endif -- cgit v1.2.3