cdk_matrix(3)
okay so you just opened cdk_matrix(3) โ that's the Cdk matrix widget, filed under Library calls. It's long, like genuinely long, so it got chopped into parts and this is part 1. Grab a snack ๐, hydrate, we're doing this.
๐ NAME ๐
cdk_matrix โ Cdk matrix widget. that's the whole name, short and iconic, no notes ๐
โจ SYNOPSIS โจ
first up, link the library, exactly like this or it simply will not go:
cc [ flag ... ] file ... -lcdk [ library ... ]
and obviously you gotta pull in the header:
#include <cdk.h>
then the entire cast list, in order, no cap. i'm putting them in little friend groups so your eyes don't fall out ๐
๐ the life-cycle girlies
int activateCDKMatrix (
CDKMATRIX *matrix,
chtype * actions);
void cleanCDKMatrix (
CDKMATRIX *matrix);
void cleanCDKMatrixCell (
CDKMATRIX *matrix,
int row,
int col);
void destroyCDKMatrix (
CDKMATRIX *matrix);
๐ draw & erase, the visual besties
void drawCDKMatrix (
CDKMATRIX *matrix,
boolean box);
void eraseCDKMatrix (
CDKMATRIX *matrix);
๐ the getters (they hand you stuff back)
boolean getCDKMatrixBox (
CDKMENTRY *matrix);
char * getCDKMatrixCell (
CDKMATRIX *matrix,
int row,
int col);
int getCDKMatrixCol (
CDKMENTRY *matrix);
int getCDKMatrixRow (
CDKMENTRY *matrix);
not me side-eyeing that some of these takeCDKMENTRY *matrixinstead ofCDKMATRIX *matrix๐ โ i don't write 'em, i just report 'em. copy it character for character, bestie, don't get cute.
๐ฎ input & moving around
int injectCDKMatrix (
CDKMATRIX *matrix,
chtype input);
int jumpToCell (
CDKMATRIX *matrix,
int row,
int col);
void moveCDKMatrix (
CDKMATRIX *matrix,
int xpos,
int ypos,
boolean relative,
boolean refresh);
int moveToCDKMatrixCell (
CDKMATRIX *matrix,
int row,
int col);
๐ the main character, newCDKMatrix
she takes nineteen arguments. nineteen. i counted them so you don't have to ๐ญ
CDKMATRIX *newCDKMatrix (
CDKSCREEN *cdkscreen,
int xpos,
int ypos,
int screenRows,
int screenCols,
int actualRows,
int actualCols,
const char *title,
CDK_CONST char **rowTitles,
CDK_CONST char **colTitles,
int *columnWidths,
int *columnTypes,
int rowSpace,
int colSpace,
chtype filler,
int dominantAttribute,
boolean boxMatrix,
boolean boxCell,
boolean shadow);
void positionCDKMatrix (
CDKMATRIX *matrix);
๐ the setters, an overachiever fr fr
void setCDKMatrix (
CDKMATRIX *matrix,
char *info[MAX_MATRIX_ROWS][MAX_MATRIX_COLS],
int rows,
int *columnLengths);
void setCDKMatrixBackgroundAttrib (
CDKMATRIX *matrix,
chtype attribute);
void setCDKMatrixBackgroundColor (
CDKMATRIX *matrix,
const char * color);
void setCDKMatrixBox (
CDKMENTRY *matrix,
boolean boxWidget);
void setCDKMatrixBoxAttribute (
CDKMATRIX *matrix,
chtype character);
void setCDKMatrixCB (
CDKMATRIX *matrix,
MATRIXCB callbackFunction);
int setCDKMatrixCell (
CDKMATRIX *matrix,
int row,
int col,
const char *value);
void setCDKMatrixCells (
CDKMATRIX *matrix,
CDK_CONST char **info,
int rows,
int cols,
int *columnLengths);
void setCDKMatrixHorizontalChar (
CDKMATRIX *matrix,
chtype character);
void setCDKMatrixLLChar (
CDKMATRIX *matrix,
chtype character);
void setCDKMatrixLRChar (
CDKMATRIX *matrix,
chtype character);
void setCDKMatrixPostProcess (
CDKMATRIX *matrix,
PROCESSFN callback,
void * data);
void setCDKMatrixPreProcess (
CDKMATRIX *matrix,
PROCESSFN callback,
void * data);
void setCDKMatrixULChar (
CDKMATRIX *matrix,
chtype character);
void setCDKMatrixURChar (
CDKMATRIX *matrix,
chtype character);
void setCDKMatrixVerticalChar (
CDKMATRIX *matrix,
chtype character);
see? she does the most. every single one of those is real, every parameter, every type, every chtype character โ keep the list intact, bestie, we don't skip โจ
๐ฆ DESCRIPTION ๐ฆ
so the Cdk matrix widget creates a matrix widget. that's the tea. ๐ธ
and every function listed up there in the synopsis is one of the functions that create or manipulate the Cdk matrix box widget. like, the whole squad: the ones that build her, the ones that clean her, the ones that move her, and the truly unhinged number of setters. all of it, one big happy family ๐
anyway that's the setup, bestie โ the actual function-by-function breakdown is coming right up, keep scrolling ๐
โจ AVAILABLE FUNCTIONS โจ
okay bestie, this is the whole function lineup and it's literally the moment. every parameter, every return value, every lil caveat โ all here. no cap. ๐
activateCDKMatrix ๐
- activates the matrix widget and lets the user interact with it.
- The parameter
matrixis a pointer to a non-NULLmatrix 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. - If the character entered into this widget is
RETURNthen this function will return1. It will also set the widget dataexitTypetovNORMAL. - If the character entered into this widget was
ESCAPEthen the widget will return a value of-1and the widget dataexitTypewill be set tovESCAPE_HIT.
- To activate the widget interactively, pass in a
- The matrix cell contents can be retrieved by using the
infoarray of the matrix widget.
cleanCDKMatrix ๐งผ
- clears the information from all cells of the matrix. it's giving reset button โจ
cleanCDKMatrixCell ๐งฝ
- clears the information from the specified cell of the matrix. just one cell, bestie.
destroyCDKMatrix ๐
- removes the widget from the screen and frees memory the object used. bye bye, memory.
drawCDKMatrix ๐จ
- draws the matrix widget on the screen. If the
boxparameter is true, the widget is drawn with a box.
eraseCDKMatrix ๐ซฅ
- removes the widget from the screen. This does NOT destroy the widget. periodt.
getCDKMatrixBox ๐ฆ
- returns true if the widget will be drawn with a box around it.
getCDKMatrixCell ๐
- returns the contents of the cell located by the
rowandcolpair.
getCDKMatrixCol ๐งญ
- returns the current column index.
getCDKMatrixRow ๐งญ
- returns the current row index.
injectCDKMatrix ๐
- injects a single character into the widget.
- The parameter
matrixis a pointer to a non-NULLmatrix 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
1. The widget dataexitTypeis set tovNORMAL.
- the function returns
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 return value and side-effect (setting the widget data
- The matrix cell contents can be retrieved by using the
infoarray of the matrix widget.
jumpToCell ๐ฆ
- provides an interactive method of moving to a cell. It pops up a scale widget and asks which cell the user wants to go to. Then it performs the jump.
moveCDKMatrix ๐บ
- 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 of
relativewasFALSE, 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.
moveToCDKMatrixCell ๐ฏ
- jumps to the given cells dictated by the parameters
rowandcol. It returns a value ofTRUEorFALSEdepending if the move was successful.
newCDKMatrix ๐
- creates a matrix 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.screenRowsandscreenColsโ are the number of rows and columns to be displayed on the screen respectively.actualRowsandactualColsโ are the number of actual rows and columns the matrix has.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.rowTitlesandcolTitlesโ are the titles along the row and columns respectively.columnWidthsโ is an array of integers stating how wide the individual columns are to be.columnTypesโ is an array of integers which correspond to the individual column display types. The values of the array should be assigned a value of typeEDisplayType. Seecdk_display(3)for legal values ofEDisplayType.rowSpaceandcolSpaceโ dictate how much white space is to be between rows and columns respectively.fillerโ is the character to use in empty space within a cell.dominantAttributeโ states which (the rows or the columns) will have the dominant character attributes. This is stated when a cell has both a row attribute and a column attribute.- If the value of the parameter
dominantAttributeis set toROWthen the attribute of the row will be displayed. If it is set toCOLthen the column's attributes will be displayed instead.
- If the value of the parameter
boxMatrixโ is true if the widget should be drawn with a box around it.boxCellโ is true if the individual cells should have boxes drawn around them.shadowโ turns the shadow on or off around this widget.
- If the widget could not be created then a
NULLpointer is returned.
positionCDKMatrix ๐ง
- allows the user to move the widget around the screen via the cursor/keypad keys. See
cdk_position(3)for key bindings.
setCDKMatrix ๐
- lets the programmer modify certain elements of an existing matrix widget.
- The parameter
infois an array ofchar *which contains the cell information. - The parameter
rowshas the number of rows - the parameter
infocontains, columnLengthshas the lengths of the individual columns ininfo.
Do not use this function. It is obsolete, provided only for compatibility with older versions of CDK. Use setCDKMatrixCells.
setCDKMatrixBackgroundAttrib ๐จ
- sets the background attribute of the widget. The parameter
attributeis a curses attribute, e.g.,A_BOLD.
setCDKMatrixBackgroundColor ๐
- sets the background color of the widget. The parameter
coloris in the format of the Cdk format strings. Seecdk_display(3).
setCDKMatrixBox ๐ฆ
- sets whether the widget will be drawn with a box around it.
setCDKMatrixBoxAttribute ๐๏ธ
- sets the attribute of the box.
setCDKMatrixCB ๐ซถ
- allows the programmer to set a different widget input handler. The parameter
callbackFunctionis of typeMATRIXCB. The default function isCDKMatrixCallBack.
setCDKMatrixCell โ๏ธ
- sets the contents of the cell located by the
rowandcolpair. The value of the cell will be set tovalue.
setCDKMatrixCells ๐งฉ
- lets the programmer initialize elements of an existing matrix widget.
- The parameter
infois an array ofchar *which contains the cell information.- The parameter
rowshas the number of rows - The parameter
colshas the number of columns - The parameter
infocontains, whilecolumnLengthshas the lengths of the individual columns ininfo.
- The parameter
setCDKMatrixHorizontalChar โ
- sets the horizontal drawing character for the box to the given character.
setCDKMatrixLLChar โฃ
- sets the lower left hand corner of the widget's box to the given character.
setCDKMatrixLRChar โข
- sets the lower right hand corner of the widget's box to the given character.
setCDKMatrixPostProcess ๐ซถ
- 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).
setCDKMatrixPreProcess โจ
- 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).
setCDKMatrixULChar โค
- sets the upper left hand corner of the widget's box to the given character.
setCDKMatrixURChar โฅ
- sets the upper right hand corner of the widget's box to the given character.
setCDKMatrixVerticalChar โ
- sets the vertical drawing character for the box to the given character.
โจ๏ธ KEY BINDINGS โจ๏ธ
okay bestie so once the widget is activated, there's a whole set of default key bindings just sitting there ready to help you type stuff in and mess with it <em>fast</em>. โจ Here's the full rundown of every key and what it does in this widget, no skips, no cuts, periodt:
Left Arrowโ moves you one cell to the left ๐ซถRight Arrowโ moves the cell to the rightTabโ moves the cell to the right (same vibe as above, different key, slay)Up Arrowโ moves one cell up โฌ๏ธDown Arrowโ moves one cell down โฌ๏ธNext Pageโ moves one page forwardCtrl-Fโ moves one page forward (the keyboard-shortcut twin ofNext Page)Prev Pageโ moves one page backwardCtrl-Bโ moves one page backward (yep, same thing, just via keyboard)Ctrl-Gโ calls the functionjumpToCelland asks you which cell you wanna jump to ๐ฆCtrl-Pโ pastes whatever is chillin' in the paste buffer straight into the current cellCtrl-Kโ cuts the contents out of the current cell and saves a copy in the paste buffer โ๏ธCtrl-Tโ copies the contents of the current cell into the paste bufferCtrl-Eโ erases the contents of the current cell ๐งนDeleteโ deletes the character before the cursor and moves the cursor left. Important note: there is no function to delete the character at the cursor, because there are no functions for moving the cursor within the edited text. iykyk, that's just how it is ๐Backspaceโ deletes the character before the cursor, moves cursor leftCtrl-Hโ deletes the character before the cursorReturnโ exits the widget and returns1. 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 ๐
๐ SEE ALSO ๐
go read these too, bestie, they're the whole friend group fr fr:
and that's the whole page, you made it to the end ๐ this was cdk_matrix(3), dated 2025-01-14 โ go forth and matrix, 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