#include <menu_item.hpp>
Public Member Functions | |
MenuItem (MenuItemKind kind, int id=-1) | |
void | set_help (const std::string &help_text) |
void | change_text (const std::string &text) |
void | change_input (const std::string &text) |
std::string | get_input_with_symbol (bool active_item) |
Static Public Member Functions | |
static MenuItem * | create (MenuItemKind kind, const std::string &text, int init_toggle, Menu *target_menu, int id, int key) |
Public Attributes | |
MenuItemKind | kind |
int | id |
bool | toggled |
std::string | text |
std::string | input |
std::string | help |
std::vector< std::string > | list |
size_t | selected |
Menu * | target_menu |
Private Member Functions | |
MenuItem (const MenuItem &) | |
MenuItem & | operator= (const MenuItem &) |
Private Attributes | |
bool | input_flickering |
keyboard key or joystick button |
Definition at line 41 of file menu_item.hpp.
MenuItem::MenuItem | ( | MenuItemKind | kind, | |
int | id = -1 | |||
) |
Definition at line 25 of file menu_item.cpp.
References selected, target_menu, and toggled.
00025 : 00026 kind(_kind), 00027 id(_id), 00028 toggled(), 00029 text(), 00030 input(), 00031 help(), 00032 list(), 00033 selected(), 00034 target_menu(), 00035 input_flickering() 00036 { 00037 toggled = false; 00038 selected = false; 00039 target_menu = 0; 00040 }
MenuItem::MenuItem | ( | const MenuItem & | ) | [private] |
static MenuItem* MenuItem::create | ( | MenuItemKind | kind, | |
const std::string & | text, | |||
int | init_toggle, | |||
Menu * | target_menu, | |||
int | id, | |||
int | key | |||
) | [static] |
void MenuItem::set_help | ( | const std::string & | help_text | ) |
Definition at line 55 of file menu_item.cpp.
References help, and Resources::normal_font.
Referenced by OptionsMenu::OptionsMenu().
00056 { 00057 std::string overflow; 00058 help = Resources::normal_font->wrap_to_width(help_text, 600, &overflow); 00059 while (!overflow.empty()) 00060 { 00061 help += "\n"; 00062 help += Resources::normal_font->wrap_to_width(overflow, 600, &overflow); 00063 } 00064 }
void MenuItem::change_text | ( | const std::string & | text | ) |
Definition at line 43 of file menu_item.cpp.
References text.
Referenced by Menu::add_controlfield().
00044 { 00045 text = text_; 00046 }
void MenuItem::change_input | ( | const std::string & | text | ) |
Definition at line 49 of file menu_item.cpp.
References input.
Referenced by Menu::add_controlfield(), KeyboardMenu::menu_action(), JoystickMenu::menu_action(), KeyboardMenu::update(), and JoystickMenu::update_menu_item().
00050 { 00051 input = text_; 00052 }
std::string MenuItem::get_input_with_symbol | ( | bool | active_item | ) |
Definition at line 67 of file menu_item.cpp.
References FLICK_CURSOR_TIME, input, input_flickering, and real_time.
Referenced by Menu::draw_item().
00068 { 00069 if(!active_item) { 00070 input_flickering = true; 00071 } else { 00072 input_flickering = ((int) (real_time / FLICK_CURSOR_TIME)) % 2; 00073 } 00074 00075 char str[1024]; 00076 if(input_flickering) 00077 snprintf(str, sizeof(str), "%s ",input.c_str()); 00078 else 00079 snprintf(str, sizeof(str), "%s_",input.c_str()); 00080 00081 std::string string = str; 00082 00083 return string; 00084 }
int MenuItem::id |
Definition at line 59 of file menu_item.hpp.
Referenced by ProfileMenu::menu_action(), OptionsMenu::menu_action(), LanguageMenu::menu_action(), KeyboardMenu::menu_action(), and JoystickMenu::menu_action().
bool MenuItem::toggled |
Definition at line 60 of file menu_item.hpp.
Referenced by Menu::add_toggle(), Menu::draw_item(), Menu::is_toggled(), KeyboardMenu::menu_action(), JoystickMenu::menu_action(), MenuItem(), Menu::set_toggled(), KeyboardMenu::update(), and JoystickMenu::update().
std::string MenuItem::text |
Definition at line 61 of file menu_item.hpp.
Referenced by Menu::add_back(), Menu::add_entry(), Menu::add_inactive(), Menu::add_label(), Menu::add_string_select(), Menu::add_submenu(), Menu::add_toggle(), change_text(), and Menu::draw_item().
std::string MenuItem::input |
Definition at line 62 of file menu_item.hpp.
Referenced by change_input(), Menu::draw_item(), and get_input_with_symbol().
std::string MenuItem::help |
std::vector<std::string> MenuItem::list |
Definition at line 65 of file menu_item.hpp.
Referenced by Menu::draw_item(), OptionsMenu::menu_action(), and OptionsMenu::OptionsMenu().
size_t MenuItem::selected |
Definition at line 66 of file menu_item.hpp.
Referenced by Menu::draw_item(), OptionsMenu::menu_action(), MenuItem(), and OptionsMenu::OptionsMenu().
bool MenuItem::input_flickering [private] |
keyboard key or joystick button
Definition at line 72 of file menu_item.hpp.
Referenced by get_input_with_symbol().