KiCad PCB EDA Suite
wx_grid.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 3
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 KICAD_WX_GRID_H
25 #define KICAD_WX_GRID_H
26 
27 #include <wx/grid.h>
28 #include <grid_tricks.h>
29 
30 class WX_GRID : public wxGrid
31 {
32 public:
33  // Constructor has to be wxFormBuilder-compatible
34  WX_GRID( wxWindow *parent, wxWindowID id,
35  const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
36  long style = wxWANTS_CHARS, const wxString& name = wxGridNameStr );
37 
38  ~WX_GRID() override;
39 
44  wxString GetShownColumns();
45 
49  void ShowHideColumns( const wxString& shownColumns );
50 
55  void SetTable( wxGridTableBase* table, bool aTakeOwnership = false );
56 
61  void DestroyTable( wxGridTableBase* aTable );
62 
68  bool CommitPendingChanges( bool aQuietMode = false );
69 
70 protected:
71  void DrawColLabel( wxDC& dc, int col ) override;
72 
73  void onGridColMove( wxGridEvent& aEvent );
74 
76 };
77 
78 #endif //KICAD_WX_GRID_H
bool m_weOwnTable
Definition: wx_grid.h:75
void DrawColLabel(wxDC &dc, int col) override
Definition: wx_grid.cpp:128
WX_GRID(wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxWANTS_CHARS, const wxString &name=wxGridNameStr)
Definition: wx_grid.cpp:32
void ShowHideColumns(const wxString &shownColumns)
Show/hide the grid columns based on a tokenized string of shown column indexes.
Definition: wx_grid.cpp:108
void SetTable(wxGridTableBase *table, bool aTakeOwnership=false)
Hide wxGrid&#39;s SetTable() method with one which doesn&#39;t mess up the grid column widths when setting th...
Definition: wx_grid.cpp:46
void DestroyTable(wxGridTableBase *aTable)
Work-around for a bug in wxGrid which crashes when deleting the table if the cell edit control was no...
Definition: wx_grid.cpp:77
void onGridColMove(wxGridEvent &aEvent)
Definition: wx_grid.cpp:205
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:156
~WX_GRID() override
Definition: wx_grid.cpp:39
wxString GetShownColumns()
Get a tokenized string containing the shown column indexes.
Definition: wx_grid.cpp:90
const char * name
Definition: DXF_plotter.cpp:61