KiCad PCB EDA Suite
Loading...
Searching...
No Matches
confirm.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
31
32#ifndef __INCLUDE__CONFIRM_H__
33#define __INCLUDE__CONFIRM_H__
34
35#include <kicommon.h>
36#include <wx/string.h>
37#include <wx/arrstr.h>
38
39class wxWindow;
40
41
42// On Windows, to have the best dark mode experience we need to sub in the generic dialogs
43// as wx can't retheme the native dialogs
44#if defined( _WIN32 ) && wxCHECK_VERSION( 3, 3, 0 )
45#define KICAD_MESSAGE_DIALOG_BASE wxGenericMessageDialog
46#define KICAD_RICH_MESSAGE_DIALOG_BASE wxGenericRichMessageDialog
47// incase we in the future declare our own message dialog class
48#define KICAD_MESSAGE_DIALOG KICAD_MESSAGE_DIALOG_BASE
49#else
50#define KICAD_MESSAGE_DIALOG_BASE wxMessageDialog
51#define KICAD_RICH_MESSAGE_DIALOG_BASE wxRichMessageDialog
52#define KICAD_MESSAGE_DIALOG KICAD_MESSAGE_DIALOG_BASE
53#endif
54
55
60KICOMMON_API bool AskOverrideLock( wxWindow* aParent, const wxString& aMessage );
61
62
73KICOMMON_API bool HandleUnsavedChanges( wxWindow* aParent, const wxString& aMessage,
74 const std::function<bool()>& aSaveFunction );
75
79
80
90KICOMMON_API int UnsavedChangesDialog( wxWindow* aParent, const wxString& aMessage,
91 bool* aApplyToAll );
92
93KICOMMON_API int UnsavedChangesDialog( wxWindow* aParent, const wxString& aMessage );
94
95
99KICOMMON_API bool ConfirmRevertDialog( wxWindow* parent, const wxString& aMessage );
100
101
105KICOMMON_API void DisplayError( wxWindow* aParent, const wxString& aText );
106
114KICOMMON_API void DisplayErrorMessage( wxWindow* aParent, const wxString& aMessage,
115 const wxString& aExtraInfo = wxEmptyString );
116
117
125KICOMMON_API void DisplayInfoMessage( wxWindow* parent, const wxString& aMessage,
126 const wxString& aExtraInfo = wxEmptyString );
127
136KICOMMON_API bool IsOK( wxWindow* aParent, const wxString& aMessage );
137
152KICOMMON_API int OKOrCancelDialog( wxWindow* aParent, const wxString& aWarning,
153 const wxString& aMessage,
154 const wxString& aDetailedMessage = wxEmptyString,
155 const wxString& aOKLabel = wxEmptyString,
156 const wxString& aCancelLabel = wxEmptyString,
157 bool* aApplyToAll = nullptr );
158
159
160
170KICOMMON_API int SelectSingleOption( wxWindow* aParent, const wxString& aTitle,
171 const wxString& aMessage,
172 const wxArrayString& aOptions );
173
174#endif /* __INCLUDE__CONFIRM_H__ */
KICOMMON_API void DisplayErrorMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo=wxEmptyString)
Display an error message with aMessage.
Definition confirm.cpp:202
KICOMMON_API void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
Definition confirm.cpp:177
KICOMMON_API void DisplayInfoMessage(wxWindow *parent, const wxString &aMessage, const wxString &aExtraInfo=wxEmptyString)
Display an informational message box with aMessage.
Definition confirm.cpp:230
KICOMMON_API int SelectSingleOption(wxWindow *aParent, const wxString &aTitle, const wxString &aMessage, const wxArrayString &aOptions)
Display a dialog with radioboxes asking the user to select an option.
Definition confirm.cpp:284
KICOMMON_API bool AskOverrideLock(wxWindow *aParent, const wxString &aMessage)
Display a dialog indicating the file is already open, with an option to reset the lock.
Definition confirm.cpp:42
KICOMMON_API bool ConfirmRevertDialog(wxWindow *parent, const wxString &aMessage)
Display a confirmation dialog for a revert action.
Definition confirm.cpp:118
KICOMMON_API bool HandleUnsavedChanges(wxWindow *aParent, const wxString &aMessage, const std::function< bool()> &aSaveFunction)
Display a dialog with Save, Cancel and Discard Changes buttons.
Definition confirm.cpp:131
KICOMMON_API int GetLastUnsavedChangesResponse()
Return the result code from the last call to HandleUnsavedChanges(): wxID_YES, wxID_NO or wxID_CANCEL...
Definition confirm.cpp:144
KICOMMON_API int OKOrCancelDialog(wxWindow *aParent, const wxString &aWarning, const wxString &aMessage, const wxString &aDetailedMessage=wxEmptyString, const wxString &aOKLabel=wxEmptyString, const wxString &aCancelLabel=wxEmptyString, bool *aApplyToAll=nullptr)
Display a warning dialog with aMessage and returns the user response.
Definition confirm.cpp:150
KICOMMON_API bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
Definition confirm.cpp:259
KICOMMON_API int UnsavedChangesDialog(wxWindow *aParent, const wxString &aMessage, bool *aApplyToAll)
A specialized version of HandleUnsavedChanges which handles an apply-to-all checkbox.
Definition confirm.cpp:64
#define KICOMMON_API
Definition kicommon.h:28