diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-05 09:56:14 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-05 09:56:14 +0300 |
commit | 80d86f303a4ac8d293fc06bc3d1ccb2cd4ebfe5b (patch) | |
tree | fe85cb106ca71f3745e1fd4f9d9c6024817a1f19 /source/blender | |
parent | 17e9870221662f19fdf601275ddc34bd3418f4ca (diff) |
UI: support property split for 'prop_search'
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/interface/interface_layout.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index ea40c8e8fd8..b3bd98c7b94 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -701,6 +701,7 @@ static uiBut *ui_item_with_label( PropertyType type; PropertySubType subtype; int prop_but_width = w_hint; + const bool use_prop_sep = ((layout->item.flag & UI_ITEM_PROP_SEP) != 0); sub = uiLayoutRow(layout, layout->align); UI_block_layout_set_current(block, sub); @@ -708,15 +709,25 @@ static uiBut *ui_item_with_label( if (name[0]) { int w_label; - if (ui_layout_vary_direction(layout) == UI_ITEM_VARY_X) { - /* w_hint is width for label in this case. Use a default width for property button(s) */ - prop_but_width = UI_UNIT_X * 5; - w_label = w_hint; + if (use_prop_sep) { + w_label = (int)((w_hint * 2) * UI_ITEM_PROP_SEP_DIVIDE); } else { - w_label = w_hint / 3; + if (ui_layout_vary_direction(layout) == UI_ITEM_VARY_X) { + /* w_hint is width for label in this case. Use a default width for property button(s) */ + prop_but_width = UI_UNIT_X * 5; + w_label = w_hint; + } + else { + w_label = w_hint / 3; + } + } + + uiBut *but_label = uiDefBut(block, UI_BTYPE_LABEL, 0, name, x, y, w_label, h, NULL, 0.0, 0.0, 0, 0, ""); + if (use_prop_sep) { + but_label->drawflag |= UI_BUT_TEXT_RIGHT; + but_label->drawflag &= ~UI_BUT_TEXT_LEFT; } - uiDefBut(block, UI_BTYPE_LABEL, 0, name, x, y, w_label, h, NULL, 0.0, 0.0, 0, 0, ""); } type = RNA_property_type(prop); @@ -1851,6 +1862,7 @@ void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propna StructRNA *icontype; int w, h; char namestr[UI_MAX_NAME_STR]; + const bool use_prop_sep = ((layout->item.flag & UI_ITEM_PROP_SEP) != 0); /* validate arguments */ prop = RNA_struct_find_property(ptr, propname); @@ -1893,7 +1905,9 @@ void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propna if (!name) name = RNA_property_ui_name(prop); - name = ui_item_name_add_colon(name, namestr); + if (use_prop_sep == false) { + name = ui_item_name_add_colon(name, namestr); + } /* create button */ block = uiLayoutGetBlock(layout); |