1 #ifndef LH_DOCUMENT_CONTAINER_H
2 #define LH_DOCUMENT_CONTAINER_H
7 #include "background.h"
19 list_style_type marker_type
;
26 // call back interface to draw text, images and other elements
27 class document_container
30 virtual litehtml::uint_ptr
create_font(const char* faceName
, int size
, int weight
, litehtml::font_style italic
, unsigned int decoration
, litehtml::font_metrics
* fm
) = 0;
31 virtual void delete_font(litehtml::uint_ptr hFont
) = 0;
32 virtual int text_width(const char* text
, litehtml::uint_ptr hFont
) = 0;
33 virtual void draw_text(litehtml::uint_ptr hdc
, const char* text
, litehtml::uint_ptr hFont
, litehtml::web_color color
, const litehtml::position
& pos
) = 0;
34 virtual int pt_to_px(int pt
) const = 0;
35 virtual int get_default_font_size() const = 0;
36 virtual const char* get_default_font_name() const = 0;
37 virtual void draw_list_marker(litehtml::uint_ptr hdc
, const litehtml::list_marker
& marker
) = 0;
38 virtual void load_image(const char* src
, const char* baseurl
, bool redraw_on_ready
) = 0;
39 virtual void get_image_size(const char* src
, const char* baseurl
, litehtml::size
& sz
) = 0;
40 // Note: regular <img> images are also drawn with draw_background
41 // bg is guaranteed to have at least one item.
42 // backgrounds in bg are in CSS order - the last one is the farthest from the user.
43 // only the last background has valid background-color.
44 virtual void draw_background(litehtml::uint_ptr hdc
, const std::vector
<litehtml::background_paint
>& bg
) = 0;
45 virtual void draw_borders(litehtml::uint_ptr hdc
, const litehtml::borders
& borders
, const litehtml::position
& draw_pos
, bool root
) = 0;
47 virtual void set_caption(const char* caption
) = 0;
48 virtual void set_base_url(const char* base_url
) = 0;
49 virtual void link(const std::shared_ptr
<litehtml::document
>& doc
, const litehtml::element::ptr
& el
) = 0;
50 virtual void on_anchor_click(const char* url
, const litehtml::element::ptr
& el
) = 0;
51 virtual void set_cursor(const char* cursor
) = 0;
52 virtual void transform_text(litehtml::string
& text
, litehtml::text_transform tt
) = 0;
53 virtual void import_css(litehtml::string
& text
, const litehtml::string
& url
, litehtml::string
& baseurl
) = 0;
54 virtual void set_clip(const litehtml::position
& pos
, const litehtml::border_radiuses
& bdr_radius
) = 0;
55 virtual void del_clip() = 0;
56 virtual void get_client_rect(litehtml::position
& client
) const = 0;
57 virtual litehtml::element::ptr
create_element( const char* tag_name
,
58 const litehtml::string_map
& attributes
,
59 const std::shared_ptr
<litehtml::document
>& doc
) = 0;
61 virtual void get_media_features(litehtml::media_features
& media
) const = 0;
62 virtual void get_language(litehtml::string
& language
, litehtml::string
& culture
) const = 0;
63 virtual litehtml::string
resolve_color(const litehtml::string
& /*color*/) const { return litehtml::string(); }
64 virtual void split_text(const char* text
, const std::function
<void(const char*)>& on_word
, const std::function
<void(const char*)>& on_space
);
67 ~document_container() = default;
71 #endif // LH_DOCUMENT_CONTAINER_H