cdk_scale(3)

πŸ“¦
version 5.0.20250116 Β· 3 versions
, in debian trixie, ubuntu questing

πŸŽ€ NAME πŸŽ€

cdk_scale β€” the Cdk scale widget, and yes bestie it's type int πŸ’–

This is page cdk_scale(3) from the library calls manual, and she is iconic. Grab a snack, we're going in πŸ“


✨ SYNOPSIS ✨

Like, here's how you actually summon her πŸ‘‘

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

#include <cdk.h>

int activateCDKScale (
               CDKSCALE *scale,
               chtype *actions);

void destroyCDKScale (
               CDKSCALE *scale);

void drawCDKScale (
               CDKSCALE *scale,
               boolean box);

void eraseCDKScale (
               CDKSCALE *scale);

boolean getCDKScaleBox (
               CDKSCALE *scale);

int getCDKScaleHighValue (
               CDKSCALE *scale);

int getCDKScaleLowValue (
               CDKSCALE *scale);

int getCDKScaleValue (
               CDKSCALE *scale);

int injectCDKScale (
               CDKSCALE *scale,
               chtype input);

void moveCDKScale (
               CDKSCALE *scale,
               int xpos,
               int ypos,
               boolean relative,
               boolean refresh);

CDKSCALE *newCDKScale (
               CDKSCREEN *cdkscreen,
               int xpos,
               int ypos,
               const char *title,
               const char *label,
               chtype fieldAttribute,
               int fieldWidth,
               int currentValue,
               int lowValue,
               int highValue,
               int increment,
               int fastIncrement,
               boolean box,
               boolean shadow);

void positionCDKScale (
               CDKSCALE *scale);

void setCDKScale (
               CDKSCALE *scale,
               int lowValue,
               int highValue,
               int currentValue,
               boolean box);

void setCDKScaleBackgroundAttrib (
               CDKSCALE *scale,
               chtype attribute);

void setCDKScaleBackgroundColor (
               CDKSCALE *scale,
               const char * color);

void setCDKScaleBox (
               CDKSCALE *scale,
               boolean box);

void setCDKScaleBoxAttribute (
               CDKSCALE *scale,
               chtype character);

void setCDKScaleHorizontalChar (
               CDKSCALE *scale,
               chtype character);

void setCDKScaleLLChar (
               CDKSCALE *scale,
               chtype character);

void setCDKScaleLRChar (
               CDKSCALE *scale,
               chtype character);

void setCDKScaleLowHigh (
               CDKSCALE *scale,
               int low,
               int high);

void setCDKScalePostProcess (
               CDKSCALE *scale,
               PROCESSFN callback,
               void * data);

void setCDKScalePreProcess (
               CDKSCALE *scale,
               PROCESSFN callback,
               void * data);

void setCDKScaleULChar (
               CDKSCALE *scale,
               chtype character);

void setCDKScaleURChar (
               CDKSCALE *scale,
               chtype character);

void setCDKScaleValue (
               CDKSCALE *scale,
               int value);

void setCDKScaleVerticalChar (
               CDKSCALE *scale,
               chtype character);

🌸 DESCRIPTION 🌸

Okay so. The Cdk scale widget is literally this little box that shows up on your screen, and it's got a label and a scale field in it 🎚️ Think of it like a slider in a settings app but it's living inside your terminal and it has main character energy.

The functions below are the whole girl squad: some of them create the Cdk scale box widget, and some of them manipulate her after she exists. That's the vibe. That's the whole assignment πŸ’…

ngl bestie, if you're here you probably want the juicy details on every single one of those functions β€” and don't worry, we are NOT skipping a single flag, value, or default. No cap. Every detail stays, only the energy levels up ✨

Part one ends here, but the lore continues β€” more is coming, so don't go anywhere πŸ¦‹

✨ AVAILABLE FUNCTIONS ✨

okay bestie, here's the whole roster of functions you get to play with. every single one. no skips. πŸ’…


πŸ’– activateCDKScale

