Public Member Functions | |
help_text_area (CVideo &video, const section &toplevel) | |
void | show_topic (const topic &t) |
Display the topic. | |
std::string | ref_at (const int x, const int y) |
Return the ID that is crossreferenced at the (screen) coordinates x, y. | |
Protected Member Functions | |
virtual void | scroll (unsigned int pos) |
virtual void | set_inner_location (const SDL_Rect &rect) |
Private Types | |
enum | ALIGNMENT { LEFT, MIDDLE, RIGHT, HERE } |
Private Member Functions | |
ALIGNMENT | str_to_align (const std::string &s) |
Convert a string to an alignment. | |
void | set_items () |
Update the vector with the items of the shown topic, creating surfaces for everything and putting things where they belong. | |
void | handle_ref_cfg (const config &cfg) |
void | handle_img_cfg (const config &cfg) |
void | handle_bold_cfg (const config &cfg) |
void | handle_italic_cfg (const config &cfg) |
void | handle_header_cfg (const config &cfg) |
void | handle_jump_cfg (const config &cfg) |
void | handle_format_cfg (const config &cfg) |
void | draw_contents () |
void | add_text_item (const std::string text, const std::string ref_dst="", int font_size=-1, bool bold=false, bool italic=false, SDL_Color color=font::NORMAL_COLOUR) |
Add an item with text. | |
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. | |
void | down_one_line () |
Move the current input point to the next line. | |
void | adjust_last_row () |
Adjust the heights of the items in the last row to make it look good . | |
int | get_remaining_width () |
Return the width that remain on the line the current input point is at. | |
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 specified y coordinate without interfering with floating images. | |
int | get_max_x (const int y, const int height=0) |
Analogous with get_min_x but return the maximum X. | |
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 coordinate can be placed. | |
void | add_item (const item &itm) |
Add an item to the internal list, update the locations and row height. | |
Private Attributes | |
std::list< item > | items_ |
std::list< item * > | last_row_ |
const section & | toplevel_ |
topic const * | shown_topic_ |
const int | title_spacing_ |
std::pair< int, int > | curr_loc_ |
const unsigned | min_row_height_ |
unsigned | curr_row_height_ |
int | contents_height_ |
The height of all items in total. | |
Classes | |
struct | item |
An item that is displayed in the text area. More... | |
class | item_at |
Function object to find an item at the specified coordinates. More... |
Definition at line 307 of file help.cpp.
enum help::help_text_area::ALIGNMENT [private] |
void help::help_text_area::show_topic | ( | const topic & | t | ) |
Display the topic.
Definition at line 1976 of file help.cpp.
References gui::widget::set_dirty(), set_items(), and shown_topic_.
Referenced by help::help_browser::show_topic().
std::string help::help_text_area::ref_at | ( | const int | x, | |
const int | y | |||
) |
Return the ID that is crossreferenced at the (screen) coordinates x, y.
If no cross-reference is there, return the empty string.
Definition at line 2480 of file help.cpp.
References gui::scrollarea::get_position(), gui::widget::height(), items_, and gui::widget::location().
Referenced by help::help_browser::handle_event(), and help::help_browser::update_cursor().
void help::help_text_area::scroll | ( | unsigned int | pos | ) | [protected, virtual] |
Implements gui::scrollarea.
Definition at line 2468 of file help.cpp.
References gui::widget::set_dirty().
void help::help_text_area::set_inner_location | ( | const SDL_Rect & | rect | ) | [protected, virtual] |
Implements gui::scrollarea.
Definition at line 1969 of file help.cpp.
References gui::widget::bg_register(), set_items(), and shown_topic_.
help_text_area::ALIGNMENT help::help_text_area::str_to_align | ( | const std::string & | s | ) | [private] |
Convert a string to an alignment.
Throw parse_error if unsuccesful.
Definition at line 2400 of file help.cpp.
References HERE, LEFT, MIDDLE, RIGHT, and help::to_lower().
Referenced by add_img_item().
void help::help_text_area::set_items | ( | ) | [private] |
Update the vector with the items of the shown topic, creating surfaces for everything and putting things where they belong.
Definition at line 2006 of file help.cpp.
References add_item(), add_text_item(), cfg, config::child(), contents_height_, curr_loc_, curr_row_height_, down_one_line(), font::get_rendered_text(), handle_bold_cfg(), handle_format_cfg(), handle_header_cfg(), handle_img_cfg(), handle_italic_cfg(), handle_jump_cfg(), handle_ref_cfg(), gui::widget::height(), gui::scrollarea::inner_location(), items_, last_row_, font::make_text_ellipsis(), config::error::message, min_row_height_, font::NORMAL_COLOUR, help::topic_text::parsed_text(), read(), gui::scrollarea::set_full_size(), gui::scrollarea::set_position(), gui::scrollarea::set_shown_size(), gui::show_title(), shown_topic_, stream, help::topic::text, help::topic::title, and title_spacing_.
Referenced by set_inner_location(), and show_topic().
void help::help_text_area::handle_ref_cfg | ( | const config & | cfg | ) | [private] |
Definition at line 2080 of file help.cpp.
References add_text_item(), game_config::debug, help::find_topic(), help::get_bool(), text, toplevel_, and write().
Referenced by set_items().
void help::help_text_area::handle_img_cfg | ( | const config & | cfg | ) | [private] |
Definition at line 2125 of file help.cpp.
References add_img_item(), and help::get_bool().
Referenced by set_items().
void help::help_text_area::handle_bold_cfg | ( | const config & | cfg | ) | [private] |
Definition at line 2140 of file help.cpp.
References add_text_item(), and text.
Referenced by set_items().
void help::help_text_area::handle_italic_cfg | ( | const config & | cfg | ) | [private] |
Definition at line 2149 of file help.cpp.
References add_text_item(), and text.
Referenced by set_items().
void help::help_text_area::handle_header_cfg | ( | const config & | cfg | ) | [private] |
Definition at line 2158 of file help.cpp.
References add_text_item(), and text.
Referenced by set_items().
void help::help_text_area::handle_jump_cfg | ( | const config & | cfg | ) | [private] |
Definition at line 2167 of file help.cpp.
References curr_loc_, curr_row_height_, down_one_line(), get_max_x(), jump_to(), lexical_cast(), and to.
Referenced by set_items().
void help::help_text_area::handle_format_cfg | ( | const config & | cfg | ) | [private] |
Definition at line 2205 of file help.cpp.
References add_text_item(), bold(), font_size, help::get_bool(), lexical_cast(), help::string_to_color(), and text.
Referenced by set_items().
void help::help_text_area::draw_contents | ( | ) | [private, virtual] |
Reimplemented from gui::widget.
Definition at line 2442 of file help.cpp.
References gui::widget::bg_restore(), draw_rectangle(), boost::foreach_detail_::end(), gui::scrollarea::get_position(), CVideo::getSurface(), gui::scrollarea::inner_location(), items_, loc, screen, update_rect(), and gui::widget::video().
void help::help_text_area::add_text_item | ( | const std::string | text, | |
const std::string | ref_dst = "" , |
|||
int | font_size = -1 , |
|||
bool | bold = false , |
|||
bool | italic = false , |
|||
SDL_Color | color = font::NORMAL_COLOUR | |||
) | [private] |
Add an item with text.
If ref_dst is something else than the empty string, the text item will be underlined to show that it is a cross-reference. The item will also remember what the reference points to. If font_size is below zero, the default will be used.
Definition at line 2225 of file help.cpp.
References add_item(), curr_loc_, curr_row_height_, down_one_line(), font_size, help::get_first_word(), get_min_x(), get_remaining_width(), font::get_rendered_text(), font::line_width(), surface::null(), help::remove_first_space(), help::split_in_width(), and font::YELLOW_COLOUR.
Referenced by handle_bold_cfg(), handle_format_cfg(), handle_header_cfg(), handle_italic_cfg(), handle_ref_cfg(), and set_items().
void help::help_text_area::add_img_item | ( | const std::string | path, | |
const std::string | alignment, | |||
const bool | floating, | |||
const bool | box | |||
) | [private] |
Add an image item with the specified attributes.
Definition at line 2288 of file help.cpp.
References add_item(), curr_loc_, curr_row_height_, down_one_line(), image::get_image(), get_min_x(), get_y_for_floating_img(), HERE, gui::scrollarea::inner_location(), LEFT, LOG_STREAM, MIDDLE, surface::null(), RIGHT, str_to_align(), text_width, lg::warn, and gui::widget::width().
Referenced by handle_img_cfg().
void help::help_text_area::down_one_line | ( | ) | [private] |
Move the current input point to the next line.
Definition at line 2417 of file help.cpp.
References adjust_last_row(), contents_height_, curr_loc_, curr_row_height_, get_min_x(), last_row_, and min_row_height_.
Referenced by add_img_item(), add_text_item(), handle_jump_cfg(), and set_items().
void help::help_text_area::adjust_last_row | ( | ) | [private] |
Adjust the heights of the items in the last row to make it look good .
Definition at line 2427 of file help.cpp.
References curr_row_height_, last_row_, and help::help_text_area::item::rect.
Referenced by down_one_line().
int help::help_text_area::get_remaining_width | ( | ) | [private] |
Return the width that remain on the line the current input point is at.
Definition at line 2436 of file help.cpp.
References curr_loc_, curr_row_height_, and get_max_x().
Referenced by add_text_item().
int help::help_text_area::get_min_x | ( | const int | y, | |
const int | height = 0 | |||
) | [private] |
Return the least x coordinate at which something of the specified height can be drawn at the specified y coordinate without interfering with floating images.
Definition at line 2349 of file help.cpp.
References help::help_text_area::item::align, help::help_text_area::item::floating, items_, LEFT, and help::help_text_area::item::rect.
Referenced by add_img_item(), add_text_item(), and down_one_line().
int help::help_text_area::get_max_x | ( | const int | y, | |
const int | height = 0 | |||
) | [private] |
Analogous with get_min_x but return the maximum X.
Definition at line 2363 of file help.cpp.
References help::help_text_area::item::align, help::help_text_area::item::floating, gui::scrollarea::inner_location(), items_, MIDDLE, help::help_text_area::item::rect, RIGHT, and text_width.
Referenced by get_remaining_width(), and handle_jump_cfg().
int help::help_text_area::get_y_for_floating_img | ( | const int | width, | |
const int | x, | |||
const int | desired_y | |||
) | [private] |
Find the lowest y coordinate where a floating img of the specified width and at the specified x coordinate can be placed.
Start looking at desired_y and continue downwards. Only check against other floating things, since text and inline images only can be above this place if called correctly.
Definition at line 2334 of file help.cpp.
References help::help_text_area::item::floating, items_, and help::help_text_area::item::rect.
Referenced by add_img_item().
void help::help_text_area::add_item | ( | const item & | itm | ) | [private] |
Add an item to the internal list, update the locations and row height.
Definition at line 2382 of file help.cpp.
References help::help_text_area::item::align, contents_height_, curr_loc_, curr_row_height_, help::help_text_area::item::floating, items_, last_row_, LEFT, and help::help_text_area::item::rect.
Referenced by add_img_item(), add_text_item(), and set_items().
std::list<item> help::help_text_area::items_ [private] |
Definition at line 427 of file help.cpp.
Referenced by add_item(), draw_contents(), get_max_x(), get_min_x(), get_y_for_floating_img(), ref_at(), and set_items().
std::list<item *> help::help_text_area::last_row_ [private] |
Definition at line 428 of file help.cpp.
Referenced by add_item(), adjust_last_row(), down_one_line(), and set_items().
const section& help::help_text_area::toplevel_ [private] |
topic const* help::help_text_area::shown_topic_ [private] |
Definition at line 430 of file help.cpp.
Referenced by set_inner_location(), set_items(), and show_topic().
const int help::help_text_area::title_spacing_ [private] |
std::pair<int, int> help::help_text_area::curr_loc_ [private] |
Definition at line 433 of file help.cpp.
Referenced by add_img_item(), add_item(), add_text_item(), down_one_line(), get_remaining_width(), handle_jump_cfg(), and set_items().
const unsigned help::help_text_area::min_row_height_ [private] |
unsigned help::help_text_area::curr_row_height_ [private] |
Definition at line 435 of file help.cpp.
Referenced by add_img_item(), add_item(), add_text_item(), adjust_last_row(), down_one_line(), get_remaining_width(), handle_jump_cfg(), and set_items().
int help::help_text_area::contents_height_ [private] |
The height of all items in total.
Definition at line 437 of file help.cpp.
Referenced by add_item(), down_one_line(), and set_items().
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |