summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorMateusz Kaduk <mateusz.kaduk@gmail.com>2005-01-03 22:06:31 +0000
committerMateusz Kaduk <mateusz.kaduk@gmail.com>2005-01-03 22:06:31 +0000
commitded2bc689849760f1a7cec9f918520dd4598fba4 (patch)
tree62a1eca5d5c8931924ed9ccd6b0297f88a1442b1 /src/gui
parent6353f2a46d79d8b411f77c503b558ffdbc6e66e8 (diff)
downloadmana-ded2bc689849760f1a7cec9f918520dd4598fba4.tar.gz
mana-ded2bc689849760f1a7cec9f918520dd4598fba4.tar.bz2
mana-ded2bc689849760f1a7cec9f918520dd4598fba4.tar.xz
mana-ded2bc689849760f1a7cec9f918520dd4598fba4.zip
Using own ListBox,
Removed temporarly unused radio button.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/setup.cpp31
-rw-r--r--src/gui/setup.h3
2 files changed, 19 insertions, 15 deletions
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index 6d6cf848..52961038 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -32,6 +32,16 @@
extern Sound sound;
#endif /* no WIN32 */
+struct Modes {
+ int height, width;
+ char *desc;
+};
+static Modes modes[] = {
+ { 640,480, "640x480"},
+ { 800,600, "800x600" },
+ { 1024,768, "1024x768" }
+};
+
/*
* Metod returns the number of elements in container
*/
@@ -44,16 +54,7 @@ int ModesListModel::getNumberOfElements() {
* Metod returns element from container
*/
std::string ModesListModel::getElementAt(int i) {
- //TODO: change hardcoded modes after moving to SDL
- struct Modes {
- int height, width;
- char *desc;
- };
- static Modes modes[] = {
- { 640,480, "640x480"},
- { 800,600, "800x600" },
- { 1024,768, "1024x768" }
- };
+ //TODO: after moving to SDL
return(modes[i].desc);
}
@@ -65,7 +66,7 @@ Setup::Setup(gcn::Container *parent)
{
modesListModel = new ModesListModel();
displayLabel = new gcn::Label("Display settings");
- modesList = new gcn::ListBox(modesListModel);
+ modesList = new ListBox(modesListModel);
scrollArea = new ScrollArea(modesList);
fsCheckBox = new CheckBox("Full screen", false);
soundLabel = new gcn::Label("Sound settings");
@@ -105,7 +106,7 @@ Setup::Setup(gcn::Container *parent)
add(fsCheckBox);
add(soundLabel);
add(soundCheckBox);
- add(disabledRadio);
+ //add(disabledRadio);
add(applyButton);
add(cancelButton);
@@ -139,18 +140,20 @@ Setup::~Setup() {
*/
void Setup::action(const std::string& eventId)
{
+ int sel;
if (eventId == "apply") {
setVisible(false);
/* Display settings */
if (fsCheckBox->isMarked() == true && config.getValue("screen",0) == 2) {
config.setValue("screen",1);
- set_gfx_mode(GFX_AUTODETECT_FULLSCREEN,800,600,0,0);
+ set_gfx_mode(GFX_AUTODETECT_FULLSCREEN,modes[sel].height,modes[sel].width,0,0);
} else
if (fsCheckBox->isMarked() == false && config.getValue("screen",0) == 1) {
config.setValue("screen",2);
- set_gfx_mode(GFX_AUTODETECT_WINDOWED,800,600,0,0);
+ sel = modesList->getSelected();
+ set_gfx_mode(GFX_AUTODETECT_WINDOWED,modes[sel].height,modes[sel].width,0,0);
}
/* Sound settings */
diff --git a/src/gui/setup.h b/src/gui/setup.h
index f1e10036..d95e1e42 100644
--- a/src/gui/setup.h
+++ b/src/gui/setup.h
@@ -28,6 +28,7 @@
#include "button.h"
#include "checkbox.h"
#include "scrollarea.h"
+#include "listbox.h"
#include "radiobutton.h"
#include "../graphic/graphic.h"
#include <allegro.h>
@@ -59,7 +60,7 @@ class Setup : public Window, public gcn::ActionListener {
CheckBox *soundCheckBox;
RadioButton *disabledRadio;
ScrollArea *scrollArea;
- gcn::ListBox *modesList;
+ ListBox *modesList;
Button *applyButton;
Button *cancelButton;