KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_edit_library_tables.cpp
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
20#include <wx/button.h>
21#include <wx/sizer.h>
22
24
25
27 const wxString& aTitle ) :
28 DIALOG_SHIM( aParent, wxID_ANY, aTitle, wxDefaultPosition, wxDefaultSize,
29 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ),
30 m_GlobalTableChanged( false ),
31 m_ProjectTableChanged( false ),
32 m_infoBar( nullptr ),
33 m_contentPanel( nullptr )
34{
35 // Construction delayed until after panel is installed
36}
37
38
40{
41 m_contentPanel = aPanel;
42
43 // Now perform the body of the constructor
44 auto mainSizer = new wxBoxSizer( wxVERTICAL );
45 SetSizer( mainSizer );
46
47 m_infoBar = new WX_INFOBAR( this );
48 mainSizer->Add( m_infoBar, 0, wxEXPAND, 0 );
49
50 mainSizer->Add( m_contentPanel, 1, wxEXPAND|wxLEFT|wxTOP|wxRIGHT, 5 );
51 m_contentPanel->SetMinSize( FromDIP( wxSize( 1000, 600 ) ) );
52
53 auto sdbSizer = new wxStdDialogButtonSizer();
54 auto sdbSizerOK = new wxButton( this, wxID_OK );
55 sdbSizer->AddButton( sdbSizerOK );
56 auto sdbSizerCancel = new wxButton( this, wxID_CANCEL );
57 sdbSizer->AddButton( sdbSizerCancel );
58 sdbSizer->Realize();
59
60 mainSizer->Add( sdbSizer, 0, wxALL|wxEXPAND, 5 );
61
63
65
66 // On some windows manager (Unity, XFCE), this dialog is not always raised, depending
67 // on how the dialog is run.
68 Raise();
69}
70
71
73{
74 return m_contentPanel->TransferDataToWindow();
75}
76
77
79{
80 /* Transfer tables edited in dialog to the global and project tables:
81 * A good way is to use m_contentPanel->TransferDataFromWindow to do that.
82 * But be careful:
83 * Since wxWidgets 3.1, it is called by wxDialog::TransferDataFromWindow()
84 * Before wxWidgets 3.1, it is *not* called by wxDialog::TransferDataFromWindow()
85 * m_contentPanel->TransferDataFromWindow do not works with two calls.
86 * Therefore *do not* call wxDialog::TransferDataFromWindow(),
87 * because m_contentPanel->TransferDataFromWindow() is called here.
88 */
89 return m_contentPanel->TransferDataFromWindow();
90}
91
DIALOG_EDIT_LIBRARY_TABLES(wxWindow *aParent, const wxString &aTitle)
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
Definition: dialog_shim.h:88
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
A modified version of the wxInfoBar class that allows us to:
Definition: wx_infobar.h:76