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 The 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
39#if defined( _WIN32 ) && wxCHECK_VERSION( 3, 3, 0 )
40#define KIDIALOG_BASE wxGenericRichMessageDialog
41#else
42#define KIDIALOG_BASE wxRichMessageDialog
43#endif
44
45
50{
51public:
53 enum KD_TYPE { KD_NONE, KD_INFO, KD_QUESTION, KD_WARNING, KD_ERROR };
54
55 KIDIALOG( wxWindow* aParent, const wxString& aMessage, const wxString& aCaption,
56 long aStyle = wxOK );
57 KIDIALOG( wxWindow* aParent, const wxString& aMessage, KD_TYPE aType,
58 const wxString& aCaption = "" );
59
60 bool SetOKCancelLabels( const ButtonLabel& ok, const ButtonLabel& cancel ) override
61 {
62 m_cancelMeansCancel = false;
63 return KIDIALOG_BASE::SetOKCancelLabels( ok, cancel );
64 }
65
67 void DoNotShowCheckbox( wxString file, int line );
68
70 bool DoNotShowAgain() const;
71 void ForceShowAgain();
72
73 bool Show( bool aShow = true ) override;
74 int ShowModal() override;
75
76protected:
77 // Helper functions for wxRichMessageDialog constructor
78 static wxString getCaption( KD_TYPE aType, const wxString& aCaption );
79 static long getStyle( KD_TYPE aType );
80
81protected:
82 unsigned long m_hash; // Unique id
83 bool m_cancelMeansCancel; // If the Cancel button is renamed then it should be
84 // saved by the DoNotShowAgain checkbox. If it's really
85 // a cancel then it should not.
86};
87
88
89#endif /* KIDIALOG_H_ */
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
Definition: kidialog.h:50
KD_TYPE
< Dialog type. Selects appropriate icon and default dialog title
Definition: kidialog.h:53
bool m_cancelMeansCancel
Definition: kidialog.h:83
unsigned long m_hash
Definition: kidialog.h:82
bool SetOKCancelLabels(const ButtonLabel &ok, const ButtonLabel &cancel) override
Definition: kidialog.h:60
#define KICOMMON_API
Definition: kicommon.h:28
#define KIDIALOG_BASE
Definition: kidialog.h:42