summaryrefslogtreecommitdiff
path: root/src/guichan
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-10-11 14:48:19 +0300
committerAndrei Karas <akaras@inbox.ru>2013-10-11 15:24:57 +0300
commitf1b82c1b06604c2c1eed750a6c980aa0b5355560 (patch)
tree3e524583691af0e5a17e5ee974439b4c6ea07ef4 /src/guichan
parent452f2489bf3225235797ea08ea0d466f80409a87 (diff)
downloadmv-f1b82c1b06604c2c1eed750a6c980aa0b5355560.tar.gz
mv-f1b82c1b06604c2c1eed750a6c980aa0b5355560.tar.bz2
mv-f1b82c1b06604c2c1eed750a6c980aa0b5355560.tar.xz
mv-f1b82c1b06604c2c1eed750a6c980aa0b5355560.zip
First part of checks from Parasoft C++ Test.
Diffstat (limited to 'src/guichan')
-rw-r--r--src/guichan/widgets/scrollarea.cpp57
1 files changed, 31 insertions, 26 deletions
diff --git a/src/guichan/widgets/scrollarea.cpp b/src/guichan/widgets/scrollarea.cpp
index 6874e41c9..324afece8 100644
--- a/src/guichan/widgets/scrollarea.cpp
+++ b/src/guichan/widgets/scrollarea.cpp
@@ -244,11 +244,12 @@ namespace gcn
{
checkPolicies();
- if (!getContent())
+ const Widget *const content = getContent();
+ if (!content)
return 0;
- const int value = getContent()->getWidth() - getChildrenArea().width +
- 2 * getContent()->getFrameSize();
+ const int value = content->getWidth() - getChildrenArea().width +
+ 2 * content->getFrameSize();
if (value < 0)
return 0;
@@ -260,13 +261,14 @@ namespace gcn
{
checkPolicies();
- if (!getContent())
+ const Widget *const content = getContent();
+ if (!content)
return 0;
int value;
- value = getContent()->getHeight() - getChildrenArea().height +
- 2 * getContent()->getFrameSize();
+ value = content->getHeight() - getChildrenArea().height +
+ 2 * content->getFrameSize();
if (value < 0)
return 0;
@@ -347,11 +349,12 @@ namespace gcn
setVerticalScrollAmount(getVerticalScrollAmount());
setHorizontalScrollAmount(getHorizontalScrollAmount());
- if (getContent())
+ Widget *const content = getContent();
+ if (content)
{
- getContent()->setPosition(-mHScroll + getContent()->getFrameSize(),
- -mVScroll + getContent()->getFrameSize());
- getContent()->logic();
+ const int frameSize = content->getFrameSize();
+ content->setPosition(-mHScroll + frameSize, -mVScroll + frameSize);
+ content->logic();
}
BLOCK_END("ScrollArea::logic")
}
@@ -364,7 +367,8 @@ namespace gcn
mHBarVisible = false;
mVBarVisible = false;
- if (!getContent())
+ const Widget *const content = getContent();
+ if (!content)
{
mHBarVisible = (mHPolicy == SHOW_ALWAYS);
mVBarVisible = (mVPolicy == SHOW_ALWAYS);
@@ -374,26 +378,26 @@ namespace gcn
if (mHPolicy == SHOW_AUTO &&
mVPolicy == SHOW_AUTO)
{
- if (getContent()->getWidth() <= w
- && getContent()->getHeight() <= h)
+ if (content->getWidth() <= w
+ && content->getHeight() <= h)
{
mHBarVisible = false;
mVBarVisible = false;
}
- if (getContent()->getWidth() > w)
+ if (content->getWidth() > w)
{
mHBarVisible = true;
}
- if ((getContent()->getHeight() > h)
- || (mHBarVisible && getContent()->getHeight()
+ if ((content->getHeight() > h)
+ || (mHBarVisible && content->getHeight()
> h - mScrollbarWidth))
{
mVBarVisible = true;
}
- if (mVBarVisible && getContent()->getWidth() > w - mScrollbarWidth)
+ if (mVBarVisible && content->getWidth() > w - mScrollbarWidth)
mHBarVisible = true;
return;
@@ -412,11 +416,11 @@ namespace gcn
case SHOW_AUTO:
if (mVPolicy == SHOW_NEVER)
{
- mHBarVisible = (getContent()->getWidth() > w);
+ mHBarVisible = (content->getWidth() > w);
}
else // (mVPolicy == SHOW_ALWAYS)
{
- mHBarVisible = (getContent()->getWidth()
+ mHBarVisible = (content->getWidth()
> w - mScrollbarWidth);
}
break;
@@ -438,11 +442,11 @@ namespace gcn
case SHOW_AUTO:
if (mHPolicy == SHOW_NEVER)
{
- mVBarVisible = (getContent()->getHeight() > h);
+ mVBarVisible = (content->getHeight() > h);
}
else // (mHPolicy == SHOW_ALWAYS)
{
- mVBarVisible = (getContent()->getHeight()
+ mVBarVisible = (content->getHeight()
> h - mScrollbarWidth);
}
break;
@@ -465,15 +469,16 @@ namespace gcn
void ScrollArea::showWidgetPart(Widget* widget, Rectangle area)
{
- if (widget != getContent())
+ const Widget *const content = getContent();
+ if (widget != content)
throw GCN_EXCEPTION("Widget not content widget");
BasicContainer::showWidgetPart(widget, area);
- setHorizontalScrollAmount(getContent()->getFrameSize()
- - getContent()->getX());
- setVerticalScrollAmount(getContent()->getFrameSize()
- - getContent()->getY());
+ setHorizontalScrollAmount(content->getFrameSize()
+ - content->getX());
+ setVerticalScrollAmount(content->getFrameSize()
+ - content->getY());
}
Widget *ScrollArea::getWidgetAt(int x, int y)