- PopUpWidget (drop down list) does not shadow underlying dialog anymore

- Remove reduntant code in drawing pipeline. Topmost dialog was drawn
  up to 4 times

svn-id: r21998
This commit is contained in:
Eugene Sandulenko 2006-04-18 00:37:04 +00:00
parent 1c9c14011b
commit 5daa835cc7
4 changed files with 23 additions and 19 deletions

View file

@ -68,7 +68,7 @@ protected:
}; };
PopUpDialog::PopUpDialog(PopUpWidget *boss, int clickX, int clickY, WidgetSize ws) PopUpDialog::PopUpDialog(PopUpWidget *boss, int clickX, int clickY, WidgetSize ws)
: Dialog(0, 0, 16, 16), : Dialog(0, 0, 16, 16, false),
_popUpBoss(boss) { _popUpBoss(boss) {
// Copy the selection index // Copy the selection index

View file

@ -39,15 +39,17 @@ namespace GUI {
* ... * ...
*/ */
Dialog::Dialog(int x, int y, int w, int h) Dialog::Dialog(int x, int y, int w, int h, bool dimsInactive_)
: GuiObject(x, y, w, h), : GuiObject(x, y, w, h),
_mouseWidget(0), _focusedWidget(0), _dragWidget(0), _visible(false), _drawingHints(0) { _mouseWidget(0), _focusedWidget(0), _dragWidget(0), _visible(false), _drawingHints(0),
_dimsInactive(dimsInactive_) {
_drawingHints = THEME_HINT_FIRST_DRAW | THEME_HINT_SAVE_BACKGROUND; _drawingHints = THEME_HINT_FIRST_DRAW | THEME_HINT_SAVE_BACKGROUND;
} }
Dialog::Dialog(Common::String name) Dialog::Dialog(Common::String name, bool dimsInactive_)
: GuiObject(name), : GuiObject(name),
_mouseWidget(0), _focusedWidget(0), _dragWidget(0), _visible(false), _drawingHints(0) { _mouseWidget(0), _focusedWidget(0), _dragWidget(0), _visible(false), _drawingHints(0),
_dimsInactive(dimsInactive_) {
_drawingHints = THEME_HINT_FIRST_DRAW | THEME_HINT_SAVE_BACKGROUND; _drawingHints = THEME_HINT_FIRST_DRAW | THEME_HINT_SAVE_BACKGROUND;
} }

View file

@ -49,10 +49,11 @@ protected:
private: private:
int _result; int _result;
bool _dimsInactive;
public: public:
Dialog(int x, int y, int w, int h); Dialog(int x, int y, int w, int h, bool dimsInactive = true);
Dialog(Common::String name); Dialog(Common::String name, bool dimsInactive = true);
virtual ~Dialog(); virtual ~Dialog();
virtual int runModal(); virtual int runModal();
@ -84,6 +85,9 @@ protected:
void setResult(int result) { _result = result; } void setResult(int result) { _result = result; }
int getResult() const { return _result; } int getResult() const { return _result; }
// Whether dialog dims all underneath dialogs or not when active
bool dimsInactive() { return _dimsInactive; }
}; };
} // End of namespace GUI } // End of namespace GUI

View file

@ -139,19 +139,8 @@ void NewGui::runLoop() {
didSaveState = true; didSaveState = true;
} }
// small 'HACK': complete gui redraw (needed for new theme inactive dialog color change possibilities)
_theme->clearAll();
int i; int i;
for (i = 0; i < _dialogStack.size() - 1; ++i) {
_theme->closeDialog();
}
for (i = 0; i < _dialogStack.size() - 1; i++) {
_theme->openDialog(false);
}
_theme->openDialog(true);
while (!_dialogStack.empty() && activeDialog == _dialogStack.top()) { while (!_dialogStack.empty() && activeDialog == _dialogStack.top()) {
activeDialog->handleTickle(); activeDialog->handleTickle();
@ -164,7 +153,16 @@ void NewGui::runLoop() {
_theme->closeDialog(); _theme->closeDialog();
} }
for (i = 0; i < _dialogStack.size(); i++) { for (i = 0; i < _dialogStack.size(); i++) {
_theme->openDialog(i == (_dialogStack.size() - 1)); // Special treatment when topmost dialog has dimsInactive() set to false
// This is the case for PopUpWidget which should not dim a dialog
// which it belongs to
if ((i == _dialogStack.size() - 2) && !_dialogStack[i + 1]->dimsInactive())
_theme->openDialog(true);
else if ((i != (_dialogStack.size() - 1)) || !_dialogStack[i]->dimsInactive())
_theme->openDialog(false);
else
_theme->openDialog(true);
_dialogStack[i]->drawDialog(); _dialogStack[i]->drawDialog();
} }
_needRedraw = false; _needRedraw = false;