KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_edit_library_tables.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
21#ifndef DIALOG_EDIT_LIBRARY_TABLES_H
22#define DIALOG_EDIT_LIBRARY_TABLES_H
23
24#include <dialog_shim.h>
25#include <functional>
26#include <wx/panel.h>
27#include <widgets/wx_infobar.h>
28
29
31{
32public:
35
36public:
37 DIALOG_EDIT_LIBRARY_TABLES( wxWindow* aParent, const wxString& aTitle );
38
39 void InstallPanel( wxPanel* aPanel );
40
41 void SetCanCloseCheck( std::function<bool()> aCheck ) { m_canCloseCheck = std::move( aCheck ); }
42
43 bool TransferDataToWindow() override;
44 bool TransferDataFromWindow() override;
45
46 void ShowInfoBarError( const wxString& aErrorMsg, bool aShowCloseButton = false,
47 WX_INFOBAR::MESSAGE_TYPE aType = WX_INFOBAR::MESSAGE_TYPE::GENERIC )
48 {
49 m_infoBar->RemoveAllButtons();
50
51 if( aShowCloseButton )
52 m_infoBar->AddCloseButton();
53
54 m_infoBar->ShowMessageFor( aErrorMsg, 8000, wxICON_ERROR, aType );
55 }
56
57protected:
60
61private:
62 void onCloseWindow( wxCloseEvent& aEvent );
63 void onCancelButton( wxCommandEvent& aEvent );
64 void onOkButton( wxCommandEvent& aEvent );
65
66 std::function<bool()> m_canCloseCheck;
67};
68
69
70#endif //DIALOG_EDIT_LIBRARY_TABLES_H
void onCloseWindow(wxCloseEvent &aEvent)
void SetCanCloseCheck(std::function< bool()> aCheck)
void onCancelButton(wxCommandEvent &aEvent)
DIALOG_EDIT_LIBRARY_TABLES(wxWindow *aParent, const wxString &aTitle)
void onOkButton(wxCommandEvent &aEvent)
void ShowInfoBarError(const wxString &aErrorMsg, bool aShowCloseButton=false, WX_INFOBAR::MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
DIALOG_SHIM(wxWindow *aParent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER, const wxString &name=wxDialogNameStr)
A modified version of the wxInfoBar class that allows us to:
Definition wx_infobar.h:77
INFOBAR_MESSAGE_TYPE MESSAGE_TYPE
Definition wx_infobar.h:91