cdk_menu(3)
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
menuis a pointer to a non-NULL menu widget. (NULL? we don't know her.) - If the
actionsparameter 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
NULLpointer foractions. that's the move.
- To activate the widget interactively, pass in a
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
menuis a pointer to a non-NULL menu widget. - The parameter
characteris the character to inject into the widget.
The return value and the side-effect (setting the widget data exitType) depend upon the injected character:
RETURNorTABβ the function returns the current menu list* 100+ the sub-menu number. The widget dataexitTypeis set tovNORMAL. πESCAPEβ the function returns-1. The widget dataexitTypeis set tovESCAPE_HIT.- Otherwise β unless modified by preprocessing, postprocessing or key bindings, the function returns
-1. The widget dataexitTypeis set tovEARLY_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 areLEFTandRIGHT.menuPosβ tells whether the menu is to be on the top of the screen or the bottom. Valid values areTOPandBOTTOM.titleAttributeandsubtitleAttributeβ 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
menuItemandsubmenuItemset 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
newCDKMenufunction.
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
functionis the callback function. - The parameter
datapoints 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
functionis the callback function. - The parameter
datapoints 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 dataexitTypetovNORMAL. πEscapeβ exits the widget and returns-1. this also sets the widget dataexitTypetovESCAPE_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 πβ¨
π¦ where this page comes from
- debian trixie: libcdk5-dev 5.0.20250116-1 Β· BSD-4-Clause
- fedora 43: cdk 5.0.20251014-1.fc43 Β· X11-distribute-modifications-variant
- fedora 43: cdk 5.0.20251014-1.fc43 Β· X11-distribute-modifications-variant
- fedora 44: cdk 5.0.20251014-3.fc44 Β· X11-distribute-modifications-variant
- fedora 44: cdk 5.0.20251014-3.fc44 Β· X11-distribute-modifications-variant
- nixos 26.05: cdk 5.0-20260119
- nixpkgs unstable: cdk 5.0-20260119
- ubuntu questing: libcdk5-dev 5.0.20250116-1
- ubuntu resolute: libcdk5-dev 5.0.20251014-1 Β· BSD-4-Clause
- ubuntu stonking: libcdk5-dev 5.0.20260119-1 Β· BSD-4-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms