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, see <https://www.gnu.org/licenses/>.
19 */
20
27
28#ifndef __INCLUDE__CONFIRM_H__
29#define __INCLUDE__CONFIRM_H__
30
31#include <kicommon.h>
32#include <wx/string.h>
33#include <wx/arrstr.h>
34
35class wxWindow;
36
37
38// On Windows, to have the best dark mode experience we need to sub in the generic dialogs
39// as wx can't retheme the native dialogs
40#if defined( _WIN32 ) && wxCHECK_VERSION( 3, 3, 0 )
41#define KICAD_MESSAGE_DIALOG_BASE wxGenericMessageDialog
42#define KICAD_RICH_MESSAGE_DIALOG_BASE wxGenericRichMessageDialog
43// incase we in the future declare our own message dialog class
44#define KICAD_MESSAGE_DIALOG KICAD_MESSAGE_DIALOG_BASE
45#else
46#define KICAD_MESSAGE_DIALOG_BASE wxMessageDialog
47#define KICAD_RICH_MESSAGE_DIALOG_BASE wxRichMessageDialog
48#define KICAD_MESSAGE_DIALOG KICAD_MESSAGE_DIALOG_BASE
49#endif
50
51
56KICOMMON_API bool AskOverrideLock( wxWindow* aParent, const wxString& aMessage );
57
58
69KICOMMON_API bool HandleUnsavedChanges( wxWindow* aParent, const wxString& aMessage,
70 const std::function<bool()>& aSaveFunction );
71
75
76
86KICOMMON_API int UnsavedChangesDialog( wxWindow* aParent, const wxString& aMessage,
87 bool* aApplyToAll );
88
89KICOMMON_API int UnsavedChangesDialog( wxWindow* aParent, const wxString& aMessage );
90
91
95KICOMMON_API bool ConfirmRevertDialog( wxWindow* parent, const wxString& aMessage );
96
97
101KICOMMON_API void DisplayError( wxWindow* aParent, const wxString& aText );
102
110KICOMMON_API void DisplayErrorMessage( wxWindow* aParent, const wxString& aMessage,
111 const wxString& aExtraInfo = wxEmptyString );
112
113
121KICOMMON_API void DisplayInfoMessage( wxWindow* parent, const wxString& aMessage,
122 const wxString& aExtraInfo = wxEmptyString );
123
132KICOMMON_API bool IsOK( wxWindow* aParent, const wxString& aMessage );
133
148KICOMMON_API int OKOrCancelDialog( wxWindow* aParent, const wxString& aWarning,
149 const wxString& aMessage,
150 const wxString& aDetailedMessage = wxEmptyString,
151 const wxString& aOKLabel = wxEmptyString,
152 const wxString& aCancelLabel = wxEmptyString,
153 bool* aApplyToAll = nullptr );
154
155
156
166KICOMMON_API int SelectSingleOption( wxWindow* aParent, const wxString& aTitle,
167 const wxString& aMessage,
168 const wxArrayString& aOptions );
169
170#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:217
KICOMMON_API void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
Definition confirm.cpp:192
KICOMMON_API void DisplayInfoMessage(wxWindow *parent, const wxString &aMessage, const wxString &aExtraInfo=wxEmptyString)
Display an informational message box with aMessage.
Definition confirm.cpp:245
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:299
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:38
KICOMMON_API bool ConfirmRevertDialog(wxWindow *parent, const wxString &aMessage)
Display a confirmation dialog for a revert action.
Definition confirm.cpp:133
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:146
KICOMMON_API int GetLastUnsavedChangesResponse()
Return the result code from the last call to HandleUnsavedChanges(): wxID_YES, wxID_NO or wxID_CANCEL...
Definition confirm.cpp:159
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:165
KICOMMON_API bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
Definition confirm.cpp:274
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:60
#define KICOMMON_API
Definition kicommon.h:27