Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Craddock <nzcraddock@gmail.com>2020-09-15 16:19:57 +0300
committerNathan Craddock <nzcraddock@gmail.com>2020-09-15 16:26:08 +0300
commite17df47303e1fc85276124d447d2ea405e1f0465 (patch)
tree3d8e5b86d37d99dde616b4b76666734603093dc4 /source/blender/editors/interface/interface_layout.c
parent13c7df1054d6762d92649adc27a4316356ad092c (diff)
UI: Add support for row-aligned icon buttons in menus
This adds support for drawing icon buttons as a row in menus. This is needed for drawing collection color tagging icons in the outliner context menu in T77777. Part of T77408 Differential Revision: https://developer.blender.org/D8317
Diffstat (limited to 'source/blender/editors/interface/interface_layout.c')
-rw-r--r--source/blender/editors/interface/interface_layout.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index a37f87e593b..f00ce7ee923 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -1434,6 +1434,26 @@ void uiItemsFullEnumO_items(uiLayout *layout,
if (radial) {
target = uiLayoutRadial(layout);
}
+ else if ((uiLayoutGetLocalDir(layout) == UI_LAYOUT_HORIZONTAL) && (flag & UI_ITEM_R_ICON_ONLY)) {
+ target = layout;
+ UI_block_layout_set_current(block, target);
+
+ /* Add a blank button to the beginning of the row. */
+ uiDefIconBut(block,
+ UI_BTYPE_LABEL,
+ 0,
+ ICON_BLANK1,
+ 0,
+ 0,
+ 1.25f * UI_UNIT_X,
+ UI_UNIT_Y,
+ NULL,
+ 0,
+ 0,
+ 0,
+ 0,
+ NULL);
+ }
else {
split = uiLayoutSplit(layout, 0.0f, false);
target = uiLayoutColumn(split, layout->align);
@@ -1489,7 +1509,7 @@ void uiItemsFullEnumO_items(uiLayout *layout,
if (item->name) {
uiBut *but;
- if (item != item_array && !radial) {
+ if (item != item_array && !radial && split) {
target = uiLayoutColumn(split, layout->align);
/* inconsistent, but menus with labels do not look good flipped */