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)
45 , max_size_(
point(0,0))
47 connect_signal<event::LEFT_BUTTON_DOWN>(
77 return widget->get_value();
101 widget->set_use_markup(use_markup);
137 if (
widget->get_cursor_pos().x < visible_area.w/2.0) {
143 if (
widget->get_cursor_pos().y >= (
widget->get_text_end_pos().y - visible_area.h/2.0)) {
144 if (
widget->get_lines_count() > 1) {
149 }
else if (
widget->get_cursor_pos().y < visible_area.h/2.0) {
155 if (
widget->get_length() == 0) {
221 load_resolutions<resolution>(cfg);
232 grid = std::make_shared<builder_grid>(child);
240 builder_scroll_text::builder_scroll_text(
const config& cfg)
245 , editable(cfg[
"editable"].to_bool(true))
259 auto widget = std::make_unique<scroll_text>(*
this);
269 widget->init_grid(*conf->grid);
272 DBG_GUI_G <<
"Window builder: placed scroll text '" <<
id
273 <<
"' 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.
A label displays text that can be wrapped but no scrollbars are provided.
Base class for a multiline text area.
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_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_use_markup(bool use_markup) override
See styled_widget::set_use_markup.
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)
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
const PangoAlignment text_alignment
scrollbar_container::scrollbar_mode vertical_scrollbar_mode
virtual std::unique_ptr< widget > build() const override
Base class of a resolution, contains the common keys for a resolution.
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)