cdk_selection(3)
π cdk_selection β the Cdk selection list widget, bestie π
okay so welcome to cdk_selection(3), from the Library calls girlies β¨ this is the Cdk selection list widget and she is literally iconic, no cap.
πΈ NAME πΈ
cdk_selection β Cdk selection list widget π
β¨ SYNOPSIS β¨
first things first, you gotta link her up:
cc [ flag ... ] file ... -lcdk [ library ... ]
and then, obviously, you gotta invite her in:
#include <cdk.h>
now here's the whole friend group, every single function, exactly as she comes π«Ά
int activateCDKSelection (
CDKSELECTION *selection,
chtype * actions);
void destroyCDKSelection (
CDKSELECTION *selection);
void drawCDKSelection (
CDKSELECTION *selection,
boolean box);
void eraseCDKSelection (
CDKSELECTION *selection);
boolean getCDKSelectionBox (
CDKSELECTION *selection);
int getCDKSelectionChoice (
CDKSELECTION *selection,
int index);
int *getCDKSelectionChoices (
CDKSELECTION *selection);
int getCDKSelectionCurrent (
CDKSELECTION *selection);
chtype getCDKSelectionHighlight (
CDKSELECTION *selection);
int getCDKSelectionItems (
CDKSELECTION *selection,
char **list);
int getCDKSelectionMode (
CDKSELECTION *selection,
int index);
int *getCDKSelectionModes (
CDKSELECTION *selection);
char *getCDKSelectionTitle (
CDKSELECTION *selection);
int injectCDKSelection (
CDKSELECTION *selection,
chtype input);
void moveCDKSelection (
CDKSELECTION *selection,
int xpos,
int ypos,
boolean relative,
boolean refresh);
CDKSELECTION *newCDKSelection (
CDKSCREEN *cdkscreen,
int xpos,
int ypos,
int spos,
int height,
int width,
const char *title,
CDK_CONST char **selectionList,
int selectionListLength,
CDK_CONST char **choiceList,
int choiceListLength,
chtype highlight,
boolean box,
boolean shadow);
void positionCDKSelection (
CDKSELECTION *selection);
void setCDKSelection (
CDKSELECTION *selection,
chtype highlight,
int *defChoices,
boolean box);
void setCDKSelectionBackgroundAttrib (
CDKSELECTION *selection,
chtype attribute);
void setCDKSelectionBackgroundColor (
CDKSELECTION *selection,
const char * color);
void setCDKSelectionBox (
CDKSELECTION *selection,
boolean boxWidget);
void setCDKSelectionBoxAttribute (
CDKSELECTION *selection,
chtype character);
void setCDKSelectionChoice (
CDKSELECTION *selection,
int index,
int choice);
void setCDKSelectionChoices (
CDKSELECTION *selection,
int *choices);
void setCDKSelectionCurrent (
CDKSELECTION *selection,
intindex);
void setCDKSelectionHighlight (
CDKSELECTION *selection,
chtype highlight);
void setCDKSelectionHorizontalChar (
CDKSELECTION *selection,
chtype character);
void setCDKSelectionItems (
CDKSELECTION *selection,
CDK_CONST char **list,
int listSize);
void setCDKSelectionLLChar (
CDKSELECTION *selection,
chtype character);
void setCDKSelectionLRChar (
CDKSELECTION *selection,
chtype character);
void setCDKSelectionMode (
CDKSELECTION *selection,
int index,
int mode);
void setCDKSelectionModes (
CDKSELECTION *selection,
int *modes);
void setCDKSelectionPostProcess (
CDKSELECTION *selection,
PROCESSFN callback,
void * data);
void setCDKSelectionPreProcess (
CDKSELECTION *selection,
PROCESSFN callback,
void * data);
void setCDKSelectionTitle (
CDKSELECTION *selection,
const char *title);
void setCDKSelectionULChar (
CDKSELECTION *selection,
chtype character);
void setCDKSelectionURChar (
CDKSELECTION *selection,
chtype character);
void setCDKSelectionVerticalChar (
CDKSELECTION *selection,
chtype character);
π¦ DESCRIPTION π¦
so the Cdk selection widget? she literally creates a selection list. that's the whole vibe, that's the moment, main character energy fr fr π
and all the functions listed up there in the synopsis? yeah, those are the ones that either create her or manipulate her. the Cdk selection list widget. periodt π
ngl there is so much more to come β the descriptions of every single function, the modes, the options, all of it. this is just the lil intro, bestie. stay tuned π
β¨ AVAILABLE FUNCTIONS β¨
okay bestie, hereβs the whole lineup of functions for the selection widget. every single one is present, no skips, no cap. π
activateCDKSelection πΈ
activates the selection widget and lets the user interact with the widget. itβs giving βmain character takes the wheel.β
- The parameter
selectionis a pointer to a non-NULL selection 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.
- To activate the widget interactively pass in a NULL pointer for
If the character entered into this widget is RETURN or TAB then this function will return 1. 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.
destroyCDKSelection π
removes the widget from the screen and frees memory the object used.
drawCDKSelection π
draws the selection widget on the screen. If the box parameter is true, the widget is drawn with a box.
eraseCDKSelection π§
removes the widget from the screen. This does NOT destroy the widget.
getCDKSelectionBox π¦
returns true if the widget will be drawn with a box around it.
getCDKSelectionChoice β
returns the selection choice at the given index.
getCDKSelectionChoices π
returns an array of the current selection choices for the widget.
getCDKSelectionCurrent π
returns the current selection index.
getCDKSelectionHighlight π
returns the attribute of the highlight bar.
getCDKSelectionItems π
optionally copies the selection-list items into the callerβs list, which must be large enough since this function does not allocate it. If the list parameter is null, no copying is done. It returns the list size whether or not the list parameter is null.
getCDKSelectionMode π₯
returns the selection mode at the given index.
getCDKSelectionModes β¨
returns an array of the current modes for the widget.
getCDKSelectionTitle π
returns the first line of the title of the selection widget. The caller must free the returned value.
injectCDKSelection π
injects a single character into the widget.
- The parameter
selectionis a pointer to a non-NULL selection 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 returns1. 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.
moveCDKSelection πΊ
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
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.
newCDKSelection π
creates a selection widget and returns a pointer to it. 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 may be an integer or one of the pre-defined valuesTOP,BOTTOM, andCENTER.sposβ is where the scroll bar is to be placed. It 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 the height or the width, 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.titleβ is the string which to display at the top of the widget. The title can be more than one line; just provide a carriage return character at the line break.selectionListβ is the list of items to display in the selection list.selectionListLengthβ is the number of elements in the given list.choiceListβ is the list of choices that will be selected when the user presses the space bar.choiceListLengthβ is the length of this list.highlightβ specifies the display attribute of the currently selected item.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 NULL pointer is returned.
positionCDKSelection π§
allows the user to move the widget around the screen via the cursor/keypad keys. See cdk_position (3) for key bindings.
setCDKSelection π οΈ
lets the programmer modify certain elements of an existing selection widget. The parameter names correspond to the same parameter names listed in the newCDKSelection function.
setCDKSelectionBackgroundAttrib π¨
sets the background attribute of the widget. The parameter attribute is a curses attribute, e.g., A_BOLD.
setCDKSelectionBackgroundColor π
sets the background color of the widget. The parameter color is in the format of the Cdk format strings. See cdk_display (3).
setCDKSelectionBox π¦
sets whether the widget will be drawn with a box around it.
setCDKSelectionBoxAttribute π₯
sets the attribute of the box.
setCDKSelectionChoice π«
sets the selection choice value at the given index.
setCDKSelectionChoices π«Ά
sets the selection choice values of the widget.
setCDKSelectionCurrent π
sets the current selection index.
setCDKSelectionHighlight β¨
sets the attribute of the highlight bar.
setCDKSelectionHorizontalChar β
sets the horizontal drawing character for the box to the given character.
setCDKSelectionItems π
sets the selection list items. The previous selection list items stored in the widget are freed.
setCDKSelectionLLChar π
sets the lower left hand corner of the widgetβs box to the given character.
setCDKSelectionLRChar π
sets the lower right hand corner of the widgetβs box to the given character.
setCDKSelectionMode ποΈ
sets the selection mode at the given index.
setCDKSelectionModes π§
sets the selection mode of the elements of the widget. There are two acceptable values for the modes:
0which allows the user to change the selection value at the given index; and1which sets the element to a read-only state.
setCDKSelectionPostProcess π
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).
setCDKSelectionPreProcess π¦
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 is a pointer to void. To learn more about pre-processing see cdk_process(3).
setCDKSelectionTitle π
set the selection listβs title.
setCDKSelectionULChar π
sets the upper left hand corner of the widgetβs box to the given character.
setCDKSelectionURChar π
sets the upper right hand corner of the widgetβs box to the given character.
setCDKSelectionVerticalChar β
sets the vertical drawing character for the box to the given character.
β¨οΈ KEY BINDINGS β¨οΈ
Okay bestie so when the widget gets activated (yes, the moment it wakes up and becomes the main character π ) there are a bunch of default key bindings that help the user enter or manipulate the info fast. Here's the whole tea, every single one, no skips:
Left Arrowβ Shift the whole list left one column.Right Arrowβ Shift the whole list right one column.Up Arrowβ Select the previous item in the list.Down Arrowβ Select the next item 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.
$β Shift the whole list to the far right.|β Shift the whole list to the far left.
Spaceβ Cycles to the next choice on the current item. πReturnβ Exit the widget and return1. Also set the widget dataexitTypetovNORMAL.Tabβ Exit the widget and return1. Also set the widget dataexitTypetovNORMAL.Escapeβ Exit the widget and return-1. Also set the widget dataexitTypetovESCAPE_HIT.Ctrl-Lβ Refreshes the screen. β¨
Not me pointing out thatReturnandTabdo the exact same thing and both setexitTypetovNORMAL, whileEscapeis the dramatic one that bails with-1and setsexitTypetovESCAPE_HIT. Two icons, two vibes, zero overlap. π«Ά
π SEE ALSO π
And that's the whole page, bestie, we ate and left no crumbs ππ This little love letter to the selection widget is cdk_selection(3), dated 2025-01-14, and it's signed off the way manpages always are β with the page name and that date chillin' in the footer. Go forth and select things, you absolute icon. π
ππ
π¦ 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