summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/window.cpp24
-rw-r--r--src/gui/window.h6
2 files changed, 13 insertions, 17 deletions
diff --git a/src/gui/window.cpp b/src/gui/window.cpp
index 62daa9cd..eacb3d6d 100644
--- a/src/gui/window.cpp
+++ b/src/gui/window.cpp
@@ -46,8 +46,7 @@ Window::Window(const std::string& caption, bool modal, Window *parent):
// Load dialog title bar image
ResourceManager *resman = ResourceManager::getInstance();
- dBorders = resman->getImage("graphics/gui/vscroll_grey.png");
- dBackground = resman->getImage("graphics/gui/bg_quad_dis.png");
+ Image *dBorders = resman->getImage("graphics/gui/vscroll_grey.png");
border.grid[0] = dBorders->getSubImage(0, 0, 4, 4);
border.grid[1] = dBorders->getSubImage(4, 0, 3, 4);
@@ -59,6 +58,9 @@ Window::Window(const std::string& caption, bool modal, Window *parent):
border.grid[7] = dBorders->getSubImage(4, 15, 3, 4);
border.grid[8] = dBorders->getSubImage(7, 15, 4, 4);
+ dBorders->decRef();
+ dBorders = NULL;
+
// Add chrome
chrome = new gcn::Container();
chrome->setOpaque(false);
@@ -72,12 +74,8 @@ Window::Window(const std::string& caption, bool modal, Window *parent):
throw GCN_EXCEPTION("Window::Window. no windowContainer set");
}
- // Load GUI alpha setting
- guiAlpha = config.getValue("guialpha", 0.8f);
-
- // Set GUI alpha level
- dBackground->setAlpha(guiAlpha);
- dBorders->setAlpha(guiAlpha);
+ // Send GUI alpha changed for initialization
+ optionChanged("guialpha");
config.addListener("guialpha", this);
}
@@ -254,12 +252,14 @@ void Window::optionChanged(const std::string &name)
{
if (name == "guialpha")
{
- guiAlpha = config.getValue("guialpha", 0.8);
+ float guiAlpha = config.getValue("guialpha", 0.8);
- if (dBackground->getAlpha() != guiAlpha)
+ for (int i = 0; i < 9; i++)
{
- dBackground->setAlpha(guiAlpha);
- dBorders->setAlpha(guiAlpha);
+ if (border.grid[i]->getAlpha() != guiAlpha)
+ {
+ border.grid[i]->setAlpha(guiAlpha);
+ }
}
}
}
diff --git a/src/gui/window.h b/src/gui/window.h
index 4a0f08c3..5632a292 100644
--- a/src/gui/window.h
+++ b/src/gui/window.h
@@ -43,12 +43,8 @@ class Window : public gcn::Window, public ConfigListener
Window *parent; /**< The parent window */
int snapSize; /**< Snap distance to window edge */
bool modal; /**< Window is modal */
- float guiAlpha; /**< Opacity of GUI windows */
- Image *dBackground; /**< Left side of title bar */
- Image *dBorders; /**< Middle of title bar */
-
- ImageRect border; /**< The window border */
+ ImageRect border; /**< The window border and background */
bool resizeable; /**< Window can be resized */
int minWinWidth; /**< Minimum window width */