The Battle for Wesnoth 1.21.0-dev
 
Loading...
Searching...
No Matches
help_browser.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2017 - 2025
3 by Charles Dang <exodia339@gmail.com>
4 Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY.
12
13 See the COPYING file for more details.
14*/
15
16#pragma once
17
19#include "help/help_impl.hpp"
20#include <map>
21#include <vector>
22
23class config;
25
26namespace help {
27 struct section;
28}
29
30namespace gui2
31{
32class tree_view_node;
33
34namespace dialogs
35{
36
37/** Help browser dialog. */
39{
40public:
41 help_browser(const help::section& toplevel, const std::string& initial = "");
42
44
45private:
46 std::string initial_topic_;
47 std::string current_topic_;
49
50 std::map<std::string, int> parsed_pages_;
51
52 std::vector<std::string> history_;
53 std::size_t history_pos_;
54
55 virtual const std::string& window_id() const override;
56
57 virtual void pre_show() override;
58
59 void on_topic_select();
60 void on_history_navigate(bool backwards);
61
62 void update_list(const std::string&);
63 bool add_topics_for_section(const help::section& parent_section, tree_view_node& parent_node, const std::string& filter_text = "");
64 tree_view_node& add_topic(const std::string& topic_id, const std::string& topic_title,
65 bool expands, tree_view_node& parent);
66 void show_topic(std::string topic_id, bool add_to_history = true, bool reshow = false);
67};
68
69} // namespace dialogs
70} // namespace gui2
A config object defines a single node in a WML file, with access to child nodes.
Definition config.hpp:157
A class grating read only view to a vector of config objects, viewed as one config with all children ...
Help browser dialog.
const help::section & toplevel_
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)
virtual const std::string & window_id() const override
The ID of the window to build.
std::vector< std::string > history_
Abstract base class for all modal dialogs.
widget * parent()
Definition widget.cpp:170
#define DEFINE_SIMPLE_DISPLAY_WRAPPER(dialog)
Adds a bare-bones static display function to a dialog class that immediately invokes the dialogs's mo...
Various uncategorised dialogs.
Generic file dialog.
A section contains topics and sections along with title and ID.