WXP C++ Library Version 6.74.9
|
This class creates a menu system. More...
#include "../include/Menu.h"
Public Member Functions | |
Menu () | |
Menu (const char *title, MenuItem *menu, int flag) | |
int | init () |
int | set (const char *title, MenuItem *menu, int flag) |
int | display () |
int | prompt (const char *prompt, String &str) |
int | search (const char *item) |
const char * | getAbbr (int index) |
int | check (int index) |
Static Public Attributes | |
static const int | EXIT = 1 |
static const int | MAIN = 2 |
static const int | HELP = 4 |
This class creates a menu system.
Menu::Menu | ( | ) |
Constructor. Initializes class values
References init().
Menu::Menu | ( | const char * | rtitle, |
MenuItem * | ritems, | ||
int | flag | ||
) |
int Menu::check | ( | int | rindex | ) |
Checks against menu list to see if item exists
rindex | Index to check |
int Menu::display | ( | ) |
Displays the menu to standard output
Referenced by prompt().
const char * Menu::getAbbr | ( | int | rindex | ) |
Gets the menu item abbreviation
rindex | Index in menu structure |
References WXP::MenuItem::abbr.
int Menu::prompt | ( | const char * | prompt, |
String & | str | ||
) |
Prompts the user for input after menu has been displayed
prompt | Prompt to send to user |
str | Output String that user typed in |
References display(), WXP::String::equal(), WXP::String::iequal(), WXP::Const::MISS, WXP::MenuItem::name, WXP::Prog::prompt(), prompt(), WXP::String::scanf(), and WXP::String::set().
Referenced by prompt().
int Menu::search | ( | const char * | item | ) |
Searches the menu for matching items
item | Item to search for |
References WXP::StrLib::iequal(), WXP::Const::MISS, and WXP::MenuItem::name.
int Menu::set | ( | const char * | rtitle, |
MenuItem * | ritems, | ||
int | flag | ||
) |
Sets up the menu list
rtitle | Title string to display at top of menu list |
ritems | Actual list of menu items |
flag | Flag |
References WXP::StrLib::copy(), and WXP::MenuItem::name.
Referenced by Menu().