KiCad PCB EDA Suite
Loading...
Searching...
No Matches
grid_combobox.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 The 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, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef GRID_COMBOBOX_H
21#define GRID_COMBOBOX_H
22
23#include <kicommon.h>
24#include <wx/combobox.h>
25#include <wx/generic/gridctrl.h>
26#include <wx/generic/grideditors.h>
27
28
29class wxGrid;
30
31
32class KICOMMON_API GRID_CELL_COMBOBOX : public wxGridCellEditor
33{
34public:
35 GRID_CELL_COMBOBOX( const wxArrayString& names );
37
38 wxGridCellEditor* Clone() const override;
39 void Create( wxWindow* aParent, wxWindowID aId, wxEvtHandler* aEventHandler ) override;
40
41 wxString GetValue() const override;
42
43 void SetSize( const wxRect& aRect ) override;
44
45 void BeginEdit( int aRow, int aCol, wxGrid* aGrid ) override;
46 bool EndEdit( int aRow, int aCol, const wxGrid*, const wxString&, wxString* aNewVal ) override;
47 void ApplyEdit( int aRow, int aCol, wxGrid* aGrid ) override;
48 void Reset() override;
49
50protected:
51 wxComboBox* Combo() const { return static_cast<wxComboBox*>( m_control ); }
52
53 void onComboCloseUp( wxCommandEvent& aEvent );
54 void onComboDropDown( wxCommandEvent& aEvent );
55
56 wxArrayString m_names;
57 wxString m_value;
58
60};
61
62
63#endif // GRID_COMBOBOX_H
bool EndEdit(int aRow, int aCol, const wxGrid *, const wxString &, wxString *aNewVal) override
GRID_CELL_COMBOBOX(const wxArrayString &names)
~GRID_CELL_COMBOBOX() override
void Create(wxWindow *aParent, wxWindowID aId, wxEvtHandler *aEventHandler) override
wxString GetValue() const override
void BeginEdit(int aRow, int aCol, wxGrid *aGrid) override
wxArrayString m_names
wxDECLARE_NO_COPY_CLASS(GRID_CELL_COMBOBOX)
wxComboBox * Combo() const
void SetSize(const wxRect &aRect) override
void ApplyEdit(int aRow, int aCol, wxGrid *aGrid) override
wxGridCellEditor * Clone() const override
void Reset() override
#define KICOMMON_API
Definition kicommon.h:27