KiCad PCB EDA Suite
Loading...
Searching...
No Matches
filedlg_hook_new_library.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 along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include <wx/filedlgcustomize.h>
23
24
25class FILEDLG_HOOK_NEW_LIBRARY : public wxFileDialogCustomizeHook
26{
27public:
28 FILEDLG_HOOK_NEW_LIBRARY( bool aDefaultUseGlobalTable ) :
29 m_useGlobalTable( aDefaultUseGlobalTable )
30 {};
31
32 virtual void AddCustomControls( wxFileDialogCustomize& customizer ) override
33 {
34 wxString padding;
35#ifdef __WXMAC__
36 padding = wxT( " " );
37 customizer.AddStaticText( wxT( "\n\n" ) );
38#endif
39
40 // Radio buttons are only grouped if they are consecutive. If we want padding, we need to add it to the
41 // first radio button
42 m_addGlobalTableEntry = customizer.AddRadioButton( _( "Add new library to global library table" ) + padding );
43 m_addProjectTableEntry = customizer.AddRadioButton( _( "Add new library to project library table" ) );
44
46 m_addGlobalTableEntry->SetValue( true );
47 else
48 m_addProjectTableEntry->SetValue( true );
49 }
50
51 virtual void TransferDataFromCustomControls() override
52 {
54 }
55
56 bool GetUseGlobalTable() const { return m_useGlobalTable; }
57
58private:
60
61 wxFileDialogRadioButton* m_addGlobalTableEntry = nullptr;
62 wxFileDialogRadioButton* m_addProjectTableEntry = nullptr;
63
65};
66
wxFileDialogRadioButton * m_addGlobalTableEntry
virtual void AddCustomControls(wxFileDialogCustomize &customizer) override
wxFileDialogRadioButton * m_addProjectTableEntry
FILEDLG_HOOK_NEW_LIBRARY(bool aDefaultUseGlobalTable)
wxDECLARE_NO_COPY_CLASS(FILEDLG_HOOK_NEW_LIBRARY)
virtual void TransferDataFromCustomControls() override
#define _(s)