Cdk(3)

πŸ“¦
version 5.0.20260119 Β· 4 versions
, in debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ NAME ✨

cdk β€” the Curses Development Kit πŸŽ€


🌈 SYNOPSIS 🌈

cc [ flag ... ] file ...  -lcdk [ library ... ]

#include <cdk.h>

okay so here's the deal, bestie πŸ’… Cdk hands you functions for a whole pile of pre-made curses widgets. To actually use them you gotta pull in the header file, cdk.h, into your source. No header, no widgets, no vibes. πŸ™ˆ

The widgets you get from Cdk are listed below:

and the rest of the manual pages? they're all about the supporting functions 🫢

  • cdk_binding(3) β€” lays out how you create user definable key bindings ✨
  • cdk_display(3) β€” shows you how to drop special display attributes, colors, and justification into a widget πŸ’–
  • cdk_draw(3) β€” the rundown on the functions used for drawing text and lines ✏️
  • cdk_screen(3) β€” demonstrates using screens inside Cdk πŸ–₯️
  • cdk_misc(3) β€” the miscellaneous functions that ship with the Cdk library 🎁
  • cdk_process(3) β€” demonstrates the pre- and post-process function class, iykyk πŸ”

πŸ’œ DESCRIPTION πŸ’œ

Cdk is a library of functions that lets a programmer spin up a full screen interactive program, fast and with ease. Fr fr, it's giving convenience. The Cdk widgets come with the following features:

  • Ncurses library. Instead of the standard curses library, Cdk can take full advantage of the colors Ncurses brings to the table 🌈. Wanna learn how to flex Cdk's color capabilities? Go see cdk_display(3).
  • Key Bindings. Individual keys can be overridden with a callback. You set that callback up with the bindCDKObject function πŸ”‘. More on this in cdk_binding(3).
  • Pre and Post Processing. Certain widgets let the user trap a character before and after that character gets applied to the widget. That's how programmers "filter" character input 🧚. More on this in cdk_process(3).
  • Self Test Widgets. Using the inject function class plus the activate function, programmers can make widgets test themselves πŸ€–. That means you can run automated tests on a final program. obsessed.
  • Special Display Formats There are special character format commands you can insert into any string in Cdk, and the contents get mapped to a chtype (peep the curses manual page) with character attributes ✨. So if you want, you can put format types on each individual character. yes, each one.
  • The Ability To Build Predefined Screens Widgets can be associated with any given screen. If more than one screen is defined, Cdk can "flip" from one screen to another with ease πŸ¦‹. The cdk_screen manual page has the details.

πŸ‘‘ STANDARD WIDGET BEHAVIOR πŸ‘‘

Every single widget has a member of the structure called exitType. This member tells you how the widget exited. The page says there are three values to check for… and then serves five, and honestly? we love a generous queen πŸ’…. Anyway, here they all are:

  • vNORMAL β€” the widget exited normally. This value gets set when the widget is handed the characters TAB or RETURN.
  • vEARLY_EXIT β€” the widget exited early. This value gets set when characters like TAB or RETURN are injected into the widget via the injectCDKXXX function and the character that got injected does not exit the widget.
  • vERROR β€” this one means an error came back from curses, e.g., if the terminal got disconnected 😭.
  • vESCAPE_HIT β€” the user hit ESCAPE to leave the widget.
  • vNEVER_ACTIVATED β€” this is the initial state of the value. It means the widget hasn't been activated yet πŸ’€.

🌸 NOTES 🌸

The header file <cdk.h> automatically includes the header files <curses.h>, <stdlib.h>, <string.h>, <ctype.h>, <unistd.h>, <dirent.h>, <time.h>, <errno.h>, <pwd.h>, <grp.h>, <sys/stat.h>, and <sys/types.h>. and the <curses.h> header file includes <stdio.h> and <unctrl.h>. one header to rule them all, no cap πŸŽ€


πŸ”₯ SEE ALSO πŸ”₯

cdk_binding(3), cdk_display(3), cdk_draw(3), cdk_misc(3), cdk_process(3), cdk_screen(3)


and that's the whole page, bestie πŸ’– this one's from Cdk(3), the Library calls section, dated 2025-01-14. go build something iconic with it, you've got this 🫢✨