diff options
author | Torbjörn Andersson | 2005-05-18 09:21:03 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2005-05-18 09:21:03 +0000 |
commit | f0e43fb2a6b3ffdf3d00b03d3f0118ccb5aa3b4d (patch) | |
tree | 9594311cade3c02550ac2396d47ec12cd3beffc5 | |
parent | 9e0c72868b819d5a77c9a494556f280149664a29 (diff) | |
download | scummvm-rg350-f0e43fb2a6b3ffdf3d00b03d3f0118ccb5aa3b4d.tar.gz scummvm-rg350-f0e43fb2a6b3ffdf3d00b03d3f0118ccb5aa3b4d.tar.bz2 scummvm-rg350-f0e43fb2a6b3ffdf3d00b03d3f0118ccb5aa3b4d.zip |
New function: addCheckbox()
svn-id: r18159
-rw-r--r-- | gui/dialog.cpp | 16 | ||||
-rw-r--r-- | gui/dialog.h | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/gui/dialog.cpp b/gui/dialog.cpp index e67c82e023..f0840a3a5b 100644 --- a/gui/dialog.cpp +++ b/gui/dialog.cpp @@ -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(); diff --git a/gui/dialog.h b/gui/dialog.h index 2e84191ee3..b437269a91 100644 --- a/gui/dialog.h +++ b/gui/dialog.h @@ -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; } |