// widgetToolbar.c -- Toolbar widget // // A horizontal container with a raised 1px bevel background, used to // hold buttons, separators, spacers, and other control widgets in a // strip at the top of a window. Like StatusBar, the toolbar is a // standard HBox layout with custom paint -- child widgets position // themselves via the generic horizontal box algorithm. // // The 1px raised bevel (vs the 2px used for window chrome) keeps the // toolbar visually distinct but lightweight. The bevel's bottom shadow // line serves as the separator between the toolbar and the content // area below it. // // Tight 2px padding and spacing match the StatusBar for visual // consistency between top and bottom chrome bars. Children (typically // ImageButtons or small Buttons) handle their own mouse/key events. #include "widgetInternal.h" // ============================================================ // wgtToolbar // ============================================================ WidgetT *wgtToolbar(WidgetT *parent) { WidgetT *w = widgetAlloc(parent, WidgetToolbarE); if (w) { w->padding = wgtPixels(2); w->spacing = wgtPixels(2); } return w; } // ============================================================ // widgetToolbarPaint // ============================================================ // Raised bevel with windowFace fill. The 1px bevel width is // intentionally thinner than window chrome (2px) to keep the // toolbar from looking too heavy. void widgetToolbarPaint(WidgetT *w, DisplayT *d, const BlitOpsT *ops, const BitmapFontT *font, const ColorSchemeT *colors) { (void)font; // Draw raised background and bottom separator BevelStyleT bevel; bevel.highlight = colors->windowHighlight; bevel.shadow = colors->windowShadow; bevel.face = colors->windowFace; bevel.width = 1; drawBevel(d, ops, w->x, w->y, w->w, w->h, &bevel); }