// widgetStatusBar.c -- StatusBar widget // // A horizontal container that draws a sunken border around each visible // child to create the classic segmented status bar appearance. Children // are typically labels or other simple widgets, laid out by the generic // horizontal box layout. The status bar itself has no special layout // logic -- it's a standard HBox with tight padding/spacing and the // extra per-child sunken border decorations. // // The border drawing is done as an overlay on top of children rather // than as part of the child's own paint, because it wraps around // the child's allocated area (extending 1px past each edge). This // keeps the sunken-panel effect consistent regardless of the child // widget type. // // No mouse/key handlers -- the status bar is purely display. Children // that are interactive (e.g., a clickable label) handle their own events. #include "widgetInternal.h" // ============================================================ // wgtStatusBar // ============================================================ // Tight 2px padding and spacing keeps the status bar compact, using // minimal vertical space at the bottom of a window. WidgetT *wgtStatusBar(WidgetT *parent) { WidgetT *w = widgetAlloc(parent, WidgetStatusBarE); if (w) { w->padding = wgtPixels(2); w->spacing = wgtPixels(2); } return w; } // ============================================================ // widgetStatusBarPaint // ============================================================ // Draws a 1px sunken bevel (reversed highlight/shadow) around each // child. The bevel.face=0 with width=1 means only the border lines // are drawn, not a filled interior -- the child paints its own content. void widgetStatusBarPaint(WidgetT *w, DisplayT *d, const BlitOpsT *ops, const BitmapFontT *font, const ColorSchemeT *colors) { (void)font; // Draw sunken border around each child for (WidgetT *c = w->firstChild; c; c = c->nextSibling) { if (!c->visible) { continue; } BevelStyleT bevel; bevel.highlight = colors->windowShadow; bevel.shadow = colors->windowHighlight; bevel.face = 0; bevel.width = 1; drawBevel(d, ops, c->x - 1, c->y - 1, c->w + 2, c->h + 2, &bevel); } }