2005-02-27 23:41:19 +00:00
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// SSSS tt lll lll
|
|
|
|
// SS SS tt ll ll
|
|
|
|
// SS tttttt eeee ll ll aaaa
|
|
|
|
// SSSS tt ee ee ll ll aa
|
|
|
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
|
|
|
// SS SS tt ee ll ll aa aa
|
|
|
|
// SSSS ttt eeeee llll llll aaaaa
|
|
|
|
//
|
2005-06-16 00:56:00 +00:00
|
|
|
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
|
2005-02-27 23:41:19 +00:00
|
|
|
//
|
|
|
|
// See the file "license" for information on usage and redistribution of
|
|
|
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
|
|
|
//
|
2006-02-22 17:38:04 +00:00
|
|
|
// $Id: Dialog.hxx,v 1.27 2006-02-22 17:38:04 stephena Exp $
|
2005-03-10 22:59:40 +00:00
|
|
|
//
|
|
|
|
// Based on code from ScummVM - Scumm Interpreter
|
|
|
|
// Copyright (C) 2002-2004 The ScummVM project
|
2005-02-27 23:41:19 +00:00
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
#ifndef DIALOG_HXX
|
|
|
|
#define DIALOG_HXX
|
|
|
|
|
2005-03-11 23:36:30 +00:00
|
|
|
class OSystem;
|
2005-05-04 19:04:47 +00:00
|
|
|
class DialogContainer;
|
2005-08-10 12:23:42 +00:00
|
|
|
class TabWidget;
|
2005-02-27 23:41:19 +00:00
|
|
|
|
2005-03-10 22:59:40 +00:00
|
|
|
#include "Command.hxx"
|
|
|
|
#include "Widget.hxx"
|
|
|
|
#include "GuiObject.hxx"
|
2005-02-27 23:41:19 +00:00
|
|
|
|
2005-03-10 22:59:40 +00:00
|
|
|
#include "bspf.hxx"
|
2005-02-27 23:41:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
This is the base class for all dialog boxes.
|
|
|
|
|
|
|
|
@author Stephen Anthony
|
2006-02-22 17:38:04 +00:00
|
|
|
@version $Id: Dialog.hxx,v 1.27 2006-02-22 17:38:04 stephena Exp $
|
2005-02-27 23:41:19 +00:00
|
|
|
*/
|
2005-03-11 23:36:30 +00:00
|
|
|
class Dialog : public GuiObject
|
2005-02-27 23:41:19 +00:00
|
|
|
{
|
2005-05-04 19:04:47 +00:00
|
|
|
friend class DialogContainer;
|
2005-03-14 04:08:15 +00:00
|
|
|
|
2005-08-10 12:23:42 +00:00
|
|
|
struct Focus {
|
|
|
|
Widget* focusedWidget;
|
|
|
|
WidgetArray focusList;
|
|
|
|
};
|
Moved the Array class from namespace GUI to Common, since it's used in
many places other than the GUI code.
As a diversion from the joystick stuff, I'm experimenting with event
recording. Eventually, this will allow one to record a state + events,
and then load that INP file again. When loaded, Stella will replay the
events, and you'll be able to see exactly what happened before. Since
this is based on frames, the replaying can speed up and slow
down by changing the emulation framerate. And it can be exited at any
point, and normal emulation can continue. Or at least that's how I
want it to work.
A preliminary spec for the event stream is -X A B A B ... -X ...,
where X represents how many frames to wait, and 'A B' are event/value
pairs representing an event in Stella. I think this is very similar
to the scheme that Thomas J. recently added to z26, so converting to
a Stella eventstream should be easy.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@905 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-12-09 01:16:14 +00:00
|
|
|
typedef Common::Array<Focus> FocusList;
|
2005-08-10 12:23:42 +00:00
|
|
|
|
2005-02-27 23:41:19 +00:00
|
|
|
public:
|
2005-05-10 19:20:45 +00:00
|
|
|
Dialog(OSystem* instance, DialogContainer* parent,
|
2005-05-13 18:28:06 +00:00
|
|
|
int x, int y, int w, int h);
|
2005-02-27 23:41:19 +00:00
|
|
|
|
2005-03-10 22:59:40 +00:00
|
|
|
virtual ~Dialog();
|
2005-02-27 23:41:19 +00:00
|
|
|
|
2005-03-10 22:59:40 +00:00
|
|
|
bool isVisible() const { return _visible; }
|
2005-02-27 23:41:19 +00:00
|
|
|
|
2005-03-12 01:47:15 +00:00
|
|
|
virtual void open();
|
|
|
|
virtual void close();
|
2005-03-10 22:59:40 +00:00
|
|
|
virtual void drawDialog();
|
2005-03-15 22:28:05 +00:00
|
|
|
virtual void loadConfig() {}
|
|
|
|
virtual void saveConfig() {}
|
2005-03-26 19:26:48 +00:00
|
|
|
virtual void setDefaults() {}
|
2005-02-27 23:41:19 +00:00
|
|
|
|
2005-08-10 12:23:42 +00:00
|
|
|
void addFocusWidget(Widget* w);
|
|
|
|
void addToFocusList(WidgetArray& list, int id = -1);
|
|
|
|
void redrawFocus();
|
|
|
|
void addTabWidget(TabWidget* w) { _ourTab = w; }
|
Removed the ability to emulate the mouse cursor with the joystick while
in GUI menu mode. The code was too troublesome to fix, and navigating
a GUI with a joystick simulating a mouse is a broken concept anyway.
In place of joy-is-mouse navigation, added the ability to use the cursor
keys or joysticks axes to 'tab' between different focused objects in
GUI mode. This is much more intuitive, and is how navigation works in
a mouse-less, game console based system. Also, any joystick button (or
enter/space keys) activate the currently focused item.
For now, only the CommandDialog can be accessed this way. It really
only makes sense here anyway, since many GUI objects in the other menus
really need access to a keyboard and mouse, and if you have those, one
can already navigate the menu.
Overall, this should make arcade cabinet style access much easier. One
can map the CommandDialog to a joystick button, navigate with the joystick
axes, and select an item with any joystick button. So Stella can be
started, play a game, and then exit, all by just using the joystick. It
also solves quite a few usability problems for the WinCE and PSP ports.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@918 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-12-19 02:19:49 +00:00
|
|
|
void setFocus(Widget* w);
|
2005-08-10 12:23:42 +00:00
|
|
|
|
2005-03-10 22:59:40 +00:00
|
|
|
protected:
|
|
|
|
virtual void draw();
|
2005-03-12 01:47:15 +00:00
|
|
|
void releaseFocus();
|
2005-02-27 23:41:19 +00:00
|
|
|
|
2005-05-13 18:28:06 +00:00
|
|
|
virtual void handleKeyDown(int ascii, int keycode, int modifiers);
|
|
|
|
virtual void handleKeyUp(int ascii, int keycode, int modifiers);
|
2005-03-10 22:59:40 +00:00
|
|
|
virtual void handleMouseDown(int x, int y, int button, int clickCount);
|
|
|
|
virtual void handleMouseUp(int x, int y, int button, int clickCount);
|
|
|
|
virtual void handleMouseWheel(int x, int y, int direction);
|
|
|
|
virtual void handleMouseMoved(int x, int y, int button);
|
2005-05-26 15:43:44 +00:00
|
|
|
virtual void handleJoyDown(int stick, int button);
|
|
|
|
virtual void handleJoyUp(int stick, int button);
|
2005-12-07 20:46:49 +00:00
|
|
|
virtual void handleJoyAxis(int stick, int axis, int value);
|
2006-01-09 16:50:01 +00:00
|
|
|
virtual void handleJoyHat(int stick, int hat, int value);
|
2005-07-05 15:25:45 +00:00
|
|
|
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
2005-03-10 22:59:40 +00:00
|
|
|
virtual void handleScreenChanged() {}
|
2005-12-24 22:09:36 +00:00
|
|
|
|
2006-01-08 02:28:04 +00:00
|
|
|
/** The dialog wants all events except those that have some special function */
|
2005-12-24 22:09:36 +00:00
|
|
|
virtual bool wantsEvents();
|
2006-01-08 02:28:04 +00:00
|
|
|
|
|
|
|
/** The dialog wants all events, without exception */
|
|
|
|
virtual bool wantsAllEvents();
|
2005-03-10 22:59:40 +00:00
|
|
|
|
|
|
|
Widget* findWidget(int x, int y); // Find the widget at pos x,y if any
|
2005-02-27 23:41:19 +00:00
|
|
|
|
2006-02-22 17:38:04 +00:00
|
|
|
ButtonWidget* addButton(const GUI::Font& font, int x, int y,
|
|
|
|
const string& label = "", int cmd = 0, char hotkey = 0);
|
2005-02-27 23:41:19 +00:00
|
|
|
|
2005-03-10 22:59:40 +00:00
|
|
|
void setResult(int result) { _result = result; }
|
|
|
|
int getResult() const { return _result; }
|
2005-02-27 23:41:19 +00:00
|
|
|
|
2005-08-10 12:23:42 +00:00
|
|
|
private:
|
|
|
|
void buildFocusWidgetList(int id);
|
|
|
|
|
2005-03-10 22:59:40 +00:00
|
|
|
protected:
|
|
|
|
Widget* _mouseWidget;
|
|
|
|
Widget* _focusedWidget;
|
2005-04-24 01:57:47 +00:00
|
|
|
Widget* _dragWidget;
|
2005-03-10 22:59:40 +00:00
|
|
|
bool _visible;
|
|
|
|
|
|
|
|
private:
|
2005-08-10 12:23:42 +00:00
|
|
|
FocusList _ourFocusList;
|
|
|
|
TabWidget* _ourTab;
|
|
|
|
|
2005-03-10 22:59:40 +00:00
|
|
|
int _result;
|
2005-08-10 12:23:42 +00:00
|
|
|
int _focusID;
|
2005-03-10 22:59:40 +00:00
|
|
|
};
|
2005-02-27 23:41:19 +00:00
|
|
|
|
|
|
|
#endif
|