- 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:
parent
1c9c14011b
commit
5daa835cc7
4 changed files with 23 additions and 19 deletions
|
@ -68,7 +68,7 @@ protected:
|
|||
};
|
||||
|
||||
PopUpDialog::PopUpDialog(PopUpWidget *boss, int clickX, int clickY, WidgetSize ws)
|
||||
: Dialog(0, 0, 16, 16),
|
||||
: Dialog(0, 0, 16, 16, false),
|
||||
_popUpBoss(boss) {
|
||||
|
||||
// Copy the selection index
|
||||
|
|
|
@ -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),
|
||||
_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;
|
||||
}
|
||||
|
||||
Dialog::Dialog(Common::String name)
|
||||
Dialog::Dialog(Common::String name, bool dimsInactive_)
|
||||
: 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,10 +49,11 @@ protected:
|
|||
|
||||
private:
|
||||
int _result;
|
||||
bool _dimsInactive;
|
||||
|
||||
public:
|
||||
Dialog(int x, int y, int w, int h);
|
||||
Dialog(Common::String name);
|
||||
Dialog(int x, int y, int w, int h, bool dimsInactive = true);
|
||||
Dialog(Common::String name, bool dimsInactive = true);
|
||||
virtual ~Dialog();
|
||||
|
||||
virtual int runModal();
|
||||
|
@ -84,6 +85,9 @@ protected:
|
|||
|
||||
void setResult(int result) { _result = result; }
|
||||
int getResult() const { return _result; }
|
||||
|
||||
// Whether dialog dims all underneath dialogs or not when active
|
||||
bool dimsInactive() { return _dimsInactive; }
|
||||
};
|
||||
|
||||
} // End of namespace GUI
|
||||
|
|
|
@ -139,19 +139,8 @@ void NewGui::runLoop() {
|
|||
didSaveState = true;
|
||||
}
|
||||
|
||||
// small 'HACK': complete gui redraw (needed for new theme inactive dialog color change possibilities)
|
||||
_theme->clearAll();
|
||||
|
||||
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()) {
|
||||
activeDialog->handleTickle();
|
||||
|
||||
|
@ -164,7 +153,16 @@ void NewGui::runLoop() {
|
|||
_theme->closeDialog();
|
||||
}
|
||||
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();
|
||||
}
|
||||
_needRedraw = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue