diff options
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/scrollarea.cpp | 54 | ||||
-rw-r--r-- | src/gui/widgets/scrollarea.h | 2 |
2 files changed, 23 insertions, 33 deletions
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index 6754b00c..8c88c2dc 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -24,7 +24,6 @@ #include "configuration.h" #include "graphics.h" -#include "gui/gui.h" #include "gui/skin.h" #include "resources/image.h" @@ -89,6 +88,11 @@ void ScrollArea::init() // Draw background by default setOpaque(true); + setUpButtonScrollAmount(2); + setDownButtonScrollAmount(2); + setLeftButtonScrollAmount(2); + setRightButtonScrollAmount(2); + if (instances == 0) { // Load the background skin @@ -160,18 +164,13 @@ void ScrollArea::init() resman->getImage("graphics/gui/hscroll_right_pressed.png"); } - mLastUpdate = tick_time; - instances++; } void ScrollArea::logic() { if (!isVisible()) - { - mLastUpdate = tick_time; return; - } gcn::ScrollArea::logic(); gcn::Widget *content = getContent(); @@ -192,32 +191,25 @@ void ScrollArea::logic() } } - const int updateTicks = get_elapsed_time(mLastUpdate) / 100; - - if (updateTicks > 0) + if (mUpButtonPressed) { - if (mUpButtonPressed) - { - setVerticalScrollAmount(getVerticalScrollAmount() - - mUpButtonScrollAmount); - } - else if (mDownButtonPressed) - { - setVerticalScrollAmount(getVerticalScrollAmount() + - mDownButtonScrollAmount); - } - else if (mLeftButtonPressed) - { - setHorizontalScrollAmount(getHorizontalScrollAmount() - - mLeftButtonScrollAmount); - } - else if (mRightButtonPressed) - { - setHorizontalScrollAmount(getHorizontalScrollAmount() + - mRightButtonScrollAmount); - } - - mLastUpdate = tick_time; + setVerticalScrollAmount(getVerticalScrollAmount() - + mUpButtonScrollAmount); + } + else if (mDownButtonPressed) + { + setVerticalScrollAmount(getVerticalScrollAmount() + + mDownButtonScrollAmount); + } + else if (mLeftButtonPressed) + { + setHorizontalScrollAmount(getHorizontalScrollAmount() - + mLeftButtonScrollAmount); + } + else if (mRightButtonPressed) + { + setHorizontalScrollAmount(getHorizontalScrollAmount() + + mRightButtonScrollAmount); } } diff --git a/src/gui/widgets/scrollarea.h b/src/gui/widgets/scrollarea.h index aa7b71a0..42e0923e 100644 --- a/src/gui/widgets/scrollarea.h +++ b/src/gui/widgets/scrollarea.h @@ -139,8 +139,6 @@ class ScrollArea : public gcn::ScrollArea, public gcn::WidgetListener int mX,mY; bool mHasMouse; bool mOpaque; - - int mLastUpdate; }; #endif |