mirror of https://github.com/stella-emu/stella.git
Fixed bug where no key events were being sent to any Tab child widget
that had WIDGET_TAB_NAVIGATE set (which is exactly the opposite of what we want). Added a dashed line to FrameBuffer::frameRect(). This is currently used to indicate which widget is selected in debugger mode. IMO, it looks much better than using a solid line. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@563 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
a935b2bcaf
commit
ed82864152
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: FrameBuffer.cxx,v 1.47 2005-06-23 14:33:11 stephena Exp $
|
// $Id: FrameBuffer.cxx,v 1.48 2005-06-25 16:35:36 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -557,12 +557,38 @@ void FrameBuffer::box(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void FrameBuffer::frameRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
|
void FrameBuffer::frameRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
|
||||||
OverlayColor color)
|
OverlayColor color, FrameStyle style)
|
||||||
{
|
{
|
||||||
hLine(x, y, x + w - 1, color);
|
switch(style)
|
||||||
hLine(x, y + h - 1, x + w - 1, color);
|
{
|
||||||
vLine(x, y, y + h - 1, color);
|
case kSolidLine:
|
||||||
vLine(x + w - 1, y, y + h - 1, color);
|
hLine(x, y, x + w - 1, color);
|
||||||
|
hLine(x, y + h - 1, x + w - 1, color);
|
||||||
|
vLine(x, y, y + h - 1, color);
|
||||||
|
vLine(x + w - 1, y, y + h - 1, color);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kDashLine:
|
||||||
|
unsigned int i, skip, lwidth = 1;
|
||||||
|
|
||||||
|
for(i = x, skip = 1; i < x+w-1; i=i+lwidth+1, ++skip)
|
||||||
|
{
|
||||||
|
if(skip % 2)
|
||||||
|
{
|
||||||
|
hLine(i, y, i + lwidth, color);
|
||||||
|
hLine(i, y + h - 1, i + lwidth, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(i = y, skip = 1; i < y+h-1; i=i+lwidth+1, ++skip)
|
||||||
|
{
|
||||||
|
if(skip % 2)
|
||||||
|
{
|
||||||
|
vLine(x, i, i + lwidth, color);
|
||||||
|
vLine(x + w - 1, i, i + lwidth, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: FrameBuffer.hxx,v 1.42 2005-06-23 14:33:11 stephena Exp $
|
// $Id: FrameBuffer.hxx,v 1.43 2005-06-25 16:35:36 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef FRAMEBUFFER_HXX
|
#ifndef FRAMEBUFFER_HXX
|
||||||
|
@ -33,9 +33,15 @@ class Console;
|
||||||
|
|
||||||
// Text alignment modes for drawString()
|
// Text alignment modes for drawString()
|
||||||
enum TextAlignment {
|
enum TextAlignment {
|
||||||
kTextAlignLeft,
|
kTextAlignLeft,
|
||||||
kTextAlignCenter,
|
kTextAlignCenter,
|
||||||
kTextAlignRight
|
kTextAlignRight
|
||||||
|
};
|
||||||
|
|
||||||
|
// Line types for drawing rectangular frames
|
||||||
|
enum FrameStyle {
|
||||||
|
kSolidLine,
|
||||||
|
kDashLine
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,7 +52,7 @@ enum TextAlignment {
|
||||||
All GUI elements (ala ScummVM) are drawn here as well.
|
All GUI elements (ala ScummVM) are drawn here as well.
|
||||||
|
|
||||||
@author Stephen Anthony
|
@author Stephen Anthony
|
||||||
@version $Id: FrameBuffer.hxx,v 1.42 2005-06-23 14:33:11 stephena Exp $
|
@version $Id: FrameBuffer.hxx,v 1.43 2005-06-25 16:35:36 stephena Exp $
|
||||||
*/
|
*/
|
||||||
class FrameBuffer
|
class FrameBuffer
|
||||||
{
|
{
|
||||||
|
@ -233,7 +239,7 @@ class FrameBuffer
|
||||||
@param color The color of the surrounding frame
|
@param color The color of the surrounding frame
|
||||||
*/
|
*/
|
||||||
void frameRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
|
void frameRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
|
||||||
OverlayColor color);
|
OverlayColor color, FrameStyle style = kSolidLine);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This method should be called to draw the specified string.
|
This method should be called to draw the specified string.
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: TabWidget.cxx,v 1.11 2005-06-24 12:01:27 stephena Exp $
|
// $Id: TabWidget.cxx,v 1.12 2005-06-25 16:35:36 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -204,12 +204,6 @@ void TabWidget::handleMouseDown(int x, int y, int button, int clickCount)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool TabWidget::handleKeyDown(int ascii, int keycode, int modifiers)
|
bool TabWidget::handleKeyDown(int ascii, int keycode, int modifiers)
|
||||||
{
|
{
|
||||||
// Pass the tab key to the activeWidget if we know that widget
|
|
||||||
// navigation won't be needed
|
|
||||||
bool navigateWanted = false;
|
|
||||||
if(_activeWidget && (_activeWidget->getFlags() & WIDGET_TAB_NAVIGATE))
|
|
||||||
navigateWanted = true;
|
|
||||||
|
|
||||||
// Test for TAB character
|
// Test for TAB character
|
||||||
// Ctrl-Tab selects next tab
|
// Ctrl-Tab selects next tab
|
||||||
// Shift-Ctrl-Tab selects previous tab
|
// Shift-Ctrl-Tab selects previous tab
|
||||||
|
@ -223,20 +217,21 @@ bool TabWidget::handleKeyDown(int ascii, int keycode, int modifiers)
|
||||||
cycleTab(-1);
|
cycleTab(-1);
|
||||||
else
|
else
|
||||||
cycleTab(+1);
|
cycleTab(+1);
|
||||||
|
|
||||||
|
return true; // this key-combo is never passed to the child widget
|
||||||
}
|
}
|
||||||
else if(navigateWanted)
|
else if(_activeWidget && (_activeWidget->getFlags() & WIDGET_TAB_NAVIGATE))
|
||||||
{
|
{
|
||||||
if(_boss->instance()->eventHandler().kbdShift(modifiers))
|
if(_boss->instance()->eventHandler().kbdShift(modifiers))
|
||||||
cycleWidget(-1);
|
cycleWidget(-1);
|
||||||
else
|
else
|
||||||
cycleWidget(+1);
|
cycleWidget(+1);
|
||||||
}
|
|
||||||
|
|
||||||
if(navigateWanted)
|
return true; // swallow tab key if the current widget wants navigation
|
||||||
return true;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_activeWidget && !navigateWanted)
|
if (_activeWidget)
|
||||||
return _activeWidget->handleKeyDown(ascii, keycode, modifiers);
|
return _activeWidget->handleKeyDown(ascii, keycode, modifiers);
|
||||||
else
|
else
|
||||||
return Widget::handleKeyDown(ascii, keycode, modifiers);
|
return Widget::handleKeyDown(ascii, keycode, modifiers);
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: Widget.cxx,v 1.19 2005-06-23 14:33:12 stephena Exp $
|
// $Id: Widget.cxx,v 1.20 2005-06-25 16:35:36 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -91,7 +91,7 @@ void Widget::draw()
|
||||||
// Indicate if this is the currently active widget
|
// Indicate if this is the currently active widget
|
||||||
// by drawing a box around it.
|
// by drawing a box around it.
|
||||||
if((_activeWidget == this) && (_flags & WIDGET_TAB_NAVIGATE))
|
if((_activeWidget == this) && (_flags & WIDGET_TAB_NAVIGATE))
|
||||||
fb.frameRect(_x-1, _y-1, _w+2, _h+2, kTextColorEm); // FIXME - maybe chose a better color
|
fb.frameRect(_x-1, _y-1, _w+2, _h+2, kTextColorEm, kDashLine);
|
||||||
|
|
||||||
// Restore x/y
|
// Restore x/y
|
||||||
if (_flags & WIDGET_BORDER) {
|
if (_flags & WIDGET_BORDER) {
|
||||||
|
|
Loading…
Reference in New Issue