16 #define GETTEXT_DOMAIN "wesnoth-lib"
29 #define LOG_SCOPE_HEADER get_control_type() + " [" + id() + "] " + __func__
30 #define LOG_HEADER LOG_SCOPE_HEADER + ':'
43 , text_alignment_(builder.text_alignment)
44 , editable_(builder.editable)
45 , max_size_(
point(0,0))
46 , link_aware_(builder.link_aware)
48 connect_signal<event::LEFT_BUTTON_DOWN>(
72 widget->goto_start_of_data();
79 return widget->get_value();
139 if (
widget->get_cursor_pos().x < visible_area.w/2.0) {
145 if (
widget->get_cursor_pos().y >= (
widget->get_text_end_pos().y - visible_area.h/2.0)) {
146 if (
widget->get_lines_count() > 1) {
151 }
else if (
widget->get_cursor_pos().y < visible_area.h/2.0) {
157 if (
widget->get_length() == 0) {
223 load_resolutions<resolution>(cfg);
234 grid = std::make_shared<builder_grid>(child);
242 builder_scroll_text::builder_scroll_text(
const config& cfg)
247 , editable(cfg[
"editable"].to_bool(true))
248 , link_aware(cfg[
"link_aware"].to_bool(false))
262 auto widget = std::make_unique<scroll_text>(*
this);
270 widget->init_grid(*conf->grid);
273 DBG_GUI_G <<
"Window builder: placed scroll text '" <<
id
274 <<
"' with definition '" <<
definition <<
"'.";
A config object defines a single node in a WML file, with access to child nodes.
widget * find(const std::string &id, const bool must_be_active) override
See widget::find.
void set_link_aware(bool l)
void set_max_size(point max_size)
Sets the size of the text beyond which scrollbars should be visible.
void signal_handler_left_button_down(const event::ui_event event)
virtual unsigned get_state() const override
See styled_widget::get_state.
multiline_text * get_internal_text_box()
PangoAlignment text_alignment_
void set_link_aware(bool l)
void set_can_wrap(bool can_wrap)
void finalize_subclass() override
Function for the subclasses to do their setup.
virtual void set_label(const t_string &label) override
virtual void set_self_active(const bool active) override
See container_base::set_self_active.
void place(const point &origin, const point &size) override
See widget::place.
point calculate_best_size() const override
See widget::calculate_best_size.
virtual bool get_active() const override
See styled_widget::get_active.
state_t state_
Current state of the widget.
virtual void set_text_alignment(const PangoAlignment text_alignment) override
See styled_widget::set_text_alignment.
bool can_wrap() const override
See widget::can_wrap.
void set_editable(bool editable)
Set or unset whether text can be edited or not Text can only be copied and scrolled through when edit...
void keyboard_capture(widget *widget)
void point(int x, int y)
Draw a single point.
ui_event
The event sent to the dispatcher.
scrollbar_mode get_scrollbar_mode(const std::string &scrollbar_mode)
Returns the scrollbar mode flags.
PangoAlignment decode_text_alignment(const std::string &alignment)
Converts a text alignment string to a text alignment.
Contains the implementation details for lexical_cast and shouldn't be used directly.
std::size_t size(const std::string &str)
Length in characters of a UTF-8 string.
scrollbar_container::scrollbar_mode horizontal_scrollbar_mode
scrollbar_container::scrollbar_mode vertical_scrollbar_mode
virtual std::unique_ptr< widget > build() const override
std::vector< state_definition > state
resolution(const config &cfg)
scroll_text_definition(const config &cfg)
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)