summaryrefslogtreecommitdiff
path: root/src/gui/widgets/shortcutcontainer.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-12-01 21:37:21 +0300
committerAndrei Karas <akaras@inbox.ru>2012-12-01 22:58:18 +0300
commit70da0bae8b4f11bf4d2fcf12c2f1aa770fe1d4d1 (patch)
treefb619fed916b20de36ad97aa9c633110f8681193 /src/gui/widgets/shortcutcontainer.cpp
parent96007521ba20250db0ed05e4d6117077690637db (diff)
downloadmv-70da0bae8b4f11bf4d2fcf12c2f1aa770fe1d4d1.tar.gz
mv-70da0bae8b4f11bf4d2fcf12c2f1aa770fe1d4d1.tar.bz2
mv-70da0bae8b4f11bf4d2fcf12c2f1aa770fe1d4d1.tar.xz
mv-70da0bae8b4f11bf4d2fcf12c2f1aa770fe1d4d1.zip
Add batch drawing to shortcuts windows.
Diffstat (limited to 'src/gui/widgets/shortcutcontainer.cpp')
-rw-r--r--src/gui/widgets/shortcutcontainer.cpp41
1 files changed, 40 insertions, 1 deletions
diff --git a/src/gui/widgets/shortcutcontainer.cpp b/src/gui/widgets/shortcutcontainer.cpp
index ba3ad3325..245ec90b5 100644
--- a/src/gui/widgets/shortcutcontainer.cpp
+++ b/src/gui/widgets/shortcutcontainer.cpp
@@ -23,6 +23,7 @@
#include "gui/widgets/shortcutcontainer.h"
#include "configuration.h"
+#include "graphicsvertexes.h"
#include "resources/image.h"
@@ -42,7 +43,9 @@ ShortcutContainer::ShortcutContainer() :
mCursorPosX(0),
mCursorPosY(0),
mGridWidth(1),
- mGridHeight(1)
+ mGridHeight(1),
+ mVertexes(new ImageCollection),
+ mRedraw(true)
{
}
@@ -59,6 +62,7 @@ void ShortcutContainer::widgetResized(const gcn::Event &event A_UNUSED)
++mGridHeight;
setHeight(mGridHeight * mBoxHeight);
+ mRedraw = true;
}
int ShortcutContainer::getIndexFromGrid(const int pointX,
@@ -77,3 +81,38 @@ int ShortcutContainer::getIndexFromGrid(const int pointX,
return index;
}
+
+void ShortcutContainer::drawBackground(Graphics *g)
+{
+ if (mBackgroundImg)
+ {
+ if (openGLMode != 2)
+ {
+ if (mRedraw)
+ {
+ mRedraw = false;
+ mVertexes->clear();
+ for (unsigned i = 0; i < mMaxItems; i ++)
+ {
+ g->calcTile(mVertexes, mBackgroundImg,
+ (i % mGridWidth) * mBoxWidth,
+ (i / mGridWidth) * mBoxHeight);
+ }
+ }
+ g->drawTile(mVertexes);
+ }
+ else
+ {
+ for (unsigned i = 0; i < mMaxItems; i ++)
+ {
+ g->drawImage(mBackgroundImg, (i % mGridWidth) * mBoxWidth,
+ (i / mGridWidth) * mBoxHeight);
+ }
+ }
+ }
+}
+
+void ShortcutContainer::widgetMoved(const gcn::Event& event)
+{
+ mRedraw = true;
+}