diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-02-10 19:36:26 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-02-10 19:36:26 +0300 |
commit | 6781809c3ae40507d86573f06c296706eff60e9a (patch) | |
tree | 41df178b61963c54e283fff6c14ef8c6a68ee740 /src/gui/widgets/scrollarea.cpp | |
parent | f6482585eb8d9fd514b38dd214d83acd3985dc76 (diff) | |
download | mv-6781809c3ae40507d86573f06c296706eff60e9a.tar.gz mv-6781809c3ae40507d86573f06c296706eff60e9a.tar.bz2 mv-6781809c3ae40507d86573f06c296706eff60e9a.tar.xz mv-6781809c3ae40507d86573f06c296706eff60e9a.zip |
Add option to scrollbuttons.xml to show/hide scrollbar buttons.
New theme option:
showbuttons - show or hide scrollbar buttons. Default is 1 (show).
Diffstat (limited to 'src/gui/widgets/scrollarea.cpp')
-rw-r--r-- | src/gui/widgets/scrollarea.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index cfc9a8938..4e3404aa8 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -167,7 +167,8 @@ void ScrollArea::init(std::string skinName) rect.grid[f]->incRef(); buttons[f][i] = rect.grid[f]; } - mShowButtons = (skin->getOption("showbuttons", 1) == 1); + if (i == 0) + mShowButtons = (skin->getOption("showbuttons", 1) == 1); } else { @@ -821,19 +822,19 @@ gcn::Rectangle ScrollArea::getVerticalBarDimension() const if (!mVBarVisible) return gcn::Rectangle(0, 0, 0, 0); - const int height = mVBarVisible ? mScrollbarWidth : 0; + const int height = (mVBarVisible && mShowButtons) ? mScrollbarWidth : 0; if (mHBarVisible) { return gcn::Rectangle(mDimension.width - mScrollbarWidth, height, mScrollbarWidth, - mDimension.height - height - height - mScrollbarWidth); + mDimension.height - 2 * height - mScrollbarWidth); } return gcn::Rectangle(mDimension.width - mScrollbarWidth, height, mScrollbarWidth, - mDimension.height - height - height); + mDimension.height - 2 * height); } gcn::Rectangle ScrollArea::getHorizontalBarDimension() const @@ -841,18 +842,18 @@ gcn::Rectangle ScrollArea::getHorizontalBarDimension() const if (!mHBarVisible) return gcn::Rectangle(0, 0, 0, 0); - const int width = mHBarVisible ? mScrollbarWidth : 0; + const int width = (mHBarVisible && mShowButtons) ? mScrollbarWidth : 0; if (mVBarVisible) { return gcn::Rectangle(width, mDimension.height - mScrollbarWidth, - mDimension.width - width - width - mScrollbarWidth, + mDimension.width - 2 * width - mScrollbarWidth, mScrollbarWidth); } return gcn::Rectangle(width, mDimension.height - mScrollbarWidth, - mDimension.width - width - width, + mDimension.width - 2 * width, mScrollbarWidth); } @@ -863,7 +864,7 @@ gcn::Rectangle ScrollArea::getVerticalMarkerDimension() int length, pos; int height; - const int h2 = mVBarVisible ? mScrollbarWidth : 0; + const int h2 = (mVBarVisible && mShowButtons) ? mScrollbarWidth : 0; const gcn::Widget *content; if (!mWidgets.empty()) content = *mWidgets.begin(); @@ -912,7 +913,7 @@ gcn::Rectangle ScrollArea::getHorizontalMarkerDimension() int length, pos; int width; - const int w2 = mHBarVisible ? mScrollbarWidth : 0; + const int w2 = (mHBarVisible && mShowButtons) ? mScrollbarWidth : 0; const gcn::Widget *content; if (!mWidgets.empty()) content = *mWidgets.begin(); @@ -956,7 +957,7 @@ gcn::Rectangle ScrollArea::getHorizontalMarkerDimension() gcn::Rectangle ScrollArea::getUpButtonDimension() const { - if (!mVBarVisible) + if (!mVBarVisible || !mShowButtons) return gcn::Rectangle(0, 0, 0, 0); return gcn::Rectangle(mDimension.width - mScrollbarWidth, 0, @@ -965,7 +966,7 @@ gcn::Rectangle ScrollArea::getUpButtonDimension() const gcn::Rectangle ScrollArea::getDownButtonDimension() const { - if (!mVBarVisible) + if (!mVBarVisible || !mShowButtons) return gcn::Rectangle(0, 0, 0, 0); if (mVBarVisible && mHBarVisible) @@ -984,7 +985,7 @@ gcn::Rectangle ScrollArea::getDownButtonDimension() const gcn::Rectangle ScrollArea::getLeftButtonDimension() const { - if (!mHBarVisible) + if (!mHBarVisible || !mShowButtons) return gcn::Rectangle(0, 0, 0, 0); return gcn::Rectangle(0, mDimension.height - mScrollbarWidth, @@ -993,7 +994,7 @@ gcn::Rectangle ScrollArea::getLeftButtonDimension() const gcn::Rectangle ScrollArea::getRightButtonDimension() const { - if (!mHBarVisible) + if (!mHBarVisible || !mShowButtons) return gcn::Rectangle(0, 0, 0, 0); if (mVBarVisible && mHBarVisible) |