16 #define GETTEXT_DOMAIN "wesnoth-lib"
45 , can_wrap_(builder.wrap)
46 , characters_per_line_(builder.characters_per_line)
47 , link_aware_(builder.link_aware)
48 , link_color_(
color_t::from_hex_string("ffff00"))
49 , can_shrink_(builder.can_shrink)
52 connect_signal<event::LEFT_BUTTON_CLICK>(
54 connect_signal<event::RIGHT_BUTTON_CLICK>(
56 connect_signal<event::MOUSE_MOTION>(
58 connect_signal<event::MOUSE_LEAVE>(
135 if (link.length() == 0) {
139 DBG_GUI_E <<
"Clicked Link:\"" << link <<
"\"";
164 if (link.length() == 0) {
168 DBG_GUI_E <<
"Right Clicked Link:\"" << link <<
"\"";
229 load_resolutions<resolution>(cfg);
234 , link_color(cfg[
"link_color"].empty() ?
color_t::from_hex_string(
"ffff00") :
color_t::from_rgba_string(cfg[
"link_color"].str()))
246 builder_label::builder_label(
const config& cfg)
248 , wrap(cfg[
"wrap"].to_bool())
249 , characters_per_line(cfg[
"characters_per_line"].to_unsigned())
251 , can_shrink(cfg[
"can_shrink"].to_bool(false))
252 , link_aware(cfg[
"link_aware"].to_bool(false))
258 auto lbl = std::make_unique<label>(*
this);
264 lbl->set_link_color(conf->link_color);
266 DBG_GUI_G <<
"Window builder: placed label '" <<
id <<
"' with definition '"
A config object defines a single node in a WML file, with access to child nodes.
@ yes_no_buttons
Shows a yes and no button.
@ auto_close
Enables auto close.
unsigned short text_alpha_
virtual bool get_link_aware() const override
See styled_widget::get_link_aware.
void signal_handler_left_button_click(bool &handled)
Left click signal handler: checks if we clicked on a hyperlink.
void set_link_color(const color_t &color)
void signal_handler_mouse_leave(bool &handled)
Mouse leave signal handler: checks if the cursor left a hyperlink.
color_t link_color_
What color links will be rendered in.
void signal_handler_right_button_click(bool &handled)
Right click signal handler: checks if we clicked on a hyperlink, copied to clipboard.
bool link_aware_
Whether the label is link aware, rendering links with special formatting and handling click events.
virtual void update_canvas() override
See styled_widget::update_canvas.
void set_state(const state_t state)
state_t
Possible states of the widget.
virtual bool get_active() const override
See styled_widget::get_active.
state_t state_
Current state of the widget.
virtual void set_active(const bool active) override
See styled_widget::set_active.
void update_mouse_cursor(bool enable)
Implementation detail for (re)setting the hyperlink cursor.
void set_link_aware(bool l)
void set_text_alpha(unsigned short alpha)
void signal_handler_mouse_motion(bool &handled, const point &coordinate)
Mouse motion signal handler: checks if the cursor is on a hyperlink.
constexpr uint8_t ALPHA_OPAQUE
static std::string _(const char *str)
Define the common log macros for the gui toolkit.
std::string label
What to show in the filter's drop-down list.
void set(CURSOR_TYPE type)
Use the default parameter to reset cursors.
void copy_to_clipboard(const std::string &text)
Copies text to the clipboard.
bool open_object([[maybe_unused]] const std::string &path_or_url)
constexpr bool open_object_is_supported()
Returns whether open_object() is supported/implemented for the current platform.
point get_mouse_position()
Returns the current mouse position.
PangoAlignment decode_text_alignment(const std::string &alignment)
Converts a text alignment string to a text alignment.
void show_message(const std::string &title, const std::string &msg, const std::string &button_caption, const bool auto_close, const bool message_use_markup, const bool title_use_markup)
Shows a message to the user.
@ OK
Dialog was closed with the OK button.
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.
Desktop environment interaction functions.
The basic class for representing 8-bit RGB or RGBA colour values.
virtual std::unique_ptr< widget > build() const override
PangoAlignment text_alignment
resolution(const config &cfg)
label_definition(const config &cfg)
std::vector< state_definition > state
std::string missing_mandatory_wml_tag(const std::string §ion, const std::string &tag)
Returns a standard message for a missing wml child (tag).
Add a special kind of assert to validate whether the input from WML doesn't contain any problems that...
#define VALIDATE_WML_CHILD(cfg, key, message)