The GtkHTML Library
<<< Previous Page | Home | Up | Next Page >>>

# GtkHTML widget

## Name

GtkHTML widget -- widget for rendering HTML

## Synopsis

    GtkWidget*  gtk_html_new                    (void);
    GtkWidget*  gtk_html_new_from_string        (const gchar *str,
                                                 gint len);
    void        gtk_html_construct              (GtkWidget *html);

    void        gtk_html_load_from_string       (GtkHTML *html,
                                                 const gchar *str,
                                                 gint len);
    GtkHTMLStream* gtk_html_begin               (GtkHTML *html);
    GtkHTMLStream* gtk_html_begin_content       (GtkHTML *html,
                                                 gchar *content_type);
    void        gtk_html_write                  (GtkHTML *html,
                                                 GtkHTMLStream *handle,
                                                 const gchar *buffer,
                                                 size_t size);
    void        gtk_html_end                    (GtkHTML *html,
                                                 GtkHTMLStream *handle,
                                                 GtkHTMLStreamStatus status);

    gboolean    gtk_html_save                   (GtkHTML *html,
                                                 GtkHTMLSaveReceiverFn receiver,
                                                 gpointer data);
    gboolean    gtk_html_export                 (GtkHTML *html,
                                                 const char *type,
                                                 GtkHTMLSaveReceiverFn receiver,
                                                 gpointer data);

    void        gtk_html_print                  (GtkHTML *html,
                                                 GnomePrintContext *print_context);
    void        gtk_html_print_with_header_footer
                                                (GtkHTML *html,
                                                 GnomePrintContext *print_context,
                                                 gdouble header_height,
                                                 gdouble footer_height,
                                                 GtkHTMLPrintCallback header_print,
                                                 GtkHTMLPrintCallback footer_print,
                                                 gpointer user_data);

    const gchar* gtk_html_get_title             (GtkHTML *html);
    gboolean    gtk_html_jump_to_anchor         (GtkHTML *html,
                                                 const gchar *anchor);
    void        gtk_html_set_default_background_color
                                                (GtkHTML *html,
                                                 GdkColor *c);
    void        gtk_html_set_default_content_type
                                                (GtkHTML *html,
                                                 gchar *content_type);
    void        gtk_html_allow_selection        (GtkHTML *html,
                                                 gboolean allow);
    gpointer    gtk_html_get_object_by_id       (GtkHTML *html,
                                                 const gchar *id);

## Object Hierarchy

      GtkObject
       +----GtkWidget
             +----GtkContainer
                   +----GtkLayout
                         +----GtkHTML

## Description

GtkHTML widget is lightweight HTML viewer / container. It provides an easy way for viewing HTML documents in your application and for layout UI of your application throught HTML.

## Details

### gtk_html_new ()

    GtkWidget*  gtk_html_new                    (void);

GtkHTML widget contructor. It creates an empty GtkHTML widget.

Returns : | A GtkHTML widget, newly created and empty.

### gtk_html_new_from_string ()

    GtkWidget*  gtk_html_new_from_string        (const gchar *str,
                                                 gint len);

GtkHTML widget constructor. It creates an new GtkHTML widget and loads HTML source from `str`. It is intended for simple creation. For more complicated loading you probably want to use GtkHTMLStream. See gtk_html_begin.

`str` : | A string containing HTML source.
`len` : | A length of `str`, if `len` == -1 then it will be computed using strlen.
Returns : | A GtkHTML widget, newly created, containing document loaded from input `str`.

### gtk_html_construct ()

    void        gtk_html_construct              (GtkWidget *html);

`html` : |

### gtk_html_load_from_string ()

    void        gtk_html_load_from_string       (GtkHTML *html,
                                                 const gchar *str,
                                                 gint len);

`html` : |
`str` : |
`len` : |

### gtk_html_begin ()

    GtkHTMLStream* gtk_html_begin               (GtkHTML *html);

Opens a new stream to load new content into the GtkHTML widget `html`.

`html` : | the html widget to operate on.
Returns : | a new GtkHTMLStream to store new content.

### gtk_html_begin_content ()

    GtkHTMLStream* gtk_html_begin_content       (GtkHTML *html,
                                                 gchar *content_type);

