diff options
-rw-r--r-- | gui/dialog.cpp | 33 | ||||
-rw-r--r-- | newgui.cpp | 10 | ||||
-rw-r--r-- | newgui.h | 2 |
3 files changed, 27 insertions, 18 deletions
diff --git a/gui/dialog.cpp b/gui/dialog.cpp index bee8037870..dea3d58b7b 100644 --- a/gui/dialog.cpp +++ b/gui/dialog.cpp @@ -32,10 +32,14 @@ /* * TODO list - * - if save or load fails (e.g. due to disk full/directory write protected), + * - If saving or loading fails (e.g. due to disk full/directory write protected), * display an error dialog? * - The user can edit the name of the autosave game. Of course this will not * do anything, but we should still prevent this. + * - add some sense of the window being "active" (i.e. in front) or not. If it + * was inactive and just became active, reset certain vars (like who is focused). + * Maybe we should just add lostFocus and receivedFocus methods to Dialog, just + * like we have for class Widget? * ... */ @@ -195,21 +199,22 @@ void Dialog::handleMouseMoved(int x, int y, int button) _mouseWidget = 0; w->handleMouseLeft(button); } - - } else { - w = findWidget(x, y); - if (_mouseWidget != w) { - if (_mouseWidget) - _mouseWidget->handleMouseLeft(button); - if (w) - w->handleMouseEntered(button); - _mouseWidget = w; - } + w->handleMouseMoved(x - w->_x, y - w->_y, button); + } - if (!w || !(w->getFlags() & WIDGET_TRACK_MOUSE)) { - return; - } + w = findWidget(x, y); + + if (_mouseWidget != w) { + if (_mouseWidget) + _mouseWidget->handleMouseLeft(button); + if (w) + w->handleMouseEntered(button); + _mouseWidget = w; + } + + if (!w || !(w->getFlags() & WIDGET_TRACK_MOUSE)) { + return; } w->handleMouseMoved(x - w->_x, y - w->_y, button); diff --git a/newgui.cpp b/newgui.cpp index d4db25f85a..54bd777e20 100644 --- a/newgui.cpp +++ b/newgui.cpp @@ -38,7 +38,7 @@ #define ABS(x) ((x) < 0 ? -(x) : (x)) -NewGui::NewGui(Scumm *s) : _s(s), _use_alpha_blending(true), +NewGui::NewGui(Scumm *s) : _s(s), _use_alpha_blending(false), _need_redraw(false),_prepare_for_gui(true), _pauseDialog(0), _saveLoadDialog(0), _aboutDialog(0), _optionsDialog(0), _currentKeyDown(0) @@ -83,13 +83,14 @@ void NewGui::soundDialog() void NewGui::loop() { Dialog *activeDialog = _dialogStack.top(); + int i; if (_prepare_for_gui) { ClearBlendCache(_s->_currentPalette, 128); saveState(); if (_use_alpha_blending) activeDialog->setupScreenBuf(); -#if 0 +#if 1 // FIXME - hack to encode our own custom GUI colors. Since we have to live // with a given 8 bit palette, the result is not always as nice as one // would wish, but this is just an experiment after all. @@ -115,7 +116,8 @@ void NewGui::loop() activeDialog->handleTickle(); if (_need_redraw) { - activeDialog->draw(); + for (i = 0; i < _dialogStack.size(); i++) + _dialogStack[i]->draw(); _need_redraw = false; } @@ -125,7 +127,7 @@ void NewGui::loop() { OSystem::Event t; - for (int i = 0; i < _eventList.size(); i++) + for (i = 0; i < _eventList.size(); i++) { t = _eventList[i]; @@ -49,6 +49,8 @@ public: void push(Dialog *d) { _stack[_size++] = d; } Dialog *top() const { return _stack[_size-1]; } void pop() { if (_size > 0) _stack[--_size] = 0; } + int size() const { return _size; } + Dialog *operator [](int i) { return _stack[i]; } }; typedef ScummVM::List<OSystem::Event> EventList; |