diff options
| author | Torbjörn Andersson | 2005-05-18 15:58:39 +0000 | 
|---|---|---|
| committer | Torbjörn Andersson | 2005-05-18 15:58:39 +0000 | 
| commit | 35dda2b636825c4273a0d13cd1b65ae49fdb65ca (patch) | |
| tree | ce9aaeefe7b6b3c2cbc2ec1e7347df7f7be5e5cf | |
| parent | 51f8aa50b15ac99903f5e4ad3c5422d5473bef85 (diff) | |
| download | scummvm-rg350-35dda2b636825c4273a0d13cd1b65ae49fdb65ca.tar.gz scummvm-rg350-35dda2b636825c4273a0d13cd1b65ae49fdb65ca.tar.bz2 scummvm-rg350-35dda2b636825c4273a0d13cd1b65ae49fdb65ca.zip | |
Added big slider widget. There is nothing in the widget itself that's
dependent on size, so the two different sizes are handled through a new
addSlider() function.
Figuring out why the big widget won't let you set volume to 0 is left as an
exercise for the reader.
svn-id: r18170
| -rw-r--r-- | gui/dialog.cpp | 18 | ||||
| -rw-r--r-- | gui/dialog.h | 3 | ||||
| -rw-r--r-- | gui/options.cpp | 27 | ||||
| -rw-r--r-- | gui/widget.cpp | 3 | ||||
| -rw-r--r-- | gui/widget.h | 8 | 
5 files changed, 43 insertions, 16 deletions
| diff --git a/gui/dialog.cpp b/gui/dialog.cpp index 9ab22c26ef..78a3ca6d33 100644 --- a/gui/dialog.cpp +++ b/gui/dialog.cpp @@ -323,6 +323,24 @@ CheckboxWidget *Dialog::addCheckbox(GuiObject *boss, int x, int y, const Common:  	return new CheckboxWidget(boss, x, y, w, h, label, cmd, hotkey, ws);  } +SliderWidget *Dialog::addSlider(int x, int y, uint32 cmd, WidgetSize ws) { +	return addSlider(this, x, y, cmd, ws); +} + +SliderWidget *Dialog::addSlider(GuiObject *boss, int x, int y, uint32 cmd, WidgetSize ws) { +	int w, h; + +	if (ws == kBigWidgetSize) { +		w = kBigSliderWidth; +		h = kBigSliderHeight; +	} else { +		w = kSliderWidth; +		h = kSliderHeight; +	} + +	return new SliderWidget(boss, x, y, w, h, cmd); +} +  uint32 GuiObject::getMillis() {  	return g_system->getMillis();  } diff --git a/gui/dialog.h b/gui/dialog.h index 77e372144a..e4bd5238bd 100644 --- a/gui/dialog.h +++ b/gui/dialog.h @@ -93,6 +93,9 @@ protected:  	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); +	SliderWidget *addSlider(GuiObject *boss, int x, int y, uint32 cmd, WidgetSize ws = kDefaultWidgetSize); +	SliderWidget *addSlider(int x, int y, uint32 cmd, WidgetSize ws = kDefaultWidgetSize); +  	void setResult(int result) { _result = result; }  	int getResult() const { return _result; }  }; diff --git a/gui/options.cpp b/gui/options.cpp index 8eae066528..257ec54a67 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -407,25 +407,28 @@ int OptionsDialog::addMIDIControls(GuiObject *boss, int yoffset, WidgetSize ws)  int OptionsDialog::addVolumeControls(GuiObject *boss, int yoffset, WidgetSize ws) {  	// Volume controllers  	new StaticTextWidget(boss, 5, yoffset + 2, 100, kLineHeight, "Music volume: ", kTextAlignRight, ws); -	_musicVolumeSlider = new SliderWidget(boss, 105, yoffset, 85, 12, kMusicVolumeChanged); -	_musicVolumeLabel = new StaticTextWidget(boss, 200, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft, ws); -	_musicVolumeSlider->setMinValue(0); _musicVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume); +	_musicVolumeSlider = addSlider(boss, 105, yoffset, kMusicVolumeChanged, ws); +	_musicVolumeLabel = new StaticTextWidget(boss, 105 + _musicVolumeSlider->getWidth() + 10, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft, ws); +	_musicVolumeSlider->setMinValue(0); +	_musicVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume);  	_musicVolumeLabel->setFlags(WIDGET_CLEARBG); -	yoffset += 16; +	yoffset += _musicVolumeSlider->getHeight() + 4;  	new StaticTextWidget(boss, 5, yoffset + 2, 100, kLineHeight, "SFX volume: ", kTextAlignRight, ws); -	_sfxVolumeSlider = new SliderWidget(boss, 105, yoffset, 85, 12, kSfxVolumeChanged); -	_sfxVolumeLabel = new StaticTextWidget(boss, 200, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft, ws); -	_sfxVolumeSlider->setMinValue(0); _sfxVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume); +	_sfxVolumeSlider = addSlider(boss, 105, yoffset, kSfxVolumeChanged, ws); +	_sfxVolumeLabel = new StaticTextWidget(boss, 105 + _musicVolumeSlider->getWidth() + 10, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft, ws); +	_sfxVolumeSlider->setMinValue(0); +	_sfxVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume);  	_sfxVolumeLabel->setFlags(WIDGET_CLEARBG); -	yoffset += 16; +	yoffset += _sfxVolumeSlider->getHeight() + 4;  	new StaticTextWidget(boss, 5, yoffset + 2, 100, kLineHeight, "Speech volume: ", kTextAlignRight, ws); -	_speechVolumeSlider = new SliderWidget(boss, 105, yoffset, 85, 12, kSpeechVolumeChanged); -	_speechVolumeLabel = new StaticTextWidget(boss, 200, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft, ws); -	_speechVolumeSlider->setMinValue(0); _speechVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume); +	_speechVolumeSlider = addSlider(boss, 105, yoffset, kSpeechVolumeChanged, ws); +	_speechVolumeLabel = new StaticTextWidget(boss, 105 + _musicVolumeSlider->getWidth() + 10, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft, ws); +	_speechVolumeSlider->setMinValue(0); +	_speechVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume);  	_speechVolumeLabel->setFlags(WIDGET_CLEARBG); -	yoffset += 16; +	yoffset += _speechVolumeSlider->getHeight() + 4;  	_enableVolumeSettings = true; diff --git a/gui/widget.cpp b/gui/widget.cpp index 8426f1577f..f91c2154bb 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -238,8 +238,7 @@ void CheckboxWidget::drawWidget(bool hilite) {  SliderWidget::SliderWidget(GuiObject *boss, int x, int y, int w, int h, uint32 cmd)  	: Widget(boss, x, y, w, h), CommandSender(boss), -	  _cmd(cmd), _value(0), _oldValue(0), _valueMin(0), _valueMax(100), _isDragging(false) -	  { +	  _cmd(cmd), _value(0), _oldValue(0), _valueMin(0), _valueMax(100), _isDragging(false) {  	_flags = WIDGET_ENABLED | WIDGET_TRACK_MOUSE | WIDGET_CLEARBG;  	_type = kSliderWidget;  } diff --git a/gui/widget.h b/gui/widget.h index eaf7e33b9d..c1c9459a21 100644 --- a/gui/widget.h +++ b/gui/widget.h @@ -74,9 +74,13 @@ enum WidgetSize {  enum {  	kButtonWidth = 72,  	kButtonHeight = 16, -	 +	kSliderWidth = 85, +	kSliderHeight = 12, +  	kBigButtonWidth = 108, -	kBigButtonHeight = 24 +	kBigButtonHeight = 24, +	kBigSliderWidth = 128, +	kBigSliderHeight = 18  }; | 