activates the scale widget and lets the user actually interact with it. main character moment fr.

  • the parameter scale is a pointer to a non-NULL scale widget.
  • if the actions parameter gets passed a non-NULL value, the characters in the array get injected straight into the widget.

to activate the widget interactively, pass in a NULL pointer for actions.

if the character entered into this widget is RETURN or TAB, this function returns a value from the low value to the high value. it also sets the widget data exitType to vNORMAL.

if the character entered into this widget was ESCAPE, the widget returns the unknownInt value (peep the cdk_objs.h header file).

the widget data exitType gets set to vESCAPE_HIT.


🧚 destroyCDKScale

removes the widget from the screen and frees the memory the object was using. it's giving closure, honestly. 🫢


🌸 drawCDKScale

draws the scale widget on the screen.

if the box parameter is true, the widget gets drawn with a box. cute little frame, we love. πŸŽ€


πŸ¦‹ eraseCDKScale

removes the widget from the screen. this does NOT destroy the widget β€” she's just off-screen, not gone. πŸ™ˆ


⭐ getCDKScaleBox

returns whether the widget will be drawn with a box around it.


⭐ getCDKScaleHighValue

returns the high value of the scale widget.


⭐ getCDKScaleLowValue

returns the low value of the scale widget.


⭐ getCDKScaleValue

returns the current value of the widget. the moment. the truth. ✨


πŸ’€ injectCDKScale

injects a single character into the widget. yes, injects. slay.

  • the parameter scale is a pointer to a non-NULL scale widget.
  • the parameter character is the character to inject into the widget.

the return value and the side-effect (setting the widget data exitType) depend on which character you inject:

  • RETURN or TAB β€” the function returns a value ranging from the scale's low value to the scale's high value. the widget data exitType is set to vNORMAL.
  • ESCAPE β€” the function returns the unknownInt value (see the cdk_objs.h header file). the widget data exitType is set to vESCAPE_HIT.
  • Otherwise β€” unless it's been modified by preprocessing, postprocessing or key bindings, the function returns the unknownInt value (see the cdk_objs.h header file). the widget data exitType is set to vEARLY_EXIT.

🌈 moveCDKScale

moves the given widget to the given position. relocation era.

  • the parameters xpos and ypos are 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 relative states whether the xpos/ypos pair 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 values TOP, BOTTOM, LEFT, RIGHT, or CENTER when relative = TRUE. (weird things may happen). 😭

the final parameter refresh is a boolean value which states whether the widget will get refreshed after the move.


πŸ‘‘ newCDKScale

creates a pointer to a scale widget. parameters, bestie, listen up:

  • 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 values LEFT, RIGHT, and CENTER.
  • ypos β€” controls the placement of the object along the vertical axis. it may be an integer or one of the pre-defined values TOP, BOTTOM, and CENTER.
  • title β€” is the string 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.
  • label β€” is the string to display in the label of the scale field.
  • fieldAttribute β€” is the attribute of the characters displayed in the field.
  • fieldWidth β€” controls the width of the widget. if you provide a value of zero, the widget will be created with the full width of the screen. if you provide a negative value, the widget will be created the full width minus the value provided.
  • currentValue β€” is the value of the scale field when the widget is activated.
  • lowValue and highValue β€” are the low and high values of the widget respectively.
  • increment β€” is the regular increment value.
  • fastIncrement β€” is the accelerated increment value.
  • 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. πŸ’”


πŸŽ€ positionCDKScale

allows the user to move the widget around the screen via the cursor/keypad keys. see cdk_position (3) for key bindings.


πŸ“ setCDKScale

lets the programmer modify certain elements of an existing scale widget.

the parameter names correspond to the same parameter names listed in the newCDKScale function. iykyk.


πŸ’œ setCDKScaleBackgroundAttrib

sets the background attribute of the widget.

the parameter attribute is a curses attribute, e.g., A_BOLD.


πŸ’œ setCDKScaleBackgroundColor

sets the background color of the widget.

the parameter color is in the format of the Cdk format strings.

