KiCad PCB EDA Suite
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 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/statline.h>
21 
23 
24 
26  const wxString& aTitle ) :
27  DIALOG_SHIM( aParent, wxID_ANY, aTitle, wxDefaultPosition, wxDefaultSize,
28  wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ),
29  m_GlobalTableChanged( false ),
30  m_ProjectTableChanged( false )
31 {
32  // Construction delayed until after panel is installed
33 }
34 
35 
37 {
38  m_contentPanel = aPanel;
39 
40  // Now perform the body of the constructor
41  auto mainSizer = new wxBoxSizer( wxVERTICAL );
42  SetSizer( mainSizer );
43 
44  mainSizer->Add( m_contentPanel, 1, wxEXPAND|wxLEFT|wxTOP|wxRIGHT, 5 );
45  m_contentPanel->SetMinSize( wxSize( 1000, 600 ) );
46 
47  auto sdbSizer = new wxStdDialogButtonSizer();
48  auto sdbSizerOK = new wxButton( this, wxID_OK );
49  sdbSizer->AddButton( sdbSizerOK );
50  auto sdbSizerCancel = new wxButton( this, wxID_CANCEL );
51  sdbSizer->AddButton( sdbSizerCancel );
52  sdbSizer->Realize();
53 
54  mainSizer->Add( sdbSizer, 0, wxALL|wxEXPAND, 5 );
55 
56  sdbSizerOK->SetDefault();
57 
59 
60  // On some windows manager (Unity, XFCE), this dialog is not always raised, depending
61  // on how the dialog is run.
62  Raise();
63 }
64 
65 
67 {
68  return m_contentPanel->TransferDataToWindow();
69 }
70 
71 
73 {
74  /* Transfer tables edited in dialog to the global and project tables:
75  * A good way is to use m_contentPanel->TransferDataFromWindow to do that.
76  * But be carefull:
77  * Since wxWidgets 3.1, it is called by wxDialog::TransferDataFromWindow()
78  * Before wxWidgets 3.1, it is *not* called by wxDialog::TransferDataFromWindow()
79  * m_contentPanel->TransferDataFromWindow do not works with two calls.
80  * Therefore *do not* call wxDialog::TransferDataFromWindow(),
81  * because m_contentPanel->TransferDataFromWindow() is called here.
82  */
83  return m_contentPanel->TransferDataFromWindow();
84 }
85 
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
Class DIALOG_SHIM may sit in the inheritance tree between wxDialog and any class written by wxFormBui...
Definition: dialog_shim.h:82
DIALOG_EDIT_LIBRARY_TABLES(wxWindow *aParent, const wxString &aTitle)