Finally completed tab/focus issues between widgets in a dialog and

widgets in a TabWidget, which is also in the dialog.  All focus
related issues are now handled by the base Dialog directly; TabWidget
exits only to show a different set of widgets based on which tab
is selected.  Still TODO is fix drawing of focus rectangle around
some widgets (specifically, those that have a scrollbar attached).

Moved CpuWidget into the main dialog area, so it's always visible.

Next I'll be moving the RamWidget to the main dialog, and combining
CheatWidget into it to save even more space.

Then, we can get back to work on the TiaWidget and RomWidget :)


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@713 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2005-08-10 12:23:42 +00:00
parent 332ba0cfe1
commit 82b7f66043
45 changed files with 576 additions and 558 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBufferGL.hxx,v 1.22 2005-08-03 13:26:01 stephena Exp $
// $Id: FrameBufferGL.hxx,v 1.23 2005-08-10 12:23:42 stephena Exp $
//============================================================================
#ifndef FRAMEBUFFER_GL_HXX
@ -37,7 +37,7 @@ class GUI::Font;
This class implements an SDL OpenGL framebuffer.
@author Stephen Anthony
@version $Id: FrameBufferGL.hxx,v 1.22 2005-08-03 13:26:01 stephena Exp $
@version $Id: FrameBufferGL.hxx,v 1.23 2005-08-10 12:23:42 stephena Exp $
*/
class FrameBufferGL : public FrameBuffer
{
@ -188,6 +188,14 @@ class FrameBufferGL : public FrameBuffer
*/
virtual void addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h);
/**
Returns the current line dimensions (width/height) used by
hLine() and vLine().
@return The line width/height (both are the same)
*/
virtual uInt32 lineDim() { return 1; /* zooming done at hardware level */ }
private:
bool createTextures();

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBufferSoft.hxx,v 1.20 2005-08-03 13:26:01 stephena Exp $
// $Id: FrameBufferSoft.hxx,v 1.21 2005-08-10 12:23:42 stephena Exp $
//============================================================================
#ifndef FRAMEBUFFER_SOFT_HXX
@ -35,7 +35,7 @@ class RectList;
This class implements an SDL software framebuffer.
@author Stephen Anthony
@version $Id: FrameBufferSoft.hxx,v 1.20 2005-08-03 13:26:01 stephena Exp $
@version $Id: FrameBufferSoft.hxx,v 1.21 2005-08-10 12:23:42 stephena Exp $
*/
class FrameBufferSoft : public FrameBuffer
{
@ -186,6 +186,14 @@ class FrameBufferSoft : public FrameBuffer
*/
virtual void addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h);
/**
Returns the current line dimensions (width/height) used by
hLine() and vLine().
@return The line width/height (both are the same)
*/
virtual uInt32 lineDim() { return theZoomLevel; }
private:
// Used in the dirty update of the SDL surface
RectList* myRectList;

View File

