diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | src/gui/scrollarea.cpp | 12 | ||||
-rw-r--r-- | src/gui/scrollarea.h | 12 |
3 files changed, 29 insertions, 0 deletions
@@ -1,5 +1,10 @@ 2008-04-27 Dennis Friis <peavey@placid.dk> + * src/gui/scrollarea.h, src/gui/scrollarea.cpp: Add methods to get + width and height adjusted for any visible scrollbars. + +2008-04-27 Dennis Friis <peavey@placid.dk> + * src/gui/inventorywindow.cpp: Fix ItemContainer not being resized properly when resizing inventory window. diff --git a/src/gui/scrollarea.cpp b/src/gui/scrollarea.cpp index 255aa2d8..21f37510 100644 --- a/src/gui/scrollarea.cpp +++ b/src/gui/scrollarea.cpp @@ -296,3 +296,15 @@ void ScrollArea::drawHMarker(gcn::Graphics *graphics) static_cast<Graphics*>(graphics)-> drawImageRect(dim.x, dim.y, dim.width, dim.height, vMarker); } + +int ScrollArea::getAdjustedWidth() const +{ + return ScrollArea::getDimension().width - + (mVBarVisible ? ScrollArea::getScrollbarWidth() : 0); +} + +int ScrollArea::getAdjustedHeight() const +{ + return ScrollArea::getDimension().height - + (mHBarVisible ? ScrollArea::getScrollbarWidth() : 0); +} diff --git a/src/gui/scrollarea.h b/src/gui/scrollarea.h index be361f68..c714bf1f 100644 --- a/src/gui/scrollarea.h +++ b/src/gui/scrollarea.h @@ -78,6 +78,18 @@ class ScrollArea : public gcn::ScrollArea */ bool isOpaque() const { return mOpaque; } + /** + * Return the width of the scrollarea adjusting for visible + * vertical scrollbar. + */ + int getAdjustedWidth() const; + + /** + * Return the height of the scrollarea adjusting for visible + * horizontal scrollbar. + */ + int getAdjustedHeight() const; + protected: enum BUTTON_DIR { UP, |