From 7fb7b85b13b293cf0eea6bb95fc41b5e551e273e Mon Sep 17 00:00:00 2001 From: David Capello Date: Fri, 28 Aug 2015 15:48:19 -0300 Subject: [PATCH] Minor adjustments to ButtonSet style --- src/app/ui/button_set.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/app/ui/button_set.cpp b/src/app/ui/button_set.cpp index d47d0f89f..6949af5f1 100644 --- a/src/app/ui/button_set.cpp +++ b/src/app/ui/button_set.cpp @@ -78,7 +78,11 @@ void ButtonSet::Item::onPaint(ui::PaintEvent& ev) CENTER | (hasText() ? BOTTOM: MIDDLE), iconSize.w, iconSize.h); - if (m_icon) { + Grid::Info info = buttonSet()->getChildInfo(this); + bool isLastCol = (info.col+info.hspan >= info.grid_cols); + bool isLastRow = (info.row+info.vspan >= info.grid_rows); + + if (m_icon || isLastRow) { textRc.y -= 1*guiscale(); iconRc.y -= 1*guiscale(); } @@ -106,9 +110,10 @@ void ButtonSet::Item::onPaint(ui::PaintEvent& ev) bg = theme->colors.buttonNormalFace(); } - Grid::Info info = buttonSet()->getChildInfo(this); - if (info.col+info.hspan < info.grid_cols) rc.w += 1*guiscale(); - if (info.row+info.vspan < info.grid_rows) { + if (!isLastCol) + rc.w += 1*guiscale(); + + if (!isLastRow) { if (nw == theme->parts.toolbuttonHotFocused()) rc.h += 2*guiscale(); else @@ -206,8 +211,8 @@ void ButtonSet::Item::onPreferredSize(ui::PreferredSizeEvent& ev) gfx::Size iconSize; if (m_icon) { iconSize = m_icon->getSize(); - iconSize.w = MAX(iconSize.w+4*guiscale(), 16*guiscale()); - iconSize.h = MAX(iconSize.h+4*guiscale(), 16*guiscale()); + iconSize.w = MAX(iconSize.w, 16*guiscale()); + iconSize.h = MAX(iconSize.h, 16*guiscale()); } gfx::Rect boxRc;