Vultraz

Untitled

Aug 8th, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. // DECLARATION IN LISTBOX HEADER
  2. template<typename Func>
  3. void register_sorting_option(const int col, const Func& f)
  4. {
  5. set_column_order(col, {
  6. [f](int lhs, int rhs) { return f(lhs) < f(lhs); },
  7. [f](int lhs, int rhs) { return f(lhs) > f(lhs); }
  8. });
  9. };
  10.  
  11.  
  12. // USAGE
  13.  
  14. hotkey_list.register_sorting_option(0, [this](const int i) { return visible_hotkeys_[i]->description.str(); });
  15. hotkey_list.register_sorting_option(1, [this](const int i) { return hotkey::get_names(visible_hotkeys_[i]->command); });
  16. hotkey_list.register_sorting_option(2, [this](const int i) { return !visible_hotkeys_[i]->scope[hotkey::SCOPE_GAME]; });
  17. hotkey_list.register_sorting_option(3, [this](const int i) { return !visible_hotkeys_[i]->scope[hotkey::SCOPE_EDITOR]; });
  18. 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