KiCad PCB EDA Suite
Loading...
Searching...
No Matches
lib_table_notebook_panel.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 modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
22
23
24class wxAuiNotebook;
25
26
28{
29public:
30 LIB_TABLE_NOTEBOOK_PANEL( wxWindow* parent, wxWindowID id = wxID_ANY ) :
31 PANEL_NOTEBOOK_BASE( parent, id )
32 { }
33
35
36 bool GetCanClose() override;
37
39 {
40 std::function<WX_GRID*( wxWindow* )> findGrid =
41 [&]( wxWindow* win ) -> WX_GRID*
42 {
43 if( WX_GRID* grid = dynamic_cast<WX_GRID*>( win ) )
44 return grid;
45
46 for( wxWindow* child : win->GetChildren() )
47 {
48 if( WX_GRID* grid = findGrid( child ) )
49 return grid;
50 }
51
52 return nullptr;
53 };
54
55 return findGrid( this );
56 }
57
59 {
60 return static_cast<LIB_TABLE_GRID_DATA_MODEL*>( GetGrid()->GetTable() );
61 }
62
63 bool TableModified();
64 bool SaveTable();
65
66 static void AddTable( wxAuiNotebook* aNotebook, const wxString& aTitle, bool aClosable );
67};
This abstract base class mixes any object derived from #LIB_TABLE into wxGridTableBase so the result ...
static void AddTable(wxAuiNotebook *aNotebook, const wxString &aTitle, bool aClosable)
LIB_TABLE_NOTEBOOK_PANEL(wxWindow *parent, wxWindowID id=wxID_ANY)
LIB_TABLE_GRID_DATA_MODEL * GetModel()
PANEL_NOTEBOOK_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1, -1), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)