1 /* Copyright (C) 2009 Wildfire Games. 2 * This file is part of 0 A.D. 3 * 4 * 0 A.D. is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * 0 A.D. is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 #ifndef INCLUDED_FIELDEDITCTRL 19 #define INCLUDED_FIELDEDITCTRL 20 21 class EditableListCtrl; 22 class AtlasDialog; 23 24 class FieldEditCtrl 25 { 26 friend class EditableListCtrl; 27 28 public: ~FieldEditCtrl()29 virtual ~FieldEditCtrl() {}; 30 31 protected: 32 virtual void StartEdit(wxWindow* parent, wxRect rect, long row, int col)=0; 33 }; 34 35 ////////////////////////////////////////////////////////////////////////// 36 37 class FieldEditCtrl_Text : public FieldEditCtrl 38 { 39 protected: 40 void StartEdit(wxWindow* parent, wxRect rect, long row, int col); 41 }; 42 43 ////////////////////////////////////////////////////////////////////////// 44 45 class FieldEditCtrl_Color : public FieldEditCtrl 46 { 47 protected: 48 void StartEdit(wxWindow* parent, wxRect rect, long row, int col); 49 }; 50 51 ////////////////////////////////////////////////////////////////////////// 52 53 class FieldEditCtrl_List : public FieldEditCtrl 54 { 55 public: 56 // listType must remain valid at least until StartEdit has been called 57 FieldEditCtrl_List(const char* listType); 58 59 protected: 60 void StartEdit(wxWindow* parent, wxRect rect, long row, int col); 61 62 private: 63 const char* m_ListType; 64 }; 65 66 ////////////////////////////////////////////////////////////////////////// 67 68 class FieldEditCtrl_Dialog : public FieldEditCtrl 69 { 70 public: 71 FieldEditCtrl_Dialog(AtlasDialog* (*dialogCtor)(wxWindow*)); 72 73 protected: 74 void StartEdit(wxWindow* parent, wxRect rect, long row, int col); 75 76 private: 77 AtlasDialog* (*m_DialogCtor)(wxWindow*); 78 }; 79 80 ////////////////////////////////////////////////////////////////////////// 81 82 83 class FieldEditCtrl_File : public FieldEditCtrl 84 { 85 public: 86 // rootDir is relative to mods/*/, and must end with a / 87 FieldEditCtrl_File(const wxString& rootDir, const wxString& fileMask); 88 89 protected: 90 void StartEdit(wxWindow* parent, wxRect rect, long row, int col); 91 92 private: 93 wxString m_RootDir; // relative to mods/*/ 94 wxString m_FileMask; 95 wxString m_RememberedDir; 96 }; 97 98 #endif // INCLUDED_FIELDEDITCTRL 99