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.
25 #include "container_linux.h"
29 PangoFontDescription
*font
;
34 class lh_widget
: public container_linux
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
);
60 void open_html(const gchar
*contents
);
62 void update_cursor(const litehtml::tchar_t
* cursor
);
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
;
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
;
88 litehtml::element::ptr m_over_element
;
89 gboolean m_showing_url
;
91 cairo_t
*m_cairo_context
;
93 litehtml::tchar_t
*m_font_name
;
95 std::atomic
<bool> m_force_render
;
96 std::atomic
<bool> m_blank
;