summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-08-08 22:25:38 +0300
committerAndrei Karas <akaras@inbox.ru>2012-08-08 22:26:45 +0300
commit79cc92118f7029de7b47caa0cd29b13823e3a3ec (patch)
tree8e95c364d56739221d205c64e5d11cd1cdc097de /src/gui/widgets
parent1319e54e6a7dab30ce2f95b0301964c53afe9e58 (diff)
downloadmanaplus-79cc92118f7029de7b47caa0cd29b13823e3a3ec.tar.gz
manaplus-79cc92118f7029de7b47caa0cd29b13823e3a3ec.tar.bz2
manaplus-79cc92118f7029de7b47caa0cd29b13823e3a3ec.tar.xz
manaplus-79cc92118f7029de7b47caa0cd29b13823e3a3ec.zip
Add theme options for caption offset and align.
Options: captionoffsetx captionoffsety captionallign
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/window.cpp20
-rw-r--r--src/gui/widgets/window.h3
2 files changed, 22 insertions, 1 deletions
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index 685d64155..8dae70fe2 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -66,6 +66,9 @@ Window::Window(const std::string &caption, bool modal, Window *parent,
mMaxWinWidth(mainGraphics->mWidth),
mMaxWinHeight(mainGraphics->mHeight),
mVertexes(new GraphicsVertexes()),
+ mCaptionOffsetX(7),
+ mCaptionOffsetY(5),
+ mCaptionAlign(gcn::Graphics::LEFT),
mRedraw(true)
{
logger->log("Window::Window(\"%s\")", caption.c_str());
@@ -87,7 +90,21 @@ Window::Window(const std::string &caption, bool modal, Window *parent,
{
mSkin = Theme::instance()->load(skin, "window.xml");
if (mSkin)
+ {
setPadding(mSkin->getPadding());
+ mCaptionOffsetX = getOption("captionoffsetx");
+ if (!mCaptionOffsetX)
+ mCaptionOffsetX = 7;
+ mCaptionOffsetY = getOption("captionoffsety");
+ if (!mCaptionOffsetY)
+ mCaptionOffsetY = 5;
+ mCaptionAlign = getOption("captionallign");
+ if (mCaptionAlign < gcn::Graphics::LEFT
+ || mCaptionAlign > gcn::Graphics::RIGHT)
+ {
+ mCaptionAlign = gcn::Graphics::LEFT;
+ }
+ }
}
else
{
@@ -167,7 +184,8 @@ void Window::draw(gcn::Graphics *graphics)
{
g->setColor(getForegroundColor());
g->setFont(mCaptionFont);
- g->drawText(getCaption(), 7, 5, gcn::Graphics::LEFT);
+ g->drawText(getCaption(), mCaptionOffsetX, mCaptionOffsetY,
+ static_cast<gcn::Graphics::Alignment>(mCaptionAlign));
}
// Draw Close Button
diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h
index 00e3a817f..a006b3995 100644
--- a/src/gui/widgets/window.h
+++ b/src/gui/widgets/window.h
@@ -467,6 +467,9 @@ class Window : public gcn::Window, gcn::WidgetListener
*/
static const unsigned resizeBorderWidth = 10;
GraphicsVertexes *mVertexes;
+ int mCaptionOffsetX;
+ int mCaptionOffsetY;
+ int mCaptionAlign;
bool mRedraw;
gcn::Font *mCaptionFont;
};