KiCad PCB EDA Suite
grid_text_button_helpers.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program 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 this program; if not, you may find one here:
18  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19  * or you may search the http://www.gnu.org website for the version 2 license,
20  * or you may write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22  */
23 
24 #ifndef GRID_TEXT_BUTTON_HELPERS_H
25 #define GRID_TEXT_BUTTON_HELPERS_H
26 
27 #include <wx/combo.h>
28 #include <wx/generic/gridctrl.h>
29 #include <wx/generic/grideditors.h>
30 
31 
32 class wxGrid;
33 class DIALOG_SHIM;
34 
35 
36 class GRID_CELL_TEXT_BUTTON : public wxGridCellEditor
37 {
38 public:
40 
41  wxString GetValue() const override;
42 
43  void SetSize( const wxRect& aRect ) override;
44 
45  void StartingKey( wxKeyEvent& event ) override;
46  void BeginEdit( int aRow, int aCol, wxGrid* aGrid ) override;
47  bool EndEdit( int , int , const wxGrid* , const wxString& , wxString *aNewVal ) override;
48  void ApplyEdit( int aRow, int aCol, wxGrid* aGrid ) override;
49  void Reset() override;
50 
51 protected:
52  wxComboCtrl* Combo() const { return static_cast<wxComboCtrl*>( m_control ); }
53 
54  wxString m_value;
55 
57 };
58 
59 
61 {
62 public:
64  m_dlg( aParent )
65  { }
66 
67  wxGridCellEditor* Clone() const override
68  {
69  return new GRID_CELL_SYMBOL_ID_EDITOR( m_dlg );
70  }
71 
72  void Create( wxWindow* aParent, wxWindowID aId, wxEvtHandler* aEventHandler ) override;
73 
74 protected:
76 };
77 
78 
80 {
81 public:
83  m_dlg( aParent )
84  { }
85 
86  wxGridCellEditor* Clone() const override
87  {
88  return new GRID_CELL_FOOTPRINT_ID_EDITOR( m_dlg );
89  }
90 
91  void Create( wxWindow* aParent, wxWindowID aId, wxEvtHandler* aEventHandler ) override;
92 
93 protected:
95 };
96 
97 
99 {
100 public:
102  m_dlg( aParent )
103  { }
104 
105  wxGridCellEditor* Clone() const override
106  {
107  return new GRID_CELL_URL_EDITOR( m_dlg );
108  }
109 
110  void Create( wxWindow* aParent, wxWindowID aId, wxEvtHandler* aEventHandler ) override;
111 
112 protected:
114 };
115 
116 
118 {
119 public:
120  GRID_CELL_PATH_EDITOR( DIALOG_SHIM* aParent, wxString* aCurrentDir ) :
121  m_dlg( aParent ),
122  m_currentDir( aCurrentDir )
123  { }
124 
125  wxGridCellEditor* Clone() const override
126  {
127  return new GRID_CELL_PATH_EDITOR( m_dlg, m_currentDir );
128  }
129 
130  void Create( wxWindow* aParent, wxWindowID aId, wxEvtHandler* aEventHandler ) override;
131 
132 protected:
134  wxString* m_currentDir;
135 };
136 
137 
138 #endif // GRID_TEXT_BUTTON_HELPERS_H
wxGridCellEditor * Clone() const override
void StartingKey(wxKeyEvent &event) override
GRID_CELL_SYMBOL_ID_EDITOR(DIALOG_SHIM *aParent)
wxDECLARE_NO_COPY_CLASS(GRID_CELL_TEXT_BUTTON)
Class DIALOG_SHIM may sit in the inheritance tree between wxDialog and any class written by wxFormBui...
Definition: dialog_shim.h:82
void SetSize(const wxRect &aRect) override
wxGridCellEditor * Clone() const override
void BeginEdit(int aRow, int aCol, wxGrid *aGrid) override
GRID_CELL_URL_EDITOR(DIALOG_SHIM *aParent)
wxComboCtrl * Combo() const
wxGridCellEditor * Clone() const override
wxString GetValue() const override
GRID_CELL_PATH_EDITOR(DIALOG_SHIM *aParent, wxString *aCurrentDir)
void ApplyEdit(int aRow, int aCol, wxGrid *aGrid) override
bool EndEdit(int, int, const wxGrid *, const wxString &, wxString *aNewVal) override
wxGridCellEditor * Clone() const override
GRID_CELL_FOOTPRINT_ID_EDITOR(DIALOG_SHIM *aParent)