From 73ce5f55954f1c2cbcf0dc2cda9c9a6d93dc8dda Mon Sep 17 00:00:00 2001 From: knakos Date: Tue, 23 Jan 2007 14:57:14 +0000 Subject: [PATCH] adding simpler navigation with directional keys for the Input Settings dialog. Reason: Non stylus (mouse) devices have to bind special keys for changing tabs, which is counter intuitive. I could wrap these changes around a wince define but they don't seem awkward. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1305 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/gui/InputDialog.cxx | 3 ++- stella/src/gui/TabWidget.cxx | 22 +++++++++++++++++++++- stella/src/gui/TabWidget.hxx | 3 ++- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/stella/src/gui/InputDialog.cxx b/stella/src/gui/InputDialog.cxx index b72dc0fb1..04972e157 100644 --- a/stella/src/gui/InputDialog.cxx +++ b/stella/src/gui/InputDialog.cxx @@ -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.23 2007-01-17 13:17:42 stephena Exp $ +// $Id: InputDialog.cxx,v 1.24 2007-01-23 14:57:14 knakos Exp $ //============================================================================ #include "OSystem.hxx" @@ -39,6 +39,7 @@ InputDialog::InputDialog(OSystem* osystem, DialogContainer* parent, xpos = 2; ypos = vBorder; myTab = new TabWidget(this, font, xpos, ypos, _w - 2*xpos, _h - 24 - 2*ypos); addTabWidget(myTab); + wid.push_back(myTab); // 1) Event mapper for emulation actions tabID = myTab->addTab("Emul. Events"); diff --git a/stella/src/gui/TabWidget.cxx b/stella/src/gui/TabWidget.cxx index 4325f539f..3b21478b8 100644 --- a/stella/src/gui/TabWidget.cxx +++ b/stella/src/gui/TabWidget.cxx @@ -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: TabWidget.cxx,v 1.25 2007-01-01 18:04:54 stephena Exp $ +// $Id: TabWidget.cxx,v 1.26 2007-01-23 14:57:14 knakos Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -208,6 +208,26 @@ void TabWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) } } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +bool TabWidget::handleEvent(Event::Type event) +{ + switch (event) + { + case Event::UIDown: + case Event::UIRight: + case Event::UIPgDown: + cycleTab(1); + return true; + + case Event::UIUp: + case Event::UILeft: + case Event::UIPgUp: + cycleTab(-1); + return true; + } + return false; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TabWidget::loadConfig() { diff --git a/stella/src/gui/TabWidget.hxx b/stella/src/gui/TabWidget.hxx index f609d0d4f..3d221ecb0 100644 --- a/stella/src/gui/TabWidget.hxx +++ b/stella/src/gui/TabWidget.hxx @@ -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: TabWidget.hxx,v 1.16 2007-01-01 18:04:54 stephena Exp $ +// $Id: TabWidget.hxx,v 1.17 2007-01-23 14:57:14 knakos Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -67,6 +67,7 @@ class TabWidget : public Widget, public CommandSender virtual void handleMouseDown(int x, int y, int button, int clickCount); virtual void handleCommand(CommandSender* sender, int cmd, int data, int id); + virtual bool handleEvent(Event::Type event); virtual void loadConfig();