FDOSTUI
FreeDOS Text User Interface
Classes | Typedefs | Enumerations | Functions
menuitem.h File Reference

Container for a menu item. More...

Go to the source code of this file.

Classes

struct  menuitem
 a menu item More...
 
struct  menuitembar
 a menu bar item More...
 

Typedefs

typedef void(* menuitem_signal_t) (struct menuitem *i_menu, void *i_user_data)
 function prototype to recieve signal More...
 

Enumerations

enum  menuitem_flags {
  MENUITEM_NONE = (0<<0), MENUITEM_VALUE = (1<<1), MENUITEM_DISABLED = (1<<2), MENUITEM_CHECKBOX = (1<<3),
  MENUITEM_SEPERATOR = (1<<4), MENUITEM_SUBMENU = (1<<5)
}
 flags that determine attributes of the menu item More...
 

Functions

void menuitem_count (unsigned int *const o_rows, unsigned int *const o_cols, struct menuitem *i_menu)
 count the number of elements in menu More...
 
void menuitem_emit (struct menuitem *i_menu)
 emit the callback signal More...
 
struct menuitemmenuitem_next (struct menuitem *i_menu)
 get the next menu item of the same level More...
 
struct menuitemmenuitem_nth (struct menuitem *i_menu, unsigned int const i_nth)
 gets the nth (zero based) menu item of the same level More...
 
void menuitem_flatten (struct array *const o_array, struct menuitem *i_menu)
 flattens a menu (creates list of menu items of same level) More...
 
struct menuitemmenuitem_find_scancode (struct menuitem *i_menu, enum scancodes const i_scan)
 scans menu items for a scancode/accelerator (stops at first match) More...
 

Detailed Description

Container for a menu item.

Typedef Documentation

◆ menuitem_signal_t

void(* menuitem_signal_t)(struct menuitem *i_menu, void *i_user_data)

function prototype to recieve signal

Parameters
[in]i_menumenu item
[in,out]io_user_datause defined
Returns
none

Enumeration Type Documentation

◆ menuitem_flags

flags that determine attributes of the menu item

Enumerator
MENUITEM_NONE 

no attributes

MENUITEM_VALUE 

menu item value (0=off, 1=on)

MENUITEM_DISABLED 

menu item is disabled

MENUITEM_CHECKBOX 

menu item can be checked

MENUITEM_SEPERATOR 

menu item has a sperator line

MENUITEM_SUBMENU 

menu item contains a sub menu

Function Documentation

◆ menuitem_count()

void menuitem_count ( unsigned int *const  o_rows,
unsigned int *const  o_cols,
struct menuitem i_menu 
)

count the number of elements in menu

Parameters
[out]o_rowsthe number of elements in ithe menu
[out]o_colsthe largest string in the menu
[in]i_menuthe menu object to count

o_rows is the count of a flattened menu. It does not include sub menus.

◆ menuitem_emit()

void menuitem_emit ( struct menuitem i_menu)

emit the callback signal

Parameters
[in,out]i_menumenu to call signal
Returns
none

◆ menuitem_find_scancode()

struct menuitem * menuitem_find_scancode ( struct menuitem i_menu,
enum scancodes const  i_scan 
)

scans menu items for a scancode/accelerator (stops at first match)

Parameters
[in]i_menumenu item to traverse
[in]i_scanscancode to search for
Returns
!0 menu item containing scancode
0 item not found

◆ menuitem_flatten()

void menuitem_flatten ( struct array *const  o_array,
struct menuitem i_menu 
)

flattens a menu (creates list of menu items of same level)

Parameters
[out]o_arraycontainer to hold menu items
[in]i_menumenu to flatten
Returns
none

◆ menuitem_next()

struct menuitem * menuitem_next ( struct menuitem i_menu)

get the next menu item of the same level

Parameters
[in]i_menumenu to step through
Returns
0 end of menu
!0 next menu item

◆ menuitem_nth()

struct menuitem * menuitem_nth ( struct menuitem i_menu,
unsigned int const  i_nth 
)

gets the nth (zero based) menu item of the same level

Returns
0 end of menu
!0 nth menu item