16 #define GETTEXT_DOMAIN "wesnoth-lib"
36 #ifdef GUI2_EXPERIMENTAL_LISTBOX
37 #include "gui/widgets/list.hpp"
59 if(initial_topic_.compare(0, 2,
"..") == 0) {
60 initial_topic_.replace(0, 2,
"+");
62 initial_topic_.insert(0,
"-");
69 tree_view& topic_tree = find_widget<tree_view>(
"topic_tree");
71 button& back_button = find_widget<button>(
"back");
72 button& next_button = find_widget<button>(
"next");
74 rich_label& topic_text = find_widget<rich_label>(
"topic_text");
81 toggle_button& contents = find_widget<toggle_button>(
"contents");
120 if(topic.
id.compare(0, 2,
"..") != 0) {
132 item[
"label"] = topic_title;
133 data.emplace(
"topic_name", item);
136 new_node.
set_id(std::string(expands ?
"+" :
"-") + topic_id);
142 if(topic_id.empty()) {
146 if(topic_id[0] ==
'+') {
147 topic_id.replace(topic_id.begin(), topic_id.begin() + 1, 2,
'.');
150 if(topic_id[0] ==
'-') {
151 topic_id.erase(topic_id.begin(), topic_id.begin() + 1);
158 ERR_GUI_P <<
"Help browser tried to show topic with id '" << topic_id
159 <<
"' but that topic could not be found." << std::endl;
166 item[
"label"] = topic->
title;
167 data.emplace(
"topic_title", item);
169 find_widget<label>(
"topic_title").set_label(topic->
title);
170 find_widget<rich_label>(
"topic_text").set_topic(topic);
173 scrollbar_panel& scroll = find_widget<scrollbar_panel>(
"topic_scroll_panel");
177 if (add_to_history) {
185 find_widget<button>(
"back").set_active(
history_pos_ != 0);
192 tree_view& topic_tree = find_widget<tree_view>(
"topic_tree");
194 if(topic_tree.
empty()) {
202 find_widget<toggle_button>(
"contents").set_value(
false);
const help::section & toplevel_
std::string initial_topic_
void show_topic(std::string topic_id, bool add_to_history=true)
std::map< std::string, int > parsed_pages_
virtual void pre_show() override
Actions to be taken before showing the window.
void on_history_navigate(bool backwards)
tree_view_node & add_topic(const std::string &topic_id, const std::string &topic_title, bool expands, tree_view_node &parent)
std::vector< std::string > history_
void add_topics_for_section(const help::section &parent_section, tree_view_node &parent_node)
Abstract base class for all modal dialogs.
A rich_label takes marked up text and shows it correctly formatted and wrapped but no scrollbars are ...
void register_link_callback(std::function< void(std::string)> link_handler)
void select_node(bool expand_parents=false)
const tree_view_node & get_root_node() const
tree_view_node * selected_item()
void keyboard_capture(widget *widget)
void invalidate_layout()
Updates the size of the window.
Standard logging facilities (interface).
REGISTER_DIALOG(editor_edit_unit)
void connect_signal_notify_modified(dispatcher &dispatcher, const signal_notification &signal)
Connects a signal handler for getting a notification upon modification.
void connect_signal_mouse_left_click(dispatcher &dispatcher, const signal &signal)
Connects a signal handler for a left mouse button click.
std::map< std::string, widget_item > widget_data
std::map< std::string, t_string > widget_item
const topic * find_topic(const section &sec, const std::string &id)
Search for the topic with the specified identifier in the section and its subsections.
const std::string default_show_topic
point window_size()
Returns the size of the window in display units / screen coordinates.
This file contains the settings handling of the widget library.
A section contains topics and sections along with title and ID.
A topic contains a title, an id and some text.