aboutsummaryrefslogtreecommitdiff
path: root/engines/wage/macwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/wage/macwindow.cpp')
-rw-r--r--engines/wage/macwindow.cpp43
1 files changed, 21 insertions, 22 deletions
diff --git a/engines/wage/macwindow.cpp b/engines/wage/macwindow.cpp
index 36b27a3e56..8903936061 100644
--- a/engines/wage/macwindow.cpp
+++ b/engines/wage/macwindow.cpp
@@ -45,16 +45,17 @@
*
*/
+#include "graphics/font.h"
#include "graphics/primitives.h"
#include "common/events.h"
-#include "wage/wage.h"
-#include "wage/gui.h"
#include "wage/macwindow.h"
+#include "wage/macwindowmanager.h"
namespace Wage {
-BaseMacWindow::BaseMacWindow(int id) : _id(id) {
+BaseMacWindow::BaseMacWindow(int id, bool editable, MacWindowManager *wm) :
+ _id(id), _editable(editable), _wm(wm) {
_callback = 0;
_dataPtr = 0;
@@ -63,8 +64,8 @@ BaseMacWindow::BaseMacWindow(int id) : _id(id) {
_type = kWindowUnknown;
}
-MacWindow::MacWindow(int id, bool scrollable, bool resizable) :
- BaseMacWindow(id), _scrollable(scrollable), _resizable(resizable) {
+MacWindow::MacWindow(int id, bool scrollable, bool resizable, bool editable, MacWindowManager *wm) :
+ BaseMacWindow(id, editable, wm), _scrollable(scrollable), _resizable(resizable) {
_active = false;
_borderIsDirty = true;
@@ -75,12 +76,18 @@ MacWindow::MacWindow(int id, bool scrollable, bool resizable) :
_beingDragged = false;
_beingResized = false;
+ _draggedX = _draggedY = 0;
+
_type = kWindowWindow;
}
MacWindow::~MacWindow() {
}
+const Graphics::Font *MacWindow::getTitleFont() {
+ return _wm->getFont("Chicago-12", Graphics::FontManager::kBigGUIFont);
+}
+
void MacWindow::setActive(bool active) {
if (active == _active)
return;
@@ -145,14 +152,6 @@ bool MacWindow::draw(Graphics::ManagedSurface *g, bool forceRedraw) {
return true;
}
-const Graphics::Font *MacWindow::getTitleFont() {
- return ((WageEngine *)g_engine)->_gui->getFont("Chicago-12", Graphics::FontManager::kBigGUIFont);
-}
-
-bool MacWindow::builtInFonts() {
- return ((WageEngine *)g_engine)->_gui->builtInFonts();
-}
-
#define ARROW_W 12
#define ARROW_H 6
const int arrowPixels[ARROW_H][ARROW_W] = {
@@ -205,11 +204,11 @@ void MacWindow::drawBorder() {
drawBox(g, x + width - size + 1, y + size, size - 4, height - 2 * size - 1);
if (active) {
- fillRect(g, x + size, y + 5, width - 2 * size - 1, 8);
- fillRect(g, x + size, y + height - 13, width - 2 * size - 1, 8);
- fillRect(g, x + 5, y + size, 8, height - 2 * size - 1);
+ fillRect(g, x + size, y + 5, width - 2 * size - 1, 8, kColorBlack);
+ fillRect(g, x + size, y + height - 13, width - 2 * size - 1, 8, kColorBlack);
+ fillRect(g, x + 5, y + size, 8, height - 2 * size - 1, kColorBlack);
if (!scrollable) {
- fillRect(g, x + width - 13, y + size, 8, height - 2 * size - 1);
+ fillRect(g, x + width - 13, y + size, 8, height - 2 * size - 1, kColorBlack);
} else {
int x1 = x + width - 15;
int y1 = y + size + 1;
@@ -219,7 +218,7 @@ void MacWindow::drawBorder() {
g->hLine(x1 + xx, y1 + yy, x1 + xx, (arrowPixels[yy][xx] != 0 ? kColorBlack : kColorWhite));
}
- fillRect(g, x + width - 13, y + size + ARROW_H, 8, height - 2 * size - 1 - ARROW_H * 2);
+ fillRect(g, x + width - 13, y + size + ARROW_H, 8, height - 2 * size - 1 - ARROW_H * 2, kColorBlack);
y1 += height - 2 * size - ARROW_H - 2;
for (int yy = 0; yy < ARROW_H; yy++) {
@@ -239,7 +238,7 @@ void MacWindow::drawBorder() {
}
if (closeable) {
if (_highlightedPart == kBorderCloseButton) {
- fillRect(g, x + 6, y + 6, 6, 6);
+ fillRect(g, x + 6, y + 6, 6, 6, kColorBlack);
} else {
drawBox(g, x + 5, y + 5, 7, 7);
}
@@ -248,7 +247,7 @@ void MacWindow::drawBorder() {
if (drawTitle) {
const Graphics::Font *font = getTitleFont();
- int yOff = builtInFonts() ? 3 : 1;
+ int yOff = _wm->hasBuiltInFonts() ? 3 : 1;
int w = font->getStringWidth(_title) + 10;
int maxWidth = width - size * 2 - 7;
@@ -329,7 +328,7 @@ bool MacWindow::processEvent(Common::Event &event) {
_draggedX = event.mouse.x;
_draggedY = event.mouse.y;
- ((WageEngine *)g_engine)->_gui->_wm.setFullRefresh(true);
+ _wm->setFullRefresh(true);
}
if (_beingResized) {
@@ -339,7 +338,7 @@ bool MacWindow::processEvent(Common::Event &event) {
_draggedX = event.mouse.x;
_draggedY = event.mouse.y;
- ((WageEngine *)g_engine)->_gui->_wm.setFullRefresh(true);
+ _wm->setFullRefresh(true);
(*_callback)(click, event, _dataPtr);
}
break;