summaryrefslogtreecommitdiff
path: root/src/gui/scrollarea.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2006-07-30 14:33:28 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2006-07-30 14:33:28 +0000
commitaff167beefadc32add4b44626cc2f1cbef800c7b (patch)
tree43796105cc107ec55742e88562e064d8031d3b23 /src/gui/scrollarea.cpp
parent18b73fdadd715d356416a95c31a25b3293fa2596 (diff)
downloadmana-aff167beefadc32add4b44626cc2f1cbef800c7b.tar.gz
mana-aff167beefadc32add4b44626cc2f1cbef800c7b.tar.bz2
mana-aff167beefadc32add4b44626cc2f1cbef800c7b.tar.xz
mana-aff167beefadc32add4b44626cc2f1cbef800c7b.zip
Updated TMW to be compatible with Guichan 0.5.0 (merged from guichan-0.5.0
branch).
Diffstat (limited to 'src/gui/scrollarea.cpp')
-rw-r--r--src/gui/scrollarea.cpp37
1 files changed, 20 insertions, 17 deletions
diff --git a/src/gui/scrollarea.cpp b/src/gui/scrollarea.cpp
index 3703ead8..18a1dfb4 100644
--- a/src/gui/scrollarea.cpp
+++ b/src/gui/scrollarea.cpp
@@ -55,7 +55,7 @@ ScrollArea::~ScrollArea()
{
// Garbage collection
if (mGC) {
- delete mContent;
+ delete getContent();
}
instances--;
@@ -144,20 +144,21 @@ void ScrollArea::init()
void ScrollArea::logic()
{
gcn::ScrollArea::logic();
+ gcn::Widget *content = getContent();
// When no scrollbar in a certain direction, adapt content size to match
// the content dimension exactly.
- if (mContent != NULL)
+ if (content != NULL)
{
if (getHorizontalScrollPolicy() == gcn::ScrollArea::SHOW_NEVER)
{
- mContent->setWidth(getContentDimension().width -
- 2 * mContent->getBorderSize());
+ content->setWidth(getChildrenArea().width -
+ 2 * content->getBorderSize());
}
if (getVerticalScrollPolicy() == gcn::ScrollArea::SHOW_NEVER)
{
- mContent->setHeight(getContentDimension().height -
- 2 * mContent->getBorderSize());
+ content->setHeight(getChildrenArea().height -
+ 2 * content->getBorderSize());
}
}
}
@@ -197,24 +198,26 @@ void ScrollArea::draw(gcn::Graphics *graphics)
mScrollbarWidth));
}
- if (mContent)
+ gcn::Widget *content = getContent();
+
+ if (content != NULL)
{
- graphics->pushClipArea(getContentDimension());
+ graphics->pushClipArea(getChildrenArea());
- if (mContent->getBorderSize() > 0)
+ if (content->getBorderSize() > 0)
{
- gcn::Rectangle rec = mContent->getDimension();
- rec.x -= mContent->getBorderSize();
- rec.y -= mContent->getBorderSize();
- rec.width += 2 * mContent->getBorderSize();
- rec.height += 2 * mContent->getBorderSize();
+ gcn::Rectangle rec = content->getDimension();
+ rec.x -= content->getBorderSize();
+ rec.y -= content->getBorderSize();
+ rec.width += 2 * content->getBorderSize();
+ rec.height += 2 * content->getBorderSize();
graphics->pushClipArea(rec);
- mContent->drawBorder(graphics);
+ content->drawBorder(graphics);
graphics->popClipArea();
}
- graphics->pushClipArea(mContent->getDimension());
- mContent->draw(graphics);
+ graphics->pushClipArea(content->getDimension());
+ content->draw(graphics);
graphics->popClipArea();
graphics->popClipArea();
}