editor2: use sliders in new map dialog

This commit is contained in:
Tomasz Śniatowski 2008-08-08 12:29:24 +01:00
parent eecdc8fafb
commit 25c22b9c91
3 changed files with 23 additions and 18 deletions

View file

@ -50,11 +50,13 @@
border = "all"
border_size = 5
horizontal_alignment = "left"
[text_box]
id = "width"
definition = "default"
label = _ "Width"
[/text_box]
[slider]
id = "width"
definition = "default"
minimum_value = 1
maximum_value = 200
step_size = 1
[/slider]
[/column]
[/row]
[/grid]
@ -83,11 +85,13 @@
border = "all"
border_size = 5
horizontal_alignment = "left"
[text_box]
id = "height"
definition = "default"
label = _ "Height"
[/text_box]
[slider]
id = "height"
definition = "default"
minimum_value = 1
maximum_value = 200
step_size = 1
[/slider]
[/column]
[/row]
[/grid]

View file

@ -20,6 +20,7 @@
#include "gui/widgets/listbox.hpp"
#include "gui/widgets/settings.hpp"
#include "gui/widgets/text_box.hpp"
#include "gui/widgets/slider.hpp"
#include "gui/widgets/window.hpp"
#include "gui/widgets/window_builder.hpp"
#include "language.hpp"
@ -36,29 +37,29 @@
namespace gui2 {
teditor_new_map::teditor_new_map() :
map_width_(register_text("width", false)),
map_height_(register_text("height", false))
map_width_(register_integer("width", false)),
map_height_(register_integer("height", false))
{
}
void teditor_new_map::set_map_width(int value)
{
map_width_->set_value(lexical_cast<std::string>(value));
map_width_->set_value(value);
}
int teditor_new_map::map_width() const
{
return lexical_cast_default<int>(map_width_->get_value());
return map_width_->get_value();
}
void teditor_new_map::set_map_height(int value)
{
map_height_->set_value(lexical_cast<std::string>(value));
map_height_->set_value(value);
}
int teditor_new_map::map_height() const
{
return lexical_cast_default<int>(map_height_->get_value());
return map_height_->get_value();
}
twindow teditor_new_map::build_window(CVideo& video)

View file

@ -34,8 +34,8 @@ private:
* NOTE the map sizes are stored in a text variable since there is no
* integer edit widget yet.
*/
tfield_text* map_width_;
tfield_text* map_height_;
tfield_integer* map_width_;
tfield_integer* map_height_;
/** Inherited from tdialog. */
twindow build_window(CVideo& video);