MP Create: hacky implementation of game filtering
This commit is contained in:
parent
b15c9be4d5
commit
b8f09213f7
2 changed files with 15 additions and 5 deletions
|
@ -139,7 +139,14 @@ void tmp_create_game::pre_show(twindow& window)
|
|||
// Set up filtering
|
||||
//
|
||||
connect_signal_notify_modified(find_widget<tslider>(&window, "num_players", false),
|
||||
std::bind(&tmp_create_game::num_players_filter_callback, this, std::ref(window)));
|
||||
std::bind(&tmp_create_game::filter_changed_callback<tslider>, this, std::ref(window), "num_players"));
|
||||
|
||||
ttext_box& filter = find_widget<ttext_box>(&window, "game_filter", false);
|
||||
|
||||
filter.set_text_changed_callback(
|
||||
std::bind(&tmp_create_game::filter_changed_callback<ttext_box>, this, std::ref(window), "game_filter"));
|
||||
|
||||
window.add_to_keyboard_chain(&filter);
|
||||
|
||||
//
|
||||
// Set up game types combobox
|
||||
|
@ -270,11 +277,13 @@ void tmp_create_game::on_tab_select(twindow& window)
|
|||
}
|
||||
}
|
||||
|
||||
void tmp_create_game::num_players_filter_callback(twindow& window)
|
||||
template<typename widget>
|
||||
void tmp_create_game::filter_changed_callback(twindow& window, const std::string& id)
|
||||
{
|
||||
create_engine_.apply_level_filter(find_widget<tslider>(&window, "num_players", false).get_value());
|
||||
create_engine_.apply_level_filter(find_widget<widget>(&window, id, false).get_value());
|
||||
|
||||
// TODO: actually display the filtered options
|
||||
// TODO: should this be done with tlistbox::set_row_shown?
|
||||
update_games_list(window);
|
||||
}
|
||||
|
||||
void tmp_create_game::update_games_list(twindow& window)
|
||||
|
|
|
@ -71,7 +71,8 @@ private:
|
|||
|
||||
tfield_integer* turns_, *gold_, *support_, *experience_, *init_turn_limit, *turn_bonus_, *reservior_, *action_bonus_;
|
||||
|
||||
void num_players_filter_callback(twindow& window);
|
||||
template<typename widget>
|
||||
void filter_changed_callback(twindow& window, const std::string& id);
|
||||
|
||||
void on_game_select(twindow& window);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue