cdk_menu(3)

πŸ“¦
version 5.0.20260119 Β· 4 versions
, in debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, ubuntu questing, ubuntu resolute, ubuntu stonking

cdk_menu πŸ’– β€” the Cdk menu widget, aka your new fave

manual page: cdk_menu(3) Β· section: Library calls


✨ NAME ✨

cdk_menu β€” the Cdk menu widget πŸŽ€ (yes bestie, a whole pull-down menu, we're so back)


✨ SYNOPSIS ✨

okay so first you gotta link it, obviously:

cc [ flag ... ] file ...  -lcdk [ library ... ]

and then you tell your code we're doing menu things:

#include <cdk.h>

and here's the entire cast of characters, verbatim, no notes:

int activateCDKMenu (
               CDKMENU *menu,
               chtype * actions);

void destroyCDKMenu (
               CDKMENU *menu);

void drawCDKMenu (
               CDKMENU *menu,
               boolean box);

void drawCDKMenuSubwin (
               CDKMENU *menu);

void eraseCDKMenu (
               CDKMENU *menu);

void eraseCDKMenuSubwin (
               CDKMENU *menu);

void getCDKMenuCurrentItem (
               CDKMENU *menu,
               int *menuItem,
               int *submenuItem);

chtype getCDKMenuSubTitleHighlight (
               CDKMENU *menu);

chtype getCDKMenuTitleHighlight (
               CDKMENU *menu);

int injectCDKMenu (
               CDKMENU *menu,
               chtype input);

CDKMENU *newCDKMenu (
               CDKSCREEN *cdkscreen,
               const char *menulist[MAX_MENU_ITEMS][MAX_SUB_ITEMS],
               int menuListLength,
               int *submenuListLength,
               int *menuLocation,
               int menuPos,
               chtype titleAttribute,
               chtype subtitleAttribute);

void setCDKMenu (
               CDKMENU *menu,
               int menuItem,
               int submenuItem,
               chtype titleAttribute,
               chtype subtitleAttribute);

void setCDKMenuBackgroundAttrib (
               CDKMENU *menu,
               chtype attribute);

void setCDKMenuBackgroundColor (
               CDKMENU *menu,
               const char * color);

void setCDKMenuCurrentItem (
               CDKMENU *menu,
               int menuItem,
               int submenuItem);

void setCDKMenuPostProcess (
               CDKMENU *menu,
               PROCESSFN callback,
               void * data);

void setCDKMenuPreProcess (
               CDKMENU *menu,
               PROCESSFN callback,
               void * data);

void setCDKMenuSubTitleHighlight (
               CDKMENU *menu,
               chtype highlight);

void setCDKMenuTitleHighlight (
               CDKMENU *menu,
               chtype highlight);

✨ DESCRIPTION ✨

The Cdk menu widget creates a pull-down menu list 🫢. Like, the whole dropdown moment. And everything below is the set of functions that either create or manipulate the Cdk menu widget. That's it, that's the job.


✨ AVAILABLE FUNCTIONS ✨

activateCDKMenu πŸ’…

activates the menu widget and lets the user actually interact with it. main character energy fr.

  • The parameter menu is a pointer to a non-NULL menu widget. (NULL? we don't know her.)
  • If the actions parameter is passed with a non-NULL value, the characters in the array will be injected into the widget.
    • To activate the widget interactively, pass in a NULL pointer for actions. that's the move.

okay so here's the tea on what comes back πŸ“:

If the character entered into this widget is RETURN, then this function returns an integer which is a value of the current menu list * 100 + the sub-menu number. It will also set the widget data exitType to vNORMAL.

If the character entered into this widget was ESCAPE, then the widget will return a value of -1 and the widget data exitType will be set to vESCAPE_HIT. 😭


destroyCDKMenu πŸ—‘οΈ

removes the widget from the screen and frees memory the object used. it's giving cleanup era.


drawCDKMenu 🎨

draws the menu widget on the screen.

If the box parameter is true, the widget is drawn with a box. ✨


drawCDKMenuSubwin πŸ–οΈ

draws the menu item subwindow.


eraseCDKMenu 🧽

removes the widget from the screen. This does NOT destroy the widget. (erase β‰  destroy, keep up bestie πŸ’€)


eraseCDKMenuSubwin 🧼

erases the menu item subwindow.


getCDKMenuCurrentItem πŸ‘€

returns the values menuItem and submenuItem to the current menu selection.


getCDKMenuSubTitleHighlight ✨

returns the highlight attribute of the sub-menu selection bar.


getCDKMenuTitleHighlight 🌟

returns the highlight attributes of the menu title.


injectCDKMenu πŸ’‰

injects a single character into the widget.

  • The parameter menu is a pointer to a non-NULL menu widget.
  • The parameter character is the character to inject into the widget.

The return value and the side-effect (setting the widget data exitType) depend upon the injected character:

  • RETURN or TAB β€” the function returns the current menu list * 100 + the sub-menu number. The widget data exitType is set to vNORMAL. πŸŽ€
  • ESCAPE β€” the function returns -1. The widget data exitType is set to vESCAPE_HIT.
  • Otherwise β€” unless modified by preprocessing, postprocessing or key bindings, the function returns -1. The widget data exitType is set to vEARLY_EXIT. πŸ™ˆ

newCDKMenu πŸ‘‘

creates a menu widget and returns a pointer to it. the origin story. Parameters:

  • screen β€” is the screen you wish this widget to be placed in.
  • menuList β€” is a list of the menu list titles.
  • menuListLength β€” is the number of pull down menus.
  • submenuListLength β€” is the number of menu items under each menu list.
  • menuLocation β€” tells where each menu is to be located. Valid values are LEFT and RIGHT.
  • menuPos β€” tells whether the menu is to be on the top of the screen or the bottom. Valid values are TOP and BOTTOM.
  • titleAttribute and
  • subtitleAttribute β€” are the character attributes of the title and sub-titles respectively.

If the widget could not be created then a NULL pointer is returned. πŸ’€


setCDKMenu πŸ› οΈ

lets the programmer modify certain elements of an existing menu widget. glow-up privileges.

  • The parameters menuItem and submenuItem set which menu list and sub-menu item are going to be highlighted when the widget is activated.
  • The other parameter names correspond to the same parameter names listed in the newCDKMenu function.

setCDKMenuBackgroundAttrib 🌈

sets the background attribute of the widget.

The parameter attribute is a curses attribute, e.g., A_BOLD.


setCDKMenuBackgroundColor 🎨

sets the background color of the widget.

The parameter color is in the format of the Cdk format strings.

See cdk_display (3).


setCDKMenuCurrentItem πŸ“

sets the current item in the menu widget.


setCDKMenuPostProcess πŸ”

allows the user to have the widget call a function after the key has been applied to the widget.

  • The parameter function is the callback function.
  • The parameter data points to data passed to the callback function.

To learn more about post-processing see cdk_process(3).


setCDKMenuPreProcess βͺ

allows the user to have the widget call a function after a key is hit and before the key is applied to the widget.

  • The parameter function is the callback function.
  • The parameter data points to data passed to the callback function.

To learn more about pre-processing see cdk_process(3).


setCDKMenuSubTitleHighlight ✨

sets the highlight attribute of the sub-menu selection bar.


setCDKMenuTitleHighlight πŸ‘‘

sets the highlight attributes of the menu title.

✨ KEY BINDINGS ✨

okay so when this widget gets activated, there are several default key bindings that lowkey help you enter or manipulate the info super fast. here's the whole key map for this widget, bestie β€” no table, just vibes and facts:

  • Left Arrow β€” highlights the menu list to the left of the current menu. πŸ¦‹
  • Right Arrow β€” highlights the menu list to the right of the current menu. ✨
  • Up Arrow β€” moves the current menu selection up one. ⬆️
  • Down Arrow β€” moves the current menu selection down one. ⬇️
  • Space β€” moves the current menu selection down one. πŸ“
  • Tab β€” highlights the menu list to the right of the current menu. πŸŽ€
  • Return β€” exits the widget and returns the index of the selected item. this also sets the widget data exitType to vNORMAL. πŸ’…
  • Escape β€” exits the widget and returns -1. this also sets the widget data exitType to vESCAPE_HIT. 🫢
  • Ctrl-L β€” refreshes the screen. πŸ”„

🌸 SEE ALSO 🌸


okay that's the whole page, bestie πŸ’– this one is cdk_menu(3), dated 2025-01-14 β€” go forth and menu like the main character you are πŸ‘‘βœ¨