mirror of
https://github.com/libretro/scummvm.git
synced 2024-11-27 19:30:41 +00:00
Started to prepare the gui for runtime resolution switches.
(some little things could be missing yet though) svn-id: r22017
This commit is contained in:
parent
ec7e734adb
commit
30787714d3
@ -31,7 +31,7 @@ namespace GUI {
|
||||
|
||||
ListWidget::ListWidget(GuiObject *boss, String name)
|
||||
: EditableWidget(boss, name), CommandSender(boss) {
|
||||
int w = g_gui.evaluator()->getVar(name + ".w");
|
||||
int w = g_gui.evaluator()->getVar(_name + ".w");
|
||||
|
||||
WidgetSize ws = g_gui.getWidgetSize();
|
||||
|
||||
@ -47,6 +47,9 @@ ListWidget::ListWidget(GuiObject *boss, String name)
|
||||
} else {
|
||||
_w = w - kNormalScrollBarWidth;
|
||||
}
|
||||
|
||||
_scrollBar = new ScrollBarWidget(boss, _x + _w, _y, (ws == kBigWidgetSize ? kBigScrollBarWidth : kNormalScrollBarWidth), _h);
|
||||
_scrollBar->setTarget(this);
|
||||
|
||||
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | WIDGET_WANT_TICKLE;
|
||||
setHints(THEME_HINT_SAVE_BACKGROUND);
|
||||
@ -56,8 +59,6 @@ ListWidget::ListWidget(GuiObject *boss, String name)
|
||||
_entriesPerPage = (_h - _topPadding - _bottomPadding) / kLineHeight;
|
||||
_currentPos = 0;
|
||||
_selectedItem = -1;
|
||||
_scrollBar = new ScrollBarWidget(boss, _x + _w, _y, (ws == kBigWidgetSize ? kBigScrollBarWidth : kNormalScrollBarWidth), _h);
|
||||
_scrollBar->setTarget(this);
|
||||
_currentKeyDown = 0;
|
||||
|
||||
_quickSelectTime = 0;
|
||||
@ -436,4 +437,36 @@ void ListWidget::abortEditMode() {
|
||||
g_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false);
|
||||
}
|
||||
|
||||
void ListWidget::handleScreenChanged() {
|
||||
Widget::handleScreenChanged();
|
||||
|
||||
int w = g_gui.evaluator()->getVar(_name + ".w");
|
||||
|
||||
WidgetSize ws = g_gui.getWidgetSize();
|
||||
|
||||
_leftPadding = g_gui.evaluator()->getVar("ListWidget.leftPadding", 0);
|
||||
_rightPadding = g_gui.evaluator()->getVar("ListWidget.rightPadding", 0);
|
||||
_topPadding = g_gui.evaluator()->getVar("ListWidget.topPadding", 0);
|
||||
_bottomPadding = g_gui.evaluator()->getVar("ListWidget.bottomPadding", 0);
|
||||
_hlLeftPadding = g_gui.evaluator()->getVar("ListWidget.hlLeftPadding", 0);
|
||||
_hlRightPadding = g_gui.evaluator()->getVar("ListWidget.hlRightPadding", 0);
|
||||
|
||||
if (ws == kBigWidgetSize) {
|
||||
_w = w - kBigScrollBarWidth;
|
||||
} else {
|
||||
_w = w - kNormalScrollBarWidth;
|
||||
}
|
||||
|
||||
_entriesPerPage = (_h - _topPadding - _bottomPadding) / kLineHeight;
|
||||
|
||||
delete [] _textWidth;
|
||||
_textWidth = new int[_entriesPerPage];
|
||||
|
||||
for (int i = 0; i < _entriesPerPage; i++)
|
||||
_textWidth[i] = 0;
|
||||
|
||||
_scrollBar->resize(_x + _w, _y, (ws == kBigWidgetSize ? kBigScrollBarWidth : kNormalScrollBarWidth), _h);
|
||||
scrollBarRecalc();
|
||||
}
|
||||
|
||||
} // End of namespace GUI
|
||||
|
@ -90,6 +90,8 @@ public:
|
||||
virtual bool handleKeyUp(uint16 ascii, int keycode, int modifiers);
|
||||
virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
|
||||
|
||||
virtual void handleScreenChanged();
|
||||
|
||||
virtual bool wantsFocus() { return true; }
|
||||
|
||||
// Made startEditMode for SCUMM's SaveLoadChooser
|
||||
|
@ -344,10 +344,7 @@ void PopUpDialog::drawMenuEntry(int entry, bool hilite) {
|
||||
|
||||
PopUpWidget::PopUpWidget(GuiObject *boss, String name, const String &label, uint labelWidth)
|
||||
: Widget(boss, name), CommandSender(boss), _label(label), _labelWidth(labelWidth) {
|
||||
_ws = g_gui.getWidgetSize();
|
||||
|
||||
_leftPadding = g_gui.evaluator()->getVar("PopUpWidget.leftPadding", 0);
|
||||
_rightPadding = g_gui.evaluator()->getVar("PopUpWidget.rightPadding", 0);
|
||||
handleScreenChanged();
|
||||
|
||||
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS;
|
||||
setHints(THEME_HINT_SAVE_BACKGROUND);
|
||||
@ -371,6 +368,15 @@ void PopUpWidget::handleMouseDown(int x, int y, int button, int clickCount) {
|
||||
}
|
||||
}
|
||||
|
||||
void PopUpWidget::handleScreenChanged() {
|
||||
_ws = g_gui.getWidgetSize();
|
||||
|
||||
_leftPadding = g_gui.evaluator()->getVar("PopUpWidget.leftPadding", 0);
|
||||
_rightPadding = g_gui.evaluator()->getVar("PopUpWidget.rightPadding", 0);
|
||||
|
||||
Widget::handleScreenChanged();
|
||||
}
|
||||
|
||||
void PopUpWidget::appendEntry(const String &entry, uint32 tag) {
|
||||
Entry e;
|
||||
e.name = entry;
|
||||
|
@ -62,6 +62,8 @@ protected:
|
||||
public:
|
||||
PopUpWidget(GuiObject *boss, String name, const String &label, uint labelWidth = 0);
|
||||
|
||||
void changeLabelWidth(uint newWidth) { _labelWidth = newWidth; }
|
||||
|
||||
void handleMouseDown(int x, int y, int button, int clickCount);
|
||||
|
||||
void appendEntry(const String &entry, uint32 tag = (uint32)-1);
|
||||
@ -79,6 +81,8 @@ public:
|
||||
|
||||
void handleMouseEntered(int button) { setFlags(WIDGET_HILITED); draw(); }
|
||||
void handleMouseLeft(int button) { clearFlags(WIDGET_HILITED); draw(); }
|
||||
|
||||
virtual void handleScreenChanged();
|
||||
protected:
|
||||
void drawWidget(bool hilite);
|
||||
};
|
||||
|
@ -137,6 +137,17 @@ bool TabWidget::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
|
||||
return Widget::handleKeyDown(ascii, keycode, modifiers);
|
||||
}
|
||||
|
||||
void TabWidget::handleScreenChanged() {
|
||||
for (uint i = 0; i < _tabs.size(); ++i) {
|
||||
Widget *w = _tabs[i].firstWidget;
|
||||
while (w) {
|
||||
w->handleScreenChanged();
|
||||
w = w->next();
|
||||
}
|
||||
}
|
||||
Widget::handleScreenChanged();
|
||||
}
|
||||
|
||||
void TabWidget::drawWidget(bool hilite) {
|
||||
Common::Array<Common::String> tabs;
|
||||
for (int i = 0; i < (int)_tabs.size(); ++i) {
|
||||
|
@ -69,6 +69,8 @@ public:
|
||||
virtual void handleMouseDown(int x, int y, int button, int clickCount);
|
||||
virtual bool handleKeyDown(uint16 ascii, int keycode, int modifiers);
|
||||
|
||||
virtual void handleScreenChanged();
|
||||
|
||||
protected:
|
||||
virtual void drawWidget(bool hilite);
|
||||
|
||||
|
@ -55,6 +55,7 @@ bool ThemeClassic::init() {
|
||||
} else {
|
||||
_font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont);
|
||||
}
|
||||
resetDrawArea();
|
||||
}
|
||||
|
||||
if (isThemeLoadingRequired())
|
||||
|
@ -322,6 +322,7 @@ bool ThemeNew::init() {
|
||||
_initOk = true;
|
||||
clearAll();
|
||||
setupFonts();
|
||||
resetDrawArea();
|
||||
}
|
||||
|
||||
if (isThemeLoadingRequired()) {
|
||||
|
@ -84,9 +84,9 @@ AboutDialog::AboutDialog()
|
||||
const int screenW = g_system->getOverlayWidth();
|
||||
const int screenH = g_system->getOverlayHeight();
|
||||
|
||||
xOff = g_gui.evaluator()->getVar("aboutXOff");;
|
||||
yOff = g_gui.evaluator()->getVar("aboutYOff");;
|
||||
int outerBorder = g_gui.evaluator()->getVar("aboutOuterBorder");;
|
||||
xOff = g_gui.evaluator()->getVar("aboutXOff");
|
||||
yOff = g_gui.evaluator()->getVar("aboutYOff");
|
||||
int outerBorder = g_gui.evaluator()->getVar("aboutOuterBorder");
|
||||
|
||||
_w = screenW - 2 * outerBorder;
|
||||
_h = screenH - 2 * outerBorder;
|
||||
@ -289,4 +289,35 @@ void AboutDialog::handleKeyUp(uint16 ascii, int keycode, int modifiers) {
|
||||
close();
|
||||
}
|
||||
|
||||
void AboutDialog::handleScreenChanged() {
|
||||
Dialog::handleScreenChanged();
|
||||
const int screenW = g_system->getOverlayWidth();
|
||||
const int screenH = g_system->getOverlayHeight();
|
||||
|
||||
xOff = g_gui.evaluator()->getVar("aboutXOff");
|
||||
yOff = g_gui.evaluator()->getVar("aboutYOff");
|
||||
int outerBorder = g_gui.evaluator()->getVar("aboutOuterBorder");
|
||||
|
||||
_w = screenW - 2 * outerBorder;
|
||||
_h = screenH - 2 * outerBorder;
|
||||
|
||||
_lineHeight = g_gui.getFontHeight() + 3;
|
||||
|
||||
// Heuristic to compute 'optimal' dialog width
|
||||
int maxW = _w - 2*xOff;
|
||||
_w = 0;
|
||||
for (int i = 0; i < ARRAYSIZE(credits); i++) {
|
||||
int tmp = g_gui.getStringWidth(credits[i] + 5);
|
||||
if ( _w < tmp && tmp <= maxW) {
|
||||
_w = tmp;
|
||||
}
|
||||
}
|
||||
_w += 2*xOff;
|
||||
|
||||
_lineHeight = g_gui.getFontHeight() + 3;
|
||||
|
||||
_x = (screenW - _w) / 2;
|
||||
_y = (screenH - _h) / 2;
|
||||
}
|
||||
|
||||
} // End of namespace GUI
|
||||
|
@ -52,6 +52,8 @@ public:
|
||||
void handleMouseUp(int x, int y, int button, int clickCount);
|
||||
void handleKeyDown(uint16 ascii, int keycode, int modifiers);
|
||||
void handleKeyUp(uint16 ascii, int keycode, int modifiers);
|
||||
|
||||
void handleScreenChanged();
|
||||
};
|
||||
|
||||
} // End of namespace GUI
|
||||
|
@ -106,9 +106,12 @@ void Dialog::handleScreenChanged() {
|
||||
_drawingHints |= THEME_HINT_FIRST_DRAW;
|
||||
Widget *w = _firstWidget;
|
||||
while (w) {
|
||||
w->handleScreenChanged();
|
||||
w->setHints(THEME_HINT_FIRST_DRAW);
|
||||
w = w->_next;
|
||||
}
|
||||
|
||||
GuiObject::handleScreenChanged();
|
||||
}
|
||||
|
||||
void Dialog::releaseFocus() {
|
||||
@ -304,6 +307,28 @@ Widget *Dialog::findWidget(int x, int y) {
|
||||
return Widget::findWidgetInChain(_firstWidget, x, y);
|
||||
}
|
||||
|
||||
Widget *Dialog::findWidget(const char *name) {
|
||||
return Widget::findWidgetInChain(_firstWidget, name);
|
||||
}
|
||||
|
||||
void Dialog::deleteWidget(Widget *del) {
|
||||
Widget *w = _firstWidget;
|
||||
|
||||
if (del == _firstWidget) {
|
||||
_firstWidget = _firstWidget->_next;
|
||||
return;
|
||||
}
|
||||
|
||||
w = _firstWidget;
|
||||
while (w) {
|
||||
if (w->_next == del) {
|
||||
w->_next = w->_next->_next;
|
||||
return;
|
||||
}
|
||||
w = w->_next;
|
||||
}
|
||||
}
|
||||
|
||||
ButtonWidget *Dialog::addButton(GuiObject *boss, int x, int y, const Common::String &label, uint32 cmd, char hotkey, WidgetSize ws) {
|
||||
int w = kButtonWidth;
|
||||
int h = kButtonHeight;
|
||||
|
@ -62,6 +62,8 @@ public:
|
||||
|
||||
void releaseFocus();
|
||||
|
||||
virtual void handleScreenChanged();
|
||||
|
||||
protected:
|
||||
virtual void open();
|
||||
virtual void close();
|
||||
@ -77,9 +79,10 @@ protected:
|
||||
virtual void handleKeyUp(uint16 ascii, int keycode, int modifiers);
|
||||
virtual void handleMouseMoved(int x, int y, int button);
|
||||
virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
|
||||
virtual void handleScreenChanged();
|
||||
|
||||
Widget *findWidget(int x, int y); // Find the widget at pos x,y if any
|
||||
Widget *findWidget(const char *name);
|
||||
void deleteWidget(Widget *widget);
|
||||
|
||||
ButtonWidget *addButton(GuiObject *boss, int x, int y, const Common::String &label, uint32 cmd, char hotkey, WidgetSize ws = kDefaultWidgetSize);
|
||||
|
||||
|
@ -767,6 +767,11 @@ void LauncherDialog::updateButtons() {
|
||||
void LauncherDialog::handleScreenChanged() {
|
||||
#ifndef DISABLE_FANCY_THEMES
|
||||
if (g_gui.evaluator()->getVar("launcher_logo.visible") == 1) {
|
||||
StaticTextWidget *ver = (StaticTextWidget*)findWidget("launcher_version");
|
||||
if (ver) {
|
||||
ver->setLabel(gScummVMVersionDate);
|
||||
}
|
||||
|
||||
if (!_logo)
|
||||
_logo = new GraphicsWidget(this, "launcher_logo");
|
||||
ThemeNew *th = (ThemeNew *)g_gui.theme();
|
||||
@ -774,9 +779,23 @@ void LauncherDialog::handleScreenChanged() {
|
||||
|
||||
_logo->setGfx(th->getImageSurface(th->kThemeLogo));
|
||||
} else {
|
||||
delete _logo;
|
||||
StaticTextWidget *ver = (StaticTextWidget*)findWidget("launcher_version");
|
||||
if (ver) {
|
||||
ver->setLabel(gScummVMFullVersion);
|
||||
}
|
||||
|
||||
if (_logo) {
|
||||
deleteWidget(_logo);
|
||||
_logo->setNext(0);
|
||||
delete _logo;
|
||||
_logo = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
_w = g_system->getOverlayWidth();
|
||||
_h = g_system->getOverlayHeight();
|
||||
|
||||
Dialog::handleScreenChanged();
|
||||
}
|
||||
|
||||
|
@ -59,29 +59,33 @@ enum {
|
||||
|
||||
// HACK. FIXME. This doesn't belong here. But otherwise it creates compulation problems
|
||||
GuiObject::GuiObject(Common::String name) : _firstWidget(0) {
|
||||
if ((_x = g_gui.evaluator()->getVar(name + ".x")) == EVAL_UNDEF_VAR)
|
||||
error("Undefined variable %s.x", name.c_str());
|
||||
if ((_y = g_gui.evaluator()->getVar(name + ".y")) == EVAL_UNDEF_VAR)
|
||||
error("Undefined variable %s.y", name.c_str());
|
||||
_w = g_gui.evaluator()->getVar(name + ".w");
|
||||
_h = g_gui.evaluator()->getVar(name + ".h");
|
||||
|
||||
if(_x < 0)
|
||||
error("Widget <%s> has x < 0", name.c_str());
|
||||
if(_x >= g_system->getOverlayWidth())
|
||||
error("Widget <%s> has x > %d", name.c_str(), g_system->getOverlayWidth());
|
||||
if(_x + _w > g_system->getOverlayWidth())
|
||||
error("Widget <%s> has x + w > %d (%d)", name.c_str(), g_system->getOverlayWidth(), _x + _w);
|
||||
if(_y < 0)
|
||||
error("Widget <%s> has y < 0", name.c_str());
|
||||
if(_y >= g_system->getOverlayWidth())
|
||||
error("Widget <%s> has y > %d", name.c_str(), g_system->getOverlayHeight());
|
||||
if(_y + _h > g_system->getOverlayWidth())
|
||||
error("Widget <%s> has y + h > %d (%d)", name.c_str(), g_system->getOverlayHeight(), _y + _h);
|
||||
|
||||
_name = name;
|
||||
handleScreenChanged();
|
||||
}
|
||||
|
||||
void GuiObject::handleScreenChanged() {
|
||||
if (_name != "") {
|
||||
if ((_x = g_gui.evaluator()->getVar(_name + ".x")) == EVAL_UNDEF_VAR)
|
||||
error("Undefined variable %s.x", _name.c_str());
|
||||
if ((_y = g_gui.evaluator()->getVar(_name + ".y")) == EVAL_UNDEF_VAR)
|
||||
error("Undefined variable %s.y", _name.c_str());
|
||||
_w = g_gui.evaluator()->getVar(_name + ".w");
|
||||
_h = g_gui.evaluator()->getVar(_name + ".h");
|
||||
|
||||
if(_x < 0)
|
||||
error("Widget <%s> has x < 0", _name.c_str());
|
||||
if(_x >= g_system->getOverlayWidth())
|
||||
error("Widget <%s> has x > %d", _name.c_str(), g_system->getOverlayWidth());
|
||||
if(_x + _w > g_system->getOverlayWidth())
|
||||
error("Widget <%s> has x + w > %d (%d)", _name.c_str(), g_system->getOverlayWidth(), _x + _w);
|
||||
if(_y < 0)
|
||||
error("Widget <%s> has y < 0", _name.c_str());
|
||||
if(_y >= g_system->getOverlayWidth())
|
||||
error("Widget <%s> has y > %d", _name.c_str(), g_system->getOverlayHeight());
|
||||
if(_y + _h > g_system->getOverlayWidth())
|
||||
error("Widget <%s> has y + h > %d (%d)", _name.c_str(), g_system->getOverlayHeight(), _y + _h);
|
||||
}
|
||||
}
|
||||
|
||||
// Constructor
|
||||
NewGui::NewGui() : _needRedraw(false),
|
||||
@ -235,7 +239,7 @@ void NewGui::runLoop() {
|
||||
_needRedraw = true;
|
||||
// refresh all dialogs
|
||||
for (i = 0; i < _dialogStack.size(); ++i) {
|
||||
activeDialog->handleScreenChanged();
|
||||
_dialogStack[i]->handleScreenChanged();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -78,6 +78,8 @@ public:
|
||||
|
||||
virtual void draw() = 0;
|
||||
|
||||
virtual void handleScreenChanged();
|
||||
|
||||
protected:
|
||||
virtual void releaseFocus() = 0;
|
||||
|
||||
|
@ -446,6 +446,19 @@ void OptionsDialog::addVolumeControls(GuiObject *boss, String prefix) {
|
||||
_enableVolumeSettings = true;
|
||||
}
|
||||
|
||||
void OptionsDialog::handleScreenChanged() {
|
||||
Dialog::handleScreenChanged();
|
||||
|
||||
int labelWidth = g_gui.evaluator()->getVar("tabPopupsLabelW");
|
||||
|
||||
if (_midiPopUp)
|
||||
_midiPopUp->changeLabelWidth(labelWidth);
|
||||
if (_gfxPopUp)
|
||||
_gfxPopUp->changeLabelWidth(labelWidth);
|
||||
if (_renderModePopUp)
|
||||
_renderModePopUp->changeLabelWidth(labelWidth);
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
|
||||
|
@ -49,6 +49,8 @@ public:
|
||||
void close();
|
||||
void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
|
||||
|
||||
virtual void handleScreenChanged();
|
||||
|
||||
enum {
|
||||
kOKCmd = 'ok '
|
||||
};
|
||||
|
@ -148,6 +148,7 @@ shading_dim_percent=30
|
||||
fontfile_normal=helvr12-l1.bdf
|
||||
|
||||
[640xY]
|
||||
def_launcherX=23
|
||||
def_widgetSize=kBigWidgetSize
|
||||
def_buttonWidth=120
|
||||
def_buttonHeight=25
|
||||
@ -155,7 +156,7 @@ def_sliderWidth=kBigSliderWidth
|
||||
def_sliderHeight=kBigSliderHeight
|
||||
def_kLineHeight=16
|
||||
def_kFontHeight=14
|
||||
def_globOptionsW=466
|
||||
def_globOptionsW=(w - buttonWidth - 17 * 2 - launcherX)
|
||||
def_gameOptionsH=(h - 2 * 40)
|
||||
def_gameOptionsLabelWidth=90
|
||||
def_tabPopupsLabelW=110
|
||||
@ -197,13 +198,13 @@ browser_cancel=(parent.w - 2 * (buttonWidth + 10)) (parent.h - buttonHeight - 8)
|
||||
browser_choose=(prev.x2 + 10) prev.y prev.w prev.h
|
||||
|
||||
##### launcher
|
||||
launcher_version=85 21 247 kLineHeight
|
||||
launcher_version=(w / 2 - 283 / 2 - 90) 21 247 kLineHeight
|
||||
launcher_version.align=kTextAlignRight
|
||||
launcher_logo=180 5 283 80
|
||||
launcher_logo=(w / 2 - 283 / 2) 5 283 80
|
||||
launcher_logo.visible=true
|
||||
space1=20
|
||||
space2=5
|
||||
launcher_list=23 94 466 (h - 23 - self.y)
|
||||
launcher_list=launcherX 94 (w - buttonWidth - 17 * 2 - self.x) (h - 23 - self.y)
|
||||
launcher_start_button=(prev.x2 + 17) prev.y buttonWidth buttonHeight
|
||||
launcher_addGame_button=prev.x (prev.y2 + space1) prev.w prev.h
|
||||
launcher_editGame_button=prev.x (prev.y2 + space2) prev.w prev.h
|
||||
@ -461,3 +462,28 @@ scummmain_quit=prev.x smY prev.w prev.h
|
||||
smH=(smY + buttonHeight + scummmainHOffset)
|
||||
smW=(buttonWidth + 2 * scummmainHOffset)
|
||||
scummmain=((w - smW) / 2) ((h - smH) / 2) smW smH
|
||||
|
||||
## 960xY modes
|
||||
[960xY]
|
||||
def_launcherX=23
|
||||
def_widgetSize=kBigWidgetSize
|
||||
def_buttonWidth=120
|
||||
def_buttonHeight=25
|
||||
def_sliderWidth=kBigSliderWidth
|
||||
def_sliderHeight=kBigSliderHeight
|
||||
def_kLineHeight=16
|
||||
def_kFontHeight=14
|
||||
def_globOptionsW=(w - buttonWidth - 17 * 2 - launcherX)
|
||||
def_gameOptionsH=(h - 2 * 40)
|
||||
def_gameOptionsLabelWidth=90
|
||||
def_tabPopupsLabelW=110
|
||||
def_aboutXOff=8
|
||||
def_aboutYOff=5
|
||||
def_aboutOuterBorder=80
|
||||
def_scummmainHOffset=12
|
||||
def_scummmainVSpace=15
|
||||
def_scummmainVAddOff=5
|
||||
def_scummhelpW=370
|
||||
def_scummhelpX=((w - scummhelpW) / 2)
|
||||
def_midiControlsSpacing=4
|
||||
use=640xY
|
||||
|
@ -49,6 +49,13 @@ void Widget::init() {
|
||||
_hints = THEME_HINT_FIRST_DRAW | THEME_HINT_SAVE_BACKGROUND;
|
||||
}
|
||||
|
||||
void Widget::resize(int x, int y, int w, int h) {
|
||||
_x = x;
|
||||
_y = y;
|
||||
_w = w;
|
||||
_h = h;
|
||||
}
|
||||
|
||||
Widget::~Widget() {
|
||||
delete _next;
|
||||
}
|
||||
@ -114,6 +121,16 @@ Widget *Widget::findWidgetInChain(Widget *w, int x, int y) {
|
||||
return w;
|
||||
}
|
||||
|
||||
Widget *Widget::findWidgetInChain(Widget *w, const char *name) {
|
||||
while (w) {
|
||||
if (w->_name == name) {
|
||||
return w;
|
||||
}
|
||||
w = w->_next;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool Widget::isVisible() const {
|
||||
if (g_gui.evaluator()->getVar(_name + ".visible") == 0)
|
||||
return false;
|
||||
@ -173,6 +190,11 @@ void StaticTextWidget::drawWidget(bool hilite) {
|
||||
g_gui.theme()->convertAligment(_align));
|
||||
}
|
||||
|
||||
void StaticTextWidget::handleScreenChanged() {
|
||||
Widget::handleScreenChanged();
|
||||
_ws = g_gui.getWidgetSize();
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
ButtonWidget::ButtonWidget(GuiObject *boss, int x, int y, int w, int h, const String &label, uint32 cmd, uint8 hotkey, WidgetSize ws)
|
||||
|
@ -98,6 +98,7 @@ protected:
|
||||
|
||||
public:
|
||||
static Widget *findWidgetInChain(Widget *start, int x, int y);
|
||||
static Widget *findWidgetInChain(Widget *start, const char *name);
|
||||
|
||||
public:
|
||||
Widget(GuiObject *boss, int x, int y, int w, int h);
|
||||
@ -105,6 +106,10 @@ public:
|
||||
virtual ~Widget();
|
||||
|
||||
void init();
|
||||
void resize(int x, int y, int w, int h);
|
||||
|
||||
void setNext(Widget *w) { _next = w; }
|
||||
Widget *next() { return _next; }
|
||||
|
||||
virtual int16 getAbsX() const { return _x + _boss->getChildX(); }
|
||||
virtual int16 getAbsY() const { return _y + _boss->getChildY(); }
|
||||
@ -122,6 +127,8 @@ public:
|
||||
virtual bool handleKeyUp(uint16 ascii, int keycode, int modifiers) { return false; } // Return true if the event was handled
|
||||
virtual void handleTickle() {}
|
||||
|
||||
virtual void handleScreenChanged() { GuiObject::handleScreenChanged(); }
|
||||
|
||||
void draw();
|
||||
void receivedFocus() { _hasFocus = true; receivedFocusWidget(); }
|
||||
void lostFocus() { _hasFocus = false; lostFocusWidget(); }
|
||||
@ -171,6 +178,8 @@ public:
|
||||
void setAlign(TextAlignment align);
|
||||
TextAlignment getAlign() const { return _align; }
|
||||
|
||||
virtual void handleScreenChanged();
|
||||
|
||||
protected:
|
||||
void drawWidget(bool hilite);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user