UI: Make menu item use theme roundness

Menu items ignore the roundness setting since they spread left to right.
This patch makes it so menu items use the theme preference instead of
hardcoded square corners. Providing more flexibility to themes.

All built-in and included themes already have this set so no need to update them. For the default themes (Dark/Light) roundness is 0.4.

{F10950727, size=full}

The motivations behind this change are:
* To be more consistent with other widgets.
* Improve themes flexibility.
* Match padding with other elements that have like the Search field:

{F10950746, size=full}

Reviewed By: #user_interface, Severin

Differential Revision: https://developer.blender.org/D12813
This commit is contained in:
Pablo Vazquez 2021-10-13 14:28:55 +02:00 committed by Pablo Vazquez
parent 72e81a45c4
commit 5183653951
Notes: blender-bot 2023-02-14 07:17:43 +01:00
Referenced by issue #92562, UI: template_ID_preview reduced preview size
Referenced by issue #92278, Small size of thumbnails in the shading popover
1 changed files with 8 additions and 2 deletions

View File

@ -4052,9 +4052,15 @@ static void widget_menu_itembut(uiWidgetColors *wcol,
uiWidgetBase wtb;
widget_init(&wtb);
/* not rounded, no outline */
/* Padding on the sides. */
const float padding = 0.125f * BLI_rcti_size_y(rect);
rect->xmin += padding;
rect->xmax -= padding;
/* No outline. */
wtb.draw_outline = false;
round_box_edges(&wtb, 0, rect, 0.0f);
const float rad = wcol->roundness * BLI_rcti_size_y(rect);
round_box_edges(&wtb, UI_CNR_ALL, rect, rad);
widgetbase_draw(&wtb, wcol);
}