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 (C) 2018-2021 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_contentPanel( nullptr )
33{
34 // Construction delayed until after panel is installed
35}
36
37
39{
40 m_contentPanel = aPanel;
41
42 // Now perform the body of the constructor
43 auto mainSizer = new wxBoxSizer( wxVERTICAL );
44 SetSizer( mainSizer );
45
46 m_infoBar = new WX_INFOBAR( this );
47 mainSizer->Add( m_infoBar, 0, wxEXPAND, 0 );
48
49 mainSizer->Add( m_contentPanel, 1, wxEXPAND|wxLEFT|wxTOP|wxRIGHT, 5 );
50 m_contentPanel->SetMinSize( FromDIP( wxSize( 1000, 600 ) ) );
51
52 auto sdbSizer = new wxStdDialogButtonSizer();
53 auto sdbSizerOK = new wxButton( this, wxID_OK );
54 sdbSizer->AddButton( sdbSizerOK );
55 auto sdbSizerCancel = new wxButton( this, wxID_CANCEL );
56 sdbSizer->AddButton( sdbSizerCancel );
57 sdbSizer->Realize();
58
59 mainSizer->Add( sdbSizer, 0, wxALL|wxEXPAND, 5 );
60
62
64
65 // On some windows manager (Unity, XFCE), this dialog is not always raised, depending
66 // on how the dialog is run.
67 Raise();
68}
69
70
72{
73 return m_contentPanel->TransferDataToWindow();
74}
75
76
78{
79 /* Transfer tables edited in dialog to the global and project tables:
80 * A good way is to use m_contentPanel->TransferDataFromWindow to do that.
81 * But be careful:
82 * Since wxWidgets 3.1, it is called by wxDialog::TransferDataFromWindow()
83 * Before wxWidgets 3.1, it is *not* called by wxDialog::TransferDataFromWindow()
84 * m_contentPanel->TransferDataFromWindow do not works with two calls.
85 * Therefore *do not* call wxDialog::TransferDataFromWindow(),
86 * because m_contentPanel->TransferDataFromWindow() is called here.
87 */
88 return m_contentPanel->TransferDataFromWindow();
89}
90
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