summaryrefslogtreecommitdiff
path: root/wx+/popup_dlg.h
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:28:01 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:28:01 +0200
commitfe9eb89ebc1b3c33cbac00a3fa095a14faef9113 (patch)
tree8a3bb620a9acb83fe0057061a86e8f2cb91a9fe1 /wx+/popup_dlg.h
parent5.21 (diff)
downloadFreeFileSync-fe9eb89ebc1b3c33cbac00a3fa095a14faef9113.tar.gz
FreeFileSync-fe9eb89ebc1b3c33cbac00a3fa095a14faef9113.tar.bz2
FreeFileSync-fe9eb89ebc1b3c33cbac00a3fa095a14faef9113.zip
5.22
Diffstat (limited to 'wx+/popup_dlg.h')
-rw-r--r--wx+/popup_dlg.h91
1 files changed, 91 insertions, 0 deletions
diff --git a/wx+/popup_dlg.h b/wx+/popup_dlg.h
new file mode 100644
index 00000000..ab988702
--- /dev/null
+++ b/wx+/popup_dlg.h
@@ -0,0 +1,91 @@
+// **************************************************************************
+// * This file is part of the FreeFileSync project. It is distributed under *
+// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
+// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
+// **************************************************************************
+
+#ifndef MESSAGEPOPUP_H_820780154723456
+#define MESSAGEPOPUP_H_820780154723456
+
+#include <wx/window.h>
+#include <wx/string.h>
+
+namespace zen
+{
+//parent window, optional: support correct dialog placement above parent on multiple monitor systems
+//this module requires error, warning and info image files in resources.zip, see <wx+/image_resources.h>
+
+struct PopupDialogCfg;
+struct PopupDialogCfg3;
+
+enum class DialogInfoType
+{
+ INFO,
+ WARNING,
+ ERROR2, //fuck the ERROR macro in WinGDI.h!
+};
+
+enum class ConfirmationButton3
+{
+ DO_IT,
+ DONT_DO_IT,
+ CANCEL
+};
+
+enum class ConfirmationButton
+{
+ DO_IT = static_cast<int>(ConfirmationButton3::DO_IT), //[!]
+ CANCEL = static_cast<int>(ConfirmationButton3::CANCEL), //Clang requires a "static_cast"
+};
+
+void showNotificationDialog (wxWindow* parent, DialogInfoType type, const PopupDialogCfg& cfg);
+ConfirmationButton showConfirmationDialog (wxWindow* parent, DialogInfoType type, const PopupDialogCfg& cfg, const wxString& labelDoIt);
+ConfirmationButton3 showConfirmationDialog3(wxWindow* parent, DialogInfoType type, const PopupDialogCfg3& cfg, const wxString& labelDoIt, const wxString& labelDontDoIt);
+
+//----------------------------------------------------------------------------------------------------------------
+class StandardPopupDialog;
+class ConfirmationDialog3;
+
+struct PopupDialogCfg
+{
+ PopupDialogCfg() : checkBoxValue() {}
+ PopupDialogCfg& setTitle (const wxString& label) { title = label; return *this; }
+ PopupDialogCfg& setMainInstructions (const wxString& label) { textMain = label; return *this; } //set at least one of these!
+ PopupDialogCfg& setDetailInstructions(const wxString& label) { textDetail = label; return *this; } //
+ PopupDialogCfg& setCheckBox(bool& value, const wxString& label) { checkBoxValue = &value; checkBoxLabel = label; return *this; }
+
+private:
+ friend class StandardPopupDialog;
+
+ wxString title;
+ wxString textMain;
+ wxString textDetail;
+ bool* checkBoxValue; //in/out
+ wxString checkBoxLabel;
+};
+
+
+struct PopupDialogCfg3
+{
+ PopupDialogCfg3() : buttonToDisableWhenChecked(ConfirmationButton3::CANCEL) {}
+ PopupDialogCfg3& setTitle (const wxString& label) { pdCfg.setTitle (label); return *this; }
+ PopupDialogCfg3& setMainInstructions (const wxString& label) { pdCfg.setMainInstructions (label); return *this; } //set at least one of these!
+ PopupDialogCfg3& setDetailInstructions(const wxString& label) { pdCfg.setDetailInstructions(label); return *this; } //
+ PopupDialogCfg3& setCheckBox(bool& value, const wxString& label) { pdCfg.setCheckBox(value, label); return *this; }
+ PopupDialogCfg3& setCheckBox(bool& value, const wxString& label, ConfirmationButton3 disableWhenChecked)
+ {
+ assert(disableWhenChecked != ConfirmationButton3::CANCEL);
+ setCheckBox(value, label);
+ buttonToDisableWhenChecked = disableWhenChecked;
+ return *this;
+ }
+
+private:
+ friend class ConfirmationDialog3;
+
+ PopupDialogCfg pdCfg;
+ ConfirmationButton3 buttonToDisableWhenChecked;
+};
+}
+
+#endif //MESSAGEPOPUP_H_820780154723456
bgstack15