summaryrefslogtreecommitdiff
path: root/src/gui/widgets/tab.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets/tab.cpp')
-rw-r--r--src/gui/widgets/tab.cpp34
1 files changed, 31 insertions, 3 deletions
diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp
index 6a2b05cd4..78165dc18 100644
--- a/src/gui/widgets/tab.cpp
+++ b/src/gui/widgets/tab.cpp
@@ -25,6 +25,7 @@
#include "client.h"
#include "configuration.h"
#include "graphics.h"
+#include "graphicsvertexes.h"
#include "log.h"
#include "gui/palette.h"
@@ -68,7 +69,10 @@ static TabData const data[TAB_COUNT] =
ImageRect Tab::tabImg[TAB_COUNT];
Tab::Tab() : gcn::Tab(),
- mTabColor(&Theme::getThemeColor(Theme::TAB))
+ mTabColor(&Theme::getThemeColor(Theme::TAB)),
+ mVertexes(new GraphicsVertexes()),
+ mRedraw(true),
+ mMode(0)
{
init();
}
@@ -82,6 +86,8 @@ Tab::~Tab()
for (int mode = 0; mode < TAB_COUNT; mode++)
for_each(tabImg[mode].grid, tabImg[mode].grid + 9, dtor<Image*>());
}
+ delete mVertexes;
+ mVertexes = 0;
}
void Tab::init()
@@ -90,6 +96,8 @@ void Tab::init()
setFrameSize(0);
mFlash = 0;
+ addWidgetListener(this);
+
if (mInstances == 0)
{
// Load the skin
@@ -179,8 +187,18 @@ void Tab::draw(gcn::Graphics *graphics)
updateAlpha();
// draw tab
- static_cast<Graphics*>(graphics)->
- drawImageRect(0, 0, getWidth(), getHeight(), tabImg[mode]);
+ if (mRedraw || mode != mMode)
+ {
+ mMode = mode;
+ mRedraw = false;
+ static_cast<Graphics*>(graphics)->calcWindow(mVertexes, 0, 0, getWidth(),
+ getHeight(), tabImg[mode]);
+ }
+
+ static_cast<Graphics*>(graphics)->drawImageRect2(mVertexes, tabImg[mode]);
+
+// static_cast<Graphics*>(graphics)->
+// drawImageRect(0, 0, getWidth(), getHeight(), tabImg[mode]);
// draw label
drawChildren(graphics);
@@ -195,3 +213,13 @@ void Tab::setFlash(int flash)
{
mFlash = flash;
}
+
+void Tab::widgetResized(const gcn::Event &event _UNUSED_)
+{
+ mRedraw = true;
+}
+
+void Tab::widgetMoved(const gcn::Event &event _UNUSED_)
+{
+ mRedraw = true;
+}