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_KeyboardGridCellEditor 21 #define TrenchBroom_KeyboardGridCellEditor 22 23 #include <wx/grid.h> 24 25 namespace TrenchBroom { 26 namespace View { 27 class KeyboardShortcutEditor; 28 29 class KeyboardGridCellEditor : public wxGridCellEditor { 30 private: 31 KeyboardShortcutEditor* m_editor; 32 wxEvtHandler* m_evtHandler; 33 public: 34 KeyboardGridCellEditor(); 35 KeyboardGridCellEditor(wxWindow* parent, wxWindowID windowId, wxEvtHandler* evtHandler, int key, int modifier1, int modifier2, int modifier3); 36 37 void Create(wxWindow* parent, wxWindowID windowId, wxEvtHandler* evtHandler); 38 wxGridCellEditor* Clone() const; 39 40 void BeginEdit(int row, int col, wxGrid* grid); 41 bool EndEdit(int row, int col, const wxGrid* grid, const wxString& oldValue, wxString* newValue); 42 void ApplyEdit(int row, int col, wxGrid* grid); 43 void HandleReturn(wxKeyEvent& event); 44 45 void Reset(); 46 void Show(bool show, wxGridCellAttr* attr = NULL); 47 48 wxString GetValue() const; 49 }; 50 } 51 } 52 53 #endif /* defined(TrenchBroom_KeyboardGridCellEditor) */ 54