diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-05-08 01:03:20 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-05-08 01:03:20 +0300 |
commit | bfab477aead2b4376e9caa193dca2c62c2ff26f9 (patch) | |
tree | e0fe0fb39d0ad476d7109ecafb452de05c0a1566 /src | |
parent | 9e65d853ef4cbebb9899dabe0233ad83a0b9e97a (diff) | |
download | manaverse-bfab477aead2b4376e9caa193dca2c62c2ff26f9.tar.gz manaverse-bfab477aead2b4376e9caa193dca2c62c2ff26f9.tar.bz2 manaverse-bfab477aead2b4376e9caa193dca2c62c2ff26f9.tar.xz manaverse-bfab477aead2b4376e9caa193dca2c62c2ff26f9.zip |
Add titlepadding option to theme file.
Now used only in shortcuts window without title bar.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/shortcutwindow.cpp | 11 | ||||
-rw-r--r-- | src/gui/theme.cpp | 13 | ||||
-rw-r--r-- | src/gui/theme.h | 6 | ||||
-rw-r--r-- | src/gui/widgets/window.h | 3 |
4 files changed, 26 insertions, 7 deletions
diff --git a/src/gui/shortcutwindow.cpp b/src/gui/shortcutwindow.cpp index 0e968efef..4d7443037 100644 --- a/src/gui/shortcutwindow.cpp +++ b/src/gui/shortcutwindow.cpp @@ -26,6 +26,7 @@ #include "logger.h" #include "gui/setup.h" +#include "gui/theme.h" #include "gui/widgets/layout.h" #include "gui/widgets/scrollarea.h" @@ -59,7 +60,15 @@ ShortcutWindow::ShortcutWindow(const std::string &title, { setWindowName(title); // no title presented, title bar is padding so window can be moved. - gcn::Window::setTitleBarHeight(gcn::Window::getPadding() + 1); + if (mSkin) + { + gcn::Window::setTitleBarHeight(gcn::Window::getPadding() + + mSkin->getTitlePadding()); + } + else + { + gcn::Window::setTitleBarHeight(gcn::Window::getPadding()); + } setShowTitle(false); setResizable(true); setDefaultVisible(false); diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 4112a702f..311863f41 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -65,7 +65,7 @@ static void initDefaultThemePath() Skin::Skin(ImageRect skin, Image *close, Image *stickyUp, Image *stickyDown, const std::string &filePath, - const std::string &name, int padding): + const std::string &name, int padding, int titlePadding): instances(0), mFilePath(filePath), mName(name), @@ -73,8 +73,10 @@ Skin::Skin(ImageRect skin, Image *close, Image *stickyUp, Image *stickyDown, mCloseImage(close), mStickyImageUp(stickyUp), mStickyImageDown(stickyDown), - mPadding(padding) -{} + mPadding(padding), + mTitlePadding(titlePadding) +{ +} Skin::~Skin() { @@ -337,6 +339,7 @@ Skin *Theme::readSkin(const std::string &filename) ImageRect border; memset(&border, 0, sizeof(ImageRect)); int padding = 3; + int titlePadding = 4; // iterate <widget>'s for_each_xml_child_node(widgetNode, rootNode) @@ -485,6 +488,8 @@ Skin *Theme::readSkin(const std::string &filename) partNode, "name", ""); if (name == "padding") padding = XML::getProperty(partNode, "value", 3); + else if (name == "titlePadding") + titlePadding = XML::getProperty(partNode, "value", 4); } } } @@ -514,7 +519,7 @@ Skin *Theme::readSkin(const std::string &filename) } Skin *skin = new Skin(border, closeImage, stickyImageUp, stickyImageDown, - filename, "", padding); + filename, "", padding, titlePadding); skin->updateAlpha(mMinimumOpacity); return skin; } diff --git a/src/gui/theme.h b/src/gui/theme.h index c547e5351..8c5675454 100644 --- a/src/gui/theme.h +++ b/src/gui/theme.h @@ -44,7 +44,7 @@ class Skin public: Skin(ImageRect skin, Image *close, Image *stickyUp, Image *stickyDown, const std::string &filePath, const std::string &name = "", - int padding = 3); + int padding = 3, int titlePadding = 4); ~Skin(); @@ -98,6 +98,9 @@ class Skin int getPadding() const { return mPadding; } + int getTitlePadding() const + { return mTitlePadding; } + int instances; private: @@ -108,6 +111,7 @@ class Skin Image *mStickyImageUp; /**< Sticky Button Image */ Image *mStickyImageDown; /**< Sticky Button Image */ int mPadding; + int mTitlePadding; }; class Theme : public Palette, public ConfigListener diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index 6fa47dedc..13883980e 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -403,6 +403,8 @@ class Window : public gcn::Window, gcn::WidgetListener protected: bool canMove(); + Skin *mSkin; /**< Skin in use by this window */ + private: enum ResizeHandles { @@ -452,7 +454,6 @@ class Window : public gcn::Window, gcn::WidgetListener static int mouseResize; /**< Active resize handles */ static int instances; /**< Number of Window instances */ - Skin *mSkin; /**< Skin in use by this window */ /** * The width of the resize border. Is independent of the actual window |