Support has_minimum/has_maximum in horizontal listboxes

This commit is contained in:
Celtic Minstrel 2016-08-28 12:19:52 -04:00
parent c355d52778
commit 943c1bdd57
3 changed files with 19 additions and 1 deletions

View file

@ -1475,6 +1475,16 @@
type="scrollbar_mode"
default=initial_auto
[/key]
[key]
name="has_minimum"
type="bool"
default=true
[/key]
[key]
name="has_maximum"
type="bool"
default=true
[/key]
[/tag]
[tag]
name="horizontal_scrollbar"

View file

@ -992,6 +992,10 @@ twidget* tbuilder_listbox::build() const
* must have the same number of columns as
* the 'list_definition'. $
*
* has_minimum & bool & true & If false, less than one row can be selected. $
*
* has_maximum & bool & true & If false, more than one row can be selected. $
*
* @end{table}
* @begin{tag}{name="header"}{min=0}{max=1}{super="gui/window/resolution/grid"}
* @end{tag}{name="header"}
@ -1023,6 +1027,8 @@ tbuilder_horizontal_listbox::tbuilder_horizontal_listbox(const config& cfg)
get_scrollbar_mode(cfg["horizontal_scrollbar_mode"]))
, list_builder(nullptr)
, list_data()
, has_minimum_(cfg["has_minimum"].to_bool(true))
, has_maximum_(cfg["has_maximum"].to_bool(true))
{
const config& l = cfg.child("list_definition");
@ -1069,7 +1075,7 @@ twidget* tbuilder_horizontal_listbox::build() const
return widget;
#else
tlistbox* widget
= new tlistbox(true, true, tgenerator_::horizontal_list, true);
= new tlistbox(has_minimum_, has_maximum_, tgenerator_::horizontal_list, true);
init_control(widget);

View file

@ -428,6 +428,8 @@ struct tbuilder_horizontal_listbox : public tbuilder_control
* serialize the data in the config, so the config is no longer required.
*/
std::vector<string_map> list_data;
bool has_minimum_, has_maximum_;
};
} // namespace implementation