mirror of https://github.com/stella-emu/stella.git
bitmapped button added
This commit is contained in:
parent
ba3cc0677d
commit
d28fb580b8
Binary file not shown.
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.4 KiB |
|
@ -408,6 +408,35 @@ void DebuggerDialog::addStatusArea()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void DebuggerDialog::addRomArea()
|
void DebuggerDialog::addRomArea()
|
||||||
{
|
{
|
||||||
|
static uInt32 LEFT_ARROW[11] =
|
||||||
|
{
|
||||||
|
0b0000010,
|
||||||
|
0b0000110,
|
||||||
|
0b0001110,
|
||||||
|
0b0011110,
|
||||||
|
0b0111110,
|
||||||
|
0b1111110,
|
||||||
|
0b0111110,
|
||||||
|
0b0011110,
|
||||||
|
0b0001110,
|
||||||
|
0b0000110,
|
||||||
|
0b0000010
|
||||||
|
};
|
||||||
|
static uInt32 RIGHT_ARROW[11] =
|
||||||
|
{
|
||||||
|
0b0100000,
|
||||||
|
0b0110000,
|
||||||
|
0b0111000,
|
||||||
|
0b0111100,
|
||||||
|
0b0111110,
|
||||||
|
0b0111111,
|
||||||
|
0b0111110,
|
||||||
|
0b0111100,
|
||||||
|
0b0111000,
|
||||||
|
0b0110000,
|
||||||
|
0b0100000
|
||||||
|
};
|
||||||
|
|
||||||
const GUI::Rect& r = getRomBounds();
|
const GUI::Rect& r = getRomBounds();
|
||||||
const int VBORDER = 4;
|
const int VBORDER = 4;
|
||||||
const string ELLIPSIS = "\x1d";
|
const string ELLIPSIS = "\x1d";
|
||||||
|
@ -430,20 +459,23 @@ void DebuggerDialog::addRomArea()
|
||||||
new ButtonWidget(this, *myLFont, buttonX, buttonY,
|
new ButtonWidget(this, *myLFont, buttonX, buttonY,
|
||||||
bwidth, bheight, "Exit", kDDExitCmd);
|
bwidth, bheight, "Exit", kDDExitCmd);
|
||||||
|
|
||||||
bwidth = myLFont->getStringWidth("< ") + 4;
|
bwidth = bheight; // 7 + 12;
|
||||||
bheight = bheight * 3 + 4 * 2;
|
bheight = bheight * 3 + 4 * 2;
|
||||||
buttonX -= (bwidth + 5);
|
buttonX -= (bwidth + 5);
|
||||||
buttonY = r.top + 5;
|
buttonY = r.top + 5;
|
||||||
|
|
||||||
myRewindButton =
|
myRewindButton =
|
||||||
new ButtonWidget(this, *myLFont, buttonX, buttonY,
|
new ButtonWidget(this, *myLFont, buttonX, buttonY,
|
||||||
bwidth, bheight, "<", kDDRewindCmd);
|
bwidth, bheight, LEFT_ARROW, 7, 11, kDDRewindCmd);
|
||||||
|
|
||||||
myRewindButton->clearFlags(WIDGET_ENABLED);
|
myRewindButton->clearFlags(WIDGET_ENABLED);
|
||||||
|
|
||||||
buttonY += bheight + 4;
|
buttonY += bheight + 4;
|
||||||
bheight = (myLFont->getLineHeight() + 2) * 2 + 4 * 1;
|
bheight = (myLFont->getLineHeight() + 2) * 2 + 4 * 1;
|
||||||
|
|
||||||
myUnwindButton =
|
myUnwindButton =
|
||||||
new ButtonWidget(this, *myLFont, buttonX, buttonY,
|
new ButtonWidget(this, *myLFont, buttonX, buttonY,
|
||||||
bwidth, bheight, ">", kDDUnwindCmd);
|
bwidth, bheight, RIGHT_ARROW, 7, 11, kDDUnwindCmd);
|
||||||
myUnwindButton->clearFlags(WIDGET_ENABLED);
|
myUnwindButton->clearFlags(WIDGET_ENABLED);
|
||||||
|
|
||||||
int xpos = buttonX - 8*myLFont->getMaxCharWidth() - 20, ypos = 30;
|
int xpos = buttonX - 8*myLFont->getMaxCharWidth() - 20, ypos = 30;
|
||||||
|
|
|
@ -343,7 +343,8 @@ ButtonWidget::ButtonWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
const string& label, int cmd)
|
const string& label, int cmd)
|
||||||
: StaticTextWidget(boss, font, x, y, w, h, label, TextAlign::Center),
|
: StaticTextWidget(boss, font, x, y, w, h, label, TextAlign::Center),
|
||||||
CommandSender(boss),
|
CommandSender(boss),
|
||||||
_cmd(cmd)
|
_cmd(cmd),
|
||||||
|
_useBitmap(false)
|
||||||
{
|
{
|
||||||
_flags = WIDGET_ENABLED | WIDGET_BORDER | WIDGET_CLEARBG;
|
_flags = WIDGET_ENABLED | WIDGET_BORDER | WIDGET_CLEARBG;
|
||||||
_bgcolor = kBtnColor;
|
_bgcolor = kBtnColor;
|
||||||
|
@ -370,6 +371,19 @@ ButtonWidget::ButtonWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
ButtonWidget::ButtonWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
|
int x, int y, int w, int h,
|
||||||
|
uInt32* bitmap, int bmw, int bmh,
|
||||||
|
int cmd)
|
||||||
|
: ButtonWidget(boss, font, x, y, w, h, "", cmd)
|
||||||
|
{
|
||||||
|
_bitmap = bitmap;
|
||||||
|
_bmh = bmh;
|
||||||
|
_bmw = bmw;
|
||||||
|
_useBitmap = true;
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void ButtonWidget::handleMouseEntered(int button)
|
void ButtonWidget::handleMouseEntered(int button)
|
||||||
{
|
{
|
||||||
|
@ -415,9 +429,15 @@ void ButtonWidget::handleMouseUp(int x, int y, int button, int clickCount)
|
||||||
void ButtonWidget::drawWidget(bool hilite)
|
void ButtonWidget::drawWidget(bool hilite)
|
||||||
{
|
{
|
||||||
FBSurface& s = _boss->dialog().surface();
|
FBSurface& s = _boss->dialog().surface();
|
||||||
s.drawString(_font, _label, _x, _y + (_h - _fontHeight)/2 + 1, _w,
|
if (!_useBitmap)
|
||||||
!isEnabled() ? hilite ? uInt32(kColor) : uInt32(kBGColorLo) :
|
s.drawString(_font, _label, _x, _y + (_h - _fontHeight)/2 + 1, _w,
|
||||||
hilite ? _textcolorhi : _textcolor, _align);
|
!isEnabled() ? hilite ? uInt32(kColor) : uInt32(kBGColorLo) :
|
||||||
|
hilite ? _textcolorhi : _textcolor, _align);
|
||||||
|
else
|
||||||
|
s.drawBitmap(_bitmap, _x + (_w - _bmw) / 2, _y + (_h - _bmh) / 2,
|
||||||
|
!isEnabled() ? hilite ? uInt32(kColor) : uInt32(kBGColorLo) :
|
||||||
|
hilite ? _textcolorhi : _textcolor,
|
||||||
|
_bmw, _bmh);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -217,6 +217,10 @@ class ButtonWidget : public StaticTextWidget, public CommandSender
|
||||||
ButtonWidget(GuiObject* boss, const GUI::Font& font,
|
ButtonWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
int x, int y,
|
int x, int y,
|
||||||
const string& label, int cmd = 0);
|
const string& label, int cmd = 0);
|
||||||
|
ButtonWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
|
int x, int y, int dw, int dh,
|
||||||
|
uInt32* bitmap, int bmw, int bmh,
|
||||||
|
int cmd = 0);
|
||||||
|
|
||||||
void setCmd(int cmd) { _cmd = cmd; }
|
void setCmd(int cmd) { _cmd = cmd; }
|
||||||
int getCmd() const { return _cmd; }
|
int getCmd() const { return _cmd; }
|
||||||
|
@ -230,7 +234,10 @@ class ButtonWidget : public StaticTextWidget, public CommandSender
|
||||||
void drawWidget(bool hilite) override;
|
void drawWidget(bool hilite) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int _cmd;
|
int _cmd;
|
||||||
|
bool _useBitmap;
|
||||||
|
uInt32* _bitmap;
|
||||||
|
int _bmw, _bmh;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Following constructors and assignment operators not supported
|
// Following constructors and assignment operators not supported
|
||||||
|
|
Loading…
Reference in New Issue