15 #define GETTEXT_DOMAIN "wesnoth-lib" 47 , can_wrap_(builder.wrap)
48 , characters_per_line_(builder.characters_per_line)
49 , link_aware_(builder.link_aware)
50 , link_color_(
color_t::from_hex_string("ffff00"))
51 , can_shrink_(builder.can_shrink)
54 connect_signal<event::LEFT_BUTTON_CLICK>(
56 connect_signal<event::RIGHT_BUTTON_CLICK>(
58 connect_signal<event::MOUSE_MOTION>(
60 connect_signal<event::MOUSE_LEAVE>(
137 if (link.length() == 0) {
141 DBG_GUI_E <<
"Clicked Link:\"" << link <<
"\"\n";
153 DBG_GUI_E <<
"label right click" << std::endl;
166 if (link.length() == 0) {
170 DBG_GUI_E <<
"Right Clicked Link:\"" << link <<
"\"\n";
181 DBG_GUI_E <<
"label mouse motion" << std::endl;
199 DBG_GUI_E <<
"label mouse leave" << std::endl;
229 DBG_GUI_P <<
"Parsing label " <<
id <<
'\n';
231 load_resolutions<resolution>(cfg);
236 , link_color(cfg[
"link_color"].empty() ?
color_t::from_hex_string(
"ffff00") :
color_t::from_rgba_string(cfg[
"link_color"].str()))
239 state.emplace_back(cfg.
child(
"state_enabled"));
240 state.emplace_back(cfg.
child(
"state_disabled"));
248 builder_label::builder_label(
const config& cfg)
250 , wrap(cfg[
"wrap"].to_bool())
251 , characters_per_line(cfg[
"characters_per_line"])
253 , can_shrink(cfg[
"can_shrink"].to_bool(false))
254 , link_aware(cfg[
"link_aware"].to_bool(false))
268 DBG_GUI_G <<
"Window builder: placed label '" <<
id <<
"' with definition '" Define the common log macros for the gui toolkit.
Base class of a resolution, contains the common keys for a resolution.
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.
config & child(config_key_type key, int n=0)
Returns the nth child with the given key, or a reference to an invalid config if there is none...
std::vector< state_definition > state
virtual bool get_link_aware() const override
See styled_widget::get_link_aware.
color_t link_color_
What color links will be rendered in.
void set(CURSOR_TYPE type)
Use the default parameter to reset cursors.
void signal_handler_mouse_leave(bool &handled)
Mouse leave signal handler: checks if the cursor left a hyperlink.
void signal_handler_mouse_motion(bool &handled, const point &coordinate)
Mouse motion signal handler: checks if the cursor is on a hyperlink.
A label displays a text, the text can be wrapped but no scrollbars are provided.
PangoAlignment decode_text_alignment(const std::string &alignment)
Converts a text alignment string to a text alignment.
static std::string _(const char *str)
unsigned short text_alpha_
void signal_handler_right_button_click(bool &handled)
Right click signal handler: checks if we clicked on a hyperlink, copied to clipboard.
constexpr bool open_object_is_supported()
Returns whether open_object() is supported/implemented for the current platform.
Desktop environment interaction functions.
This file contains the settings handling of the widget library.
void set_text_alpha(unsigned short alpha)
Shows a yes and no button.
void set_link_color(const color_t &color)
state_t state_
Current state of the widget.
bool link_aware_
Whether the label is link aware, rendering links with special formatting and handling click events...
bool open_object([[maybe_unused]] const std::string &path_or_url)
void signal_handler_left_button_click(bool &handled)
Left click signal handler: checks if we clicked on a hyperlink.
state_t
Possible states of the widget.
resolution(const config &cfg)
virtual void update_canvas() override
See styled_widget::update_canvas.
PangoAlignment text_alignment
point get_mouse_position()
Returns the current mouse position.
void copy_to_clipboard(const std::string &text, const bool)
Copies text to the clipboard.
const uint8_t ALPHA_OPAQUE
virtual bool get_active() const override
See styled_widget::get_active.
void set_state(const state_t state)
virtual widget * build() const override
label_definition(const config &cfg)
Dialog was closed with the OK button.
map_location coordinate
Contains an x and y coordinate used for starting positions in maps.
A config object defines a single node in a WML file, with access to child nodes.
void update_mouse_cursor(bool enable)
Implementation detail for (re)setting the hyperlink cursor.
virtual void set_active(const bool active) override
See styled_widget::set_active.
void set_link_aware(bool l)
Contains the implementation details for lexical_cast and shouldn't be used directly.