cdk_radio(3)
cdk_radio ๐ โ the Cdk radio list widget (manual page cdk_radio(3), library calls section, bestie)
okay so. you found the cdk_radio(3) page and you're like "what is this" โ it's the Cdk radio list widget, and yes it's exactly as cute as it sounds. a radio list, like the little round buttons where you pick one and only one. that's the vibe. let's get into it. โจ
๐ธ NAME ๐ธ
cdk_radio โ Cdk radio list widget
๐ SYNOPSIS ๐
compile situation first, bestie:
cc [ flag ... ] file ... -lcdk [ library ... ]
and the header, obviously:
#include <cdk.h>
now the whole function lineup, every single one, no skips, no cap:
int activateCDKRadio (
CDKRADIO *radio,
chtype *actions);
void destroyCDKRadio (
CDKRADIO *radio);
void drawCDKRadio (
CDKRADIO *radio,
boolean box);
void eraseCDKRadio (
CDKRADIO *radio);
boolean getCDKRadioBox (
CDKRADIO *radio);
chtype getCDKRadioChoiceCharacter (
CDKRADIO *radio);
int getCDKRadioCurrentItem (
CDKRADIO *radio);
chtype getCDKRadioHighlight (
CDKRADIO *radio);
int getCDKRadioItems (
CDKRADIO *radio,
char **list);
chtype getCDKRadioLeftBrace (
CDKRADIO *radio);
chtype getCDKRadioRightBrace (
CDKRADIO *radio);
int getCDKRadioSelectedItem (
CDKRADIO *radio);
int injectCDKRadio (
CDKRADIO *radio,
chtype input);
void moveCDKRadio (
CDKRADIO *radio,
int xpos,
int ypos,
boolean relative,
boolean refresh);
CDKRADIO *newCDKRadio (
CDKSCREEN *cdkscreen,
int xpos,
int ypos,
int spos,
int height,
int width,
const char *title,
CDK_CONST char **radioList,
int radioListLength,
chtype choiceCharacter,
int defaultItem,
chtype highlight,
boolean box,
boolean shadow);
void positionCDKRadio (
CDKRADIO *radio);
void setCDKRadio (
CDKRADIO *radio,
chtype highlight,
chtype choiceCharacter,
boolean box);
void setCDKRadioBackgroundAttrib (
CDKRADIO *radio,
chtype attribute);
void setCDKRadioBackgroundColor (
CDKRADIO *radio,
const char * color);
void setCDKRadioBox (
CDKRADIO *radio,
boolean box);
void setCDKRadioBoxAttribute (
CDKRADIO *radio,
chtype character);
void setCDKRadioChoiceCharacter (
CDKRADIO *radio,
chtype character);
void setCDKRadioCurrentItem (
CDKRADIO *radio,
intindex);
void setCDKRadioHighlight (
CDKRADIO *radio,
chtype highlight);
void setCDKRadioHorizontalChar (
CDKRADIO *radio,
chtype character);
void setCDKRadioItems (
CDKRADIO *radio,
CDK_CONST char **list,
int listSize);
void setCDKRadioLLChar (
CDKRADIO *radio,
chtype character);
void setCDKRadioLRChar (
CDKRADIO *radio,
chtype character);
void setCDKRadioLeftBrace (
CDKRADIO *radio,
chtype character);
void setCDKRadioPostProcess (
CDKRADIO *radio,
PROCESSFN callback,
void * data);
void setCDKRadioPreProcess (
CDKRADIO *radio,
PROCESSFN callback,
void * data);
void setCDKRadioRightBrace (
CDKRADIO *radio,
chtype character);
void setCDKRadioSelectedItem (
CDKRADIO *radio,
int item);
void setCDKRadioULChar (
CDKRADIO *radio,
chtype character);
void setCDKRadioURChar (
CDKRADIO *radio,
chtype character);
void setCDKRadioVerticalChar (
CDKRADIO *radio,
chtype character);
lowkey that's a lot of functions and yes you're gonna meet all of them. pace yourself, hydrate, it's giving marathon not sprint. ๐
๐ฆ DESCRIPTION ๐ฆ
so here's the tea: the Cdk radio widget creates a radio list. that's the whole main character energy of this page. ๐ปโจ
and then โ the part that actually matters for your code โ there's a whole lil family of functions that either create the Cdk radio box widget or manipulate it. new one gets born, existing one gets poked and prodded and restyled. that's the deal. ๐ซถ
(part 1 done, bestie โ the rest is coming, don't go anywhere) ๐
โจ AVAILABLE FUNCTIONS โจ
๐ activateCDKRadio
okay so this one activates the radio widget and lets the user actually interact with it. main character moment fr.
- the parameter
radiois a pointer to a non-NULLradio widget. no cap. - 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 aNULLpointer foractions. (iykyk โ that's the hands-off mode ๐ )
if the character entered into this widget is RETURN or TAB then this function will return a value from 0 to the number of items minus 1, representing the item selected. it will also set the widget data exitType to vNORMAL. slay.
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. ๐ญ the escape hatch got hit, bestie.
๐ฆ destroyCDKRadio
removes the widget from the screen and frees memory the object used. it's giving closure. bye babe ๐ซถ
๐ธ drawCDKRadio
draws the radio widget on the screen. putting it on display, as it should be.
if the box parameter is true, the widget is drawn with a box. ๐
โจ eraseCDKRadio
removes the widget from the screen. this does NOT destroy the widget. so it's a little disappearing act, not a breakup โ the widget is still very much alive, just not visible. ๐
๐ getCDKRadioBox
returns true if the widget will be drawn with a box around it. vibe check: boxed or unboxed? ๐
๐ getCDKRadioChoiceCharacter
returns the character being used to draw the selected element in the list.
โญ getCDKRadioCurrentItem
returns the index of the current item.
๐ฅ getCDKRadioHighlight
returns the attribute of the highlight bar.
๐ง getCDKRadioItems
optionally copies the radio-box items into the caller's list, which must be large enough since this function does not allocate it. like, you bring the container, okay?? if the list parameter is null, no copying is done. it returns the list size whether or not the list parameter is null. so either way you get the number, periodt.
๐
getCDKRadioLeftBrace
returns the character being used to draw the left brace of the selection box.
๐ getCDKRadioRightBrace
returns the character being used to draw the right brace of the selection box.
๐ getCDKRadioSelectedItem
returns the selected item of the widget.
๐ injectCDKRadio
this function injects a single character into the widget. one (1) character. very precise of it.
- the parameter
radiois a pointer to a non-NULLradio 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, so let's break it down:
RETURNorTABโ the function returns a value ranging from zero to one less than the number of items, representing the items 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. she left early, no explanation ๐
๐ซถ moveCDKRadio
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
relativestates whether thexpos/ypospair 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). and by "weird things" they mean chaos, bestie, do not test it ๐
- the final parameter
refreshis a boolean value which states whether the widget will get refreshed after the move.
๐ newCDKRadio
creates a radio widget and returns a pointer to it. the birth of an icon ๐ parameters go a little something like this:
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 may be an integer or one of the pre-defined valuesTOP,BOTTOM, andCENTER.sposโ tells where the scroll bar is to be placed. this may be one of three values:LEFTputs the scroll bar on the left of the scrolling list.RIGHTputs the scroll bar on the right side of the list, andNONEdoes not add a scroll bar.
heightandwidthโ control the height and width of the widget. if you provide a value of zero for either of theheightor thewidth, the widget will be created with the full width and height of the screen. if you provide a negative value, the widget will be created the full height or width minus the value provided. math girlies rise ๐งฎtitleโ is the string which will be displayed at the top of the widget. the title can be more than one line; just provide a carriage return character at the line break. multiline title? we love range. ๐radioListโ is the list of items to display in the radio list.radioListLengthโ is the number of elements in the given list.choiceCharacterโ is the character to use to highlight the current selection.highlightโ specifies the display attribute of the currently selected item.defaultItemโ is the index in the list of the default selection.boxโ is true if 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 NULL pointer is returned. sad girl hours ๐ญ
๐ซ positionCDKRadio
allows the user to move the widget around the screen via the cursor/keypad keys. see cdk_position (3) for key bindings. it's giving drag and drop but make it terminal.
๐ setCDKRadio
lets the programmer modify certain elements of an existing radio widget.
the parameter names correspond to the same parameter names listed in the newCDKRadio function. so like, same list, same vibes, you already know them. โจ
๐ธ setCDKRadioBackgroundAttrib
sets the background attribute of the widget.
the parameter attribute is a curses attribute, e.g., A_BOLD.
๐ setCDKRadioBackgroundColor
sets the background color of the widget.
the parameter color is in the format of the Cdk format strings.
see cdk_display (3).
๐ setCDKRadioBox
sets whether the widget will be drawn with a box around it. ๐
โญ setCDKRadioBoxAttribute
this function sets the attribute of the box.
๐ setCDKRadioChoiceCharacter
sets the character to use to draw the selected element in the list.
๐ฅ setCDKRadioCurrentItem
sets the current item by its index in the list.
๐ setCDKRadioHighlight
sets the attribute of the highlight bar.
๐ง setCDKRadioHorizontalChar
sets the horizontal drawing character for the box to the given character.
๐
setCDKRadioItems
set the radio list items and display the result. the current item is set to the beginning of the list. the previous radio list items stored in the widget are freed. out with the old, in with the new, no takebacks ๐
๐ซถ setCDKRadioLLChar
sets the lower left hand corner of the widget's box to the given character.
๐ฆ setCDKRadioLRChar
sets the lower right hand corner of the widget's box to the given character.
โจ setCDKRadioLeftBrace
sets the character to use to draw the left brace of the selection box.
๐ setCDKRadioPostProcess
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).
๐ซ setCDKRadioPreProcess
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).
๐ธ setCDKRadioRightBrace
sets the character to use to draw the right brace of the selection box.
๐ setCDKRadioSelectedItem
sets the selected item.
โญ setCDKRadioULChar
this function sets the upper left hand corner of the widget's box to the given character.
๐ setCDKRadioURChar
this function sets the upper right hand corner of the widget's box to the given character.
๐ฅ setCDKRadioVerticalChar
this function sets the vertical drawing character for the box to the given character.
โจ๏ธ KEY BINDINGS โจ๏ธ
Okay bestie, so when the widget is activated, there are a bunch of default key bindings that will help the user enter or manipulate the information quickly. The table below lays out the keys and their actions for this widget, so let's get into it ๐
Left Arrowโ Shifts the whole list left one character.Right Arrowโ Shifts the whole list right one character.Up Arrowโ Selects the next item up in the list.Down Arrowโ Selects the next item down in the list.
Prev Page,Ctrl-Bโ Scroll one page backward.Next Page,Ctrl-Fโ Scroll one page forward.
1,<,g,Homeโ Move to the first element in the list. โจ>,G,Endโ Move to the last element in the list. ๐
$โ Shifts the whole list to the far right.|โ Shifts the whole list to the far left.
Spaceโ Selects or deselects the current choice.Returnโ Exits the widget and returns the index of the selected item. This also sets the widget dataexitTypetovNORMAL.Tabโ Exit the widget and return the index of the selected item. Set the widget dataexitTypetovNORMAL.Escapeโ Exit the widget and return-1. Set the widget dataexitTypetovESCAPE_HIT.Ctrl-Lโ Refreshes the screen. ๐ฆ
๐ SEE ALSO ๐
cdk(3), cdk_binding(3), cdk_display(3), cdk_position(3), cdk_screen(3)
And that's a wrap on cdk_radio(3), bestie!! This page is from the 2025-01-14 version, so you know it's fresh. Now go forth and radio-button your little heart out ๐๐ธ๐
๐ฆ 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