30 struct builder_rich_label;
66 virtual void set_active(
const bool active)
override;
209 void add_image(
config& curr_item, std::string name, std::string align,
bool floating,
point& img_size);
210 void add_link(
config& curr_item, std::string name, std::string dest,
int img_width);
213 if (!key->
str().empty()) {
214 *key = key->
str() + suffix;
227 std::vector<std::pair<rect, std::string>>
links_;
248 static const std::string&
type();
303 virtual std::unique_ptr<widget>
build()
const override;
Variant for storing WML attributes.
std::string str(const std::string &fallback="") const
A config object defines a single node in a WML file, with access to child nodes.
point get_column_line(const point &position) const
Gets the column of line of the character at the position.
point get_cursor_position(const unsigned column, const unsigned line=0) const
Gets the location for the cursor, in drawing coordinates.
A rich_label takes marked up text and shows it correctly formatted and wrapped but no scrollbars are ...
point calculate_best_size() const override
See widget::calculate_best_size.
unsigned characters_per_line_
The maximum number of characters per line.
bool disable_click_dismiss() const override
Does the widget disable easy close?
void signal_handler_mouse_motion(bool &handled, const point &coordinate)
Mouse motion signal handler: checks if the cursor is on a hyperlink.
void set_can_wrap(const bool wrap)
void append_if_not_empty(config_attribute_value *key, std::string suffix)
state_t state_
Current state of the widget.
void set_state(const state_t state)
void add_text_with_attribute(config &curr_item, std::string text, std::string attr_name="", std::string extra_data="")
size_t get_split_location(std::string text, int img_height)
virtual bool get_active() const override
Gets the active state of the styled_widget.
bool can_wrap_
Holds the rich_label can wrap or not.
virtual color_t get_link_color() const override
Returns the color string to be used with links.
void set_width(unsigned width)
std::function< void(std::string)> link_handler_
const t_string & get_label() const
wfl::map_formula_callable setup_text_renderer(config text_cfg, unsigned width=0)
virtual unsigned get_state() const override
Returns the id of the state.
virtual void update_canvas() override
Updates the canvas(ses).
unsigned w_
Width and height of the canvas.
void add_link(config &curr_item, std::string name, std::string dest, int img_width)
void default_text_config(config *txt_ptr, t_string text="")
template for canvas text config
t_string unparsed_text_
The unparsed/raw text.
void signal_handler_mouse_leave(bool &handled)
Mouse leave signal handler: checks if the cursor left a hyperlink.
std::vector< std::pair< rect, std::string > > links_
link variables and functions
std::unique_ptr< image_shape > ishape_
virtual bool can_mouse_focus() const override
Whether the mouse move/click event go 'through' this widget.
unsigned short text_alpha_
virtual const std::string & get_control_type() const override
Inherited from styled_widget, implemented by REGISTER_WIDGET.
point get_image_size(config img_cfg)
void set_can_shrink(bool can_shrink)
point get_xy_from_offset(const unsigned offset) const
virtual void set_active(const bool active) override
Sets the styled_widget's state.
void add_image(config &curr_item, std::string name, std::string align, bool floating, point &img_size)
point get_text_size(config text_cfg, unsigned width=0)
size calculation functions
point get_column_line(const point &position) const
unsigned prev_blk_height_
Height of all previous blocks, combined.
state_t
Possible states of the widget.
void register_link_callback(std::function< void(std::string)> link_handler)
void signal_handler_left_button_click(bool &handled)
Left click signal handler: checks if we clicked on a hyperlink.
unsigned txt_height_
Height of current text block.
static const std::string & type()
Static type getter that does not rely on the widget being constructed.
bool link_aware_
Whether the rich_label is link aware, rendering links with special formatting and handling click even...
virtual unsigned get_characters_per_line() const override
Returns the number of characters per line.
virtual bool can_wrap() const override
Can the widget wrap.
void set_link_color(const color_t &color)
std::unique_ptr< text_shape > tshape_
shapes used for size calculation
unsigned padding_
Padding.
void set_link_aware(bool l)
virtual bool get_link_aware() const override
Returns whether the label should be link_aware, in in rendering and in searching for links with get_l...
rich_label(const implementation::builder_rich_label &builder)
virtual bool text_can_shrink() override
Inherited from styled_widget.
void add_text_with_attributes(config &curr_item, std::string text, std::vector< std::string > attr_names, std::vector< std::string > extra_data)
void set_text_alpha(unsigned short alpha)
color_t link_color_
What color links will be rendered in.
void set_label(const t_string &text) override
void update_mouse_cursor(bool enable)
Implementation detail for (re)setting the hyperlink cursor.
void set_characters_per_line(const unsigned characters_per_line)
config text_dom_
structure tree of the marked up text after parsing
void point(int x, int y)
Draw a single point.
pango_text & get_text_renderer()
Returns a reference to a static pango_text object.
Contains the implementation details for lexical_cast and shouldn't be used directly.
map_location coordinate
Contains an x and y coordinate used for starting positions in maps.
The basic class for representing 8-bit RGB or RGBA colour values.
virtual std::unique_ptr< widget > build() const override
builder_rich_label(const config &cfg)
PangoAlignment text_alignment
resolution(const config &cfg)
rich_label_definition(const config &cfg)