diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2004-12-19 12:41:27 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2004-12-19 12:41:27 +0000 |
commit | 86e10f867bc0531cdc2007524aa7757d7d594e7d (patch) | |
tree | 0e37ad5c038ca930d6a8beba557427b9ad34de8b /src/gui/window.cpp | |
parent | 129040251c8242bd4b56f4fc6b107017d62bca3c (diff) | |
download | mana-86e10f867bc0531cdc2007524aa7757d7d594e7d.tar.gz mana-86e10f867bc0531cdc2007524aa7757d7d594e7d.tar.bz2 mana-86e10f867bc0531cdc2007524aa7757d7d594e7d.tar.xz mana-86e10f867bc0531cdc2007524aa7757d7d594e7d.zip |
More refining of windows.
Diffstat (limited to 'src/gui/window.cpp')
-rw-r--r-- | src/gui/window.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/gui/window.cpp b/src/gui/window.cpp index a75dd242..eb886538 100644 --- a/src/gui/window.cpp +++ b/src/gui/window.cpp @@ -23,7 +23,7 @@ #include "gui.h" #include <guichan/allegro.hpp> -Window::Window(std::string text) : +Window::Window(gcn::Container *parent, std::string text) : caption(text), mousePX(0), mousePY(0), @@ -31,9 +31,9 @@ Window::Window(std::string text) : mouseDown(false), titlebarHeight(20) { - titlebarColor.r = 32; - titlebarColor.g = 32; - titlebarColor.b = 128; + titlebarColor.r = 203; + titlebarColor.g = 203; + titlebarColor.b = 203; setBaseColor(gcn::Color(255, 255, 255)); @@ -50,6 +50,9 @@ Window::Window(std::string text) : chrome->setOpaque(false); chrome->setY(titlebarHeight); gcn::Container::add(chrome); + + // Add this window to the parent container + parent->add(this); } Window::~Window() @@ -72,6 +75,10 @@ void Window::draw(gcn::Graphics* graphics) getDimension().height - titlebarHeight)); } + // Draw line around window + graphics->setColor(titlebarColor); + graphics->drawRectangle(gcn::Rectangle(0, titlebarHeight - 1, + getWidth(), getHeight() - titlebarHeight + 1)); // Skinned dialog render if (typeid(*graphics) == typeid(gcn::AllegroGraphics)) @@ -95,7 +102,7 @@ void Window::draw(gcn::Graphics* graphics) // Plain title bar graphics->setColor(titlebarColor); graphics->fillRectangle(gcn::Rectangle(0, 0, - getDimension().width, titlebarHeight)); + getWidth(), titlebarHeight)); } // Draw title @@ -173,7 +180,6 @@ void Window::mouseRelease(int mx, int my, int button) mouseDown = false; } -//window move void Window::mouseMotion(int mx, int my) { if (mouseDown) @@ -186,17 +192,17 @@ void Window::mouseMotion(int mx, int my) x = x - (mousePX - mx); y = y - (mousePY - my); - //keep guichan window inside window + // Keep guichan window inside window if (x < 0) x = 0; if (y < 0) y = 0; if (x + winWidth > 799) x = 799 - winWidth; - if (y + winWidth > 599) + if (y + winHeight > 599) y = 599 - winHeight; - //snap window to edges + // Snap window to edges if (x < snapSize) x = 0; if (y < snapSize) |