update copyright year
[claws.git] / src / plugins / litehtml_viewer / lh_widget.h
index da2dc7fb18c5218ff4a4fe5cc1ea326f670b2fe1..495412bf1a6a580797351c9178d96047b92ff3c8 100644 (file)
@@ -1,9 +1,36 @@
+/*
+ * Claws Mail -- A GTK based, lightweight, and fast e-mail client
+ * Copyright(C) 2019 the Claws Mail Team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write tothe Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
 #include <gtk/gtk.h>
 #include <glib.h>
 #include <gio/gio.h>
+#include <atomic>
+
+#include "procmime.h"
 
 #include "container_linux.h"
 
+struct pango_font
+{
+       PangoFontDescription *font;
+       bool underline;
+       bool strikethrough;
+};
+
 class lh_widget : public container_linux
 {
        public:
@@ -13,44 +40,52 @@ class lh_widget : public container_linux
                GtkWidget *get_widget() const;
 
                /* Methods that litehtml calls */
-               void set_caption(const litehtml::tchar_t* caption);
-               void set_base_url(const litehtml::tchar_t* base_url);
-               void on_anchor_click(const litehtml::tchar_t* url, const litehtml::element::ptr& el);
-               void set_cursor(const litehtml::tchar_t* cursor);
-               void import_css(litehtml::tstring& text, const litehtml::tstring& url, litehtml::tstring& baseurl);
+               void set_caption(const char *caption);
+               void set_base_url(const char *base_url);
+               void on_anchor_click(const char *url, const litehtml::element::ptr& el);
+               void set_cursor(const char *cursor);
+               void import_css(litehtml::string& text, const litehtml::string& url, litehtml::string& baseurl);
                void get_client_rect(litehtml::position& client) const;
-               inline const litehtml::tchar_t *get_default_font_name() const { return m_font_name; };
+               inline const char *get_default_font_name() const { return m_font_name; };
+
                inline int get_default_font_size() const { return m_font_size; };
-               GdkPixbuf *get_image(const litehtml::tchar_t* url, bool redraw_on_ready);
 
                void draw(cairo_t *cr);
+               void rerender();
                void redraw();
                void open_html(const gchar *contents);
                void clear();
-               void update_cursor();
+               void update_cursor(const char *cursor);
                void update_font();
                void print();
 
-               const litehtml::tchar_t *get_href_at(const gint x, const gint y) const;
-               void popup_context_menu(const litehtml::tchar_t *url, GdkEventButton *event);
-               const litehtml::tstring fullurl(const litehtml::tchar_t *url) const;
+               const char *get_href_at(litehtml::element::const_ptr element);
+               void popup_context_menu(const char *url, GdkEventButton *event);
+               const litehtml::string fullurl(const char *url) const;
+
+               void set_partinfo(MimeInfo *partinfo);
+               GdkPixbuf *get_local_image(const litehtml::string url) const;
+
+               void set_cairo_context(cairo_t *cr);
 
                litehtml::document::ptr m_html;
-               litehtml::tstring m_clicked_url;
-               litehtml::tstring m_base_url;
+               litehtml::string m_clicked_url;
+               litehtml::string m_base_url;
 
        private:
-               void paint_white();
-
                gint m_rendered_width;
                GtkWidget *m_drawing_area;
                GtkWidget *m_scrolled_window;
                GtkWidget *m_viewport;
                GtkWidget *m_context_menu;
-               litehtml::context m_context;
                gint m_height;
-               litehtml::tstring m_cursor;
+               litehtml::element::const_ptr m_over_element;
+               gboolean m_showing_url;
+               MimeInfo *m_partinfo;
+               cairo_t *m_cairo_context;
 
-               litehtml::tchar_t *m_font_name;
+               char *m_font_name;
                int m_font_size;
+               std::atomic<bool> m_force_render;
+               std::atomic<bool> m_blank;
 };