2005-04-04 02:19:22 +00:00
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// SSSS tt lll lll
|
|
|
|
// SS SS tt ll ll
|
|
|
|
// SS tttttt eeee ll ll aaaa
|
|
|
|
// SSSS tt ee ee ll ll aa
|
|
|
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
|
|
|
// SS SS tt ee ll ll aa aa
|
|
|
|
// SSSS ttt eeeee llll llll aaaaa
|
|
|
|
//
|
2013-01-04 19:49:01 +00:00
|
|
|
// Copyright (c) 1995-2013 by Bradford W. Mott, Stephen Anthony
|
2010-04-10 21:37:23 +00:00
|
|
|
// and the Stella Team
|
2005-04-04 02:19:22 +00:00
|
|
|
//
|
2010-01-10 03:23:32 +00:00
|
|
|
// See the file "License.txt" for information on usage and redistribution of
|
2005-04-04 02:19:22 +00:00
|
|
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
|
|
|
//
|
2009-05-13 13:55:40 +00:00
|
|
|
// $Id$
|
2005-04-04 02:19:22 +00:00
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
#include "OSystem.hxx"
|
|
|
|
#include "Dialog.hxx"
|
|
|
|
#include "FrameBuffer.hxx"
|
|
|
|
#include "ScrollBarWidget.hxx"
|
|
|
|
#include "bspf.hxx"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* TODO:
|
|
|
|
* - Allow for a horizontal scrollbar, too?
|
|
|
|
* - If there are less items than fit on one pages, no scrolling can be done
|
|
|
|
* and we thus should not highlight the arrows/slider.
|
|
|
|
*/
|
|
|
|
|
More cleanups to the UI.
Context menus, both as right-mouse button popups and those part of
PopupWidgets now have arrows that support scrolling, without having to
continuously click the mouse button. The scroll arrow color also
changes to disabled when they reach the upper or lower range.
Also, the maximum number of items shown in a ContextMenu is now 16,
which looks quite a bit nicer than showing 30 or so all at once.
ScrollBarWidget now looks a little nicer, as the scroll bar is a little
wider, and the arrows are larger (same ones from ContextMenu). As well,
click and hold works on the scroll buttons, even during mouse movement.
This means you no longer have to hold the mouse completely still to
get continuous mouse click events.
Dialogs can now register whether they want to receive continuous mouse
click events (aka, click and hold of a mouse button). Most dialogs
don't need it, and some even work incorrectly when it's activated.
This fixes a bug in ContextMenu, where click and hold on a PopupWidget
would continuously open and close the list of items.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2080 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-07-30 17:25:28 +00:00
|
|
|
#define UP_DOWN_BOX_HEIGHT 18
|
2005-04-04 02:19:22 +00:00
|
|
|
|
|
|
|
// Up arrow
|
2005-05-13 18:28:06 +00:00
|
|
|
static unsigned int up_arrow[8] = {
|
2009-01-04 02:28:12 +00:00
|
|
|
0x00011000,
|
More cleanups to the UI.
Context menus, both as right-mouse button popups and those part of
PopupWidgets now have arrows that support scrolling, without having to
continuously click the mouse button. The scroll arrow color also
changes to disabled when they reach the upper or lower range.
Also, the maximum number of items shown in a ContextMenu is now 16,
which looks quite a bit nicer than showing 30 or so all at once.
ScrollBarWidget now looks a little nicer, as the scroll bar is a little
wider, and the arrows are larger (same ones from ContextMenu). As well,
click and hold works on the scroll buttons, even during mouse movement.
This means you no longer have to hold the mouse completely still to
get continuous mouse click events.
Dialogs can now register whether they want to receive continuous mouse
click events (aka, click and hold of a mouse button). Most dialogs
don't need it, and some even work incorrectly when it's activated.
This fixes a bug in ContextMenu, where click and hold on a PopupWidget
would continuously open and close the list of items.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2080 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-07-30 17:25:28 +00:00
|
|
|
0x00011000,
|
|
|
|
0x00111100,
|
2009-01-04 02:28:12 +00:00
|
|
|
0x00111100,
|
|
|
|
0x01111110,
|
More cleanups to the UI.
Context menus, both as right-mouse button popups and those part of
PopupWidgets now have arrows that support scrolling, without having to
continuously click the mouse button. The scroll arrow color also
changes to disabled when they reach the upper or lower range.
Also, the maximum number of items shown in a ContextMenu is now 16,
which looks quite a bit nicer than showing 30 or so all at once.
ScrollBarWidget now looks a little nicer, as the scroll bar is a little
wider, and the arrows are larger (same ones from ContextMenu). As well,
click and hold works on the scroll buttons, even during mouse movement.
This means you no longer have to hold the mouse completely still to
get continuous mouse click events.
Dialogs can now register whether they want to receive continuous mouse
click events (aka, click and hold of a mouse button). Most dialogs
don't need it, and some even work incorrectly when it's activated.
This fixes a bug in ContextMenu, where click and hold on a PopupWidget
would continuously open and close the list of items.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2080 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-07-30 17:25:28 +00:00
|
|
|
0x01111110,
|
2009-01-04 02:28:12 +00:00
|
|
|
0x11111111,
|
More cleanups to the UI.
Context menus, both as right-mouse button popups and those part of
PopupWidgets now have arrows that support scrolling, without having to
continuously click the mouse button. The scroll arrow color also
changes to disabled when they reach the upper or lower range.
Also, the maximum number of items shown in a ContextMenu is now 16,
which looks quite a bit nicer than showing 30 or so all at once.
ScrollBarWidget now looks a little nicer, as the scroll bar is a little
wider, and the arrows are larger (same ones from ContextMenu). As well,
click and hold works on the scroll buttons, even during mouse movement.
This means you no longer have to hold the mouse completely still to
get continuous mouse click events.
Dialogs can now register whether they want to receive continuous mouse
click events (aka, click and hold of a mouse button). Most dialogs
don't need it, and some even work incorrectly when it's activated.
This fixes a bug in ContextMenu, where click and hold on a PopupWidget
would continuously open and close the list of items.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2080 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-07-30 17:25:28 +00:00
|
|
|
0x11111111
|
2005-04-04 02:19:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Down arrow
|
2005-05-13 18:28:06 +00:00
|
|
|
static unsigned int down_arrow[8] = {
|
2013-08-10 21:21:17 +00:00
|
|
|
0x11111111,
|
|
|
|
0x11111111,
|
|
|
|
0x01111110,
|
|
|
|
0x01111110,
|
|
|
|
0x00111100,
|
|
|
|
0x00111100,
|
|
|
|
0x00011000,
|
|
|
|
0x00011000
|
2005-04-04 02:19:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2006-02-22 17:38:04 +00:00
|
|
|
ScrollBarWidget::ScrollBarWidget(GuiObject* boss, const GUI::Font& font,
|
|
|
|
int x, int y, int w, int h)
|
Added support for accessing/modifying extended RAM (aka SuperChip) from
the debugger RAM UI. A scrollbar is now present, which can scroll
through each 128 byte 'bank'. Labels indicate the current readport,
so you can distinguish between different areas of RAM. For now,
F4SC, F6SC, F8SC, and FASC have been converted, but I'm looking into the
other schemes now.
The RAM UI takes care of all read/write port issues. From the POV of
the UI, the RAM can be treated as zero-page; translation is done
behind the scene. Searching/comparing and change-tracking are also
supported.
The 'ram' command in the debugger prompt now reflects all RAM, and
readport/writeport addresses are shown, making it easier to use the
command withot having to look up the offsets.
Debugger width has been bumped to 1050 pixels wide to accomodate the
new functionality. We'll see how much trouble this causes ...
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1747 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2009-06-02 17:25:14 +00:00
|
|
|
: Widget(boss, font, x, y, w, h), CommandSender(boss),
|
|
|
|
_numEntries(0),
|
|
|
|
_entriesPerPage(0),
|
|
|
|
_currentPos(0),
|
|
|
|
_wheel_lines(0),
|
|
|
|
_part(kNoPart),
|
|
|
|
_draggingPart(kNoPart),
|
|
|
|
_sliderHeight(0),
|
|
|
|
_sliderPos(0),
|
|
|
|
_sliderDeltaMouseDownPos(0)
|
2005-04-04 02:19:22 +00:00
|
|
|
{
|
|
|
|
_flags = WIDGET_ENABLED | WIDGET_TRACK_MOUSE | WIDGET_CLEARBG;
|
2007-08-12 23:05:12 +00:00
|
|
|
_bgcolor = kWidColor;
|
|
|
|
_bgcolorhi = kWidColor;
|
2005-04-04 02:19:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2005-05-13 18:28:06 +00:00
|
|
|
void ScrollBarWidget::handleMouseDown(int x, int y, int button,
|
|
|
|
int clickCount)
|
2005-04-04 02:19:22 +00:00
|
|
|
{
|
More cleanups to the UI.
Context menus, both as right-mouse button popups and those part of
PopupWidgets now have arrows that support scrolling, without having to
continuously click the mouse button. The scroll arrow color also
changes to disabled when they reach the upper or lower range.
Also, the maximum number of items shown in a ContextMenu is now 16,
which looks quite a bit nicer than showing 30 or so all at once.
ScrollBarWidget now looks a little nicer, as the scroll bar is a little
wider, and the arrows are larger (same ones from ContextMenu). As well,
click and hold works on the scroll buttons, even during mouse movement.
This means you no longer have to hold the mouse completely still to
get continuous mouse click events.
Dialogs can now register whether they want to receive continuous mouse
click events (aka, click and hold of a mouse button). Most dialogs
don't need it, and some even work incorrectly when it's activated.
This fixes a bug in ContextMenu, where click and hold on a PopupWidget
would continuously open and close the list of items.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2080 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-07-30 17:25:28 +00:00
|
|
|
// Ignore subsequent mouse clicks when the slider is being moved
|
|
|
|
if(_draggingPart == kSliderPart)
|
|
|
|
return;
|
|
|
|
|
2005-05-13 18:28:06 +00:00
|
|
|
int old_pos = _currentPos;
|
2005-04-04 02:19:22 +00:00
|
|
|
|
|
|
|
// Do nothing if there are less items than fit on one page
|
|
|
|
if(_numEntries <= _entriesPerPage)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (y <= UP_DOWN_BOX_HEIGHT)
|
|
|
|
{
|
|
|
|
// Up arrow
|
|
|
|
_currentPos--;
|
|
|
|
_draggingPart = kUpArrowPart;
|
|
|
|
}
|
|
|
|
else if(y >= _h - UP_DOWN_BOX_HEIGHT)
|
|
|
|
{
|
|
|
|
// Down arrow
|
|
|
|
_currentPos++;
|
|
|
|
_draggingPart = kDownArrowPart;
|
|
|
|
}
|
|
|
|
else if(y < _sliderPos)
|
|
|
|
{
|
|
|
|
_currentPos -= _entriesPerPage;
|
|
|
|
}
|
|
|
|
else if(y >= _sliderPos + _sliderHeight)
|
|
|
|
{
|
|
|
|
_currentPos += _entriesPerPage;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_draggingPart = kSliderPart;
|
|
|
|
_sliderDeltaMouseDownPos = y - _sliderPos;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Make sure that _currentPos is still inside the bounds
|
|
|
|
checkBounds(old_pos);
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2005-05-13 18:28:06 +00:00
|
|
|
void ScrollBarWidget::handleMouseUp(int x, int y, int button,
|
|
|
|
int clickCount)
|
2005-04-04 02:19:22 +00:00
|
|
|
{
|
|
|
|
_draggingPart = kNoPart;
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2005-05-13 18:28:06 +00:00
|
|
|
void ScrollBarWidget::handleMouseWheel(int x, int y, int direction)
|
2005-04-04 02:19:22 +00:00
|
|
|
{
|
2005-05-13 18:28:06 +00:00
|
|
|
int old_pos = _currentPos;
|
2005-04-04 02:19:22 +00:00
|
|
|
|
|
|
|
if(_numEntries < _entriesPerPage)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if(direction < 0)
|
Added support for accessing/modifying extended RAM (aka SuperChip) from
the debugger RAM UI. A scrollbar is now present, which can scroll
through each 128 byte 'bank'. Labels indicate the current readport,
so you can distinguish between different areas of RAM. For now,
F4SC, F6SC, F8SC, and FASC have been converted, but I'm looking into the
other schemes now.
The RAM UI takes care of all read/write port issues. From the POV of
the UI, the RAM can be treated as zero-page; translation is done
behind the scene. Searching/comparing and change-tracking are also
supported.
The 'ram' command in the debugger prompt now reflects all RAM, and
readport/writeport addresses are shown, making it easier to use the
command withot having to look up the offsets.
Debugger width has been bumped to 1050 pixels wide to accomodate the
new functionality. We'll see how much trouble this causes ...
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1747 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2009-06-02 17:25:14 +00:00
|
|
|
_currentPos -= _wheel_lines ? _wheel_lines : _WHEEL_LINES;
|
2005-04-04 02:19:22 +00:00
|
|
|
else
|
Added support for accessing/modifying extended RAM (aka SuperChip) from
the debugger RAM UI. A scrollbar is now present, which can scroll
through each 128 byte 'bank'. Labels indicate the current readport,
so you can distinguish between different areas of RAM. For now,
F4SC, F6SC, F8SC, and FASC have been converted, but I'm looking into the
other schemes now.
The RAM UI takes care of all read/write port issues. From the POV of
the UI, the RAM can be treated as zero-page; translation is done
behind the scene. Searching/comparing and change-tracking are also
supported.
The 'ram' command in the debugger prompt now reflects all RAM, and
readport/writeport addresses are shown, making it easier to use the
command withot having to look up the offsets.
Debugger width has been bumped to 1050 pixels wide to accomodate the
new functionality. We'll see how much trouble this causes ...
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1747 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2009-06-02 17:25:14 +00:00
|
|
|
_currentPos += _wheel_lines ? _wheel_lines : _WHEEL_LINES;
|
2005-04-04 02:19:22 +00:00
|
|
|
|
|
|
|
// Make sure that _currentPos is still inside the bounds
|
|
|
|
checkBounds(old_pos);
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2005-05-13 18:28:06 +00:00
|
|
|
void ScrollBarWidget::handleMouseMoved(int x, int y, int button)
|
2005-04-04 02:19:22 +00:00
|
|
|
{
|
|
|
|
// Do nothing if there are less items than fit on one page
|
|
|
|
if(_numEntries <= _entriesPerPage)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if(_draggingPart == kSliderPart)
|
|
|
|
{
|
2005-05-13 18:28:06 +00:00
|
|
|
int old_pos = _currentPos;
|
2005-04-04 02:19:22 +00:00
|
|
|
_sliderPos = y - _sliderDeltaMouseDownPos;
|
|
|
|
|
|
|
|
if(_sliderPos < UP_DOWN_BOX_HEIGHT)
|
|
|
|
_sliderPos = UP_DOWN_BOX_HEIGHT;
|
|
|
|
|
|
|
|
if(_sliderPos > _h - UP_DOWN_BOX_HEIGHT - _sliderHeight)
|
|
|
|
_sliderPos = _h - UP_DOWN_BOX_HEIGHT - _sliderHeight;
|
|
|
|
|
|
|
|
_currentPos = (_sliderPos - UP_DOWN_BOX_HEIGHT) * (_numEntries - _entriesPerPage) /
|
|
|
|
(_h - 2 * UP_DOWN_BOX_HEIGHT - _sliderHeight);
|
|
|
|
checkBounds(old_pos);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-05-13 18:28:06 +00:00
|
|
|
int old_part = _part;
|
2005-04-04 02:19:22 +00:00
|
|
|
|
|
|
|
if(y <= UP_DOWN_BOX_HEIGHT) // Up arrow
|
|
|
|
_part = kUpArrowPart;
|
|
|
|
else if(y >= _h - UP_DOWN_BOX_HEIGHT) // Down arrow
|
|
|
|
_part = kDownArrowPart;
|
|
|
|
else if(y < _sliderPos)
|
|
|
|
_part = kPageUpPart;
|
|
|
|
else if(y >= _sliderPos + _sliderHeight)
|
|
|
|
_part = kPageDownPart;
|
|
|
|
else
|
|
|
|
_part = kSliderPart;
|
|
|
|
|
|
|
|
if (old_part != _part)
|
2005-05-10 19:20:45 +00:00
|
|
|
{
|
2005-08-01 22:33:16 +00:00
|
|
|
setDirty(); draw();
|
2005-05-10 19:20:45 +00:00
|
|
|
}
|
2005-04-04 02:19:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
More cleanups to the UI.
Context menus, both as right-mouse button popups and those part of
PopupWidgets now have arrows that support scrolling, without having to
continuously click the mouse button. The scroll arrow color also
changes to disabled when they reach the upper or lower range.
Also, the maximum number of items shown in a ContextMenu is now 16,
which looks quite a bit nicer than showing 30 or so all at once.
ScrollBarWidget now looks a little nicer, as the scroll bar is a little
wider, and the arrows are larger (same ones from ContextMenu). As well,
click and hold works on the scroll buttons, even during mouse movement.
This means you no longer have to hold the mouse completely still to
get continuous mouse click events.
Dialogs can now register whether they want to receive continuous mouse
click events (aka, click and hold of a mouse button). Most dialogs
don't need it, and some even work incorrectly when it's activated.
This fixes a bug in ContextMenu, where click and hold on a PopupWidget
would continuously open and close the list of items.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2080 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-07-30 17:25:28 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
bool ScrollBarWidget::handleMouseClicks(int x, int y, int button)
|
|
|
|
{
|
|
|
|
// Let continuous mouse clicks come through, as the scroll buttons need them
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2005-04-04 02:19:22 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2005-05-13 18:28:06 +00:00
|
|
|
void ScrollBarWidget::checkBounds(int old_pos)
|
2005-04-04 02:19:22 +00:00
|
|
|
{
|
|
|
|
if(_numEntries <= _entriesPerPage || _currentPos < 0)
|
|
|
|
_currentPos = 0;
|
|
|
|
else if(_currentPos > _numEntries - _entriesPerPage)
|
|
|
|
_currentPos = _numEntries - _entriesPerPage;
|
|
|
|
|
|
|
|
if (old_pos != _currentPos)
|
|
|
|
{
|
2005-05-10 19:20:45 +00:00
|
|
|
recalc(); // This takes care of the required refresh
|
2005-08-01 22:33:16 +00:00
|
|
|
setDirty(); draw();
|
2005-07-05 15:25:45 +00:00
|
|
|
sendCommand(kSetPositionCmd, _currentPos, _id);
|
2005-04-04 02:19:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-01 22:33:16 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void ScrollBarWidget::handleMouseEntered(int button)
|
|
|
|
{
|
|
|
|
setFlags(WIDGET_HILITED);
|
|
|
|
setDirty(); draw();
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void ScrollBarWidget::handleMouseLeft(int button)
|
|
|
|
{
|
|
|
|
_part = kNoPart;
|
|
|
|
clearFlags(WIDGET_HILITED);
|
|
|
|
setDirty(); draw();
|
|
|
|
}
|
|
|
|
|
2005-04-04 02:19:22 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void ScrollBarWidget::recalc()
|
|
|
|
{
|
2006-01-15 20:46:20 +00:00
|
|
|
//cerr << "ScrollBarWidget::recalc()\n";
|
2005-04-04 02:19:22 +00:00
|
|
|
if(_numEntries > _entriesPerPage)
|
|
|
|
{
|
|
|
|
_sliderHeight = (_h - 2 * UP_DOWN_BOX_HEIGHT) * _entriesPerPage / _numEntries;
|
|
|
|
if(_sliderHeight < UP_DOWN_BOX_HEIGHT)
|
|
|
|
_sliderHeight = UP_DOWN_BOX_HEIGHT;
|
|
|
|
|
|
|
|
_sliderPos = UP_DOWN_BOX_HEIGHT + (_h - 2 * UP_DOWN_BOX_HEIGHT - _sliderHeight) *
|
|
|
|
_currentPos / (_numEntries - _entriesPerPage);
|
|
|
|
if(_sliderPos < 0)
|
|
|
|
_sliderPos = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_sliderHeight = _h - 2 * UP_DOWN_BOX_HEIGHT;
|
|
|
|
_sliderPos = UP_DOWN_BOX_HEIGHT;
|
|
|
|
}
|
2005-05-10 19:20:45 +00:00
|
|
|
|
2005-08-01 22:33:16 +00:00
|
|
|
setDirty(); draw();
|
2005-04-04 02:19:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void ScrollBarWidget::drawWidget(bool hilite)
|
|
|
|
{
|
2005-08-10 12:23:42 +00:00
|
|
|
//cerr << "ScrollBarWidget::drawWidget\n";
|
2008-06-13 13:14:52 +00:00
|
|
|
FBSurface& s = _boss->dialog().surface();
|
2005-04-04 02:19:22 +00:00
|
|
|
int bottomY = _y + _h;
|
|
|
|
bool isSinglePage = (_numEntries <= _entriesPerPage);
|
|
|
|
|
2008-06-13 13:14:52 +00:00
|
|
|
s.frameRect(_x, _y, _w, _h, kShadowColor);
|
2005-04-04 02:19:22 +00:00
|
|
|
|
|
|
|
if(_draggingPart != kNoPart)
|
|
|
|
_part = _draggingPart;
|
|
|
|
|
|
|
|
// Up arrow
|
2008-06-13 13:14:52 +00:00
|
|
|
s.frameRect(_x, _y, _w, UP_DOWN_BOX_HEIGHT, kColor);
|
More cleanups to the UI.
Context menus, both as right-mouse button popups and those part of
PopupWidgets now have arrows that support scrolling, without having to
continuously click the mouse button. The scroll arrow color also
changes to disabled when they reach the upper or lower range.
Also, the maximum number of items shown in a ContextMenu is now 16,
which looks quite a bit nicer than showing 30 or so all at once.
ScrollBarWidget now looks a little nicer, as the scroll bar is a little
wider, and the arrows are larger (same ones from ContextMenu). As well,
click and hold works on the scroll buttons, even during mouse movement.
This means you no longer have to hold the mouse completely still to
get continuous mouse click events.
Dialogs can now register whether they want to receive continuous mouse
click events (aka, click and hold of a mouse button). Most dialogs
don't need it, and some even work incorrectly when it's activated.
This fixes a bug in ContextMenu, where click and hold on a PopupWidget
would continuously open and close the list of items.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2080 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-07-30 17:25:28 +00:00
|
|
|
s.drawBitmap(up_arrow, _x+3, _y+5, isSinglePage ? kColor :
|
|
|
|
(hilite && _part == kUpArrowPart) ? kScrollColorHi : kScrollColor, 8);
|
2005-04-04 02:19:22 +00:00
|
|
|
|
|
|
|
// Down arrow
|
2008-06-13 13:14:52 +00:00
|
|
|
s.frameRect(_x, bottomY - UP_DOWN_BOX_HEIGHT, _w, UP_DOWN_BOX_HEIGHT, kColor);
|
More cleanups to the UI.
Context menus, both as right-mouse button popups and those part of
PopupWidgets now have arrows that support scrolling, without having to
continuously click the mouse button. The scroll arrow color also
changes to disabled when they reach the upper or lower range.
Also, the maximum number of items shown in a ContextMenu is now 16,
which looks quite a bit nicer than showing 30 or so all at once.
ScrollBarWidget now looks a little nicer, as the scroll bar is a little
wider, and the arrows are larger (same ones from ContextMenu). As well,
click and hold works on the scroll buttons, even during mouse movement.
This means you no longer have to hold the mouse completely still to
get continuous mouse click events.
Dialogs can now register whether they want to receive continuous mouse
click events (aka, click and hold of a mouse button). Most dialogs
don't need it, and some even work incorrectly when it's activated.
This fixes a bug in ContextMenu, where click and hold on a PopupWidget
would continuously open and close the list of items.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2080 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-07-30 17:25:28 +00:00
|
|
|
s.drawBitmap(down_arrow, _x+3, bottomY - UP_DOWN_BOX_HEIGHT + 5, isSinglePage ? kColor :
|
|
|
|
(hilite && _part == kDownArrowPart) ? kScrollColorHi : kScrollColor, 8);
|
2005-04-04 02:19:22 +00:00
|
|
|
|
|
|
|
// Slider
|
|
|
|
if(!isSinglePage)
|
|
|
|
{
|
2008-06-13 13:14:52 +00:00
|
|
|
s.fillRect(_x, _y + _sliderPos, _w, _sliderHeight,
|
|
|
|
(hilite && _part == kSliderPart) ? kScrollColorHi : kScrollColor);
|
|
|
|
s.frameRect(_x, _y + _sliderPos, _w, _sliderHeight, kColor);
|
2005-04-04 02:19:22 +00:00
|
|
|
int y = _y + _sliderPos + _sliderHeight / 2;
|
2008-06-13 13:14:52 +00:00
|
|
|
s.hLine(_x + 2, y - 2, _x + _w - 3, kWidColor);
|
|
|
|
s.hLine(_x + 2, y, _x + _w - 3, kWidColor);
|
|
|
|
s.hLine(_x + 2, y + 2, _x + _w - 3, kWidColor);
|
2005-04-04 02:19:22 +00:00
|
|
|
}
|
|
|
|
}
|
2007-08-15 17:43:51 +00:00
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
int ScrollBarWidget::_WHEEL_LINES = 4;
|