help::help_menu Class Reference

The menu to the left in the help browser, where topics can be navigated through and chosen. More...

Inheritance diagram for help::help_menu:

Inheritance graph
[legend]
Collaboration diagram for help::help_menu:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 help_menu (CVideo &video, const section &toplevel, int max_height=-1)
int process ()
void select_topic (const topic &t)
 Make the topic the currently selected one, and expand all sections that need to be expanded to show it.
const topicchosen_topic ()
 If a topic has been chosen, return that topic, otherwise NULL.

Private Member Functions

void update_visible_items (const section &top_level, unsigned starting_level=0)
 Regenerate what items are visible by checking what sections are expanded.
bool expanded (const section &sec)
 Return true if the section is expanded.
void expand (const section &sec)
 Mark a section as expanded.
void contract (const section &sec)
 Contract (close) a section.
std::string indented_icon (const std::string &icon, const unsigned level)
 Return the string to use as the prefix for the icon part of the menu-string at the specified level.
std::string get_string_to_show (const section &sec, const unsigned level)
 Return the string to use as the menu-string for sections at the specified level.
std::string get_string_to_show (const topic &topic, const unsigned level)
 Return the string to use as the menu-string for topics at the specified level.
void display_visible_items ()
 Draw the currently visible items.
bool select_topic_internal (const topic &t, const section &sec)
 Internal recursive thingie.

Private Attributes

std::vector< visible_itemvisible_items_
const sectiontoplevel_
std::set< const section * > expanded_
surface_restorer restorer_
SDL_Rect rect_
topic const * chosen_topic_
visible_item selected_item_

Classes

struct  visible_item
 Information about an item that is visible in the menu. More...


Detailed Description

The menu to the left in the help browser, where topics can be navigated through and chosen.

Definition at line 228 of file help.cpp.


Constructor & Destructor Documentation

help::help_menu::help_menu ( CVideo video,
const section toplevel,
int  max_height = -1 
)


Member Function Documentation

int help::help_menu::process (  ) 

void help::help_menu::select_topic ( const topic t  ) 

Make the topic the currently selected one, and expand all sections that need to be expanded to show it.

Definition at line 1861 of file help.cpp.

References display_visible_items(), select_topic_internal(), selected_item_, toplevel_, update_visible_items(), and visible_items_.

Referenced by help::help_browser::show_topic().

const topic * help::help_menu::chosen_topic (  ) 

If a topic has been chosen, return that topic, otherwise NULL.

If one topic is returned, it will not be returned again, if it is not re-chosen.

Definition at line 1919 of file help.cpp.

References chosen_topic_.

Referenced by help::help_browser::process_event().

void help::help_menu::update_visible_items ( const section top_level,
unsigned  starting_level = 0 
) [private]

Regenerate what items are visible by checking what sections are expanded.

Definition at line 1789 of file help.cpp.

References expanded(), get_string_to_show(), is_visible_id(), help::section::sections, help::section::topics, and visible_items_.

Referenced by help_menu(), process(), and select_topic().

bool help::help_menu::expanded ( const section sec  )  [private]

Return true if the section is expanded.

Definition at line 1770 of file help.cpp.

References expanded_.

Referenced by get_string_to_show(), process(), and update_visible_items().

void help::help_menu::expand ( const section sec  )  [private]

Mark a section as expanded.

Do not update the visible items or anything.

Definition at line 1775 of file help.cpp.

References expanded_, help::section::id, game_config::sounds::menu_expand, and sound::play_UI_sound().

Referenced by process(), and select_topic_internal().

void help::help_menu::contract ( const section sec  )  [private]

Contract (close) a section.

That is, mark it as not expanded, visible items are not updated.

Definition at line 1782 of file help.cpp.

References expanded_, game_config::sounds::menu_contract, and sound::play_UI_sound().

Referenced by process().

std::string help::help_menu::indented_icon ( const std::string &  icon,
const unsigned  level 
) [private]

Return the string to use as the prefix for the icon part of the menu-string at the specified level.

Definition at line 1814 of file help.cpp.

References IMAGE_PREFIX, and IMG_TEXT_SEPARATOR.

Referenced by get_string_to_show(), and process().

std::string help::help_menu::get_string_to_show ( const section sec,
const unsigned  level 
) [private]

Return the string to use as the menu-string for sections at the specified level.

Definition at line 1824 of file help.cpp.

References expanded(), IMG_TEXT_SEPARATOR, indented_icon(), and help::section::title.

Referenced by update_visible_items().

std::string help::help_menu::get_string_to_show ( const topic topic,
const unsigned  level 
) [private]

Return the string to use as the menu-string for topics at the specified level.

Definition at line 1832 of file help.cpp.

References IMG_TEXT_SEPARATOR, indented_icon(), and help::topic::title.

void help::help_menu::display_visible_items (  )  [private]

Draw the currently visible items.

Definition at line 1926 of file help.cpp.

References boost::foreach_detail_::end(), selected_item_, gui::menu::set_items(), and visible_items_.

Referenced by help_menu(), process(), and select_topic().

bool help::help_menu::select_topic_internal ( const topic t,
const section sec 
) [private]

Internal recursive thingie.

did_expand will be true if any section was expanded, otherwise untouched.

Definition at line 1840 of file help.cpp.

References expand(), help::topic::id, help::section::sections, and help::section::topics.

Referenced by select_topic().


Member Data Documentation

Definition at line 291 of file help.cpp.

Referenced by help_menu(), process(), and select_topic().

std::set<const section*> help::help_menu::expanded_ [private]

Definition at line 292 of file help.cpp.

Referenced by contract(), expand(), and expanded().

Reimplemented from gui::widget.

Definition at line 293 of file help.cpp.

SDL_Rect help::help_menu::rect_ [private]

Reimplemented from gui::widget.

Definition at line 294 of file help.cpp.

Definition at line 295 of file help.cpp.

Referenced by chosen_topic(), and process().

Definition at line 296 of file help.cpp.

Referenced by display_visible_items(), help_menu(), process(), and select_topic().


The documentation for this class was generated from the following file:

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs