New function: addCheckbox()

svn-id: r18159
This commit is contained in:
Torbjörn Andersson 2005-05-18 09:21:03 +00:00
parent 9e0c72868b
commit f0e43fb2a6
2 changed files with 17 additions and 0 deletions

View file

@ -298,6 +298,22 @@ ButtonWidget *Dialog::addButton(int x, int y, const Common::String &label, uint3
return new ButtonWidget(this, x, y, w, h, label, cmd, hotkey, ws);
}
CheckboxWidget *Dialog::addCheckbox(int x, int y, const Common::String &label, uint32 cmd, char hotkey, WidgetSize ws) {
const Graphics::Font *font;
int w, h;
if (ws == kBigWidgetSize) {
font = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont);
h = kBigButtonHeight;
} else {
font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont);
h = kButtonHeight;
}
w = font->getFontHeight() + 10 + font->getStringWidth(label);
return new CheckboxWidget(this, x, y, w, h, label, cmd, hotkey, ws);
}
uint32 GuiObject::getMillis() {
return g_system->getMillis();

View file

@ -88,6 +88,7 @@ protected:
Widget *findWidget(int x, int y); // Find the widget at pos x,y if any
ButtonWidget *addButton(int x, int y, const Common::String &label, uint32 cmd, char hotkey, WidgetSize ws = kDefaultWidgetSize);
CheckboxWidget *addCheckbox(int x, int y, const Common::String &label, uint32 cmd, char hotkey, WidgetSize ws = kDefaultWidgetSize);
void setResult(int result) { _result = result; }
int getResult() const { return _result; }