| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
#ifndef MENU_PRIV_H_incl |
| 41 |
#define MENU_PRIV_H_incl 1 |
| 42 |
|
| 43 |
#include "curspriv.h" |
| 44 |
#include "mf_common.h" |
| 45 |
#include "menu.h" |
| 46 |
|
| 47 |
|
| 48 |
#define BS (8) |
| 49 |
|
| 50 |
extern NCURSES_EXPORT_VAR(ITEM) _nc_Default_Item; |
| 51 |
extern NCURSES_EXPORT_VAR(MENU) _nc_Default_Menu; |
| 52 |
|
| 53 |
|
| 54 |
#define Normalize_Item( item ) ((item)=(item)?(item):&_nc_Default_Item) |
| 55 |
|
| 56 |
|
| 57 |
#define Normalize_Menu( menu ) ((menu)=(menu)?(menu):&_nc_Default_Menu) |
| 58 |
|
| 59 |
#define Get_Menu_Screen( menu ) (menu->userwin ? \ |
| 60 |
_nc_screen_of(menu->userwin) : CURRENT_SCREEN) |
| 61 |
|
| 62 |
|
| 63 |
#define Get_Menu_UserWin(menu) ((menu)->userwin ? \ |
| 64 |
(menu)->userwin : stdscr) |
| 65 |
|
| 66 |
|
| 67 |
#define Get_Menu_Window( menu ) \ |
| 68 |
((menu)->usersub ? (menu)->usersub : Get_Menu_UserWin(menu)) |
| 69 |
|
| 70 |
|
| 71 |
#define _LINK_NEEDED (0x04) |
| 72 |
#define _MARK_ALLOCATED (0x08) |
| 73 |
|
| 74 |
#define ALL_MENU_OPTS ( \ |
| 75 |
O_ONEVALUE | \ |
| 76 |
O_SHOWDESC | \ |
| 77 |
O_ROWMAJOR | \ |
| 78 |
O_IGNORECASE | \ |
| 79 |
O_SHOWMATCH | \ |
| 80 |
O_NONCYCLIC ) |
| 81 |
|
| 82 |
#define ALL_ITEM_OPTS (O_SELECTABLE) |
| 83 |
|
| 84 |
|
| 85 |
#define Move_And_Post_Item(menu,item) \ |
| 86 |
{wmove((menu)->win,(menu)->spc_rows*(item)->y,((menu)->itemlen+(menu)->spc_cols)*(item)->x);\ |
| 87 |
_nc_Post_Item((menu),(item));} |
| 88 |
|
| 89 |
#define Move_To_Current_Item(menu,item) \ |
| 90 |
if ( (item) != (menu)->curitem)\ |
| 91 |
{\ |
| 92 |
Move_And_Post_Item(menu,item);\ |
| 93 |
Move_And_Post_Item(menu,(menu)->curitem);\ |
| 94 |
} |
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
#define Adjust_Current_Item(menu,row,item) \ |
| 101 |
{ if ((item)->y < row) \ |
| 102 |
row = (item)->y;\ |
| 103 |
if ( (item)->y >= (row + (menu)->arows) )\ |
| 104 |
row = ( (item)->y < ((menu)->rows - row) ) ? \ |
| 105 |
(item)->y : (menu)->rows - (menu)->arows;\ |
| 106 |
_nc_New_TopRow_and_CurrentItem(menu,row,item); } |
| 107 |
|
| 108 |
|
| 109 |
#define Reset_Pattern(menu) \ |
| 110 |
{ (menu)->pindex = 0; \ |
| 111 |
(menu)->pattern[0] = '\0'; } |
| 112 |
|
| 113 |
#define UChar(c) ((unsigned char)(c)) |
| 114 |
|
| 115 |
|
| 116 |
extern NCURSES_EXPORT(void) _nc_Draw_Menu (const MENU *); |
| 117 |
extern NCURSES_EXPORT(void) _nc_Show_Menu (const MENU *); |
| 118 |
extern NCURSES_EXPORT(void) _nc_Calculate_Item_Length_and_Width (MENU *); |
| 119 |
extern NCURSES_EXPORT(int) _nc_Calculate_Text_Width(const TEXT *); |
| 120 |
extern NCURSES_EXPORT(void) _nc_Post_Item (const MENU *, const ITEM *); |
| 121 |
extern NCURSES_EXPORT(bool) _nc_Connect_Items (MENU *, ITEM **); |
| 122 |
extern NCURSES_EXPORT(void) _nc_Disconnect_Items (MENU *); |
| 123 |
extern NCURSES_EXPORT(void) _nc_New_TopRow_and_CurrentItem (MENU *,int, ITEM *); |
| 124 |
extern NCURSES_EXPORT(void) _nc_Link_Items (MENU *); |
| 125 |
extern NCURSES_EXPORT(int) _nc_Match_Next_Character_In_Item_Name (MENU*,int,ITEM**); |
| 126 |
extern NCURSES_EXPORT(int) _nc_menu_cursor_pos (const MENU* menu, const ITEM* item, |
| 127 |
int* pY, int* pX); |
| 128 |
|
| 129 |
#ifdef TRACE |
| 130 |
|
| 131 |
#define returnItem(code) TRACE_RETURN(code,item) |
| 132 |
#define returnItemPtr(code) TRACE_RETURN(code,item_ptr) |
| 133 |
#define returnItemOpts(code) TRACE_RETURN(code,item_opts) |
| 134 |
#define returnMenu(code) TRACE_RETURN(code,menu) |
| 135 |
#define returnMenuHook(code) TRACE_RETURN(code,menu_hook) |
| 136 |
#define returnMenuOpts(code) TRACE_RETURN(code,menu_opts) |
| 137 |
|
| 138 |
extern NCURSES_EXPORT(ITEM *) _nc_retrace_item (ITEM *); |
| 139 |
extern NCURSES_EXPORT(ITEM **) _nc_retrace_item_ptr (ITEM **); |
| 140 |
extern NCURSES_EXPORT(Item_Options) _nc_retrace_item_opts (Item_Options); |
| 141 |
extern NCURSES_EXPORT(MENU *) _nc_retrace_menu (MENU *); |
| 142 |
extern NCURSES_EXPORT(Menu_Hook) _nc_retrace_menu_hook (Menu_Hook); |
| 143 |
extern NCURSES_EXPORT(Menu_Options) _nc_retrace_menu_opts (Menu_Options); |
| 144 |
|
| 145 |
#else |
| 146 |
|
| 147 |
#define returnItem(code) return code |
| 148 |
#define returnItemPtr(code) return code |
| 149 |
#define returnItemOpts(code) return code |
| 150 |
#define returnMenu(code) return code |
| 151 |
#define returnMenuHook(code) return code |
| 152 |
#define returnMenuOpts(code) return code |
| 153 |
|
| 154 |
#endif |
| 155 |
|
| 156 |
#endif |