From 16a5f224128acde7343c53c636ff53e7983ef754 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 28 Feb 2012 22:33:42 +0300 Subject: Adjust label size in setupitem controls. --- src/gui/widgets/setupitem.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/gui/widgets/setupitem.cpp') diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index b3a018813..93854e823 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -171,6 +171,12 @@ void SetupItem::externalUpdated(std::string eventName A_UNUSED) toWidget(); } +void SetupItem::fixFirstItemSize(gcn::Widget *widget) +{ + if (widget->getWidth() < mParent->getPreferredFirstItemSize()) + widget->setWidth(mParent->getPreferredFirstItemSize()); +} + SetupItemCheckBox::SetupItemCheckBox(std::string text, std::string description, std::string keyName, SetupTabScroll *parent, @@ -279,6 +285,7 @@ void SetupItemTextField::createControls() mButton = new Button(_("Edit"), mEventName + "_EDIT", mParent); mWidget = mTextField; mTextField->setWidth(200); + fixFirstItemSize(mLabel); mHorizont->add(mLabel); mHorizont->add(mTextField); mHorizont->add(mButton); @@ -402,6 +409,7 @@ void SetupItemIntTextField::createControls() mButton = new Button(_("Edit"), mEventName + "_EDIT", mParent); mWidget = mTextField; mTextField->setWidth(50); + fixFirstItemSize(mLabel); mHorizont->add(mLabel); mHorizont->add(mTextField); mHorizont->add(mButton); @@ -572,6 +580,7 @@ void SetupItemDropDown::createControls() mWidget = mDropDown; // mTextField->setWidth(50); + fixFirstItemSize(mLabel); mHorizont->add(mLabel); mHorizont->add(mDropDown); @@ -656,6 +665,7 @@ void SetupItemSlider::createControls() mWidget = mSlider; mSlider->setWidth(mWidth); mSlider->setHeight(40); + fixFirstItemSize(mLabel); mHorizont->add(mLabel); mHorizont->add(mSlider, -10); @@ -767,6 +777,7 @@ void SetupItemSlider2::createControls() mWidget = mSlider; mSlider->setWidth(150); mSlider->setHeight(40); + fixFirstItemSize(mLabel); mHorizont->add(mLabel); mHorizont->add(mSlider, -10); mHorizont->add(mLabel2); @@ -917,6 +928,7 @@ void SetupItemSliderList::createControls() mSlider->adjustSize(); mWidget = mSlider; + fixFirstItemSize(mLabel); mHorizont->add(mLabel, 5); mHorizont->add(mSlider); -- cgit v1.2.3-70-g09d2