@ -13,12 +13,12 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Version.hxx,v 1.5 2005-07-17 00:03:59 stephena Exp $
// $Id: Version.hxx,v 1.6 2005-08-10 12:23:42 stephena Exp $
//============================================================================
#ifndef VERSION_HXX
#define VERSION_HXX
#define STELLA_VERSION "2.0alpha4"
#define STELLA_VERSION "2.0pre-0810"
#endif

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: CheatWidget.cxx,v 1.2 2005-08-04 16:31:23 stephena Exp $
// $Id: CheatWidget.cxx,v 1.3 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -61,7 +61,7 @@ CheatWidget::CheatWidget(GuiObject* boss, int x, int y, int w, int h)
myEditBox = new EditNumWidget(boss, 90, ypos - 2, charWidth*10, charHeight, "");
myEditBox->setFont(instance()->consoleFont());
// myEditBox->setTarget(this);
myActiveWidget = myEditBox;
addFocusWidget(myEditBox);
ypos += border;
// Add the result text string area
@ -95,6 +95,7 @@ CheatWidget::CheatWidget(GuiObject* boss, int x, int y, int w, int h)
myResultsList = new AddrValueWidget(boss, xpos, ypos, 100, 75, 0xff);
myResultsList->setFont(instance()->consoleFont());
myResultsList->setTarget(this);
addFocusWidget(myResultsList);
myInputBox = new InputTextDialog(boss, instance()->consoleFont());
myInputBox->setTarget(this);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: CheatWidget.hxx,v 1.2 2005-08-04 16:31:24 stephena Exp $
// $Id: CheatWidget.hxx,v 1.3 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -51,8 +51,6 @@ class CheatWidget : public Widget, public CommandSender
CheatWidget(GuiObject *boss, int x, int y, int w, int h);
virtual ~CheatWidget();
Widget* activeWidget() { return myActiveWidget; }
void handleCommand(CommandSender* sender, int cmd, int data, int id);
private:
@ -63,8 +61,6 @@ class CheatWidget : public Widget, public CommandSender
void fillResultsList();
private:
Widget* myActiveWidget;
EditNumWidget* myEditBox;
StaticTextWidget* myResult;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: CpuWidget.cxx,v 1.3 2005-08-02 18:28:27 stephena Exp $
// $Id: CpuWidget.cxx,v 1.4 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -53,73 +53,45 @@ enum {
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CpuWidget::CpuWidget(GuiObject* boss, int x, int y, int w, int h)
: Widget(boss, x, y, w, h),
CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
: Widget(boss, x, y, 16, 16),
CommandSender(boss)
{
const GUI::Font& font = instance()->consoleFont();
int xpos = 10, ypos = 20, lwidth = 4 * font.getMaxCharWidth();
int fontHeight = font.getFontHeight(), lineHeight = font.getLineHeight();
const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight();
int xpos, ypos, lwidth;
StaticTextWidget* t;
// Create a 1x5 grid with labels for the CPU registers
xpos = x + 10, ypos = y, lwidth = 4 * fontWidth;
myCpuGrid = new DataGridWidget(boss, font, xpos + lwidth, ypos, 1, 5, 8, 16);
myCpuGrid->setTarget(this);
myActiveWidget = myCpuGrid;
addFocusWidget(myCpuGrid);
string labels[5] = { "PC:", "SP:", "A:", "X:", "Y:" };
for(int row = 0; row < 5; ++row)
{
t = new StaticTextWidget(boss, xpos, ypos + row*lineHeight + 2,
lwidth, fontHeight,
lwidth-2, fontHeight,
labels[row], kTextAlignLeft);
t->setFont(font);
}
// Create a read-only textbox containing the current PC label
xpos += lwidth + myCpuGrid->colWidth() + 10;
xpos += lwidth + myCpuGrid->getWidth() + 10;
myPCLabel = new EditTextWidget(boss, xpos, ypos, 100, lineHeight, "");
myPCLabel->clearFlags(WIDGET_TAB_NAVIGATE);
myPCLabel->setFont(font);
myPCLabel->setEditable(false);
// Create a bitfield widget for changing the processor status
xpos = 10; ypos += 5*lineHeight + 5;
xpos = x + 10; ypos += 5*lineHeight + 5;
t = new StaticTextWidget(boss, xpos, ypos, lwidth-2, fontHeight,
"PS:", kTextAlignLeft);
t->setFont(font);
myPSRegister = new ToggleBitWidget(boss, font, xpos+lwidth, ypos-2, 8, 1);
myPSRegister->setTarget(this);
// FIXME --------------------------
// The following will be moved to another part of the debugger dialog,
// so I won't bother fixing it here.
// And some status fields
xpos = 10; ypos += 2*lineHeight;
new StaticTextWidget(boss, xpos, ypos, 55, kLineHeight, "Current Ins:", kTextAlignLeft);
xpos += 60;
myCurrentIns = new EditTextWidget(boss, xpos, ypos-2, 300, kLineHeight, "");
myCurrentIns->clearFlags(WIDGET_TAB_NAVIGATE);
myCurrentIns->setFont(font);
myCurrentIns->setEditable(false);
xpos = 10; ypos += kLineHeight + 5;
new StaticTextWidget(boss, xpos, ypos, 55, kLineHeight, "Cycle Count:", kTextAlignLeft);
xpos += 60;
myCycleCount = new EditTextWidget(boss, xpos, ypos-2, 50, kLineHeight, "");
myCycleCount->clearFlags(WIDGET_TAB_NAVIGATE);
myCycleCount->setFont(font);
myCycleCount->setEditable(false);
xpos = 10; ypos += kLineHeight + 5;
new StaticTextWidget(boss, xpos, ypos, 55, kLineHeight, "BP/Trap:", kTextAlignLeft);
xpos += 60;
myStatus = new EditTextWidget(boss, xpos, ypos-2, 100, kLineHeight, "");
myStatus->clearFlags(WIDGET_TAB_NAVIGATE);
myStatus->setFont(font);
myStatus->setEditable(false);
// FIXME --------------------------
addFocusWidget(myPSRegister);
// Set the strings to be used in the PSRegister
// We only do this once because it's the state that changes, not the strings
@ -132,6 +104,39 @@ CpuWidget::CpuWidget(GuiObject* boss, int x, int y, int w, int h)
on.push_back(onstr[i]);
}
myPSRegister->setList(off, on);
// Calculate real dimensions
_w = lwidth + myCpuGrid->getWidth() + myPSRegister->getWidth() + 20;
_h = ypos + myPSRegister->getHeight() - y;
/*
// FIXME --------------------------
// The following will be moved to another part of the debugger dialog,
// so I won't bother fixing it here.
// And some status fields
xpos = 10; ypos += 2*lineHeight;
new StaticTextWidget(boss, xpos, ypos, 55, kLineHeight, "Current Ins:", kTextAlignLeft);
xpos += 60;
myCurrentIns = new EditTextWidget(boss, xpos, ypos-2, 300, kLineHeight, "");
myCurrentIns->setFont(font);
myCurrentIns->setEditable(false);
xpos = 10; ypos += kLineHeight + 5;
new StaticTextWidget(boss, xpos, ypos, 55, kLineHeight, "Cycle Count:", kTextAlignLeft);
xpos += 60;
myCycleCount = new EditTextWidget(boss, xpos, ypos-2, 50, kLineHeight, "");
myCycleCount->setFont(font);
myCycleCount->setEditable(false);
xpos = 10; ypos += kLineHeight + 5;
new StaticTextWidget(boss, xpos, ypos, 55, kLineHeight, "BP/Trap:", kTextAlignLeft);
xpos += 60;
myStatus = new EditTextWidget(boss, xpos, ypos-2, 100, kLineHeight, "");
myStatus->setFont(font);
myStatus->setEditable(false);
// FIXME --------------------------
*/
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -216,7 +221,6 @@ void CpuWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CpuWidget::loadConfig()
{
cerr << "CpuWidget::loadConfig()\n";
fillGrid();
}
@ -263,6 +267,7 @@ void CpuWidget::fillGrid()
myPSRegister->setState(state.PSbits, changed);
/*
// Update the other status fields
int pc = state.PC;
const char* buf;
@ -286,4 +291,5 @@ void CpuWidget::fillGrid()
// FIXME - add trap info
myStatus->setEditString(status);
*/
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: CpuWidget.hxx,v 1.1 2005-08-01 22:33:12 stephena Exp $
// $Id: CpuWidget.hxx,v 1.2 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -36,11 +36,9 @@ class ToggleBitWidget;
class CpuWidget : public Widget, public CommandSender
{
public:
CpuWidget(GuiObject* boss, int x, int y, int w, int h);
CpuWidget(GuiObject* boss, const GUI::Font& font, int x, int y);
virtual ~CpuWidget();
Widget* activeWidget() { return myActiveWidget; }
void handleCommand(CommandSender* sender, int cmd, int data, int id);
void loadConfig();
@ -48,8 +46,6 @@ class CpuWidget : public Widget, public CommandSender
void fillGrid();
private:
Widget* myActiveWidget;
DataGridWidget* myCpuGrid;
ToggleBitWidget* myPSRegister;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Debugger.cxx,v 1.80 2005-08-04 22:59:38 stephena Exp $
// $Id: Debugger.cxx,v 1.81 2005-08-10 12:23:42 stephena Exp $
//============================================================================
#include "bspf.hxx"
@ -160,8 +160,6 @@ void Debugger::initialize()
string cheetah = myOSystem->settings().getString("cheetah");
if(cheetah != "") run("cheetah " + cheetah);
myOSystem->settings().setString("cheetah", "", false);
autoExec();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Debugger.hxx,v 1.66 2005-08-05 02:28:21 urchlay Exp $
// $Id: Debugger.hxx,v 1.67 2005-08-10 12:23:42 stephena Exp $
//============================================================================
#ifndef DEBUGGER_HXX
@ -82,7 +82,7 @@ typedef uInt16 (Debugger::*DEBUGGER_WORD_METHOD)();
for all debugging operations in Stella (parser, 6502 debugger, etc).
@author Stephen Anthony
@version $Id: Debugger.hxx,v 1.66 2005-08-05 02:28:21 urchlay Exp $
@version $Id: Debugger.hxx,v 1.67 2005-08-10 12:23:42 stephena Exp $
*/
class Debugger : public DialogContainer
{
@ -192,6 +192,7 @@ class Debugger : public DialogContainer
int trace();
void nextScanline(int lines);
void nextFrame(int frames);
void autoExec();
string showWatches();
@ -260,8 +261,8 @@ class Debugger : public DialogContainer
int getBank();
int bankCount();
string loadListFile(string f = "");
const string getSourceLines(int addr);
string loadListFile(string f = "");
const string getSourceLines(int addr);
bool saveROM(string filename);
@ -326,7 +327,6 @@ class Debugger : public DialogContainer
void reset();
void autoLoadSymbols(string file);
void autoExec();
void clearAllBreakPoints();
void formatFlags(BoolArray& b, char *out);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: PromptWidget.cxx,v 1.1 2005-08-01 22:33:12 stephena Exp $
// $Id: PromptWidget.cxx,v 1.2 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -47,9 +47,11 @@
PromptWidget::PromptWidget(GuiObject* boss, int x, int y, int w, int h)
: Widget(boss, x, y, w - kScrollBarWidth, h),
CommandSender(boss),
_makeDirty(false)
_makeDirty(false),
_firstTime(true)
{
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS;
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS |
WIDGET_WANTS_TAB;
_type = kPromptWidget;
_kConsoleCharWidth = instance()->consoleFont().getMaxCharWidth();
@ -69,7 +71,6 @@ PromptWidget::PromptWidget(GuiObject* boss, int x, int y, int w, int h)
// Add scrollbar
_scrollBar = new ScrollBarWidget(boss, _x + _w, _y, kScrollBarWidth, _h);
_scrollBar->setTarget(this);
// Init colors
@ -88,13 +89,7 @@ PromptWidget::PromptWidget(GuiObject* boss, int x, int y, int w, int h)
_promptStartPos = _promptEndPos = -1;
// Display greetings & prompt
string version = string("Stella ") + STELLA_VERSION + "\n";
print(version.c_str());
print("Debugger is ready\n");
//print( instance()->debugger().state() + "\n"); // FIXME: this doesn't work yet
print(PROMPT);
_promptStartPos = _promptEndPos = _currentPos;
addFocusWidget(this);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -105,7 +100,7 @@ PromptWidget::~PromptWidget()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PromptWidget::drawWidget(bool hilite)
{
cerr << "PromptWidget::drawWidget\n";
//cerr << "PromptWidget::drawWidget\n";
OverlayColor fgcolor, bgcolor;
FrameBuffer& fb = _boss->instance()->frameBuffer();
@ -144,9 +139,7 @@ cerr << "PromptWidget::drawWidget\n";
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PromptWidget::handleMouseDown(int x, int y, int button, int clickCount)
{
return;
_scrollBar->handleMouseDown(x, y, button, clickCount);
cerr << "PromptWidget::handleMouseDown\n";
cerr << "PromptWidget::handleMouseDown\n";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -491,6 +484,22 @@ void PromptWidget::loadConfig()
{
// See logic at the end of handleKeyDown for an explanation of this
_makeDirty = true;
// Show the prompt the first time we draw this widget
if(_firstTime)
{
// Display greetings & prompt
string version = string("Stella ") + STELLA_VERSION + "\n";
print(version.c_str());
print("Debugger is ready\n");
print(PROMPT);
_promptStartPos = _promptEndPos = _currentPos;
// Take care of one-time debugger stuff
instance()->debugger().autoExec();
_firstTime = false;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: PromptWidget.hxx,v 1.1 2005-08-01 22:33:12 stephena Exp $
// $Id: PromptWidget.hxx,v 1.2 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -78,6 +78,9 @@ class PromptWidget : public Widget, public CommandSender
void handleMouseWheel(int x, int y, int direction);
bool handleKeyDown(int ascii, int keycode, int modifiers);
void handleCommand(CommandSender* sender, int cmd, int data, int id);
virtual bool wantsFocus() { return true; }
void loadConfig();
protected:
@ -109,6 +112,7 @@ class PromptWidget : public Widget, public CommandSender
OverlayColor bgColor;
bool _inverse;
bool _makeDirty;
bool _firstTime;
int compareHistory(const char *histLine);
};

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: RamWidget.cxx,v 1.3 2005-08-02 18:28:27 stephena Exp $
// $Id: RamWidget.cxx,v 1.4 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -50,12 +50,11 @@ RamWidget::RamWidget(GuiObject* boss, int x, int y, int w, int h)
myRamGrid = new DataGridWidget(boss, font, xpos + lwidth, ypos,
16, 8, 2, 8, kBASE_16);
myRamGrid->setTarget(this);
myRamGrid->clearFlags(WIDGET_TAB_NAVIGATE);
myActiveWidget = myRamGrid;
addFocusWidget(myRamGrid);
for(int row = 0; row < 8; ++row)
{
t = new StaticTextWidget(boss, xpos, ypos + row*lineHeight + 2,
t = new StaticTextWidget(boss, xpos-2, ypos + row*lineHeight + 2,
lwidth, fontHeight,
Debugger::to_hex_8(row*16 + kRamStart) + string(":"),
kTextAlignLeft);
@ -78,7 +77,6 @@ RamWidget::RamWidget(GuiObject* boss, int x, int y, int w, int h)
t->setFont(font);
xpos += 6*fontWidth + 5;
myLabel = new EditTextWidget(boss, xpos, ypos-2, 15*fontWidth, lineHeight, "");
myLabel->clearFlags(WIDGET_TAB_NAVIGATE);
myLabel->setFont(font);
myLabel->setEditable(false);
@ -89,7 +87,6 @@ RamWidget::RamWidget(GuiObject* boss, int x, int y, int w, int h)
t->setFont(font);
xpos += 4*fontWidth + 5;
myDecValue = new EditTextWidget(boss, xpos, ypos-2, 4*fontWidth, lineHeight, "");
myDecValue->clearFlags(WIDGET_TAB_NAVIGATE);
myDecValue->setFont(font);
myDecValue->setEditable(false);
@ -100,7 +97,6 @@ RamWidget::RamWidget(GuiObject* boss, int x, int y, int w, int h)
t->setFont(font);
xpos += 4*fontWidth + 5;
myBinValue = new EditTextWidget(boss, xpos, ypos-2, 9*fontWidth, lineHeight, "");
myBinValue->clearFlags(WIDGET_TAB_NAVIGATE);
myBinValue->setFont(font);
myBinValue->setEditable(false);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: RamWidget.hxx,v 1.1 2005-08-01 22:33:12 stephena Exp $
// $Id: RamWidget.hxx,v 1.2 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -44,8 +44,6 @@ class RamWidget : public Widget, public CommandSender
RamWidget(GuiObject* boss, int x, int y, int w, int h);
virtual ~RamWidget();
Widget* activeWidget() { return myActiveWidget; }
void handleCommand(CommandSender* sender, int cmd, int data, int id);
void loadConfig();
@ -56,8 +54,6 @@ class RamWidget : public Widget, public CommandSender
int myUndoAddress;
int myUndoValue;
Widget* myActiveWidget;
DataGridWidget* myRamGrid;
EditTextWidget* myBinValue;
EditTextWidget* myDecValue;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: TiaInfoWidget.cxx,v 1.1 2005-07-21 19:30:15 stephena Exp $
// $Id: TiaInfoWidget.cxx,v 1.2 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -42,7 +42,6 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, int x, int y, int w, int h)
new StaticTextWidget(boss, xpos, ypos, lwidth, kLineHeight, "Frame:", kTextAlignLeft);
xpos += lwidth;
myFrameCount = new EditTextWidget(boss, xpos, ypos-2, 45, kLineHeight, "");
myFrameCount->clearFlags(WIDGET_TAB_NAVIGATE);
myFrameCount->setFont(font);
myFrameCount->setEditable(false);
@ -50,25 +49,21 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, int x, int y, int w, int h)
new StaticTextWidget(boss, xpos, ypos, lwidth, kLineHeight, "F. Cycles:", kTextAlignLeft);
xpos += lwidth;
myFrameCycles = new EditTextWidget(boss, xpos, ypos-2, 45, kLineHeight, "");
myFrameCycles->clearFlags(WIDGET_TAB_NAVIGATE);
myFrameCycles->setFont(font);
myFrameCycles->setEditable(false);
xpos = x + 20; ypos += kLineHeight + 5;
myVSync = new CheckboxWidget(boss, xpos, ypos-3, 25, kLineHeight, "VSync", 0);
myVSync->clearFlags(WIDGET_TAB_NAVIGATE);
myVSync->setEditable(false);
xpos = x + 20; ypos += kLineHeight + 5;
myVBlank = new CheckboxWidget(boss, xpos, ypos-3, 30, kLineHeight, "VBlank", 0);
myVBlank->clearFlags(WIDGET_TAB_NAVIGATE);
myVBlank->setEditable(false);
xpos = x + 10 + 100; ypos = y + 10;
new StaticTextWidget(boss, xpos, ypos, lwidth, kLineHeight, "Scanline:", kTextAlignLeft);
xpos += lwidth;
myScanlineCount = new EditTextWidget(boss, xpos, ypos-2, 30, kLineHeight, "");
myScanlineCount->clearFlags(WIDGET_TAB_NAVIGATE);
myScanlineCount->setFont(font);
myScanlineCount->setEditable(false);
@ -76,7 +71,6 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, int x, int y, int w, int h)
new StaticTextWidget(boss, xpos, ypos, lwidth, kLineHeight, "S. Cycles:", kTextAlignLeft);
xpos += lwidth;
myScanlineCycles = new EditTextWidget(boss, xpos, ypos-2, 30, kLineHeight, "");
myScanlineCycles->clearFlags(WIDGET_TAB_NAVIGATE);
myScanlineCycles->setFont(font);
myScanlineCycles->setEditable(false);
@ -84,7 +78,6 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, int x, int y, int w, int h)
new StaticTextWidget(boss, xpos, ypos, lwidth, kLineHeight, "Pixel Pos:", kTextAlignLeft);
xpos += lwidth;
myPixelPosition = new EditTextWidget(boss, xpos, ypos-2, 30, kLineHeight, "");
myPixelPosition->clearFlags(WIDGET_TAB_NAVIGATE);
myPixelPosition->setFont(font);
myPixelPosition->setEditable(false);
@ -92,7 +85,6 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, int x, int y, int w, int h)
new StaticTextWidget(boss, xpos, ypos, lwidth, kLineHeight, "Color Clk:", kTextAlignLeft);
xpos += lwidth;
myColorClocks = new EditTextWidget(boss, xpos, ypos-2, 30, kLineHeight, "");
myColorClocks->clearFlags(WIDGET_TAB_NAVIGATE);
myColorClocks->setFont(font);
myColorClocks->setEditable(false);
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: TiaWidget.cxx,v 1.3 2005-08-02 18:28:27 stephena Exp $
// $Id: TiaWidget.cxx,v 1.4 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -64,7 +64,7 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
myRamGrid->setEditable(false);
myRamGrid->setTarget(this);
myRamGrid->setID(kRamID);
myActiveWidget = myRamGrid;
addFocusWidget(myRamGrid);
t = new StaticTextWidget(boss, xpos, ypos + 2,
lwidth, fontHeight,
@ -88,7 +88,6 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
t->setFont(font);
xpos += 6*fontWidth + 5;
myLabel = new EditTextWidget(boss, xpos, ypos-2, 15*fontWidth, lineHeight, "");
myLabel->clearFlags(WIDGET_TAB_NAVIGATE);
myLabel->setFont(font);
myLabel->setEditable(false);
@ -99,7 +98,6 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
t->setFont(font);
xpos += 4*fontWidth + 5;
myDecValue = new EditTextWidget(boss, xpos, ypos-2, 4*fontWidth, lineHeight, "");
myDecValue->clearFlags(WIDGET_TAB_NAVIGATE);
myDecValue->setFont(font);
myDecValue->setEditable(false);
@ -110,7 +108,6 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
t->setFont(font);
xpos += 4*fontWidth + 5;
myBinValue = new EditTextWidget(boss, xpos, ypos-2, 9*fontWidth, lineHeight, "");
myBinValue->clearFlags(WIDGET_TAB_NAVIGATE);
myBinValue->setFont(font);
myBinValue->setEditable(false);
@ -130,6 +127,7 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
1, 4, 2, 8, kBASE_16);
myColorRegs->setTarget(this);
myColorRegs->setID(kColorRegsID);
addFocusWidget(myColorRegs);
xpos += myColorRegs->colWidth() + 5;
myCOLUP0Color = new ColorWidget(boss, xpos, ypos+2, 20, lineHeight - 4);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: TiaWidget.hxx,v 1.1 2005-08-01 22:33:12 stephena Exp $
// $Id: TiaWidget.hxx,v 1.2 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -39,8 +39,6 @@ class TiaWidget : public Widget, public CommandSender
TiaWidget(GuiObject* boss, int x, int y, int w, int h);
virtual ~TiaWidget();
Widget* activeWidget() { return myActiveWidget; }
void handleCommand(CommandSender* sender, int cmd, int data, int id);
void loadConfig();
@ -49,8 +47,6 @@ class TiaWidget : public Widget, public CommandSender
void changeColorRegs();
private:
Widget* myActiveWidget;
DataGridWidget* myRamGrid;
EditTextWidget* myBinValue;
EditTextWidget* myDecValue;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBuffer.hxx,v 1.52 2005-08-03 13:26:02 stephena Exp $
// $Id: FrameBuffer.hxx,v 1.53 2005-08-10 12:23:42 stephena Exp $
//============================================================================
#ifndef FRAMEBUFFER_HXX
@ -52,7 +52,7 @@ enum FrameStyle {
All GUI elements (ala ScummVM) are drawn here as well.
@author Stephen Anthony
@version $Id: FrameBuffer.hxx,v 1.52 2005-08-03 13:26:02 stephena Exp $
@version $Id: FrameBuffer.hxx,v 1.53 2005-08-10 12:23:42 stephena Exp $
*/
class FrameBuffer
{
@ -390,6 +390,14 @@ class FrameBuffer
*/
virtual void addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h) = 0;
/**
Returns the current line dimensions (width/height) used by
hLine() and vLine().
@return The line width/height (both are the same)
*/
virtual uInt32 lineDim() = 0;
protected:
// The parent system for the framebuffer
OSystem* myOSystem;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: OSystem.cxx,v 1.28 2005-07-14 00:54:28 stephena Exp $
// $Id: OSystem.cxx,v 1.29 2005-08-10 12:23:42 stephena Exp $
//============================================================================
#include <cassert>
@ -88,9 +88,6 @@ OSystem::OSystem()
#ifdef DEVELOPER_SUPPORT
myFeatures += "Debugger";
#endif
// When we first start Stella, no GUI widget is active
GuiObject::resetActiveWidget();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: OSystem.hxx,v 1.25 2005-07-14 00:54:28 stephena Exp $
// $Id: OSystem.hxx,v 1.26 2005-08-10 12:23:42 stephena Exp $
//============================================================================
#ifndef OSYSTEM_HXX
@ -32,8 +32,6 @@ class Debugger;
#include "Console.hxx"
#include "StringList.hxx"
#include "Font.hxx"
//#include "StellaFont.hxx"
//#include "ConsoleFont.hxx"
#include "bspf.hxx"
@ -44,7 +42,7 @@ class Debugger;
other objects belong.
@author Stephen Anthony
@version $Id: OSystem.hxx,v 1.25 2005-07-14 00:54:28 stephena Exp $
@version $Id: OSystem.hxx,v 1.26 2005-08-10 12:23:42 stephena Exp $
*/
class OSystem
{

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: AddrValueWidget.cxx,v 1.9 2005-08-01 22:33:14 stephena Exp $
// $Id: AddrValueWidget.cxx,v 1.10 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -39,8 +39,7 @@ AddrValueWidget::AddrValueWidget(GuiObject* boss, int x, int y, int w, int h,
{
_w = w - kScrollBarWidth;
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS |
WIDGET_TAB_NAVIGATE;
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS;
_type = kListWidget; // we're just a slightly modified listwidget
_editMode = false;
@ -130,10 +129,6 @@ void AddrValueWidget::handleMouseDown(int x, int y, int button, int clickCount)
if (!isEnabled())
return;
// A click indicates this widget has been selected
// It should receive focus (because it has the WIDGET_TAB_NAVIGATE property)
receivedFocus();
// First check whether the selection changed
int newSelectedItem;
newSelectedItem = findItem(x, y);
@ -146,9 +141,8 @@ void AddrValueWidget::handleMouseDown(int x, int y, int button, int clickCount)
abortEditMode();
_selectedItem = newSelectedItem;
sendCommand(kAVSelectionChangedCmd, _selectedItem, _id);
setDirty(); draw();
}
setDirty(); draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: AudioDialog.cxx,v 1.11 2005-08-01 22:33:14 stephena Exp $
// $Id: AudioDialog.cxx,v 1.12 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -91,8 +91,6 @@ AudioDialog::AudioDialog(OSystem* osystem, DialogContainer* parent,
addButton(_w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd, 0);
addButton(_w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
#endif
setDefaults();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: BrowserDialog.cxx,v 1.8 2005-08-01 22:33:14 stephena Exp $
// $Id: BrowserDialog.cxx,v 1.9 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -58,7 +58,8 @@ BrowserDialog::BrowserDialog(GuiObject* boss, int x, int y, int w, int h)
_fileList = new ListWidget(this, 10, 34, _w - 2 * 10, _h - 34 - 24 - 10);
_fileList->setNumberingMode(kListNumberingOff);
_fileList->setEditable(false);
_fileList->clearFlags(WIDGET_TAB_NAVIGATE);
_fileList->setFlags(WIDGET_NODRAW_FOCUS);
addFocusWidget(_fileList);
// Buttons
addButton(10, _h - 24, "Go up", kGoUpCmd, 0);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: DataGridWidget.cxx,v 1.17 2005-08-02 18:28:28 stephena Exp $
// $Id: DataGridWidget.cxx,v 1.18 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -49,8 +49,7 @@ DataGridWidget::DataGridWidget(GuiObject* boss, const GUI::Font& font,
{
setFont(font);
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS |
WIDGET_TAB_NAVIGATE;
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS;
_type = kDataGridWidget;
_editMode = false;
@ -108,6 +107,8 @@ cerr << "_addrList.size() = " << _addrList.size()
// Send item selected signal for starting with cell 0
sendCommand(kDGSelectionChangedCmd, _selectedItem, _id);
setDirty(); draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -129,10 +130,6 @@ void DataGridWidget::handleMouseDown(int x, int y, int button, int clickCount)
if (!isEnabled())
return;
// A click indicates this widget has been selected
// It should receive focus (because it has the WIDGET_TAB_NAVIGATE property)
receivedFocus();
// First check whether the selection changed
int newSelectedItem;
newSelectedItem = findItem(x, y);
@ -149,11 +146,8 @@ void DataGridWidget::handleMouseDown(int x, int y, int button, int clickCount)
_currentCol = _selectedItem - (_currentRow * _cols);
sendCommand(kDGSelectionChangedCmd, _selectedItem, _id);
setDirty(); draw();
}
// FIXME - this is only here for focus
// it needs to be fixed
setDirty(); draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -442,7 +436,6 @@ void DataGridWidget::handleCommand(CommandSender* sender, int cmd,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DataGridWidget::drawWidget(bool hilite)
{
cerr << "DataGridWidget::drawWidget\n";
FrameBuffer& fb = _boss->instance()->frameBuffer();
int row, col, deltax;
string buffer;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: DebuggerDialog.cxx,v 1.30 2005-08-04 22:59:38 stephena Exp $
// $Id: DebuggerDialog.cxx,v 1.31 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -62,9 +62,11 @@ DebuggerDialog::~DebuggerDialog()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DebuggerDialog::loadConfig()
{
cerr << " ==> DebuggerDialog::loadConfig()\n";
myTab->loadConfig();
myTiaInfo->loadConfig();
myTiaOutput->loadConfig();
myCpu->loadConfig();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -83,7 +85,7 @@ void DebuggerDialog::handleKeyDown(int ascii, int keycode, int modifiers)
doScanlineAdvance();
}
else
myTab->handleKeyDown(ascii, keycode, modifiers);
Dialog::handleKeyDown(ascii, keycode, modifiers);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -135,46 +137,40 @@ void DebuggerDialog::addTabArea()
const int vBorder = 4;
const int widWidth = r.width() - vBorder;
const int widHeight = r.height() - 25; // FIXME - magic number/font height
int tabID;
// The tab widget
myTab = new TabWidget(this, r.left, r.top + vBorder,
r.width(), r.height() - vBorder);
r.width(), r.height() - vBorder);
addTabWidget(myTab);
// 1) The Prompt/console tab
myTab->addTab("Prompt");
// The Prompt/console tab
tabID = myTab->addTab("Prompt");
myPrompt = new PromptWidget(myTab, 2, 2, widWidth, widHeight);
myTab->setParentWidget(0, myPrompt, myPrompt);
myTab->setParentWidget(tabID, myPrompt);
addToFocusList(myPrompt->getFocusList(), tabID);
// 2) The CPU tab
myTab->addTab("CPU");
CpuWidget* cpu = new CpuWidget(myTab, 2, 2, widWidth, widHeight);
myTab->setParentWidget(1, cpu, cpu->activeWidget());
// 3) The RAM tab (part of RIOT)
myTab->addTab("RAM");
// The RAM tab (part of RIOT)
tabID = myTab->addTab("RAM");
RamWidget* ram = new RamWidget(myTab, 2, 2, widWidth, widHeight);
myTab->setParentWidget(2, ram, ram->activeWidget());
myTab->setParentWidget(tabID, ram);
addToFocusList(ram->getFocusList(), tabID);
// 4) The input/output tab (part of RIOT)
myTab->addTab("I/O");
// The input/output tab (part of RIOT)
tabID = myTab->addTab("I/O");
// 5) The TIA tab
myTab->addTab("TIA");
// The TIA tab
tabID = myTab->addTab("TIA");
TiaWidget* tia = new TiaWidget(myTab, 2, 2, widWidth, widHeight);
myTab->setParentWidget(4, tia, tia->activeWidget());
myTab->setParentWidget(tabID, tia);
addToFocusList(tia->getFocusList(), tabID);
// 6) The ROM tab
myTab->addTab("ROM");
// 7) The Cheat tab
myTab->addTab("Cheat");
// The Cheat tab
tabID = myTab->addTab("Cheat");
CheatWidget* cheat = new CheatWidget(myTab, 2, 2, widWidth, widHeight);
myTab->setParentWidget(6, cheat, cheat->activeWidget());
myTab->setParentWidget(tabID, cheat);
addToFocusList(cheat->getFocusList(), tabID);
// Set active tab to prompt
myTab->setActiveTab(0);
}
@ -189,20 +185,24 @@ void DebuggerDialog::addStatusArea()
void DebuggerDialog::addRomArea()
{
GUI::Rect r = instance()->debugger().getRomBounds();
int xpos, ypos;
xpos = r.left + 10; ypos = 10;
myCpu = new CpuWidget(this, instance()->consoleFont(), xpos, ypos);
addToFocusList(myCpu->getFocusList());
// Add some buttons that are always shown, no matter which tab we're in
// FIXME - these positions will definitely change
int xoff = r.right - 100;
int yoff = r.bottom - 150;
addButton(xoff, yoff, "Step", kDDStepCmd, 0);
yoff += 22;
addButton(xoff, yoff, "Trace", kDDTraceCmd, 0);
yoff += 22;
addButton(xoff, yoff, "Scan +1", kDDSAdvCmd, 0);
yoff += 22;
addButton(xoff, yoff, "Frame +1", kDDAdvCmd, 0);
xpos = r.right - 100; ypos = r.bottom - 150;
addButton(xpos, ypos, "Step", kDDStepCmd, 0);
ypos += 22;
addButton(xpos, ypos, "Trace", kDDTraceCmd, 0);
ypos += 22;
addButton(xpos, ypos, "Scan +1", kDDSAdvCmd, 0);
ypos += 22;
addButton(xpos, ypos, "Frame +1", kDDAdvCmd, 0);
addButton(xoff, r.bottom - 22 - 10, "Exit", kDDExitCmd, 0);
addButton(xpos, r.bottom - 22 - 10, "Exit", kDDExitCmd, 0);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: DebuggerDialog.hxx,v 1.15 2005-08-04 22:59:54 stephena Exp $
// $Id: DebuggerDialog.hxx,v 1.16 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -25,6 +25,8 @@
class Debugger;
class OSystem;
class DialogContainer;
class CpuWidget;
class RamWidget;
class TabWidget;
class TiaInfoWidget;
class TiaOutputWidget;
@ -47,12 +49,14 @@ class DebuggerDialog : public Dialog
virtual void handleKeyDown(int ascii, int keycode, int modifiers);
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
protected:
private:
TabWidget* myTab;
PromptWidget* myPrompt;
TiaInfoWidget* myTiaInfo;
TiaOutputWidget* myTiaOutput;
CpuWidget* myCpu;
RamWidget* myRam;
private:
void addTiaArea();

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Dialog.cxx,v 1.24 2005-08-04 22:59:54 stephena Exp $
// $Id: Dialog.cxx,v 1.25 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -26,6 +26,7 @@
#include "Menu.hxx"
#include "Dialog.hxx"
#include "Widget.hxx"
#include "TabWidget.hxx"
/*
* TODO list
@ -38,18 +39,23 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Dialog::Dialog(OSystem* instance, DialogContainer* parent,
int x, int y, int w, int h)
: GuiObject(instance, parent, x, y, w, h),
_mouseWidget(0),
_focusedWidget(0),
_dragWidget(0),
_visible(true),
_openCount(0)
: GuiObject(instance, parent, x, y, w, h),
_mouseWidget(0),
_focusedWidget(0),
_dragWidget(0),
_visible(true),
_openCount(0),
_ourTab(NULL),
_focusID(0)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Dialog::~Dialog()
{
for(unsigned int i = 0; i < _ourFocusList.size(); ++i)
_ourFocusList[i].focusList.clear();
delete _firstWidget;
_firstWidget = NULL;
}
@ -65,20 +71,12 @@ cerr << " ==> Dialog::open()\n";
if(_openCount++ == 0)
loadConfig();
Widget* w = _firstWidget;
// Search for the first objects that wantsFocus() (if any) and give it the focus
while(w && !w->wantsFocus())
w = w->_next;
if(w)
{
w->receivedFocus();
_focusedWidget = w;
}
// (Re)-build the focus list to use for the widgets which are currently
// onscreen
buildFocusWidgetList(_focusID);
// Make all child widget dirty
w = _firstWidget;
Widget* w = _firstWidget;
Widget::setDirtyInChain(w);
}
@ -112,6 +110,74 @@ void Dialog::releaseFocus()
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Dialog::addFocusWidget(Widget* w)
{
if(_ourFocusList.size() == 0)
{
Focus f;
_ourFocusList.push_back(f);
}
_ourFocusList[0].focusList.push_back(w);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Dialog::addToFocusList(WidgetArray& list, int id)
{
id++; // Arrays start at 0, not -1.
// Make sure the array is large enough
while((int)_ourFocusList.size() <= id)
{
Focus f;
f.focusedWidget = NULL;
_ourFocusList.push_back(f);
}
_ourFocusList[id].focusList.push_back(list);
if(list.size() > 0)
_ourFocusList[id].focusedWidget = list[0];
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Dialog::buildFocusWidgetList(int id)
{
// Yes, this is hideously complex. That's the price we pay for
// tab navigation ...
// Remember which item previously had focus, but only if it belongs
// to this focus list
if(_focusID < (int)_ourFocusList.size() && _focusID != id &&
Widget::isWidgetInChain(_ourFocusList[_focusID].focusList, _focusedWidget))
_ourFocusList[_focusID].focusedWidget = _focusedWidget;
_focusID = id;
// Create a focuslist for items currently onscreen
// We do this by starting with any dialog focus list (at index 0 in the
// focus lists, then appending the list indicated by 'id'.
if(_focusID < (int)_ourFocusList.size())
{
_focusList.clear();
_focusList.push_back(_ourFocusList[0].focusList);
// Append extra focus list
if(_focusID > 0)
_focusList.push_back(_ourFocusList[_focusID].focusList);
// Only update _focusedWidget if it doesn't belong to the main focus list
if(!Widget::isWidgetInChain(_ourFocusList[0].focusList, _focusedWidget))
_focusedWidget = _ourFocusList[_focusID].focusedWidget;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Dialog::redrawFocus()
{
_focusedWidget = Widget::setFocusForChain(this, getFocusList(), _focusedWidget, 0);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Dialog::draw()
{
@ -137,8 +203,6 @@ void Dialog::drawDialog()
// Tell the framebuffer this area is dirty
fb.addDirtyRect(_x, _y, _w, _h);
_dirty = false;
}
// Draw all children
@ -148,6 +212,12 @@ void Dialog::drawDialog()
w->draw();
w = w->_next;
}
// Draw outlines for focused widgets
if(_dirty)
redrawFocus();
_dirty = false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -162,15 +232,8 @@ void Dialog::handleMouseDown(int x, int y, int button, int clickCount)
// focused one, change the focus to that widget.
if(w && w != _focusedWidget && w->wantsFocus())
{
// The focus will change. Tell the old focused widget (if any)
// that it lost the focus.
releaseFocus();
// Tell the new focused widget (if any) that it just gained the focus.
if(w)
w->receivedFocus();
_focusedWidget = w;
// Redraw widgets for new focus
_focusedWidget = Widget::setFocusForChain(this, getFocusList(), w, 0);
}
if(w)
@ -184,8 +247,6 @@ void Dialog::handleMouseUp(int x, int y, int button, int clickCount)
if(_focusedWidget)
{
//w = _focusedWidget;
// Lose focus on mouseup unless the widget requested to retain the focus
if(! (_focusedWidget->getFlags() & WIDGET_RETAIN_FOCUS ))
releaseFocus();
@ -218,9 +279,40 @@ void Dialog::handleMouseWheel(int x, int y, int direction)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Dialog::handleKeyDown(int ascii, int keycode, int modifiers)
{
if(_focusedWidget)
if (_focusedWidget->handleKeyDown(ascii, keycode, modifiers))
return;
// Test for TAB character
// Ctrl-Tab selects next tab
// Shift-Ctrl-Tab selects previous tab
// Tab sets next widget in current tab
// Shift-Tab sets previous widget in current tab
//
// Widgets are only cycled if currently focused key hasn't claimed
// the TAB key
// TODO - figure out workaround for this
if(keycode == 9) // tab key
{
if(_ourTab && instance()->eventHandler().kbdControl(modifiers))
{
if(instance()->eventHandler().kbdShift(modifiers))
_ourTab->cycleTab(-1);
else
_ourTab->cycleTab(+1);
return; // this key-combo is never passed to the child widget
}
else if(_focusedWidget && !(_focusedWidget->getFlags() & WIDGET_WANTS_TAB))
{
if(instance()->eventHandler().kbdShift(modifiers))
_focusedWidget = Widget::setFocusForChain(this, getFocusList(),
_focusedWidget, -1);
else
_focusedWidget = Widget::setFocusForChain(this, getFocusList(),
_focusedWidget, +1);
return; // this key-combo is never passed to the child widget
}
}
if (_focusedWidget)
_focusedWidget->handleKeyDown(ascii, keycode, modifiers);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -302,6 +394,11 @@ void Dialog::handleCommand(CommandSender* sender, int cmd, int data, int id)
{
switch(cmd)
{
case kTabChangedCmd:
// Add this focus list for the given tab to the global focus list
buildFocusWidgetList(++data);
break;
case kCloseCmd:
close();
break;
@ -324,3 +421,23 @@ ButtonWidget* Dialog::addButton(int x, int y, const string& label,
{
return new ButtonWidget(this, x, y, kButtonWidth, 16, label, cmd, hotkey);
}
/*
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void GuiObject::removeFromFocusList(WidgetArray& list)
{
for(int i = 0; i < (int)list.size(); ++i)
{
// Start searching from the end, since more than likely
// that's where the previously added widgets will be
for(int j = (int)_focusList.size() - 1; j >= 0; --j)
{
if(list[i] == _focusList[j])
{
_focusList.remove_at(j);
break;
}
}
}
}
*/

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Dialog.hxx,v 1.18 2005-07-05 15:25:44 stephena Exp $
// $Id: Dialog.hxx,v 1.19 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -24,6 +24,7 @@
class OSystem;
class DialogContainer;
class TabWidget;
#include "Command.hxx"
#include "Widget.hxx"
@ -35,12 +36,18 @@ class DialogContainer;
This is the base class for all dialog boxes.
@author Stephen Anthony
@version $Id: Dialog.hxx,v 1.18 2005-07-05 15:25:44 stephena Exp $
@version $Id: Dialog.hxx,v 1.19 2005-08-10 12:23:42 stephena Exp $
*/
class Dialog : public GuiObject
{
friend class DialogContainer;
struct Focus {
Widget* focusedWidget;
WidgetArray focusList;
};
typedef GUI::Array<Focus> FocusList;
public:
Dialog(OSystem* instance, DialogContainer* parent,
int x, int y, int w, int h);
@ -57,6 +64,11 @@ class Dialog : public GuiObject
virtual void saveConfig() {}
virtual void setDefaults() {}
void addFocusWidget(Widget* w);
void addToFocusList(WidgetArray& list, int id = -1);
void redrawFocus();
void addTabWidget(TabWidget* w) { _ourTab = w; }
protected:
virtual void draw();
void releaseFocus();
@ -79,6 +91,9 @@ class Dialog : public GuiObject
void setResult(int result) { _result = result; }
int getResult() const { return _result; }
private:
void buildFocusWidgetList(int id);
protected:
Widget* _mouseWidget;
Widget* _focusedWidget;
@ -87,7 +102,11 @@ class Dialog : public GuiObject
int _openCount;
private:
FocusList _ourFocusList;
TabWidget* _ourTab;
int _result;
int _focusID;
};
#endif

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: DialogContainer.cxx,v 1.14 2005-08-04 22:59:54 stephena Exp $
// $Id: DialogContainer.cxx,v 1.15 2005-08-10 12:23:42 stephena Exp $
//============================================================================
#include "OSystem.hxx"
@ -93,7 +93,10 @@ void DialogContainer::draw(bool fullrefresh)
void DialogContainer::addDialog(Dialog* d)
{
myDialogStack.push(d);
d->open();
myOSystem->frameBuffer().refreshTIA();
myOSystem->frameBuffer().refreshOverlay();
// d->open(); // FIXME
d->setDirty(); // Next update() will take care of drawing
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: EditNumWidget.cxx,v 1.7 2005-08-01 22:33:15 stephena Exp $
// $Id: EditNumWidget.cxx,v 1.8 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -28,10 +28,9 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EditNumWidget::EditNumWidget(GuiObject* boss, int x, int y, int w, int h,
const string& text)
: EditableWidget(boss, x, y - 1, w, h + 2)
: EditableWidget(boss, x, y, w, h)
{
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS |
WIDGET_TAB_NAVIGATE;
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS;
_type = kEditTextWidget;
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: EditTextWidget.cxx,v 1.7 2005-08-01 22:33:15 stephena Exp $
// $Id: EditTextWidget.cxx,v 1.8 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -30,8 +30,7 @@ EditTextWidget::EditTextWidget(GuiObject* boss, int x, int y, int w, int h,
const string& text)
: EditableWidget(boss, x, y - 1, w, h + 2)
{
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS |
WIDGET_TAB_NAVIGATE;
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS;
_type = kEditTextWidget;
setEditString(text);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: EventMappingDialog.cxx,v 1.17 2005-08-01 22:33:15 stephena Exp $
// $Id: EventMappingDialog.cxx,v 1.18 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -46,7 +46,8 @@ EventMappingDialog::EventMappingDialog(OSystem* osystem, DialogContainer* parent
myActionsList = new ListWidget(this, 10, 20, 150, 100);
myActionsList->setNumberingMode(kListNumberingOff);
myActionsList->setEditable(false);
myActionsList->clearFlags(WIDGET_TAB_NAVIGATE);
myActionsList->setFlags(WIDGET_NODRAW_FOCUS);
addFocusWidget(myActionsList);
myKeyMapping = new StaticTextWidget(this, 10, 125, w - 20, kFontHeight,
"Action: ", kTextAlignLeft);
@ -56,7 +57,7 @@ EventMappingDialog::EventMappingDialog(OSystem* osystem, DialogContainer* parent
myMapButton = addButton(170, 25, "Map", kStartMapCmd, 0);
myEraseButton = addButton(170, 45, "Erase", kEraseCmd, 0);
myCancelMapButton = addButton(170, 65, "Cancel", kStopMapCmd, 0);
myCancelMapButton->setEnabled(false);
myCancelMapButton->clearFlags(WIDGET_ENABLED);
// Add 'mouse to paddle' mapping
myPaddleModeText = new StaticTextWidget(this, 168, 93, 50, kFontHeight,

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: GuiObject.hxx,v 1.13 2005-08-01 22:33:15 stephena Exp $
// $Id: GuiObject.hxx,v 1.14 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -27,12 +27,15 @@ class DialogContainer;
class Widget;
#include "Command.hxx"
#include "Array.hxx"
typedef GUI::Array<Widget*> WidgetArray;
/**
This is the base class for all GUI objects/widgets.
@author Stephen Anthony
@version $Id: GuiObject.hxx,v 1.13 2005-08-01 22:33:15 stephena Exp $
@version $Id: GuiObject.hxx,v 1.14 2005-08-10 12:23:42 stephena Exp $
*/
class GuiObject : public CommandReceiver
{
@ -41,16 +44,16 @@ class GuiObject : public CommandReceiver
public:
GuiObject(OSystem* osystem, DialogContainer* parent, int x, int y, int w, int h)
: myOSystem(osystem),
myParent(parent),
_x(x),
_y(y),
_w(w),
_h(h),
_dirty(true),
_firstWidget(0) { }
: myOSystem(osystem),
myParent(parent),
_x(x),
_y(y),
_w(w),
_h(h),
_dirty(true),
_firstWidget(0) {}
virtual ~GuiObject() { }
virtual ~GuiObject() {}
OSystem* instance() { return myOSystem; }
DialogContainer* parent() { return myParent; }
@ -70,7 +73,17 @@ class GuiObject : public CommandReceiver
virtual bool isVisible() const = 0;
virtual void draw() = 0;
static void resetActiveWidget() { _activeWidget = NULL; }
/** Add given widget to the focus list */
virtual void addFocusWidget(Widget* w) = 0;
/** Return focus list for this object */
WidgetArray& getFocusList() { return _focusList; }
/** Redraw the focus list */
virtual void redrawFocus() {}
protected:
virtual void releaseFocus() = 0;
protected:
OSystem* myOSystem;
@ -78,14 +91,10 @@ class GuiObject : public CommandReceiver
int _x, _y;
int _w, _h;
bool _dirty;
Widget* _firstWidget;
static Widget* _activeWidget;
protected:
virtual void releaseFocus() = 0;
WidgetArray _focusList;
};
#endif

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: GuiUtils.hxx,v 1.16 2005-08-02 18:28:29 stephena Exp $
// $Id: GuiUtils.hxx,v 1.17 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -29,7 +29,7 @@
Probably not very neat, but at least it works ...
@author Stephen Anthony
@version $Id: GuiUtils.hxx,v 1.16 2005-08-02 18:28:29 stephena Exp $
@version $Id: GuiUtils.hxx,v 1.17 2005-08-10 12:23:42 stephena Exp $
*/
#define kFontHeight 10
@ -56,7 +56,7 @@ enum {
kPrevCmd = 'PREV',
kDefaultsCmd = 'DEFA',
kSetPositionCmd = 'SETP',
kActiveWidgetCmd = 'ACTW',
kTabChangedCmd = 'TBCH',
kCheckActionCmd = 'CBAC',
kRefreshAllCmd = 'REFA',
kRendererChanged,

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: InputTextDialog.cxx,v 1.2 2005-08-04 22:59:54 stephena Exp $
// $Id: InputTextDialog.cxx,v 1.3 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -61,8 +61,7 @@ InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font)
_input = new EditNumWidget(this, xpos, ypos,
_w - xpos - 10, lineHeight, "");
_input->setFont(font);
_input->clearFlags(WIDGET_TAB_NAVIGATE);
_input->receivedFocus();
addFocusWidget(_input);
xpos = 10; ypos = 2*lineHeight;
_title = new StaticTextWidget(this, xpos, ypos, _w - 2*xpos, fontHeight,

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: LauncherDialog.cxx,v 1.26 2005-08-04 22:59:54 stephena Exp $
// $Id: LauncherDialog.cxx,v 1.27 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -95,7 +95,8 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
myList = new ListWidget(this, 10, 24, _w - 20, _h - 24 - 26 - 10 - 10);
myList->setNumberingMode(kListNumberingOff);
myList->setEditable(false);
myList->clearFlags(WIDGET_TAB_NAVIGATE);
myList->setFlags(WIDGET_NODRAW_FOCUS);
addFocusWidget(myList);
// Add note textwidget to show any notes for the currently selected ROM
new StaticTextWidget(this, 20, _h - 43, 30, fontHeight, "Note:", kTextAlignLeft);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: LauncherOptionsDialog.cxx,v 1.8 2005-08-01 22:33:15 stephena Exp $
// $Id: LauncherOptionsDialog.cxx,v 1.9 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -91,7 +91,7 @@ LauncherOptionsDialog::LauncherOptionsDialog(
int baseH = instance()->frameBuffer().baseHeight();
myBrowser = new BrowserDialog(this, 60, 20, baseW - 120, baseH - 40);
loadConfig();
loadConfig(); // FIXME
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -103,6 +103,7 @@ LauncherOptionsDialog::~LauncherOptionsDialog()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherOptionsDialog::loadConfig()
{
cerr << "LauncherOptionsDialog::loadConfig()\n";
string s;
bool b;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: ListWidget.cxx,v 1.24 2005-08-01 22:33:15 stephena Exp $
// $Id: ListWidget.cxx,v 1.25 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -37,8 +37,7 @@ ListWidget::ListWidget(GuiObject* boss, int x, int y, int w, int h)
{
_w = w - kScrollBarWidth;
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS |
WIDGET_TAB_NAVIGATE;
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS;
_type = kListWidget;
_editMode = false;
_numberingMode = kListNumberingOne;
@ -125,10 +124,6 @@ void ListWidget::handleMouseDown(int x, int y, int button, int clickCount)
if (!isEnabled())
return;
// A click indicates this widget has been selected
// It should receive focus (because it has the WIDGET_TAB_NAVIGATE property)
receivedFocus();
// First check whether the selection changed
int newSelectedItem;
newSelectedItem = findItem(x, y);
@ -141,11 +136,11 @@ void ListWidget::handleMouseDown(int x, int y, int button, int clickCount)
abortEditMode();
_selectedItem = newSelectedItem;
sendCommand(kListSelectionChangedCmd, _selectedItem, _id);
setDirty(); draw();
}
// TODO: Determine where inside the string the user clicked and place the
// caret accordingly. See _editScrollOffset and EditTextWidget::handleMouseDown.
setDirty(); draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: OptionsDialog.cxx,v 1.22 2005-08-05 02:28:22 urchlay Exp $
// $Id: OptionsDialog.cxx,v 1.23 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -77,7 +77,7 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent)
addBigButton("Audio Settings", kAudCmd, 0);
#else
ButtonWidget* b = addBigButton("Audio Settings", kAudCmd, 0);
b->setEnabled(false);
b->clearFlags(WIDGET_ENABLED);
#endif
addBigButton("Event Mapping", kEMapCmd, 0);
addBigButton("Game Information", kInfoCmd, 0);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: ScrollBarWidget.cxx,v 1.10 2005-08-01 22:33:16 stephena Exp $
// $Id: ScrollBarWidget.cxx,v 1.11 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -246,7 +246,7 @@ void ScrollBarWidget::recalc()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ScrollBarWidget::drawWidget(bool hilite)
{
cerr << "ScrollBarWidget::drawWidget\n";
//cerr << "ScrollBarWidget::drawWidget\n";
FrameBuffer& fb = _boss->instance()->frameBuffer();
int bottomY = _y + _h;
bool isSinglePage = (_numEntries <= _entriesPerPage);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: TabWidget.cxx,v 1.16 2005-08-03 13:26:02 stephena Exp $
// $Id: TabWidget.cxx,v 1.17 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -25,6 +25,7 @@
#include "bspf.hxx"
#include "GuiObject.hxx"
#include "Widget.hxx"
#include "Dialog.hxx"
#include "TabWidget.hxx"
enum {
@ -33,18 +34,16 @@ enum {
kTabPadding = 3
};
Widget* GuiObject::_activeWidget;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TabWidget::TabWidget(GuiObject *boss, int x, int y, int w, int h)
TabWidget::TabWidget(GuiObject* boss, int x, int y, int w, int h)
: Widget(boss, x, y, w, h),
CommandSender(boss)
CommandSender(boss),
_tabWidth(40),
_activeTab(-1),
_firstTime(true)
{
_flags = WIDGET_ENABLED | WIDGET_CLEARBG;
_type = kTabWidget;
_activeTab = -1;
_tabWidth = 40;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -55,7 +54,6 @@ TabWidget::~TabWidget()
delete _tabs[i].firstWidget;
_tabs[i].firstWidget = 0;
// _tabs[i].parentWidget is deleted elsewhere
// _tabs[i].activeWidget is deleted elsewhere
}
_tabs.clear();
}
@ -74,7 +72,6 @@ int TabWidget::addTab(const string& title)
newTab.title = title;
newTab.firstWidget = NULL;
newTab.parentWidget = NULL;
newTab.activeWidget = NULL;
_tabs.push_back(newTab);
@ -96,35 +93,33 @@ int TabWidget::addTab(const string& title)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TabWidget::setActiveTab(int tabID)
void TabWidget::setActiveTab(int tabID, bool show)
{
assert(0 <= tabID && tabID < (int)_tabs.size());
if(_tabs[tabID].parentWidget)
_tabs[tabID].parentWidget->loadConfig();
if (_activeTab != tabID)
if (_activeTab != -1)
{
// Exchange the widget lists, and switch to the new tab
if (_activeTab != -1)
_tabs[_activeTab].firstWidget = _firstWidget;
_activeTab = tabID;
_firstWidget = _tabs[tabID].firstWidget;
// If a widget has been activated elsewhere and it belongs to the
// current view, use it. Otherwise use the default.
if(_activeWidget && isWidgetInChain(_firstWidget, _activeWidget))
_tabs[tabID].activeWidget = _activeWidget;
else
_activeWidget = _tabs[tabID].activeWidget;
// Make sure this widget receives focus, and that the other widgets
// in the tabview lose focus
if(_activeWidget)
_activeWidget->receivedFocus();
_tabs[_activeTab].firstWidget = _firstWidget;
}
_activeTab = tabID;
_firstWidget = _tabs[tabID].firstWidget;
// Let parent know about the tab change
if(show)
sendCommand(kTabChangedCmd, _activeTab, -1);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TabWidget::updateActiveTab()
{
if(_activeTab < 0)
return;
if(_tabs[_activeTab].parentWidget)
_tabs[_activeTab].parentWidget->loadConfig();
setDirty(); draw();
}
@ -151,33 +146,15 @@ void TabWidget::cycleTab(int direction)
}
// Finally, select the active tab
setActiveTab(tabID);
setActiveTab(tabID, true);
updateActiveTab();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TabWidget::cycleWidget(int direction)
{
// Don't do anything if no tabs have been defined
if(_activeTab == -1)
return;
if(direction == -1)
Widget::setPrevInChain(_tabs[_activeTab].firstWidget,
_tabs[_activeTab].activeWidget);
else if(direction == +1)
Widget::setNextInChain(_tabs[_activeTab].firstWidget,
_tabs[_activeTab].activeWidget);
Widget::setDirtyInChain(_tabs[_activeTab].firstWidget);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TabWidget::setParentWidget(int tabID, Widget* parent, Widget* active)
void TabWidget::setParentWidget(int tabID, Widget* parent)
{
assert(0 <= tabID && tabID < (int)_tabs.size());
_tabs[tabID].parentWidget = parent;
_tabs[tabID].activeWidget = active;
_tabs[tabID].activeWidget->receivedFocus();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -197,43 +174,10 @@ void TabWidget::handleMouseDown(int x, int y, int button, int clickCount)
// If a tab was clicked, switch to that pane
if (tabID >= 0 && tabID != _activeTab)
setActiveTab(tabID);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool TabWidget::handleKeyDown(int ascii, int keycode, int modifiers)
{
// Test for TAB character
// Ctrl-Tab selects next tab
// Shift-Ctrl-Tab selects previous tab
// Tab sets next widget in current tab
// Shift-Tab sets previous widget in current tab
if(keycode == 9) // tab key
{
if(_boss->instance()->eventHandler().kbdControl(modifiers))
{
if(_boss->instance()->eventHandler().kbdShift(modifiers))
cycleTab(-1);
else
cycleTab(+1);
return true; // this key-combo is never passed to the child widget
}
else if(_activeWidget && (_activeWidget->getFlags() & WIDGET_TAB_NAVIGATE))
{
if(_boss->instance()->eventHandler().kbdShift(modifiers))
cycleWidget(-1);
else
cycleWidget(+1);
return true; // swallow tab key if the current widget wants navigation
}
setActiveTab(tabID, true);
updateActiveTab();
}
if (_activeWidget)
return _activeWidget->handleKeyDown(ascii, keycode, modifiers);
else
return Widget::handleKeyDown(ascii, keycode, modifiers);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -241,15 +185,6 @@ void TabWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
{
switch(cmd)
{
case kActiveWidgetCmd:
if(_activeWidget && isWidgetInChain(_firstWidget, _activeWidget))
{
_tabs[_activeTab].activeWidget = _activeWidget;
Widget::setFocusForChain(_firstWidget, _activeWidget);
setActiveTab(_activeTab);
}
break;
default:
sendCommand(cmd, data, _id);
break;
@ -259,12 +194,14 @@ void TabWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TabWidget::loadConfig()
{
cerr << "TabWidget::loadConfig()\n";
//cerr << "TabWidget::loadConfig()\n";
if(_firstTime)
{
setActiveTab(_activeTab, true);
_firstTime = false;
}
// Make sure changes are seen onscreen
// For efficiency reasons, only update the tab which is visible
// Others will be updated when they're selected
setActiveTab(_activeTab);
updateActiveTab();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -290,7 +227,7 @@ void TabWidget::box(int x, int y, int width, int height,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TabWidget::drawWidget(bool hilite)
{
cerr << "TabWidget::drawWidget\n";
//cerr << "TabWidget::drawWidget: " << _tabs[_activeTab].firstWidget << endl;
// The tab widget is strange in that it acts as both a widget (obviously)
// and a dialog (it contains other widgets). Because of the latter,
// it must assume responsibility for refreshing all its children.
@ -327,6 +264,9 @@ cerr << "TabWidget::drawWidget\n";
fb.hLine(_x+1, _y + _h - 1, _x + _w - 2, kColor);
fb.vLine(_x + _w - 2, _y + kTabHeight - 1, _y + _h - 2, kColor);
fb.vLine(_x + _w - 1, _y + kTabHeight - 1, _y + _h - 2, kShadowColor);
// Redraw focused areas
_boss->redrawFocus();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: TabWidget.hxx,v 1.8 2005-07-05 15:25:44 stephena Exp $
// $Id: TabWidget.hxx,v 1.9 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -38,12 +38,11 @@ class TabWidget : public Widget, public CommandSender
string title;
Widget* firstWidget;
Widget* parentWidget;
Widget* activeWidget;
};
typedef GUI::Array<Tab> TabList;
public:
TabWidget(GuiObject *boss, int x, int y, int w, int h);
TabWidget(GuiObject* boss, int x, int y, int w, int h);
~TabWidget();
virtual int getChildY() const;
@ -58,31 +57,32 @@ class TabWidget : public Widget, public CommandSender
// Maybe we need to remove tabs again? Hm
//void removeTab(int tabID);
// Setting the active tab:
void setActiveTab(int tabID);
void setActiveTab(int tabID, bool show = false);
void cycleTab(int direction);
void cycleWidget(int direction);
// setActiveTab changes the value of _firstWidget. This means Widgets added afterwards
// will be added to the active tab.
void setParentWidget(int tabID, Widget* parent, Widget* active);
void setParentWidget(int tabID, Widget* parent);
virtual void handleMouseDown(int x, int y, int button, int clickCount);
virtual bool handleKeyDown(int ascii, int keycode, int modifiers);
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
virtual void loadConfig();
protected:
virtual void drawWidget(bool hilite);
virtual Widget *findWidget(int x, int y);
virtual Widget* findWidget(int x, int y);
protected:
int _activeTab;
TabList _tabs;
int _tabWidth;
int _activeTab;
bool _firstTime;
private:
void box(int x, int y, int width, int height,
OverlayColor colorA, OverlayColor colorB, bool omitBottom);
void updateActiveTab();
};
#endif

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: ToggleBitWidget.cxx,v 1.6 2005-08-02 18:28:29 stephena Exp $
// $Id: ToggleBitWidget.cxx,v 1.7 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -29,8 +29,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ToggleBitWidget::ToggleBitWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int cols, int rows, int colchars)
: Widget(boss, x, y, cols*(colchars * font.getMaxCharWidth() + 8) + 1,
font.getLineHeight()*rows + 1),
: Widget(boss, x, y, 16, 16),
CommandSender(boss),
_rows(rows),
_cols(cols),
@ -40,10 +39,13 @@ ToggleBitWidget::ToggleBitWidget(GuiObject* boss, const GUI::Font& font,
_colWidth(colchars * font.getMaxCharWidth() + 8),
_selectedItem(0)
{
// Calculate real dimensions
_w = cols*(colchars * font.getMaxCharWidth() + 8) + 1;
_h = font.getLineHeight()*rows + 1;
setFont(font);
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS |
WIDGET_TAB_NAVIGATE;
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS;
_type = kToggleBitWidget;
}
@ -71,6 +73,8 @@ void ToggleBitWidget::setState(const BoolArray& state, const BoolArray& changed)
_stateList = state;
_changedList.clear();
_changedList = changed;
setDirty(); draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -79,10 +83,6 @@ void ToggleBitWidget::handleMouseDown(int x, int y, int button, int clickCount)
if (!isEnabled())
return;
// A click indicates this widget has been selected
// It should receive focus (because it has the WIDGET_TAB_NAVIGATE property)
receivedFocus();
// First check whether the selection changed
int newSelectedItem;
newSelectedItem = findItem(x, y);
@ -94,9 +94,8 @@ void ToggleBitWidget::handleMouseDown(int x, int y, int button, int clickCount)
_selectedItem = newSelectedItem;
_currentRow = _selectedItem / _cols;
_currentCol = _selectedItem - (_currentRow * _cols);
setDirty(); draw();
}
setDirty(); draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: VideoDialog.cxx,v 1.19 2005-08-01 22:33:16 stephena Exp $
// $Id: VideoDialog.cxx,v 1.20 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -137,8 +137,6 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
addButton(_w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd, 0);
addButton(_w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
#endif
setDefaults();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Widget.cxx,v 1.26 2005-08-01 22:33:16 stephena Exp $
// $Id: Widget.cxx,v 1.27 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -52,6 +52,8 @@ Widget::~Widget()
{
delete _next;
_next = NULL;
_focusList.clear();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -93,11 +95,6 @@ void Widget::draw()
// Now perform the actual widget draw
drawWidget((_flags & WIDGET_HILITED) ? true : false);
// Indicate if this is the currently active widget
// by drawing a box around it.
if((_activeWidget == this) && (_flags & WIDGET_TAB_NAVIGATE))
fb.frameRect(_x-1, _y-1, _w+2, _h+2, kTextColorEm, kDashLine);
// Restore x/y
if (_flags & WIDGET_BORDER) {
_x -= 4;
@ -129,14 +126,16 @@ void Widget::receivedFocus()
_hasFocus = true;
receivedFocusWidget();
}
// Only signal a new active widget if the widget has defined that capability
// We only care about widgets with WIDGET_TAB_NAVIGATE property
if(getFlags() & WIDGET_TAB_NAVIGATE)
{
_activeWidget = this;
_boss->handleCommand(NULL, kActiveWidgetCmd, 0, 0);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Widget::lostFocus()
{
if(!_hasFocus)
return;
_hasFocus = false;
lostFocusWidget();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -187,147 +186,89 @@ bool Widget::isWidgetInChain(Widget* w, Widget* find)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Widget::setFocusForChain(Widget* w, Widget* hasFocus)
bool Widget::isWidgetInChain(WidgetArray& list, Widget* find)
{
if(!hasFocus)
return;
bool found = false;
while(w)
for(int i = 0; i < (int)list.size(); ++i)
{
if(w != hasFocus)
w->lostFocus();
w = w->_next;
if(list[i] == find)
{
found = true;
break;
}
}
return found;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Widget::setPrevInChain(Widget* start, Widget* hasFocus)
Widget* Widget::setFocusForChain(GuiObject* boss, WidgetArray& arr,
Widget* wid, int direction)
{
if(!start)
return;
// We search the array in circular fashion until the 'end' is reached
Widget* w = hasFocus;
Widget* active = NULL;
if(w) // start from 'hasFocus'
FrameBuffer& fb = boss->instance()->frameBuffer();
int size = arr.size(), pos = -1;
Widget* tmp;
for(int i = 0; i < size; ++i)
{
w = w->_next;
while(w)
{
if(w->getFlags() & WIDGET_TAB_NAVIGATE)
{
active = w;
break;
}
w = w->_next;
}
tmp = arr[i];
// If we haven't found an active widget by now, start searching from
// the beginning of the list
if(!active)
// Determine position of widget 'w'
if(wid == tmp)
pos = i;
int x = tmp->getAbsX() - 1, y = tmp->getAbsY() - 1,
w = tmp->getWidth() + 2, h = tmp->getHeight() + 2;
// First clear area surrounding all widgets
if(tmp->_hasFocus)
{
w = start;
while(w != hasFocus)
{
if(w->getFlags() & WIDGET_TAB_NAVIGATE)
{
active = w;
break;
}
w = w->_next;
}
}
}
else // start from the beginning, since no widget currently has focus
{
w = start;
while(w)
{
if(w->getFlags() & WIDGET_TAB_NAVIGATE)
{
active = w;
break;
}
w = w->_next;
tmp->lostFocus();
if(!(tmp->_flags & WIDGET_NODRAW_FOCUS))
fb.frameRect(x, y, w, h, kBGColor);
tmp->setDirty(); tmp->draw();
fb.addDirtyRect(x, y, w, h);
}
}
// At this point, we *should* have an active widget
if(active)
active->receivedFocus();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Widget::setNextInChain(Widget* start, Widget* hasFocus)
{
if(!start)
return;
// FIXME - get this working
//cerr << "--------------------------------\nWidget list:\n";
Widget* w1 = start;
while(w1)
{
if(w1->getFlags() & WIDGET_TAB_NAVIGATE)
{
// cerr << w1 << endl;
}
w1 = w1->_next;
}
//cerr << "\n--------------------------------\n";
// We search the array in circular fashion until the 'end' is reached
Widget* w = hasFocus;
Widget* active = NULL;
if(w) // start from 'hasFocus'
// Figure out which which should be active
if(pos == -1)
return 0;
else
{
w = w->_next;
while(w)
switch(direction)
{
if(w->getFlags() & WIDGET_TAB_NAVIGATE)
{
active = w;
case -1: // previous widget
pos--;
if(pos < 0)
pos = size - 1;
break;
}
w = w->_next;
}
// If we haven't found an active widget by now, start searching from
// the beginning of the list
if(!active)
{
w = start;
while(w != hasFocus)
{
if(w->getFlags() & WIDGET_TAB_NAVIGATE)
{
active = w;
break;
}
w = w->_next;
}
}
}
else // start from the beginning, since no widget currently has focus
{
w = start;
while(w)
{
if(w->getFlags() & WIDGET_TAB_NAVIGATE)
{
active = w;
case +1: // next widget
pos++;
if(pos >= size)
pos = 0;
break;
default:
// pos already set
break;
}
w = w->_next;
}
}
// At this point, we *should* have an active widget
if(active)
active->receivedFocus();
// Now highlight the active widget
tmp = arr[pos];
int x = tmp->getAbsX() - 1, y = tmp->getAbsY() - 1,
w = tmp->getWidth() + 2, h = tmp->getHeight() + 2;
tmp->receivedFocus();
if(!(tmp->_flags & WIDGET_NODRAW_FOCUS))
fb.frameRect(x, y, w, h, kTextColorEm, kDashLine);
tmp->setDirty(); tmp->draw();
fb.addDirtyRect(x, y, w, h);
return tmp;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -348,7 +289,7 @@ StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h,
{
_flags = WIDGET_ENABLED | WIDGET_CLEARBG;
_type = kStaticTextWidget;
setLabel(text);
_label = text;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Widget.hxx,v 1.26 2005-08-01 22:33:16 stephena Exp $
// $Id: Widget.hxx,v 1.27 2005-08-10 12:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -30,6 +30,7 @@ class Dialog;
#include "FrameBuffer.hxx"
#include "GuiObject.hxx"
#include "GuiUtils.hxx"
#include "Array.hxx"
#include "bspf.hxx"
enum {
@ -39,9 +40,10 @@ enum {
WIDGET_BORDER = 1 << 3,
WIDGET_INV_BORDER = 1 << 4,
WIDGET_CLEARBG = 1 << 5,
WIDGET_TAB_NAVIGATE = 1 << 7,
WIDGET_TRACK_MOUSE = 1 << 8,
WIDGET_RETAIN_FOCUS = 1 << 9
WIDGET_TRACK_MOUSE = 1 << 6,
WIDGET_RETAIN_FOCUS = 1 << 7,
WIDGET_NODRAW_FOCUS = 1 << 8,
WIDGET_WANTS_TAB = 1 << 9
};
enum {
@ -69,7 +71,7 @@ enum {
This is the base class for all widgets.
@author Stephen Anthony
@version $Id: Widget.hxx,v 1.26 2005-08-01 22:33:16 stephena Exp $
@version $Id: Widget.hxx,v 1.27 2005-08-10 12:23:42 stephena Exp $
*/
class Widget : public GuiObject
{
@ -95,18 +97,19 @@ class Widget : public GuiObject
void draw();
void receivedFocus();
void lostFocus() { _hasFocus = false; lostFocusWidget(); }
void lostFocus();
void addFocusWidget(Widget* w) { _focusList.push_back(w); }
virtual bool wantsFocus() { return false; };
/** Set/clear WIDGET_ENABLED flag and immediately redraw */
void setEnabled(bool e);
void setFlags(int flags) { _flags |= flags; }
void setFlags(int flags) { _flags |= flags; }
void clearFlags(int flags) { _flags &= ~flags; }
int getFlags() const { return _flags; }
int getFlags() const { return _flags; }
bool isEnabled() const { return _flags & WIDGET_ENABLED; }
bool isEnabled() const { return _flags & WIDGET_ENABLED; }
bool isVisible() const { return !(_flags & WIDGET_INVISIBLE); }
void setID(int id) { _id = id; }
@ -148,16 +151,13 @@ class Widget : public GuiObject
/** Determine if 'find' is in the chain pointed to by 'start' */
static bool isWidgetInChain(Widget* start, Widget* find);
/** Widget 'hasFocus' has focus, make all other widgets in chain lose focus */
static void setFocusForChain(Widget* start, Widget* hasFocus);
/** Determine if 'find' is in the widget array */
static bool isWidgetInChain(WidgetArray& list, Widget* find);
/** Select previous widget in chain with WIDGET_TAB_NOTIFY property to have
focus, starting from 'hasFocus' */
static void setPrevInChain(Widget* start, Widget* hasFocus);
/** Select next widget in chain with WIDGET_TAB_NOTIFY property to have
focus, starting from 'hasFocus' */
static void setNextInChain(Widget* start, Widget* hasFocus);
/** Select either previous, current, or next widget in chain to have
focus, and deselects all others */
static Widget* setFocusForChain(GuiObject* boss, WidgetArray& arr,
Widget* w, int direction);
/** Sets all widgets in this chain to be dirty (must be redrawn) */
static void setDirtyInChain(Widget* start);