diff options
author | Hans Goudey <h.goudey@me.com> | 2020-06-17 21:09:17 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-06-17 21:09:17 +0300 |
commit | bcb2b8ab576cbaf4663d9cc8690d40353f2f2651 (patch) | |
tree | a20804f53341987f63a2ddf2df8dee28ad4e13f0 /source/blender/editors/interface | |
parent | 4cfdd10c2bf910606ce5570155b1b01f1f838a55 (diff) |
UI: Improve Modifier Panel Header Menu
This makes a few changes to the modifier panel header:
1. Adds "move to top" and "move to bottom" buttons.
2. Adds a checkmark icon for "apply"
3. Makes it narrower, the text is closer to the dropdown icon.
(Requires the change in ui_block_func_POPUP)
Differential Revision: https://developer.blender.org/D8040
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/interface_region_menu_popup.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface_region_menu_popup.c b/source/blender/editors/interface/interface_region_menu_popup.c index 3e34b7f3f8a..65f5798bdce 100644 --- a/source/blender/editors/interface/interface_region_menu_popup.c +++ b/source/blender/editors/interface/interface_region_menu_popup.c @@ -184,7 +184,12 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi pup->block->handle = NULL; } - if (pup->but) { + /* Find block minimum width. */ + if (uiLayoutGetUnitsX(pup->layout) != 0.0f) { + /* Use the minimum width from the layout if it's set. */ + minwidth = uiLayoutGetUnitsX(pup->layout) * UI_UNIT_X; + } + else if (pup->but) { /* minimum width to enforece */ if (pup->but->drawstr[0]) { minwidth = BLI_rctf_size_x(&pup->but->rect); @@ -193,7 +198,13 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi /* For buttons with no text, use the minimum (typically icon only). */ minwidth = UI_MENU_WIDTH_MIN; } + } + else { + minwidth = UI_MENU_WIDTH_MIN; + } + /* Find block direction. */ + if (pup->but) { if (pup->block->direction != 0) { /* allow overriding the direction from menu_func */ direction = pup->block->direction; @@ -203,7 +214,6 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi } } else { - minwidth = UI_MENU_WIDTH_MIN; direction = UI_DIR_DOWN; } |