The Battle for Wesnoth
1.19.3+dev
help
help_browser.hpp
Go to the documentation of this file.
1
/*
2
Copyright (C) 2003 - 2024
3
by David White <dave@whitevine.net>
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
18
#include <deque>
// for deque
19
#include <string>
// for string
20
#include <SDL2/SDL_events.h>
// for SDL_Event
21
#include "
help_menu.hpp
"
// for help_menu
22
#include "
help_text_area.hpp
"
// for help_text_area
23
#include "widgets/button.hpp"
// for button
24
#include "widgets/widget.hpp"
// for widget
25
26
27
namespace
help
{
28
29
/** A help browser widget. */
30
class
help_browser
:
public
gui::widget
31
{
32
public
:
33
help_browser
(
const
section
&toplevel);
34
35
void
adjust_layout
();
36
37
/**
38
* Display the topic with the specified identifier. Open the menu
39
* on the right location and display the topic in the text area.
40
*/
41
void
show_topic
(
const
std::string &topic_id);
42
43
protected
:
44
virtual
void
update_location
(
const
SDL_Rect&
rect
);
45
virtual
void
process_event
();
46
virtual
void
handle_event
(
const
SDL_Event &event);
47
48
private
:
49
/**
50
* Update the current cursor, set it to the reference cursor if
51
* mousex, mousey is over a cross-reference, otherwise, set it to
52
* the normal cursor.
53
*/
54
void
update_cursor
();
55
void
show_topic
(
const
topic
&
t
,
bool
save_in_history=
true
);
56
/**
57
* Move in the topic history. Pop an element from from and insert
58
* it in to. Pop at the fronts if the maximum number of elements is
59
* exceeded.
60
*/
61
void
move_in_history
(std::deque<const topic *> &from, std::deque<const topic *> &to);
62
help_menu
menu_
;
63
help_text_area
text_area_
;
64
const
section
&
toplevel_
;
65
bool
ref_cursor_
;
// If the cursor currently is the hyperlink cursor.
66
std::deque<const topic *>
back_topics_
,
forward_topics_
;
67
gui::button
back_button_
,
forward_button_
;
68
topic
const
*
shown_topic_
;
69
};
70
71
}
// end namespace help
t
double t
Definition:
astarsearch.cpp:63
gui::button
Definition:
button.hpp:27
gui::widget
Definition:
widget.hpp:28
help::help_browser
A help browser widget.
Definition:
help_browser.hpp:31
help::help_browser::adjust_layout
void adjust_layout()
Definition:
help_browser.cpp:49
help::help_browser::move_in_history
void move_in_history(std::deque< const topic * > &from, std::deque< const topic * > &to)
Move in the topic history.
Definition:
help_browser.cpp:115
help::help_browser::toplevel_
const section & toplevel_
Definition:
help_browser.hpp:64
help::help_browser::shown_topic_
topic const * shown_topic_
Definition:
help_browser.hpp:68
help::help_browser::show_topic
void show_topic(const std::string &topic_id)
Display the topic with the specified identifier.
Definition:
help_browser.cpp:202
help::help_browser::handle_event
virtual void handle_event(const SDL_Event &event)
Definition:
help_browser.cpp:132
help::help_browser::text_area_
help_text_area text_area_
Definition:
help_browser.hpp:63
help::help_browser::forward_button_
gui::button forward_button_
Definition:
help_browser.hpp:67
help::help_browser::help_browser
help_browser(const section &toplevel)
Definition:
help_browser.cpp:29
help::help_browser::menu_
help_menu menu_
Definition:
help_browser.hpp:62
help::help_browser::process_event
virtual void process_event()
Definition:
help_browser.cpp:90
help::help_browser::update_location
virtual void update_location(const SDL_Rect &rect)
Definition:
help_browser.cpp:85
help::help_browser::back_topics_
std::deque< const topic * > back_topics_
Definition:
help_browser.hpp:66
help::help_browser::back_button_
gui::button back_button_
Definition:
help_browser.hpp:67
help::help_browser::update_cursor
void update_cursor()
Update the current cursor, set it to the reference cursor if mousex, mousey is over a cross-reference...
Definition:
help_browser.cpp:187
help::help_browser::ref_cursor_
bool ref_cursor_
Definition:
help_browser.hpp:65
help::help_browser::forward_topics_
std::deque< const topic * > forward_topics_
Definition:
help_browser.hpp:66
help::help_menu
The menu to the left in the help browser, where topics can be navigated through and chosen.
Definition:
help_menu.hpp:33
help::help_text_area
The area where the content is shown in the help browser.
Definition:
help_text_area.hpp:34
help_menu.hpp
help_text_area.hpp
help
Definition:
help.cpp:53
help::section
A section contains topics and sections along with title and ID.
Definition:
help_impl.hpp:146
help::topic
A topic contains a title, an id and some text.
Definition:
help_impl.hpp:113
rect
An abstract description of a rectangle with integer coordinates.
Definition:
rect.hpp:47
Generated by
1.9.1