35 text_area_(toplevel), toplevel_(toplevel),
39 back_button_(
"",
gui::button::TYPE_PRESS,
"button_normal/button_small_H22",
gui::button::DEFAULT_SPACE, true,
"icons/arrows/long_arrow_ornate_left"),
40 forward_button_(
"",
gui::button::TYPE_PRESS,
"button_normal/button_small_H22",
gui::button::DEFAULT_SPACE, true,
"icons/arrows/long_arrow_ornate_right"),
57 const int menu_w = 250;
58 const int menu_h =
height();
61 const int text_area_y =
location().y;
62 const int text_area_x = menu_x + menu_w + menu_text_area_padding;
63 const int text_area_w =
width() - menu_w - menu_text_area_padding;
64 const int text_area_h =
height();
66 const int button_border_padding = 0;
68 const int back_button_x =
location().x + button_border_padding;
69 const int back_button_y = menu_y + menu_h + menu_buttons_padding;
70 const int forward_button_x = back_button_x +
back_button_.
width() + button_button_padding;
71 const int forward_button_y = back_button_y;
103 if (chosen_topic !=
nullptr && chosen_topic !=
shown_topic_) {
119 std::deque<const topic *> &to)
122 const topic *to_show = from.back();
139 SDL_MouseButtonEvent mouse_event =
event.button;
140 if (event.type == SDL_MOUSEBUTTONDOWN) {
141 if (mouse_event.button == SDL_BUTTON_LEFT) {
143 const int mousex = mouse_event.x;
144 const int mousey = mouse_event.y;
157 std::stringstream
msg;
158 msg <<
_(
"Reference to unknown topic: ") <<
"'" << ref <<
"'.";
170 const bool mouse_back = !
back_button_.
hidden() && mouse_event.button == SDL_BUTTON_X1;
179 if (mouse_back || mouse_forward) {
185 else if (event.type == SDL_MOUSEMOTION) {
214 PLAIN_LOG <<
"Help browser tried to show topic with id '" << topic_id
215 <<
"' but that topic could not be found." << std::endl;
223 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.