see cdk_display (3).


πŸ’œ setCDKScaleBox

sets whether the widget will be drawn with a box around it.


πŸ’œ setCDKScaleBoxAttribute

sets the attribute of the box.


πŸ’œ setCDKScaleHorizontalChar

sets the horizontal drawing character for the box to the given character.


πŸ’œ setCDKScaleLLChar

sets the lower left hand corner of the widget's box to the given character.


πŸ’œ setCDKScaleLRChar

sets the lower right hand corner of the widget's box to the given character.


πŸ’œ setCDKScaleLowHigh

sets the low and high values of the widget.


πŸ”₯ setCDKScalePostProcess

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).


πŸ”₯ setCDKScalePreProcess

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 points to data passed to the callback function.

to learn more about pre-processing see cdk_process (3).


πŸ’œ setCDKScaleULChar

sets the upper left hand corner of the widget's box to the given character.


πŸ’œ setCDKScaleURChar

sets the upper right hand corner of the widget's box to the given character.


πŸ’œ setCDKScaleValue

sets the current value of the widget.


πŸ’œ setCDKScaleVerticalChar

sets the vertical drawing character for the box to the given character.


πŸŽ€ KEY BINDINGS πŸŽ€

okay so when the widget is activated (like, it's awake and it's the main character now ✨) there's a whole lil squad of default key bindings that help you enter or manipulate the info fast. here's the keys and what they do, bestie πŸ‘‡

  • Down Arrow β€” Decrements the scale by the normal value. πŸ“‰
  • Up Arrow β€” Increments the scale by the normal value. πŸ“ˆ
  • u β€” Increments the scale by the normal value. (yes, lowercase, she's shy πŸ’…)
  • Prev Page β€” Decrements the scale by the accelerated value. πŸš€β¬‡οΈ
  • U β€” Decrements the scale by the accelerated value.
  • Ctrl-B β€” Decrements the scale by the accelerated value.
  • Next Page β€” Increments the scale by the accelerated value. πŸš€β¬†οΈ
  • Ctrl-F β€” Increments the scale by the accelerated value.
  • Home β€” Sets the scale to the low value. 🏠
  • g β€” Sets the scale to the low value.
  • ^ β€” Sets the scale to the low value.
  • End β€” Sets the scale to the high value. πŸ”š
  • G β€” Sets the scale to the high value.
  • $ β€” Sets the scale to the high value.
  • Return β€” Exits the widget and returns the index of the selected value. This also sets the widget data exitType to vNORMAL. ✌️
  • Tab β€” Exits the widget and returns the index of the selected value. This also sets the widget data exitType to vNORMAL.
  • Escape β€” Exits the widget and returns the unknownInt value (see the cdk_objs.h header file). This also sets the widget data exitType to vESCAPE_HIT. 😭
  • Ctrl-R β€” Refreshes the screen. πŸ”„

now, plot twist 🫒 if the cursor is not pointing to the field's value, a different set of key bindings takes over. You may use the left/right arrows to move the cursor onto the field's value and modify it by typing characters to replace the digits and sign. like, you literally just type at it. iconic behavior honestly.

  • Left Arrow β€” Decrements the scale by the normal value. ⬅️
  • Right Arrow β€” Increments the scale by the normal value. ➑️
  • d β€” Decrements the scale by the normal value.
  • D β€” Increments the scale by the accelerated value. πŸš€
  • - β€” Decrements the scale by the normal value.
  • + β€” Increments the scale by the normal value.
  • 0 β€” Sets the scale to the low value. 0️⃣
ngl bestie, remember that Escape hands back the unknownInt value β€” that one's in the cdk_objs.h header file, so peek there if you're confused. she's not like the other exits. 🫢

πŸ’– SEE ALSO πŸ’–


and that's the whole page, periodt πŸ’… this was cdk_scale(3) from the 2025-01-14 source drop β€” go forth and scale things, you absolute icon πŸ‘‘πŸ¦‹βœ¨

πŸ“¦ where this page comes from