aboutsummaryrefslogtreecommitdiff
path: root/engines/wage/macwindow.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2016-04-18 20:02:53 +0200
committerEugene Sandulenko2016-04-19 09:35:50 +0200
commit609dd56b136db3e0bdfc7906bdc386403e4a1192 (patch)
tree4fc910501f766d5e0839fd037c17fd7789fe5c5e /engines/wage/macwindow.cpp
parent73733594c1536194a314597c596cd123294bb9fc (diff)
downloadscummvm-rg350-609dd56b136db3e0bdfc7906bdc386403e4a1192.tar.gz
scummvm-rg350-609dd56b136db3e0bdfc7906bdc386403e4a1192.tar.bz2
scummvm-rg350-609dd56b136db3e0bdfc7906bdc386403e4a1192.zip
WAGE: Further work on WindowManager
Diffstat (limited to 'engines/wage/macwindow.cpp')
-rw-r--r--engines/wage/macwindow.cpp46
1 files changed, 45 insertions, 1 deletions
diff --git a/engines/wage/macwindow.cpp b/engines/wage/macwindow.cpp
index e517b7230b..490ab9e886 100644
--- a/engines/wage/macwindow.cpp
+++ b/engines/wage/macwindow.cpp
@@ -90,11 +90,15 @@ void MacWindow::resize(int w, int h) {
void MacWindow::move(int x, int y) {
_dims.moveTo(x, y);
+
+ _innerDims.setWidth(0); // Invalidate rect
}
void MacWindow::setDimensions(const Common::Rect &r) {
resize(r.width(), r.height());
_dims.moveTo(r.left, r.top);
+
+ _innerDims.setWidth(0); // Invalidate rect
}
bool MacWindow::draw(Graphics::ManagedSurface *g, bool forceRedraw) {
@@ -144,6 +148,11 @@ static void drawPixelInverted(int x, int y, int color, void *data) {
void MacWindow::drawBorder() {
_borderIsDirty = false;
+ if (_innerDims.isEmpty()) {
+ _innerDims = _dims;
+ _innerDims.grow(-kBorderWidth);
+ }
+
bool active = _active, scrollable = _scrollable, closeable = _active, drawTitle = !_title.empty();
const int size = kBorderWidth;
int x = 0;
@@ -235,8 +244,43 @@ void MacWindow::fillRect(Graphics::ManagedSurface *g, int x, int y, int w, int h
g->fillRect(r, color);
}
-WindowClick MacWindow::mouseDown(int x, int y) {
+static WindowClick isInBorder(Common::Rect &rect, int x, int y) {
+ if (x >= rect.left - kBorderWidth && x < rect.left && y >= rect.top - kBorderWidth && y < rect.top)
+ return kBorderCloseButton;
+
+ if (x >= rect.right && x < rect.right + kBorderWidth) {
+ if (y < rect.top - kBorderWidth)
+ return kBorderNone;
+
+ if (y >= rect.bottom + kBorderWidth)
+ return kBorderNone;
+
+ if (y >= rect.top + rect.height() / 2)
+ return kBorderScrollDown;
+
+ return kBorderScrollUp;
+ }
+
return kBorderNone;
}
+void MacWindow::mouseDown(int x, int y) {
+ if (_innerDims.contains(x, y)) {
+ // (*callback)(x - _dims.left, y - dims.top);
+ return;
+ }
+
+ WindowClick click = isInBorder(_innerDims, x, y);
+
+ if (click == kBorderNone)
+ return;
+
+ setHighlight(click);
+
+ if (click == kBorderScrollUp || click == kBorderScrollDown) {
+ // TODO
+ }
+
+}
+
} // End of namespace Wage