📄 menu.h
字号:
/* * @(#)menu.h 1.1 92/07/30 */#ifndef _MENU_H_#define _MENU_H_/* * Name: menu.h * * Description: Global declarations for menu library. *//* * Global constants: */#define ACTIVE 1 /* menu object is active */#define ATTR_NORMAL ((menu_attr) 0) /* normal attributes */#define ATTR_STAND ((menu_attr) 1) /* standout attributes */#ifndef CP_NULL# define CP_NULL ((char *) 0)#endif#define NOT_ACTIVE 0 /* menu object is not active */#ifndef NULL# define NULL 0#endif#ifndef PFI_NULL# define PFI_NULL ((int (*)()) 0)#endif#ifndef PTR_NULL# define PTR_NULL ((pointer) 0)#endif/* * Global types: *//* * Do the typedefs up front so the data structures can be in * alphabetical order. */typedef struct form_button_t form_button;typedef struct form_field_t form_field;typedef struct form_map_t form_map;typedef struct form_noecho_t form_noecho;typedef struct form_radio_t form_radio;typedef struct form_t form;typedef struct form_yesno_t form_yesno;typedef unsigned int menu_attr;typedef unsigned char menu_coord;typedef struct menu_file_t menu_file;typedef struct menu_item_t menu_item;typedef struct menu_string_t menu_string;typedef struct menu_t menu;typedef int * pointer;/* * Definition of a form: * * m_type - type of menu object * m_help - pointer to the help function * f_active - is this form active? * f_name - name of this form * f_mstrings - menu strings associated with this form * f_fields - field associated with this form * f_files - files associated with this form * f_noechos - noechos associated with this form * f_radios - radios associated with this form * f_map - map of objects on this form * f_obj - ptr to current object's map * f_finish - ptr to finish object * f_shared - ptr to shared yes/no object */struct form_t { int m_type; int (* m_help)(); int f_active; char * f_name; menu_string * f_mstrings; form_field * f_fields; menu_file * f_files; form_noecho * f_noechos; form_radio * f_radios; form_yesno * f_yesnos; form_map * f_map; form_map * f_obj; form_yesno * f_finish; form_yesno * f_shared;};/* * Definition of a form button: * * m_type - type of menu object * m_help - pointer to the help function * fb_active - is this button active? * fb_name - name of this button * fb_mstrings - menu strings associated with this button * fb_x - x-coordinate of this button * fb_y - y-coordinate of this button * fb_code - code to place in radio's code buffer * fb_func - function to invoke if button is selected * fb_arg - argument for function * fb_next - pointer to next button * fb_radio - pointer to parent radio */struct form_button_t { int m_type; int (* m_help)(); char fb_active; char * fb_name; menu_string * fb_mstrings; menu_coord fb_x; menu_coord fb_y; int fb_code; int (* fb_func)(); pointer fb_arg; form_button * fb_next; form_radio * fb_radio;};/* * Definition of a form field: * * m_type - type of menu object * m_help - pointer to the help function * ff_active - is this field active? * ff_name - name of this field * ff_mstrings - menu strings associated with this field * ff_x - starting x-coordinate of this field * ff_y - starting y-coordinate of this field * ff_width - width of this field * ff_data - pointer to data buffer for this field * ff_datasize - size of buffer 'ff_data' * ff_lex - pointer to the lexical function * ff_prefunc - pointer to pre-function. The following * return values are expected: * 1 -> proceed with getting data * 0 -> return with out getting data * -1 -> return with error condition * ff_prearg - argument for pre-function * ff_postfunc - pointer to post-function * 1 -> data is valid * 0 -> data is invalid try again * -1 -> return with error condition * ff_postarg - argument for post-function * ff_next - pointer to next field */struct form_field_t { int m_type; int (* m_help)(); char ff_active; char * ff_name; menu_string * ff_mstrings; menu_coord ff_x; menu_coord ff_y; menu_coord ff_width; char * ff_data; short ff_datasize; int (* ff_lex)(); int (* ff_prefunc)(); pointer ff_prearg; int (* ff_postfunc)(); pointer ff_postarg; form_field * ff_next;};/* * Definition of a form map: * * fm_obj - pointer to the object in the form * fm_func - function to manipulate the object * fm_prev - pointer to the previous mapped object * fm_next - pointer to the next mapped object */struct form_map_t { pointer fm_obj; int (* fm_func)(); form_map * fm_prev; form_map * fm_next;};/* * Definition of a form noecho: * * m_type - type of menu object * m_help - pointer to the help function * fne_active - is this noecho active? * fne_name - name of this noecho * fne_mstrings - menu strings associated with this noecho * fne_x - starting x-coordinate of this noecho * fne_y - starting y-coordinate of this noecho * fne_data - pointer to data buffer for this noecho * fne_datasize - size of buffer 'fne_data' * fne_prefunc - pointer to pre-function. The following * return values are expected: * 1 -> proceed with getting data * 0 -> return with out getting data * -1 -> return with error condition * fne_prearg - argument for pre-function * fne_postfunc - pointer to post-function * 1 -> data is valid * 0 -> data is invalid try again * -1 -> return with error condition * fne_postarg - argument for post-function * fne_next - pointer to next noecho */struct form_noecho_t { int m_type; int (* m_help)(); char fne_active; char * fne_name; menu_string * fne_mstrings; menu_coord fne_x; menu_coord fne_y; char * fne_data; short fne_datasize; int (* fne_prefunc)(); pointer fne_prearg; int (* fne_postfunc)(); pointer fne_postarg; form_noecho * fne_next;};/* * Definition of a form radio: * * m_type - type of menu object * m_help - pointer to the help function * fr_active - is this radio active? * fr_name - name of this radio * fr_mstrings - strings associated with this radio * fr_buttons - the buttons associated with this radio * fr_pressed - the currently pressed button * fr_codeptr - pointer to pressed button's code * fr_prefunc - pointer to pre-function. The following * return values are expected: * 1 -> proceed with getting button * 0 -> return with out getting button * -1 -> return with error condition * fr_prearg - argument for pre-function * fr_postfunc - pointer to post-function * 1 -> button is valid * 0 -> button is invalid try again * -1 -> return with error condition * fr_postarg - argument for post-function * fr_next - pointer to next radio */struct form_radio_t { int m_type; int (* m_help)(); char fr_active; char * fr_name; menu_string * fr_mstrings; form_button * fr_buttons; form_button * fr_pressed; int * fr_codeptr; int (* fr_prefunc)(); pointer fr_prearg; int (* fr_postfunc)(); pointer fr_postarg; form_radio * fr_next;};/* * Definition of a form yes/no question: * * m_type - type of menu object * m_help - pointer to the help function * fyn_active - is this yes/no active? * fyn_name - name of this yes/no question * fyn_mstrings - menu strings associated with this yes/no * fyn_answer - current answer * fyn_answerp - pointer to current answer * fyn_x - x-coordinate of this yes/no * fyn_y - y-coordinate of this yes/no * fyn_prefunc - pointer to pre-function. The following * return values are expected: * 1 -> proceed with getting answer * 0 -> return with out getting answer * -1 -> return with error condition * fyn_prearg - argument for pre-function * fyn_nofunc - function to invoke if no is selected. The * following return values are expected: * 1 -> answer was valid * 0 -> answer was not valid, try again * -1 -> return with error condition * fyn_noarg - argument for no function * fyn_yesfunc - function to invoke if yes is selected. The * following return values are expected:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -