16 #define GETTEXT_DOMAIN "wesnoth-lib"
34 #define ERR_HP LOG_STREAM(err, log_help)
35 #define WRN_HP LOG_STREAM(warn, log_help)
36 #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");
73 panel& topic_panel = find_widget<panel>(
"topic_panel");
80 connect_signal<event::BACK_BUTTON_CLICK>([
this](
auto&&...) {
83 connect_signal<event::FORWARD_BUTTON_CLICK>([
this](
auto&&...) {
87 toggle_button& contents = find_widget<toggle_button>(
"contents");
89 contents.set_value(
true);
95 if ((
parent !=
nullptr) && (win_w == 0)) {
102 PLAIN_LOG <<
"RL init width: " << rl_init_w;
108 topic_text.
set_width(is_contents_visible ? win_w : rl_init_w);
132 <<
"' but that topic could not be found." << std::endl;
139 tree_view& topic_tree = find_widget<tree_view>(
"topic_tree");
149 bool topics_added =
false;
156 if (subtopics_added || (match(section.
id) || match(section.
title))) {
157 if (!filter_text.empty()) {
162 find_widget<tree_view>(
"topic_tree").remove_node(§ion_node);
167 if (topic.
id[0] ==
'.') {
171 if ((match(topic.
id) || match(topic.
title)) && (topic.
id.compare(0, 2,
"..") != 0)) {
186 item[
"label"] = topic_title;
187 data.emplace(
"topic_name", item);
190 new_node.
set_id(std::string(expands ?
"+" :
"-") + topic_id);
199 find_widget<rich_label>(
"topic_text").set_dom(topic->
text.
parsed_text());
210 if(topic_id[0] ==
'+') {
211 topic_id.replace(topic_id.begin(), topic_id.begin() + 1, 2,
'.');
214 if(topic_id[0] ==
'-') {
215 topic_id.erase(topic_id.begin(), topic_id.begin() + 1);
222 ERR_HP <<
"Help browser tried to show topic with id '" << topic_id
223 <<
"' but that topic could not be found." << std::endl;
227 DBG_HP <<
"Showing topic: " << topic->
id <<
": " << topic->
title;
229 std::string topic_id_temp = topic->
id;
230 if(topic_id_temp.compare(0, 2,
"..") == 0) {
231 topic_id_temp.replace(0, 2,
"+");
233 topic_id_temp.insert(0,
"-");
235 tree_view& topic_tree = find_widget<tree_view>(
"topic_tree");
239 find_widget<label>(
"topic_title").set_label(topic->
title);
240 find_widget<rich_label>(
"topic_text").set_dom(topic->
text.
parsed_text());
257 find_widget<button>(
"back").set_active(
history_pos_ != 0);
263 tree_view& topic_tree = find_widget<tree_view>(
"topic_tree");
265 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="")
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)
void show_topic(std::string topic_id, bool add_to_history=true, bool reshow=false)
std::string current_topic_
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, bool fire_event=true)
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.