cdk_itemlist(3)
โจ NAME โจ
cdk_itemlist โ it's the Cdk itemlist widget, bestie. Manual section 3, library calls, iykyk. ๐
๐ SYNOPSIS ๐
okay so first you gotta link against the library, like:
cc [ flag ... ] file ... -lcdk [ library ... ]
and obviously you pull in the header:
#include <cdk.h>
then here's the whole girl squad of functions, every single one, no cap:
int activateCDKItemlist (
CDKITEMLIST *itemlist,
chtype *actions);
void destroyCDKItemlist (
CDKITEMLIST *itemlist);
void drawCDKItemlist (
CDKITEMLIST *itemlist,
boolean box);
void drawCDKItemlistField (
CDKITEMLIST *itemlist,
boolean highlight);
void eraseCDKItemlist (
CDKITEMLIST *itemlist);
boolean getCDKItemlistBox (
CDKITEMLIST *itemlist);
int getCDKItemlistCurrentItem (
CDKITEMLIST *itemlist);
int getCDKItemlistDefaultItem (
CDKITEMLIST *itemlist);
chtype **getCDKItemlistValues (
CDKITEMLIST *itemlist,
int *listSize);
int injectCDKItemlist (
CDKITEMLIST *itemlist,
chtype input);
void moveCDKItemlist (
CDKITEMLIST *itemlist,
int xpos,
int ypos,
boolean relative,
boolean refresh);
CDKITEMLIST *newCDKItemlist (
CDKSCREEN *cdkscreen,
int xpos,
int ypos,
const char *title,
const char *label,
CDK_CONST char **itemList,
int itemCount,
int defaultItem,
boolean box,
boolean shadow);
void positionCDKItemlist (
CDKITEMLIST *itemlist);
void setCDKItemlist (
CDKITEMLIST *itemlist,
CDK_CONST char **itemList,
int itemCount,
int currentSelection,
boolean box);
void setCDKItemlistBackgroundAttrib (
CDKITEMLIST *itemlist,
chtypeattribute);
void setCDKItemlistBackgroundColor (
CDKITEMLIST *itemlist,
const char *color);
void setCDKItemlistBox (
CDKITEMLIST *itemlist,
boolean box);
void setCDKItemlistBoxAttribute (
CDKITEMLIST *itemlist,
chtype character);
void setCDKItemlistCurrentItem (
CDKITEMLIST *itemlist,
int currentItem);
void setCDKItemlistDefaultItem (
CDKITEMLIST *itemlist,
int defaultItem);
void setCDKItemlistHorizontalChar (
CDKITEMLIST *itemlist,
chtype character);
void setCDKItemlistLLChar (
CDKITEMLIST *itemlist,
chtype character);
void setCDKItemlistLRChar (
CDKITEMLIST *itemlist,
chtype character);
void setCDKItemlistPostProcess (
CDKITEMLIST *itemlist,
PROCESSFN callback,
void *data);
void setCDKItemlistPreProcess (
CDKITEMLIST *itemlist,
PROCESSFN callback,
void *data);
void setCDKItemlistULChar (
CDKITEMLIST *itemlist,
chtype character);
void setCDKItemlistURChar (
CDKITEMLIST *itemlist,
chtype character);
void setCDKItemlistValues (
CDKITEMLIST *itemlist,
CDK_CONST char **itemList,
int itemCount);
void setCDKItemlistVerticalChar (
CDKITEMLIST *itemlist,
chtype character);
yes there are a LOT of them and yes I listed every single one. we don't do skipping here. ๐
๐ฆ DESCRIPTION ๐ฆ
so the Cdk itemlist widget makes you a little widget that lets a user pick from a list of preset character strings โ like the days of the week, or the months of the year. iconic behavior honestly. ๐
the following functions create or manipulate the Cdk itemlist widget. that's the whole vibe for this section, and yeah โ more on all of them coming right up. ๐ซถ
โจ AVAILABLE FUNCTIONS โจ
okay so here's the whole roster of functions, bestie โ every single one, no skips, periodt. ๐
activateCDKItemlistโ activates the itemlist widget and lets the user interact with the widget. ๐- The parameter
itemlistis a pointer to a non-NULL itemlist 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
NULLpointer foractions. - If the character entered into this widget is
RETURNorTABthen 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
ESCAPEthen the widget will return a-1and the widget dataexitTypewill be set tovESCAPE_HIT.
- To activate the widget interactively pass in a
- The parameter
destroyCDKItemlistโ removes the widget from the screen and frees memory the object used. ๐drawCDKItemlistโ draws the itemlist widget on the screen. Theboxoption is true if the widget is drawn with a box. โจdrawCDKItemlistFieldโ draws the contents of the field. ๐ธeraseCDKItemlistโ removes the widget from the screen. This does NOT destroy the widget. ๐ซถgetCDKItemlistBoxโ returns true if the widget will be drawn with a box around it. ๐getCDKItemlistCurrentItemโ returns the index of the currently displayed item in the widget. ๐getCDKItemlistDefaultItemโ returns the index of the default item in the widget. โญgetCDKItemlistValuesโ returns the list of pointers to the items. The parametersizepoints to a location which receives the item count. ๐injectCDKItemlistโ injects a single character into the widget. ๐ฆ- The parameter
itemlistis a pointer to a non-NULL itemlist widget. - The parameter
characteris the character to inject into the widget. The return value and side-effect (setting the widget dataexitType) 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 data
exitTypeis set tovNORMAL.
- the function returns a value ranging from zero to one less than the number of buttons, representing the button selected. The widget data
ESCAPE- the function returns
-1. The widget dataexitTypeis set tovESCAPE_HIT.
- the function returns
- Otherwise
- unless modified by preprocessing, postprocessing or key bindings, the function returns
-1. The widget dataexitTypeis set tovEARLY_EXIT.
- unless modified by preprocessing, postprocessing or key bindings, the function returns
- The parameter
moveCDKItemlistโ 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.
- The parameters
newCDKItemlistโ creates a pointer to an itemlist 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 may be an integer or one of the pre-defined valuesTOP,BOTTOM, andCENTER.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.labelโ is the string to use as the label of the itemlist field.itemListโ is the list of the strings which will be displayed in the widget.itemCountโ is the number of elements in the list.defaultItemโ is the index of the default item for the list.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
NULLpointer is returned.
positionCDKItemlistโ allows the user to move the widget around the screen via the cursor/keypad keys. Seecdk_position (3)for key bindings. ๐ฎsetCDKItemlistโ lets the programmer modify certain elements of an existing itemlist widget. The parameter names correspond to the same parameter names listed in thenewCDKItemlistfunction. ๐ ๏ธsetCDKItemlistBackgroundAttribโ the background color attribute the widget. The parameterattributeis a curses attribute, e.g.,A_BOLD. ๐จsetCDKItemlistBackgroundColorโ sets the background color of the widget. The parametercoloris in the format of the Cdk format strings. Seecdk_display (3). ๐setCDKItemlistBoxโ sets whether the widget will be drawn with a box around it. ๐ฆsetCDKItemlistBoxAttributeโ sets the attribute of the box. ๐setCDKItemlistCurrentItemโ sets the currently displayed item in the widget. ๐setCDKItemlistDefaultItemโ sets the default item in the widget. โญsetCDKItemlistHorizontalCharโ sets the horizontal drawing character for the box to the given character. โsetCDKItemlistLLCharโ sets the lower left hand corner of the widget's box to the given character. โฃsetCDKItemlistLRCharโ sets the lower right hand corner of the widget's box to the given character. โขsetCDKItemlistPostProcessโ 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).
- To learn more about post-processing see
- The parameter
setCDKItemlistPreProcessโ 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).
- To learn more about pre-processing see
- The parameter
setCDKItemlistULCharโ sets the upper left hand corner of the widget's box to the given character. โคsetCDKItemlistURCharโ sets the upper right hand corner of the widget's box to the given character. โฅsetCDKItemlistValuesโ sets the contents of the list from an array of string pointersitemwhose final index is given bycount. IfdefaultItemis in the range0..count, that sets the default item value for the list. ๐setCDKItemlistVerticalCharโ sets the vertical drawing character for the box to the given character. โ
โจ KEY BINDINGS โจ
Okay so when the widget gets activated, it has a bunch of default key bindings that help the user enter or manipulate the information quickly. The original table was giving very organized, but we're doing it as a list now. Every key and its action for this widget, no cap:
Left Arrow,Down Arrow,-,pโ shift the list one column to the left. โฌ ๏ธRight Arrow,Up Arrow,Space,+,nโ shift the list one column to the right. โก๏ธd,Dโ display the default item. ๐0โ display the first item in the list. ๐ฅ$โ display the last item in the list. ๐Returnโ exit the widget and return an integer representing the current selection. Also set the widget dataexitTypetovNORMAL. โจTabโ exit the widget and return an integer representing the current selection. Also set the widget dataexitTypetovNORMAL. ๐Escapeโ exit the widget and return-1. Also set the widget dataexitTypetovESCAPE_HIT. ๐ญCtrl-Lโ refreshes the screen. ๐
๐ SEE ALSO ๐
Bestie, go read these too if you wanna be fully in the know:
That's the whole vibe from cdk_itemlist(3), dated 2025-01-14. Stay iconic, bestie ๐
๐ฆ 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