KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_embed_files.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) 2024 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
26DIALOG_EMBED_FILES::DIALOG_EMBED_FILES( wxWindow* aParent, const wxString& aTitle ) :
27 DIALOG_SHIM( aParent, wxID_ANY, aTitle, wxDefaultPosition, wxDefaultSize,
28 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ),
29 m_contentPanel( nullptr )
30{
31 // Construction delayed until after panel is installed
32}
33
34
35void DIALOG_EMBED_FILES::InstallPanel( wxPanel* aPanel )
36{
37 m_contentPanel = aPanel;
38
39 // Now perform the body of the constructor
40 auto mainSizer = new wxBoxSizer( wxVERTICAL );
41 SetSizer( mainSizer );
42
43 mainSizer->Add( m_contentPanel, 1, wxEXPAND|wxLEFT|wxTOP|wxRIGHT, 5 );
44 m_contentPanel->SetMinSize( FromDIP( wxSize( 1000, 600 ) ) );
45
46 auto sdbSizer = new wxStdDialogButtonSizer();
47 auto sdbSizerOK = new wxButton( this, wxID_OK );
48 sdbSizer->AddButton( sdbSizerOK );
49 auto sdbSizerCancel = new wxButton( this, wxID_CANCEL );
50 sdbSizer->AddButton( sdbSizerCancel );
51 sdbSizer->Realize();
52
53 mainSizer->Add( sdbSizer, 0, wxALL|wxEXPAND, 5 );
54
56
58
59 // On some windows manager (Unity, XFCE), this dialog is not always raised, depending
60 // on how the dialog is run.
61 Raise();
62}
63
64
66{
67 return m_contentPanel->TransferDataToWindow();
68}
69
70
72{
76 return m_contentPanel->TransferDataFromWindow();
77}
78
void InstallPanel(wxPanel *aPanel)
bool TransferDataFromWindow() override
bool TransferDataToWindow() override
DIALOG_EMBED_FILES(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...