Refactor image loading to a separate class. Add dependency to curl
[claws.git] / src / plugins / litehtml_viewer / lh_widget.h
1 #include <gtk/gtk.h>
2 #include <glib.h>
3 #include <gio/gio.h>
4
5 #include "container_linux.h"
6
7 #define HTTP_GET_TIMEOUT 5L
8
9 class lh_widget : public container_linux
10 {
11         public:
12                 lh_widget();
13                 ~lh_widget();
14
15                 GtkWidget *get_widget() const;
16
17                 void set_caption(const litehtml::tchar_t* caption);
18                 void set_base_url(const litehtml::tchar_t* base_url);
19                 void on_anchor_click(const litehtml::tchar_t* url, const litehtml::element::ptr& el);
20                 void set_cursor(const litehtml::tchar_t* cursor);
21                 void import_css(litehtml::tstring& text, const litehtml::tstring& url, litehtml::tstring& baseurl);
22                 void get_client_rect(litehtml::position& client) const;
23                 GdkPixbuf *get_image(const litehtml::tchar_t* url, bool redraw_on_ready);
24
25                 gint height() const { return m_height; };
26                 void setHeight(gint height) { m_height = height; };
27                 void draw(cairo_t *cr);
28                 void redraw();
29                 void open_html(const gchar *contents);
30                 void clear();
31
32         private:
33                 void paint_white();
34                 GInputStream *load_url(const gchar *url, GError **error);
35
36                 litehtml::document::ptr m_html;
37                 gint m_rendered_width;
38                 GtkWidget *m_drawing_area;
39                 GtkWidget *m_scrolled_window;
40                 GtkWidget *m_viewport;
41                 litehtml::context m_context;
42                 gint m_height;
43
44 };