UI: use zero box-spacing when used in headers
Without this, boxes are unusable in header layouts as they add vertical space which shifts the items out of the header.
This commit is contained in:
@@ -3650,8 +3650,13 @@ static void ui_litem_estimate_box(uiLayout *litem)
|
||||
uiStyle *style = litem->root->style;
|
||||
|
||||
ui_litem_estimate_column(litem, true);
|
||||
litem->w += 2 * style->boxspace;
|
||||
litem->h += 2 * style->boxspace;
|
||||
|
||||
int boxspace = style->boxspace;
|
||||
if (litem->root->type == UI_LAYOUT_HEADER) {
|
||||
boxspace = 0;
|
||||
}
|
||||
litem->w += 2 * boxspace;
|
||||
litem->h += 2 * boxspace;
|
||||
}
|
||||
|
||||
static void ui_litem_layout_box(uiLayout *litem)
|
||||
@@ -3661,29 +3666,34 @@ static void ui_litem_layout_box(uiLayout *litem)
|
||||
uiBut *but;
|
||||
int w, h;
|
||||
|
||||
int boxspace = style->boxspace;
|
||||
if (litem->root->type == UI_LAYOUT_HEADER) {
|
||||
boxspace = 0;
|
||||
}
|
||||
|
||||
w = litem->w;
|
||||
h = litem->h;
|
||||
|
||||
litem->x += style->boxspace;
|
||||
litem->y -= style->boxspace;
|
||||
litem->x += boxspace;
|
||||
litem->y -= boxspace;
|
||||
|
||||
if (w != 0) {
|
||||
litem->w -= 2 * style->boxspace;
|
||||
litem->w -= 2 * boxspace;
|
||||
}
|
||||
if (h != 0) {
|
||||
litem->h -= 2 * style->boxspace;
|
||||
litem->h -= 2 * boxspace;
|
||||
}
|
||||
|
||||
ui_litem_layout_column(litem, true);
|
||||
|
||||
litem->x -= style->boxspace;
|
||||
litem->y -= style->boxspace;
|
||||
litem->x -= boxspace;
|
||||
litem->y -= boxspace;
|
||||
|
||||
if (w != 0) {
|
||||
litem->w += 2 * style->boxspace;
|
||||
litem->w += 2 * boxspace;
|
||||
}
|
||||
if (h != 0) {
|
||||
litem->h += 2 * style->boxspace;
|
||||
litem->h += 2 * boxspace;
|
||||
}
|
||||
|
||||
/* roundbox around the sublayout */
|
||||
|
||||
Reference in New Issue
Block a user