1 /* 2 Copyright (C) 2010-2014 Kristian Duske 3 4 This file is part of TrenchBroom. 5 6 TrenchBroom 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 3 of the License, or 9 (at your option) any later version. 10 11 TrenchBroom is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with TrenchBroom. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef TrenchBroom_KeyboardShortcutGridTable 21 #define TrenchBroom_KeyboardShortcutGridTable 22 23 #include "StringUtils.h" 24 25 #include <wx/grid.h> 26 27 #include <vector> 28 29 namespace TrenchBroom { 30 namespace View { 31 class KeyboardShortcutEntry; 32 class KeyboardGridCellEditor; 33 class Menu; 34 35 class KeyboardShortcutGridTable : public wxGridTableBase { 36 private: 37 typedef std::vector<KeyboardShortcutEntry*> EntryList; 38 39 EntryList m_entries; 40 KeyboardGridCellEditor* m_cellEditor; 41 public: 42 KeyboardShortcutGridTable(); 43 ~KeyboardShortcutGridTable(); 44 45 int GetNumberRows(); 46 int GetNumberCols(); 47 48 wxString GetValue(int row, int col); 49 void SetValue(int row, int col, const wxString& value); 50 51 void Clear(); 52 bool InsertRows(size_t pos = 0, size_t numRows = 1); 53 bool AppendRows(size_t numRows = 1); 54 bool DeleteRows(size_t pos = 0, size_t numRows = 1); 55 56 wxString GetColLabelValue(int col); 57 wxGridCellAttr* GetAttr(int row, int col, wxGridCellAttr::wxAttrKind kind); 58 59 bool hasDuplicates() const; 60 bool update(); 61 private: 62 void notifyRowsUpdated(size_t pos, size_t numRows = 1); 63 void notifyRowsInserted(size_t pos = 0, size_t numRows = 1); 64 void notifyRowsAppended(size_t numRows = 1); 65 void notifyRowsDeleted(size_t pos = 0, size_t numRows = 1); 66 67 bool markConflicts(EntryList& entries); 68 }; 69 } 70 } 71 72 #endif /* defined(TrenchBroom_KeyboardShortcutGridTable) */ 73