Improve some sieve-related translations
[claws.git] / src / plugins / litehtml_viewer / lh_widget.h
blob4688de9fe01e95f7a16bfc40ef67ce4b89c8d5ca
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 litehtml::tchar_t* caption);
44 void set_base_url(const litehtml::tchar_t* base_url);
45 void on_anchor_click(const litehtml::tchar_t* url, const litehtml::element::ptr& el);
46 void set_cursor(const litehtml::tchar_t* cursor);
47 void import_css(litehtml::tstring& text, const litehtml::tstring& url, litehtml::tstring& baseurl);
48 void get_client_rect(litehtml::position& client) const;
49 inline const litehtml::tchar_t *get_default_font_name() const { return m_font_name; };
51 inline int get_default_font_size() const { return m_font_size; };
52 litehtml::uint_ptr create_font(const litehtml::tchar_t* faceName, int size, int weight, litehtml::font_style italic, unsigned int decoration, litehtml::font_metrics* fm);
53 void delete_font(litehtml::uint_ptr hFont);
54 int text_width(const litehtml::tchar_t* text, litehtml::uint_ptr hFont);
55 void draw_text(litehtml::uint_ptr hdc, const litehtml::tchar_t* text, litehtml::uint_ptr hFont, litehtml::web_color color, const litehtml::position& pos);
57 void draw(cairo_t *cr);
58 void rerender();
59 void redraw();
60 void open_html(const gchar *contents);
61 void clear();
62 void update_cursor(const litehtml::tchar_t* cursor);
63 void update_font();
64 void print();
66 const litehtml::tchar_t *get_href_at(litehtml::element::ptr element) const;
67 const litehtml::tchar_t *get_href_at(const gint x, const gint y) const;
68 void popup_context_menu(const litehtml::tchar_t *url, GdkEventButton *event);
69 const litehtml::tstring fullurl(const litehtml::tchar_t *url) const;
71 void set_partinfo(MimeInfo *partinfo);
72 GdkPixbuf *get_local_image(const litehtml::tstring url) const;
74 void set_cairo_context(cairo_t *cr);
76 litehtml::document::ptr m_html;
77 litehtml::tstring m_clicked_url;
78 litehtml::tstring m_base_url;
80 private:
81 gint m_rendered_width;
82 GtkWidget *m_drawing_area;
83 GtkWidget *m_scrolled_window;
84 GtkWidget *m_viewport;
85 GtkWidget *m_context_menu;
86 litehtml::context m_context;
87 gint m_height;
88 litehtml::element::ptr m_over_element;
89 gboolean m_showing_url;
90 MimeInfo *m_partinfo;
91 cairo_t *m_cairo_context;
93 litehtml::tchar_t *m_font_name;
94 int m_font_size;
95 std::atomic<bool> m_force_render;
96 std::atomic<bool> m_blank;