Fixed tab selection order wrt the new tab functionality added by Kostas

(WinCE maintainer).  The objects now cycle from tab widget, to all widgets
in that tab, to buttons at the bottom of the dialog.  Previously, the
ordering was from tab widget to buttons, then jump back to widgets in the
tab.  This would have worked, but cosmetically wasn't very nice.

Added UIOK and UICancel handling to InputDialog; I forgot this in the last
release.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1306 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2007-01-24 19:17:33 +00:00
parent 73ce5f5595
commit 1d44875687
5 changed files with 33 additions and 23 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Dialog.cxx,v 1.53 2007-01-01 18:04:52 stephena Exp $
// $Id: Dialog.cxx,v 1.54 2007-01-24 19:17:33 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -58,6 +58,8 @@ Dialog::~Dialog()
delete _firstWidget;
_firstWidget = NULL;
_ourButtonGroup.clear();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -187,6 +189,12 @@ void Dialog::buildFocusWidgetList(int id)
if(_focusID > 0)
_focusList.push_back(_ourFocusList[_focusID].focusList);
// Add button group at end of current focus list
// We do it this way for TabWidget, so that buttons are scanned
// *after* the widgets in the current tab
if(_ourButtonGroup.size() > 0)
_focusList.push_back(_ourButtonGroup);
// Only update _focusedWidget if it doesn't belong to the main focus list
// HACK - figure out how to properly deal with only one focus-able widget
// in a tab -- TabWidget is the spawn of the devil

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Dialog.hxx,v 1.34 2007-01-01 18:04:52 stephena Exp $
// $Id: Dialog.hxx,v 1.35 2007-01-24 19:17:33 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -36,7 +36,7 @@ class TabWidget;
This is the base class for all dialog boxes.
@author Stephen Anthony
@version $Id: Dialog.hxx,v 1.34 2007-01-01 18:04:52 stephena Exp $
@version $Id: Dialog.hxx,v 1.35 2007-01-24 19:17:33 stephena Exp $
*/
class Dialog : public GuiObject
{
@ -66,6 +66,7 @@ class Dialog : public GuiObject
void addFocusWidget(Widget* w);
void addToFocusList(WidgetArray& list, int id = -1);
void addBGroupToFocusList(WidgetArray& list) { _ourButtonGroup = list; }
void redrawFocus();
void addTabWidget(TabWidget* w) { _ourTab = w; }
void addOKWidget(Widget* w) { _okWidget = w; }
@ -112,8 +113,9 @@ class Dialog : public GuiObject
bool _center;
private:
FocusList _ourFocusList;
TabWidget* _ourTab;
FocusList _ourFocusList;
TabWidget* _ourTab;
WidgetArray _ourButtonGroup;
int _result;
int _focusID;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FileSnapDialog.cxx,v 1.5 2007-01-19 21:53:27 stephena Exp $
// $Id: FileSnapDialog.cxx,v 1.6 2007-01-24 19:17:33 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -50,6 +50,7 @@ FileSnapDialog::FileSnapDialog(
xpos = 2; ypos = vBorder;
myTab = new TabWidget(this, font, xpos, ypos, _w - 2*xpos, _h - 2*bheight - ypos);
addTabWidget(myTab);
addFocusWidget(myTab);
// 1) The browser settings tab
wid.clear();
@ -116,32 +117,24 @@ FileSnapDialog::FileSnapDialog(
// Add focus widgets for Snapshot tab
addToFocusList(wid, tabID);
// Activate the first tab
myTab->setActiveTab(0);
// Add OK & Cancel buttons
wid.clear();
#ifndef MAC_OSX
xpos = _w - 2 *(bwidth + 10); ypos = _h - bheight - 8;
b = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "OK", kOKCmd);
b = addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd);
wid.push_back(b);
addOKWidget(b);
xpos += bwidth + 10;
b = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Cancel", kCloseCmd);
b = addButton(font, _w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd);
wid.push_back(b);
addCancelWidget(b);
#else
xpos = _w - 2 *(bwidth + 10); ypos = _h - bheight - 8;
b = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Cancel", kCloseCmd);
b = addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd);
wid.push_back(b);
addCancelWidget(b);
xpos += bwidth + 10;
b = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "OK", kOKCmd);
b = addButton(font, _w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd);
wid.push_back(b);
addOKWidget(b);
#endif
// Add focus widgets for OK/Cancel buttons
addToFocusList(wid);
addBGroupToFocusList(wid);
// Create file browser dialog
myBrowser = new BrowserDialog(this, font, 60, 20, 200, 200);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: GameInfoDialog.cxx,v 1.36 2007-01-01 18:04:53 stephena Exp $
// $Id: GameInfoDialog.cxx,v 1.37 2007-01-24 19:17:33 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -50,6 +50,7 @@ GameInfoDialog::GameInfoDialog(
xpos = 2; ypos = vBorder;
myTab = new TabWidget(this, font, xpos, ypos, _w - 2*xpos, _h - 24 - 2*ypos - 15);
addTabWidget(myTab);
addFocusWidget(myTab);
// 1) Cartridge properties
wid.clear();
@ -320,7 +321,7 @@ GameInfoDialog::GameInfoDialog(
wid.push_back(b);
addOKWidget(b);
#endif
addToFocusList(wid);
addBGroupToFocusList(wid);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: InputDialog.cxx,v 1.24 2007-01-23 14:57:14 knakos Exp $
// $Id: InputDialog.cxx,v 1.25 2007-01-24 19:17:33 stephena Exp $
//============================================================================
#include "OSystem.hxx"
@ -40,6 +40,7 @@ InputDialog::InputDialog(OSystem* osystem, DialogContainer* parent,
myTab = new TabWidget(this, font, xpos, ypos, _w - 2*xpos, _h - 24 - 2*ypos);
addTabWidget(myTab);
wid.push_back(myTab);
addToFocusList(wid);
// 1) Event mapper for emulation actions
tabID = myTab->addTab("Emul. Events");
@ -69,19 +70,24 @@ InputDialog::InputDialog(OSystem* osystem, DialogContainer* parent,
myTab->setActiveTab(0);
// Add OK and Cancel buttons
wid.clear();
ButtonWidget* b;
#ifndef MAC_OSX
b = addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd);
wid.push_back(b);
addOKWidget(b);
b = addButton(font, _w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd);
wid.push_back(b);
addCancelWidget(b);
#else
b = addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd);
wid.push_back(b);
addCancelWidget(b);
b = addButton(font, _w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd);
wid.push_back(b);
addOKWidget(b);
#endif
addToFocusList(wid);
addBGroupToFocusList(wid);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -