summaryrefslogtreecommitdiff
path: root/shutdown
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2014-05-16 05:38:47 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2014-05-16 05:38:47 +0200
commit5f9f0894639610d1354ba6802cca95d29f44e42b (patch)
tree49f59e88390928d85c7d05d341e24ea0616f0657 /shutdown
parentef9777f49971a4f17112d452f675d854e3937ebc (diff)
SessionView: add some padding if we only can show one button
(bzr r3806.11.5)
Diffstat (limited to 'shutdown')
-rw-r--r--shutdown/SessionView.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/shutdown/SessionView.cpp b/shutdown/SessionView.cpp
index 2a22595ad..749333c99 100644
--- a/shutdown/SessionView.cpp
+++ b/shutdown/SessionView.cpp
@@ -115,9 +115,18 @@ void View::UpdateViewSize()
ReloadCloseButtonTexture();
buttons_layout_->SetSpaceBetweenChildren(style::BUTTONS_SPACE.CP(scale()));
+ auto const& buttons = buttons_layout_->GetChildren();
- for (auto* area : buttons_layout_->GetChildren())
+ for (auto* area : buttons)
static_cast<Button*>(area)->scale = scale();
+
+ if (buttons.size() == 1)
+ {
+ auto* button = buttons.front();
+ button->ComputeContentSize();
+ int padding = button->GetWidth()/2 + style::MAIN_SPACE.CP(scale())/2;
+ buttons_layout_->SetLeftAndRightPadding(padding, padding);
+ }
}
void View::UpdateText()
@@ -202,6 +211,7 @@ void View::PopulateButtons()
{
debug::Introspectable::RemoveAllChildren();
buttons_layout_->Clear();
+ buttons_layout_->SetLeftAndRightPadding(0, 0);
key_focus_area_ = this;
if (mode() == Mode::LOGOUT)