• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-12-stable/contrib/ncurses/menu/

Lines Matching defs:menu

35 * Globally used internal routines and the default menu and item structures *
38 #include "menu.priv.h"
61 (WINDOW *)0, /* Window containing entire menu */
62 (WINDOW *)0, /* Portion of menu displayed */
66 0, /* Total Nr. of items in menu */
68 0, /* Top row of menu */
86 (MENU *)0, /* Pointer to parent menu */
102 | Function : static void ComputeMaximum_NameDesc_Lenths(MENU *menu)
105 | of the items connected to the menu
110 ComputeMaximum_NameDesc_Lengths(MENU * menu)
117 assert(menu && menu->items);
118 for (items = menu->items; *items; items++)
129 menu->namelen = (short)MaximumNameLength;
130 menu->desclen = (short)MaximumDescriptionLength;
131 T(("ComputeMaximum_NameDesc_Lengths %d,%d", menu->namelen, menu->desclen));
138 | Description : Reset all informations in the menu and the items in
144 ResetConnectionInfo(MENU * menu, ITEM ** items)
148 assert(menu && items);
154 if (menu->pattern)
155 free(menu->pattern);
156 menu->pattern = (char *)0;
157 menu->pindex = 0;
158 menu->items = (ITEM **) 0;
159 menu->nitems = 0;
164 | Function : bool _nc_Connect_Items(MENU *menu, ITEM **items)
166 | Description : Connect the items in the item array to the menu.
168 | pointer to the menu.
174 _nc_Connect_Items(MENU * menu, ITEM ** items)
179 if (menu && items)
194 if (menu->opt & O_ONEVALUE)
199 (*item)->imenu = menu;
208 menu->items = items;
209 menu->nitems = (short)ItemCount;
210 ComputeMaximum_NameDesc_Lengths(menu);
211 if ((menu->pattern = typeMalloc(char, (unsigned)(1 + menu->namelen))))
213 Reset_Pattern(menu);
214 set_menu_format(menu, menu->frows, menu->fcols);
215 menu->curitem = *items;
216 menu->toprow = 0;
223 ResetConnectionInfo(menu, items);
229 | Function : void _nc_Disconnect_Items(MENU *menu)
231 | Description : Disconnect the menus item array from the menu
236 _nc_Disconnect_Items(MENU * menu)
238 if (menu && menu->items)
239 ResetConnectionInfo(menu, menu->items);
287 * Calculate the actual width of a menu entry for wide-characters.
291 calculate_actual_width(MENU * menu, bool name)
297 assert(menu && menu->items);
299 if (menu->items != 0)
301 for (items = menu->items; *items; items++)
317 width = (name ? menu->namelen : menu->desclen);
323 name ? menu->namelen : menu->desclen));
327 #define calculate_actual_width(menu, name) (name ? menu->namelen : menu->desclen)
332 | Function : void _nc_Calculate_Item_Length_and_Width(MENU *menu)
335 | whole menu.
340 _nc_Calculate_Item_Length_and_Width(MENU * menu)
344 assert(menu);
346 menu->height = (short)(1 + menu->spc_rows * (menu->arows - 1));
348 l = calculate_actual_width(menu, TRUE);
349 l += menu->marklen;
351 if ((menu->opt & O_SHOWDESC) && (menu->desclen > 0))
353 l += calculate_actual_width(menu, FALSE);
354 l += menu->spc_desc;
357 menu->itemlen = (short)l;
358 l *= menu->cols;
359 l += (menu->cols - 1) * menu->spc_cols; /* for the padding between the columns */
360 menu->width = (short)l;
363 menu->cols,
364 menu->itemlen,
365 menu->width));
370 | Function : void _nc_Link_Item(MENU *menu)
373 | This depends on the orientation of the menu. This
374 | static approach simplifies navigation in the menu a lot.
379 _nc_Link_Items(MENU * menu)
381 if (menu && menu->items && *(menu->items))
385 int Number_Of_Items = menu->nitems;
389 bool cycle = (menu->opt & O_NONCYCLIC) ? FALSE : TRUE;
391 ClrStatus(menu, _LINK_NEEDED);
393 if (menu->opt & O_ROWMAJOR)
395 int Number_Of_Columns = menu->cols;
399 item = menu->items[i];
406 menu->items[i - 1] :
407 (cycle ? menu->items[(Last_in_Row >= Number_Of_Items) ?
415 menu->items[i + 1] :
416 (cycle ? menu->items[row * Number_Of_Columns] :
420 Last_in_Column = (menu->rows - 1) * Number_Of_Columns + col;
422 item->up = (row) ? menu->items[i - Number_Of_Columns] :
423 (cycle ? menu->items[(Last_in_Column >= Number_Of_Items) ?
430 menu->items[i + Number_Of_Columns] :
431 (cycle ? menu->items[(row + 1) < menu->rows ?
445 int Number_Of_Rows = menu->rows;
449 item = menu->items[i = (col * Number_Of_Rows + row)];
451 Last_in_Column = (menu->cols - 1) * Number_Of_Rows + row;
454 menu->items[i - Number_Of_Rows] :
456 menu->items[Last_in_Column - Number_Of_Rows] :
457 menu->items[Last_in_Column] :
462 menu->items[i + Number_Of_Rows] :
463 (cycle ? menu->items[row] : (ITEM *) 0);
468 menu->items[i - 1] :
470 menu->items[(Last_in_Row >= Number_Of_Items) ?
477 (menu->items[((i + 1) < Number_Of_Items) ?
481 menu->items[col * Number_Of_Rows] :
499 | Function : void _nc_Show_Menu(const MENU* menu)
501 | Description : Update the window that is associated with the menu
506 _nc_Show_Menu(const MENU * menu)
511 assert(menu);
512 if ((menu->status & _POSTED) && !(menu->status & _IN_DRIVER))
515 assert(menu->sub);
516 mvderwin(menu->sub, menu->spc_rows * menu->toprow, 0);
517 win = Get_Menu_Window(menu);
522 if (menu->height < maxy)
523 maxy = menu->height;
524 if (menu->width < maxx)
525 maxx = menu->width;
527 copywin(menu->sub, win, 0, 0, 0, 0, maxy - 1, maxx - 1, 0);
528 pos_menu_cursor(menu);
535 | MENU *menu,
539 | Description : Redisplay the menu so that the given row becomes the
547 MENU * menu,
555 assert(menu);
556 if (menu->status & _POSTED)
558 if (new_current_item != menu->curitem)
560 Call_Hook(menu, itemterm);
563 if (new_toprow != menu->toprow)
565 Call_Hook(menu, menuterm);
569 cur_item = menu->curitem;
571 menu->toprow = (short)new_toprow;
572 menu->curitem = new_current_item;
576 Call_Hook(menu, menuinit);
581 Move_To_Current_Item(menu, cur_item);
582 Call_Hook(menu, iteminit);
586 _nc_Show_Menu(menu);
589 pos_menu_cursor(menu);
593 menu->toprow = (short)new_toprow;
594 menu->curitem = new_current_item;