summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-02-28 22:33:42 +0300
committerAndrei Karas <akaras@inbox.ru>2012-02-28 22:33:42 +0300
commit16a5f224128acde7343c53c636ff53e7983ef754 (patch)
tree37f03ebcb523a52fa87f31ba7d9c36529571a059 /src
parentbbf5743dd18e78298376da6f78c71ae2a524c766 (diff)
downloadmanaplus-16a5f224128acde7343c53c636ff53e7983ef754.tar.gz
manaplus-16a5f224128acde7343c53c636ff53e7983ef754.tar.bz2
manaplus-16a5f224128acde7343c53c636ff53e7983ef754.tar.xz
manaplus-16a5f224128acde7343c53c636ff53e7983ef754.zip
Adjust label size in setupitem controls.
Diffstat (limited to 'src')
-rw-r--r--src/gui/setup_visual.cpp2
-rw-r--r--src/gui/widgets/setupitem.cpp12
-rw-r--r--src/gui/widgets/setupitem.h2
-rw-r--r--src/gui/widgets/setuptabscroll.cpp7
-rw-r--r--src/gui/widgets/setuptabscroll.h4
5 files changed, 22 insertions, 5 deletions
diff --git a/src/gui/setup_visual.cpp b/src/gui/setup_visual.cpp
index f7a083498..55e219bd7 100644
--- a/src/gui/setup_visual.cpp
+++ b/src/gui/setup_visual.cpp
@@ -39,6 +39,8 @@ Setup_Visual::Setup_Visual()
ContainerPlacer place = h.getPlacer(0, 0);
place(0, 0, mScroll, 10, 10);
+ mPreferredFirstItemSize = 150;
+
new SetupItemCheckBox(_("Show pickup notifications in chat"), "",
"showpickupchat", this, "showpickupchatEvent");
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);
diff --git a/src/gui/widgets/setupitem.h b/src/gui/widgets/setupitem.h
index 38dec929e..86fdf95f9 100644
--- a/src/gui/widgets/setupitem.h
+++ b/src/gui/widgets/setupitem.h
@@ -97,6 +97,8 @@ class SetupItem : public gcn::ActionListener
bool isMainConfig() const
{ return mMainConfig; }
+ void fixFirstItemSize(gcn::Widget *widget);
+
protected:
std::string mText;
diff --git a/src/gui/widgets/setuptabscroll.cpp b/src/gui/widgets/setuptabscroll.cpp
index 34cc993a9..f3f8b1526 100644
--- a/src/gui/widgets/setuptabscroll.cpp
+++ b/src/gui/widgets/setuptabscroll.cpp
@@ -28,17 +28,14 @@
#include "debug.h"
SetupTabScroll::SetupTabScroll() :
- SetupTab()
+ SetupTab(),
+ mPreferredFirstItemSize(200)
{
mContainer = new VertContainer(25, false, 8);
mScroll = new ScrollArea(mContainer);
mScroll->setOpaque(false);
mScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
mScroll->setVerticalScrollPolicy(ScrollArea::SHOW_AUTO);
-
-// LayoutHelper h(this);
-// ContainerPlacer place = h.getPlacer(0, 0);
-// place(0, 0, mScroll, 10, 10);
}
SetupTabScroll::~SetupTabScroll()
diff --git a/src/gui/widgets/setuptabscroll.h b/src/gui/widgets/setuptabscroll.h
index d471ecfbc..e7151769e 100644
--- a/src/gui/widgets/setuptabscroll.h
+++ b/src/gui/widgets/setuptabscroll.h
@@ -55,11 +55,15 @@ class SetupTabScroll : public SetupTab
virtual void action(const gcn::ActionEvent &event A_UNUSED)
{ }
+ int getPreferredFirstItemSize()
+ { return mPreferredFirstItemSize; }
+
protected:
VertContainer *mContainer;
ScrollArea *mScroll;
std::map<std::string, SetupItem*> mItems;
std::set<SetupItem*> mAllItems;
+ int mPreferredFirstItemSize;
};
#endif