spacing(3MENU)

✨ spacing(3MENU) ✨

okay bestie, we're doing the spacing page from the menu library πŸ’… it lives in section 3MENU and it's literally all about the vibes β€” the gaps, the breathing room, the personal space between your menu items 🫢


🌸 NAME 🌸

set_menu_spacing, menu_spacing β€” set and get spacing between menu items. that's it, that's the whole job, and they ate πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

#include <menu.h>

int set_menu_spacing(MENU *menu,
                     int spc_description,
                     int spc_rows,
                     int spc_columns);
int menu_spacing(const MENU *menu,
                 int* spc_description,
                 int* spc_rows,
                 int* spc_columns);

like yes, four args each, we love a consistent queen πŸ‘‘


πŸ’– DESCRIPTION πŸ’–

so set_menu_spacing is the one that sets the spacing info for the menu, and its parameters hand over the description and the size (in rows and columns). it's giving interior decorator energy ngl 🎨

  • spc_description β€” controls the number of spaces between an item name and an item description. it must not be larger than TABSIZE. the menu system puts the pad character right in the middle of this spacing area, and the leftover parts get filled with spaces. cute, right? ✨
  • spc_rows β€” controls the number of rows that are used for an item. it must not be larger than 3. the menu system inserts the blank lines between item rows, and those lines will contain the pad character in the appropriate positions. no cap 🧚
  • spc_columns β€” controls the number of blanks between columns of items. it must not be larger than TABSIZE. and listen β€” a value of 0 for all the spacing values resets them to the default, which is 1 for all of them. iconic reset behavior πŸ’…

and then menu_spacing is the getter β€” it returns the spacing information for the menu. if a pointer is NULL, that corresponding bit of info is simply not returned. she respects boundaries 🫢


πŸ”₯ RETURN VALUE πŸ”₯

both routines return E_OK on success, periodt.

set_menu_spacing may also return:

  • E_POSTED if the menu is posted
  • E_BAD_ARGUMENT if one of the spacing values is out of range
watch those ranges bestie, the library is NOT playing around 😭

🌈 PORTABILITY 🌈

these routines are specific to ncurses. they were not supported on Version 7, BSD or System V implementations. so it is recommended that any code depending on them be conditioned using NCURSES_VERSION. like, protect yourself, always πŸ’œ


πŸ‘‘ AUTHORS πŸ‘‘

Juergen Pfeifer. manual pages and adaptation for new curses by Eric S. Raymond. absolute legends, we stan 🌟


πŸ’€ SEE ALSO πŸ’€

  • ncurses(3NCURSES)
  • curses_variables(3NCURSES)
  • menu(3MENU)

and that's the whole page, bestie πŸŽ€ this one shipped in ncurses 6.6, dated 2024-12-28, so go forth and space your menu items beautifully ✨ spacing slay, no notes πŸ’–

πŸ“¦ where this page comes from