cdk_buttonbox(3)
๐ cdk_buttonbox ๐
okay bestie, pull up a chair, we're talking about cdk_buttonbox โ that's the Cdk buttonbox widget, from section 3 of the manual (library calls, iykyk). this is part 1 of 3 so don't go anywhere, there's more coming ๐
โจ NAME โจ
cdk_buttonbox โ it's giving Cdk buttonbox widget. that's it. that's the name. iconic. ๐
๐ฆ SYNOPSIS ๐ฆ
so first, you gotta compile it in, like so:
cc [ flag ... ] file ... -lcdk [ library ... ]
and then you gotta actually include the thing, obviously:
#include <cdk.h>
and then, here's the whole entire menu of functions this widget hands you, no cap, every single one, exactly as written:
int activateCDKButtonbox (
CDKBUTTONBOX *buttonbox,
chtype * actions);
void destroyCDKButtonbox (
CDKBUTTONBOX *buttonbox);
void drawCDKButtonbox (
CDKBUTTONBOX *buttonbox,
boolean box);
void drawCDKButtonboxButtons (
CDKBUTTONBOX *buttonbox);
void eraseCDKButtonbox (
CDKBUTTONBOX *buttonbox);
boolean getCDKButtonboxBox (
CDKBUTTONBOX *buttonbox);
int getCDKButtonboxButtonCount (
CDKBUTTONBOX *buttonbox);
int getCDKButtonboxCurrentButton (
CDKBUTTONBOX *buttonbox);
chtype getCDKButtonboxHighlight (
CDKBUTTONBOX *buttonbox);
int injectCDKButtonbox (
CDKBUTTONBOX *buttonbox,
chtype input);
void moveCDKButtonbox (
CDKBUTTONBOX *buttonbox,
int xpos,
int ypos,
boolean relative,
boolean refresh);
CDKBUTTONBOX *newCDKButtonbox (
CDKSCREEN *cdkscreen,
int xpos,
int ypos,
int height,
int width,
const char * title,
int rows,
int cols,
CDK_CONST char ** buttons,
int buttonCount,
chtype highlight,
boolean box,
boolean shadow);
void positionCDKButtonbox (
CDKBUTTONBOX *buttonbox);
void setCDKButtonbox (
CDKBUTTONBOX *buttonbox,
chtype highlight,
boolean box);
void setCDKButtonboxBackgroundAttrib (
CDKBUTTONBOX *buttonbox,
chtype attribute);
void setCDKButtonboxBackgroundColor (
CDKBUTTONBOX *buttonbox,
const char * color);
void setCDKButtonboxBox (
CDKBUTTONBOX *buttonbox,
boolean box);
void setCDKButtonboxBoxAttribute (
CDKBUTTONBOX *buttonbox,
chtype character);
void setCDKButtonboxCurrentButton (
CDKBUTTONBOX *buttonbox,
int button);
void setCDKButtonboxHighlight (
CDKBUTTONBOX *buttonbox,
chtype highlight);
void setCDKButtonboxHorizontalChar (
CDKBUTTONBOX *buttonbox,
chtype character);
void setCDKButtonboxLLChar (
CDKBUTTONBOX *buttonbox,
chtype character);
void setCDKButtonboxLRChar (
CDKBUTTONBOX *buttonbox,
chtype character);
void setCDKButtonboxPostProcess (
CDKBUTTONBOX *buttonbox,
PROCESSFN callback,
void * data);
void setCDKButtonboxPreProcess (
CDKBUTTONBOX *buttonbox,
PROCESSFN callback,
void * data);
void setCDKButtonboxULChar (
CDKBUTTONBOX *buttonbox,
chtype character);
void setCDKButtonboxURChar (
CDKBUTTONBOX *buttonbox,
chtype character);
void setCDKButtonboxVerticalChar (
CDKBUTTONBOX *buttonbox,
chtype character);
like, that's a lot of functions. she's thorough. we love a thorough queen. ๐
๐ DESCRIPTION ๐
okay so here's the vibe: the Cdk buttonbox widget spins up a little buttonbox box โ yes, a box with a message and a varied number of buttons for your user to pick from ๐ซถ. you know, the classic "which one do you want, bestie" situation.
and the way that it works is: the functions listed down there in the synopsis? those are the ones that create the Cdk buttonbox box widget or manipulate it. that's the whole job. that's what they do. periodt. ๐
lowkey this page is long so it comes in 3 parts and this was just part 1 โ more is on the way, bestie, don't scroll away ๐ธ
โจ AVAILABLE FUNCTIONS โจ
activateCDKButtonboxโ activates the buttonbox widget and lets the user interact with the widget. ๐- The parameter
buttonboxis a pointer to a non-NULLbuttonbox widget. - If the
actionsparameter is passed with a non-NULLvalue, the characters in the array will be injected into the widget.- To activate the widget interactively, pass in a
NULLpointer foractions.
- To activate the widget interactively, pass in a
- If the character entered into this widget is
RETURNorTAB, then this function will return a value from0to the number of buttons-1, representing the button selected. It will also set the widget dataexitTypetovNORMAL. - If the character entered into this widget was
ESCAPE, then the widget will return a value of-1and the widget dataexitTypewill be set tovESCAPE_HIT.
- The parameter
destroyCDKButtonboxโ removes the widget from the screen and releases any memory the object used. ๐งนdrawCDKButtonboxโ draws the buttonbox widget on the screen. ๐จ- If the
boxparameter is true, the widget is drawn with a box.
- If the
drawCDKButtonboxButtonsโ draws the buttons. ๐eraseCDKButtonboxโ removes the widget from the screen. This does NOT destroy the widget. ๐คgetCDKButtonboxBoxโ returns true if the widget will be drawn with a box around it. ๐ฆgetCDKButtonboxButtonCountโ returns the number of buttons in the button box. ๐ขgetCDKButtonboxCurrentButtonโ returns the current button-number. ๐getCDKButtonboxHighlightโ returns the highlight attribute of the widget. โจinjectCDKButtonboxโ injects a single character into the widget. ๐- The parameter
buttonboxis a pointer to a non-NULLbuttonbox 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 ranging from zero to one less than the number of buttons, representing the button selected. The widget dataexitTypeis set tovNORMAL.ESCAPEโ the function returns-1.vESCAPE_HIT. 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.
- The parameter
moveCDKButtonboxโ moves the given widget to the given position. ๐- The parameters
xposandyposare the new position of the widget.- The parameter
xposmay be an integer or one of the pre-defined valuesTOP,BOTTOM, andCENTER. - The parameter
yposmay be an integer or one of the pre-defined valuesLEFT,RIGHT, andCENTER.
- The parameter
- The parameter
relativestates whether thexpos/ypospair is a relative move or an absolute move.- For example, if
xpos = 1andypos = 2andrelative = TRUE, then the widget would move one row down and two columns right. If the value ofrelativewasFALSE, then the widget would move to the position(1,2). - Do not use the values
TOP,BOTTOM,LEFT,RIGHT, orCENTERwhenrelative = TRUE. (weird things may happen). ๐จ
- For example, if
- The final parameter
refreshis a boolean value which states whether the widget will get refreshed after the move.
- The parameters
newCDKButtonboxโ creates a pointer to a buttonbox widget. 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 an integer or one of the pre-defined valuesLEFT,RIGHT, andCENTER.yposโ controls the placement of the object along the vertical axis. It can be an integer value or one of the pre-defined valuesTOP,BOTTOM, andCENTER.heightandwidthโ control the height and width of the widget.titleโ is the title of the widget.rowsโ is the number of rows of buttons.colsโ sets the number of columns.buttonsโ is an array containing the button labels.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.shadowโ turns the shadow on or off around this widget.- If the widget could not be created then a
NULLpointer is returned. ๐ญ
positionCDKButtonboxโ allows the user to move the widget around the screen via the cursor/keypad keys. Seecdk_position (3)for key bindings. ๐ฎsetCDKButtonboxโ lets the programmer modify certain elements of an existing buttonbox widget. ๐ ๏ธ- The parameter names correspond to the same parameter names listed in the
newCDKButtonboxfunction.
- The parameter names correspond to the same parameter names listed in the
setCDKButtonboxBackgroundAttribโ sets the background attribute of the widget. ๐จ- The parameter
attributeis a curses attribute, e.g.,A_BOLD.
- The parameter
setCDKButtonboxBackgroundColorโ sets the background color of the widget. ๐- The parameter
coloris in the format of the Cdk format strings. (Seecdk_display).
- The parameter
setCDKButtonboxBoxโ sets true if the widget will be drawn with a box around it. ๐ฆsetCDKButtonboxBoxAttributeโ sets the attribute of the box. ๐๏ธsetCDKButtonboxCurrentButtonโ sets the current button-number for the box. ๐ขsetCDKButtonboxHighlightโ sets the highlight attribute of the selected button. โจsetCDKButtonboxHorizontalCharโ sets the horizontal drawing character for the box to the given character. โsetCDKButtonboxLLCharโ sets the lower left hand corner of the widget's box to the given character. โ๏ธsetCDKButtonboxLRCharโ sets the lower right hand corner of the widget's box to the given character. โ๏ธsetCDKButtonboxPostProcessโ 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. (Seecdk_process).
- The parameter
setCDKButtonboxPreProcessโ 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. (Seecdk_process).
- The parameter
setCDKButtonboxULCharโ sets the upper left hand corner of the widget's box to the given character. โ๏ธsetCDKButtonboxURCharโ sets the upper right hand corner of the widget's box to the given character. โ๏ธsetCDKButtonboxVerticalCharโ sets the vertical drawing character for the box to the given character. โ
๐ KEY BINDINGS ๐
When the widget is activated there are several default key bindings which will help the user enter or manipulate the information quickly. The following table outlines 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. (yes bestie,Tabis listed twice in the original table โ not a typo, not me being messy ๐ )Escapeโ Exits the widget and returns-1. This also sets the widget dataexitTypetovESCAPE_HIT. ๐ชCtrl-Lโ Refreshes the screen. ๐
โจ SEE ALSO โจ
okay bestie, you're not gonna be a solo act forever โ these are the other pages you're gonna want in your rotation ๐
cdk(3)โ the whole Cdk universe in one place, the mothership, the blueprint, the origin story ๐cdk_binding(3)โ how key bindings work, i.e. which buttons do what when you press things, iykyk ๐นcdk_display(3)โ for when you need the screen to actually do stuff (drawing, refreshing, all that main-character screen energy) ๐บcdk_position(3)โ where things go on screen, because placement is literally everything ๐cdk_process(3)โ the behind-the-scenes machinery that keeps the whole vibe running, no cap โ๏ธcdk_screen(3)โ the screen object itself, the whole stage your button box is standing on ๐
and that's a wrap on cdk_buttonbox(3), bestie!! ๐ฆโจ this page is from the Cdk family and it's dated 2024-03-28 โ go forth, build your little button boxes, and slay responsibly. periodt. ๐๐
๐ฆ where this page comes from
- debian trixie: libcdk5-dev 5.0.20250116-1 ยท BSD-4-Clause
- fedora 43: cdk 5.0.20240619-4.fc43 ยท LicenseRef-Callaway-BSD-with-advertising
- fedora 43: cdk 5.0.20240619-4.fc43 ยท LicenseRef-Callaway-BSD-with-advertising
- 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