WXP C++ Library Version 6.74.9
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
WXP::Menu Class Reference

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
 

Detailed Description

This class creates a menu system.

Author
Dan Vietor

Constructor & Destructor Documentation

◆ Menu() [1/2]

Menu::Menu ( )

Constructor. Initializes class values

References init().

◆ Menu() [2/2]

Menu::Menu ( const char *  rtitle,
MenuItem ritems,
int  flag 
)

Constructor. Sets up menu

Parameters
rtitleTitle string to display at top of menu list
ritemsActual list of menu items
flagFlag
Menu::MAIN = add menu link to main menu
Manu::EXIT = add menu item to exit program

References init(), and set().

Member Function Documentation

◆ check()

int Menu::check ( int  rindex)

Checks against menu list to see if item exists

Parameters
rindexIndex to check
Returns
1=exists, 0=not exist

◆ display()

int Menu::display ( )

Displays the menu to standard output

Referenced by prompt().

◆ getAbbr()

const char * Menu::getAbbr ( int  rindex)

Gets the menu item abbreviation

Parameters
rindexIndex in menu structure
Returns
Abbreviation string

References WXP::MenuItem::abbr.

◆ init()

int Menu::init ( )

Initializes the class values

Referenced by Menu(), and Menu().

◆ prompt()

int Menu::prompt ( const char *  prompt,
String str 
)

Prompts the user for input after menu has been displayed

Parameters
promptPrompt to send to user
Return values
strOutput 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().

◆ search()

int Menu::search ( const char *  item)

Searches the menu for matching items

Parameters
itemItem to search for

References WXP::StrLib::iequal(), WXP::Const::MISS, and WXP::MenuItem::name.

◆ set()

int Menu::set ( const char *  rtitle,
MenuItem ritems,
int  flag 
)

Sets up the menu list

Parameters
rtitleTitle string to display at top of menu list
ritemsActual list of menu items
flagFlag

References WXP::StrLib::copy(), and WXP::MenuItem::name.

Referenced by Menu().


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