summaryrefslogtreecommitdiff
path: root/src/gui/setup.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-04-02 19:07:14 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-04-02 19:07:14 +0000
commit43d51d4a7c00bb425d004acf7eeb5e4aa4e969b0 (patch)
tree1a497ed7219d0450a0b33baf6a20d4b48f6b5404 /src/gui/setup.cpp
parente89ecd460dd2aa14aa7fd01292628fb74cb34692 (diff)
downloadmana-client-43d51d4a7c00bb425d004acf7eeb5e4aa4e969b0.tar.gz
mana-client-43d51d4a7c00bb425d004acf7eeb5e4aa4e969b0.tar.bz2
mana-client-43d51d4a7c00bb425d004acf7eeb5e4aa4e969b0.tar.xz
mana-client-43d51d4a7c00bb425d004acf7eeb5e4aa4e969b0.zip
Added ConfigListener class to allow listening for changes to config options,
and added a GUI opacity slider to the setup window that utilizes this.
Diffstat (limited to 'src/gui/setup.cpp')
-rw-r--r--src/gui/setup.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index 4502dbac..85aa900d 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -107,7 +107,8 @@ Setup::Setup():
disabledRadio = new RadioButton("Disabled", "Modes", false);
applyButton = new Button("Apply");
cancelButton = new Button("Cancel");
- //alphaSlider = new Slider(1.0);
+ alphaLabel = new gcn::Label("GUI opacity:");
+ alphaSlider = new Slider(0.2, 1.0);
// Set selections
last_sel = 0;
@@ -116,6 +117,7 @@ Setup::Setup():
// Set events
applyButton->setEventId("apply");
cancelButton->setEventId("cancel");
+ alphaSlider->setEventId("guialpha");
// Set dimensions/positions
setContentSize(240, 216);
@@ -132,10 +134,14 @@ Setup::Setup():
fsCheckBox->setPosition(120, 36);
soundCheckBox->setPosition(10, 130);
disabledRadio->setPosition(10, 140);
+ alphaLabel->setPosition(10, 157);
+ alphaSlider->setDimension(gcn::Rectangle(
+ alphaLabel->getWidth() + 20, 160, 100, 10));
// Listen for actions
applyButton->addActionListener(this);
cancelButton->addActionListener(this);
+ alphaSlider->addActionListener(this);
// Assemble dialog
add(scrollArea);
@@ -146,7 +152,8 @@ Setup::Setup():
//add(disabledRadio);
add(applyButton);
add(cancelButton);
- //add(alphaSlider);
+ add(alphaLabel);
+ add(alphaSlider);
setLocationRelativeTo(getParent());
@@ -156,6 +163,7 @@ Setup::Setup():
fsCheckBox->setMarked(true);
}
soundCheckBox->setMarked(config.getValue("sound", 0));
+ alphaSlider->setValue(config.getValue("guialpha", 0.8));
}
Setup::~Setup()
@@ -169,11 +177,17 @@ Setup::~Setup()
delete displayLabel;
delete applyButton;
delete cancelButton;
+ delete alphaLabel;
+ delete alphaSlider;
}
void Setup::action(const std::string &eventId)
{
- if (eventId == "apply")
+ if (eventId == "guialpha")
+ {
+ config.setValue("guialpha", alphaSlider->getValue());
+ }
+ else if (eventId == "apply")
{
setVisible(false);