Made use of addCheckbox(). I had to add an alternative form of the function

because most checkboxes are on tabs. (We'll probably need a similar form of
addButton() as well.)

svn-id: r18161
This commit is contained in:
Torbjörn Andersson 2005-05-18 10:12:20 +00:00
parent 6ef7dbf97c
commit ef8e42473a
4 changed files with 26 additions and 22 deletions

View file

@ -299,6 +299,10 @@ ButtonWidget *Dialog::addButton(int x, int y, const Common::String &label, uint3
}
CheckboxWidget *Dialog::addCheckbox(int x, int y, const Common::String &label, uint32 cmd, char hotkey, WidgetSize ws) {
return addCheckbox(this, x, y, label, cmd, hotkey, ws);
}
CheckboxWidget *Dialog::addCheckbox(GuiObject *boss, int x, int y, const Common::String &label, uint32 cmd, char hotkey, WidgetSize ws) {
const Graphics::Font *font;
int w, h;
@ -312,7 +316,7 @@ CheckboxWidget *Dialog::addCheckbox(int x, int y, const Common::String &label, u
w = font->getFontHeight() + 10 + font->getStringWidth(label);
return new CheckboxWidget(this, x, y, w, h, label, cmd, hotkey, ws);
return new CheckboxWidget(boss, x, y, w, h, label, cmd, hotkey, ws);
}
uint32 GuiObject::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(GuiObject *boss, 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; }

View file

@ -239,8 +239,8 @@ EditGameDialog::EditGameDialog(const String &domain, GameSettings target)
tab->addTab("Gfx");
yoffset = vBorder;
_globalGraphicsOverride = new CheckboxWidget(tab, x, yoffset, w, 16, "Override global graphic settings", kCmdGlobalGraphicsOverride);
yoffset += 16;
_globalGraphicsOverride = addCheckbox(tab, x, yoffset, "Override global graphic settings", kCmdGlobalGraphicsOverride, 0);
yoffset += _globalGraphicsOverride->getHeight();
yoffset = addGraphicControls(tab, yoffset);
@ -250,8 +250,8 @@ EditGameDialog::EditGameDialog(const String &domain, GameSettings target)
tab->addTab("Audio");
yoffset = vBorder;
_globalAudioOverride = new CheckboxWidget(tab, x, yoffset, w, 16, "Override global audio settings", kCmdGlobalAudioOverride);
yoffset += 16;
_globalAudioOverride = addCheckbox(tab, x, yoffset, "Override global audio settings", kCmdGlobalAudioOverride, 0);
yoffset += _globalAudioOverride->getHeight();
yoffset = addAudioControls(tab, yoffset);
@ -261,8 +261,8 @@ EditGameDialog::EditGameDialog(const String &domain, GameSettings target)
tab->addTab("MIDI");
yoffset = vBorder;
_globalMIDIOverride = new CheckboxWidget(tab, x, yoffset, w, 16, "Override global MIDI settings", kCmdGlobalMIDIOverride);
yoffset += 16;
_globalMIDIOverride = addCheckbox(tab, x, yoffset, "Override global MIDI settings", kCmdGlobalMIDIOverride, 0);
yoffset += _globalMIDIOverride->getHeight();
yoffset = addMIDIControls(tab, yoffset);
@ -272,8 +272,8 @@ EditGameDialog::EditGameDialog(const String &domain, GameSettings target)
tab->addTab("Volume");
yoffset = vBorder;
_globalVolumeOverride = new CheckboxWidget(tab, x, yoffset, w, 16, "Override global volume settings", kCmdGlobalVolumeOverride);
yoffset += 16;
_globalVolumeOverride = addCheckbox(tab, x, yoffset, "Override global volume settings", kCmdGlobalVolumeOverride, 0);
yoffset += _globalVolumeOverride->getHeight();
yoffset = addVolumeControls(tab, yoffset);

View file

@ -336,12 +336,12 @@ int OptionsDialog::addGraphicControls(GuiObject *boss, int yoffset) {
}
// Fullscreen checkbox
_fullscreenCheckbox = new CheckboxWidget(boss, x, yoffset, w, 16, "Fullscreen mode");
yoffset += 16;
_fullscreenCheckbox = addCheckbox(boss, x, yoffset, "Fullscreen mode", 0, 0);
yoffset += _fullscreenCheckbox->getHeight();
// Aspect ratio checkbox
_aspectCheckbox = new CheckboxWidget(boss, x, yoffset, w, 16, "Aspect ratio correction");
yoffset += 16;
_aspectCheckbox = addCheckbox(boss, x, yoffset, "Aspect ratio correction", 0, 0);
yoffset += _aspectCheckbox->getHeight();
#ifdef _WIN32_WCE
_fullscreenCheckbox->setState(TRUE);
@ -370,8 +370,8 @@ int OptionsDialog::addAudioControls(GuiObject *boss, int yoffset) {
}
// Subtitles on/off
_subCheckbox = new CheckboxWidget(boss, x, yoffset, w, 16, "Display subtitles");
yoffset += 16;
_subCheckbox = addCheckbox(boss, x, yoffset, "Display subtitles", 0, 0);
yoffset += _subCheckbox->getHeight();
yoffset += 18;
@ -382,7 +382,6 @@ int OptionsDialog::addAudioControls(GuiObject *boss, int yoffset) {
int OptionsDialog::addMIDIControls(GuiObject *boss, int yoffset) {
const int x = 10;
const int w = _w - 20;
// SoundFont
_soundFontButton = new ButtonWidget(boss, x, yoffset, kButtonWidth + 14, 16, "SoundFont: ", kChooseSoundFontCmd, 0);
@ -390,16 +389,16 @@ int OptionsDialog::addMIDIControls(GuiObject *boss, int yoffset) {
yoffset += 18;
// Multi midi setting
_multiMidiCheckbox = new CheckboxWidget(boss, x, yoffset, w, 16, "Mixed Adlib/MIDI mode");
yoffset += 16;
_multiMidiCheckbox = addCheckbox(boss, x, yoffset, "Mixed Adlib/MIDI mode", 0, 0);
yoffset += _multiMidiCheckbox->getHeight();
// Native mt32 setting
_mt32Checkbox = new CheckboxWidget(boss, x, yoffset, w, 16, "True Roland MT-32 (disable GM emulation)");
yoffset += 16;
_mt32Checkbox = addCheckbox(boss, x, yoffset, "True Roland MT-32 (disable GM emulation)", 0, 0);
yoffset += _mt32Checkbox->getHeight();
// GS Extensions setting
_enableGSCheckbox = new CheckboxWidget(boss, x, yoffset, w, 16, "Enable Roland GS Mode");
yoffset += 16;
_enableGSCheckbox = addCheckbox(boss, x, yoffset, "Enable Roland GS Mode", 0, 0);
yoffset += _enableGSCheckbox->getHeight();
_enableMIDISettings = true;