hook(3MENU)
π hook(3MENU) β library calls, but make it make sense π
okay bestie, gather round, because today we're talking about menu_hook, and it's literally the "set hooks for automatic invocation by applications" situation. no cap, this is the glow-up that lets your app sneak its own little functions into the menu's autopilot. πͺβ¨
β¨ NAME β¨
menu_hook β set hooks for automatic invocation by applications π
πΈ SYNOPSIS πΈ
#include <menu.h>
int set_item_init(MENU *menu, Menu_Hook func);
Menu_Hook item_init(const MENU *menu);
int set_item_term(MENU *menu, Menu_Hook func);
Menu_Hook item_term(const MENU *menu);
int set_menu_init(MENU *menu, Menu_Hook func);
Menu_Hook menu_init(const MENU *menu);
int set_menu_term(MENU *menu, Menu_Hook func);
Menu_Hook menu_term(const MENU *menu);
π DESCRIPTION π
so these functions are the main character energy of the whole page β they let you set hook functions that get called at various points in the automatic processing of input event codes by menu_driver. it's giving "you get a callback, you get a callback, everybody gets a callback." π¦
set_item_initβ sets a hook to be called at menu-post time and each time the selected item changes (after the change, iykyk). anditem_initreturns the current item init hook, if any (NULLif there is no such hook). πset_item_termβ sets a hook to be called at menu-unpost time and each time the selected item changes (before the change, bestie, the timing matters). anditem_termreturns the current item term hook, if any (NULLif there is no such hook). π§set_menu_initβ sets a hook to be called at menu-post time and just after the top row on the menu changes once it is posted. andmenu_initreturns the current menu init hook, if any (NULLif there is no such hook). πset_menu_termβ sets a hook to be called at menu-unpost time and just before the top row on the menu changes once it is posted. andmenu_termreturns the current menu term hook, if any (NULLif there is no such hook). π
π₯ RETURN VALUE π₯
the routines that return pointers? they return NULL on error. simple as that. π
every other routine returns one of these iconic little values:
E_OKβ the routine succeeded. slay. πE_SYSTEM_ERRORβ a system error occurred (peeperrno(3)). π
π«Ά PORTABILITY π«Ά
these routines emulate the System V menu library. they were not supported on Version 7 or BSD versions, so don't come for them, they simply weren't invited. π
β AUTHORS β
Juergen Pfeifer. manual pages and adaptation for new curses by Eric S. Raymond. legends only. π
π SEE ALSO π
ncurses(3NCURSES), menu(3MENU)
that's the whole vibe, bestie β go forth and hook responsibly π this has been the ncurses 6.6 era, dated 2024-12-28, signing off with maximum main character energy. periodt. β¨
π¦ 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-2007,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