summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/widgets/window.cpp90
-rw-r--r--src/gui/widgets/window.h5
2 files changed, 67 insertions, 28 deletions
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index ecf8f0f99..ba6d982c8 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -70,13 +70,14 @@ Window::Window(const std::string &caption, const bool modal,
mMinWinHeight(40),
mMaxWinWidth(mainGraphics->mWidth),
mMaxWinHeight(mainGraphics->mHeight),
- mVertexes(new GraphicsVertexes()),
+ mVertexes(new ImageCollection),
mCaptionOffsetX(7),
mCaptionOffsetY(5),
mCaptionAlign(gcn::Graphics::LEFT),
mTitlePadding(4),
mGripPadding(2),
mResizeHandles(-1),
+ mOldResizeHandles(-1),
mRedraw(true),
mPlayVisibleSound(false),
mCaptionFont(getFont())
@@ -190,15 +191,71 @@ void Window::draw(gcn::Graphics *graphics)
Graphics *const g = static_cast<Graphics*>(graphics);
bool update = false;
- if (mRedraw)
+ if (openGLMode != 2)
{
- mRedraw = false;
- update = true;
- g->calcWindow(mVertexes, 0, 0, mDimension.width,
- mDimension.height, mSkin->getBorder());
+ if (mResizeHandles != mOldResizeHandles)
+ {
+ mRedraw = true;
+ mOldResizeHandles = mResizeHandles;
+ }
+ if (mRedraw)
+ {
+ mRedraw = false;
+ update = true;
+ mVertexes->clear();
+ g->calcWindow(mVertexes, 0, 0, mDimension.width,
+ mDimension.height, mSkin->getBorder());
+
+ // Draw Close Button
+ if (mCloseButton)
+ {
+ const Image *const button = mSkin->getCloseImage(
+ mResizeHandles == CLOSE);
+ if (button)
+ g->calcTile(mVertexes, button, mCloseRect.x, mCloseRect.y);
+ }
+ // Draw Sticky Button
+ if (mStickyButton)
+ {
+ const Image *const button = mSkin->getStickyImage(mSticky);
+ if (button)
+ {
+ g->calcTile(mVertexes, button,
+ mStickyRect.x, mStickyRect.y);
+ }
+ }
+
+ if (mGrip)
+ g->calcTile(mVertexes, mGrip, mGripRect.x, mGripRect.y);
+
+ }
+
+ g->drawTile(mVertexes);
}
+ else
+ {
+ g->drawImageRect(0, 0, mDimension.width,
+ mDimension.height, mSkin->getBorder());
+
+ // Draw Close Button
+ if (mCloseButton)
+ {
+ const Image *const button = mSkin->getCloseImage(
+ mResizeHandles == CLOSE);
+ if (button)
+ g->drawImage(button, mCloseRect.x, mCloseRect.y);
+ }
+ // Draw Sticky Button
+ if (mStickyButton)
+ {
+ const Image *const button = mSkin->getStickyImage(mSticky);
+ if (button)
+ g->drawImage(button, mStickyRect.x, mStickyRect.y);
+ }
- g->drawImageRect2(mVertexes, mSkin->getBorder());
+ if (mGrip)
+ g->drawImage(mGrip, mGripRect.x, mGripRect.y);
+ }
// Draw title
if (mShowTitle)
@@ -209,25 +266,6 @@ void Window::draw(gcn::Graphics *graphics)
static_cast<gcn::Graphics::Alignment>(mCaptionAlign));
}
- // Draw Close Button
- if (mCloseButton)
- {
- const Image *const button = mSkin->getCloseImage(
- mResizeHandles == CLOSE);
- if (button)
- g->drawImage(button, mCloseRect.x, mCloseRect.y);
- }
- // Draw Sticky Button
- if (mStickyButton)
- {
- const Image *const button = mSkin->getStickyImage(mSticky);
- if (button)
- g->drawImage(button, mStickyRect.x, mStickyRect.y);
- }
-
- if (mGrip)
- g->drawImage(mGrip, mGripRect.x, mGripRect.y);
-
if (update)
{
g->setRedraw(update);
diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h
index 2f70bf763..7b05c65f6 100644
--- a/src/gui/widgets/window.h
+++ b/src/gui/widgets/window.h
@@ -33,7 +33,7 @@
#include <guichan/widgets/window.hpp>
class ContainerPlacer;
-class GraphicsVertexes;
+class ImageCollection;
class Layout;
class LayoutCell;
class ResizeGrip;
@@ -490,13 +490,14 @@ class Window : public gcn::Window,
* where two borders are moved at the same time.
*/
static const unsigned resizeBorderWidth = 10;
- GraphicsVertexes *mVertexes;
+ ImageCollection *mVertexes;
int mCaptionOffsetX;
int mCaptionOffsetY;
int mCaptionAlign;
int mTitlePadding;
int mGripPadding;
int mResizeHandles;
+ int mOldResizeHandles;
bool mRedraw;
bool mPlayVisibleSound;
gcn::Font *mCaptionFont;