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
|
|
|
|
//
|
|
|
|
// Copyright (c) 1995-2005 by Bradford W. Mott
|
|
|
|
//
|
|
|
|
// See the file "license" for information on usage and redistribution of
|
|
|
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
|
|
|
//
|
2005-03-12 01:47:15 +00:00
|
|
|
// $Id: Dialog.hxx,v 1.4 2005-03-12 01:47:15 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-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
|
|
|
|
2005-03-11 23:36:30 +00:00
|
|
|
// Some "common" commands sent to handleCommand()
|
|
|
|
enum {
|
|
|
|
kCloseCmd = 'clos'
|
|
|
|
};
|
|
|
|
|
2005-02-27 23:41:19 +00:00
|
|
|
/**
|
|
|
|
This is the base class for all dialog boxes.
|
|
|
|
|
|
|
|
@author Stephen Anthony
|
2005-03-12 01:47:15 +00:00
|
|
|
@version $Id: Dialog.hxx,v 1.4 2005-03-12 01:47:15 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
|
|
|
{
|
|
|
|
public:
|
2005-03-11 23:36:30 +00:00
|
|
|
Dialog(OSystem* instance, uInt16 x, uInt16 y, uInt16 w, uInt16 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
|
|
|
virtual int runModal();
|
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-02-27 23:41:19 +00:00
|
|
|
|
2005-03-11 23:36:30 +00:00
|
|
|
virtual void handleKeyDown(uInt16 ascii, Int32 keycode, Int32 modifiers);
|
|
|
|
virtual void handleKeyUp(uInt16 ascii, Int32 keycode, Int32 modifiers);
|
2005-02-27 23:41:19 +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-03-10 22:59:40 +00:00
|
|
|
virtual void handleTickle(); // Called periodically (in every guiloop() )
|
|
|
|
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);
|
|
|
|
virtual void handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data);
|
|
|
|
virtual void handleScreenChanged() {}
|
|
|
|
|
|
|
|
Widget* findWidget(int x, int y); // Find the widget at pos x,y if any
|
2005-02-27 23:41:19 +00:00
|
|
|
|
2005-03-10 22:59:40 +00:00
|
|
|
ButtonWidget* addButton(int x, int y, const string& label, uInt32 cmd, char hotkey);
|
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-03-10 22:59:40 +00:00
|
|
|
protected:
|
|
|
|
Widget* _mouseWidget;
|
|
|
|
Widget* _focusedWidget;
|
|
|
|
bool _visible;
|
|
|
|
|
|
|
|
private:
|
|
|
|
int _result;
|
|
|
|
};
|
2005-02-27 23:41:19 +00:00
|
|
|
|
|
|
|
#endif
|