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
25#pragma once
26
27#include <kicommon.h>
28#include <wx/richmsgdlg.h>
29
30
31#if defined( _WIN32 ) && wxCHECK_VERSION( 3, 3, 0 )
32#define KIDIALOG_BASE wxGenericRichMessageDialog
33#else
34#define KIDIALOG_BASE wxRichMessageDialog
35#endif
36
37
42{
43public:
44 static void ClearDoNotShowAgainDialogs();
45
48
49 KIDIALOG( wxWindow* aParent, const wxString& aMessage, const wxString& aCaption, long aStyle = wxOK );
50 KIDIALOG( wxWindow* aParent, const wxString& aMessage, KD_TYPE aType, const wxString& aCaption = "" );
51
52 bool SetOKCancelLabels( const ButtonLabel& ok, const ButtonLabel& cancel ) override
53 {
54 m_cancelMeansCancel = false;
55 return KIDIALOG_BASE::SetOKCancelLabels( ok, cancel );
56 }
57
59 void DoNotShowCheckbox( wxString file, int line );
60
62 bool DoNotShowAgain() const;
63
64 bool Show( bool aShow = true ) override;
65 int ShowModal() override;
66
67protected:
68 // Helper functions for wxRichMessageDialog constructor
69 static wxString getCaption( KD_TYPE aType, const wxString& aCaption );
70 static long getStyle( KD_TYPE aType );
71
72protected:
73 unsigned long m_hash; // Unique id
74 bool m_cancelMeansCancel; // If the Cancel button is renamed then it should be saved by the
75 // DoNotShowAgain checkbox. If it's really a cancel then it should not.
76};
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
Definition kidialog.h:42
@ KD_INFO
Definition kidialog.h:47
@ KD_QUESTION
Definition kidialog.h:47
@ KD_ERROR
Definition kidialog.h:47
@ KD_NONE
Definition kidialog.h:47
@ KD_WARNING
Definition kidialog.h:47
bool m_cancelMeansCancel
Definition kidialog.h:74
unsigned long m_hash
Definition kidialog.h:73
KIDIALOG(wxWindow *aParent, const wxString &aMessage, const wxString &aCaption, long aStyle=wxOK)
Definition kidialog.cpp:33
bool SetOKCancelLabels(const ButtonLabel &ok, const ButtonLabel &cancel) override
Definition kidialog.h:52
static void ClearDoNotShowAgainDialogs()
Dialog type. Selects appropriate icon and default dialog title.
Definition kidialog.cpp:49
#define KICOMMON_API
Definition kicommon.h:28
#define KIDIALOG_BASE
Definition kidialog.h:34