| OLD | NEW |
| 1 /** | 1 /** |
| 2 * \file interaction.h User interaction classes. Message boxes and translations. | 2 * \file interaction.h User interaction classes. Message boxes and translations. |
| 3 */ | 3 */ |
| 4 | 4 |
| 5 #ifndef INTERACTION_H | 5 #ifndef INTERACTION_H |
| 6 #define INTERACTION_H | 6 #define INTERACTION_H |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "session.h" | 10 #include "session.h" |
| 11 | 11 |
| 12 #include <Windows.h> | 12 #include <Windows.h> |
| 13 #include <Msi.h> | 13 #include <Msi.h> |
| 14 #include <MsiQuery.h> | 14 #include <MsiQuery.h> |
| 15 | 15 |
| 16 /** | 16 /** |
| 17 * A modal dialog box as displayable from within a custom action. | 17 * A modal dialog box as displayable from within a custom action. |
| 18 * | 18 * |
| 19 * The only fully user interface element that the Windows Installer supports for
use within custom actions is a small set of modal dialog boxes. | 19 * The only fully user interface element that the Windows Installer supports for
use within custom actions is a small set of modal dialog boxes. |
| 20 * The Windows Installer provides the call MsiProcessMessage, overloaded by a se
t of message type constants. | 20 * The Windows Installer provides the call MsiProcessMessage, overloaded by a se
t of message type constants. |
| 21 * This class represents those messages with user-provided messages; these ultim
ately call MessageBox. | 21 * This class represents those messages with user-provided messages; these ultim
ately call MessageBox. |
| 22 * | 22 * |
| 23 * \sa | 23 * \sa |
| 24 * * MSDN [MsiProcessMessage function](http://msdn.microsoft.com/en-us/librar
y/windows/desktop/aa370354%28v=vs.85%29.aspx) | 24 * * MSDN [MsiProcessMessage function](http://msdn.microsoft.com/en-us/librar
y/windows/desktop/aa370354%28v=vs.85%29.aspx) |
| 25 * * MSDN [Sending Messages to Windows Installer Using MsiProcessMessage](htt
p://msdn.microsoft.com/en-us/library/windows/desktop/aa371614%28v=vs.85%29.aspx) | 25 * * MSDN [Sending Messages to Windows Installer Using MsiProcessMessage](htt
p://msdn.microsoft.com/en-us/library/windows/desktop/aa371614%28v=vs.85%29.aspx) |
| 26 */ | 26 */ |
| 27 class InstallerMessageBox | 27 class InstallerMessageBox |
| 28 : public Message | 28 : public Message |
| 29 { | 29 { |
| 30 public: | 30 public: |
| 31 enum class Box : long | 31 enum class Box : long |
| 32 { | 32 { |
| 33 defaultBox = 0, | 33 defaultBox = 0, |
| 34 error = INSTALLMESSAGE::INSTALLMESSAGE_ERROR, | 34 error = INSTALLMESSAGE::INSTALLMESSAGE_ERROR, |
| 35 warning = INSTALLMESSAGE::INSTALLMESSAGE_WARNING, | 35 warning = INSTALLMESSAGE::INSTALLMESSAGE_WARNING, |
| 36 user = INSTALLMESSAGE::INSTALLMESSAGE_USER | 36 user = INSTALLMESSAGE::INSTALLMESSAGE_USER |
| 37 } ; | 37 }; |
| 38 | 38 |
| 39 enum class ButtonSet : long | 39 enum class ButtonSet : long |
| 40 { | 40 { |
| 41 defaultButtonSet = 0, | 41 defaultButtonSet = 0, |
| 42 ok = MB_OK, | 42 ok = MB_OK, |
| 43 okCancel = MB_OKCANCEL, | 43 okCancel = MB_OKCANCEL, |
| 44 abortRetryIgnore = MB_ABORTRETRYIGNORE, | 44 abortRetryIgnore = MB_ABORTRETRYIGNORE, |
| 45 yesNoCancel = MB_YESNOCANCEL, | 45 yesNoCancel = MB_YESNOCANCEL, |
| 46 yesNo = MB_YESNO, | 46 yesNo = MB_YESNO, |
| 47 retryCancel = MB_RETRYCANCEL | 47 retryCancel = MB_RETRYCANCEL |
| 48 } ; | 48 }; |
| 49 | 49 |
| 50 enum class DefaultButton : long | 50 enum class DefaultButton : long |
| 51 { | 51 { |
| 52 defaultButton = 0, ///< use the default button | 52 defaultButton = 0, ///< use the default button |
| 53 one = MB_DEFBUTTON1, | 53 one = MB_DEFBUTTON1, |
| 54 two = MB_DEFBUTTON2, | 54 two = MB_DEFBUTTON2, |
| 55 three = MB_DEFBUTTON3 | 55 three = MB_DEFBUTTON3 |
| 56 } ; | 56 }; |
| 57 | 57 |
| 58 enum class Icon : long | 58 enum class Icon : long |
| 59 { | 59 { |
| 60 defaultIcon = 0, ///< use the default icon associated
with the box type | 60 defaultIcon = 0, ///< use the default icon associated
with the box type |
| 61 warningIcon = MB_ICONWARNING, ///< exclamation point | 61 warningIcon = MB_ICONWARNING, ///< exclamation point |
| 62 informationIcon = MB_ICONINFORMATION, ///< lowercase letter "i" in a circl
e | 62 informationIcon = MB_ICONINFORMATION, ///< lowercase letter "i" in a circl
e |
| 63 errorIcon = MB_ICONERROR ///< stop sign | 63 errorIcon = MB_ICONERROR ///< stop sign |
| 64 } ; | 64 }; |
| 65 | 65 |
| 66 /** | 66 /** |
| 67 * Ordinary constructor, wide string | 67 * Ordinary constructor, wide string |
| 68 */ | 68 */ |
| 69 InstallerMessageBox( | 69 InstallerMessageBox( |
| 70 std::wstring message, | 70 std::wstring message, |
| 71 Box box = Box::user, | 71 Box box = Box::user, |
| 72 ButtonSet buttonset = ButtonSet::defaultButtonSet, | 72 ButtonSet buttonset = ButtonSet::defaultButtonSet, |
| 73 DefaultButton defaultButton = DefaultButton::defaultButton, | 73 DefaultButton defaultButton = DefaultButton::defaultButton, |
| 74 Icon icon = Icon::defaultIcon | 74 Icon icon = Icon::defaultIcon |
| 75 ) ; | 75 ); |
| 76 | 76 |
| 77 /** | 77 /** |
| 78 * Ordinary constructor, regular string | 78 * Ordinary constructor, regular string |
| 79 */ | 79 */ |
| 80 InstallerMessageBox( | 80 InstallerMessageBox( |
| 81 std::string message, | 81 std::string message, |
| 82 Box box = Box::user, | 82 Box box = Box::user, |
| 83 ButtonSet buttonset = ButtonSet::defaultButtonSet, | 83 ButtonSet buttonset = ButtonSet::defaultButtonSet, |
| 84 DefaultButton defaultButton = DefaultButton::defaultButton, | 84 DefaultButton defaultButton = DefaultButton::defaultButton, |
| 85 Icon icon = Icon::defaultIcon | 85 Icon icon = Icon::defaultIcon |
| 86 ) ; | 86 ); |
| 87 } ; | 87 }; |
| 88 | 88 |
| 89 /** | 89 /** |
| 90 * Error for any non-handled return value from Session.WriteMessage(). | 90 * Error for any non-handled return value from Session.WriteMessage(). |
| 91 */ | 91 */ |
| 92 struct UnexpectedReturnValueFromMessageBox | 92 struct UnexpectedReturnValueFromMessageBox |
| 93 : std::logic_error | 93 : std::logic_error |
| 94 { | 94 { |
| 95 UnexpectedReturnValueFromMessageBox() | 95 UnexpectedReturnValueFromMessageBox() |
| 96 : std::logic_error( "Unexpected return value from message box." ) | 96 : std::logic_error("Unexpected return value from message box.") |
| 97 {} | 97 {} |
| 98 } ; | 98 }; |
| 99 | 99 |
| 100 #endif | 100 #endif |
| OLD | NEW |