Radio buttons are now diamonds.

This commit is contained in:
Scott Duensing 2026-03-15 22:37:15 -05:00
parent 236f6b4e39
commit 3580565ca6
2 changed files with 41 additions and 15 deletions

View file

@ -840,12 +840,12 @@ static void drawPopupLevel(AppContextT *ctx, DisplayT *d, const BlitOpsT *ops, c
drawVLine(d, ops, cx + 2, cy - 1, 2, fg);
drawVLine(d, ops, cx + 3, cy - 2, 2, fg);
} else if (item->type == MenuItemRadioE) {
// Filled circle bullet (5x5)
drawHLine(d, ops, cx - 1, cy - 2, 3, fg);
drawHLine(d, ops, cx - 2, cy - 1, 5, fg);
// Filled diamond bullet (5x5)
drawHLine(d, ops, cx, cy - 2, 1, fg);
drawHLine(d, ops, cx - 1, cy - 1, 3, fg);
drawHLine(d, ops, cx - 2, cy, 5, fg);
drawHLine(d, ops, cx - 2, cy + 1, 5, fg);
drawHLine(d, ops, cx - 1, cy + 2, 3, fg);
drawHLine(d, ops, cx - 1, cy + 1, 3, fg);
drawHLine(d, ops, cx, cy + 2, 1, fg);
}
}

View file

@ -175,19 +175,45 @@ void widgetRadioPaint(WidgetT *w, DisplayT *d, const BlitOpsT *ops, const Bitmap
uint32_t bg = w->bgColor ? w->bgColor : colors->contentBg;
int32_t boxY = w->y + (w->h - CHECKBOX_BOX_SIZE) / 2;
// Draw radio box
BevelStyleT bevel;
bevel.highlight = colors->windowShadow;
bevel.shadow = colors->windowHighlight;
bevel.face = bg;
bevel.width = 1;
drawBevel(d, ops, w->x, boxY, CHECKBOX_BOX_SIZE, CHECKBOX_BOX_SIZE, &bevel);
// Draw diamond-shaped radio box
int32_t bx = w->x;
int32_t mid = CHECKBOX_BOX_SIZE / 2;
uint32_t hi = colors->windowShadow;
uint32_t sh = colors->windowHighlight;
// Draw filled dot if selected
// Fill interior
for (int32_t i = 0; i < CHECKBOX_BOX_SIZE; i++) {
int32_t dist = i < mid ? i : CHECKBOX_BOX_SIZE - 1 - i;
int32_t left = mid - dist;
int32_t right = mid + dist;
if (right > left) {
drawHLine(d, ops, bx + left + 1, boxY + i, right - left - 1, bg);
}
}
// Diamond border — upper-left edges get highlight, lower-right get shadow
for (int32_t i = 0; i < mid; i++) {
int32_t left = mid - i;
int32_t right = mid + i;
drawHLine(d, ops, bx + left, boxY + i, 1, hi);
drawHLine(d, ops, bx + right, boxY + i, 1, sh);
}
for (int32_t i = mid; i < CHECKBOX_BOX_SIZE; i++) {
int32_t left = mid - (CHECKBOX_BOX_SIZE - 1 - i);
int32_t right = mid + (CHECKBOX_BOX_SIZE - 1 - i);
drawHLine(d, ops, bx + left, boxY + i, 1, hi);
drawHLine(d, ops, bx + right, boxY + i, 1, sh);
}
// Draw filled diamond if selected
if (w->parent && w->parent->type == WidgetRadioGroupE &&
w->parent->as.radioGroup.selectedIdx == w->as.radio.index) {
rectFill(d, ops, w->x + 3, boxY + 3,
CHECKBOX_BOX_SIZE - 6, CHECKBOX_BOX_SIZE - 6, fg);
for (int32_t i = -2; i <= 2; i++) {
int32_t span = 3 - (i < 0 ? -i : i);
drawHLine(d, ops, bx + mid - span, boxY + mid + i, span * 2 + 1, fg);
}
}
int32_t labelX = w->x + CHECKBOX_BOX_SIZE + CHECKBOX_GAP;