Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // DECLARATION IN LISTBOX HEADER
- template<typename Func>
- void register_sorting_option(const int col, const Func& f)
- {
- set_column_order(col, {
- [f](int lhs, int rhs) { return f(lhs) < f(lhs); },
- [f](int lhs, int rhs) { return f(lhs) > f(lhs); }
- });
- };
- // USAGE
- hotkey_list.register_sorting_option(0, [this](const int i) { return visible_hotkeys_[i]->description.str(); });
- hotkey_list.register_sorting_option(1, [this](const int i) { return hotkey::get_names(visible_hotkeys_[i]->command); });
- hotkey_list.register_sorting_option(2, [this](const int i) { return !visible_hotkeys_[i]->scope[hotkey::SCOPE_GAME]; });
- hotkey_list.register_sorting_option(3, [this](const int i) { return !visible_hotkeys_[i]->scope[hotkey::SCOPE_EDITOR]; });
- hotkey_list.register_sorting_option(4, [this](const int i) { return !visible_hotkeys_[i]->scope[hotkey::SCOPE_MAIN_MENU]; });
Advertisement
Add Comment
Please, Sign In to add comment