1 //////////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright            : (C) 2015 Eran Ifrah
4 // File name            : clKeyboardManager.h
5 //
6 //    This program is free software; you can redistribute it and/or modify
7 //    it under the terms of the GNU General Public License as published by
8 //    the Free Software Foundation; either version 2 of the License, or
9 //    (at your option) any later version.
10 //
11 //////////////////////////////////////////////////////////////////////////////
12 // Modifed for Code::Blocks by pecan
13 
14 #ifndef CLKEYBOARDBINDINGCONFIG_H
15 #define CLKEYBOARDBINDINGCONFIG_H
16 
17 #include <wx/filename.h>
18 #include <wx/stdpaths.h>
19 
20 #include "configmanager.h"
21 #include "clKeyboardManager.h"
22 
23 class  clKeyboardBindingConfig
24 {
25     MenuItemDataMap_t m_bindings;
26 public:
27     clKeyboardBindingConfig();
28     virtual ~clKeyboardBindingConfig();
29 
30     clKeyboardBindingConfig& Load();
31     clKeyboardBindingConfig& Save();
32     bool SortBindings( std::vector<MenuItemDataMap_t::iterator>& sortedIters);
33 
Exists()34     bool Exists() const {
35         wxFileName fn(ConfigManager::GetConfigFolder(), _T("cbKeyBinder20.conf"));
36         wxString personality = Manager::Get()->GetPersonalityManager()->GetPersonality();
37         fn.SetName(personality + _T(".") + fn.GetName());
38 
39         #if defined(LOGGING)
40             wxString look = fn.GetFullPath(); ;
41         #endif
42         return fn.FileExists();
43     }
44 
SetBindings(const MenuItemDataMap_t & menus,const MenuItemDataMap_t & globals)45     clKeyboardBindingConfig& SetBindings(const MenuItemDataMap_t& menus, const MenuItemDataMap_t& globals)
46     {
47         this->m_bindings = menus;
48         this->m_bindings.insert(globals.begin(), globals.end());
49         return *this;
50     }
GetBindings()51     const MenuItemDataMap_t& GetBindings() const { return m_bindings; }
52 
53 };
54 
55 #endif // CLKEYBOARDBINDINGCONFIG_H
56