GUI2/Listbox: enabled view-only mode
Currently for the vertical listbox only, since it does have some quirks. Removes the assert in the "show" policy checking if the callback is null. It won't be for the listbox, but doesn't really matter since it's not used.
This commit is contained in:
parent
fb78528f2c
commit
7e2a99dc20
4 changed files with 5 additions and 5 deletions
|
@ -262,6 +262,7 @@
|
|||
{DEFAULT_KEY "vertical_scrollbar_mode" scrollbar_mode initial_auto}
|
||||
{DEFAULT_KEY "has_minimum" bool true}
|
||||
{DEFAULT_KEY "has_maximum" bool true}
|
||||
{DEFAULT_KEY "allow_selection" bool true}
|
||||
[/tag]
|
||||
[tag]
|
||||
name="matrix"
|
||||
|
|
|
@ -1070,10 +1070,8 @@ void selection::init(grid* g,
|
|||
|
||||
void show::init(grid* grid,
|
||||
const widget_data& data,
|
||||
const std::function<void(widget&)>& callback)
|
||||
const std::function<void(widget&)>& /*callback*/)
|
||||
{
|
||||
assert(!callback);
|
||||
|
||||
for(const auto& item : data) {
|
||||
if(item.first.empty()) {
|
||||
for(unsigned row = 0; row < grid->get_rows(); ++row) {
|
||||
|
|
|
@ -755,6 +755,7 @@ builder_listbox::builder_listbox(const config& cfg)
|
|||
, list_data()
|
||||
, has_minimum_(cfg["has_minimum"].to_bool(true))
|
||||
, has_maximum_(cfg["has_maximum"].to_bool(true))
|
||||
, allow_selection_(cfg["allow_selection"].to_bool(true))
|
||||
{
|
||||
if(auto h = cfg.optional_child("header")) {
|
||||
header = std::make_shared<builder_grid>(*h);
|
||||
|
@ -792,7 +793,7 @@ std::unique_ptr<widget> builder_listbox::build() const
|
|||
|
||||
widget->init_grid(*conf->grid);
|
||||
|
||||
auto generator = generator_base::build(has_minimum_, has_maximum_, generator_base::vertical_list, true);
|
||||
auto generator = generator_base::build(has_minimum_, has_maximum_, generator_base::vertical_list, allow_selection_);
|
||||
widget->finalize(std::move(generator), header, footer, list_data);
|
||||
|
||||
return widget;
|
||||
|
|
|
@ -456,7 +456,7 @@ struct builder_listbox : public builder_styled_widget
|
|||
*/
|
||||
std::vector<widget_data> list_data;
|
||||
|
||||
bool has_minimum_, has_maximum_;
|
||||
bool has_minimum_, has_maximum_, allow_selection_;
|
||||
};
|
||||
|
||||
struct builder_horizontal_listbox : public builder_styled_widget
|
||||
|
|
Loading…
Add table
Reference in a new issue