- * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. *
+ * Copyright 2020-2021,2023 Thomas E. Dickey *
+ * Copyright 1998-2012,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
16, /* Nr. of chars high */
1, /* Nr. of chars wide */
16, /* Nr. of items high */
16, /* Nr. of chars high */
1, /* Nr. of chars wide */
16, /* Nr. of items high */
0, /* length of widest description */
1, /* length of mark */
1, /* length of one item */
0, /* length of widest description */
1, /* length of mark */
1, /* length of one item */
1, /* Spacing for columns */
1, /* Spacing for rows */
(char *)0, /* buffer used to store match chars */
1, /* Spacing for columns */
1, /* Spacing for rows */
(char *)0, /* buffer used to store match chars */
0, /* Top row of menu */
(chtype)A_REVERSE, /* Attribute for selection */
(chtype)A_NORMAL, /* Attribute for nonselection */
0, /* Top row of menu */
(chtype)A_REVERSE, /* Attribute for selection */
(chtype)A_NORMAL, /* Attribute for nonselection */
' ', /* Pad character */
(Menu_Hook)0, /* Menu init */
(Menu_Hook)0, /* Menu term */
' ', /* Pad character */
(Menu_Hook)0, /* Menu init */
(Menu_Hook)0, /* Menu term */
{ (char *)0, 0 }, /* name */
{ (char *)0, 0 }, /* description */
(MENU *)0, /* Pointer to parent menu */
{ (char *)0, 0 }, /* name */
{ (char *)0, 0 }, /* description */
(MENU *)0, /* Pointer to parent menu */
| Description : Calculates the maximum name and description lengths
| of the items connected to the menu
|
| Return Values : -
+--------------------------------------------------------------------------*/
NCURSES_INLINE static void
| Description : Calculates the maximum name and description lengths
| of the items connected to the menu
|
| Return Values : -
+--------------------------------------------------------------------------*/
NCURSES_INLINE static void
| the item array that indicates a connection
|
| Return Values : -
+--------------------------------------------------------------------------*/
NCURSES_INLINE static void
| the item array that indicates a connection
|
| Return Values : -
+--------------------------------------------------------------------------*/
NCURSES_INLINE static void
| Function : bool _nc_Connect_Items(MENU *menu, ITEM **items)
|
| Description : Connect the items in the item array to the menu.
| Function : bool _nc_Connect_Items(MENU *menu, ITEM **items)
|
| Description : Connect the items in the item array to the menu.
| Return Values : TRUE - successful connection
| FALSE - connection failed
+--------------------------------------------------------------------------*/
| Return Values : TRUE - successful connection
| FALSE - connection failed
+--------------------------------------------------------------------------*/
and inform about a reject connection */
ResetConnectionInfo(menu, items);
return (FALSE);
}
/*---------------------------------------------------------------------------
and inform about a reject connection */
ResetConnectionInfo(menu, items);
return (FALSE);
}
/*---------------------------------------------------------------------------
| Description : Disconnect the menus item array from the menu
|
| Return Values : -
+--------------------------------------------------------------------------*/
| Description : Disconnect the menus item array from the menu
|
| Return Values : -
+--------------------------------------------------------------------------*/
{
if (menu && menu->items)
ResetConnectionInfo(menu, menu->items);
}
/*---------------------------------------------------------------------------
{
if (menu && menu->items)
ResetConnectionInfo(menu, menu->items);
}
/*---------------------------------------------------------------------------
| Description : Calculate the number of columns for a TEXT.
|
| Return Values : the width
+--------------------------------------------------------------------------*/
| Description : Calculate the number of columns for a TEXT.
|
| Return Values : the width
+--------------------------------------------------------------------------*/
- if (name)
- {
- check = _nc_Calculate_Text_Width(&((*items)->name));
- }
- else
- {
- check = _nc_Calculate_Text_Width(&((*items)->description));
- }
+ int check = (name
+ ? _nc_Calculate_Text_Width(&((*items)->name))
+ : _nc_Calculate_Text_Width(&((*items)->description)));
+
| Description : Calculate the length of an item and the width of the
| whole menu.
|
| Return Values : -
+--------------------------------------------------------------------------*/
| Description : Calculate the length of an item and the width of the
| whole menu.
|
| Return Values : -
+--------------------------------------------------------------------------*/
| Description : Statically calculate for every item its four neighbors.
| This depends on the orientation of the menu. This
| static approach simplifies navigation in the menu a lot.
|
| Return Values : -
+--------------------------------------------------------------------------*/
| Description : Statically calculate for every item its four neighbors.
| This depends on the orientation of the menu. This
| static approach simplifies navigation in the menu a lot.
|
| Return Values : -
+--------------------------------------------------------------------------*/
item->right = ((col < (Number_Of_Columns - 1)) &&
((i + 1) < Number_Of_Items)
)?
menu->items[i + 1] :
(cycle ? menu->items[row * Number_Of_Columns] :
item->right = ((col < (Number_Of_Columns - 1)) &&
((i + 1) < Number_Of_Items)
)?
menu->items[i + 1] :
(cycle ? menu->items[row * Number_Of_Columns] :
item->down = ((i + Number_Of_Columns) < Number_Of_Items)
?
menu->items[i + Number_Of_Columns] :
(cycle ? menu->items[(row + 1) < menu->rows ?
Number_Of_Items - 1 : col] :
item->down = ((i + Number_Of_Columns) < Number_Of_Items)
?
menu->items[i + Number_Of_Columns] :
(cycle ? menu->items[(row + 1) < menu->rows ?
Number_Of_Items - 1 : col] :
(cycle ? (Last_in_Column >= Number_Of_Items) ?
menu->items[Last_in_Column - Number_Of_Rows] :
menu->items[Last_in_Column] :
(cycle ? (Last_in_Column >= Number_Of_Items) ?
menu->items[Last_in_Column - Number_Of_Rows] :
menu->items[Last_in_Column] :
| Description : Update the window that is associated with the menu
|
| Return Values : -
+--------------------------------------------------------------------------*/
| Description : Update the window that is associated with the menu
|
| Return Values : -
+--------------------------------------------------------------------------*/
/* adjust the internal subwindow to start on the current top */
assert(menu->sub);
mvderwin(menu->sub, menu->spc_rows * menu->toprow, 0);
/* adjust the internal subwindow to start on the current top */
assert(menu->sub);
mvderwin(menu->sub, menu->spc_rows * menu->toprow, 0);
| Description : Redisplay the menu so that the given row becomes the
| top row and the given item becomes the new current
| item.
|
| Return Values : -
+--------------------------------------------------------------------------*/
| Description : Redisplay the menu so that the given row becomes the
| top row and the given item becomes the new current
| item.
|
| Return Values : -
+--------------------------------------------------------------------------*/
if (new_current_item != menu->curitem)
{
Call_Hook(menu, itemterm);
if (new_current_item != menu->curitem)
{
Call_Hook(menu, itemterm);