Checkbox elements provide a simple boolean toggle control. Each checkbox is a square box that fills with a smaller inner square when checked. An optional text label can be placed to the right of the box. Left-clicking anywhere within the hit-test region — the box itself plus the label area — toggles the checked state. The box colors follow the same packed integer convention as buttons and inputs: the low nibble is the fill color and the high nibble is the border color.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/DRESsedAlarm184/LWXGL/llms.txt
Use this file to discover all available pages before exploring further.
Hit-Test Region
The clickable area extends beyond the visible box to include the label:label is NULL the hit area is just size × size. The height of the hit region always equals size.
Functions
CreateCheckbox
Creates a toggleable checkbox element with an optional text label.Unique integer identifier for this element.
Left edge of the checkbox box in pixels.
Top edge of the checkbox box in pixels.
Width and height of the checkbox box in pixels. Also determines the height of the hit-test region.
Packed color for the checkbox box. Low nibble = fill color (
CLR_*); high nibble = border color (CLR_*). When checked, the inner indicator square is drawn in the border color (high nibble).Color of the label text, one of the
CLR_* palette constants. The packing convention does not apply here — this is used directly as a CLR_* index. Pass any value if label is NULL.Text label drawn
size + 5 pixels to the right of the box. Pass NULL for no label; the hit region then equals only the box area.GetCheckbox
Returns the current checked state of a checkbox element.The identifier of a checkbox element previously created with
CreateCheckbox.1 if the checkbox is currently checked, or 0 if it is unchecked. The state is toggled internally each time the user clicks within the hit-test region.
Visual Details
The renderer draws the checkbox as follows:- Fill the
size × sizebox with the low-nibble color. - Outline the box with the high-nibble color (
XDrawRectangle). - If checked, fill an inner rectangle inset by 4 px on each side with the high-nibble color.
- If a label is provided, draw it
size + 5px to the right, vertically centered aty + size/2 + 5.