aboutsummaryrefslogtreecommitdiff
path: root/graphics/macgui
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/macgui')
-rw-r--r--graphics/macgui/macwindow.cpp38
-rw-r--r--graphics/macgui/macwindow.h10
2 files changed, 24 insertions, 24 deletions
diff --git a/graphics/macgui/macwindow.cpp b/graphics/macgui/macwindow.cpp
index 55319569e9..4dacf23e11 100644
--- a/graphics/macgui/macwindow.cpp
+++ b/graphics/macgui/macwindow.cpp
@@ -64,7 +64,7 @@ BaseMacWindow::BaseMacWindow(int id, bool editable, MacWindowManager *wm) :
}
MacWindow::MacWindow(int id, bool scrollable, bool resizable, bool editable, MacWindowManager *wm) :
- BaseMacWindow(id, editable, wm), _scrollable(scrollable), _resizable(resizable) {
+ BaseMacWindow(id, editable, wm), _scrollable(scrollable), _resizable(resizable), _bmp(new TransparentSurface(), false) {
_active = false;
_borderIsDirty = true;
@@ -78,6 +78,9 @@ MacWindow::MacWindow(int id, bool scrollable, bool resizable, bool editable, Mac
_draggedX = _draggedY = 0;
_type = kWindowWindow;
+
+ TransparentSurface *srf = new TransparentSurface;
+ _bmp = NinePatchBitmap(srf, false);
}
MacWindow::~MacWindow() {
@@ -142,18 +145,23 @@ bool MacWindow::draw(ManagedSurface *g, bool forceRedraw) {
_contentIsDirty = false;
- TransparentSurface tr;
- _bmp->blit(tr, 0, 0, _borderSurface.w, _borderSurface.h);
-
+
// Compose
_composeSurface.blitFrom(_surface, Common::Rect(0, 0, _surface.w - 2, _surface.h - 2), Common::Point(2, 2));
- _composeSurface.transBlitFrom(tr, kColorGreen);
+ _composeSurface.transBlitFrom(_borderSurface, kColorGreen);
g->transBlitFrom(_composeSurface, _composeSurface.getBounds(), Common::Point(_dims.left - 2, _dims.top - 2), kColorGreen2);
return true;
}
+bool MacWindow::drawTR(Surface &g, int x, int y, int w, int h, bool forceRedraw) {
+
+ _bmp.blit(g, x, y, w, h);
+
+ return false;
+}
+
#define ARROW_W 12
#define ARROW_H 6
const int arrowPixels[ARROW_H][ARROW_W] = {
@@ -259,21 +267,7 @@ void MacWindow::drawBorder() {
w = maxWidth;
drawBox(g, x + (width - w) / 2, y, w, size);
font->drawString(g, _title, x + (width - w) / 2 + 5, y + yOff, w, kColorBlack);
- }
-
- initBorders(g);
-}
-
-void MacWindow::initBorders(ManagedSurface *source) {
- TransparentSurface *tr = new TransparentSurface();
- tr->create(source->w, source->h, PixelFormat::createFormatCLUT8());
-
- // Fill with alpha so that _check_pixel will go through
- tr->drawThickLine(0, tr->h / 2, tr->w, tr->h/2, 1, tr->h/2, Graphics::ALPHA_FULL);
- // Show that something can be drawn
- tr->drawLine(1, 1, tr->w - 2, tr->h - 2, kColorBlack);
-
- _bmp = new NinePatchBitmap(tr, false);
+ }
}
void MacWindow::setHighlight(WindowClick highlightedPart) {
@@ -293,6 +287,10 @@ void MacWindow::setHighlight(WindowClick highlightedPart) {
_borderIsDirty = true;
}
+ void MacWindow::setBorders(TransparentSurface *source) {
+ _bmp = NinePatchBitmap(source, true);
+ }
+
void MacWindow::drawBox(ManagedSurface *g, int x, int y, int w, int h) {
Common::Rect r(x, y, x + w + 1, y + h + 1);
diff --git a/graphics/macgui/macwindow.h b/graphics/macgui/macwindow.h
index 908eab84b4..dbbaff2d1e 100644
--- a/graphics/macgui/macwindow.h
+++ b/graphics/macgui/macwindow.h
@@ -51,6 +51,7 @@
#include "graphics/managed_surface.h"
#include "graphics/transparent_surface.h"
#include "graphics/nine_patch.h"
+#include "graphics/palette.h"
namespace Graphics {
@@ -126,6 +127,7 @@ public:
const Common::Rect &getInnerDimensions() { return _innerDims; }
bool draw(ManagedSurface *g, bool forceRedraw = false);
+ bool drawTR(Surface &g, int x, int y, int w, int h, bool forceRedraw);
void setActive(bool active);
void setTitle(Common::String &title) { _title = title; }
@@ -134,21 +136,21 @@ public:
bool processEvent(Common::Event &event);
bool hasAllFocus() { return _beingDragged || _beingResized; }
+ void setBorders(TransparentSurface *source);
+
private:
void drawBorder();
void drawBox(ManagedSurface *g, int x, int y, int w, int h);
void fillRect(ManagedSurface *g, int x, int y, int w, int h, int color);
const Font *getTitleFont();
void updateInnerDims();
- WindowClick isInBorder(int x, int y);
-
- void initBorders(ManagedSurface *tr);
+ WindowClick isInBorder(int x, int y);
private:
ManagedSurface _borderSurface;
ManagedSurface _composeSurface;
- NinePatchBitmap *_bmp;
+ NinePatchBitmap _bmp;
bool _scrollable;
bool _resizable;