cdk_dialog(3)
β¨ NAME β¨
cdk_dialog β it's the Cdk dialog widget, bestie π the little pop-up box that says stuff and gives you buttons to smash.
π SYNOPSIS π
Compile it like this, periodt:
cc [ flag ... ] file ... -lcdk [ library ... ]
#include <cdk.h>
And here's the whole squad of functions, verbatim, no cap:
int activateCDKDialog (
CDKDIALOG *dialog,
chtype * actions);
void destroyCDKDialog (
CDKDIALOG *dialog);
void drawCDKDialog (
CDKDIALOG *dialog,
boolean box);
void drawCDKDialogButtons (
CDKDIALOG *dialog);
void eraseCDKDialog (
CDKDIALOG *dialog);
boolean getCDKDialog (
CDKDIALOG *dialog);
boolean getCDKDialogBox (
CDKDIALOG *dialog);
chtype getCDKDialogHighlight (
CDKDIALOG *dialog);
boolean getCDKDialogSeparator (
CDKDIALOG *dialog);
int injectCDKDialog (
CDKDIALOG *dialog,
chtype input);
void moveCDKDialog (
CDKDIALOG *dialog,
int xpos,
int ypos,
boolean relative,
boolean refresh);
CDKDIALOG *newCDKDialog (
CDKSCREEN *cdkscreen,
int xpos,
int ypos,
CDK_CONST char ** message,
int rows,
CDK_CONST char ** buttons,
int buttonCount,
chtype highlight,
boolean separator,
boolean box,
boolean shadow);
void positionCDKDialog (
CDKDIALOG *dialog);
void setCDKDialogBox (
CDKDIALOG *dialog,
boolean boxWidget);
void setCDKDialog (
CDKDIALOG *dialog,
chtype highlight,
boolean separator,
boolean box);
void setCDKDialogBackgroundAttrib (
CDKDIALOG *dialog,
chtype attribute);
void setCDKDialogBackgroundColor (
CDKDIALOG *dialog,
const char * color);
void setCDKDialogBox (
CDKDIALOG *dialog,
boolean box);
void setCDKDialogBoxAttribute (
CDKDIALOG *dialog,
chtype character);
void setCDKDialogHighlight (
CDKDIALOG *dialog,
chtype highlight);
void setCDKDialogHorizontalChar (
CDKDIALOG *dialog,
chtype character);
void setCDKDialogLLChar (
CDKDIALOG *dialog,
chtype character);
void setCDKDialogLRChar (
CDKDIALOG *dialog,
chtype character);
void setCDKDialogPostProcess (
CDKDIALOG *dialog,
PROCESSFN callback,
void * data);
void setCDKDialogPreProcess (
CDKDIALOG *dialog,
PROCESSFN callback,
void * data);
void setCDKDialogSeparator (
CDKDIALOG *dialog,
boolean separator);
void setCDKDialogULChar (
CDKDIALOG *dialog,
chtype character);
void setCDKDialogURChar (
CDKDIALOG *dialog,
chtype character);
void setCDKDialogVerticalChar (
CDKDIALOG *dialog,
chtype character);
Not me noticing there are twosetCDKDialogBoxprototypes in here π one takesboolean boxWidgetand the other takesboolean box. I'm just the messenger, I'm reading it exactly how it's written, okay? π
πΈ DESCRIPTION πΈ
So. The Cdk dialog widget π it builds you a dialog box β a whole moment, honestly β with a message inside it and a varied number of buttons to choose from. Like, as many buttons as your heart desires, and then you pick one. Main character energy fr fr.
The functions listed below are the ones that create the Cdk dialog box widget, or manipulate it once it exists. Create it, draw it, poke at it, tear it down β the full arc. β¨
iykyk π¦
β¨ AVAILABLE FUNCTIONS β¨
okay bestie, this is the whole roster of functions this widget ships with, and honestly? it's giving full-service. every single one, no skips π
activateCDKDialog
activates the dialog widget and lets the user interact with the widget. this is the glow-up moment where your widget actually does stuff π₯
- The parameter
dialogis a pointer to a non-NULL dialog widget. - 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 NULL pointer for actions.
If the character entered into this widget is RETURN or TAB then this function will return a value from 0 to the number of buttons -1, representing the button selected. It also sets the widget data exitType to vNORMAL.
If the character entered into this widget was ESCAPE, then the widget returns a value of -1 and the widget data exitType will be set to vESCAPE_HIT.
destroyCDKDialog
removes the widget from the screen and frees memory the object used. like, fully gone, ghosted, no refunds π«Ά
drawCDKDialog
draws the dialog widget on the screen.
If the box parameter is true, the widget is drawn with a box. β¨
drawCDKDialogButtons
draws the dialog buttons and the separation line. the little divider moment, we love her π
eraseCDKDialog
removes the widget from the screen. This does NOT destroy the widget. so she's off-screen but still alive and thriving, lowkey iconic π
getCDKDialog
returns true if the list will be drawn with a box around it.
getCDKDialogBox
returns true if the dialog will be drawn with a box around it.
getCDKDialogHighlight
returns the highlight attribute of the widget.
getCDKDialogSeparator
returns the state of the separator flag.
injectCDKDialog
injects a single character into the widget. sneaky little character drop, love that for us π
- The parameter
dialogis a pointer to a non-NULL dialog widget. - The parameter
characteris the character to inject into the widget.
The return value and side-effect (setting the widget data exitType) depend upon the injected character:
RETURNorTABβ the function returns a value from zero to one less than the number of buttons, representing the button selected. 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.
moveCDKDialog
moves the given widget to the given position. relocation era π¦
- The parameters
xposandyposare the new position of the widget.
The parameter xpos may be an integer or one of the pre-defined values TOP, BOTTOM, and CENTER.
The parameter ypos may be an integer or one of the pre-defined values LEFT, RIGHT, and CENTER.
The parameter relative states whether the xpos/ypos pair is a relative move or an absolute move.
For example, if xpos = 1 and ypos = 2 and relative = TRUE, then the widget would move one row down and two columns right. If the value of relative was FALSE, then the widget would move to the position (1,2).
Do not use the valuesTOP,BOTTOM,LEFT,RIGHT, orCENTERwhenrelative = TRUE. (weird things may happen). seriously bestie, weird things WILL happen π
- The final parameter
refreshis a boolean value which states whether the widget will get refreshed after the move.
newCDKDialog
creates a dialog widget and returns a pointer to it. fresh widget, just dropped π
Parameters:
screenβ is the screen you wish this widget to be placed in.xposβ controls the placement of the object along the horizontal axis. It may be integer or one of the pre-defined valuesLEFT,RIGHT, andCENTER.yposβ controls the placement of the object along the vertical axis. It may be an integer or one of the pre-defined valuesTOP,BOTTOM, andCENTER.messageβ is the text to be displayed in the message region of the dialog box.rowsβ is the number of elements in the message list.buttonsβ is an array containing the button labels to be displayed on the bottom of the dialog box.buttonCountβ is the number of elements in thebuttonsarray.highlightβ is the attribute of the currently highlighted button.boxβ is true if the widget should be drawn with a box around it.separatorβ is true if a separator line should be drawn between the message region and the buttons.shadowβ turns the shadow on or off around this widget.
If the widget could not be created then a NULL pointer is returned. π
positionCDKDialog
allows the user to move the widget around the screen via the cursor/keypad keys. See cdk_position (3) for key bindings. drag her around like a lil app icon β¨
setCDKDialogBox
sets whether the widget will be drawn with a box around it.
setCDKDialog
lets the programmer modify certain elements of an existing dialog widget.
The parameter names correspond to the same parameter names listed in the newCDKDialog function. glow-up on demand π
setCDKDialogBackgroundAttrib
sets the background attribute of the widget.
The parameter attribute is a curses attribute, e.g., A_BOLD.
setCDKDialogBackgroundColor
sets the background color of the widget.
The parameter color is in the format of the Cdk format strings.
See cdk_display (3). setCDKDialogBox sets the box attribute of the dialog widget.
setCDKDialogBoxAttribute
function sets the attribute of the box.
setCDKDialogHighlight
sets the highlight attribute of the selected button.
setCDKDialogHorizontalChar
sets the horizontal drawing character for the box to the given character.
setCDKDialogLLChar
sets the lower left hand corner of the widget's box to the given character.
setCDKDialogLRChar
sets the lower right hand corner of the widget's box to the given character.
setCDKDialogPreProcess
allows the user to have the widget call a function after a key is hit and before the key is applied to the widget. pregame function, the opening act π
- The parameter
functionis the callback function. - The parameter
datais a pointer to void.
To learn more about pre-processing see cdk_process(3).
setCDKDialogPostProcess
allows the user to have the widget call a function after the key has been applied to the widget. the afters, the encore πΈ
- 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).
setCDKDialogSeparator
sets the boolean flag whether the widget will be drawn with the separator bar between the buttons and the message area.
setCDKDialogULChar
function sets the upper left hand corner of the widget's box to the given character.
setCDKDialogURChar
sets the upper right hand corner of the widget's box to the given character.
setCDKDialogVerticalChar
sets the vertical drawing character for the box to the given character.
β¨ KEY BINDINGS β¨
Okay bestie, once the widget is activated, there's a whole set of default key bindings just vibing there, ready to help the user enter or manipulate the information fast. The following list lays out the keys and their actions for this widget. π
Left Arrowβ Selects the button to the left of the current button.Right Arrowβ Selects the button to the right of the current button.Tabβ Selects the button to the right of the current button.Spaceβ Selects the button to the right of the current button.Returnβ Exits the widget and returns the index of the selected button. This also sets the widget dataexitTypetovNORMAL.Tabβ Exits the widget and returns the index of the selected button. 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.
Not me pointing out that Tab is literally listed twice with two completely different jobs β once it's moving you right, once it's yeeting you out of the widget. That's the manpage being real, not me being messy. Both are canon. π
πΈ SEE ALSO πΈ
Go read these too, they're the friend group:
And that's a wrap on cdk_dialog(3), bestie!! π«Ά This little icon comes to you courtesy of the CDK source, dated 2025-01-14, and the manual page itself is cdk_dialog(3). Now go forth and make your dialogs absolutely slay. πβ¨π
π¦ 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