mirror of
https://github.com/libretro/scummvm.git
synced 2024-11-27 19:30:41 +00:00
Major GUI update:
- Implemented padding in console - Update only current line in console instead of whole screen - Fixed caret positioning in edit text widget - Improved buttons drawing, now they look more realistic - Added label spacing in popup widget - Correct shadow in popup widget - Fixed up with selected popup widget being drawn on wrong tab - Added shading to list dialog - Adjusted shading of inactive widgets - Proper coloring of browset (add game) dialog - Introduced Container widget - Used Container widget in scumm save/load dialog. Now it looks properly - Adjusted button colors even more. Now they match almost perfectly albeit with banding - Made scrollbar appear only when it is really needed svn-id: r22670
This commit is contained in:
parent
3d0aa0a4d9
commit
b56c7b88d7
@ -958,6 +958,14 @@
|
||||
RelativePath="..\..\graphics\animation.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\graphics\cursorman.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\graphics\cursorman.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\graphics\font.cpp"
|
||||
>
|
||||
|
@ -244,57 +244,21 @@ SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel,
|
||||
_list->setEditable(saveMode);
|
||||
_list->setNumberingMode(saveMode ? GUI::kListNumberingOne : GUI::kListNumberingZero);
|
||||
|
||||
if (g_gui.evaluator()->getVar("scummsaveload_extinfo.visible") == 1) {
|
||||
int thumbX = g_gui.evaluator()->getVar("scummsaveload_thumbnail.x");
|
||||
int thumbY = g_gui.evaluator()->getVar("scummsaveload_thumbnail.y");
|
||||
_container = new GUI::ContainerWidget(this, 0, 0, 10, 10);
|
||||
_container->setHints(GUI::THEME_HINT_USE_SHADOW);
|
||||
|
||||
// Add the thumbnail display
|
||||
_gfxWidget = new GUI::GraphicsWidget(this,
|
||||
thumbX, thumbY,
|
||||
kThumbnailWidth + 8,
|
||||
((_vm->_system->getHeight() % 200 && _vm->_system->getHeight() != 350) ? kThumbnailHeight2 : kThumbnailHeight1) + 8);
|
||||
_gfxWidget->setFlags(GUI::WIDGET_BORDER);
|
||||
_gfxWidget = new GUI::GraphicsWidget(this, 0, 0, 10, 10);
|
||||
|
||||
int height = thumbY + ((_vm->_system->getHeight() % 200 && _vm->_system->getHeight() != 350) ? kThumbnailHeight2 : kThumbnailHeight1) + 8;
|
||||
|
||||
_date = new StaticTextWidget(this,
|
||||
thumbX,
|
||||
height,
|
||||
kThumbnailWidth + 8,
|
||||
kLineHeight,
|
||||
"No date saved",
|
||||
kTextAlignCenter);
|
||||
|
||||
height += kLineHeight;
|
||||
|
||||
_time = new StaticTextWidget(this,
|
||||
thumbX,
|
||||
height,
|
||||
kThumbnailWidth + 8,
|
||||
kLineHeight,
|
||||
"No time saved",
|
||||
kTextAlignCenter);
|
||||
|
||||
height += kLineHeight;
|
||||
|
||||
_playtime = new StaticTextWidget(this,
|
||||
thumbX,
|
||||
height,
|
||||
kThumbnailWidth + 8,
|
||||
kLineHeight,
|
||||
"No playtime saved",
|
||||
kTextAlignCenter);
|
||||
} else {
|
||||
_gfxWidget = 0;
|
||||
_date = 0;
|
||||
_time = 0;
|
||||
_playtime = 0;
|
||||
}
|
||||
_date = new StaticTextWidget(this, 0, 0, 10, 10, "No date saved", kTextAlignCenter);
|
||||
_time = new StaticTextWidget(this, 0, 0, 10, 10, "No time saved", kTextAlignCenter);
|
||||
_playtime = new StaticTextWidget(this, 0, 0, 10, 10, "No playtime saved", kTextAlignCenter);
|
||||
|
||||
// Buttons
|
||||
new GUI::ButtonWidget(this, "scummsaveload_cancel", "Cancel", kCloseCmd, 0);
|
||||
_chooseButton = new GUI::ButtonWidget(this, "scummsaveload_choose", buttonLabel, kChooseCmd, 0);
|
||||
_chooseButton->setEnabled(false);
|
||||
|
||||
handleScreenChanged();
|
||||
}
|
||||
|
||||
SaveLoadChooser::~SaveLoadChooser() {
|
||||
@ -358,62 +322,40 @@ void SaveLoadChooser::handleScreenChanged() {
|
||||
if (g_gui.evaluator()->getVar("scummsaveload_extinfo.visible") == 1) {
|
||||
int thumbX = g_gui.evaluator()->getVar("scummsaveload_thumbnail.x");
|
||||
int thumbY = g_gui.evaluator()->getVar("scummsaveload_thumbnail.y");
|
||||
int hPad = g_gui.evaluator()->getVar("scummsaveload_thumbnail.hPad");
|
||||
int vPad = g_gui.evaluator()->getVar("scummsaveload_thumbnail.vPad");
|
||||
int thumbH = ((_vm->_system->getHeight() % 200 && _vm->_system->getHeight() != 350) ? kThumbnailHeight2 : kThumbnailHeight1);
|
||||
|
||||
_container->resize(thumbX - hPad, thumbY - vPad, kThumbnailWidth + hPad * 2, thumbH + vPad * 2 + kLineHeight * 4);
|
||||
|
||||
// Add the thumbnail display
|
||||
if (!_gfxWidget) {
|
||||
_gfxWidget = new GUI::GraphicsWidget(this, 0, 0, 0, 0);
|
||||
_gfxWidget->setFlags(GUI::WIDGET_BORDER);
|
||||
}
|
||||
_gfxWidget->resize(thumbX, thumbY, kThumbnailWidth + 8,
|
||||
((_vm->_system->getHeight() % 200 && _vm->_system->getHeight() != 350) ? kThumbnailHeight2 : kThumbnailHeight1) + 8);
|
||||
_gfxWidget->resize(thumbX, thumbY, kThumbnailWidth, thumbH);
|
||||
|
||||
int height = thumbY + ((_vm->_system->getHeight() % 200 && _vm->_system->getHeight() != 350) ? kThumbnailHeight2 : kThumbnailHeight1) + 8;
|
||||
int height = thumbY + thumbH + kLineHeight;
|
||||
|
||||
if (!_date)
|
||||
_date = new StaticTextWidget(this, 0, 0, 0, 0, "", kTextAlignCenter);
|
||||
_date->resize(thumbX, height, kThumbnailWidth + 8, kLineHeight);
|
||||
_date->resize(thumbX, height, kThumbnailWidth, kLineHeight);
|
||||
|
||||
height += kLineHeight;
|
||||
|
||||
if (!_time)
|
||||
_time = new StaticTextWidget(this, 0, 0, 0, 0, "", kTextAlignCenter);
|
||||
_time->resize(thumbX, height, kThumbnailWidth + 8, kLineHeight);
|
||||
_time->resize(thumbX, height, kThumbnailWidth, kLineHeight);
|
||||
|
||||
height += kLineHeight;
|
||||
|
||||
if (!_playtime)
|
||||
_playtime = new StaticTextWidget(this, 0, 0, 0, 0, "", kTextAlignCenter);
|
||||
_playtime->resize(thumbX, height, kThumbnailWidth + 8, kLineHeight);
|
||||
_playtime->resize(thumbX, height, kThumbnailWidth, kLineHeight);
|
||||
|
||||
_container->clearFlags(GUI::WIDGET_INVISIBLE);
|
||||
_gfxWidget->clearFlags(GUI::WIDGET_INVISIBLE);
|
||||
_date->clearFlags(GUI::WIDGET_INVISIBLE);
|
||||
_time->clearFlags(GUI::WIDGET_INVISIBLE);
|
||||
_playtime->clearFlags(GUI::WIDGET_INVISIBLE);
|
||||
|
||||
updateInfos();
|
||||
} else {
|
||||
if (_gfxWidget) {
|
||||
deleteWidget(_gfxWidget);
|
||||
_gfxWidget->setNext(0);
|
||||
delete _gfxWidget;
|
||||
_gfxWidget = 0;
|
||||
}
|
||||
|
||||
if (_date) {
|
||||
deleteWidget(_date);
|
||||
_date->setNext(0);
|
||||
delete _date;
|
||||
_date = 0;
|
||||
}
|
||||
|
||||
if (_time) {
|
||||
deleteWidget(_time);
|
||||
_time->setNext(0);
|
||||
delete _time;
|
||||
_time = 0;
|
||||
}
|
||||
|
||||
if (_playtime) {
|
||||
deleteWidget(_playtime);
|
||||
_playtime->setNext(0);
|
||||
delete _playtime;
|
||||
_playtime = 0;
|
||||
}
|
||||
_container->setFlags(GUI::WIDGET_INVISIBLE);
|
||||
_gfxWidget->setFlags(GUI::WIDGET_INVISIBLE);
|
||||
_date->setFlags(GUI::WIDGET_INVISIBLE);
|
||||
_time->setFlags(GUI::WIDGET_INVISIBLE);
|
||||
_playtime->setFlags(GUI::WIDGET_INVISIBLE);
|
||||
}
|
||||
|
||||
Dialog::handleScreenChanged();
|
||||
|
@ -61,6 +61,7 @@ protected:
|
||||
GUI::StaticTextWidget *_date;
|
||||
GUI::StaticTextWidget *_time;
|
||||
GUI::StaticTextWidget *_playtime;
|
||||
GUI::ContainerWidget *_container;
|
||||
ScummEngine *_vm;
|
||||
|
||||
void updateInfos();
|
||||
|
@ -55,6 +55,8 @@ void EditTextWidget::handleScreenChanged() {
|
||||
EditableWidget::handleScreenChanged();
|
||||
_leftPadding = g_gui.evaluator()->getVar("EditTextWidget.leftPadding", 0);
|
||||
_rightPadding = g_gui.evaluator()->getVar("EditTextWidget.rightPadding", 0);
|
||||
|
||||
_font = (Theme::kFontStyle)g_gui.evaluator()->getVar("EditTextWidget.font", Theme::kFontStyleNormal);
|
||||
}
|
||||
|
||||
|
||||
@ -83,11 +85,11 @@ void EditTextWidget::drawWidget(bool hilite) {
|
||||
|
||||
// Draw the text
|
||||
adjustOffset();
|
||||
g_gui.theme()->drawText(Common::Rect(_x+2 + _leftPadding,_y+2, _x+getEditRect().width()-2, _y+_h-2), _editString, Theme::kStateEnabled, Theme::kTextAlignLeft, false, -_editScrollOffset, false, Theme::kFontStyleNormal);
|
||||
g_gui.theme()->drawText(Common::Rect(_x+2+ _leftPadding,_y+2, _x+_leftPadding+getEditRect().width()+2, _y+_h-2), _editString, Theme::kStateEnabled, Theme::kTextAlignLeft, false, -_editScrollOffset, false, _font);
|
||||
}
|
||||
|
||||
Common::Rect EditTextWidget::getEditRect() const {
|
||||
Common::Rect r(2 + _leftPadding, 1, _w - 2 - _leftPadding, _h);
|
||||
Common::Rect r(2 + _leftPadding, 1, _w - 2 - _leftPadding - _rightPadding, _h);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
@ -41,18 +41,17 @@ ListWidget::ListWidget(GuiObject *boss, String name)
|
||||
_hlLeftPadding = g_gui.evaluator()->getVar("ListWidget.hlLeftPadding", 0);
|
||||
_hlRightPadding = g_gui.evaluator()->getVar("ListWidget.hlRightPadding", 0);
|
||||
|
||||
int scrollBarWidth;
|
||||
if (ws == kBigWidgetSize) {
|
||||
scrollBarWidth = kBigScrollBarWidth;
|
||||
_scrollBarWidth = kBigScrollBarWidth;
|
||||
} else {
|
||||
scrollBarWidth = kNormalScrollBarWidth;
|
||||
_scrollBarWidth = kNormalScrollBarWidth;
|
||||
}
|
||||
|
||||
_scrollBar = new ScrollBarWidget(this, _w - scrollBarWidth, 0, scrollBarWidth, _h);
|
||||
_scrollBar = new ScrollBarWidget(this, _w - _scrollBarWidth, 0, _scrollBarWidth, _h);
|
||||
_scrollBar->setTarget(this);
|
||||
|
||||
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | WIDGET_WANT_TICKLE;
|
||||
setHints(THEME_HINT_SAVE_BACKGROUND);
|
||||
setHints(THEME_HINT_SAVE_BACKGROUND | THEME_HINT_USE_SHADOW);
|
||||
_type = kListWidget;
|
||||
_editMode = false;
|
||||
_numberingMode = kListNumberingOne;
|
||||
@ -139,6 +138,11 @@ void ListWidget::handleMouseDown(int x, int y, int button, int clickCount) {
|
||||
if (!isEnabled())
|
||||
return;
|
||||
|
||||
if (x >= _w - _scrollBarWidth) {
|
||||
_scrollBar->handleMouseDown(x, y, button, clickCount);
|
||||
return;
|
||||
}
|
||||
|
||||
// First check whether the selection changed
|
||||
int newSelectedItem;
|
||||
newSelectedItem = findItem(x, y);
|
||||
@ -345,7 +349,7 @@ void ListWidget::drawWidget(bool hilite) {
|
||||
char temp[10];
|
||||
sprintf(temp, "%2d. ", (pos + _numberingMode));
|
||||
buffer = temp;
|
||||
g_gui.theme()->drawText(Common::Rect(_x, y, _x + r.left + _leftPadding, y + fontHeight - 1), buffer, Theme::kStateEnabled, Theme::kTextAlignLeft, inverted, _leftPadding);
|
||||
g_gui.theme()->drawText(Common::Rect(_x, y, _x + r.left + _leftPadding, y + fontHeight - 2), buffer, Theme::kStateEnabled, Theme::kTextAlignLeft, inverted, _leftPadding);
|
||||
pad = 0;
|
||||
}
|
||||
|
||||
@ -354,8 +358,8 @@ void ListWidget::drawWidget(bool hilite) {
|
||||
if (_selectedItem == pos && _editMode) {
|
||||
buffer = _editString;
|
||||
adjustOffset();
|
||||
width = _w - r.left - _hlRightPadding - _leftPadding - _rightPadding;
|
||||
g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.left + width, y + fontHeight - 1), buffer, Theme::kStateEnabled, Theme::kTextAlignLeft, inverted, pad);
|
||||
width = _w - r.left - _hlRightPadding - _leftPadding;
|
||||
g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.left + width, y + fontHeight-2), buffer, Theme::kStateEnabled, Theme::kTextAlignLeft, inverted, pad);
|
||||
} else {
|
||||
int maxWidth = _textWidth[i];
|
||||
buffer = _list[pos];
|
||||
@ -367,7 +371,7 @@ void ListWidget::drawWidget(bool hilite) {
|
||||
width = _w - r.left - _hlRightPadding;
|
||||
if (width > maxWidth)
|
||||
maxWidth = width;
|
||||
g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.left + maxWidth, y + fontHeight - 1), buffer, Theme::kStateEnabled, Theme::kTextAlignLeft, inverted, pad);
|
||||
g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.left + maxWidth, y + fontHeight-2), buffer, Theme::kStateEnabled, Theme::kTextAlignLeft, inverted, pad);
|
||||
}
|
||||
|
||||
_textWidth[i] = width;
|
||||
@ -449,11 +453,10 @@ void ListWidget::handleScreenChanged() {
|
||||
_hlLeftPadding = g_gui.evaluator()->getVar("ListWidget.hlLeftPadding", 0);
|
||||
_hlRightPadding = g_gui.evaluator()->getVar("ListWidget.hlRightPadding", 0);
|
||||
|
||||
int scrollBarWidth;
|
||||
if (ws == kBigWidgetSize) {
|
||||
scrollBarWidth = kBigScrollBarWidth;
|
||||
_scrollBarWidth = kBigScrollBarWidth;
|
||||
} else {
|
||||
scrollBarWidth = kNormalScrollBarWidth;
|
||||
_scrollBarWidth = kNormalScrollBarWidth;
|
||||
}
|
||||
|
||||
_entriesPerPage = (_h - _topPadding - _bottomPadding) / kLineHeight;
|
||||
@ -464,7 +467,7 @@ void ListWidget::handleScreenChanged() {
|
||||
for (int i = 0; i < _entriesPerPage; i++)
|
||||
_textWidth[i] = 0;
|
||||
|
||||
_scrollBar->resize(_w - scrollBarWidth, 0, scrollBarWidth, _h);
|
||||
_scrollBar->resize(_w - _scrollBarWidth, 0, _scrollBarWidth, _h);
|
||||
scrollBarRecalc();
|
||||
}
|
||||
|
||||
|
@ -67,6 +67,7 @@ protected:
|
||||
int _rightPadding;
|
||||
int _topPadding;
|
||||
int _bottomPadding;
|
||||
int _scrollBarWidth;
|
||||
|
||||
public:
|
||||
ListWidget(GuiObject *boss, String name);
|
||||
|
@ -75,10 +75,10 @@ PopUpDialog::PopUpDialog(PopUpWidget *boss, int clickX, int clickY, WidgetSize w
|
||||
_selection = _popUpBoss->_selectedItem;
|
||||
|
||||
// Calculate real popup dimensions
|
||||
_x = _popUpBoss->getAbsX() + _popUpBoss->_labelWidth;
|
||||
_x = _popUpBoss->getAbsX() + _popUpBoss->_labelWidth + _popUpBoss->_labelSpacing;
|
||||
_y = _popUpBoss->getAbsY() - _popUpBoss->_selectedItem * kLineHeight;
|
||||
_h = _popUpBoss->_entries.size() * kLineHeight + 2;
|
||||
_w = _popUpBoss->_w - kLineHeight + 2 - _popUpBoss->_labelWidth;
|
||||
_w = _popUpBoss->_w - kLineHeight + 2 - _popUpBoss->_labelWidth - _popUpBoss->_labelSpacing;
|
||||
|
||||
_leftPadding = _popUpBoss->_leftPadding;
|
||||
_rightPadding = _popUpBoss->_rightPadding;
|
||||
@ -365,6 +365,7 @@ void PopUpWidget::handleMouseDown(int x, int y, int button, int clickCount) {
|
||||
_selectedItem = newSel;
|
||||
sendCommand(kPopUpItemSelectedCmd, _entries[_selectedItem].tag);
|
||||
}
|
||||
g_gui.clearDragWidget();
|
||||
}
|
||||
}
|
||||
|
||||
@ -373,6 +374,7 @@ void PopUpWidget::handleScreenChanged() {
|
||||
|
||||
_leftPadding = g_gui.evaluator()->getVar("PopUpWidget.leftPadding", 0);
|
||||
_rightPadding = g_gui.evaluator()->getVar("PopUpWidget.rightPadding", 0);
|
||||
_labelSpacing = g_gui.evaluator()->getVar("PopUpWidget.labelSpacing", 0);
|
||||
|
||||
Widget::handleScreenChanged();
|
||||
}
|
||||
@ -411,8 +413,8 @@ void PopUpWidget::setSelectedTag(uint32 tag) {
|
||||
}
|
||||
|
||||
void PopUpWidget::drawWidget(bool hilite) {
|
||||
int x = _x + _labelWidth;
|
||||
int w = _w - _labelWidth;
|
||||
int x = _x + _labelWidth + _labelSpacing;
|
||||
int w = _w - _labelWidth - _labelSpacing;
|
||||
|
||||
// Draw the label, if any
|
||||
if (_labelWidth > 0)
|
||||
|
@ -58,6 +58,7 @@ protected:
|
||||
|
||||
int _leftPadding;
|
||||
int _rightPadding;
|
||||
int _labelSpacing;
|
||||
|
||||
public:
|
||||
PopUpWidget(GuiObject *boss, String name, const String &label, uint labelWidth = 0);
|
||||
|
@ -173,9 +173,11 @@ void ScrollBarWidget::recalc() {
|
||||
UP_DOWN_BOX_HEIGHT + (_h - 2 * UP_DOWN_BOX_HEIGHT - _sliderHeight) * _currentPos / (_numEntries - _entriesPerPage);
|
||||
if (_sliderPos < 0)
|
||||
_sliderPos = 0;
|
||||
clearFlags(WIDGET_INVISIBLE);
|
||||
} else {
|
||||
_sliderHeight = _h - 2 * UP_DOWN_BOX_HEIGHT;
|
||||
_sliderPos = UP_DOWN_BOX_HEIGHT;
|
||||
setFlags(WIDGET_INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -451,7 +451,7 @@ void ThemeClassic::drawLineSeparator(const Common::Rect &r, kState state) {
|
||||
|
||||
// intern drawing
|
||||
|
||||
void ThemeClassic::restoreBackground(Common::Rect r) {
|
||||
void ThemeClassic::restoreBackground(Common::Rect r, bool special) {
|
||||
r.clip(_screen.w, _screen.h);
|
||||
r.clip(_drawArea);
|
||||
#ifndef OLDGUI_TRANSPARENCY
|
||||
@ -478,7 +478,7 @@ void ThemeClassic::restoreBackground(Common::Rect r) {
|
||||
#endif
|
||||
}
|
||||
|
||||
bool ThemeClassic::addDirtyRect(Common::Rect r, bool save) {
|
||||
bool ThemeClassic::addDirtyRect(Common::Rect r, bool save, bool special) {
|
||||
// TODO: implement proper dirty rect handling
|
||||
// FIXME: problem with the 'pitch'
|
||||
r.clip(_screen.w, _screen.h);
|
||||
|
@ -35,13 +35,15 @@
|
||||
|
||||
#include "common/unzip.h"
|
||||
|
||||
#define kShadowTr0 8
|
||||
#define kShadowTr1 16
|
||||
#define kShadowTr2 32
|
||||
#define kShadowTr3 64
|
||||
#define kShadowTr35 96
|
||||
#define kShadowTr4 128
|
||||
#define kShadowTr5 192
|
||||
|
||||
#define THEME_VERSION 12
|
||||
#define THEME_VERSION 13
|
||||
|
||||
using Graphics::Surface;
|
||||
|
||||
@ -471,6 +473,11 @@ void ThemeNew::drawDialogBackground(const Common::Rect &r, uint16 hints, kState
|
||||
|
||||
drawRectMasked(r, surface(kDialogBkgdCorner), surface(kDialogBkgdTop), surface(kDialogBkgdLeft), surface(kDialogBkgd),
|
||||
256, _colors[kMainDialogStart], _colors[kMainDialogEnd], _gradientFactors[kDialogSpecialFactor]);
|
||||
} else if (hints & THEME_HINT_PLAIN_COLOR) {
|
||||
drawShadow(r, surface(kDialogBkgdCorner), surface(kDialogBkgdTop), surface(kDialogBkgdLeft), surface(kDialogBkgd), kShadowFull);
|
||||
|
||||
drawRectMasked(r, surface(kDialogBkgdCorner), surface(kDialogBkgdTop), surface(kDialogBkgdLeft), surface(kDialogBkgd),
|
||||
256, _colors[kDialogEnd], _colors[kDialogEnd], _gradientFactors[kDialogFactor]);
|
||||
} else {
|
||||
drawShadow(r, surface(kDialogBkgdCorner), surface(kDialogBkgdTop), surface(kDialogBkgdLeft), surface(kDialogBkgd), kShadowFull);
|
||||
|
||||
@ -547,7 +554,10 @@ void ThemeNew::drawWidgetBackground(const Common::Rect &r, uint16 hints, kWidget
|
||||
left = kWidgetBkgdLeft;
|
||||
bkgd = kWidgetBkgd;
|
||||
shadow = kShadowFull;
|
||||
start = kWidgetBackgroundStart;
|
||||
if (hints & THEME_HINT_PLAIN_COLOR)
|
||||
start = kWidgetBackgroundEnd;
|
||||
else
|
||||
start = kWidgetBackgroundStart;
|
||||
end = kWidgetBackgroundEnd;
|
||||
factor = kWidgetFactor;
|
||||
break;
|
||||
@ -661,12 +671,13 @@ void ThemeNew::drawSlider(const Common::Rect &rr, int width, kState state) {
|
||||
Common::Rect r2 = r;
|
||||
r2.left = r.left;
|
||||
r2.top = r.top;
|
||||
r2.bottom = r.bottom;
|
||||
r2.right = r2.left + width;
|
||||
r2.bottom = r.bottom-1;
|
||||
r2.right = r2.left + width-1;
|
||||
if (r2.right > r.right) {
|
||||
r2.right = r.right;
|
||||
}
|
||||
|
||||
drawShadow(r2, surface(kButtonBkgdCorner), surface(kButtonBkgdTop), surface(kButtonBkgdLeft), surface(kButtonBkgd), kShadowButton);
|
||||
if (state == kStateHighlight) {
|
||||
drawRectMasked(r2, surface(kSliderCorner), surface(kSliderTop), surface(kSliderLeft), surface(kSliderBkgd),
|
||||
256, _colors[kSliderHighStart], _colors[kSliderHighEnd], _gradientFactors[kSliderFactor]);
|
||||
@ -691,7 +702,7 @@ void ThemeNew::drawPopUpWidget(const Common::Rect &r, const Common::String &sel,
|
||||
end = _colors[kPopUpWidgetHighlightEnd];
|
||||
}
|
||||
|
||||
drawShadow(r, surface(kDialogBkgdCorner), surface(kDialogBkgdTop), surface(kDialogBkgdLeft), surface(kDialogBkgd), kShadowSmall);
|
||||
drawShadow(r, surface(kDialogBkgdCorner), surface(kDialogBkgdTop), surface(kDialogBkgdLeft), surface(kDialogBkgd), kShadowPopUp);
|
||||
|
||||
drawRectMasked(r, surface(kPopUpWidgetBkgdCorner), surface(kPopUpWidgetBkgdTop), surface(kPopUpWidgetBkgdLeft), surface(kPopUpWidgetBkgd),
|
||||
(state == kStateDisabled) ? -30 : 256, start, end, _gradientFactors[kPopUpWidgetFactor]);
|
||||
@ -1034,13 +1045,21 @@ void ThemeNew::drawRectMasked(const Common::Rect &r, const Graphics::Surface *co
|
||||
Common::Rect ThemeNew::shadowRect(const Common::Rect &r, uint32 shadowStyle) {
|
||||
switch (shadowStyle) {
|
||||
case kShadowButton:
|
||||
return Common::Rect(r.left - _shadowLeftWidth/2, r.top - _shadowTopHeight/2, r.right + _shadowRightWidth/2 - 1, r.bottom + _shadowBottomHeight/2 - 1);
|
||||
return Common::Rect(r.left - 1, r.top - 1, r.right + 1, r.bottom + 1);
|
||||
break;
|
||||
|
||||
case kShadowEmboss:
|
||||
return Common::Rect(r.left - 1, r.top - 1, r.right + 1, r.bottom + 1);
|
||||
break;
|
||||
|
||||
case kShadowPopUp:
|
||||
return Common::Rect(r.left - 1, r.top - 1, r.right + 3, r.bottom + 3);
|
||||
break;
|
||||
|
||||
case kShadowFull:
|
||||
return Common::Rect(r.left - 2, r.top - 2, r.right + 4, r.bottom + 4);
|
||||
break;
|
||||
|
||||
default:
|
||||
return Common::Rect(r.left - _shadowLeftWidth/2, r.top - _shadowTopHeight/2, r.right + _shadowRightWidth/2 + 1, r.bottom + _shadowBottomHeight/2 + 1);
|
||||
break;
|
||||
@ -1053,13 +1072,16 @@ void ThemeNew::drawShadow(const Common::Rect &r, const Graphics::Surface *corner
|
||||
const Graphics::Surface *left, const Graphics::Surface *fill, uint32 shadowStyle, bool skipLastRow) {
|
||||
switch (shadowStyle) {
|
||||
case kShadowFull: {
|
||||
Common::Rect r2(r.left - _shadowLeftWidth/2, r.top - _shadowTopHeight/2, r.right + _shadowRightWidth/2 + 1, r.bottom + _shadowBottomHeight/2 + 1);
|
||||
Common::Rect r3(r.left - _shadowLeftWidth/2, r.top - _shadowTopHeight/2, r.right + _shadowRightWidth/2, r.bottom + _shadowBottomHeight/2);
|
||||
Common::Rect r4(r.left - _shadowLeftWidth/2 + 1, r.top - _shadowTopHeight/2 + 1, r.right + _shadowRightWidth/2-1, r.bottom + _shadowBottomHeight/2-1);
|
||||
Common::Rect r2(r.left-1, r.top-1, r.right + 4, r.bottom + 4);
|
||||
Common::Rect r3(r.left, r.top+1, r.right + 3, r.bottom + 3);
|
||||
Common::Rect r4(r.left, r.top+1, r.right + 2, r.bottom + 2);
|
||||
Common::Rect r5(r.left, r.top, r.right + 1, r.bottom + 1);
|
||||
|
||||
drawShadowRect(r2, r, corner, top, left, fill, kShadowTr1, skipLastRow);
|
||||
drawShadowRect(r3, r, corner, top, left, fill, kShadowTr2, skipLastRow);
|
||||
drawShadowRect(r4, r, corner, top, left, fill, kShadowTr3, skipLastRow);
|
||||
drawShadowRect(r2, r, corner, top, left, fill, kShadowTr0, skipLastRow);
|
||||
drawShadowRect(r3, r, corner, top, left, fill, kShadowTr1, skipLastRow);
|
||||
drawShadowRect(r4, r, corner, top, left, fill, kShadowTr2, skipLastRow);
|
||||
drawShadowRect(r5, r, corner, top, left, fill, kShadowTr3, skipLastRow);
|
||||
//drawShadowRect(r5, r, corner, top, left, fill, kShadowTr35, skipLastRow);
|
||||
} break;
|
||||
|
||||
case kShadowSmall: {
|
||||
@ -1071,11 +1093,11 @@ void ThemeNew::drawShadow(const Common::Rect &r, const Graphics::Surface *corner
|
||||
} break;
|
||||
|
||||
case kShadowButton: {
|
||||
Common::Rect r2(r.left - _shadowLeftWidth/2, r.top - _shadowTopHeight/2, r.right + _shadowRightWidth/2 - 1, r.bottom + _shadowBottomHeight/2 - 1);
|
||||
Common::Rect r3(r.left - _shadowLeftWidth/2 + 1, r.top - _shadowTopHeight/2 + 1, r.right + _shadowRightWidth/2 - 1, r.bottom + _shadowBottomHeight/2 - 1);
|
||||
Common::Rect r2(r.left-1, r.top - 1, r.right, r.bottom);
|
||||
Common::Rect r4(r.left, r.top, r.right + 1, r.bottom + 1);
|
||||
|
||||
drawShadowRect(r2, r, corner, top, left, fill, kShadowTr2, skipLastRow);
|
||||
drawShadowRect(r3, r, corner, top, left, fill, kShadowTr4, skipLastRow);
|
||||
drawShadowRect(r2, r, corner, top, left, fill, -kShadowTr35-256, skipLastRow);
|
||||
drawShadowRect(r4, r, corner, top, left, fill, kShadowTr4, skipLastRow);
|
||||
} break;
|
||||
|
||||
case kShadowEmboss: {
|
||||
@ -1084,7 +1106,19 @@ void ThemeNew::drawShadow(const Common::Rect &r, const Graphics::Surface *corner
|
||||
|
||||
drawShadowRect(r2, r, corner, top, left, fill, kShadowTr5, skipLastRow);
|
||||
drawShadowRect(r4, r, corner, top, left, fill, kShadowTr1, skipLastRow);
|
||||
};
|
||||
} break;
|
||||
|
||||
case kShadowPopUp: {
|
||||
Common::Rect r2(r.left, r.top, r.right + 3, r.bottom + 3);
|
||||
Common::Rect r25(r.left-1, r.top-1, r.right + 2, r.bottom + 2);
|
||||
Common::Rect r3(r.left - 1, r.top-1, r.right, r.bottom);
|
||||
Common::Rect r4(r.left, r.top, r.right + 1, r.bottom + 1);
|
||||
|
||||
drawShadowRect(r2, r, corner, top, left, fill, kShadowTr1, skipLastRow);
|
||||
drawShadowRect(r25, r, corner, top, left, fill, kShadowTr2, skipLastRow);
|
||||
drawShadowRect(r4, r, corner, top, left, fill, kShadowTr3, skipLastRow);
|
||||
drawShadowRect(r3, r, corner, top, left, fill, -kShadowTr35-256, skipLastRow);
|
||||
} break;
|
||||
|
||||
default:
|
||||
break;
|
||||
@ -1228,7 +1262,7 @@ void ThemeNew::drawSurfaceMasked(const Common::Rect &r, const Graphics::Surface
|
||||
} else {
|
||||
blitSurface(NORMAL_OFFSET, NO_EFFECT);
|
||||
}
|
||||
} else if (alpha < 0) {
|
||||
} else if (alpha < 0 && alpha >= -256) {
|
||||
int backUp = _dimPercentValue;
|
||||
_dimPercentValue = 256 * (100 - (-alpha)) / 100;
|
||||
|
||||
@ -1595,11 +1629,28 @@ inline OverlayColor getColorAlphaImpl(OverlayColor col1, OverlayColor col2, int
|
||||
return output;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline OverlayColor getColorAlphaImp2(OverlayColor col1, OverlayColor col2, int alpha) {
|
||||
OverlayColor output = 0;
|
||||
output |= ((alpha * ((~col1 & T::kRedMask) - (col2 & T::kRedMask)) >> 8) + (col2 & T::kRedMask)) & T::kRedMask;
|
||||
output |= ((alpha * ((~col1 & T::kGreenMask) - (col2 & T::kGreenMask)) >> 8) + (col2 & T::kGreenMask)) & T::kGreenMask;
|
||||
output |= ((alpha * ((~col1 & T::kBlueMask) - (col2 & T::kBlueMask)) >> 8) + (col2 & T::kBlueMask)) & T::kBlueMask;
|
||||
return output;
|
||||
}
|
||||
|
||||
OverlayColor getColorAlpha(OverlayColor col1, OverlayColor col2, int alpha) {
|
||||
if (gBitFormat == 565) {
|
||||
return getColorAlphaImpl<ColorMasks<565> >(col1, col2, alpha);
|
||||
if (alpha > 0) {
|
||||
if (gBitFormat == 565) {
|
||||
return getColorAlphaImpl<ColorMasks<565> >(col1, col2, alpha);
|
||||
} else {
|
||||
return getColorAlphaImpl<ColorMasks<555> >(col1, col2, alpha);
|
||||
}
|
||||
} else {
|
||||
return getColorAlphaImpl<ColorMasks<555> >(col1, col2, alpha);
|
||||
if (gBitFormat == 565) {
|
||||
return getColorAlphaImp2<ColorMasks<565> >(col1, col2, -alpha - 256);
|
||||
} else {
|
||||
return getColorAlphaImp2<ColorMasks<555> >(col1, col2, -alpha - 256);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,6 +150,8 @@ BrowserDialog::BrowserDialog(const char *title, bool dirBrowser)
|
||||
_fileList->setNumberingMode(kListNumberingOff);
|
||||
_fileList->setEditable(false);
|
||||
|
||||
_fileList->setHints(THEME_HINT_PLAIN_COLOR);
|
||||
|
||||
// Buttons
|
||||
new ButtonWidget(this, "browser_up", "Go up", kGoUpCmd, 0);
|
||||
new ButtonWidget(this, "browser_cancel", "Cancel", kCloseCmd, 0);
|
||||
|
@ -101,6 +101,11 @@ void ConsoleDialog::init() {
|
||||
else
|
||||
_font = g_gui.theme()->getFont((Theme::kFontStyle)f);
|
||||
|
||||
_leftPadding = g_gui.evaluator()->getVar("Console.leftPadding", 0);
|
||||
_rightPadding = g_gui.evaluator()->getVar("Console.rightPadding", 0);
|
||||
_topPadding = g_gui.evaluator()->getVar("Console.topPadding", 0);
|
||||
_bottomPadding = g_gui.evaluator()->getVar("Console.bottomPadding", 0);
|
||||
|
||||
// Calculate the real width/height (rounded to char/line multiples)
|
||||
_w = (uint16)(_widthPercent * screenW);
|
||||
_h = (uint16)((_heightPercent * screenH - 2) / kConsoleLineHeight);
|
||||
@ -116,8 +121,8 @@ void ConsoleDialog::init() {
|
||||
|
||||
_drawingHints = THEME_HINT_FIRST_DRAW | THEME_HINT_SAVE_BACKGROUND;
|
||||
|
||||
_pageWidth = (_w - scrollBarWidth - 2) / kConsoleCharWidth;
|
||||
_linesPerPage = (_h - 2) / kConsoleLineHeight;
|
||||
_pageWidth = (_w - scrollBarWidth - 2 - _leftPadding - _topPadding - scrollBarWidth) / kConsoleCharWidth;
|
||||
_linesPerPage = (_h - 2 - _topPadding - _bottomPadding) / kConsoleLineHeight;
|
||||
_linesInBuffer = kBufferSize / kLineWidth;
|
||||
}
|
||||
|
||||
@ -164,35 +169,44 @@ void ConsoleDialog::close() {
|
||||
}
|
||||
|
||||
void ConsoleDialog::drawDialog() {
|
||||
// Draw text
|
||||
int start = _scrollLine - _linesPerPage + 1;
|
||||
int y = _y + 2;
|
||||
int limit = MIN(_pageWidth, (int)kLineWidth);
|
||||
|
||||
g_gui.theme()->drawDialogBackground(Common::Rect(_x, _y, _x+_w, _y+_h), _drawingHints);
|
||||
// FIXME: for the old theme the frame around the console vanishes
|
||||
// when any action is processed if we enable this
|
||||
// _drawingHints &= ~THEME_HINT_FIRST_DRAW;
|
||||
|
||||
for (int line = 0; line < _linesPerPage; line++) {
|
||||
int x = _x + 1;
|
||||
for (int column = 0; column < limit; column++) {
|
||||
#if 0
|
||||
int l = (start + line) % _linesInBuffer;
|
||||
byte c = buffer(l * kLineWidth + column);
|
||||
#else
|
||||
byte c = buffer((start + line) * kLineWidth + column);
|
||||
#endif
|
||||
g_gui.theme()->drawChar(Common::Rect(x, y, x+kConsoleCharWidth, y+kConsoleLineHeight), c, _font);
|
||||
x += kConsoleCharWidth;
|
||||
}
|
||||
y += kConsoleLineHeight;
|
||||
}
|
||||
for (int line = 0; line < _linesPerPage; line++)
|
||||
drawLine(line, false);
|
||||
|
||||
// Draw the scrollbar
|
||||
_scrollBar->draw();
|
||||
}
|
||||
|
||||
void ConsoleDialog::drawLine(int line, bool restoreBg) {
|
||||
int x = _x + 1 + _leftPadding;
|
||||
int start = _scrollLine - _linesPerPage + 1;
|
||||
int y = _y + 2 + _topPadding;
|
||||
int limit = MIN(_pageWidth, (int)kLineWidth);
|
||||
|
||||
y += line * kConsoleLineHeight;
|
||||
|
||||
if (restoreBg) {
|
||||
Common::Rect r(_x, y - 2, _x + _pageWidth * kConsoleCharWidth, y+kConsoleLineHeight);
|
||||
g_gui.theme()->restoreBackground(r);
|
||||
g_gui.theme()->addDirtyRect(r);
|
||||
}
|
||||
|
||||
for (int column = 0; column < limit; column++) {
|
||||
#if 0
|
||||
int l = (start + line) % _linesInBuffer;
|
||||
byte c = buffer(l * kLineWidth + column);
|
||||
#else
|
||||
byte c = buffer((start + line) * kLineWidth + column);
|
||||
#endif
|
||||
g_gui.theme()->drawChar(Common::Rect(x, y, x+kConsoleCharWidth, y+kConsoleLineHeight), c, _font);
|
||||
x += kConsoleCharWidth;
|
||||
}
|
||||
}
|
||||
|
||||
void ConsoleDialog::handleScreenChanged() {
|
||||
init();
|
||||
|
||||
@ -301,7 +315,7 @@ void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
|
||||
killChar();
|
||||
}
|
||||
scrollToCurrent();
|
||||
draw(); // FIXME - not nice to redraw the full console just for one char!
|
||||
drawLine(pos2line(_currentPos));
|
||||
break;
|
||||
case 9: // tab
|
||||
{
|
||||
@ -321,7 +335,7 @@ void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
|
||||
drawCaret(true);
|
||||
insertIntoPrompt(completion);
|
||||
scrollToCurrent();
|
||||
draw();
|
||||
drawLine(pos2line(_currentPos));
|
||||
delete[] completion;
|
||||
}
|
||||
delete[] str;
|
||||
@ -330,7 +344,7 @@ void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
|
||||
}
|
||||
case 127:
|
||||
killChar();
|
||||
draw();
|
||||
drawLine(pos2line(_currentPos));
|
||||
break;
|
||||
case 256 + 24: // pageup
|
||||
if (modifiers == OSystem::KBD_SHIFT) {
|
||||
@ -382,12 +396,12 @@ void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
|
||||
case 275: // cursor right
|
||||
if (_currentPos < _promptEndPos)
|
||||
_currentPos++;
|
||||
draw();
|
||||
drawLine(pos2line(_currentPos));
|
||||
break;
|
||||
case 276: // cursor left
|
||||
if (_currentPos > _promptStartPos)
|
||||
_currentPos--;
|
||||
draw();
|
||||
drawLine(pos2line(_currentPos));
|
||||
break;
|
||||
default:
|
||||
if (ascii == '~' || ascii == '#') {
|
||||
@ -599,7 +613,7 @@ void ConsoleDialog::putchar(int c) {
|
||||
drawCaret(true);
|
||||
|
||||
putcharIntern(c);
|
||||
draw(); // FIXME - not nice to redraw the full console just for one char!
|
||||
drawLine(pos2line(_currentPos));
|
||||
}
|
||||
|
||||
void ConsoleDialog::putcharIntern(int c) {
|
||||
@ -636,11 +650,11 @@ void ConsoleDialog::drawCaret(bool erase) {
|
||||
return;
|
||||
}
|
||||
|
||||
int x = _x + 1 + (_currentPos % kLineWidth) * kConsoleCharWidth;
|
||||
int y = _y + displayLine * kConsoleLineHeight;
|
||||
int x = _x + 1 + _leftPadding + (_currentPos % kLineWidth) * kConsoleCharWidth;
|
||||
int y = _y + _topPadding + displayLine * kConsoleLineHeight;
|
||||
|
||||
_caretVisible = !erase;
|
||||
g_gui.theme()->drawCaret(Common::Rect(x, y, x+kConsoleCharWidth, y+kConsoleLineHeight), erase);
|
||||
g_gui.theme()->drawCaret(Common::Rect(x, y, x+1, y+kConsoleLineHeight), erase);
|
||||
}
|
||||
|
||||
void ConsoleDialog::scrollToCurrent() {
|
||||
|
@ -90,6 +90,11 @@ protected:
|
||||
|
||||
float _widthPercent, _heightPercent;
|
||||
|
||||
int _leftPadding;
|
||||
int _rightPadding;
|
||||
int _topPadding;
|
||||
int _bottomPadding;
|
||||
|
||||
void slideUpAndClose();
|
||||
|
||||
public:
|
||||
@ -126,6 +131,9 @@ protected:
|
||||
|
||||
void init();
|
||||
|
||||
int pos2line(int pos) { return (pos - (_scrollLine - _linesPerPage + 1) * kLineWidth) / kLineWidth; }
|
||||
|
||||
void drawLine(int line, bool restoreBg = true);
|
||||
void drawCaret(bool erase);
|
||||
void putcharIntern(int c);
|
||||
void insertIntoPrompt(const char *str);
|
||||
|
@ -43,6 +43,8 @@ void EditableWidget::init() {
|
||||
_caretInverse = false;
|
||||
|
||||
_editScrollOffset = 0;
|
||||
|
||||
_font = Theme::kFontStyleBold;
|
||||
}
|
||||
|
||||
EditableWidget::~EditableWidget() {
|
||||
@ -54,7 +56,7 @@ void EditableWidget::setEditString(const String &str) {
|
||||
_editString = str;
|
||||
_caretPos = _editString.size();
|
||||
|
||||
_editScrollOffset = (g_gui.getStringWidth(_editString) - (getEditRect().width()));
|
||||
_editScrollOffset = (g_gui.getStringWidth(_editString) - (getEditRect().width()), _font);
|
||||
if (_editScrollOffset < 0)
|
||||
_editScrollOffset = 0;
|
||||
}
|
||||
@ -109,11 +111,13 @@ bool EditableWidget::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
|
||||
if (_caretPos > 0) {
|
||||
dirty = setCaretPos(_caretPos - 1);
|
||||
}
|
||||
dirty = true;
|
||||
break;
|
||||
case 256 + 19: // right arrow
|
||||
if (_caretPos < (int)_editString.size()) {
|
||||
dirty = setCaretPos(_caretPos + 1);
|
||||
}
|
||||
dirty = true;
|
||||
break;
|
||||
case 256 + 22: // home
|
||||
dirty = setCaretPos(0);
|
||||
@ -139,7 +143,7 @@ bool EditableWidget::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
|
||||
int EditableWidget::getCaretOffset() const {
|
||||
int caretpos = 0;
|
||||
for (int i = 0; i < _caretPos; i++)
|
||||
caretpos += g_gui.getCharWidth(_editString[i]);
|
||||
caretpos += g_gui.getCharWidth(_editString[i], _font);
|
||||
|
||||
caretpos -= _editScrollOffset;
|
||||
|
||||
@ -191,7 +195,7 @@ bool EditableWidget::adjustOffset() {
|
||||
_editScrollOffset -= (editWidth - caretpos);
|
||||
return true;
|
||||
} else if (_editScrollOffset > 0) {
|
||||
const int strWidth = g_gui.getStringWidth(_editString);
|
||||
const int strWidth = g_gui.getStringWidth(_editString, _font);
|
||||
if (strWidth - _editScrollOffset < editWidth) {
|
||||
// scroll right
|
||||
_editScrollOffset = (strWidth - editWidth);
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "common/str.h"
|
||||
#include "common/rect.h"
|
||||
#include "gui/widget.h"
|
||||
#include "gui/newgui.h"
|
||||
|
||||
namespace GUI {
|
||||
|
||||
@ -46,6 +47,8 @@ protected:
|
||||
|
||||
int _editScrollOffset;
|
||||
|
||||
Theme::kFontStyle _font;
|
||||
|
||||
public:
|
||||
EditableWidget(GuiObject *boss, int x, int y, int w, int h, WidgetSize ws = kNormalWidgetSize);
|
||||
EditableWidget(GuiObject *boss, String name);
|
||||
@ -70,6 +73,8 @@ protected:
|
||||
bool setCaretPos(int newPos);
|
||||
bool adjustOffset();
|
||||
|
||||
void setFontStyle(Theme::kFontStyle font) { _font = font; }
|
||||
|
||||
virtual bool tryInsertChar(char c, int pos);
|
||||
};
|
||||
|
||||
|
@ -349,4 +349,8 @@ void NewGui::handleScreenChange() {
|
||||
_theme->refresh();
|
||||
}
|
||||
|
||||
void NewGui::clearDragWidget() {
|
||||
_dialogStack.top()->_dragWidget = 0;
|
||||
}
|
||||
|
||||
} // End of namespace GUI
|
||||
|
@ -81,6 +81,9 @@ public:
|
||||
WidgetSize getWidgetSize();
|
||||
|
||||
void handleScreenChange();
|
||||
|
||||
void clearDragWidget();
|
||||
|
||||
protected:
|
||||
OSystem *_system;
|
||||
|
||||
|
21
gui/theme.h
21
gui/theme.h
@ -55,8 +55,11 @@ enum {
|
||||
// Indicates special colorfade
|
||||
THEME_HINT_SPECIAL_COLOR = 1 << 3,
|
||||
|
||||
// Indicates no colorfade
|
||||
THEME_HINT_PLAIN_COLOR = 1 << 4,
|
||||
|
||||
// Indictaes that a shadows should be drawn around the background
|
||||
THEME_HINT_USE_SHADOW = 1 << 4
|
||||
THEME_HINT_USE_SHADOW = 1 << 5
|
||||
};
|
||||
|
||||
|
||||
@ -148,6 +151,9 @@ public:
|
||||
virtual void drawCaret(const Common::Rect &r, bool erase, kState state = kStateEnabled) = 0;
|
||||
virtual void drawLineSeparator(const Common::Rect &r, kState state = kStateEnabled) = 0;
|
||||
|
||||
virtual void restoreBackground(Common::Rect r, bool special = false) = 0;
|
||||
virtual bool addDirtyRect(Common::Rect r, bool save = false, bool special = false) = 0;
|
||||
|
||||
Graphics::TextAlignment convertAligment(kTextAlign align) const {
|
||||
switch (align) {
|
||||
case kTextAlignLeft:
|
||||
@ -245,10 +251,10 @@ public:
|
||||
void drawPopUpWidget(const Common::Rect &r, const Common::String &sel, int deltax, kState state, kTextAlign align);
|
||||
void drawCaret(const Common::Rect &r, bool erase, kState state);
|
||||
void drawLineSeparator(const Common::Rect &r, kState state);
|
||||
private:
|
||||
void restoreBackground(Common::Rect r);
|
||||
bool addDirtyRect(Common::Rect r, bool save = false);
|
||||
void restoreBackground(Common::Rect r, bool special = false);
|
||||
bool addDirtyRect(Common::Rect r, bool save = false, bool special = false);
|
||||
|
||||
private:
|
||||
void box(int x, int y, int width, int height, OverlayColor colorA, OverlayColor colorB, bool skipLastRow = false);
|
||||
void box(int x, int y, int width, int height);
|
||||
|
||||
@ -324,9 +330,10 @@ public:
|
||||
void drawLineSeparator(const Common::Rect &r, kState state);
|
||||
const Graphics::Surface *getImageSurface(int n) { return _images[n]; }
|
||||
|
||||
private:
|
||||
void restoreBackground(Common::Rect r, bool special = false);
|
||||
bool addDirtyRect(Common::Rect r, bool backup = false, bool special = false);
|
||||
|
||||
private:
|
||||
void colorFade(const Common::Rect &r, OverlayColor start, OverlayColor end, uint factor = 1);
|
||||
void drawRect(const Common::Rect &r, const Graphics::Surface *corner, const Graphics::Surface *top,
|
||||
const Graphics::Surface *left, const Graphics::Surface *fill, int alpha, bool skipLastRow = false);
|
||||
@ -341,7 +348,8 @@ private:
|
||||
kShadowFull = 0,
|
||||
kShadowSmall = 1,
|
||||
kShadowButton = 2,
|
||||
kShadowEmboss = 3
|
||||
kShadowEmboss = 3,
|
||||
kShadowPopUp = 4
|
||||
};
|
||||
|
||||
Common::Rect shadowRect(const Common::Rect &r, uint32 shadowStyle);
|
||||
@ -368,7 +376,6 @@ private:
|
||||
void resetupGuiRenderer();
|
||||
void setupColors();
|
||||
|
||||
void restoreBackground(Common::Rect r, bool special = false);
|
||||
OverlayColor getColor(kState state);
|
||||
|
||||
struct DialogState {
|
||||
|
@ -1,7 +1,7 @@
|
||||
# $URL$
|
||||
# $Id$
|
||||
[theme]
|
||||
version=12
|
||||
version=13
|
||||
|
||||
[pixmaps]
|
||||
dialog_corner=dialog_bkgd_corner.bmp
|
||||
@ -75,7 +75,7 @@ main_dialog_end=239 196 24
|
||||
dialog_start=246 224 139
|
||||
dialog_end=251 241 206
|
||||
|
||||
color_state_disabled=128 128 128
|
||||
color_state_disabled=192 192 192
|
||||
color_state_highlight=100 162 8
|
||||
color_state_enabled=0 0 0
|
||||
|
||||
@ -89,18 +89,18 @@ widget_bkgd_end=251 241 206
|
||||
widget_bkgd_small_start=246 224 139
|
||||
widget_bkgd_small_end=251 241 206
|
||||
|
||||
button_bkgd_start=210 130 110
|
||||
button_bkgd_end=177 61 34
|
||||
button_bkgd_start=203 126 107
|
||||
button_bkgd_end=169 42 12
|
||||
button_bkgd_highlight_start=255 210 200
|
||||
button_bkgd_highlight_end=200 70 50
|
||||
button_text_enabled=255 255 255
|
||||
button_text_disabled=128 128 128
|
||||
button_text_disabled=192 192 192
|
||||
button_text_highlight=255 214 84
|
||||
|
||||
slider_background_start=247 228 166
|
||||
slider_background_end=247 228 166
|
||||
slider_start=210 130 110
|
||||
slider_end=177 61 34
|
||||
slider_start=203 126 107
|
||||
slider_end=169 42 12
|
||||
slider_highlight_start=255 210 200
|
||||
slider_highlight_end=200 70 50
|
||||
|
||||
@ -111,8 +111,8 @@ scrollbar_background_start=247 228 166
|
||||
scrollbar_background_end=247 228 166
|
||||
scrollbar_button_start=247 228 166
|
||||
scrollbar_button_end=247 228 166
|
||||
scrollbar_slider_start=210 130 110
|
||||
scrollbar_slider_end=177 61 34
|
||||
scrollbar_slider_start=203 126 107
|
||||
scrollbar_slider_end=169 42 12
|
||||
scrollbar_button_highlight_start=255 210 200
|
||||
scrollbar_button_highlight_end=200 70 50
|
||||
scrollbar_slider_highlight_start=255 210 200
|
||||
@ -137,9 +137,9 @@ dialog_special=2
|
||||
widget_small=3
|
||||
widget=3
|
||||
|
||||
button=2
|
||||
button=1
|
||||
|
||||
slider=2
|
||||
slider=1
|
||||
slider_bkgd=1
|
||||
|
||||
tab=2
|
||||
@ -157,7 +157,7 @@ shadow_right_width=4
|
||||
shadow_top_height=2
|
||||
shadow_bottom_height=4
|
||||
inactive_dialog_shading=dim
|
||||
shading_dim_percent=20
|
||||
shading_dim_percent=15
|
||||
fontfile_normal=helvr12-l1.bdf
|
||||
fontfile_fixed_normal=courr12-l1.bdf
|
||||
cursor_hotspot_x=0
|
||||
@ -192,16 +192,22 @@ def_midiControlsSpacing=4
|
||||
|
||||
##### Widgets config
|
||||
ListWidget.leftPadding=7
|
||||
ListWidget.rightPadding=7
|
||||
ListWidget.rightPadding=5
|
||||
ListWidget.topPadding=5
|
||||
ListWidget.bottomPadding=5
|
||||
ListWidget.hlLeftPadding=0
|
||||
ListWidget.hlRightPadding=0
|
||||
PopUpWidget.leftPadding=7
|
||||
PopUpWidget.rightPadding=7
|
||||
PopUpWidget.rightPadding=5
|
||||
PopUpWidget.labelSpacing=3
|
||||
EditTextWidget.font=kFontStyleNormal
|
||||
EditTextWidget.leftPadding=7
|
||||
EditTextWidget.rightPadding=7
|
||||
EditTextWidget.rightPadding=5
|
||||
Console.font=kFontStyleFixedNormal
|
||||
Console.leftPadding=7
|
||||
Console.rightPadding=5
|
||||
Console.topPadding=5
|
||||
Console.bottomPadding=5
|
||||
|
||||
###### chooser
|
||||
opHeight=insetH
|
||||
@ -393,10 +399,12 @@ scummhelp_close=(scummhelpW - 8 - shButtonWidth) prev.y prev.w prev.h
|
||||
# Saveload dialog
|
||||
scummsaveload=8 8 (w - 2 * 8) (h - 16)
|
||||
set_parent=scummsaveload
|
||||
scummsaveload_title=10 2 (parent.w - 2 * 10 - 180) kLineHeight
|
||||
scummsaveload_title=10 2 (parent.w - 2 * 10 - 180-20) kLineHeight
|
||||
scummsaveload_title.align=kTextAlignCenter
|
||||
scummsaveload_list=10 18 prev.w (parent.h - 17 - buttonHeight - 8 - self.y)
|
||||
scummsaveload_thumbnail=(parent.w - (kThumbnailWidth + 22)) 18
|
||||
scummsaveload_thumbnail.hPad=10
|
||||
scummsaveload_thumbnail.vPad=10
|
||||
scummsaveload_cancel=(parent.w - 2 * (buttonWidth + 10)) (parent.h - buttonHeight - 8) buttonWidth buttonHeight
|
||||
scummsaveload_choose=(prev.x2 + 10) prev.y prev.w prev.h
|
||||
scummsaveload_extinfo.visible=true
|
||||
@ -414,9 +422,9 @@ chooser_ok=(prev.x2 + 10) prev.y prev.w prev.h
|
||||
gcx=(opXoffset + 10)
|
||||
gcw=(parent.w - gcx - 25)
|
||||
grModePopup=(gcx - 5) (opYoffset - 1) (gcw + 5) kPopUpHeight
|
||||
opYoffset=(opYoffset + kLineHeight + 8)
|
||||
grRenderPopup=prev.x (opYoffset - 1) prev.w prev.h
|
||||
opYoffset=(opYoffset + kLineHeight + 12)
|
||||
grRenderPopup=prev.x (opYoffset - 1) prev.w prev.h
|
||||
opYoffset=(opYoffset + kLineHeight + 16)
|
||||
grFullscreenCheckbox=gcx opYoffset (kFontHeight + 10 + 96) buttonHeight
|
||||
opYoffset=(opYoffset + buttonHeight + 4)
|
||||
grAspectCheckbox=prev.x opYoffset (kFontHeight + 10 + 136) prev.h
|
||||
|
@ -356,4 +356,20 @@ void GraphicsWidget::drawWidget(bool hilite) {
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
ContainerWidget::ContainerWidget(GuiObject *boss, int x, int y, int w, int h) : Widget(boss, x, y, w, h) {
|
||||
_flags = WIDGET_ENABLED | WIDGET_CLEARBG;
|
||||
_type = kContainerWidget;
|
||||
}
|
||||
|
||||
ContainerWidget::ContainerWidget(GuiObject *boss, String name) : Widget(boss, name) {
|
||||
_flags = WIDGET_ENABLED | WIDGET_CLEARBG;
|
||||
_type = kContainerWidget;
|
||||
}
|
||||
|
||||
void ContainerWidget::drawWidget(bool hilite) {
|
||||
g_gui.theme()->drawWidgetBackground(Common::Rect(_x, _y, _x + _w, _y + _h), _hints, Theme::kWidgetBackgroundBorder);
|
||||
}
|
||||
|
||||
} // End of namespace GUI
|
||||
|
13
gui/widget.h
13
gui/widget.h
@ -58,7 +58,8 @@ enum {
|
||||
kScrollBarWidget = 'SCRB',
|
||||
kPopUpWidget = 'POPU',
|
||||
kTabWidget = 'TABW',
|
||||
kGraphicsWidget = 'GFXW'
|
||||
kGraphicsWidget = 'GFXW',
|
||||
kContainerWidget = 'CTNR'
|
||||
};
|
||||
|
||||
enum {
|
||||
@ -279,6 +280,16 @@ protected:
|
||||
bool _transparency;
|
||||
};
|
||||
|
||||
/* ContainerWidget */
|
||||
class ContainerWidget : public Widget {
|
||||
public:
|
||||
ContainerWidget(GuiObject *boss, int x, int y, int w, int h);
|
||||
ContainerWidget(GuiObject *boss, Common::String name);
|
||||
|
||||
protected:
|
||||
void drawWidget(bool hilite);
|
||||
};
|
||||
|
||||
} // End of namespace GUI
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user