Classes | Public Member Functions | Private Member Functions | Private Attributes

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.

Classes

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

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_

Detailed Description

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

Definition at line 261 of file help.cpp.


Constructor & Destructor Documentation

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

Definition at line 1950 of file help.cpp.

References display_visible_items(), selected_item_, gui::menu::silent_, toplevel_, update_visible_items(), and visible_items_.

Here is the call graph for this function:


Member Function Documentation

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 2116 of file help.cpp.

References chosen_topic_.

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

Here is the caller graph for this function:

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 1979 of file help.cpp.

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

Referenced by process().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Draw the currently visible items.

Definition at line 2123 of file help.cpp.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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 1972 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().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Return true if the section is expanded.

Definition at line 1967 of file help.cpp.

References expanded_.

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

Here is the caller graph for this function:

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 2021 of file help.cpp.

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

Referenced by update_visible_items().

Here is the call graph for this function:

Here is the caller graph for this function:

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 2029 of file help.cpp.

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

Here is the call graph for this function:

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 2011 of file help.cpp.

References IMAGE_PREFIX, and IMG_TEXT_SEPARATOR.

Referenced by get_string_to_show(), and process().

Here is the caller graph for this function:

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 2058 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().

Here is the call graph for this function:

Here is the caller graph for this function:

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 2037 of file help.cpp.

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

Referenced by select_topic().

Here is the call graph for this function:

Here is the caller graph for this function:

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 1986 of file help.cpp.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 328 of file help.cpp.

Referenced by chosen_topic(), and process().

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

Definition at line 325 of file help.cpp.

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

SDL_Rect help::help_menu::rect_ [private]

Reimplemented from gui::widget.

Definition at line 327 of file help.cpp.

Reimplemented from gui::widget.

Definition at line 326 of file help.cpp.

Definition at line 329 of file help.cpp.

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

Definition at line 324 of file help.cpp.

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


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:24:20 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs