16 #define GETTEXT_DOMAIN "wesnoth-lib"
35 #define ERR_HP LOG_STREAM(err, log_help)
36 #define WRN_HP LOG_STREAM(warn, log_help)
37 #define DBG_HP LOG_STREAM(debug, log_help)
57 if(initial_topic_.compare(0, 2,
"..") == 0) {
58 initial_topic_.replace(0, 2,
"+");
60 initial_topic_.insert(0,
"-");
67 tree_view& topic_tree = find_widget<tree_view>(
"topic_tree");
69 button& back_button = find_widget<button>(
"back");
70 button& next_button = find_widget<button>(
"next");
72 rich_label& topic_text = find_widget<rich_label>(
"topic_text");
79 toggle_button& contents = find_widget<toggle_button>(
"contents");
86 if ((
parent !=
nullptr) && (win_w == 0)) {
96 topic_text.
set_width(win_w - (is_contents_visible ? 0 : tree_w) - 20 );
122 tree_view& topic_tree = find_widget<tree_view>(
"topic_tree");
132 bool topics_added =
false;
139 if (subtopics_added || (match(section.
id) || match(section.
title))) {
140 if (!filter_text.empty()) {
145 find_widget<tree_view>(
"topic_tree").remove_node(§ion_node);
150 if ((match(topic.
id) || match(topic.
title)) && (topic.
id.compare(0, 2,
"..") != 0)) {
165 item[
"label"] = topic_title;
166 data.emplace(
"topic_name", item);
169 new_node.
set_id(std::string(expands ?
"+" :
"-") + topic_id);
176 if(topic_id.empty()) {
180 if(topic_id[0] ==
'+') {
181 topic_id.replace(topic_id.begin(), topic_id.begin() + 1, 2,
'.');
184 if(topic_id[0] ==
'-') {
185 topic_id.erase(topic_id.begin(), topic_id.begin() + 1);
192 ERR_HP <<
"Help browser tried to show topic with id '" << topic_id
193 <<
"' but that topic could not be found." << std::endl;
197 DBG_HP <<
"Showing topic: " << topic->
id <<
": " << topic->
title;
202 item[
"label"] = topic->
title;
203 data.emplace(
"topic_title", item);
205 find_widget<label>(
"topic_title").set_label(topic->
title);
206 find_widget<rich_label>(
"topic_text").set_dom(topic->
text.
parsed_text());
209 scrollbar_panel& scroll = find_widget<scrollbar_panel>(
"topic_scroll_panel");
213 if (add_to_history) {
225 find_widget<button>(
"back").set_active(
history_pos_ != 0);
231 tree_view& topic_tree = find_widget<tree_view>(
"topic_tree");
233 if(topic_tree.
empty()) {
const help::section & toplevel_
std::string initial_topic_
void update_list(const std::string &)
bool add_topics_for_section(const help::section &parent_section, tree_view_node &parent_node, const std::string &filter_text="")
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_
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 set_width(const int width)
void register_link_callback(std::function< void(std::string)> link_handler)
A widget that allows the user to input text in single line.
void select_node(bool expand_parents=false)
void unfold(const bool recursive=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.
void add_to_keyboard_chain(widget *widget)
Adds the widget to the keyboard chain.
const config & parsed_text() const
static lg::log_domain log_help("help")
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
auto make_ci_matcher(std::string_view filter_text)
Returns a function which performs locale-aware case-insensitive search.
A section contains topics and sections along with title and ID.
A topic contains a title, an id and some text.