summaryrefslogtreecommitdiff
path: root/src/gui/scrollarea.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2006-08-13 10:20:19 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2006-08-13 10:20:19 +0000
commitd3385829ca6f7d52e21706b25b14fe1083cfe984 (patch)
treeaea368b2434a49864b33183f95b6aae36abef3b7 /src/gui/scrollarea.cpp
parent7d287027babe615e01ddcf20edc1057f7d778c58 (diff)
downloadmana-d3385829ca6f7d52e21706b25b14fe1083cfe984.tar.gz
mana-d3385829ca6f7d52e21706b25b14fe1083cfe984.tar.bz2
mana-d3385829ca6f7d52e21706b25b14fe1083cfe984.tar.xz
mana-d3385829ca6f7d52e21706b25b14fe1083cfe984.zip
Merged Guichan 0.5.0 support from guichan-0.5.0 branch, plus several updates
from the 0.1.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();
}