Opens a new stream to load new content of type `content_type` into the GtkHTML widget given in `html`.

`html` : | the html widget to operate on.
`content_type` : | a string listing the type of content to expect on the stream.
Returns : | a new GtkHTMLStream to store new content.

### gtk_html_write ()

    void        gtk_html_write                  (GtkHTML *html,
                                                 GtkHTMLStream *handle,
                                                 const gchar *buffer,
                                                 size_t size);

Writes `size` bytes of `buffer` to the stream pointed to by `stream`.

`html` : | the GtkHTML widget the stream belongs to (unused)
`handle` : | the GkHTMLStream to write to.
`buffer` : | the data to write to the stream.
`size` : | the length of data to read from `buffer`

### gtk_html_end ()

    void        gtk_html_end                    (GtkHTML *html,
                                                 GtkHTMLStream *handle,
                                                 GtkHTMLStreamStatus status);

Close the GtkHTMLStream represented by `stream` and notify `html` that is should not expect any more content from that stream.

`html` : | the GtkHTML widget the stream belongs to.
`handle` : | the GtkHTMLStream to close.
`status` : | the GtkHTMLStreamStatus representing the state of the stream when closed.

### gtk_html_save ()

    gboolean    gtk_html_save                   (GtkHTML *html,
                                                 GtkHTMLSaveReceiverFn receiver,
                                                 gpointer data);

`html` : |
`receiver` : |
`data` : |
Returns : |

### gtk_html_export ()

    gboolean    gtk_html_export                 (GtkHTML *html,
                                                 const char *type,
                                                 GtkHTMLSaveReceiverFn receiver,
                                                 gpointer data);

Export the current document into the content type given by `content_type`, by calling the function listed in `receiver` data becomes avaiable. When `receiver` is called `user_data` is passed in as the user_data parameter.

`html` : | the GtkHTML widget
`type` : |
`receiver` : |
`data` : |
Returns : | TRUE if the export was successfull, FALSE otherwise.

### gtk_html_print ()

    void        gtk_html_print                  (GtkHTML *html,
                                                 GnomePrintContext *print_context);

`html` : |
`print_context` : |

### gtk_html_print_with_header_footer ()

    void        gtk_html_print_with_header_footer
                                                (GtkHTML *html,
                                                 GnomePrintContext *print_context,
                                                 gdouble header_height,
                                                 gdouble footer_height,
                                                 GtkHTMLPrintCallback header_print,
                                                 GtkHTMLPrintCallback footer_print,
                                                 gpointer user_data);

`html` : |
`print_context` : |
`header_height` : |
`footer_height` : |
`header_print` : |
`footer_print` : |
`user_data` : |

### gtk_html_get_title ()

    const gchar* gtk_html_get_title             (GtkHTML *html);

Retrieve the title of the document currently loaded in the GtkHTML widget.

`html` : | The GtkHTML widget.
Returns : | the title of the current document

### gtk_html_jump_to_anchor ()

    gboolean    gtk_html_jump_to_anchor         (GtkHTML *html,
                                                 const gchar *anchor);

Scroll the document display to show the HTML anchor listed in `anchor`

`html` : | the GtkHTML widget.
`anchor` : | a string containing the name of the anchor.
Returns : | TRUE if the anchor is found, FALSE otherwise.

### gtk_html_set_default_background_color ()

    void        gtk_html_set_default_background_color
                                                (GtkHTML *html,
                                                 GdkColor *c);

`html` : |
`c` : |

### gtk_html_set_default_content_type ()

    void        gtk_html_set_default_content_type
                                                (GtkHTML *html,
                                                 gchar *content_type);

`html` : |
`content_type` : |

### gtk_html_allow_selection ()

    void        gtk_html_allow_selection        (GtkHTML *html,
                                                 gboolean allow);

`html` : |
`allow` : |

### gtk_html_get_object_by_id ()

    gpointer    gtk_html_get_object_by_id       (GtkHTML *html,
                                                 const gchar *id);

`html` : |
`id` : |
Returns : |

<<< Previous Page | Home | Up | Next Page >>>
API Reference | GtkHTMLEmbedded widget