32 text_area_(toplevel), toplevel_(toplevel),
36 back_button_(
"",
gui::button::TYPE_PRESS,
"button_normal/button_small_H22",
gui::button::DEFAULT_SPACE, true,
"icons/arrows/long_arrow_ornate_left"),
37 forward_button_(
"",
gui::button::TYPE_PRESS,
"button_normal/button_small_H22",
gui::button::DEFAULT_SPACE, true,
"icons/arrows/long_arrow_ornate_right"),
54 const int menu_w = 250;
55 const int menu_h =
height();
58 const int text_area_y =
location().y;
59 const int text_area_x = menu_x + menu_w + menu_text_area_padding;
60 const int text_area_w =
width() - menu_w - menu_text_area_padding;
61 const int text_area_h =
height();
63 const int button_border_padding = 0;
65 const int back_button_x =
location().x + button_border_padding;
66 const int back_button_y = menu_y + menu_h + menu_buttons_padding;
67 const int forward_button_x = back_button_x +
back_button_.
width() + button_button_padding;
68 const int forward_button_y = back_button_y;
100 if (chosen_topic !=
nullptr && chosen_topic !=
shown_topic_) {
116 std::deque<const topic *> &to)
119 const topic *to_show = from.back();
136 SDL_MouseButtonEvent mouse_event =
event.button;
137 if (event.type == SDL_MOUSEBUTTONDOWN) {
138 if (mouse_event.button == SDL_BUTTON_LEFT) {
140 const int mousex = mouse_event.x;
141 const int mousey = mouse_event.y;
154 std::stringstream
msg;
155 msg <<
_(
"Reference to unknown topic: ") <<
"'" << ref <<
"'.";
167 const bool mouse_back = !
back_button_.
hidden() && mouse_event.button == SDL_BUTTON_X1;
176 if (mouse_back || mouse_forward) {
182 else if (event.type == SDL_MOUSEMOTION) {
211 PLAIN_LOG <<
"Help browser tried to show topic with id '" << topic_id
212 <<
"' but that topic could not be found." << std::endl;
220 if (save_in_history) {
Class that keeps track of all the keys on the keyboard.
void move_in_history(std::deque< const topic * > &from, std::deque< const topic * > &to)
Move in the topic history.
const section & toplevel_
topic const * shown_topic_
void show_topic(const std::string &topic_id)
Display the topic with the specified identifier.
virtual void handle_event(const SDL_Event &event)
help_text_area text_area_
gui::button forward_button_
help_browser(const section &toplevel)
virtual void process_event()
virtual void update_location(const SDL_Rect &rect)
std::deque< const topic * > back_topics_
void update_cursor()
Update the current cursor, set it to the reference cursor if mousex, mousey is over a cross-reference...
std::deque< const topic * > forward_topics_
std::string ref_at(const int x, const int y)
Return the ID that is cross-referenced at the (screen) coordinates x, y.
void show_topic(const topic &t)
Display the topic.
static std::string _(const char *str)
Standard logging facilities (interface).
#define log_scope(description)
void set(CURSOR_TYPE type)
Use the default parameter to reset cursors.
int relative_size(int size)
void show_transient_message(const std::string &title, const std::string &message, const std::string &image, const bool message_use_markup, const bool title_use_markup)
Shows a transient message to the user.
std::string hidden_symbol(bool hidden)
const std::string unit_prefix
const std::string unknown_unit_topic
const unsigned max_history
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.
uint32_t get_mouse_state(int *x, int *y)
A wrapper for SDL_GetMouseState that gives coordinates in draw space.
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
Contains the SDL_Rect helper code.
This file contains object "key", which is used to store information about keys while annotation parsi...
A section contains topics and sections along with title and ID.
A topic contains a title, an id and some text.
bool contains(int x, int y) const
Whether the given point lies within the rectangle.