KiCad PCB EDA Suite
Loading...
Searching...
No Matches
kidialog.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 (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
32#ifndef KIDIALOG_H_
33#define KIDIALOG_H_
34
35#include <kicommon.h>
36#include <wx/richmsgdlg.h>
37
38
42class KICOMMON_API KIDIALOG : public wxRichMessageDialog
43{
44public:
46 enum KD_TYPE { KD_NONE, KD_INFO, KD_QUESTION, KD_WARNING, KD_ERROR };
47
48 KIDIALOG( wxWindow* aParent, const wxString& aMessage, const wxString& aCaption,
49 long aStyle = wxOK );
50 KIDIALOG( wxWindow* aParent, const wxString& aMessage, KD_TYPE aType,
51 const wxString& aCaption = "" );
52
53 bool SetOKCancelLabels( const ButtonLabel& ok, const ButtonLabel& cancel ) override
54 {
55 m_cancelMeansCancel = false;
56 return wxRichMessageDialog::SetOKCancelLabels( ok, cancel );
57 }
58
60 void DoNotShowCheckbox( wxString file, int line );
61
63 bool DoNotShowAgain() const;
64 void ForceShowAgain();
65
66 bool Show( bool aShow = true ) override;
67 int ShowModal() override;
68
69protected:
70 // Helper functions for wxRichMessageDialog constructor
71 static wxString getCaption( KD_TYPE aType, const wxString& aCaption );
72 static long getStyle( KD_TYPE aType );
73
74protected:
75 unsigned long m_hash; // Unique id
76 bool m_cancelMeansCancel; // If the Cancel button is renamed then it should be
77 // saved by the DoNotShowAgain checkbox. If it's really
78 // a cancel then it should not.
79};
80
81
82#endif /* KIDIALOG_H_ */
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
Definition: kidialog.h:43
KD_TYPE
< Dialog type. Selects appropriate icon and default dialog title
Definition: kidialog.h:46
bool m_cancelMeansCancel
Definition: kidialog.h:76
unsigned long m_hash
Definition: kidialog.h:75
bool SetOKCancelLabels(const ButtonLabel &ok, const ButtonLabel &cancel) override
Shows the 'do not show again' checkbox.
Definition: kidialog.h:53
#define KICOMMON_API
Definition: kicommon.h:28