Add standard radius
This commit is contained in:
@@ -153,7 +153,7 @@ B32 ui_button(const char *id, const char *text) {
|
||||
.childAlignment = { .y = CLAY_ALIGN_Y_CENTER },
|
||||
},
|
||||
.backgroundColor = hovered ? g_theme.accent_hover : g_theme.accent,
|
||||
.cornerRadius = CLAY_CORNER_RADIUS(CORNER_RADIUS_SM)
|
||||
.cornerRadius = CLAY_CORNER_RADIUS(CORNER_RADIUS)
|
||||
) {
|
||||
CLAY_TEXT(clay_str(text), &g_widget_text_config_btn);
|
||||
}
|
||||
@@ -190,11 +190,11 @@ B32 ui_checkbox(const char *id, const char *label, B32 *value) {
|
||||
.childAlignment = { .x = CLAY_ALIGN_X_CENTER, .y = CLAY_ALIGN_Y_CENTER },
|
||||
},
|
||||
.backgroundColor = box_bg,
|
||||
.cornerRadius = CLAY_CORNER_RADIUS(CORNER_RADIUS_SM),
|
||||
.cornerRadius = CLAY_CORNER_RADIUS(CORNER_RADIUS),
|
||||
.border = { .color = g_theme.border, .width = { 1, 1, 1, 1 } }
|
||||
) {
|
||||
if (*value) {
|
||||
ui_icon(UI_ICON_CHECK, WIDGET_CHECKBOX_SIZE * 0.75f, g_theme.text);
|
||||
ui_icon(UI_ICON_CHECK, WIDGET_CHECKBOX_SIZE * 0.75f, g_theme.button_text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ B32 ui_radio_group(const char *id, const char **options, S32 count, S32 *selecte
|
||||
.layout = {
|
||||
.sizing = { .width = CLAY_SIZING_FIXED(WIDGET_RADIO_INNER), .height = CLAY_SIZING_FIXED(WIDGET_RADIO_INNER) },
|
||||
},
|
||||
.backgroundColor = g_theme.text,
|
||||
.backgroundColor = g_theme.button_text,
|
||||
.cornerRadius = CLAY_CORNER_RADIUS(uis(4))
|
||||
) {}
|
||||
}
|
||||
@@ -606,7 +606,7 @@ B32 ui_text_input(const char *id, char *buf, S32 buf_size) {
|
||||
.layoutDirection = CLAY_LEFT_TO_RIGHT,
|
||||
},
|
||||
.backgroundColor = bg,
|
||||
.cornerRadius = CLAY_CORNER_RADIUS(CORNER_RADIUS_SM),
|
||||
.cornerRadius = CLAY_CORNER_RADIUS(CORNER_RADIUS),
|
||||
.border = { .color = border_color, .width = { 1, 1, 1, 1 } }
|
||||
) {
|
||||
if (len == 0 && !is_focused) {
|
||||
@@ -720,7 +720,7 @@ B32 ui_dropdown(const char *id, const char **options, S32 count, S32 *selected)
|
||||
.layoutDirection = CLAY_LEFT_TO_RIGHT,
|
||||
},
|
||||
.backgroundColor = bg,
|
||||
.cornerRadius = CLAY_CORNER_RADIUS(CORNER_RADIUS_SM),
|
||||
.cornerRadius = CLAY_CORNER_RADIUS(CORNER_RADIUS),
|
||||
.border = { .color = is_open ? g_theme.accent : g_theme.border, .width = { 1, 1, 1, 1 } }
|
||||
) {
|
||||
CLAY(text_eid,
|
||||
@@ -762,6 +762,7 @@ B32 ui_dropdown(const char *id, const char **options, S32 count, S32 *selected)
|
||||
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
||||
},
|
||||
.backgroundColor = g_theme.bg_dark,
|
||||
.cornerRadius = CLAY_CORNER_RADIUS(CORNER_RADIUS),
|
||||
.border = { .color = g_theme.border, .width = { 1, 1, 1, 1 } },
|
||||
.floating = {
|
||||
.parentId = eid.id,
|
||||
@@ -784,13 +785,18 @@ B32 ui_dropdown(const char *id, const char **options, S32 count, S32 *selected)
|
||||
Clay_TextElementConfig *item_text = (is_item_selected && !item_hovered)
|
||||
? &g_widget_text_config_btn : &g_widget_text_config;
|
||||
|
||||
Clay_CornerRadius item_radius = {};
|
||||
if (i == 0) { item_radius.topLeft = CORNER_RADIUS; item_radius.topRight = CORNER_RADIUS; }
|
||||
if (i == count - 1) { item_radius.bottomLeft = CORNER_RADIUS; item_radius.bottomRight = CORNER_RADIUS; }
|
||||
|
||||
CLAY(item_id,
|
||||
.layout = {
|
||||
.sizing = { .width = CLAY_SIZING_GROW(), .height = CLAY_SIZING_FIXED(WIDGET_DROPDOWN_ITEM_H) },
|
||||
.padding = { uip(8), uip(8), 0, 0 },
|
||||
.childAlignment = { .y = CLAY_ALIGN_Y_CENTER },
|
||||
},
|
||||
.backgroundColor = item_bg
|
||||
.backgroundColor = item_bg,
|
||||
.cornerRadius = item_radius
|
||||
) {
|
||||
CLAY_TEXT(clay_str(options[i]), item_text);
|
||||
}
|
||||
@@ -876,7 +882,7 @@ S32 ui_modal(const char *id, const char *title, const char *message,
|
||||
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
||||
},
|
||||
.backgroundColor = g_theme.bg_medium,
|
||||
.cornerRadius = CLAY_CORNER_RADIUS(CORNER_RADIUS_MD),
|
||||
.cornerRadius = CLAY_CORNER_RADIUS(CORNER_RADIUS),
|
||||
.floating = {
|
||||
.zIndex = 1001,
|
||||
.attachPoints = {
|
||||
@@ -896,7 +902,7 @@ S32 ui_modal(const char *id, const char *title, const char *message,
|
||||
.childAlignment = { .y = CLAY_ALIGN_Y_CENTER },
|
||||
},
|
||||
.backgroundColor = g_theme.title_bar,
|
||||
.cornerRadius = { MODAL_CORNER_RADIUS, MODAL_CORNER_RADIUS, 0, 0 },
|
||||
.cornerRadius = { CORNER_RADIUS, CORNER_RADIUS, 0, 0 },
|
||||
.border = { .color = g_theme.border, .width = { .bottom = 1 } }
|
||||
) {
|
||||
CLAY_TEXT(clay_str(title), &g_widget_text_config);
|
||||
@@ -937,7 +943,7 @@ S32 ui_modal(const char *id, const char *title, const char *message,
|
||||
.childAlignment = { .y = CLAY_ALIGN_Y_CENTER },
|
||||
},
|
||||
.backgroundColor = btn_hovered ? g_theme.accent_hover : g_theme.accent,
|
||||
.cornerRadius = CLAY_CORNER_RADIUS(CORNER_RADIUS_SM)
|
||||
.cornerRadius = CLAY_CORNER_RADIUS(CORNER_RADIUS)
|
||||
) {
|
||||
CLAY_TEXT(clay_str(buttons[i]), &g_widget_text_config_btn);
|
||||
}
|
||||
@@ -1060,7 +1066,7 @@ B32 ui_window(const char *id, const char *title, B32 *open,
|
||||
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
||||
},
|
||||
.backgroundColor = g_theme.bg_medium,
|
||||
.cornerRadius = CLAY_CORNER_RADIUS(CORNER_RADIUS_MD),
|
||||
.cornerRadius = CLAY_CORNER_RADIUS(CORNER_RADIUS),
|
||||
.floating = {
|
||||
.offset = { slot->position.x, slot->position.y },
|
||||
.zIndex = (int16_t)(100 + slot->z_order),
|
||||
@@ -1082,7 +1088,7 @@ B32 ui_window(const char *id, const char *title, B32 *open,
|
||||
.layoutDirection = CLAY_LEFT_TO_RIGHT,
|
||||
},
|
||||
.backgroundColor = g_theme.title_bar,
|
||||
.cornerRadius = { WINDOW_CORNER_RADIUS, WINDOW_CORNER_RADIUS, 0, 0 },
|
||||
.cornerRadius = { CORNER_RADIUS, CORNER_RADIUS, 0, 0 },
|
||||
.border = { .color = g_theme.border, .width = { .bottom = 1 } }
|
||||
) {
|
||||
// Title text (grows to push close button right)
|
||||
@@ -1095,14 +1101,16 @@ B32 ui_window(const char *id, const char *title, B32 *open,
|
||||
}
|
||||
|
||||
// Close button
|
||||
Clay_Color close_bg = close_hovered ? Clay_Color{200, 60, 60, 255} : Clay_Color{120, 50, 50, 255};
|
||||
Clay_Color close_bg = g_theme_id == 1
|
||||
? (close_hovered ? Clay_Color{220, 50, 50, 255} : Clay_Color{200, 70, 70, 255})
|
||||
: (close_hovered ? Clay_Color{200, 60, 60, 255} : Clay_Color{120, 50, 50, 255});
|
||||
CLAY(close_id,
|
||||
.layout = {
|
||||
.sizing = { .width = CLAY_SIZING_FIXED(uis(20)), .height = CLAY_SIZING_FIXED(uis(20)) },
|
||||
.childAlignment = { .x = CLAY_ALIGN_X_CENTER, .y = CLAY_ALIGN_Y_CENTER },
|
||||
},
|
||||
.backgroundColor = close_bg,
|
||||
.cornerRadius = CLAY_CORNER_RADIUS(CORNER_RADIUS_SM)
|
||||
.cornerRadius = CLAY_CORNER_RADIUS(CORNER_RADIUS)
|
||||
) {
|
||||
ui_icon(UI_ICON_CLOSE, uis(12), g_theme.button_text);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user