mirror of https://github.com/stella-emu/stella.git
Added TabWidget and modified LauncherDialog to use it.
Changed many conflicting instances (in overloaded methods) of uInt32, uInt16, Int32 and Int16 to just plain 'int'. After spending two hours trying to find out why a method wasn't being called, only to see it was because of conflicting definitions of 'int', I said to hell with it and removed all instances of those portability functions from the GUI stuff (thank Brian for the advice). Eventually, they'll be removed from the whole codebase. Already we're running into problems with them on 64-bit machines. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@423 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
fc8240239a
commit
8bed0dfc75
|
@ -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: makefile,v 1.77 2005-05-10 19:20:38 stephena Exp $
|
||||
## $Id: makefile,v 1.78 2005-05-13 18:28:04 stephena Exp $
|
||||
##============================================================================
|
||||
|
||||
##============================================================================
|
||||
|
@ -156,10 +156,10 @@ win32-gl:
|
|||
M6502_OBJS = D6502.o Device.o M6502.o M6502Low.o M6502Hi.o NullDev.o System.o
|
||||
|
||||
GUI_OBJS = StellaFont.o Menu.o Launcher.o \
|
||||
Widget.o PopUpWidget.o ScrollBarWidget.o ListWidget.o \
|
||||
Widget.o PopUpWidget.o ScrollBarWidget.o ListWidget.o TabWidget.o \
|
||||
Dialog.o DialogContainer.o OptionsDialog.o VideoDialog.o AudioDialog.o \
|
||||
EventMappingDialog.o GameInfoDialog.o HelpDialog.o \
|
||||
LauncherDialog.o BrowserDialog.o GameList.o
|
||||
LauncherDialog.o LauncherOptionsDialog.o BrowserDialog.o GameList.o
|
||||
|
||||
CORE_OBJS = Booster.o Cart.o Cart2K.o Cart3F.o Cart4K.o CartAR.o CartDPC.o \
|
||||
CartE0.o CartE7.o CartF4.o CartF4SC.o CartF6.o CartF6SC.o \
|
||||
|
@ -397,6 +397,9 @@ ScrollBarWidget.o: $(GUI)/ScrollBarWidget.cxx $(GUI)/ScrollBarWidget.hxx
|
|||
ListWidget.o: $(GUI)/ListWidget.cxx $(GUI)/ListWidget.hxx
|
||||
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(GUI)/ListWidget.cxx
|
||||
|
||||
TabWidget.o: $(GUI)/TabWidget.cxx $(GUI)/TabWidget.hxx
|
||||
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(GUI)/TabWidget.cxx
|
||||
|
||||
Dialog.o: $(GUI)/Dialog.cxx $(GUI)/Dialog.hxx
|
||||
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(GUI)/Dialog.cxx
|
||||
|
||||
|
@ -424,6 +427,9 @@ HelpDialog.o: $(GUI)/HelpDialog.cxx $(GUI)/HelpDialog.hxx
|
|||
LauncherDialog.o: $(GUI)/LauncherDialog.cxx $(GUI)/LauncherDialog.hxx
|
||||
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(GUI)/LauncherDialog.cxx
|
||||
|
||||
LauncherOptionsDialog.o: $(GUI)/LauncherOptionsDialog.cxx $(GUI)/LauncherOptionsDialog.hxx
|
||||
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(GUI)/LauncherOptionsDialog.cxx
|
||||
|
||||
BrowserDialog.o: $(GUI)/BrowserDialog.cxx $(GUI)/BrowserDialog.hxx
|
||||
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(GUI)/BrowserDialog.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: FrameBuffer.cxx,v 1.35 2005-05-12 18:45:21 stephena Exp $
|
||||
// $Id: FrameBuffer.cxx,v 1.36 2005-05-13 18:28:05 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <sstream>
|
||||
|
@ -176,10 +176,10 @@ void FrameBuffer::update()
|
|||
// Draw any pending messages
|
||||
if(myMessageTime > 0)
|
||||
{
|
||||
uInt32 w = myFont->getStringWidth(myMessageText) + 10;
|
||||
uInt32 h = myFont->getFontHeight() + 8;
|
||||
uInt32 x = (myBaseDim.w >> 1) - (w >> 1);
|
||||
uInt32 y = myBaseDim.h - h - 10/2;
|
||||
Int32 w = myFont->getStringWidth(myMessageText) + 10;
|
||||
Int32 h = myFont->getFontHeight() + 8;
|
||||
Int32 x = (myBaseDim.w >> 1) - (w >> 1);
|
||||
Int32 y = myBaseDim.h - h - 10/2;
|
||||
|
||||
// Draw the bounded box and text
|
||||
blendRect(x+1, y+2, w-2, h-4, kBGColor);
|
||||
|
|
|
@ -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: Settings.cxx,v 1.41 2005-05-12 18:45:21 stephena Exp $
|
||||
// $Id: Settings.cxx,v 1.42 2005-05-13 18:28:05 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
|
@ -164,7 +164,7 @@ bool Settings::loadCommandLine(int argc, char** argv)
|
|||
void Settings::validate()
|
||||
{
|
||||
string s;
|
||||
uInt32 i;
|
||||
int i;
|
||||
float f;
|
||||
|
||||
s = getString("video");
|
||||
|
@ -313,7 +313,7 @@ void Settings::saveConfig()
|
|||
<< ";" << endl;
|
||||
|
||||
// Write out each of the key and value pairs
|
||||
for(uInt32 i = 0; i < mySize; ++i)
|
||||
for(unsigned int i = 0; i < mySize; ++i)
|
||||
if(mySettings[i].save)
|
||||
out << mySettings[i].key << " = " << mySettings[i].value << endl;
|
||||
|
||||
|
@ -324,7 +324,7 @@ void Settings::saveConfig()
|
|||
void Settings::set(const string& key, const string& value, bool save)
|
||||
{
|
||||
// See if the setting already exists
|
||||
for(uInt32 i = 0; i < mySize; ++i)
|
||||
for(unsigned int i = 0; i < mySize; ++i)
|
||||
{
|
||||
// If a key is already present in the array, then we assume
|
||||
// that it was set by the emulation core and must be saved
|
||||
|
@ -343,7 +343,7 @@ void Settings::set(const string& key, const string& value, bool save)
|
|||
// Yes, so we'll make the array twice as large
|
||||
Setting* newSettings = new Setting[myCapacity * 2];
|
||||
|
||||
for(uInt32 i = 0; i < mySize; ++i)
|
||||
for(unsigned int i = 0; i < mySize; ++i)
|
||||
{
|
||||
newSettings[i] = mySettings[i];
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ void Settings::set(const string& key, const string& value, bool save)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Settings::setInt(const string& key, const uInt32 value, bool save)
|
||||
void Settings::setInt(const string& key, const int value, bool save)
|
||||
{
|
||||
ostringstream stream;
|
||||
stream << value;
|
||||
|
@ -399,12 +399,12 @@ void Settings::setString(const string& key, const string& value, bool save)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt32 Settings::getInt(const string& key) const
|
||||
int Settings::getInt(const string& key) const
|
||||
{
|
||||
// Try to find the named setting and answer its value
|
||||
for(uInt32 i = 0; i < mySize; ++i)
|
||||
for(unsigned int i = 0; i < mySize; ++i)
|
||||
if(key == mySettings[i].key)
|
||||
return (uInt32) atoi(mySettings[i].value.c_str());
|
||||
return (int) atoi(mySettings[i].value.c_str());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -413,7 +413,7 @@ uInt32 Settings::getInt(const string& key) const
|
|||
float Settings::getFloat(const string& key) const
|
||||
{
|
||||
// Try to find the named setting and answer its value
|
||||
for(uInt32 i = 0; i < mySize; ++i)
|
||||
for(unsigned int i = 0; i < mySize; ++i)
|
||||
if(key == mySettings[i].key)
|
||||
return (float) atof(mySettings[i].value.c_str());
|
||||
|
||||
|
@ -424,7 +424,7 @@ float Settings::getFloat(const string& key) const
|
|||
bool Settings::getBool(const string& key) const
|
||||
{
|
||||
// Try to find the named setting and answer its value
|
||||
for(uInt32 i = 0; i < mySize; ++i)
|
||||
for(unsigned int i = 0; i < mySize; ++i)
|
||||
{
|
||||
if(key == mySettings[i].key)
|
||||
{
|
||||
|
@ -444,7 +444,7 @@ bool Settings::getBool(const string& key) const
|
|||
string Settings::getString(const string& key) const
|
||||
{
|
||||
// Try to find the named setting and answer its value
|
||||
for(uInt32 i = 0; i < mySize; ++i)
|
||||
for(unsigned int i = 0; i < mySize; ++i)
|
||||
if(key == mySettings[i].key)
|
||||
return mySettings[i].value;
|
||||
|
||||
|
@ -455,7 +455,7 @@ string Settings::getString(const string& key) const
|
|||
bool Settings::contains(const string& key)
|
||||
{
|
||||
// Try to find the named setting
|
||||
for(uInt32 i = 0; i < mySize; ++i)
|
||||
for(unsigned int i = 0; i < mySize; ++i)
|
||||
if(key == mySettings[i].key)
|
||||
return true;
|
||||
|
||||
|
|
|
@ -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: Settings.hxx,v 1.23 2005-05-12 18:45:21 stephena Exp $
|
||||
// $Id: Settings.hxx,v 1.24 2005-05-13 18:28:05 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef SETTINGS_HXX
|
||||
|
@ -28,7 +28,7 @@ class OSystem;
|
|||
This class provides an interface for accessing frontend specific settings.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: Settings.hxx,v 1.23 2005-05-12 18:45:21 stephena Exp $
|
||||
@version $Id: Settings.hxx,v 1.24 2005-05-13 18:28:05 stephena Exp $
|
||||
*/
|
||||
class Settings
|
||||
{
|
||||
|
@ -79,7 +79,7 @@ class Settings
|
|||
@param key The key of the setting to lookup
|
||||
@return The integer value of the setting
|
||||
*/
|
||||
uInt32 getInt(const string& key) const;
|
||||
int getInt(const string& key) const;
|
||||
|
||||
/**
|
||||
Get the value assigned to the specified key. If the key does
|
||||
|
@ -115,7 +115,7 @@ class Settings
|
|||
@param value The value to assign to the setting
|
||||
@param save Whether this setting should be saved to the rc-file.
|
||||
*/
|
||||
void setInt(const string& key, const uInt32 value, bool save = true);
|
||||
void setInt(const string& key, const int value, bool save = true);
|
||||
|
||||
/**
|
||||
Set the value associated with key to the given value.
|
||||
|
|
|
@ -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: AudioDialog.cxx,v 1.5 2005-05-12 18:45:21 stephena Exp $
|
||||
// $Id: AudioDialog.cxx,v 1.6 2005-05-13 18:28:05 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -42,7 +42,7 @@ enum {
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AudioDialog::AudioDialog(OSystem* osystem, DialogContainer* parent,
|
||||
uInt16 x, uInt16 y, uInt16 w, uInt16 h)
|
||||
int x, int y, int w, int h)
|
||||
: Dialog(osystem, parent, x, y, w, h)
|
||||
{
|
||||
int yoff = 10,
|
||||
|
@ -104,7 +104,7 @@ AudioDialog::~AudioDialog()
|
|||
void AudioDialog::loadConfig()
|
||||
{
|
||||
bool b;
|
||||
uInt32 i;
|
||||
int i;
|
||||
|
||||
// Volume
|
||||
myVolumeSlider->setValue(instance()->settings().getInt("volume"));
|
||||
|
@ -131,7 +131,7 @@ void AudioDialog::loadConfig()
|
|||
void AudioDialog::saveConfig()
|
||||
{
|
||||
string s;
|
||||
uInt32 i;
|
||||
int i;
|
||||
bool b, restart = false;
|
||||
|
||||
// Volume
|
||||
|
@ -194,7 +194,7 @@ void AudioDialog::handleSoundEnableChange(bool active)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void AudioDialog::handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data)
|
||||
void AudioDialog::handleCommand(CommandSender* sender, int cmd, int data)
|
||||
{
|
||||
switch(cmd)
|
||||
{
|
||||
|
|
|
@ -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: AudioDialog.hxx,v 1.2 2005-05-10 19:20:43 stephena Exp $
|
||||
// $Id: AudioDialog.hxx,v 1.3 2005-05-13 18:28:05 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -37,7 +37,7 @@ class AudioDialog : public Dialog
|
|||
{
|
||||
public:
|
||||
AudioDialog(OSystem* osystem, DialogContainer* parent,
|
||||
uInt16 x, uInt16 y, uInt16 w, uInt16 h);
|
||||
int x, int y, int w, int h);
|
||||
~AudioDialog();
|
||||
|
||||
protected:
|
||||
|
@ -52,7 +52,7 @@ class AudioDialog : public Dialog
|
|||
void setDefaults();
|
||||
|
||||
void handleSoundEnableChange(bool active);
|
||||
virtual void handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data);
|
||||
virtual void handleCommand(CommandSender* sender, int cmd, int data);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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: BrowserDialog.cxx,v 1.2 2005-05-10 19:20:43 stephena Exp $
|
||||
// $Id: BrowserDialog.cxx,v 1.3 2005-05-13 18:28:05 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -24,6 +24,7 @@
|
|||
#include "ListWidget.hxx"
|
||||
#include "Dialog.hxx"
|
||||
#include "FSNode.hxx"
|
||||
#include "GuiObject.hxx"
|
||||
#include "GuiUtils.hxx"
|
||||
#include "BrowserDialog.hxx"
|
||||
|
||||
|
@ -41,16 +42,13 @@ enum {
|
|||
*/
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
BrowserDialog::BrowserDialog(OSystem* osystem, DialogContainer* parent,
|
||||
const string& title, const string& startpath,
|
||||
uInt16 x, uInt16 y, uInt16 w, uInt16 h)
|
||||
: Dialog(osystem, parent, x, y, w, h),
|
||||
BrowserDialog::BrowserDialog(GuiObject* boss, int x, int y, int w, int h)
|
||||
: Dialog(boss->instance(), boss->parent(), x, y, w, h),
|
||||
CommandSender(boss),
|
||||
_fileList(NULL),
|
||||
_currentPath(NULL),
|
||||
_startPath(startpath)
|
||||
_currentPath(NULL)
|
||||
{
|
||||
// Headline - TODO: should be customizable during creation time
|
||||
new StaticTextWidget(this, 10, 8, _w - 2 * 10, kLineHeight, title, kTextAlignCenter);
|
||||
_title = new StaticTextWidget(this, 10, 8, _w - 2 * 10, kLineHeight, "", kTextAlignCenter);
|
||||
|
||||
// Current path - TODO: handle long paths ?
|
||||
_currentPath = new StaticTextWidget(this, 10, 20, _w - 2 * 10, kLineHeight,
|
||||
|
@ -65,18 +63,16 @@ BrowserDialog::BrowserDialog(OSystem* osystem, DialogContainer* parent,
|
|||
addButton(10, _h - 24, "Go up", kGoUpCmd, 0);
|
||||
addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
|
||||
addButton(_w - (kButtonWidth+10), _h - 24, "Choose", kChooseCmd, 0);
|
||||
|
||||
// If no node has been set, or the last used one is now invalid,
|
||||
// go back to the root/default dir.
|
||||
if (_startPath != "")
|
||||
_choice = FilesystemNode(_startPath);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void BrowserDialog::loadConfig()
|
||||
void BrowserDialog::setStartPath(const string& startpath)
|
||||
{
|
||||
// If no node has been set, or the last used one is now invalid,
|
||||
// go back to the root/default dir.
|
||||
if (startpath != "")
|
||||
_choice = FilesystemNode(startpath);
|
||||
|
||||
if (_choice.isValid())
|
||||
_node = _choice;
|
||||
else if (!_node.isValid())
|
||||
|
@ -87,7 +83,7 @@ void BrowserDialog::loadConfig()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void BrowserDialog::handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data)
|
||||
void BrowserDialog::handleCommand(CommandSender* sender, int cmd, int data)
|
||||
{
|
||||
switch (cmd)
|
||||
{
|
||||
|
@ -95,13 +91,16 @@ void BrowserDialog::handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data
|
|||
{
|
||||
// If nothing is selected in the list widget, choose the current dir.
|
||||
// Else, choose the dir that is selected.
|
||||
Int32 selection = _fileList->getSelected();
|
||||
int selection = _fileList->getSelected();
|
||||
if (selection >= 0)
|
||||
_choice = _nodeContent[selection];
|
||||
else
|
||||
_choice = _node;
|
||||
|
||||
setResult(1);
|
||||
// Send a signal to the calling class that a selection has been made
|
||||
if(_cmd)
|
||||
sendCommand(_cmd, 0);
|
||||
|
||||
close();
|
||||
break;
|
||||
}
|
||||
|
@ -135,8 +134,8 @@ void BrowserDialog::updateListing()
|
|||
|
||||
// Populate the ListWidget
|
||||
StringList list;
|
||||
Int32 size = _nodeContent.size();
|
||||
for (Int32 i = 0; i < size; i++)
|
||||
int size = _nodeContent.size();
|
||||
for (int i = 0; i < size; i++)
|
||||
list.push_back(_nodeContent[i].displayName());
|
||||
|
||||
_fileList->setList(list);
|
||||
|
|
|
@ -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: BrowserDialog.hxx,v 1.2 2005-05-10 19:20:43 stephena Exp $
|
||||
// $Id: BrowserDialog.hxx,v 1.3 2005-05-13 18:28:05 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -22,38 +22,40 @@
|
|||
#ifndef BROWSER_DIALOG_HXX
|
||||
#define BROWSER_DIALOG_HXX
|
||||
|
||||
class DialogContainer;
|
||||
class CommandSender;
|
||||
class ButtonWidget;
|
||||
class GuiObject;
|
||||
class StaticTextWidget;
|
||||
class ListWidget;
|
||||
|
||||
#include "Dialog.hxx"
|
||||
#include "OSystem.hxx"
|
||||
#include "Command.hxx"
|
||||
#include "FSNode.hxx"
|
||||
#include "bspf.hxx"
|
||||
|
||||
class BrowserDialog : public Dialog
|
||||
class BrowserDialog : public Dialog, public CommandSender
|
||||
{
|
||||
public:
|
||||
BrowserDialog(OSystem* osystem, DialogContainer* parent,
|
||||
const string& title, const string& startpath,
|
||||
uInt16 x, uInt16 y, uInt16 w, uInt16 h);
|
||||
|
||||
virtual void loadConfig();
|
||||
virtual void handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data);
|
||||
BrowserDialog(GuiObject* boss, int x, int y, int w, int h);
|
||||
|
||||
const FilesystemNode& getResult() { return _choice; }
|
||||
|
||||
void setTitle(const string& title) { _title->setLabel(title); }
|
||||
void setEmitSignal(int cmd) { _cmd = cmd; }
|
||||
void setStartPath(const string& startpath);
|
||||
|
||||
protected:
|
||||
virtual void handleCommand(CommandSender* sender, int cmd, int data);
|
||||
void updateListing();
|
||||
|
||||
protected:
|
||||
ListWidget* _fileList;
|
||||
StaticTextWidget* _currentPath;
|
||||
StaticTextWidget* _title;
|
||||
FilesystemNode _node;
|
||||
FSList _nodeContent;
|
||||
FilesystemNode _choice;
|
||||
string _startPath;
|
||||
|
||||
void updateListing();
|
||||
private:
|
||||
int _cmd;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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: Command.hxx,v 1.1 2005-03-10 22:59:40 stephena Exp $
|
||||
// $Id: Command.hxx,v 1.2 2005-05-13 18:28:05 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -28,7 +28,7 @@
|
|||
Allows base GUI objects to send and receive commands.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: Command.hxx,v 1.1 2005-03-10 22:59:40 stephena Exp $
|
||||
@version $Id: Command.hxx,v 1.2 2005-05-13 18:28:05 stephena Exp $
|
||||
*/
|
||||
class CommandReceiver;
|
||||
class CommandSender;
|
||||
|
@ -38,7 +38,7 @@ class CommandReceiver
|
|||
friend class CommandSender;
|
||||
|
||||
protected:
|
||||
virtual void handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data) {}
|
||||
virtual void handleCommand(CommandSender* sender, int cmd, int data) {}
|
||||
};
|
||||
|
||||
class CommandSender
|
||||
|
@ -52,7 +52,7 @@ class CommandSender
|
|||
void setTarget(CommandReceiver* target) { _target = target; }
|
||||
CommandReceiver* getTarget() const { return _target; }
|
||||
|
||||
virtual void sendCommand(uInt32 cmd, uInt32 data)
|
||||
virtual void sendCommand(int cmd, int data)
|
||||
{
|
||||
if(_target && cmd)
|
||||
_target->handleCommand(this, cmd, data);
|
||||
|
|
|
@ -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.13 2005-05-13 01:03:27 stephena Exp $
|
||||
// $Id: Dialog.cxx,v 1.14 2005-05-13 18:28:05 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Dialog::Dialog(OSystem* instance, DialogContainer* parent,
|
||||
uInt16 x, uInt16 y, uInt16 w, uInt16 h)
|
||||
int x, int y, int w, int h)
|
||||
: GuiObject(instance, parent, x, y, w, h),
|
||||
_mouseWidget(0),
|
||||
_focusedWidget(0),
|
||||
|
@ -193,7 +193,7 @@ void Dialog::handleMouseWheel(int x, int y, int direction)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Dialog::handleKeyDown(uInt16 ascii, Int32 keycode, Int32 modifiers)
|
||||
void Dialog::handleKeyDown(int ascii, int keycode, int modifiers)
|
||||
{
|
||||
if(_focusedWidget)
|
||||
if (_focusedWidget->handleKeyDown(ascii, keycode, modifiers))
|
||||
|
@ -220,7 +220,7 @@ void Dialog::handleKeyDown(uInt16 ascii, Int32 keycode, Int32 modifiers)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Dialog::handleKeyUp(uInt16 ascii, Int32 keycode, Int32 modifiers)
|
||||
void Dialog::handleKeyUp(int ascii, int keycode, int modifiers)
|
||||
{
|
||||
// Focused widget receives keyup events
|
||||
if(_focusedWidget)
|
||||
|
@ -286,7 +286,7 @@ void Dialog::handleTickle()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Dialog::handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data)
|
||||
void Dialog::handleCommand(CommandSender* sender, int cmd, int data)
|
||||
{
|
||||
switch(cmd)
|
||||
{
|
||||
|
@ -307,8 +307,8 @@ Widget* Dialog::findWidget(int x, int y)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
ButtonWidget* Dialog::addButton(Int32 x, Int32 y, const string& label,
|
||||
uInt32 cmd, char hotkey)
|
||||
ButtonWidget* Dialog::addButton(int x, int y, const string& label,
|
||||
int cmd, char hotkey)
|
||||
{
|
||||
return new ButtonWidget(this, x, y, kButtonWidth, 16, label, cmd, hotkey);
|
||||
}
|
||||
|
|
|
@ -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.11 2005-05-13 01:03:27 stephena Exp $
|
||||
// $Id: Dialog.hxx,v 1.12 2005-05-13 18:28:05 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -35,7 +35,7 @@ class DialogContainer;
|
|||
This is the base class for all dialog boxes.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: Dialog.hxx,v 1.11 2005-05-13 01:03:27 stephena Exp $
|
||||
@version $Id: Dialog.hxx,v 1.12 2005-05-13 18:28:05 stephena Exp $
|
||||
*/
|
||||
class Dialog : public GuiObject
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ class Dialog : public GuiObject
|
|||
|
||||
public:
|
||||
Dialog(OSystem* instance, DialogContainer* parent,
|
||||
uInt16 x, uInt16 y, uInt16 w, uInt16 h);
|
||||
int x, int y, int w, int h);
|
||||
|
||||
virtual ~Dialog();
|
||||
|
||||
|
@ -61,18 +61,18 @@ class Dialog : public GuiObject
|
|||
void releaseFocus();
|
||||
|
||||
virtual void handleTickle(); // Called periodically (in every guiloop() )
|
||||
virtual void handleKeyDown(uInt16 ascii, Int32 keycode, Int32 modifiers);
|
||||
virtual void handleKeyUp(uInt16 ascii, Int32 keycode, Int32 modifiers);
|
||||
virtual void handleKeyDown(int ascii, int keycode, int modifiers);
|
||||
virtual void handleKeyUp(int ascii, int keycode, int modifiers);
|
||||
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 handleCommand(CommandSender* sender, int cmd, int data);
|
||||
virtual void handleScreenChanged() {}
|
||||
|
||||
Widget* findWidget(int x, int y); // Find the widget at pos x,y if any
|
||||
|
||||
ButtonWidget* addButton(int x, int y, const string& label, uInt32 cmd, char hotkey);
|
||||
ButtonWidget* addButton(int x, int y, const string& label, int cmd, char hotkey);
|
||||
|
||||
void setResult(int result) { _result = result; }
|
||||
int getResult() const { return _result; }
|
||||
|
@ -82,7 +82,7 @@ class Dialog : public GuiObject
|
|||
Widget* _focusedWidget;
|
||||
Widget* _dragWidget;
|
||||
bool _visible;
|
||||
uInt32 _openCount;
|
||||
int _openCount;
|
||||
|
||||
private:
|
||||
int _result;
|
||||
|
|
|
@ -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: DialogContainer.cxx,v 1.2 2005-05-11 19:36:00 stephena Exp $
|
||||
// $Id: DialogContainer.cxx,v 1.3 2005-05-13 18:28:05 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "OSystem.hxx"
|
||||
|
@ -44,7 +44,7 @@ DialogContainer::~DialogContainer()
|
|||
void DialogContainer::draw()
|
||||
{
|
||||
// Draw all the dialogs on the stack
|
||||
for(Int32 i = 0; i < myDialogStack.size(); i++)
|
||||
for(int i = 0; i < myDialogStack.size(); i++)
|
||||
{
|
||||
myDialogStack[i]->open();
|
||||
myDialogStack[i]->drawDialog();
|
||||
|
@ -79,7 +79,7 @@ void DialogContainer::reStack()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DialogContainer::handleKeyEvent(uInt16 key, Int32 mod, uInt8 state)
|
||||
void DialogContainer::handleKeyEvent(int key, int mod, uInt8 state)
|
||||
{
|
||||
if(myDialogStack.empty())
|
||||
return;
|
||||
|
@ -93,7 +93,7 @@ void DialogContainer::handleKeyEvent(uInt16 key, Int32 mod, uInt8 state)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DialogContainer::handleMouseMotionEvent(Int32 x, Int32 y, Int32 button)
|
||||
void DialogContainer::handleMouseMotionEvent(int x, int y, int button)
|
||||
{
|
||||
if(myDialogStack.empty())
|
||||
return;
|
||||
|
@ -106,7 +106,7 @@ void DialogContainer::handleMouseMotionEvent(Int32 x, Int32 y, Int32 button)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DialogContainer::handleMouseButtonEvent(MouseButton b, Int32 x, Int32 y, uInt8 state)
|
||||
void DialogContainer::handleMouseButtonEvent(MouseButton b, int x, int y, uInt8 state)
|
||||
{
|
||||
if(myDialogStack.empty())
|
||||
return;
|
||||
|
@ -115,7 +115,7 @@ void DialogContainer::handleMouseButtonEvent(MouseButton b, Int32 x, Int32 y, uI
|
|||
Dialog* activeDialog = myDialogStack.top();
|
||||
|
||||
// Get the current time for detecting double clicks
|
||||
uInt32 time = myOSystem->getTicks() / 1000; // we only need millisecond precision
|
||||
int time = myOSystem->getTicks() / 1000; // we only need millisecond precision
|
||||
|
||||
switch(b)
|
||||
{
|
||||
|
|
|
@ -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: DialogContainer.hxx,v 1.1 2005-05-04 21:32:25 stephena Exp $
|
||||
// $Id: DialogContainer.hxx,v 1.2 2005-05-13 18:28:05 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef DIALOG_CONTAINER_HXX
|
||||
|
@ -37,7 +37,7 @@ typedef FixedStack<Dialog *> DialogStack;
|
|||
a stack, and handles their events.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: DialogContainer.hxx,v 1.1 2005-05-04 21:32:25 stephena Exp $
|
||||
@version $Id: DialogContainer.hxx,v 1.2 2005-05-13 18:28:05 stephena Exp $
|
||||
*/
|
||||
class DialogContainer
|
||||
{
|
||||
|
@ -60,7 +60,7 @@ class DialogContainer
|
|||
@param mod modifiers
|
||||
@param state state of key
|
||||
*/
|
||||
void handleKeyEvent(uInt16 key, Int32 mod, uInt8 state);
|
||||
void handleKeyEvent(int key, int mod, uInt8 state);
|
||||
|
||||
/**
|
||||
Handle a mouse motion event.
|
||||
|
@ -69,7 +69,7 @@ class DialogContainer
|
|||
@param y The y location
|
||||
@param button The currently pressed button
|
||||
*/
|
||||
void handleMouseMotionEvent(Int32 x, Int32 y, Int32 button);
|
||||
void handleMouseMotionEvent(int x, int y, int button);
|
||||
|
||||
/**
|
||||
Handle a mouse button event.
|
||||
|
@ -79,7 +79,7 @@ class DialogContainer
|
|||
@param y The y location
|
||||
@param state The state (pressed or released)
|
||||
*/
|
||||
void handleMouseButtonEvent(MouseButton b, Int32 x, Int32 y, uInt8 state);
|
||||
void handleMouseButtonEvent(MouseButton b, int x, int y, uInt8 state);
|
||||
|
||||
// FIXME - add joystick handler
|
||||
|
||||
|
@ -116,17 +116,17 @@ class DialogContainer
|
|||
|
||||
// For continuous events (keyDown)
|
||||
struct {
|
||||
uInt16 ascii;
|
||||
int ascii;
|
||||
uInt8 flags;
|
||||
uInt32 keycode;
|
||||
int keycode;
|
||||
} myCurrentKeyDown;
|
||||
uInt32 myKeyRepeatTime;
|
||||
int myKeyRepeatTime;
|
||||
|
||||
// Position and time of last mouse click (used to detect double clicks)
|
||||
struct {
|
||||
Int16 x, y; // Position of mouse when the click occured
|
||||
uInt32 time; // Time
|
||||
Int32 count; // How often was it already pressed?
|
||||
int x, y; // Position of mouse when the click occured
|
||||
int time; // Time
|
||||
int count; // How often was it already pressed?
|
||||
} myLastClick;
|
||||
};
|
||||
|
||||
|
|
|
@ -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: EventMappingDialog.cxx,v 1.8 2005-05-10 19:20:43 stephena Exp $
|
||||
// $Id: EventMappingDialog.cxx,v 1.9 2005-05-13 18:28:05 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -32,7 +32,7 @@
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
EventMappingDialog::EventMappingDialog(OSystem* osystem, DialogContainer* parent,
|
||||
uInt16 x, uInt16 y, uInt16 w, uInt16 h)
|
||||
int x, int y, int w, int h)
|
||||
: Dialog(osystem, parent, x, y, w, h),
|
||||
myActionSelected(-1),
|
||||
myRemapStatus(false)
|
||||
|
@ -147,7 +147,7 @@ void EventMappingDialog::drawKeyMapping()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventMappingDialog::handleKeyDown(uInt16 ascii, Int32 keycode, Int32 modifiers)
|
||||
void EventMappingDialog::handleKeyDown(int ascii, int keycode, int modifiers)
|
||||
{
|
||||
// Remap keys in remap mode, otherwise pass to listwidget
|
||||
if(myRemapStatus && myActionSelected >= 0)
|
||||
|
@ -162,7 +162,7 @@ void EventMappingDialog::handleKeyDown(uInt16 ascii, Int32 keycode, Int32 modifi
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventMappingDialog::handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data)
|
||||
void EventMappingDialog::handleCommand(CommandSender* sender, int cmd, int data)
|
||||
{
|
||||
switch(cmd)
|
||||
{
|
||||
|
|
|
@ -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: EventMappingDialog.hxx,v 1.5 2005-05-10 19:20:43 stephena Exp $
|
||||
// $Id: EventMappingDialog.hxx,v 1.6 2005-05-13 18:28:05 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -35,10 +35,10 @@ class EventMappingDialog : public Dialog
|
|||
{
|
||||
public:
|
||||
EventMappingDialog(OSystem* osystem, DialogContainer* parent,
|
||||
uInt16 x, uInt16 y, uInt16 w, uInt16 h);
|
||||
int x, int y, int w, int h);
|
||||
~EventMappingDialog();
|
||||
|
||||
virtual void handleKeyDown(uInt16 ascii, Int32 keycode, Int32 modifiers);
|
||||
virtual void handleKeyDown(int ascii, int keycode, int modifiers);
|
||||
|
||||
protected:
|
||||
ButtonWidget* myMapButton;
|
||||
|
@ -56,7 +56,7 @@ class EventMappingDialog : public Dialog
|
|||
kStopMapCmd = 'smap'
|
||||
};
|
||||
|
||||
virtual void handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data);
|
||||
virtual void handleCommand(CommandSender* sender, int cmd, int data);
|
||||
|
||||
void startRemapping();
|
||||
void eraseRemapping();
|
||||
|
@ -67,7 +67,7 @@ class EventMappingDialog : public Dialog
|
|||
|
||||
private:
|
||||
// Indicates the event that is currently selected
|
||||
Int32 myActionSelected;
|
||||
int myActionSelected;
|
||||
|
||||
// Indicates if we're currently in remap mode
|
||||
// In this mode, the next event received is remapped to some action
|
||||
|
|
|
@ -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.4 2005-05-10 19:20:43 stephena Exp $
|
||||
// $Id: GameInfoDialog.cxx,v 1.5 2005-05-13 18:28:05 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -30,7 +30,7 @@
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
GameInfoDialog::GameInfoDialog(OSystem* osystem, DialogContainer* parent,
|
||||
uInt16 x, uInt16 y, uInt16 w, uInt16 h)
|
||||
int x, int y, int w, int h)
|
||||
: Dialog(osystem, parent, x, y, w, h),
|
||||
myPage(1),
|
||||
myNumPages(2),
|
||||
|
@ -122,7 +122,7 @@ void GameInfoDialog::displayInfo()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void GameInfoDialog::handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data)
|
||||
void GameInfoDialog::handleCommand(CommandSender* sender, int cmd, int data)
|
||||
{
|
||||
switch(cmd)
|
||||
{
|
||||
|
|
|
@ -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.hxx,v 1.3 2005-05-10 19:20:43 stephena Exp $
|
||||
// $Id: GameInfoDialog.hxx,v 1.4 2005-05-13 18:28:05 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -41,7 +41,7 @@ class GameInfoDialog : public Dialog
|
|||
{
|
||||
public:
|
||||
GameInfoDialog(OSystem* osystem, DialogContainer* parent,
|
||||
uInt16 x, uInt16 y, uInt16 w, uInt16 h);
|
||||
int x, int y, int w, int h);
|
||||
~GameInfoDialog();
|
||||
|
||||
void setGameProfile(Properties& props) { myGameProperties = &props; }
|
||||
|
@ -58,7 +58,7 @@ class GameInfoDialog : public Dialog
|
|||
uInt8 myNumPages;
|
||||
|
||||
private:
|
||||
virtual void handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data);
|
||||
virtual void handleCommand(CommandSender* sender, int cmd, int data);
|
||||
virtual void updateStrings(uInt8 page, uInt8 lines,
|
||||
string& title, string*& key, string* &dsc);
|
||||
void displayInfo();
|
||||
|
|
|
@ -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: GameList.cxx,v 1.3 2005-05-11 23:06:52 stephena Exp $
|
||||
// $Id: GameList.cxx,v 1.4 2005-05-13 18:28:05 stephena Exp $
|
||||
//
|
||||
// Based on code from KStella - Stella frontend
|
||||
// Copyright (C) 2003-2005 Stephen Anthony
|
||||
|
@ -51,10 +51,10 @@ void GameList::sortByName()
|
|||
return;
|
||||
|
||||
// Simple selection sort
|
||||
for(uInt32 i = 0; i < myArray.size()-1; i++)
|
||||
for(unsigned int i = 0; i < myArray.size()-1; i++)
|
||||
{
|
||||
uInt32 min = i;
|
||||
for (uInt32 j = i+1; j < myArray.size(); j++)
|
||||
unsigned int min = i;
|
||||
for (unsigned int j = i+1; j < myArray.size(); j++)
|
||||
if (myArray[j]._name < myArray[min]._name)
|
||||
min = j;
|
||||
if (min != i)
|
||||
|
|
|
@ -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: GameList.hxx,v 1.2 2005-05-11 01:44:39 stephena Exp $
|
||||
// $Id: GameList.hxx,v 1.3 2005-05-13 18:28:05 stephena Exp $
|
||||
//
|
||||
// Based on code from KStella - Stella frontend
|
||||
// Copyright (C) 2003-2005 Stephen Anthony
|
||||
|
@ -45,10 +45,10 @@ class GameList
|
|||
GameList();
|
||||
~GameList();
|
||||
|
||||
inline const string& rom(Int32 i) { return myArray[i]._rom; }
|
||||
inline const string& name(Int32 i) { return myArray[i]._name; }
|
||||
inline const string& note(Int32 i) { return myArray[i]._note; }
|
||||
inline Int32 size() { return myArray.size(); }
|
||||
inline const string& rom(int i) { return myArray[i]._rom; }
|
||||
inline const string& name(int i) { return myArray[i]._name; }
|
||||
inline const string& note(int i) { return myArray[i]._note; }
|
||||
inline int size() { return myArray.size(); }
|
||||
|
||||
void clear() { myArray.clear(); }
|
||||
void appendGame(const string& rom, const string& name, const string& note);
|
||||
|
|
|
@ -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: GuiObject.hxx,v 1.6 2005-05-13 01:03:27 stephena Exp $
|
||||
// $Id: GuiObject.hxx,v 1.7 2005-05-13 18:28:05 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -33,7 +33,7 @@ class Widget;
|
|||
This is the base class for all GUI objects/widgets.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: GuiObject.hxx,v 1.6 2005-05-13 01:03:27 stephena Exp $
|
||||
@version $Id: GuiObject.hxx,v 1.7 2005-05-13 18:28:05 stephena Exp $
|
||||
*/
|
||||
class GuiObject : public CommandReceiver
|
||||
{
|
||||
|
@ -53,12 +53,12 @@ class GuiObject : public CommandReceiver
|
|||
OSystem* instance() { return myOSystem; }
|
||||
DialogContainer* parent() { return myParent; }
|
||||
|
||||
virtual Int16 getAbsX() const { return _x; }
|
||||
virtual Int16 getAbsY() const { return _y; }
|
||||
virtual Int16 getChildX() const { return getAbsX(); }
|
||||
virtual Int16 getChildY() const { return getAbsY(); }
|
||||
virtual uInt16 getWidth() const { return _w; }
|
||||
virtual uInt16 getHeight() const { return _h; }
|
||||
virtual int getAbsX() const { return _x; }
|
||||
virtual int getAbsY() const { return _y; }
|
||||
virtual int getChildX() const { return getAbsX(); }
|
||||
virtual int getChildY() const { return getAbsY(); }
|
||||
virtual int getWidth() const { return _w; }
|
||||
virtual int getHeight() const { return _h; }
|
||||
|
||||
virtual bool isVisible() const = 0;
|
||||
virtual void draw() = 0;
|
||||
|
@ -67,8 +67,8 @@ class GuiObject : public CommandReceiver
|
|||
OSystem* myOSystem;
|
||||
DialogContainer* myParent;
|
||||
|
||||
Int16 _x, _y;
|
||||
uInt16 _w, _h;
|
||||
int _x, _y;
|
||||
int _w, _h;
|
||||
|
||||
Widget* _firstWidget;
|
||||
|
||||
|
|
|
@ -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: HelpDialog.cxx,v 1.4 2005-05-10 19:20:43 stephena Exp $
|
||||
// $Id: HelpDialog.cxx,v 1.5 2005-05-13 18:28:05 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -29,7 +29,7 @@
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
HelpDialog::HelpDialog(OSystem* osystem, DialogContainer* parent,
|
||||
uInt16 x, uInt16 y, uInt16 w, uInt16 h)
|
||||
int x, int y, int w, int h)
|
||||
: Dialog(osystem, parent, x, y, w, h),
|
||||
myPage(1),
|
||||
myNumPages(4)
|
||||
|
@ -138,7 +138,7 @@ void HelpDialog::displayInfo()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void HelpDialog::handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data)
|
||||
void HelpDialog::handleCommand(CommandSender* sender, int cmd, int data)
|
||||
{
|
||||
switch(cmd)
|
||||
{
|
||||
|
|
|
@ -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: HelpDialog.hxx,v 1.2 2005-05-10 19:20:43 stephena Exp $
|
||||
// $Id: HelpDialog.hxx,v 1.3 2005-05-13 18:28:05 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -41,7 +41,7 @@ class HelpDialog : public Dialog
|
|||
{
|
||||
public:
|
||||
HelpDialog(OSystem* osystem, DialogContainer* parent,
|
||||
uInt16 x, uInt16 y, uInt16 w, uInt16 h);
|
||||
int x, int y, int w, int h);
|
||||
~HelpDialog();
|
||||
|
||||
protected:
|
||||
|
@ -56,7 +56,7 @@ class HelpDialog : public Dialog
|
|||
uInt8 myNumPages;
|
||||
|
||||
private:
|
||||
virtual void handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data);
|
||||
virtual void handleCommand(CommandSender* sender, int cmd, int data);
|
||||
virtual void updateStrings(uInt8 page, uInt8 lines,
|
||||
string& title, string*& key, string* &dsc);
|
||||
void displayInfo();
|
||||
|
|
|
@ -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: LauncherDialog.cxx,v 1.11 2005-05-13 01:03:27 stephena Exp $
|
||||
// $Id: LauncherDialog.cxx,v 1.12 2005-05-13 18:28:05 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -34,6 +34,7 @@
|
|||
#include "DialogContainer.hxx"
|
||||
#include "GuiUtils.hxx"
|
||||
#include "BrowserDialog.hxx"
|
||||
#include "LauncherOptionsDialog.hxx"
|
||||
#include "LauncherDialog.hxx"
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
@ -55,7 +56,7 @@ enum {
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
|
||||
uInt16 x, uInt16 y, uInt16 w, uInt16 h)
|
||||
int x, int y, int w, int h)
|
||||
: Dialog(osystem, parent, x, y, w, h),
|
||||
myList(NULL),
|
||||
myGameList(NULL)
|
||||
|
@ -111,12 +112,10 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
|
|||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
// Create file browser dialog
|
||||
string romdir = instance()->settings().getString("romdir");
|
||||
myBrowser = new BrowserDialog(osystem, parent, "Select ROM directory", romdir,
|
||||
20, 20, _w - 40, _h - 40);
|
||||
*/
|
||||
// Create the launcher options dialog, where you can change ROM
|
||||
// and snapshot paths
|
||||
myOptions = new LauncherOptionsDialog(osystem, parent, 20, 40, _w - 40, _h - 80);
|
||||
|
||||
// Create a game list, which contains all the information about a ROM that
|
||||
// the launcher needs
|
||||
myGameList = new GameList();
|
||||
|
@ -125,6 +124,7 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
LauncherDialog::~LauncherDialog()
|
||||
{
|
||||
delete myOptions;
|
||||
delete myGameList;
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ void LauncherDialog::updateListing(bool fullReload)
|
|||
|
||||
// Now fill the list widget with the contents of the GameList
|
||||
StringList l;
|
||||
for (Int32 i = 0; i < (Int32) myGameList->size(); ++i)
|
||||
for (int i = 0; i < (int) myGameList->size(); ++i)
|
||||
l.push_back(myGameList->name(i));
|
||||
|
||||
myList->setList(l);
|
||||
|
@ -281,7 +281,7 @@ void LauncherDialog::createListCache()
|
|||
ofstream out(cacheFile.c_str());
|
||||
|
||||
// Write the gamelist to the cachefile (sorting is already done)
|
||||
for (Int32 i = 0; i < (Int32) myGameList->size(); ++i)
|
||||
for (int i = 0; i < (int) myGameList->size(); ++i)
|
||||
{
|
||||
out << myGameList->rom(i) << "|"
|
||||
<< myGameList->name(i) << "|"
|
||||
|
@ -300,7 +300,7 @@ string LauncherDialog::MD5FromFile(const string& path)
|
|||
|
||||
uInt8* image = new uInt8[512 * 1024];
|
||||
in.read((char*)image, 512 * 1024);
|
||||
uInt32 size = in.gcount();
|
||||
int size = in.gcount();
|
||||
in.close();
|
||||
|
||||
string md5 = MD5(image, size);
|
||||
|
@ -310,9 +310,9 @@ string LauncherDialog::MD5FromFile(const string& path)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void LauncherDialog::handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data)
|
||||
void LauncherDialog::handleCommand(CommandSender* sender, int cmd, int data)
|
||||
{
|
||||
Int32 item;
|
||||
int item;
|
||||
|
||||
switch (cmd)
|
||||
{
|
||||
|
@ -328,8 +328,7 @@ void LauncherDialog::handleCommand(CommandSender* sender, uInt32 cmd, uInt32 dat
|
|||
break;
|
||||
|
||||
case kOptionsCmd:
|
||||
cerr << "add options to stack\n";
|
||||
// parent()->addDialog(myBrowser);
|
||||
parent()->addDialog(myOptions);
|
||||
break;
|
||||
|
||||
case kReloadCmd:
|
||||
|
|
|
@ -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: LauncherDialog.hxx,v 1.5 2005-05-13 01:03:27 stephena Exp $
|
||||
// $Id: LauncherDialog.hxx,v 1.6 2005-05-13 18:28:05 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -23,6 +23,7 @@
|
|||
#define LAUNCHER_DIALOG_HXX
|
||||
|
||||
class DialogContainer;
|
||||
class LauncherOptionsDialog;
|
||||
class CommandSender;
|
||||
class StaticTextWidget;
|
||||
class ListWidget;
|
||||
|
@ -36,10 +37,10 @@ class LauncherDialog : public Dialog
|
|||
{
|
||||
public:
|
||||
LauncherDialog(OSystem* osystem, DialogContainer* parent,
|
||||
uInt16 x, uInt16 y, uInt16 w, uInt16 h);
|
||||
int x, int y, int w, int h);
|
||||
~LauncherDialog();
|
||||
|
||||
virtual void handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data);
|
||||
virtual void handleCommand(CommandSender* sender, int cmd, int data);
|
||||
|
||||
protected:
|
||||
void updateListing(bool fullReload = false);
|
||||
|
@ -53,6 +54,8 @@ class LauncherDialog : public Dialog
|
|||
StaticTextWidget* myRomCount;
|
||||
GameList* myGameList;
|
||||
|
||||
LauncherOptionsDialog* myOptions;
|
||||
|
||||
private:
|
||||
void loadListFromDisk();
|
||||
void loadListFromCache();
|
||||
|
|
|
@ -13,209 +13,301 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: LauncherOptionsDialog.cxx,v 1.1 2005-05-13 01:03:27 stephena Exp $
|
||||
// $Id: LauncherOptionsDialog.cxx,v 1.2 2005-05-13 18:28:05 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
//============================================================================
|
||||
|
||||
#include "DialogContainer.hxx"
|
||||
#include "BrowserDialog.hxx"
|
||||
#include "gui/chooser.h"
|
||||
//#include "gui/options.h"
|
||||
#include "PopUpWidget.hxx"
|
||||
#include "TabWidget.hxx"
|
||||
|
||||
#include "FSNode.hxx"
|
||||
#include "bspf.hxx"
|
||||
#include "LauncherOptionsDialog.hxx"
|
||||
|
||||
enum {
|
||||
kChooseRomDirCmd = 'roms', // rom select
|
||||
kChooseSnapDirCmd = 'snps', // snap select
|
||||
kRomDirChosenCmd = 'romc', // rom chosen
|
||||
kSnapDirChosenCmd = 'snpc' // snap chosen
|
||||
};
|
||||
|
||||
OptionsDialog::OptionsDialog(const string& domain, int x, int y, int w, int h)
|
||||
: Dialog(x, y, w, h),
|
||||
_domain(domain)
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
LauncherOptionsDialog::LauncherOptionsDialog(
|
||||
OSystem* osystem, DialogContainer* parent,
|
||||
int x, int y, int w, int h)
|
||||
: Dialog(osystem, parent, x, y, w, h),
|
||||
myBrowser(NULL)
|
||||
{
|
||||
const int vBorder = 4;
|
||||
int yoffset;
|
||||
|
||||
const int vBorder = 4;
|
||||
int yoffset;
|
||||
// The tab widget
|
||||
TabWidget* tab = new TabWidget(this, 0, vBorder, _w, _h - 24 - 2 * vBorder);
|
||||
|
||||
// The tab widget
|
||||
TabWidget *tab = new TabWidget(this, 0, vBorder, _w, _h - 24 - 2 * vBorder);
|
||||
// 1) The ROM locations tab
|
||||
tab->addTab("ROM Settings");
|
||||
yoffset = vBorder;
|
||||
|
||||
// 1) The file locations tab
|
||||
//
|
||||
tab->addTab("File Locations");
|
||||
yoffset = vBorder;
|
||||
// ROM path
|
||||
new ButtonWidget(tab, 5, yoffset, kButtonWidth + 14, 16, "Path", kChooseRomDirCmd, 0);
|
||||
myRomPath = new StaticTextWidget(tab, 5 + kButtonWidth + 20, yoffset + 3, _w - (5 + kButtonWidth + 20) - 10, kLineHeight, "xxx", kTextAlignLeft);
|
||||
|
||||
// ROM path
|
||||
new ButtonWidget(tab, 5, yoffset, kButtonWidth + 14, 16, "ROM Path: ", kChooseSaveDirCmd, 0);
|
||||
_savePath = new StaticTextWidget(tab, 5 + kButtonWidth + 20, yoffset + 3, _w - (5 + kButtonWidth + 20) - 10, kLineHeight, "Enter valid path", kTextAlignLeft);
|
||||
yoffset += 18;
|
||||
// 2) The snapshot settings tab
|
||||
tab->addTab("Snapshot Settings");
|
||||
yoffset = vBorder;
|
||||
|
||||
// 2) The snapshot settings tab
|
||||
//
|
||||
tab->addTab("Snapshot Settings");
|
||||
yoffset = vBorder;
|
||||
// Save game path
|
||||
new ButtonWidget(tab, 5, yoffset, kButtonWidth + 14, 16, "Path", kChooseSnapDirCmd, 0);
|
||||
mySnapPath = new StaticTextWidget(tab, 5 + kButtonWidth + 20, yoffset + 3, _w - (5 + kButtonWidth + 20) - 10, kLineHeight, "yyy", kTextAlignLeft);
|
||||
yoffset += 18;
|
||||
|
||||
// Save game path
|
||||
new ButtonWidget(tab, 5, yoffset, kButtonWidth + 14, 16, "Save Path: ", kChooseSaveDirCmd, 0);
|
||||
_savePath = new StaticTextWidget(tab, 5 + kButtonWidth + 20, yoffset + 3, _w - (5 + kButtonWidth + 20) - 10, kLineHeight, "/foo/bar", kTextAlignLeft);
|
||||
|
||||
yoffset += 18;
|
||||
|
||||
new ButtonWidget(tab, 5, yoffset, kButtonWidth + 14, 16, "Extra Path:", kChooseExtraDirCmd, 0);
|
||||
_extraPath = new StaticTextWidget(tab, 5 + kButtonWidth + 20, yoffset + 3, _w - (5 + kButtonWidth + 20) - 10, kLineHeight, "None", kTextAlignLeft);
|
||||
yoffset += 18;
|
||||
// FIXME - add other snapshot stuff
|
||||
|
||||
/*
|
||||
//
|
||||
// 3) The miscellaneous tab
|
||||
//
|
||||
tab->addTab("Misc");
|
||||
yoffset = vBorder;
|
||||
|
||||
#if !( defined(__DC__) || defined(__GP32__) )
|
||||
// Save game path
|
||||
new ButtonWidget(tab, 5, yoffset, kButtonWidth + 14, 16, "Save Path: ", kChooseSaveDirCmd, 0);
|
||||
_savePath = new StaticTextWidget(tab, 5 + kButtonWidth + 20, yoffset + 3, _w - (5 + kButtonWidth + 20) - 10, kLineHeight, "/foo/bar", kTextAlignLeft);
|
||||
// Activate the first tab
|
||||
tab->setActiveTab(0);
|
||||
|
||||
yoffset += 18;
|
||||
|
||||
new ButtonWidget(tab, 5, yoffset, kButtonWidth + 14, 16, "Extra Path:", kChooseExtraDirCmd, 0);
|
||||
_extraPath = new StaticTextWidget(tab, 5 + kButtonWidth + 20, yoffset + 3, _w - (5 + kButtonWidth + 20) - 10, kLineHeight, "None", kTextAlignLeft);
|
||||
yoffset += 18;
|
||||
#endif
|
||||
|
||||
// TODO: joystick setting
|
||||
*/
|
||||
|
||||
// Activate the first tab
|
||||
tab->setActiveTab(0);
|
||||
|
||||
// Add OK & Cancel buttons
|
||||
addButton(_w - 2 *(kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
|
||||
addButton(_w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
|
||||
|
||||
// Create file browser dialog
|
||||
_browser = new BrowserDialog("Select directory for savegames");
|
||||
// Add OK & Cancel buttons
|
||||
addButton(_w - 2 *(kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
|
||||
addButton(_w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
|
||||
|
||||
// Create file browser dialog
|
||||
myBrowser = new BrowserDialog(this, 20, 20, _w - 40, _h - 40);
|
||||
}
|
||||
|
||||
GlobalOptionsDialog::~GlobalOptionsDialog() {
|
||||
delete _browser;
|
||||
}
|
||||
|
||||
void OptionsDialog::close()
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
LauncherOptionsDialog::~LauncherOptionsDialog()
|
||||
{
|
||||
delete myBrowser;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void LauncherOptionsDialog::loadConfig()
|
||||
{
|
||||
string romdir = instance()->settings().getString("romdir");
|
||||
string snapdir = instance()->settings().getString("ssdir");
|
||||
|
||||
myRomPath->setLabel(romdir);
|
||||
mySnapPath->setLabel(snapdir);
|
||||
/*
|
||||
if (getResult()) {
|
||||
if (_fullscreenCheckbox) {
|
||||
if (_enableGraphicSettings) {
|
||||
ConfMan.set("fullscreen", _fullscreenCheckbox->getState(), _domain);
|
||||
ConfMan.set("aspect_ratio", _aspectCheckbox->getState(), _domain);
|
||||
string s;
|
||||
bool b;
|
||||
int i;
|
||||
float f;
|
||||
|
||||
if ((int32)_gfxPopUp->getSelectedTag() >= 0)
|
||||
ConfMan.set("gfx_mode", _gfxPopUp->getSelectedString(), _domain);
|
||||
} else {
|
||||
ConfMan.removeKey("fullscreen", _domain);
|
||||
ConfMan.removeKey("aspect_ratio", _domain);
|
||||
ConfMan.removeKey("gfx_mode", _domain);
|
||||
}
|
||||
}
|
||||
// Driver setting
|
||||
myDriverPopup->setSelectedTag(0); // FIXME
|
||||
|
||||
if (_masterVolumeSlider) {
|
||||
if (_enableVolumeSettings) {
|
||||
ConfMan.set("master_volume", _masterVolumeSlider->getValue(), _domain);
|
||||
ConfMan.set("music_volume", _musicVolumeSlider->getValue(), _domain);
|
||||
ConfMan.set("sfx_volume", _sfxVolumeSlider->getValue(), _domain);
|
||||
ConfMan.set("speech_volume", _speechVolumeSlider->getValue(), _domain);
|
||||
} else {
|
||||
ConfMan.removeKey("master_volume", _domain);
|
||||
ConfMan.removeKey("music_volume", _domain);
|
||||
ConfMan.removeKey("sfx_volume", _domain);
|
||||
ConfMan.removeKey("speech_volume", _domain);
|
||||
}
|
||||
}
|
||||
// Renderer setting
|
||||
s = instance()->settings().getString("video");
|
||||
if(s == "soft")
|
||||
myRendererPopup->setSelectedTag(1);
|
||||
else if(s == "gl")
|
||||
myRendererPopup->setSelectedTag(2);
|
||||
|
||||
if (_multiMidiCheckbox) {
|
||||
if (_enableAudioSettings) {
|
||||
ConfMan.set("multi_midi", _multiMidiCheckbox->getState(), _domain);
|
||||
ConfMan.set("native_mt32", _mt32Checkbox->getState(), _domain);
|
||||
ConfMan.set("subtitles", _subCheckbox->getState(), _domain);
|
||||
const MidiDriverDescription *md = MidiDriver::getAvailableMidiDrivers();
|
||||
while (md->name && md->id != (int)_midiPopUp->getSelectedTag())
|
||||
md++;
|
||||
if (md->name)
|
||||
ConfMan.set("music_driver", md->name, _domain);
|
||||
else
|
||||
ConfMan.removeKey("music_driver", _domain);
|
||||
} else {
|
||||
ConfMan.removeKey("multi_midi", _domain);
|
||||
ConfMan.removeKey("native_mt32", _domain);
|
||||
ConfMan.removeKey("music_driver", _domain);
|
||||
ConfMan.removeKey("subtitles", _domain);
|
||||
}
|
||||
}
|
||||
// Filter setting
|
||||
s = instance()->settings().getString("gl_filter");
|
||||
if(s == "linear")
|
||||
myFilterPopup->setSelectedTag(1);
|
||||
else if(s == "nearest")
|
||||
myFilterPopup->setSelectedTag(2);
|
||||
|
||||
// Save config file
|
||||
ConfMan.flushToDisk();
|
||||
}
|
||||
// Aspect ratio - another huge hack
|
||||
s = instance()->settings().getString("gl_aspect");
|
||||
f = instance()->settings().getFloat("gl_aspect");
|
||||
if(f < 1.1)
|
||||
{
|
||||
f = 1.1;
|
||||
s = "1.1";
|
||||
}
|
||||
else if(f > 2.0)
|
||||
{
|
||||
f = 2.0;
|
||||
s = "2.0";
|
||||
}
|
||||
i = (int)((f * 10) - 10) * 10;
|
||||
myAspectRatioSlider->setValue(i);
|
||||
myAspectRatioLabel->setLabel(s);
|
||||
|
||||
// Palette
|
||||
s = instance()->settings().getString("palette");
|
||||
if(s == "standard")
|
||||
myPalettePopup->setSelectedTag(1);
|
||||
else if(s == "original")
|
||||
myPalettePopup->setSelectedTag(2);
|
||||
else if(s == "z26")
|
||||
myPalettePopup->setSelectedTag(3);
|
||||
|
||||
// Framerate
|
||||
myFrameRateSlider->setValue(instance()->settings().getInt("framerate"));
|
||||
myFrameRateLabel->setLabel(instance()->settings().getString("framerate"));
|
||||
|
||||
// Zoom
|
||||
i = (instance()->settings().getInt("zoom") - 1) * 10;
|
||||
myZoomSlider->setValue(i);
|
||||
myZoomLabel->setLabel(instance()->settings().getString("zoom"));
|
||||
|
||||
// Fullscreen
|
||||
b = instance()->settings().getBool("fullscreen");
|
||||
myFullscreenCheckbox->setState(b);
|
||||
|
||||
// Use desktop resolution in fullscreen mode
|
||||
b = instance()->settings().getBool("gl_fsmax");
|
||||
myUseDeskResCheckbox->setState(b);
|
||||
|
||||
// Make sure that mutually-exclusive items are not enabled at the same time
|
||||
i = myRendererPopup->getSelectedTag() - 1;
|
||||
handleRendererChange(i);
|
||||
*/
|
||||
Dialog::close();
|
||||
}
|
||||
|
||||
int OptionsDialog::addGraphicControls(GuiObject *boss, int yoffset) {
|
||||
const int x = 10;
|
||||
const int w = _w - 2 * 10;
|
||||
const OSystem::GraphicsMode *gm = g_system->getSupportedGraphicsModes();
|
||||
|
||||
// The GFX mode popup
|
||||
_gfxPopUp = new PopUpWidget(boss, x-5, yoffset, w+5, kLineHeight, "Graphics mode: ", 100);
|
||||
yoffset += 16;
|
||||
|
||||
_gfxPopUp->appendEntry("<default>");
|
||||
_gfxPopUp->appendEntry("");
|
||||
while (gm->name) {
|
||||
_gfxPopUp->appendEntry(gm->name, gm->id);
|
||||
gm++;
|
||||
}
|
||||
|
||||
// Fullscreen checkbox
|
||||
_fullscreenCheckbox = new CheckboxWidget(boss, x, yoffset, w, 16, "Fullscreen mode");
|
||||
yoffset += 16;
|
||||
|
||||
// Aspect ratio checkbox
|
||||
_aspectCheckbox = new CheckboxWidget(boss, x, yoffset, w, 16, "Aspect ratio correction");
|
||||
yoffset += 16;
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
_fullscreenCheckbox->setState(TRUE);
|
||||
_fullscreenCheckbox->setEnabled(FALSE);
|
||||
_aspectCheckbox->setEnabled(FALSE);
|
||||
#endif
|
||||
|
||||
_enableGraphicSettings = true;
|
||||
|
||||
return yoffset;
|
||||
}
|
||||
|
||||
void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
|
||||
switch (cmd) {
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void LauncherOptionsDialog::saveConfig()
|
||||
{
|
||||
cerr << "LauncherOptionsDialog::saveConfig()\n";
|
||||
/*
|
||||
case kChooseSaveDirCmd:
|
||||
if (_browser->runModal() > 0) {
|
||||
// User made his choice...
|
||||
FilesystemNode dir(_browser->getResult());
|
||||
_savePath->setLabel(dir.path());
|
||||
// TODO - we should check if the directory is writeable before accepting it
|
||||
}
|
||||
break;
|
||||
case kChooseExtraDirCmd:
|
||||
if (_browser->runModal() > 0) {
|
||||
// User made his choice...
|
||||
FilesystemNode dir(_browser->getResult());
|
||||
_extraPath->setLabel(dir.path());
|
||||
}
|
||||
break;
|
||||
string s;
|
||||
int i;
|
||||
bool b, restart = false;
|
||||
|
||||
// Driver setting
|
||||
s = myDriverPopup->getSelectedString();
|
||||
if(s != instance()->settings().getString("video_driver"))
|
||||
{
|
||||
instance()->settings().setString("video_driver", s);
|
||||
restart = true;
|
||||
}
|
||||
|
||||
// Renderer setting
|
||||
i = myRendererPopup->getSelectedTag();
|
||||
if(i == 1)
|
||||
s = "soft";
|
||||
else if(i == 2)
|
||||
s = "gl";
|
||||
if(s != instance()->settings().getString("video"))
|
||||
{
|
||||
instance()->settings().setString("video", s);
|
||||
restart = true;
|
||||
}
|
||||
|
||||
// Filter setting
|
||||
i = myFilterPopup->getSelectedTag();
|
||||
if(i == 1)
|
||||
s = "linear";
|
||||
else if(i == 2)
|
||||
s = "nearest";
|
||||
if(s != instance()->settings().getString("gl_filter"))
|
||||
{
|
||||
instance()->settings().setString("gl_filter", s);
|
||||
restart = true;
|
||||
}
|
||||
|
||||
// Aspect ratio
|
||||
s = myAspectRatioLabel->getLabel();
|
||||
if(s != instance()->settings().getString("gl_aspect"))
|
||||
{
|
||||
instance()->settings().setString("gl_aspect", s);
|
||||
restart = true;
|
||||
}
|
||||
|
||||
// Palette
|
||||
i = myPalettePopup->getSelectedTag();
|
||||
if(i == 1)
|
||||
instance()->settings().setString("palette", "standard");
|
||||
else if(i == 2)
|
||||
instance()->settings().setString("palette", "original");
|
||||
else if(i == 3)
|
||||
instance()->settings().setString("palette", "z26");
|
||||
s = myPalettePopup->getSelectedString();
|
||||
instance()->settings().setString("palette", s);
|
||||
instance()->console().togglePalette(s);
|
||||
|
||||
// Framerate
|
||||
i = myFrameRateSlider->getValue();
|
||||
instance()->setFramerate(i);
|
||||
|
||||
// Zoom
|
||||
i = (myZoomSlider->getValue() / 10) + 1;
|
||||
instance()->settings().setInt("zoom", i);
|
||||
instance()->frameBuffer().resize(GivenSize, i);
|
||||
|
||||
// Fullscreen (the setFullscreen method takes care of updating settings)
|
||||
b = myFullscreenCheckbox->getState();
|
||||
instance()->frameBuffer().setFullscreen(b);
|
||||
|
||||
// Use desktop resolution in fullscreen mode
|
||||
b = myUseDeskResCheckbox->getState();
|
||||
if(b != instance()->settings().getBool("gl_fsmax"))
|
||||
{
|
||||
instance()->settings().setBool("gl_fsmax", b);
|
||||
restart = true;
|
||||
}
|
||||
|
||||
// Finally, issue a complete framebuffer re-initialization
|
||||
// Not all options may require a full re-initialization, so we only
|
||||
// do it when necessary
|
||||
if(restart)
|
||||
instance()->createFrameBuffer();
|
||||
*/
|
||||
default:
|
||||
OptionsDialog::handleCommand(sender, cmd, data);
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void LauncherOptionsDialog::openRomBrowser()
|
||||
{
|
||||
myBrowser->setTitle("Select ROM directory:");
|
||||
myBrowser->setEmitSignal(kRomDirChosenCmd);
|
||||
myBrowser->setStartPath(myRomPath->getLabel());
|
||||
|
||||
parent()->addDialog(myBrowser);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void LauncherOptionsDialog::openSnapBrowser()
|
||||
{
|
||||
myBrowser->setTitle("Select snapshot directory:");
|
||||
myBrowser->setEmitSignal(kSnapDirChosenCmd);
|
||||
myBrowser->setStartPath(mySnapPath->getLabel());
|
||||
|
||||
parent()->addDialog(myBrowser);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void LauncherOptionsDialog::handleCommand(CommandSender* sender, int cmd, int data)
|
||||
{
|
||||
switch (cmd)
|
||||
{
|
||||
case kOKCmd:
|
||||
saveConfig();
|
||||
close();
|
||||
break;
|
||||
|
||||
case kChooseRomDirCmd:
|
||||
openRomBrowser();
|
||||
break;
|
||||
|
||||
case kChooseSnapDirCmd:
|
||||
openSnapBrowser();
|
||||
break;
|
||||
|
||||
case kRomDirChosenCmd:
|
||||
{
|
||||
FilesystemNode dir(myBrowser->getResult());
|
||||
myRomPath->setLabel(dir.path());
|
||||
break;
|
||||
}
|
||||
|
||||
case kSnapDirChosenCmd:
|
||||
{
|
||||
FilesystemNode dir(myBrowser->getResult());
|
||||
mySnapPath->setLabel(dir.path());
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
Dialog::handleCommand(sender, cmd, data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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: LauncherOptionsDialog.hxx,v 1.1 2005-05-13 01:03:27 stephena Exp $
|
||||
// $Id: LauncherOptionsDialog.hxx,v 1.2 2005-05-13 18:28:05 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -22,75 +22,41 @@
|
|||
#ifndef LAUNCHER_OPTIONS_DIALOG_HXX
|
||||
#define LAUNCHER_OPTIONS_DIALOG_HXX
|
||||
|
||||
#include "Dialog.hxx"
|
||||
|
||||
class OSystem;
|
||||
class DialogContainer;
|
||||
class BrowserDialog;
|
||||
class CheckboxWidget;
|
||||
class PopUpWidget;
|
||||
class SliderWidget;
|
||||
class StaticTextWidget;
|
||||
|
||||
#include "Dialog.hxx"
|
||||
|
||||
class LauncherOptionsDialog : public Dialog
|
||||
{
|
||||
public:
|
||||
LauncherOptionsDialog(const String &domain, int x, int y, int w, int h);
|
||||
LauncherOptionsDialog(OSystem* osystem, DialogContainer* parent,
|
||||
int x, int y, int w, int h);
|
||||
~LauncherOptionsDialog();
|
||||
|
||||
void open();
|
||||
void close();
|
||||
void handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data);
|
||||
virtual void loadConfig();
|
||||
virtual void saveConfig();
|
||||
|
||||
virtual void handleCommand(CommandSender* sender, int cmd, int data);
|
||||
|
||||
protected:
|
||||
BrowserDialog *myRomBrowser;
|
||||
BrowserDialog *mySnapBrowser;
|
||||
StaticTextWidget *_savePath;
|
||||
StaticTextWidget *_extraPath;
|
||||
BrowserDialog* myBrowser;
|
||||
|
||||
protected:
|
||||
/** Config domain this dialog is used to edit. */
|
||||
string _domain;
|
||||
|
||||
int addGraphicControls(GuiObject *boss, int yoffset);
|
||||
int addMIDIControls(GuiObject *boss, int yoffset);
|
||||
int addVolumeControls(GuiObject *boss, int yoffset);
|
||||
// Rom path controls
|
||||
StaticTextWidget* myRomPath;
|
||||
|
||||
void setGraphicSettingsState(bool enabled);
|
||||
void setAudioSettingsState(bool enabled);
|
||||
void setVolumeSettingsState(bool enabled);
|
||||
// Snapshot controls
|
||||
StaticTextWidget* mySnapPath;
|
||||
PopUpWidget* mySnapType;
|
||||
CheckboxWidget* mySnapSingle;
|
||||
|
||||
private:
|
||||
//
|
||||
// Graphics controls
|
||||
//
|
||||
bool _enableGraphicSettings;
|
||||
PopUpWidget *_gfxPopUp;
|
||||
CheckboxWidget *_fullscreenCheckbox;
|
||||
CheckboxWidget *_aspectCheckbox;
|
||||
|
||||
//
|
||||
// Audio controls
|
||||
//
|
||||
bool _enableAudioSettings;
|
||||
PopUpWidget *_midiPopUp;
|
||||
CheckboxWidget *_multiMidiCheckbox;
|
||||
CheckboxWidget *_mt32Checkbox;
|
||||
CheckboxWidget *_subCheckbox;
|
||||
|
||||
//
|
||||
// Volume controls
|
||||
//
|
||||
bool _enableVolumeSettings;
|
||||
|
||||
SliderWidget *_masterVolumeSlider;
|
||||
StaticTextWidget *_masterVolumeLabel;
|
||||
|
||||
SliderWidget *_musicVolumeSlider;
|
||||
StaticTextWidget *_musicVolumeLabel;
|
||||
|
||||
SliderWidget *_sfxVolumeSlider;
|
||||
StaticTextWidget *_sfxVolumeLabel;
|
||||
|
||||
SliderWidget *_speechVolumeSlider;
|
||||
StaticTextWidget *_speechVolumeLabel;
|
||||
void openRomBrowser();
|
||||
void openSnapBrowser();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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: ListWidget.cxx,v 1.7 2005-05-12 18:45:21 stephena Exp $
|
||||
// $Id: ListWidget.cxx,v 1.8 2005-05-13 18:28:05 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -32,7 +32,7 @@
|
|||
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
ListWidget::ListWidget(GuiObject* boss, Int32 x, Int32 y, Int32 w, Int32 h)
|
||||
ListWidget::ListWidget(GuiObject* boss, int x, int y, int w, int h)
|
||||
: Widget(boss, x, y, w - kScrollBarWidth, h),
|
||||
CommandSender(boss)
|
||||
{
|
||||
|
@ -63,13 +63,13 @@ ListWidget::~ListWidget()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void ListWidget::setSelected(Int32 item)
|
||||
void ListWidget::setSelected(int item)
|
||||
{
|
||||
assert(item >= -1 && item < (Int32)_list.size());
|
||||
assert(item >= -1 && item < (int)_list.size());
|
||||
|
||||
if(isEnabled() && _selectedItem != item)
|
||||
{
|
||||
Int32 oldSelectedItem = _selectedItem;
|
||||
int oldSelectedItem = _selectedItem;
|
||||
_selectedItem = item;
|
||||
|
||||
if (_editMode)
|
||||
|
@ -96,7 +96,7 @@ void ListWidget::setList(const StringList& list)
|
|||
if (_editMode && _caretVisible)
|
||||
drawCaret(true);
|
||||
|
||||
Int32 size = list.size();
|
||||
int size = list.size();
|
||||
_list = list;
|
||||
|
||||
if (_currentPos >= size)
|
||||
|
@ -109,9 +109,9 @@ void ListWidget::setList(const StringList& list)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void ListWidget::scrollTo(Int32 item)
|
||||
void ListWidget::scrollTo(int item)
|
||||
{
|
||||
Int32 size = _list.size();
|
||||
int size = _list.size();
|
||||
if (item >= size)
|
||||
item = size - 1;
|
||||
if (item < 0)
|
||||
|
@ -146,13 +146,13 @@ void ListWidget::handleTickle()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void ListWidget::handleMouseDown(Int32 x, Int32 y, Int32 button, Int32 clickCount)
|
||||
void ListWidget::handleMouseDown(int x, int y, int button, int clickCount)
|
||||
{
|
||||
if (isEnabled())
|
||||
{
|
||||
Int32 oldSelectedItem = _selectedItem;
|
||||
int oldSelectedItem = _selectedItem;
|
||||
_selectedItem = (y - 1) / kLineHeight + _currentPos;
|
||||
if (_selectedItem > (Int32)_list.size() - 1)
|
||||
if (_selectedItem > (int)_list.size() - 1)
|
||||
_selectedItem = -1;
|
||||
|
||||
if (oldSelectedItem != _selectedItem)
|
||||
|
@ -172,7 +172,7 @@ void ListWidget::handleMouseDown(Int32 x, Int32 y, Int32 button, Int32 clickCoun
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void ListWidget::handleMouseUp(Int32 x, Int32 y, Int32 button, Int32 clickCount)
|
||||
void ListWidget::handleMouseUp(int x, int y, int button, int clickCount)
|
||||
{
|
||||
// If this was a double click and the mouse is still over the selected item,
|
||||
// send the double click command
|
||||
|
@ -181,7 +181,7 @@ void ListWidget::handleMouseUp(Int32 x, Int32 y, Int32 button, Int32 clickCount)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void ListWidget::handleMouseWheel(Int32 x, Int32 y, Int32 direction)
|
||||
void ListWidget::handleMouseWheel(int x, int y, int direction)
|
||||
{
|
||||
_scrollBar->handleMouseWheel(x, y, direction);
|
||||
}
|
||||
|
@ -198,11 +198,11 @@ static bool matchingCharsIgnoringCase(string s, string pattern)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool ListWidget::handleKeyDown(uInt16 ascii, Int32 keycode, Int32 modifiers)
|
||||
bool ListWidget::handleKeyDown(int ascii, int keycode, int modifiers)
|
||||
{
|
||||
bool handled = true;
|
||||
bool dirty = false;
|
||||
Int32 oldSelectedItem = _selectedItem;
|
||||
int oldSelectedItem = _selectedItem;
|
||||
|
||||
if (!_editMode && isalpha((char)ascii))
|
||||
{
|
||||
|
@ -211,7 +211,7 @@ bool ListWidget::handleKeyDown(uInt16 ascii, Int32 keycode, Int32 modifiers)
|
|||
// Only works in a useful fashion if the list entries are sorted.
|
||||
// TODO: Maybe this should be off by default, and instead we add a
|
||||
// method "enableQuickSelect()" or so ?
|
||||
uInt32 time = instance()->getTicks() / 1000;
|
||||
int time = instance()->getTicks() / 1000;
|
||||
if (_quickSelectTime < time)
|
||||
_quickSelectStr = (char)ascii;
|
||||
else
|
||||
|
@ -343,7 +343,7 @@ bool ListWidget::handleKeyDown(uInt16 ascii, Int32 keycode, Int32 modifiers)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool ListWidget::handleKeyUp(uInt16 ascii, Int32 keycode, Int32 modifiers)
|
||||
bool ListWidget::handleKeyUp(int ascii, int keycode, int modifiers)
|
||||
{
|
||||
if (keycode == _currentKeyDown)
|
||||
_currentKeyDown = 0;
|
||||
|
@ -359,7 +359,7 @@ void ListWidget::lostFocusWidget()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void ListWidget::handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data)
|
||||
void ListWidget::handleCommand(CommandSender* sender, int cmd, int data)
|
||||
{
|
||||
switch (cmd)
|
||||
{
|
||||
|
@ -411,9 +411,9 @@ void ListWidget::drawWidget(bool hilite)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Int32 ListWidget::getCaretPos() const
|
||||
int ListWidget::getCaretPos() const
|
||||
{
|
||||
Int32 caretpos = 0;
|
||||
int caretpos = 0;
|
||||
FrameBuffer& fb = _boss->instance()->frameBuffer();
|
||||
|
||||
if (_numberingMode == kListNumberingZero || _numberingMode == kListNumberingOne)
|
||||
|
|
|
@ -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: ListWidget.hxx,v 1.2 2005-05-10 19:20:44 stephena Exp $
|
||||
// $Id: ListWidget.hxx,v 1.3 2005-05-13 18:28:06 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -47,28 +47,28 @@ enum {
|
|||
class ListWidget : public Widget, public CommandSender
|
||||
{
|
||||
public:
|
||||
ListWidget(GuiObject* boss, Int32 x, Int32 y, Int32 w, Int32 h);
|
||||
ListWidget(GuiObject* boss, int x, int y, int w, int h);
|
||||
virtual ~ListWidget();
|
||||
|
||||
void setList(const StringList& list);
|
||||
const StringList& getList() const { return _list; }
|
||||
Int32 getSelected() const { return _selectedItem; }
|
||||
void setSelected(Int32 item);
|
||||
int getSelected() const { return _selectedItem; }
|
||||
void setSelected(int item);
|
||||
const string& getSelectedString() const { return _list[_selectedItem]; }
|
||||
bool isEditable() const { return _editable; }
|
||||
void setEditable(bool editable) { _editable = editable; }
|
||||
void setNumberingMode(NumberingMode numberingMode) { _numberingMode = numberingMode; }
|
||||
void scrollTo(Int32 item);
|
||||
void scrollTo(int item);
|
||||
|
||||
virtual void handleTickle();
|
||||
virtual void handleMouseDown(Int32 x, Int32 y, Int32 button, Int32 clickCount);
|
||||
virtual void handleMouseUp(Int32 x, Int32 y, Int32 button, Int32 clickCount);
|
||||
virtual void handleMouseWheel(Int32 x, Int32 y, Int32 direction);
|
||||
virtual void handleMouseEntered(Int32 button) {};
|
||||
virtual void handleMouseLeft(Int32 button) {};
|
||||
virtual bool handleKeyDown(uInt16 ascii, Int32 keycode, Int32 modifiers);
|
||||
virtual bool handleKeyUp(uInt16 ascii, Int32 keycode, Int32 modifiers);
|
||||
virtual void handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data);
|
||||
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 handleMouseEntered(int button) {};
|
||||
virtual void handleMouseLeft(int button) {};
|
||||
virtual bool handleKeyDown(int ascii, int keycode, int modifiers);
|
||||
virtual bool handleKeyUp(int ascii, int keycode, int modifiers);
|
||||
virtual void handleCommand(CommandSender* sender, int cmd, int data);
|
||||
|
||||
virtual bool wantsFocus() { return true; };
|
||||
|
||||
|
@ -80,7 +80,7 @@ class ListWidget : public Widget, public CommandSender
|
|||
protected:
|
||||
void drawWidget(bool hilite);
|
||||
|
||||
Int32 getCaretPos() const;
|
||||
int getCaretPos() const;
|
||||
void drawCaret(bool erase);
|
||||
|
||||
void lostFocusWidget();
|
||||
|
@ -91,18 +91,18 @@ class ListWidget : public Widget, public CommandSender
|
|||
bool _editable;
|
||||
bool _editMode;
|
||||
NumberingMode _numberingMode;
|
||||
Int32 _currentPos;
|
||||
Int32 _entriesPerPage;
|
||||
Int32 _selectedItem;
|
||||
int _currentPos;
|
||||
int _entriesPerPage;
|
||||
int _selectedItem;
|
||||
ScrollBarWidget* _scrollBar;
|
||||
Int32 _currentKeyDown;
|
||||
int _currentKeyDown;
|
||||
string _backupString;
|
||||
|
||||
bool _caretVisible;
|
||||
uInt32 _caretTime;
|
||||
int _caretTime;
|
||||
|
||||
string _quickSelectStr;
|
||||
uInt32 _quickSelectTime;
|
||||
int _quickSelectTime;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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: OptionsDialog.cxx,v 1.15 2005-05-13 01:03:27 stephena Exp $
|
||||
// $Id: OptionsDialog.cxx,v 1.16 2005-05-13 18:28:06 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -76,9 +76,9 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent)
|
|||
addBigButton("Help", kHelpCmd, 'H');
|
||||
|
||||
// Set some sane values for the dialog boxes
|
||||
uInt16 fbWidth = osystem->frameBuffer().baseWidth();
|
||||
uInt16 fbHeight = osystem->frameBuffer().baseHeight();
|
||||
uInt16 x, y, w, h;
|
||||
int fbWidth = osystem->frameBuffer().baseWidth();
|
||||
int fbHeight = osystem->frameBuffer().baseHeight();
|
||||
int x, y, w, h;
|
||||
|
||||
// Now create all the dialogs attached to each menu button
|
||||
w = 230; h = 130;
|
||||
|
@ -118,8 +118,8 @@ OptionsDialog::~OptionsDialog()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void OptionsDialog::checkBounds(uInt16 width, uInt16 height,
|
||||
uInt16* x, uInt16* y, uInt16* w, uInt16* h)
|
||||
void OptionsDialog::checkBounds(int width, int height,
|
||||
int* x, int* y, int* w, int* h)
|
||||
{
|
||||
if(*w > width) *w = width;
|
||||
if(*h > height) *h = height;
|
||||
|
@ -128,7 +128,7 @@ void OptionsDialog::checkBounds(uInt16 width, uInt16 height,
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void OptionsDialog::handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data)
|
||||
void OptionsDialog::handleCommand(CommandSender* sender, int cmd, int data)
|
||||
{
|
||||
switch(cmd)
|
||||
{
|
||||
|
|
|
@ -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: OptionsDialog.hxx,v 1.5 2005-05-10 19:20:44 stephena Exp $
|
||||
// $Id: OptionsDialog.hxx,v 1.6 2005-05-13 18:28:06 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -42,7 +42,7 @@ class OptionsDialog : public Dialog
|
|||
OptionsDialog(OSystem* osystem, DialogContainer* parent);
|
||||
~OptionsDialog();
|
||||
|
||||
virtual void handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data);
|
||||
virtual void handleCommand(CommandSender* sender, int cmd, int data);
|
||||
|
||||
void setGameProfile(Properties& props) { myGameInfoDialog->setGameProfile(props); }
|
||||
|
||||
|
@ -55,8 +55,8 @@ class OptionsDialog : public Dialog
|
|||
HelpDialog* myHelpDialog;
|
||||
|
||||
private:
|
||||
void checkBounds(uInt16 width, uInt16 height,
|
||||
uInt16* x, uInt16* y, uInt16* w, uInt16* h);
|
||||
void checkBounds(int width, int height,
|
||||
int* x, int* y, int* w, int* h);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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: PopUpWidget.cxx,v 1.7 2005-05-13 01:03:27 stephena Exp $
|
||||
// $Id: PopUpWidget.cxx,v 1.8 2005-05-13 18:28:06 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -31,7 +31,7 @@
|
|||
#define UP_DOWN_BOX_HEIGHT 10
|
||||
|
||||
// Little up/down arrow
|
||||
static uInt32 up_down_arrows[8] = {
|
||||
static unsigned int up_down_arrows[8] = {
|
||||
0x00000000,
|
||||
0x00001000,
|
||||
0x00011100,
|
||||
|
@ -43,7 +43,7 @@ static uInt32 up_down_arrows[8] = {
|
|||
};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
PopUpDialog::PopUpDialog(PopUpWidget* boss, Int32 clickX, Int32 clickY)
|
||||
PopUpDialog::PopUpDialog(PopUpWidget* boss, int clickX, int clickY)
|
||||
: Dialog(boss->instance(), boss->parent(), 0, 0, 16, 16),
|
||||
_popUpBoss(boss)
|
||||
{
|
||||
|
@ -84,28 +84,28 @@ void PopUpDialog::drawDialog()
|
|||
fb.vLine(_x + _w - 1, _y, _y + _h - 1, kShadowColor);
|
||||
|
||||
// Draw the entries
|
||||
Int32 count = _popUpBoss->_entries.size();
|
||||
for(Int32 i = 0; i < count; i++)
|
||||
int count = _popUpBoss->_entries.size();
|
||||
for(int i = 0; i < count; i++)
|
||||
drawMenuEntry(i, i == _selection);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PopUpDialog::handleMouseDown(Int32 x, Int32 y, Int32 button, Int32 clickCount)
|
||||
void PopUpDialog::handleMouseDown(int x, int y, int button, int clickCount)
|
||||
{
|
||||
_clickX = -1;
|
||||
_clickY = -1;
|
||||
_openTime = (uInt32)-1;
|
||||
_openTime = (int)-1;
|
||||
|
||||
if(_popUpBoss->_cmd)
|
||||
_popUpBoss->sendCommand(_popUpBoss->_cmd, _selection);
|
||||
|
||||
// We remove the dialog and delete the dialog when the user has selected an item
|
||||
parent()->removeDialog();
|
||||
delete this;
|
||||
delete this; // FIXME - this is a memory leak
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PopUpDialog::handleMouseWheel(Int32 x, Int32 y, Int32 direction)
|
||||
void PopUpDialog::handleMouseWheel(int x, int y, int direction)
|
||||
{
|
||||
if(direction < 0)
|
||||
moveUp();
|
||||
|
@ -114,10 +114,10 @@ void PopUpDialog::handleMouseWheel(Int32 x, Int32 y, Int32 direction)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PopUpDialog::handleMouseMoved(Int32 x, Int32 y, Int32 button)
|
||||
void PopUpDialog::handleMouseMoved(int x, int y, int button)
|
||||
{
|
||||
// Compute over which item the mouse is...
|
||||
Int32 item = findItem(x, y);
|
||||
int item = findItem(x, y);
|
||||
|
||||
if(item >= 0 && _popUpBoss->_entries[item].name.size() == 0)
|
||||
item = -1;
|
||||
|
@ -130,7 +130,7 @@ void PopUpDialog::handleMouseMoved(Int32 x, Int32 y, Int32 button)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PopUpDialog::handleKeyDown(uInt16 ascii, Int32 keycode, Int32 modifiers)
|
||||
void PopUpDialog::handleKeyDown(int ascii, int keycode, int modifiers)
|
||||
{
|
||||
if(isMouseDown())
|
||||
return;
|
||||
|
@ -158,7 +158,7 @@ void PopUpDialog::handleKeyDown(uInt16 ascii, Int32 keycode, Int32 modifiers)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Int32 PopUpDialog::findItem(Int32 x, Int32 y) const
|
||||
int PopUpDialog::findItem(int x, int y) const
|
||||
{
|
||||
if(x >= 0 && x < _w && y >= 0 && y < _h)
|
||||
return (y-2) / kLineHeight;
|
||||
|
@ -167,7 +167,7 @@ Int32 PopUpDialog::findItem(Int32 x, Int32 y) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PopUpDialog::setSelection(Int32 item)
|
||||
void PopUpDialog::setSelection(int item)
|
||||
{
|
||||
if(item != _selection)
|
||||
{
|
||||
|
@ -206,7 +206,7 @@ void PopUpDialog::moveUp()
|
|||
}
|
||||
else if(_selection > 0)
|
||||
{
|
||||
Int32 item = _selection;
|
||||
int item = _selection;
|
||||
do {
|
||||
item--;
|
||||
} while (item >= 0 && _popUpBoss->_entries[item].name.size() == 0);
|
||||
|
@ -218,7 +218,7 @@ void PopUpDialog::moveUp()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PopUpDialog::moveDown()
|
||||
{
|
||||
Int32 lastItem = _popUpBoss->_entries.size() - 1;
|
||||
int lastItem = _popUpBoss->_entries.size() - 1;
|
||||
|
||||
if(_selection < 0)
|
||||
{
|
||||
|
@ -226,7 +226,7 @@ void PopUpDialog::moveDown()
|
|||
}
|
||||
else if(_selection < lastItem)
|
||||
{
|
||||
Int32 item = _selection;
|
||||
int item = _selection;
|
||||
do {
|
||||
item++;
|
||||
} while (item <= lastItem && _popUpBoss->_entries[item].name.size() == 0);
|
||||
|
@ -236,13 +236,13 @@ void PopUpDialog::moveDown()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PopUpDialog::drawMenuEntry(Int32 entry, bool hilite)
|
||||
void PopUpDialog::drawMenuEntry(int entry, bool hilite)
|
||||
{
|
||||
// Draw one entry of the popup menu, including selection
|
||||
assert(entry >= 0);
|
||||
Int32 x = _x + 1;
|
||||
Int32 y = _y + 1 + kLineHeight * entry;
|
||||
Int32 w = _w - 2;
|
||||
int x = _x + 1;
|
||||
int y = _y + 1 + kLineHeight * entry;
|
||||
int w = _w - 2;
|
||||
string& name = _popUpBoss->_entries[entry].name;
|
||||
|
||||
FrameBuffer& fb = _popUpBoss->instance()->frameBuffer();
|
||||
|
@ -261,8 +261,8 @@ void PopUpDialog::drawMenuEntry(Int32 entry, bool hilite)
|
|||
// PopUpWidget
|
||||
//
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
PopUpWidget::PopUpWidget(GuiObject* boss, Int32 x, Int32 y, Int32 w, Int32 h,
|
||||
const string& label, uInt32 labelWidth, Int32 cmd)
|
||||
PopUpWidget::PopUpWidget(GuiObject* boss, int x, int y, int w, int h,
|
||||
const string& label, int labelWidth, int cmd)
|
||||
: Widget(boss, x, y - 1, w, h + 2),
|
||||
CommandSender(boss),
|
||||
_label(label),
|
||||
|
@ -279,7 +279,7 @@ PopUpWidget::PopUpWidget(GuiObject* boss, Int32 x, Int32 y, Int32 w, Int32 h,
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PopUpWidget::handleMouseDown(Int32 x, Int32 y, Int32 button, Int32 clickCount)
|
||||
void PopUpWidget::handleMouseDown(int x, int y, int button, int clickCount)
|
||||
{
|
||||
if(isEnabled())
|
||||
{
|
||||
|
@ -289,7 +289,7 @@ void PopUpWidget::handleMouseDown(Int32 x, Int32 y, Int32 button, Int32 clickCou
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PopUpWidget::appendEntry(const string& entry, uInt32 tag)
|
||||
void PopUpWidget::appendEntry(const string& entry, int tag)
|
||||
{
|
||||
Entry e;
|
||||
e.name = entry;
|
||||
|
@ -305,7 +305,7 @@ void PopUpWidget::clearEntries()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PopUpWidget::setSelected(Int32 item)
|
||||
void PopUpWidget::setSelected(int item)
|
||||
{
|
||||
if(item != _selectedItem)
|
||||
{
|
||||
|
@ -317,9 +317,9 @@ void PopUpWidget::setSelected(Int32 item)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PopUpWidget::setSelectedTag(uInt32 tag)
|
||||
void PopUpWidget::setSelectedTag(int tag)
|
||||
{
|
||||
for(uInt32 item = 0; item < _entries.size(); ++item)
|
||||
for(unsigned int item = 0; item < _entries.size(); ++item)
|
||||
{
|
||||
if(_entries[item].tag == tag)
|
||||
{
|
||||
|
@ -334,8 +334,8 @@ void PopUpWidget::drawWidget(bool hilite)
|
|||
{
|
||||
FrameBuffer& fb = instance()->frameBuffer();
|
||||
|
||||
Int32 x = _x + _labelWidth;
|
||||
Int32 w = _w - _labelWidth;
|
||||
int x = _x + _labelWidth;
|
||||
int w = _w - _labelWidth;
|
||||
|
||||
// Draw the label, if any
|
||||
if (_labelWidth > 0)
|
||||
|
|
|
@ -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: PopUpWidget.hxx,v 1.3 2005-03-26 19:26:48 stephena Exp $
|
||||
// $Id: PopUpWidget.hxx,v 1.4 2005-05-13 18:28:06 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -47,41 +47,41 @@ class PopUpWidget : public Widget, public CommandSender
|
|||
|
||||
struct Entry {
|
||||
string name;
|
||||
uInt32 tag;
|
||||
int tag;
|
||||
};
|
||||
|
||||
typedef Array<Entry> EntryList;
|
||||
|
||||
protected:
|
||||
EntryList _entries;
|
||||
Int32 _selectedItem;
|
||||
int _selectedItem;
|
||||
string _label;
|
||||
uInt32 _labelWidth;
|
||||
int _labelWidth;
|
||||
|
||||
public:
|
||||
PopUpWidget(GuiObject* boss, Int32 x, Int32 y, Int32 w, Int32 h,
|
||||
const string& label, uInt32 labelWidth = 0, Int32 cmd = 0);
|
||||
PopUpWidget(GuiObject* boss, int x, int y, int w, int h,
|
||||
const string& label, int labelWidth = 0, int cmd = 0);
|
||||
|
||||
void handleMouseDown(Int32 x, Int32 y, Int32 button, Int32 clickCount);
|
||||
void handleMouseDown(int x, int y, int button, int clickCount);
|
||||
|
||||
void appendEntry(const string& entry, uInt32 tag = (uInt32)-1);
|
||||
void appendEntry(const string& entry, int tag = (int)-1);
|
||||
void clearEntries();
|
||||
|
||||
/** Select the entry at the given index. */
|
||||
void setSelected(Int32 item);
|
||||
void setSelected(int item);
|
||||
|
||||
/** Select the first entry matching the given tag. */
|
||||
void setSelectedTag(uInt32 tag);
|
||||
void setSelectedTag(int tag);
|
||||
|
||||
Int32 getSelected() const { return _selectedItem; }
|
||||
uInt32 getSelectedTag() const { return (_selectedItem >= 0) ? _entries[_selectedItem].tag : (uInt32)-1; }
|
||||
int getSelected() const { return _selectedItem; }
|
||||
int getSelectedTag() const { return (_selectedItem >= 0) ? _entries[_selectedItem].tag : (int)-1; }
|
||||
const string& getSelectedString() const { return (_selectedItem >= 0) ? _entries[_selectedItem].name : EmptyString; }
|
||||
|
||||
protected:
|
||||
void drawWidget(bool hilite);
|
||||
|
||||
protected:
|
||||
uInt32 _cmd;
|
||||
int _cmd;
|
||||
|
||||
private:
|
||||
PopUpDialog* myPopUpDialog;
|
||||
|
@ -94,26 +94,26 @@ class PopUpDialog : public Dialog
|
|||
{
|
||||
protected:
|
||||
PopUpWidget* _popUpBoss;
|
||||
Int32 _clickX, _clickY;
|
||||
int _clickX, _clickY;
|
||||
uInt8* _buffer;
|
||||
Int32 _selection;
|
||||
uInt32 _openTime;
|
||||
int _selection;
|
||||
int _openTime;
|
||||
|
||||
public:
|
||||
PopUpDialog(PopUpWidget* boss, Int32 clickX, Int32 clickY);
|
||||
PopUpDialog(PopUpWidget* boss, int clickX, int clickY);
|
||||
|
||||
void drawDialog();
|
||||
|
||||
void handleMouseDown(Int32 x, Int32 y, Int32 button, Int32 clickCount);
|
||||
void handleMouseWheel(Int32 x, Int32 y, Int32 direction); // Scroll through entries with scroll wheel
|
||||
void handleMouseMoved(Int32 x, Int32 y, Int32 button); // Redraw selections depending on mouse position
|
||||
void handleKeyDown(uInt16 ascii, Int32 keycode, Int32 modifiers); // Scroll through entries with arrow keys etc.
|
||||
void handleMouseDown(int x, int y, int button, int clickCount);
|
||||
void handleMouseWheel(int x, int y, int direction); // Scroll through entries with scroll wheel
|
||||
void handleMouseMoved(int x, int y, int button); // Redraw selections depending on mouse position
|
||||
void handleKeyDown(int ascii, int keycode, int modifiers); // Scroll through entries with arrow keys etc.
|
||||
|
||||
protected:
|
||||
void drawMenuEntry(Int32 entry, bool hilite);
|
||||
void drawMenuEntry(int entry, bool hilite);
|
||||
|
||||
Int32 findItem(Int32 x, Int32 y) const;
|
||||
void setSelection(Int32 item);
|
||||
int findItem(int x, int y) const;
|
||||
void setSelection(int item);
|
||||
bool isMouseDown();
|
||||
|
||||
void moveUp();
|
||||
|
|
|
@ -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: ScrollBarWidget.cxx,v 1.3 2005-05-10 19:20:44 stephena Exp $
|
||||
// $Id: ScrollBarWidget.cxx,v 1.4 2005-05-13 18:28:06 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -38,7 +38,7 @@
|
|||
#define UP_DOWN_BOX_HEIGHT 10
|
||||
|
||||
// Up arrow
|
||||
static uInt32 up_arrow[8] = {
|
||||
static unsigned int up_arrow[8] = {
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00001000,
|
||||
|
@ -50,7 +50,7 @@ static uInt32 up_arrow[8] = {
|
|||
};
|
||||
|
||||
// Down arrow
|
||||
static uInt32 down_arrow[8] = {
|
||||
static unsigned int down_arrow[8] = {
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00100010,
|
||||
|
@ -62,7 +62,7 @@ static uInt32 down_arrow[8] = {
|
|||
};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
ScrollBarWidget::ScrollBarWidget(GuiObject* boss, Int32 x, Int32 y, Int32 w, Int32 h)
|
||||
ScrollBarWidget::ScrollBarWidget(GuiObject* boss, int x, int y, int w, int h)
|
||||
: Widget(boss, x, y, w, h), CommandSender(boss)
|
||||
{
|
||||
_flags = WIDGET_ENABLED | WIDGET_TRACK_MOUSE | WIDGET_CLEARBG;
|
||||
|
@ -81,10 +81,10 @@ ScrollBarWidget::ScrollBarWidget(GuiObject* boss, Int32 x, Int32 y, Int32 w, Int
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void ScrollBarWidget::handleMouseDown(Int32 x, Int32 y, Int32 button,
|
||||
Int32 clickCount)
|
||||
void ScrollBarWidget::handleMouseDown(int x, int y, int button,
|
||||
int clickCount)
|
||||
{
|
||||
Int32 old_pos = _currentPos;
|
||||
int old_pos = _currentPos;
|
||||
|
||||
// Do nothing if there are less items than fit on one page
|
||||
if(_numEntries <= _entriesPerPage)
|
||||
|
@ -121,16 +121,16 @@ void ScrollBarWidget::handleMouseDown(Int32 x, Int32 y, Int32 button,
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void ScrollBarWidget::handleMouseUp(Int32 x, Int32 y, Int32 button,
|
||||
Int32 clickCount)
|
||||
void ScrollBarWidget::handleMouseUp(int x, int y, int button,
|
||||
int clickCount)
|
||||
{
|
||||
_draggingPart = kNoPart;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void ScrollBarWidget::handleMouseWheel(Int32 x, Int32 y, Int32 direction)
|
||||
void ScrollBarWidget::handleMouseWheel(int x, int y, int direction)
|
||||
{
|
||||
Int32 old_pos = _currentPos;
|
||||
int old_pos = _currentPos;
|
||||
|
||||
if(_numEntries < _entriesPerPage)
|
||||
return;
|
||||
|
@ -145,7 +145,7 @@ void ScrollBarWidget::handleMouseWheel(Int32 x, Int32 y, Int32 direction)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void ScrollBarWidget::handleMouseMoved(Int32 x, Int32 y, Int32 button)
|
||||
void ScrollBarWidget::handleMouseMoved(int x, int y, int button)
|
||||
{
|
||||
// Do nothing if there are less items than fit on one page
|
||||
if(_numEntries <= _entriesPerPage)
|
||||
|
@ -153,7 +153,7 @@ void ScrollBarWidget::handleMouseMoved(Int32 x, Int32 y, Int32 button)
|
|||
|
||||
if(_draggingPart == kSliderPart)
|
||||
{
|
||||
Int32 old_pos = _currentPos;
|
||||
int old_pos = _currentPos;
|
||||
_sliderPos = y - _sliderDeltaMouseDownPos;
|
||||
|
||||
if(_sliderPos < UP_DOWN_BOX_HEIGHT)
|
||||
|
@ -168,7 +168,7 @@ void ScrollBarWidget::handleMouseMoved(Int32 x, Int32 y, Int32 button)
|
|||
}
|
||||
else
|
||||
{
|
||||
Int32 old_part = _part;
|
||||
int old_part = _part;
|
||||
|
||||
if(y <= UP_DOWN_BOX_HEIGHT) // Up arrow
|
||||
_part = kUpArrowPart;
|
||||
|
@ -213,7 +213,7 @@ void ScrollBarWidget::handleTickle() {
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void ScrollBarWidget::checkBounds(Int32 old_pos)
|
||||
void ScrollBarWidget::checkBounds(int old_pos)
|
||||
{
|
||||
if(_numEntries <= _entriesPerPage || _currentPos < 0)
|
||||
_currentPos = 0;
|
||||
|
|
|
@ -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: ScrollBarWidget.hxx,v 1.1 2005-04-04 02:19:22 stephena Exp $
|
||||
// $Id: ScrollBarWidget.hxx,v 1.2 2005-05-13 18:28:06 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -41,14 +41,14 @@ class ScrollBarWidget : public Widget, public CommandSender
|
|||
} Part;
|
||||
|
||||
public:
|
||||
ScrollBarWidget(GuiObject* boss, Int32 x, Int32 y, Int32 w, Int32 h);
|
||||
ScrollBarWidget(GuiObject* boss, int x, int y, int w, int h);
|
||||
|
||||
virtual void handleMouseDown(Int32 x, Int32 y, Int32 button, Int32 clickCount);
|
||||
virtual void handleMouseUp(Int32 x, Int32 y, Int32 button, Int32 clickCount);
|
||||
virtual void handleMouseWheel(Int32 x, Int32 y, Int32 direction);
|
||||
virtual void handleMouseMoved(Int32 x, Int32 y, Int32 button);
|
||||
virtual void handleMouseEntered(Int32 button) { setFlags(WIDGET_HILITED); }
|
||||
virtual void handleMouseLeft(Int32 button) { clearFlags(WIDGET_HILITED); _part = kNoPart; draw(); }
|
||||
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 handleMouseEntered(int button) { setFlags(WIDGET_HILITED); }
|
||||
virtual void handleMouseLeft(int button) { clearFlags(WIDGET_HILITED); _part = kNoPart; draw(); }
|
||||
virtual void handleTickle();
|
||||
|
||||
// FIXME - this should be private, but then we also have to add accessors
|
||||
|
@ -57,9 +57,9 @@ class ScrollBarWidget : public Widget, public CommandSender
|
|||
void recalc();
|
||||
|
||||
public:
|
||||
Int32 _numEntries;
|
||||
Int32 _entriesPerPage;
|
||||
Int32 _currentPos;
|
||||
int _numEntries;
|
||||
int _entriesPerPage;
|
||||
int _currentPos;
|
||||
|
||||
protected:
|
||||
void drawWidget(bool hilite);
|
||||
|
@ -67,10 +67,10 @@ class ScrollBarWidget : public Widget, public CommandSender
|
|||
|
||||
protected:
|
||||
Part _part;
|
||||
Int32 _sliderHeight;
|
||||
Int32 _sliderPos;
|
||||
int _sliderHeight;
|
||||
int _sliderPos;
|
||||
Part _draggingPart;
|
||||
Int32 _sliderDeltaMouseDownPos;
|
||||
int _sliderDeltaMouseDownPos;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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: StellaFont.cxx,v 1.2 2005-04-29 19:05:06 stephena Exp $
|
||||
// $Id: StellaFont.cxx,v 1.3 2005-05-13 18:28:06 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -46,7 +46,7 @@ StellaFont::StellaFont(FrameBuffer* buffer)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Int32 StellaFont::getCharWidth(uInt8 chr) const
|
||||
int StellaFont::getCharWidth(uInt8 chr) const
|
||||
{
|
||||
// If no width table is specified, return the maximum width
|
||||
if(!myFontDesc.width)
|
||||
|
@ -64,24 +64,24 @@ Int32 StellaFont::getCharWidth(uInt8 chr) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Int32 StellaFont::getStringWidth(const string& str) const
|
||||
int StellaFont::getStringWidth(const string& str) const
|
||||
{
|
||||
Int32 space = 0;
|
||||
int space = 0;
|
||||
|
||||
for(uInt32 i = 0; i < str.size(); ++i)
|
||||
for(unsigned int i = 0; i < str.size(); ++i)
|
||||
space += getCharWidth(str[i]);
|
||||
|
||||
return space;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void StellaFont::drawString(const string& s, uInt32 x, uInt32 y, uInt32 w,
|
||||
void StellaFont::drawString(const string& s, int x, int y, int w,
|
||||
OverlayColor color, TextAlignment align,
|
||||
Int32 deltax, bool useEllipsis) const
|
||||
int deltax, bool useEllipsis) const
|
||||
{
|
||||
const uInt32 leftX = x, rightX = x + w;
|
||||
uInt32 i;
|
||||
uInt32 width = getStringWidth(s);
|
||||
const int leftX = x, rightX = x + w;
|
||||
unsigned int i;
|
||||
int width = getStringWidth(s);
|
||||
string str;
|
||||
|
||||
if(useEllipsis && width > w)
|
||||
|
|
|
@ -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: StellaFont.hxx,v 1.2 2005-04-29 19:05:06 stephena Exp $
|
||||
// $Id: StellaFont.hxx,v 1.3 2005-05-13 18:28:06 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -39,15 +39,15 @@ enum TextAlignment {
|
|||
struct FontDesc
|
||||
{
|
||||
const char* name; /* font name */
|
||||
Int32 maxwidth; /* max width in pixels */
|
||||
Int32 height; /* height in pixels */
|
||||
Int32 ascent; /* ascent (baseline) height */
|
||||
Int32 firstchar; /* first character in bitmap */
|
||||
Int32 size; /* font size in glyphs */
|
||||
int maxwidth; /* max width in pixels */
|
||||
int height; /* height in pixels */
|
||||
int ascent; /* ascent (baseline) height */
|
||||
int firstchar; /* first character in bitmap */
|
||||
int size; /* font size in glyphs */
|
||||
const uInt16* bits; /* 16-bit right-padded bitmap data */
|
||||
const uInt32* offset; /* offsets into bitmap data */
|
||||
const int* offset; /* offsets into bitmap data */
|
||||
const uInt8* width; /* character widths or NULL if fixed */
|
||||
Int32 defaultchar; /* default char (not glyph index) */
|
||||
int defaultchar; /* default char (not glyph index) */
|
||||
long bits_size; /* # words of bitmap_t bits */
|
||||
};
|
||||
|
||||
|
@ -58,15 +58,15 @@ class StellaFont
|
|||
|
||||
const FontDesc& desc() { return myFontDesc; }
|
||||
|
||||
Int32 getFontHeight() const { return myFontDesc.height; }
|
||||
Int32 getMaxCharWidth() const { return myFontDesc.maxwidth; }
|
||||
int getFontHeight() const { return myFontDesc.height; }
|
||||
int getMaxCharWidth() const { return myFontDesc.maxwidth; }
|
||||
|
||||
Int32 getCharWidth(uInt8 chr) const;
|
||||
int getCharWidth(uInt8 chr) const;
|
||||
|
||||
Int32 getStringWidth(const string& str) const;
|
||||
void drawString(const string& str, uInt32 x, uInt32 y, uInt32 w,
|
||||
int getStringWidth(const string& str) const;
|
||||
void drawString(const string& str, int x, int y, int w,
|
||||
OverlayColor color, TextAlignment align = kTextAlignLeft,
|
||||
Int32 deltax = 0, bool useEllipsis = true) const;
|
||||
int deltax = 0, bool useEllipsis = true) const;
|
||||
|
||||
protected:
|
||||
FrameBuffer* myFrameBuffer;
|
||||
|
|
|
@ -1,177 +1,208 @@
|
|||
/* ScummVM - Scumm Interpreter
|
||||
* Copyright (C) 2002-2004 The ScummVM project
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Header: /home/stephena/STELLA_CVS-to-SVN/stella/src/gui/TabWidget.cxx,v 1.1 2005-05-13 01:03:27 stephena Exp $
|
||||
*/
|
||||
//============================================================================
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// $Id: TabWidget.cxx,v 1.2 2005-05-13 18:28:06 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
//============================================================================
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "common/util.h"
|
||||
#include "gui/TabWidget.h"
|
||||
#include "gui/dialog.h"
|
||||
#include "gui/newgui.h"
|
||||
|
||||
namespace GUI {
|
||||
#include "OSystem.hxx"
|
||||
#include "FrameBuffer.hxx"
|
||||
#include "GuiUtils.hxx"
|
||||
#include "bspf.hxx"
|
||||
#include "GuiObject.hxx"
|
||||
#include "Widget.hxx"
|
||||
#include "TabWidget.hxx"
|
||||
|
||||
enum {
|
||||
kTabHeight = 16,
|
||||
kTabHeight = 16,
|
||||
|
||||
kTabLeftOffset = 4,
|
||||
kTabSpacing = 2,
|
||||
kTabPadding = 3
|
||||
kTabLeftOffset = 4,
|
||||
kTabSpacing = 2,
|
||||
kTabPadding = 3
|
||||
};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
TabWidget::TabWidget(GuiObject *boss, int x, int y, int w, int h)
|
||||
: Widget(boss, x, y, w, h) {
|
||||
: Widget(boss, x, y, w, h),
|
||||
CommandSender(boss)
|
||||
{
|
||||
_flags = WIDGET_ENABLED;
|
||||
_type = kTabWidget;
|
||||
_activeTab = -1;
|
||||
|
||||
_flags = WIDGET_ENABLED;
|
||||
_type = kTabWidget;
|
||||
_activeTab = -1;
|
||||
|
||||
_tabWidth = 40;
|
||||
_tabWidth = 40;
|
||||
}
|
||||
|
||||
TabWidget::~TabWidget() {
|
||||
for (uint i = 0; i < _tabs.size(); ++i) {
|
||||
delete _tabs[i].firstWidget;
|
||||
_tabs[i].firstWidget = 0;
|
||||
}
|
||||
_tabs.clear();
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
TabWidget::~TabWidget()
|
||||
{
|
||||
for (unsigned int i = 0; i < _tabs.size(); ++i)
|
||||
{
|
||||
delete _tabs[i].firstWidget;
|
||||
_tabs[i].firstWidget = 0;
|
||||
}
|
||||
_tabs.clear();
|
||||
}
|
||||
|
||||
int16 TabWidget::getChildY() const {
|
||||
return getAbsY() + kTabHeight;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
int TabWidget::getChildY() const
|
||||
{
|
||||
return getAbsY() + kTabHeight;
|
||||
}
|
||||
|
||||
int TabWidget::addTab(const String &title) {
|
||||
// Add a new tab page
|
||||
Tab newTab;
|
||||
newTab.title = title;
|
||||
newTab.firstWidget = NULL;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
int TabWidget::addTab(const string& title)
|
||||
{
|
||||
FrameBuffer& fb = instance()->frameBuffer();
|
||||
|
||||
_tabs.push_back(newTab);
|
||||
// Add a new tab page
|
||||
Tab newTab;
|
||||
newTab.title = title;
|
||||
newTab.firstWidget = NULL;
|
||||
|
||||
int numTabs = _tabs.size();
|
||||
_tabs.push_back(newTab);
|
||||
|
||||
// Determine the new tab width
|
||||
int newWidth = g_gui.getStringWidth(title) + 2 * kTabPadding;
|
||||
if (_tabWidth < newWidth)
|
||||
_tabWidth = newWidth;
|
||||
int maxWidth = (_w - kTabLeftOffset) / numTabs - kTabLeftOffset;
|
||||
if (_tabWidth > maxWidth)
|
||||
_tabWidth = maxWidth;
|
||||
int numTabs = _tabs.size();
|
||||
|
||||
// Activate the new tab
|
||||
setActiveTab(numTabs - 1);
|
||||
// Determine the new tab width
|
||||
int newWidth = fb.font().getStringWidth(title) + 2 * kTabPadding;
|
||||
if (_tabWidth < newWidth)
|
||||
_tabWidth = newWidth;
|
||||
|
||||
return _activeTab;
|
||||
int maxWidth = (_w - kTabLeftOffset) / numTabs - kTabLeftOffset;
|
||||
if (_tabWidth > maxWidth)
|
||||
_tabWidth = maxWidth;
|
||||
|
||||
// Activate the new tab
|
||||
setActiveTab(numTabs - 1);
|
||||
|
||||
return _activeTab;
|
||||
}
|
||||
|
||||
void TabWidget::setActiveTab(int tabID) {
|
||||
assert(0 <= tabID && tabID < (int)_tabs.size());
|
||||
if (_activeTab != tabID) {
|
||||
// Exchange the widget lists, and switch to the new tab
|
||||
if (_activeTab != -1)
|
||||
_tabs[_activeTab].firstWidget = _firstWidget;
|
||||
_activeTab = tabID;
|
||||
_firstWidget = _tabs[tabID].firstWidget;
|
||||
_boss->draw();
|
||||
}
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TabWidget::setActiveTab(int tabID)
|
||||
{
|
||||
assert(0 <= tabID && tabID < (int)_tabs.size());
|
||||
if (_activeTab != tabID)
|
||||
{
|
||||
// Exchange the widget lists, and switch to the new tab
|
||||
if (_activeTab != -1)
|
||||
_tabs[_activeTab].firstWidget = _firstWidget;
|
||||
|
||||
_activeTab = tabID;
|
||||
_firstWidget = _tabs[tabID].firstWidget;
|
||||
_boss->draw();
|
||||
|
||||
_boss->instance()->frameBuffer().refresh();
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TabWidget::handleMouseDown(int x, int y, int button, int clickCount)
|
||||
{
|
||||
assert(y < kTabHeight);
|
||||
|
||||
void TabWidget::handleMouseDown(int x, int y, int button, int clickCount) {
|
||||
assert(y < kTabHeight);
|
||||
// Determine which tab was clicked
|
||||
int tabID = -1;
|
||||
x -= kTabLeftOffset;
|
||||
if (x >= 0 && x % (_tabWidth + kTabSpacing) < _tabWidth)
|
||||
{
|
||||
tabID = x / (_tabWidth + kTabSpacing);
|
||||
if (tabID >= (int)_tabs.size())
|
||||
tabID = -1;
|
||||
}
|
||||
|
||||
// Determine which tab was clicked
|
||||
int tabID = -1;
|
||||
x -= kTabLeftOffset;
|
||||
if (x >= 0 && x % (_tabWidth + kTabSpacing) < _tabWidth) {
|
||||
tabID = x / (_tabWidth + kTabSpacing);
|
||||
if (tabID >= (int)_tabs.size())
|
||||
tabID = -1;
|
||||
}
|
||||
|
||||
// If a tab was clicked, switch to that pane
|
||||
if (tabID >= 0) {
|
||||
setActiveTab(tabID);
|
||||
}
|
||||
// If a tab was clicked, switch to that pane
|
||||
if (tabID >= 0)
|
||||
setActiveTab(tabID);
|
||||
}
|
||||
|
||||
bool TabWidget::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
|
||||
// TODO: maybe there should be a way to switch between tabs
|
||||
// using the keyboard? E.g. Alt-Shift-Left/Right-Arrow or something
|
||||
// like that.
|
||||
return Widget::handleKeyDown(ascii, keycode, modifiers);
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool TabWidget::handleKeyDown(int ascii, int keycode, int modifiers)
|
||||
{
|
||||
// TODO: maybe there should be a way to switch between tabs
|
||||
// using the keyboard? E.g. Alt-Shift-Left/Right-Arrow or something
|
||||
// like that.
|
||||
return Widget::handleKeyDown(ascii, keycode, modifiers);
|
||||
}
|
||||
|
||||
static void box(int x, int y, int width, int height, OverlayColor colorA, OverlayColor colorB, bool omitBottom) {
|
||||
NewGui &gui = g_gui;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TabWidget::box(int x, int y, int width, int height,
|
||||
OverlayColor colorA, OverlayColor colorB, bool omitBottom)
|
||||
{
|
||||
FrameBuffer& fb = _boss->instance()->frameBuffer();
|
||||
|
||||
gui.hLine(x + 1, y, x + width - 2, colorA);
|
||||
gui.hLine(x, y + 1, x + width - 1, colorA);
|
||||
gui.vLine(x, y + 1, y + height - (omitBottom ? 1 : 2), colorA);
|
||||
gui.vLine(x + 1, y, y + height - (omitBottom ? 2 : 1), colorA);
|
||||
fb.hLine(x + 1, y, x + width - 2, colorA);
|
||||
fb.hLine(x, y + 1, x + width - 1, colorA);
|
||||
fb.vLine(x, y + 1, y + height - (omitBottom ? 1 : 2), colorA);
|
||||
fb.vLine(x + 1, y, y + height - (omitBottom ? 2 : 1), colorA);
|
||||
|
||||
if (!omitBottom) {
|
||||
gui.hLine(x + 1, y + height - 2, x + width - 1, colorB);
|
||||
gui.hLine(x + 1, y + height - 1, x + width - 2, colorB);
|
||||
}
|
||||
gui.vLine(x + width - 1, y + 1, y + height - (omitBottom ? 1 : 2), colorB);
|
||||
gui.vLine(x + width - 2, y + 1, y + height - (omitBottom ? 2 : 1), colorB);
|
||||
if (!omitBottom)
|
||||
{
|
||||
fb.hLine(x + 1, y + height - 2, x + width - 1, colorB);
|
||||
fb.hLine(x + 1, y + height - 1, x + width - 2, colorB);
|
||||
}
|
||||
fb.vLine(x + width - 1, y + 1, y + height - (omitBottom ? 1 : 2), colorB);
|
||||
fb.vLine(x + width - 2, y + 1, y + height - (omitBottom ? 2 : 1), colorB);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TabWidget::drawWidget(bool hilite)
|
||||
{
|
||||
FrameBuffer& fb = instance()->frameBuffer();
|
||||
|
||||
void TabWidget::drawWidget(bool hilite) {
|
||||
NewGui *gui = &g_gui;
|
||||
const int left1 = _x + 1;
|
||||
const int right1 = _x + kTabLeftOffset + _activeTab * (_tabWidth + kTabSpacing);
|
||||
const int left2 = right1 + _tabWidth;
|
||||
const int right2 = _x + _w - 2;
|
||||
|
||||
const int left1 = _x + 1;
|
||||
const int right1 = _x + kTabLeftOffset + _activeTab * (_tabWidth + kTabSpacing);
|
||||
const int left2 = right1 + _tabWidth;
|
||||
const int right2 = _x + _w - 2;
|
||||
|
||||
// Draw horizontal line
|
||||
gui->hLine(left1, _y + kTabHeight - 2, right1, gui->_shadowcolor);
|
||||
gui->hLine(left2, _y + kTabHeight - 2, right2, gui->_shadowcolor);
|
||||
// Draw horizontal line
|
||||
fb.hLine(left1, _y + kTabHeight - 2, right1, kShadowColor);
|
||||
fb.hLine(left2, _y + kTabHeight - 2, right2, kShadowColor);
|
||||
|
||||
// Iterate over all tabs and draw them
|
||||
int i, x = _x + kTabLeftOffset;
|
||||
for (i = 0; i < (int)_tabs.size(); ++i) {
|
||||
OverlayColor color = (i == _activeTab) ? gui->_color : gui->_shadowcolor;
|
||||
int yOffset = (i == _activeTab) ? 0 : 2;
|
||||
box(x, _y + yOffset, _tabWidth, kTabHeight - yOffset, color, color, (i == _activeTab));
|
||||
gui->drawString(_tabs[i].title, x + kTabPadding, _y + yOffset / 2 + (kTabHeight - kLineHeight - 1), _tabWidth - 2 * kTabPadding, gui->_textcolor, kTextAlignCenter);
|
||||
x += _tabWidth + kTabSpacing;
|
||||
}
|
||||
// Iterate over all tabs and draw them
|
||||
int i, x = _x + kTabLeftOffset;
|
||||
for (i = 0; i < (int)_tabs.size(); ++i)
|
||||
{
|
||||
OverlayColor color = (i == _activeTab) ? kColor : kShadowColor;
|
||||
int yOffset = (i == _activeTab) ? 0 : 2;
|
||||
box(x, _y + yOffset, _tabWidth, kTabHeight - yOffset, color, color, (i == _activeTab));
|
||||
fb.font().drawString(_tabs[i].title, x + kTabPadding, _y + yOffset / 2 + (kTabHeight - kLineHeight - 1), _tabWidth - 2 * kTabPadding, kTextColor, kTextAlignCenter);
|
||||
x += _tabWidth + kTabSpacing;
|
||||
}
|
||||
|
||||
// Draw more horizontal lines
|
||||
gui->hLine(left1, _y + kTabHeight - 1, right1, gui->_color);
|
||||
gui->hLine(left2, _y + kTabHeight - 1, right2, gui->_color);
|
||||
gui->hLine(_x+1, _y + _h - 2, _x + _w - 2, gui->_shadowcolor);
|
||||
gui->hLine(_x+1, _y + _h - 1, _x + _w - 2, gui->_color);
|
||||
// Draw more horizontal lines
|
||||
fb.hLine(left1, _y + kTabHeight - 1, right1, kColor);
|
||||
fb.hLine(left2, _y + kTabHeight - 1, right2, kColor);
|
||||
fb.hLine(_x+1, _y + _h - 2, _x + _w - 2, kShadowColor);
|
||||
fb.hLine(_x+1, _y + _h - 1, _x + _w - 2, kColor);
|
||||
}
|
||||
|
||||
Widget *TabWidget::findWidget(int x, int y) {
|
||||
if (y < kTabHeight) {
|
||||
// Click was in the tab area
|
||||
return this;
|
||||
} else {
|
||||
// Iterate over all child widgets and find the one which was clicked
|
||||
return Widget::findWidgetInChain(_firstWidget, x, y - kTabHeight);
|
||||
}
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Widget *TabWidget::findWidget(int x, int y)
|
||||
{
|
||||
if (y < kTabHeight)
|
||||
{
|
||||
// Click was in the tab area
|
||||
return this;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Iterate over all child widgets and find the one which was clicked
|
||||
return Widget::findWidgetInChain(_firstWidget, x, y - kTabHeight);
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace GUI
|
||||
|
|
|
@ -1,49 +1,46 @@
|
|||
/* ScummVM - Scumm Interpreter
|
||||
* Copyright (C) 2002-2004 The ScummVM project
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Header: /home/stephena/STELLA_CVS-to-SVN/stella/src/gui/TabWidget.hxx,v 1.1 2005-05-13 01:03:27 stephena Exp $
|
||||
*/
|
||||
//============================================================================
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// $Id: TabWidget.hxx,v 1.2 2005-05-13 18:28:06 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
//============================================================================
|
||||
|
||||
#ifndef TABWIDGET_H
|
||||
#define TABWIDGET_H
|
||||
#ifndef TAB_WIDGET_HXX
|
||||
#define TAB_WIDGET_HXX
|
||||
|
||||
#include "widget.h"
|
||||
#include "common/str.h"
|
||||
#include "common/array.h"
|
||||
#include "GuiUtils.hxx"
|
||||
#include "Widget.hxx"
|
||||
#include "Command.hxx"
|
||||
#include "Array.hxx"
|
||||
#include "bspf.hxx"
|
||||
|
||||
namespace GUI {
|
||||
class TabWidget : public Widget, public CommandSender
|
||||
{
|
||||
struct Tab {
|
||||
string title;
|
||||
Widget* firstWidget;
|
||||
};
|
||||
typedef Array<Tab> TabList;
|
||||
|
||||
class TabWidget : public Widget {
|
||||
typedef Common::String String;
|
||||
struct Tab {
|
||||
String title;
|
||||
Widget *firstWidget;
|
||||
};
|
||||
typedef Common::Array<Tab> TabList;
|
||||
protected:
|
||||
int _activeTab;
|
||||
TabList _tabs;
|
||||
int _tabWidth;
|
||||
public:
|
||||
TabWidget(GuiObject *boss, int x, int y, int w, int h);
|
||||
~TabWidget();
|
||||
|
||||
public:
|
||||
TabWidget(GuiObject *boss, int x, int y, int w, int h);
|
||||
~TabWidget();
|
||||
|
||||
virtual int16 getChildY() const;
|
||||
virtual int getChildY() const;
|
||||
|
||||
// use Dialog::releaseFocus() when changing to another tab
|
||||
|
||||
|
@ -51,23 +48,31 @@ public:
|
|||
// First off, widget should allow non-dialog bosses, (i.e. also other widgets)
|
||||
// Could add a common base class for Widgets and Dialogs.
|
||||
// Then you add tabs using the following method, which returns a unique ID
|
||||
int addTab(const String &title);
|
||||
int addTab(const string& title);
|
||||
// Maybe we need to remove tabs again? Hm
|
||||
//void removeTab(int tabID);
|
||||
//void removeTab(int tabID);
|
||||
// Setting the active tab:
|
||||
void setActiveTab(int tabID);
|
||||
void setActiveTab(int tabID);
|
||||
// setActiveTab changes the value of _firstWidget. This means Widgets added afterwards
|
||||
// will be added to the active tab.
|
||||
|
||||
virtual void handleMouseDown(int x, int y, int button, int clickCount);
|
||||
virtual bool handleKeyDown(uint16 ascii, int keycode, int modifiers);
|
||||
virtual void handleMouseDown(int x, int y, int button, int clickCount);
|
||||
virtual bool handleKeyDown(int ascii, int keycode, int modifiers);
|
||||
|
||||
protected:
|
||||
virtual void drawWidget(bool hilite);
|
||||
protected:
|
||||
virtual void drawWidget(bool hilite);
|
||||
|
||||
virtual Widget *findWidget(int x, int y);
|
||||
|
||||
protected:
|
||||
int _activeTab;
|
||||
TabList _tabs;
|
||||
int _tabWidth;
|
||||
|
||||
private:
|
||||
void box(int x, int y, int width, int height,
|
||||
OverlayColor colorA, OverlayColor colorB, bool omitBottom);
|
||||
|
||||
virtual Widget *findWidget(int x, int y);
|
||||
};
|
||||
|
||||
} // End of namespace GUI
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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: VideoDialog.cxx,v 1.11 2005-05-11 19:36:00 stephena Exp $
|
||||
// $Id: VideoDialog.cxx,v 1.12 2005-05-13 18:28:06 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -41,7 +41,7 @@ enum {
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
||||
uInt16 x, uInt16 y, uInt16 w, uInt16 h)
|
||||
int x, int y, int w, int h)
|
||||
: Dialog(osystem, parent, x, y, w, h)
|
||||
{
|
||||
int yoff = 10,
|
||||
|
@ -147,7 +147,7 @@ void VideoDialog::loadConfig()
|
|||
{
|
||||
string s;
|
||||
bool b;
|
||||
uInt32 i;
|
||||
int i;
|
||||
float f;
|
||||
|
||||
// Driver setting
|
||||
|
@ -180,7 +180,7 @@ void VideoDialog::loadConfig()
|
|||
f = 2.0;
|
||||
s = "2.0";
|
||||
}
|
||||
i = (uInt32)((f * 10) - 10) * 10;
|
||||
i = (int)((f * 10) - 10) * 10;
|
||||
myAspectRatioSlider->setValue(i);
|
||||
myAspectRatioLabel->setLabel(s);
|
||||
|
||||
|
@ -219,7 +219,7 @@ void VideoDialog::loadConfig()
|
|||
void VideoDialog::saveConfig()
|
||||
{
|
||||
string s;
|
||||
uInt32 i;
|
||||
int i;
|
||||
bool b, restart = false;
|
||||
|
||||
// Driver setting
|
||||
|
@ -332,7 +332,7 @@ void VideoDialog::setDefaults()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void VideoDialog::handleRendererChange(uInt32 item)
|
||||
void VideoDialog::handleRendererChange(int item)
|
||||
{
|
||||
// When we're in software mode, certain OpenGL-related options are disabled
|
||||
bool active = item == 0 ? false : true;
|
||||
|
@ -344,7 +344,7 @@ void VideoDialog::handleRendererChange(uInt32 item)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void VideoDialog::handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data)
|
||||
void VideoDialog::handleCommand(CommandSender* sender, int cmd, int data)
|
||||
{
|
||||
switch(cmd)
|
||||
{
|
||||
|
|
|
@ -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: VideoDialog.hxx,v 1.4 2005-05-10 19:20:44 stephena Exp $
|
||||
// $Id: VideoDialog.hxx,v 1.5 2005-05-13 18:28:06 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -37,7 +37,7 @@ class VideoDialog : public Dialog
|
|||
{
|
||||
public:
|
||||
VideoDialog(OSystem* osystem, DialogContainer* parent,
|
||||
uInt16 x, uInt16 y, uInt16 w, uInt16 h);
|
||||
int x, int y, int w, int h);
|
||||
~VideoDialog();
|
||||
|
||||
protected:
|
||||
|
@ -59,8 +59,8 @@ class VideoDialog : public Dialog
|
|||
void saveConfig();
|
||||
void setDefaults();
|
||||
|
||||
void handleRendererChange(uInt32 item);
|
||||
virtual void handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data);
|
||||
void handleRendererChange(int item);
|
||||
virtual void handleCommand(CommandSender* sender, int cmd, int data);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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: Widget.cxx,v 1.8 2005-05-10 19:20:44 stephena Exp $
|
||||
// $Id: Widget.cxx,v 1.9 2005-05-13 18:28:06 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -30,7 +30,7 @@
|
|||
#include "Widget.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Widget::Widget(GuiObject* boss, Int32 x, Int32 y, Int32 w, Int32 h)
|
||||
Widget::Widget(GuiObject* boss, int x, int y, int w, int h)
|
||||
: GuiObject(boss->instance(), boss->parent(), x, y, w, h),
|
||||
_type(0),
|
||||
_boss(boss),
|
||||
|
@ -58,7 +58,7 @@ void Widget::draw()
|
|||
if(!isVisible() || !_boss->isVisible())
|
||||
return;
|
||||
|
||||
Int32 oldX = _x, oldY = _y;
|
||||
int oldX = _x, oldY = _y;
|
||||
|
||||
// Account for our relative position in the dialog
|
||||
_x = getAbsX();
|
||||
|
@ -105,7 +105,7 @@ void Widget::draw()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Widget* Widget::findWidgetInChain(Widget *w, Int32 x, Int32 y)
|
||||
Widget* Widget::findWidgetInChain(Widget *w, int x, int y)
|
||||
{
|
||||
while(w)
|
||||
{
|
||||
|
@ -122,7 +122,7 @@ Widget* Widget::findWidgetInChain(Widget *w, Int32 x, Int32 y)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
StaticTextWidget::StaticTextWidget(GuiObject *boss, Int32 x, Int32 y, Int32 w, Int32 h,
|
||||
StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h,
|
||||
const string& text, TextAlignment align)
|
||||
: Widget(boss, x, y, w, h),
|
||||
_align(align)
|
||||
|
@ -133,7 +133,7 @@ StaticTextWidget::StaticTextWidget(GuiObject *boss, Int32 x, Int32 y, Int32 w, I
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void StaticTextWidget::setValue(Int32 value)
|
||||
void StaticTextWidget::setValue(int value)
|
||||
{
|
||||
char buf[256];
|
||||
sprintf(buf, "%d", value);
|
||||
|
@ -153,8 +153,8 @@ void StaticTextWidget::drawWidget(bool hilite)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
ButtonWidget::ButtonWidget(GuiObject *boss, Int32 x, Int32 y, Int32 w, Int32 h,
|
||||
const string& label, Int32 cmd, uInt8 hotkey)
|
||||
ButtonWidget::ButtonWidget(GuiObject *boss, int x, int y, int w, int h,
|
||||
const string& label, int cmd, uInt8 hotkey)
|
||||
: StaticTextWidget(boss, x, y, w, h, label, kTextAlignCenter),
|
||||
CommandSender(boss),
|
||||
_cmd(cmd),
|
||||
|
@ -165,7 +165,7 @@ ButtonWidget::ButtonWidget(GuiObject *boss, Int32 x, Int32 y, Int32 w, Int32 h,
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void ButtonWidget::handleMouseUp(Int32 x, Int32 y, Int32 button, Int32 clickCount)
|
||||
void ButtonWidget::handleMouseUp(int x, int y, int button, int clickCount)
|
||||
{
|
||||
if(isEnabled() && x >= 0 && x < _w && y >= 0 && y < _h)
|
||||
sendCommand(_cmd, 0);
|
||||
|
@ -182,7 +182,7 @@ void ButtonWidget::drawWidget(bool hilite)
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
/* 8x8 checkbox bitmap */
|
||||
static uInt32 checked_img[8] =
|
||||
static unsigned int checked_img[8] =
|
||||
{
|
||||
0x00000000,
|
||||
0x01000010,
|
||||
|
@ -195,8 +195,8 @@ static uInt32 checked_img[8] =
|
|||
};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CheckboxWidget::CheckboxWidget(GuiObject *boss, Int32 x, Int32 y, Int32 w, Int32 h,
|
||||
const string& label, Int32 cmd, uInt8 hotkey)
|
||||
CheckboxWidget::CheckboxWidget(GuiObject *boss, int x, int y, int w, int h,
|
||||
const string& label, int cmd, uInt8 hotkey)
|
||||
: ButtonWidget(boss, x, y, w, h, label, cmd, hotkey),
|
||||
_state(false)
|
||||
{
|
||||
|
@ -205,7 +205,7 @@ CheckboxWidget::CheckboxWidget(GuiObject *boss, Int32 x, Int32 y, Int32 w, Int32
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CheckboxWidget::handleMouseUp(Int32 x, Int32 y, Int32 button, Int32 clickCount)
|
||||
void CheckboxWidget::handleMouseUp(int x, int y, int button, int clickCount)
|
||||
{
|
||||
if(isEnabled() && x >= 0 && x < _w && y >= 0 && y < _h)
|
||||
toggleState();
|
||||
|
@ -248,8 +248,8 @@ void CheckboxWidget::drawWidget(bool hilite)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SliderWidget::SliderWidget(GuiObject *boss, Int32 x, Int32 y, Int32 w, Int32 h,
|
||||
const string& label, Int32 labelWidth, Int32 cmd, uInt8 hotkey)
|
||||
SliderWidget::SliderWidget(GuiObject *boss, int x, int y, int w, int h,
|
||||
const string& label, int labelWidth, int cmd, uInt8 hotkey)
|
||||
: ButtonWidget(boss, x, y, w, h, label, cmd, hotkey),
|
||||
_value(0),
|
||||
_oldValue(0),
|
||||
|
@ -263,13 +263,13 @@ SliderWidget::SliderWidget(GuiObject *boss, Int32 x, Int32 y, Int32 w, Int32 h,
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SliderWidget::handleMouseMoved(Int32 x, Int32 y, Int32 button)
|
||||
void SliderWidget::handleMouseMoved(int x, int y, int button)
|
||||
{
|
||||
// TODO: when the mouse is dragged outside the widget, the slider should
|
||||
// snap back to the old value.
|
||||
if(isEnabled() && _isDragging && x >= (int)_labelWidth)
|
||||
{
|
||||
Int32 newValue = posToValue(x - _labelWidth);
|
||||
int newValue = posToValue(x - _labelWidth);
|
||||
|
||||
if(newValue < _valueMin)
|
||||
newValue = _valueMin;
|
||||
|
@ -289,7 +289,7 @@ void SliderWidget::handleMouseMoved(Int32 x, Int32 y, Int32 button)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SliderWidget::handleMouseDown(Int32 x, Int32 y, Int32 button, Int32 clickCount)
|
||||
void SliderWidget::handleMouseDown(int x, int y, int button, int clickCount)
|
||||
{
|
||||
if(isEnabled())
|
||||
{
|
||||
|
@ -299,7 +299,7 @@ void SliderWidget::handleMouseDown(Int32 x, Int32 y, Int32 button, Int32 clickCo
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SliderWidget::handleMouseUp(Int32 x, Int32 y, Int32 button, Int32 clickCount)
|
||||
void SliderWidget::handleMouseUp(int x, int y, int button, int clickCount)
|
||||
{
|
||||
if(isEnabled() && _isDragging)
|
||||
sendCommand(_cmd, _value);
|
||||
|
@ -327,13 +327,13 @@ void SliderWidget::drawWidget(bool hilite)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Int32 SliderWidget::valueToPos(Int32 value)
|
||||
int SliderWidget::valueToPos(int value)
|
||||
{
|
||||
return ((_w - _labelWidth - 4) * (value - _valueMin) / (_valueMax - _valueMin));
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Int32 SliderWidget::posToValue(Int32 pos)
|
||||
int SliderWidget::posToValue(int pos)
|
||||
{
|
||||
return (pos) * (_valueMax - _valueMin) / (_w - _labelWidth - 4) + _valueMin;
|
||||
}
|
||||
|
|
|
@ -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: Widget.hxx,v 1.8 2005-04-04 02:19:22 stephena Exp $
|
||||
// $Id: Widget.hxx,v 1.9 2005-05-13 18:28:06 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -65,27 +65,27 @@ enum {
|
|||
This is the base class for all widgets.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: Widget.hxx,v 1.8 2005-04-04 02:19:22 stephena Exp $
|
||||
@version $Id: Widget.hxx,v 1.9 2005-05-13 18:28:06 stephena Exp $
|
||||
*/
|
||||
class Widget : public GuiObject
|
||||
{
|
||||
friend class Dialog;
|
||||
|
||||
public:
|
||||
Widget(GuiObject* boss, Int32 x, Int32 y, Int32 w, Int32 h);
|
||||
Widget(GuiObject* boss, int x, int y, int w, int h);
|
||||
virtual ~Widget();
|
||||
|
||||
virtual Int16 getAbsX() const { return _x + _boss->getChildX(); }
|
||||
virtual Int16 getAbsY() const { return _y + _boss->getChildY(); }
|
||||
virtual int getAbsX() const { return _x + _boss->getChildX(); }
|
||||
virtual int getAbsY() const { return _y + _boss->getChildY(); }
|
||||
|
||||
virtual void handleMouseDown(Int32 x, Int32 y, Int32 button, Int32 clickCount) {}
|
||||
virtual void handleMouseUp(Int32 x, Int32 y, Int32 button, Int32 clickCount) {}
|
||||
virtual void handleMouseEntered(Int32 button) {}
|
||||
virtual void handleMouseLeft(Int32 button) {}
|
||||
virtual void handleMouseMoved(Int32 x, Int32 y, Int32 button) {}
|
||||
virtual void handleMouseWheel(Int32 x, Int32 y, Int32 direction) {}
|
||||
virtual bool handleKeyDown(uInt16 ascii, Int32 keycode, Int32 modifiers) { return false; }
|
||||
virtual bool handleKeyUp(uInt16 ascii, Int32 keycode, Int32 modifiers) { return false; }
|
||||
virtual void handleMouseDown(int x, int y, int button, int clickCount) {}
|
||||
virtual void handleMouseUp(int x, int y, int button, int clickCount) {}
|
||||
virtual void handleMouseEntered(int button) {}
|
||||
virtual void handleMouseLeft(int button) {}
|
||||
virtual void handleMouseMoved(int x, int y, int button) {}
|
||||
virtual void handleMouseWheel(int x, int y, int direction) {}
|
||||
virtual bool handleKeyDown(int ascii, int keycode, int modifiers) { return false; }
|
||||
virtual bool handleKeyUp(int ascii, int keycode, int modifiers) { return false; }
|
||||
virtual void handleTickle() {}
|
||||
|
||||
void draw();
|
||||
|
@ -93,13 +93,13 @@ class Widget : public GuiObject
|
|||
void lostFocus() { _hasFocus = false; lostFocusWidget(); }
|
||||
virtual bool wantsFocus() { return false; };
|
||||
|
||||
void setFlags(Int32 flags) { _flags |= flags;
|
||||
_boss->instance()->frameBuffer().refresh();
|
||||
void setFlags(int flags) { _flags |= flags;
|
||||
_boss->instance()->frameBuffer().refresh();
|
||||
}
|
||||
void clearFlags(Int32 flags) { _flags &= ~flags;
|
||||
_boss->instance()->frameBuffer().refresh();
|
||||
void clearFlags(int flags) { _flags &= ~flags;
|
||||
_boss->instance()->frameBuffer().refresh();
|
||||
}
|
||||
Int32 getFlags() const { return _flags; }
|
||||
int getFlags() const { return _flags; }
|
||||
|
||||
void setEnabled(bool e) { if (e) setFlags(WIDGET_ENABLED); else clearFlags(WIDGET_ENABLED); }
|
||||
bool isEnabled() const { return _flags & WIDGET_ENABLED; }
|
||||
|
@ -111,24 +111,24 @@ class Widget : public GuiObject
|
|||
virtual void receivedFocusWidget() {}
|
||||
virtual void lostFocusWidget() {}
|
||||
|
||||
virtual Widget* findWidget(Int32 x, Int32 y) { return this; }
|
||||
virtual Widget* findWidget(int x, int y) { return this; }
|
||||
|
||||
void releaseFocus() { assert(_boss); _boss->releaseFocus(); }
|
||||
|
||||
// By default, delegate unhandled commands to the boss
|
||||
void handleCommand(CommandSender* sender, Int32 cmd, Int32 data)
|
||||
void handleCommand(CommandSender* sender, int cmd, int data)
|
||||
{ assert(_boss); _boss->handleCommand(sender, cmd, data); }
|
||||
|
||||
protected:
|
||||
Int32 _type;
|
||||
int _type;
|
||||
GuiObject* _boss;
|
||||
Widget* _next;
|
||||
uInt16 _id;
|
||||
uInt16 _flags;
|
||||
int _id;
|
||||
int _flags;
|
||||
bool _hasFocus;
|
||||
|
||||
public:
|
||||
static Widget* findWidgetInChain(Widget* start, Int32 x, Int32 y);
|
||||
static Widget* findWidgetInChain(Widget* start, int x, int y);
|
||||
};
|
||||
|
||||
|
||||
|
@ -137,9 +137,9 @@ class StaticTextWidget : public Widget
|
|||
{
|
||||
public:
|
||||
StaticTextWidget(GuiObject* boss,
|
||||
Int32 x, Int32 y, Int32 w, Int32 h,
|
||||
int x, int y, int w, int h,
|
||||
const string& text, TextAlignment align);
|
||||
void setValue(Int32 value);
|
||||
void setValue(int value);
|
||||
void setLabel(const string& label) { _label = label;
|
||||
_boss->instance()->frameBuffer().refresh();
|
||||
}
|
||||
|
@ -159,21 +159,21 @@ class ButtonWidget : public StaticTextWidget, public CommandSender
|
|||
{
|
||||
public:
|
||||
ButtonWidget(GuiObject* boss,
|
||||
Int32 x, Int32 y, Int32 w, Int32 h,
|
||||
const string& label, Int32 cmd = 0, uInt8 hotkey = 0);
|
||||
int x, int y, int w, int h,
|
||||
const string& label, int cmd = 0, uInt8 hotkey = 0);
|
||||
|
||||
void setCmd(Int32 cmd) { _cmd = cmd; }
|
||||
Int32 getCmd() const { return _cmd; }
|
||||
void setCmd(int cmd) { _cmd = cmd; }
|
||||
int getCmd() const { return _cmd; }
|
||||
|
||||
void handleMouseUp(Int32 x, Int32 y, Int32 button, Int32 clickCount);
|
||||
void handleMouseEntered(Int32 button) { setFlags(WIDGET_HILITED); draw(); }
|
||||
void handleMouseLeft(Int32 button) { clearFlags(WIDGET_HILITED); draw(); }
|
||||
void handleMouseUp(int x, int y, int button, int clickCount);
|
||||
void handleMouseEntered(int button) { setFlags(WIDGET_HILITED); draw(); }
|
||||
void handleMouseLeft(int button) { clearFlags(WIDGET_HILITED); draw(); }
|
||||
|
||||
protected:
|
||||
void drawWidget(bool hilite);
|
||||
|
||||
protected:
|
||||
uInt32 _cmd;
|
||||
uint _cmd;
|
||||
uInt8 _hotkey;
|
||||
};
|
||||
|
||||
|
@ -182,12 +182,12 @@ class ButtonWidget : public StaticTextWidget, public CommandSender
|
|||
class CheckboxWidget : public ButtonWidget
|
||||
{
|
||||
public:
|
||||
CheckboxWidget(GuiObject* boss, Int32 x, Int32 y, Int32 w, Int32 h,
|
||||
const string& label, Int32 cmd = 0, uInt8 hotkey = 0);
|
||||
CheckboxWidget(GuiObject* boss, int x, int y, int w, int h,
|
||||
const string& label, int cmd = 0, uInt8 hotkey = 0);
|
||||
|
||||
void handleMouseUp(Int32 x, Int32 y, Int32 button, Int32 clickCount);
|
||||
virtual void handleMouseEntered(Int32 button) {}
|
||||
virtual void handleMouseLeft(Int32 button) {}
|
||||
void handleMouseUp(int x, int y, int button, int clickCount);
|
||||
virtual void handleMouseEntered(int button) {}
|
||||
virtual void handleMouseLeft(int button) {}
|
||||
|
||||
void setState(bool state);
|
||||
void toggleState() { setState(!_state); }
|
||||
|
@ -205,32 +205,32 @@ class CheckboxWidget : public ButtonWidget
|
|||
class SliderWidget : public ButtonWidget
|
||||
{
|
||||
public:
|
||||
SliderWidget(GuiObject *boss, Int32 x, Int32 y, Int32 w, Int32 h, const string& label = "",
|
||||
Int32 labelWidth = 0, Int32 cmd = 0, uInt8 hotkey = 0);
|
||||
SliderWidget(GuiObject *boss, int x, int y, int w, int h, const string& label = "",
|
||||
int labelWidth = 0, int cmd = 0, uInt8 hotkey = 0);
|
||||
|
||||
void setValue(Int32 value) { _value = value; }
|
||||
Int32 getValue() const { return _value; }
|
||||
void setValue(int value) { _value = value; }
|
||||
int getValue() const { return _value; }
|
||||
|
||||
void setMinValue(Int32 value) { _valueMin = value; }
|
||||
Int32 getMinValue() const { return _valueMin; }
|
||||
void setMaxValue(Int32 value) { _valueMax = value; }
|
||||
Int32 getMaxValue() const { return _valueMax; }
|
||||
void setMinValue(int value) { _valueMin = value; }
|
||||
int getMinValue() const { return _valueMin; }
|
||||
void setMaxValue(int value) { _valueMax = value; }
|
||||
int getMaxValue() const { return _valueMax; }
|
||||
|
||||
void handleMouseMoved(Int32 x, Int32 y, Int32 button);
|
||||
void handleMouseDown(Int32 x, Int32 y, Int32 button, Int32 clickCount);
|
||||
void handleMouseUp(Int32 x, Int32 y, Int32 button, Int32 clickCount);
|
||||
void handleMouseMoved(int x, int y, int button);
|
||||
void handleMouseDown(int x, int y, int button, int clickCount);
|
||||
void handleMouseUp(int x, int y, int button, int clickCount);
|
||||
|
||||
protected:
|
||||
void drawWidget(bool hilite);
|
||||
|
||||
Int32 valueToPos(Int32 value);
|
||||
Int32 posToValue(Int32 pos);
|
||||
int valueToPos(int value);
|
||||
int posToValue(int pos);
|
||||
|
||||
protected:
|
||||
Int32 _value, _oldValue;
|
||||
Int32 _valueMin, _valueMax;
|
||||
bool _isDragging;
|
||||
Int32 _labelWidth;
|
||||
int _value, _oldValue;
|
||||
int _valueMin, _valueMax;
|
||||
bool _isDragging;
|
||||
int _labelWidth;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue