summaryrefslogtreecommitdiff
path: root/src/gui/widgets/scrollarea.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-06-14 15:39:43 +0300
committerAndrei Karas <akaras@inbox.ru>2013-06-14 15:39:43 +0300
commitb21d07cdcaa227f439e705feeb618948458163bc (patch)
treeacb0239b6329cb26ba17f7b9ee3846fb2e858e3e /src/gui/widgets/scrollarea.cpp
parent34a5f3077937317febd9fa3fc2dc6f2a2473521c (diff)
downloadmanaverse-b21d07cdcaa227f439e705feeb618948458163bc.tar.gz
manaverse-b21d07cdcaa227f439e705feeb618948458163bc.tar.bz2
manaverse-b21d07cdcaa227f439e705feeb618948458163bc.tar.xz
manaverse-b21d07cdcaa227f439e705feeb618948458163bc.zip
improve scrollarea.
Diffstat (limited to 'src/gui/widgets/scrollarea.cpp')
-rw-r--r--src/gui/widgets/scrollarea.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp
index 69b1f6d8e..76d883216 100644
--- a/src/gui/widgets/scrollarea.cpp
+++ b/src/gui/widgets/scrollarea.cpp
@@ -55,15 +55,15 @@ ScrollArea::ScrollArea(const bool opaque, const std::string &skin) :
mY(0),
mClickX(0),
mClickY(0),
- mHasMouse(false),
- mOpaque(opaque),
mVertexes(new ImageCollection),
mVertexes2(new ImageCollection),
- mRedraw(true),
mXOffset(0),
mYOffset(0),
mDrawWidth(0),
- mDrawHeight(0)
+ mDrawHeight(0),
+ mHasMouse(false),
+ mOpaque(opaque),
+ mRedraw(true)
{
addWidgetListener(this);
init(skin);
@@ -77,15 +77,15 @@ ScrollArea::ScrollArea(gcn::Widget *const widget, const bool opaque,
mY(0),
mClickX(0),
mClickY(0),
- mHasMouse(false),
- mOpaque(opaque),
mVertexes(new ImageCollection),
mVertexes2(new ImageCollection),
- mRedraw(true),
mXOffset(0),
mYOffset(0),
mDrawWidth(0),
- mDrawHeight(0)
+ mDrawHeight(0),
+ mHasMouse(false),
+ mOpaque(opaque),
+ mRedraw(true)
{
init(skin);
}
@@ -356,9 +356,9 @@ void ScrollArea::drawFrame(gcn::Graphics *graphics)
BLOCK_START("ScrollArea::drawFrame")
if (mOpaque)
{
- const int bs = mFrameSize;
- const int w = mDimension.width + bs * 2;
- const int h = mDimension.height + bs * 2;
+ const int bs = mFrameSize * 2;
+ const int w = mDimension.width + bs;
+ const int h = mDimension.height + bs;
updateCalcFlag(graphics);
@@ -671,13 +671,13 @@ void ScrollArea::mousePressed(gcn::MouseEvent& event)
}
else if (getLeftButtonDimension().isPointInRect(x, y))
{
- setHorizontalScrollAmount(getHorizontalScrollAmount()
+ setHorizontalScrollAmount(mHScroll
- mLeftButtonScrollAmount);
mLeftButtonPressed = true;
}
else if (getRightButtonDimension().isPointInRect(x, y))
{
- setHorizontalScrollAmount(getHorizontalScrollAmount()
+ setHorizontalScrollAmount(mHScroll
+ mRightButtonScrollAmount);
mRightButtonPressed = true;
}
@@ -712,12 +712,12 @@ void ScrollArea::mousePressed(gcn::MouseEvent& event)
{
if (x < getHorizontalMarkerDimension().x)
{
- setHorizontalScrollAmount(getHorizontalScrollAmount()
+ setHorizontalScrollAmount(mHScroll
- static_cast<int>(getChildrenArea().width * 0.95));
}
else
{
- setHorizontalScrollAmount(getHorizontalScrollAmount()
+ setHorizontalScrollAmount(mHScroll
+ static_cast<int>(getChildrenArea().width * 0.95));
}
}
@@ -952,7 +952,7 @@ gcn::Rectangle ScrollArea::getHorizontalMarkerDimension()
const int maxH = getHorizontalMaxScroll();
if (mMarkerSize && maxH)
{
- pos = (getHorizontalScrollAmount() * width / maxH - mMarkerSize / 2);
+ pos = (mHScroll * width / maxH - mMarkerSize / 2);
length = mMarkerSize;
}
else
@@ -978,7 +978,7 @@ gcn::Rectangle ScrollArea::getHorizontalMarkerDimension()
if (getHorizontalMaxScroll() != 0)
{
- pos = ((width - length) * getHorizontalScrollAmount())
+ pos = ((width - length) * mHScroll)
/ getHorizontalMaxScroll();
}
else