da2dc7fb18c5218ff4a4fe5cc1ea326f670b2fe1
[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 class lh_widget : public container_linux
8 {
9         public:
10                 lh_widget();
11                 ~lh_widget();
12
13                 GtkWidget *get_widget() const;
14
15                 /* Methods that litehtml calls */
16                 void set_caption(const litehtml::tchar_t* caption);
17                 void set_base_url(const litehtml::tchar_t* base_url);
18                 void on_anchor_click(const litehtml::tchar_t* url, const litehtml::element::ptr& el);
19                 void set_cursor(const litehtml::tchar_t* cursor);
20                 void import_css(litehtml::tstring& text, const litehtml::tstring& url, litehtml::tstring& baseurl);
21                 void get_client_rect(litehtml::position& client) const;
22                 inline const litehtml::tchar_t *get_default_font_name() const { return m_font_name; };
23                 inline int get_default_font_size() const { return m_font_size; };
24                 GdkPixbuf *get_image(const litehtml::tchar_t* url, bool redraw_on_ready);
25
26                 void draw(cairo_t *cr);
27                 void redraw();
28                 void open_html(const gchar *contents);
29                 void clear();
30                 void update_cursor();
31                 void update_font();
32                 void print();
33
34                 const litehtml::tchar_t *get_href_at(const gint x, const gint y) const;
35                 void popup_context_menu(const litehtml::tchar_t *url, GdkEventButton *event);
36                 const litehtml::tstring fullurl(const litehtml::tchar_t *url) const;
37
38                 litehtml::document::ptr m_html;
39                 litehtml::tstring m_clicked_url;
40                 litehtml::tstring m_base_url;
41
42         private:
43                 void paint_white();
44
45                 gint m_rendered_width;
46                 GtkWidget *m_drawing_area;
47                 GtkWidget *m_scrolled_window;
48                 GtkWidget *m_viewport;
49                 GtkWidget *m_context_menu;
50                 litehtml::context m_context;
51                 gint m_height;
52                 litehtml::tstring m_cursor;
53
54                 litehtml::tchar_t *m_font_name;
55                 int m_font_size;
56 };