17 #include <SDL_mouse.h>
37 text_area_(video, toplevel), toplevel_(toplevel),
41 back_button_(video,
"",
gui::button::TYPE_PRESS,
"button_normal/button_small_H22",
gui::button::DEFAULT_SPACE, true,
"icons/arrows/long_arrow_ornate_left"),
42 forward_button_(video,
"",
gui::button::TYPE_PRESS,
"button_normal/button_small_H22",
gui::button::DEFAULT_SPACE, true,
"icons/arrows/long_arrow_ornate_right"),
59 const int menu_w = 250;
60 const int menu_h =
height();
63 const int text_area_y =
location().y;
64 const int text_area_x = menu_x + menu_w + menu_text_area_padding;
65 const int text_area_w =
width() - menu_w - menu_text_area_padding;
66 const int text_area_h =
height();
68 const int button_border_padding = 0;
70 const int back_button_x =
location().x + button_border_padding;
71 const int back_button_y = menu_y + menu_h + menu_buttons_padding;
72 const int forward_button_x = back_button_x +
back_button_.
width() + button_button_padding;
73 const int forward_button_y = back_button_y;
99 SDL_GetMouseState(&mousex,&mousey);
105 if (chosen_topic !=
nullptr && chosen_topic !=
shown_topic_) {
121 std::deque<const topic *> &to)
124 const topic *to_show = from.back();
141 SDL_MouseButtonEvent mouse_event =
event.button;
142 if (event.type == SDL_MOUSEBUTTONDOWN) {
143 if (mouse_event.button == SDL_BUTTON_LEFT) {
145 const int mousex = mouse_event.x;
146 const int mousey = mouse_event.y;
151 std::stringstream
msg;
152 msg <<
_(
"Reference to unknown topic: ") <<
"'" << ref <<
"'.";
163 else if (event.type == SDL_MOUSEMOTION) {
171 SDL_GetMouseState(&mousex,&mousey);
192 std::cerr <<
"Help browser tried to show topic with id '" << topic_id
193 <<
"' but that topic could not be found." << std::endl;
201 if (save_in_history) {
void update_cursor()
Update the current cursor, set it to the reference cursor if mousex, mousey is over a cross-reference...
gui::button forward_button_
void move_in_history(std::deque< const topic * > &from, std::deque< const topic * > &to)
Move in the topic history.
const std::string unit_prefix
void set(CURSOR_TYPE type)
Use the default parameter to reset cursors.
A section contains topics and sections along with title and ID.
topic const * shown_topic_
const std::string unknown_unit_topic
int relative_size(int size)
virtual void handle_event(const SDL_Event &event)
help_browser(CVideo &video, const section &toplevel)
std::deque< const topic * > forward_topics_
void show_transient_message(CVideo &video, const std::string &title, const std::string &message, const std::string &image, const bool message_use_markup, const bool title_use_markup, const bool restore_background)
Shows a transient message to the user.
const section & toplevel_
static UNUSEDNOWARN std::string _(const char *str)
std::string hidden_symbol(bool hidden)
std::deque< const topic * > back_topics_
std::string ref_at(const int x, const int y)
Return the ID that is cross-referenced at the (screen) coordinates x, y.
bool point_in_rect(int x, int y, const SDL_Rect &rect)
Tests whether a point is inside a rectangle.
void show_topic(const topic &t)
Display the topic.
void show_topic(const std::string &topic_id)
Display the topic with the specified identifier.
virtual void process_event()
virtual void update_location(SDL_Rect const &rect)
#define log_scope(description)
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
const unsigned max_history
Contains the SDL_Rect helper code.
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.
Standard logging facilities (interface).
A topic contains a title, an id and some text.
Class that keeps track of all the keys on the keyboard.
GLsizei const GLcharARB ** string
help_text_area text_area_