diff options
author | Ira Rice <irarice@gmail.com> | 2009-01-26 12:18:23 -0700 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-01-26 12:18:23 -0700 |
commit | 63126a5dd5e6cf9acaf9b2114e8ac7213939d69f (patch) | |
tree | 9c85c85da7e970133637aeaf3a53edf4cca13a3f /src/gui | |
parent | a1d19e32e1206e406409ca68db6f344535e16519 (diff) | |
download | mana-63126a5dd5e6cf9acaf9b2114e8ac7213939d69f.tar.gz mana-63126a5dd5e6cf9acaf9b2114e8ac7213939d69f.tar.bz2 mana-63126a5dd5e6cf9acaf9b2114e8ac7213939d69f.tar.xz mana-63126a5dd5e6cf9acaf9b2114e8ac7213939d69f.zip |
Made minimaps resizeable.
Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/minimap.cpp | 17 | ||||
-rw-r--r-- | src/gui/window.h | 20 |
2 files changed, 33 insertions, 4 deletions
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 9292ec05..e52a20ac 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -41,6 +41,7 @@ Minimap::Minimap(): mProportion(0.5) { setWindowName(_("MiniMap")); + setResizable(true); } Minimap::~Minimap() @@ -63,11 +64,19 @@ void Minimap::setMapImage(Image *img) const int titleWidth = getFont()->getWidth(getCaption()) + 15; const int mapWidth = mMapImage->getWidth() < 100 ? mMapImage->getWidth() + offsetX : 100; + const int mapHeight = mMapImage->getHeight() < 100 ? + mMapImage->getHeight() + offsetY : 100; + + setMinWidth(mapWidth > titleWidth ? mapWidth : titleWidth); + setMinHeight(mapHeight); + setMaxWidth(mMapImage->getWidth() + offsetX); + setMaxHeight(mMapImage->getHeight() + offsetY); + mMapImage->setAlpha(config.getValue("guialpha", 0.8)); - setDefaultSize(offsetX, offsetY, - mapWidth > titleWidth ? mapWidth : titleWidth, - mMapImage->getHeight() < 100 ? - mMapImage->getHeight() + offsetY : 100); + setDefaultSize(offsetX, offsetY, getMinWidth() > getWidth() ? + getMinWidth() : getWidth(), + getMaxHeight() < getHeight() ? + getMaxHeight() : getHeight()); loadWindowState(); setVisible(mShow); } diff --git a/src/gui/window.h b/src/gui/window.h index 51b5186d..501ad160 100644 --- a/src/gui/window.h +++ b/src/gui/window.h @@ -130,6 +130,26 @@ class Window : public gcn::Window, gcn::WidgetListener void setMaxHeight(unsigned int height); /** + * Gets the minimum width of the window. + */ + int getMinWidth() { return mMinWinWidth; } + + /** + * Gets the minimum height of the window. + */ + int getMinHeight() { return mMinWinHeight; } + + /** + * Gets the maximum width of the window. + */ + int getMaxWidth() { return mMaxWinWidth; } + + /** + * Gets the minimum height of the window. + */ + int getMaxHeight() { return mMaxWinHeight; } + + /** * Sets flag to show a title or not. */ void setShowTitle(bool flag) |