/
help_browser.hpp
73 lines (53 loc) · 1.69 KB
/
help_browser.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
Copyright (C) 2017 by Charles Dang <exodia339@gmail.com>
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY.
See the COPYING file for more details.
*/
#ifndef GUI_DIALOGS_HELP_BROWSER_HPP_INCLUDED
#define GUI_DIALOGS_HELP_BROWSER_HPP_INCLUDED
#include "gui/dialogs/modal_dialog.hpp"
#include <map>
#include <list>
class config;
class CVideo;
namespace help {
struct section;
}
namespace gui2
{
class tree_view_node;
namespace dialogs
{
/** Help browser dialog. */
class help_browser : public modal_dialog
{
public:
help_browser();
static void display(CVideo& video)
{
help_browser().show(video);
}
private:
std::string initial_topic_;
std::map<std::string, int> parsed_pages_;
std::list<std::string> history_;
std::list<std::string>::const_iterator history_pos_;
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
virtual const std::string& window_id() const;
/** Inherited from modal_dialog. */
void pre_show(window& window);
void on_topic_select(window& window);
void on_history_navigate(window& window, bool backwards);
void add_topics_for_section(const help::section& parent_section, tree_view_node& parent_node);
tree_view_node& add_topic(const std::string& topic_id, const std::string& topic_title,
bool expands, tree_view_node& parent);
};
} // namespace dialogs
} // namespace gui2
#endif