diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-06-18 23:35:58 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-06-18 23:39:07 +0300 |
commit | dc6771670569d2f296f4c12595966bbcb9aadf65 (patch) | |
tree | 92e0a21bd121c7abe43f22e1d25a8f17b6969214 /src/gui/widgets/vertcontainer.cpp | |
parent | 6a10bc8d7d186fd83099c75c2a03409d0881aae9 (diff) | |
download | plus-dc6771670569d2f296f4c12595966bbcb9aadf65.tar.gz plus-dc6771670569d2f296f4c12595966bbcb9aadf65.tar.bz2 plus-dc6771670569d2f296f4c12595966bbcb9aadf65.tar.xz plus-dc6771670569d2f296f4c12595966bbcb9aadf65.zip |
Start implimenting new setup pages.
Add new container for setup items. Imporved other containers.
Diffstat (limited to 'src/gui/widgets/vertcontainer.cpp')
-rw-r--r-- | src/gui/widgets/vertcontainer.cpp | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/src/gui/widgets/vertcontainer.cpp b/src/gui/widgets/vertcontainer.cpp index d4cf0a13f..6f94df535 100644 --- a/src/gui/widgets/vertcontainer.cpp +++ b/src/gui/widgets/vertcontainer.cpp @@ -23,23 +23,45 @@ #include "debug.h" -VertContainer::VertContainer(int spacing): - mSpacing(spacing), - mCount(0) +VertContainer::VertContainer(int verticalItemSize, bool resizable, + int leftSpacing): + mVerticalItemSize(verticalItemSize), + mCount(0), + mNextY(0), + mLeftSpacing(leftSpacing), + mVerticalSpacing(0), + mResizable(resizable) { addWidgetListener(this); } -void VertContainer::add(gcn::Widget *widget) +void VertContainer::add(gcn::Widget *widget, int spacing) +{ + add(widget, mResizable, spacing); +} + +void VertContainer::add(gcn::Widget *widget, bool resizable, int spacing) { if (!widget) return; Container::add(widget); - widget->setPosition(0, mCount * mSpacing); - widget->setSize(getWidth(), mSpacing); - mCount++; - setHeight(mCount * mSpacing); + widget->setPosition(mLeftSpacing, mNextY); + if (resizable) + { + widget->setSize(getWidth() - mLeftSpacing, mVerticalItemSize); + mResizableWidgets.push_back(widget); + } + else if (widget->getHeight() > mVerticalItemSize) + { + widget->setSize(widget->getWidth(), mVerticalItemSize); + } + + if (spacing == -1) + mNextY += mVerticalItemSize + (mVerticalSpacing * 2); + else + mNextY += mVerticalItemSize + (spacing * 2); + setHeight(mNextY); } void VertContainer::clear() @@ -51,6 +73,9 @@ void VertContainer::clear() void VertContainer::widgetResized(const gcn::Event &event _UNUSED_) { - for (WidgetListIterator it = mWidgets.begin(); it != mWidgets.end(); it++) + for (WidgetListIterator it = mResizableWidgets.begin(); + it != mResizableWidgets.end(); it++) + { (*it)->setWidth(getWidth()); + } } |