add support for Ayatana indicator to Notification plugin
[claws.git] / src / plugins / litehtml_viewer / lh_widget.h
blob495412bf1a6a580797351c9178d96047b92ff3c8
1 /*
2 * Claws Mail -- A GTK based, lightweight, and fast e-mail client
3 * Copyright(C) 2019 the Claws Mail Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write tothe Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 #include <gtk/gtk.h>
19 #include <glib.h>
20 #include <gio/gio.h>
21 #include <atomic>
23 #include "procmime.h"
25 #include "container_linux.h"
27 struct pango_font
29 PangoFontDescription *font;
30 bool underline;
31 bool strikethrough;
34 class lh_widget : public container_linux
36 public:
37 lh_widget();
38 ~lh_widget();
40 GtkWidget *get_widget() const;
42 /* Methods that litehtml calls */
43 void set_caption(const char *caption);
44 void set_base_url(const char *base_url);
45 void on_anchor_click(const char *url, const litehtml::element::ptr& el);
46 void set_cursor(const char *cursor);
47 void import_css(litehtml::string& text, const litehtml::string& url, litehtml::string& baseurl);
48 void get_client_rect(litehtml::position& client) const;
49 inline const char *get_default_font_name() const { return m_font_name; };
51 inline int get_default_font_size() const { return m_font_size; };
53 void draw(cairo_t *cr);
54 void rerender();
55 void redraw();
56 void open_html(const gchar *contents);
57 void clear();
58 void update_cursor(const char *cursor);
59 void update_font();
60 void print();
62 const char *get_href_at(litehtml::element::const_ptr element);
63 void popup_context_menu(const char *url, GdkEventButton *event);
64 const litehtml::string fullurl(const char *url) const;
66 void set_partinfo(MimeInfo *partinfo);
67 GdkPixbuf *get_local_image(const litehtml::string url) const;
69 void set_cairo_context(cairo_t *cr);
71 litehtml::document::ptr m_html;
72 litehtml::string m_clicked_url;
73 litehtml::string m_base_url;
75 private:
76 gint m_rendered_width;
77 GtkWidget *m_drawing_area;
78 GtkWidget *m_scrolled_window;
79 GtkWidget *m_viewport;
80 GtkWidget *m_context_menu;
81 gint m_height;
82 litehtml::element::const_ptr m_over_element;
83 gboolean m_showing_url;
84 MimeInfo *m_partinfo;
85 cairo_t *m_cairo_context;
87 char *m_font_name;
88 int m_font_size;
89 std::atomic<bool> m_force_render;
90 std::atomic<bool> m_blank;