win(3MENU)
π win β bestie, let's talk menu windows π
okay so real talk, this is from the win(3MENU) page in the library calls section, and it's literally all about making and breaking menu window and subwindow associations. like, matchmaking but for curses windows π«Ά
β¨ NAME β¨
menu_win β make and break menu window and subwindow associations π
πΈ SYNOPSIS πΈ
#include <menu.h>
int set_menu_win(MENU *menu, WINDOW *win);
WINDOW *menu_win(const MENU *menu);
int set_menu_sub(MENU *menu, WINDOW *sub);
WINDOW *menu_sub(const MENU *menu);
int scale_menu(const MENU *menu, int *rows, int *columns);
π¦ DESCRIPTION π¦
so every menu has an associated pair of curses windows, no cap. they come as a duo, main character energy π
- the menu window displays any title and border associated with the window
- the menu subwindow displays the items of the menu that are currently available for selection
the first four functions get and set those windows. and here's the tea: it is not necessary to set either window β by default, the driver code uses stdscr for both. so if you do nothing, it still works. lowkey iconic of it π
in the set_ functions:
- a window argument of
NULLis treated as though it werestsdcr. (yes, that's spelled exactly like that in the source, bestie β I'm not fixing it, that's the vibe π) - a menu argument of
NULLis treated as a request to change the system default menu window or subwindow
and the function scale_menu returns the minimum size required for the subwindow of menu. it's giving "how much room do I need" energy πβ¨
π RETURN VALUE π
- routines that return pointers return
NULLon error - routines that return an integer return one of the following error codes:
E_OKβ the routine succeeded. we love a success story πE_SYSTEM_ERRORβ system error occurred (seeerrno(3)). it's giving chaos πE_BAD_ARGUMENTβ routine detected an incorrect or out-of-range argument. bestie, what did you pass in πE_POSTEDβ the menu has already been posted. it's already out there, you can't do that again π«E_NOT_CONNECTEDβ no items are connected to the menu. an empty menu is just a sad little box π
π PORTABILITY π
these routines emulate the System V menu library. they were not supported on Version 7 or BSD versions. so like, vintage but make it specific π°οΈ
π AUTHORS π
Juergen Pfeifer. Manual pages and adaptation for new curses by Eric S. Raymond. absolute legends, fr fr π«Ά
π₯ SEE ALSO π₯
ncurses(3NCURSES)curses_variables(3NCURSES)menu(3MENU)
go read those too, iykyk πβ¨
and that's the whole page, bestie!! this one's from ncurses 6.6, dated 2024-12-28, filed under win(3MENU). slay, go associate some windows π
ππ
π¦ where this page comes from
- ubuntu resolute: ncurses-doc 6.6+20251231-1 Β· MIT/X11
- ubuntu stonking: ncurses-doc 6.6+20260608-2 Β· MIT/X11
- Copyright 2018-2023,2024 Thomas E. Dickey
- Copyright 1998-2006,2010 Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms