summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-09-05 22:12:03 +0300
committerAndrei Karas <akaras@inbox.ru>2012-09-05 22:12:03 +0300
commit22ed653d8b630c813333d5c73a4ca02dede2a5a5 (patch)
treea8cffab510c989ffc7603be52a6e75d7fcb5cd87 /src/gui
parent6fee84f3838bdd900e8cfc4a1e4d7f15f35bd6ed (diff)
downloadmanaverse-22ed653d8b630c813333d5c73a4ca02dede2a5a5.tar.gz
manaverse-22ed653d8b630c813333d5c73a4ca02dede2a5a5.tar.bz2
manaverse-22ed653d8b630c813333d5c73a4ca02dede2a5a5.tar.xz
manaverse-22ed653d8b630c813333d5c73a4ca02dede2a5a5.zip
Add theme attribute for close button padding.
Attribute name: closePadding Default value: 3 pixels.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/theme.cpp7
-rw-r--r--src/gui/widgets/window.cpp12
2 files changed, 14 insertions, 5 deletions
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp
index 26f250c4c..26d1e7402 100644
--- a/src/gui/theme.cpp
+++ b/src/gui/theme.cpp
@@ -431,6 +431,7 @@ Skin *Theme::readSkin(const std::string &filename, const bool full)
memset(&images, 0, sizeof(ImageRect));
int padding = 3;
int titlePadding = 4;
+ int closePadding = 3;
std::map<std::string, int> *const mOptions
= new std::map<std::string, int>();
@@ -483,6 +484,10 @@ Skin *Theme::readSkin(const std::string &filename, const bool full)
{
titlePadding = XML::getProperty(partNode, "value", 4);
}
+ else if (name == "closePadding")
+ {
+ closePadding = XML::getProperty(partNode, "value", 3);
+ }
else
{
(*mOptions)[name] = XML::getProperty(
@@ -501,6 +506,8 @@ Skin *Theme::readSkin(const std::string &filename, const bool full)
if (dBorders)
dBorders->decRef();
+ (*mOptions)["closePadding"] = closePadding;
+
Skin *const skin = new Skin(border, images, filename, "", padding,
titlePadding, mOptions);
skin->updateAlpha(mMinimumOpacity);
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index e08908c7a..2a417c633 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -187,12 +187,14 @@ void Window::draw(gcn::Graphics *graphics)
static_cast<gcn::Graphics::Alignment>(mCaptionAlign));
}
+ int closePadding = getOption("closePadding");
+
// Draw Close Button
if (mCloseButton && mSkin->getCloseImage())
{
const Image *const button = mSkin->getCloseImage();
- const int x = getWidth() - button->getWidth() - getPadding();
- g->drawImage(button, x, getPadding());
+ const int x = getWidth() - button->getWidth() - closePadding;
+ g->drawImage(button, x, closePadding);
}
// Draw Sticky Button
@@ -201,11 +203,11 @@ void Window::draw(gcn::Graphics *graphics)
const Image *const button = mSkin->getStickyImage(mSticky);
if (button)
{
- int x = getWidth() - button->getWidth() - getPadding();
+ int x = getWidth() - button->getWidth() - closePadding;
if (mCloseButton && mSkin->getCloseImage())
- x -= mSkin->getCloseImage()->getWidth() + getPadding();
+ x -= mSkin->getCloseImage()->getWidth() + closePadding;
- g->drawImage(button, x, getPadding());
+ g->drawImage(button, x, closePadding);
}
}