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
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
24
25
26class wxAuiNotebook;
27
28
30{
31public:
32 LIB_TABLE_NOTEBOOK_PANEL( wxWindow* parent, wxWindowID id = wxID_ANY ) :
33 PANEL_NOTEBOOK_BASE( parent, id )
34 { }
35
37
38 bool GetCanClose() override;
39
41 {
42 std::function<WX_GRID*( wxWindow* )> findGrid =
43 [&]( wxWindow* win ) -> WX_GRID*
44 {
45 if( WX_GRID* grid = dynamic_cast<WX_GRID*>( win ) )
46 return grid;
47
48 for( wxWindow* child : win->GetChildren() )
49 {
50 if( WX_GRID* grid = findGrid( child ) )
51 return grid;
52 }
53
54 return nullptr;
55 };
56
57 return findGrid( this );
58 }
59
61 {
62 return static_cast<LIB_TABLE_GRID_DATA_MODEL*>( GetGrid()->GetTable() );
63 }
64
65 bool TableModified();
66 bool SaveTable();
67
68 void MarkDirty();
69 void ClearDirty();
70
72 bool SaveOverrides();
73
74 static void AddTable( wxAuiNotebook* aNotebook, const wxString& aTitle, bool aClosable );
75
76private:
77 void onGridCellChanging( wxGridEvent& aEvent );
78
79 wxString m_baseTitle;
80};
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)
void onGridCellChanging(wxGridEvent &aEvent)
bool SaveOverrides()
Save enable/visible overrides for a read-only nested table to user settings.
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)