52 lines
1.4 KiB
C
52 lines
1.4 KiB
C
// widgetSeparator.c — Separator widget (horizontal and vertical)
|
|
|
|
#include "widgetInternal.h"
|
|
|
|
|
|
// ============================================================
|
|
// wgtHSeparator
|
|
// ============================================================
|
|
|
|
WidgetT *wgtHSeparator(WidgetT *parent) {
|
|
WidgetT *w = widgetAlloc(parent, WidgetSeparatorE);
|
|
|
|
if (w) {
|
|
w->as.separator.vertical = false;
|
|
}
|
|
|
|
return w;
|
|
}
|
|
|
|
|
|
// ============================================================
|
|
// wgtVSeparator
|
|
// ============================================================
|
|
|
|
WidgetT *wgtVSeparator(WidgetT *parent) {
|
|
WidgetT *w = widgetAlloc(parent, WidgetSeparatorE);
|
|
|
|
if (w) {
|
|
w->as.separator.vertical = true;
|
|
}
|
|
|
|
return w;
|
|
}
|
|
|
|
|
|
// ============================================================
|
|
// widgetSeparatorPaint
|
|
// ============================================================
|
|
|
|
void widgetSeparatorPaint(WidgetT *w, DisplayT *d, const BlitOpsT *ops, const BitmapFontT *font, const ColorSchemeT *colors) {
|
|
(void)font;
|
|
|
|
if (w->as.separator.vertical) {
|
|
int32_t cx = w->x + w->w / 2;
|
|
drawVLine(d, ops, cx, w->y, w->h, colors->windowShadow);
|
|
drawVLine(d, ops, cx + 1, w->y, w->h, colors->windowHighlight);
|
|
} else {
|
|
int32_t cy = w->y + w->h / 2;
|
|
drawHLine(d, ops, w->x, cy, w->w, colors->windowShadow);
|
|
drawHLine(d, ops, w->x, cy + 1, w->w, colors->windowHighlight);
|
|
}
|
|
}
|