X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=blobdiff_plain;f=src%2Fplugins%2Flitehtml_viewer%2Flh_widget.h;h=9b95ef83beb6c80d842ba961c2df276e5f19ddd0;hp=0cb97c63956a1baf52d68f90fe3f252a569117fb;hb=HEAD;hpb=0a5c4155c189513caba6e2d79b1bf3b0643f169c diff --git a/src/plugins/litehtml_viewer/lh_widget.h b/src/plugins/litehtml_viewer/lh_widget.h index 0cb97c639..495412bf1 100644 --- a/src/plugins/litehtml_viewer/lh_widget.h +++ b/src/plugins/litehtml_viewer/lh_widget.h @@ -1,10 +1,35 @@ +/* + * 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 #include #include +#include + +#include "procmime.h" #include "container_linux.h" -#define HTTP_GET_TIMEOUT 5L +struct pango_font +{ + PangoFontDescription *font; + bool underline; + bool strikethrough; +}; class lh_widget : public container_linux { @@ -14,31 +39,53 @@ class lh_widget : public container_linux GtkWidget *get_widget() const; - 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); + /* Methods that litehtml calls */ + 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; - GdkPixbuf *get_image(const litehtml::tchar_t* url, bool redraw_on_ready); + inline const char *get_default_font_name() const { return m_font_name; }; + + inline int get_default_font_size() const { return m_font_size; }; - gint height() const { return m_height; }; - void setHeight(gint height) { m_height = height; }; void draw(cairo_t *cr); + void rerender(); void redraw(); void open_html(const gchar *contents); void clear(); + void update_cursor(const char *cursor); + void update_font(); + void print(); - private: - void paint_white(); - GInputStream *load_url(const gchar *url, GError **error); + 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::string m_clicked_url; + litehtml::string m_base_url; + + private: gint m_rendered_width; GtkWidget *m_drawing_area; GtkWidget *m_scrolled_window; GtkWidget *m_viewport; - litehtml::context m_context; + GtkWidget *m_context_menu; gint m_height; + litehtml::element::const_ptr m_over_element; + gboolean m_showing_url; + MimeInfo *m_partinfo; + cairo_t *m_cairo_context; + char *m_font_name; + int m_font_size; + std::atomic m_force_render; + std::atomic m_blank; };