diff --git a/libs/ui/source/default_element_factory.cpp b/libs/ui/source/default_element_factory.cpp index da50a9f6..9dc2efdc 100644 --- a/libs/ui/source/default_element_factory.cpp +++ b/libs/ui/source/default_element_factory.cpp @@ -276,7 +276,7 @@ namespace psemek::ui auto st = merged_style(); - float const header_height = std::max(lc[1].min + 2.f * (*st->border_width), bc[1].min); + float const header_height = std::max(lc[1].min + 2.f * (*st->inner_margin) + 2.f * (*st->border_width), bc[1].min); { geom::box b; @@ -289,10 +289,10 @@ namespace psemek::ui { geom::box b; - b[0].min = bbox[0].min + (*st->border_width); - b[0].max = bbox[0].max - bc[0].min; - b[1].min = bbox[1].min + (*st->border_width); - b[1].max = bbox[1].min + header_height - (*st->border_width); + b[0].min = bbox[0].min + (*st->inner_margin) + (*st->border_width); + b[0].max = bbox[0].max - (*st->inner_margin) - bc[0].min; + b[1].min = bbox[1].min + (*st->inner_margin) + (*st->border_width); + b[1].max = bbox[1].min + header_height - (*st->inner_margin) - (*st->border_width); caption_->reshape(b); } @@ -317,9 +317,9 @@ namespace psemek::ui auto st = merged_style(); - float const header_height = std::max(lc[1].min + 2.f * (*st->border_width), bc[1].min); + float const header_height = std::max(lc[1].min + 2.f * (*st->inner_margin) + 2.f * (*st->border_width), bc[1].min); - r[0].min = std::max(r[0].min + 2.f * (*st->border_width), (*st->border_width) + lc[0].min + bc[0].min); + r[0].min = std::max(r[0].min + 2.f * (*st->inner_margin) + 2.f * (*st->border_width), (*st->border_width) + lc[0].min + bc[0].min); r[1] += (*st->border_width) * 1.f + header_height; return r; @@ -338,9 +338,11 @@ namespace psemek::ui p.draw_rect(bb + geom::cast(*st->shadow_offset), *st->shadow_color); p.draw_rect(bb, *st->border_color); - float const header_height = std::max(lc[1].min + 2.f * (*st->border_width), bc[1].min); + float const header_height = std::max(lc[1].min + 2.f * (*st->inner_margin) + 2.f * (*st->border_width), bc[1].min); p.draw_rect({{{bb[0].min + (*st->border_width), bb[0].max - bc[0].min}, {bb[1].min + (*st->border_width), bb[1].min + header_height - (*st->border_width)}}}, *st->fg_color); + p.draw_rect({{{bb[0].min + (*st->border_width), bb[0].max - (*st->border_width)}, {bb[1].min + header_height, bb[1].max - (*st->border_width)}}}, + *st->bg_color); } private: