UI: Add (internal) option to use property splitting for label-less items

Usually items without labels don't use the property split layout and
just use the full layout width. In some cases that is not wanted because
it looks odd if single items within the split layout use the full width.
The option is unused but would be needed for adding decorators to the
material properties.
This commit is contained in:
Julian Eisel 2020-04-27 15:24:25 +02:00
parent b6592c83b5
commit 6842958c9b
2 changed files with 5 additions and 3 deletions

View File

@ -1778,6 +1778,8 @@ enum {
UI_ITEM_R_CHECKBOX_INVERT = 1 << 12,
/** Don't add a real decorator item, just blank space. */
UI_ITEM_R_FORCE_BLANK_DECORATE = 1 << 13,
/* Even create the property split layout if there's no name to show there. */
UI_ITEM_R_SPLIT_EMPTY_NAME = 1 << 14,
};
#define UI_HEADER_OFFSET ((void)0, 0.4f * UI_UNIT_X)

View File

@ -1969,7 +1969,7 @@ void uiItemFullR(uiLayout *layout,
* Keep using 'use_prop_sep' instead of disabling it entirely because
* we need the ability to have decorators still. */
bool use_prop_sep_split_label = use_prop_sep;
bool forbid_single_col = false;
bool use_split_empty_name = (flag & UI_ITEM_R_SPLIT_EMPTY_NAME);
#ifdef UI_PROP_DECORATE
struct {
@ -2082,7 +2082,7 @@ void uiItemFullR(uiLayout *layout,
use_prop_sep_split_label = false;
/* For checkboxes we make an expection: We allow showing them in a split row even without
* label. It typically relates to its neighbor items, so no need for an extra label. */
forbid_single_col = true;
use_split_empty_name = true;
}
}
#endif
@ -2120,7 +2120,7 @@ void uiItemFullR(uiLayout *layout,
}
#endif /* UI_PROP_DECORATE */
if ((name[0] == '\0') && !forbid_single_col) {
if ((name[0] == '\0') && !use_split_empty_name) {
/* Ensure we get a column when text is not set. */
layout = uiLayoutColumn(layout_row ? layout_row : layout, true);
layout->space = 0;