summaryrefslogtreecommitdiff
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
parent34a5f3077937317febd9fa3fc2dc6f2a2473521c (diff)
downloadplus-b21d07cdcaa227f439e705feeb618948458163bc.tar.gz
plus-b21d07cdcaa227f439e705feeb618948458163bc.tar.bz2
plus-b21d07cdcaa227f439e705feeb618948458163bc.tar.xz
plus-b21d07cdcaa227f439e705feeb618948458163bc.zip
improve scrollarea.
-rw-r--r--src/gui/widgets/scrollarea.cpp34
-rw-r--r--src/gui/widgets/scrollarea.h8
2 files changed, 21 insertions, 21 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
diff --git a/src/gui/widgets/scrollarea.h b/src/gui/widgets/scrollarea.h
index 6455d1af8..d488a7422 100644
--- a/src/gui/widgets/scrollarea.h
+++ b/src/gui/widgets/scrollarea.h
@@ -120,7 +120,7 @@ class ScrollArea final : public gcn::ScrollArea,
void mouseReleased(gcn::MouseEvent& event) override;
- void mouseDragged(gcn::MouseEvent &event);
+ void mouseDragged(gcn::MouseEvent &event) override;
void widgetResized(const gcn::Event &event) override;
@@ -185,15 +185,15 @@ class ScrollArea final : public gcn::ScrollArea,
int mX, mY;
int mClickX, mClickY;
- bool mHasMouse;
- bool mOpaque;
ImageCollection *mVertexes;
ImageCollection *mVertexes2;
- bool mRedraw;
int mXOffset;
int mYOffset;
int mDrawWidth;
int mDrawHeight;
+ bool mHasMouse;
+ bool mOpaque;
+ bool mRedraw;
};
#endif // GUI_WIDGETS_SCROLLAREA_H