wxDataViewItem HotkeyDataViewModel::New(wxDataViewItem item) { if (!item.IsOk()) return wxDataViewItem(); if (!IsContainer(item)) item = GetParent(item); HotkeyModelCategory *ctx = static_cast<HotkeyModelCategory*>(item.GetID()); wxVariant name; ctx->GetValue(name, 0); return ctx->AddChild(Combo(from_wx(name.GetString()), "", std::vector<std::string>())); }
HotkeyModelRoot(wxDataViewModel *model) { Hotkey::HotkeyMap const& hk_map = hotkey::inst->GetHotkeyMap(); std::map<std::string, HotkeyModelCategory*> cat_map; for (auto const& category : hk_map) { std::string cat_name = category.second.Context(); HotkeyModelCategory *cat; auto cat_it = cat_map.find(cat_name); if (cat_it != cat_map.end()) cat = cat_it->second; else { categories.emplace_back(model, to_wx(cat_name)); cat = cat_map[cat_name] = &categories.back(); } cat->AddChild(category.second); } }
HotkeyModelRoot(wxDataViewModel *model) { Hotkey::HotkeyMap const& hk_map = hotkey::inst->GetHotkeyMap(); std::map<std::string, HotkeyModelCategory*> cat_map; for (Hotkey::HotkeyMap::const_iterator it = hk_map.begin(); it != hk_map.end(); ++it) { std::string cat_name = it->second.Context(); HotkeyModelCategory *cat; std::map<std::string, HotkeyModelCategory*>::iterator cat_it = cat_map.find(cat_name); if (cat_it != cat_map.end()) cat = cat_it->second; else { categories.push_back(HotkeyModelCategory(model, cat_name)); cat = cat_map[cat_name] = &categories.back(); } cat->AddChild(it->second); } }