15 #ifndef HELP_TEXT_AREA_HPP
16 #define HELP_TEXT_AREA_HPP
21 #include <SDL_video.h>
27 namespace help {
struct section; }
28 namespace help {
struct topic; }
64 item(surface surface,
int x,
int y,
118 bool broken_link =
false,
int get_max_x(const int y, const int height=0)
Analogous with get_min_x but return the maximum X.
help_text_area(CVideo &video, const section &toplevel)
virtual void set_inner_location(const SDL_Rect &rect)
void add_img_item(const std::string &path, const std::string &alignment, const bool floating, const bool box)
Add an image item with the specified attributes.
A section contains topics and sections along with title and ID.
int get_remaining_width()
Return the width that remain on the line the current input point is at.
int get_y_for_floating_img(const int width, const int x, const int desired_y)
Find the lowest y coordinate where a floating img of the specified width and at the specified x coord...
std::list< item * > last_row_
GLint GLint GLint GLint GLint GLint y
void add_text_item(const std::string &text, const std::string &ref_dst="", bool broken_link=false, int font_size=-1, bool bold=false, bool italic=false, SDL_Color color=font::NORMAL_COLOR)
Add an item with text.
void set_items()
Update the vector with the items of the shown topic, creating surfaces for everything and putting thi...
const SDL_Color NORMAL_COLOR
std::string bold(const std::string &s)
topic const * shown_topic_
GLsizei const char ** path
void add_item(const item &itm)
Add an item to the internal list, update the locations and row height.
std::string ref_at(const int x, const int y)
Return the ID that is cross-referenced at the (screen) coordinates x, y.
The area where the content is shown in the help browser.
virtual void scroll(unsigned int pos)
const section & toplevel_
void handle_ref_cfg(const config &cfg)
const unsigned min_row_height_
void handle_img_cfg(const config &cfg)
void handle_header_cfg(const config &cfg)
An item that is displayed in the text area.
void handle_italic_cfg(const config &cfg)
void handle_bold_cfg(const config &cfg)
void show_topic(const topic &t)
Display the topic.
void adjust_last_row()
Adjust the heights of the items in the last row to make it look good .
item_at(const int x, const int y)
std::pair< int, int > curr_loc_
item(surface surface, int x, int y, const std::string &text="", const std::string &reference_to="", bool floating=false, bool box=false, ALIGNMENT alignment=HERE)
GLint GLint GLint GLint GLint x
int get_min_x(const int y, const int height=0)
Return the least x coordinate at which something of the specified height can be drawn at the specifie...
void down_one_line()
Move the current input point to the next line.
GLint GLint GLint GLint GLint GLint GLsizei GLsizei height
void handle_format_cfg(const config &cfg)
bool operator()(const item &) const
A topic contains a title, an id and some text.
ALIGNMENT str_to_align(const std::string &s)
Convert a string to an alignment.
GLint GLint GLint GLint GLint GLint GLsizei width
SDL_Rect rect
Relative coordinates of this item.
A config object defines a single node in a WML file, with access to child nodes.
int contents_height_
The height of all items in total.
GLsizei const GLcharARB ** string
void handle_jump_cfg(const config &cfg)
unsigned curr_row_height_
Function object to find an item at the specified coordinates.