1
0

Reporting.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * Reporting.h
  3. * -----------
  4. * Purpose: A class for showing notifications, prompts, etc...
  5. * Notes : (currently none)
  6. * Authors: OpenMPT Devs
  7. * The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
  8. */
  9. #pragma once
  10. #include "openmpt/all/BuildSettings.hpp"
  11. OPENMPT_NAMESPACE_BEGIN
  12. enum ConfirmAnswer
  13. {
  14. cnfYes,
  15. cnfNo,
  16. cnfCancel,
  17. };
  18. enum RetryAnswer
  19. {
  20. rtyRetry,
  21. rtyCancel,
  22. };
  23. class Reporting
  24. {
  25. public:
  26. // TODO Quick'n'dirty workaround for MsgBox(). Shouldn't be public.
  27. static UINT CustomNotification(const AnyStringLocale &text, const AnyStringLocale &caption, UINT flags, const CWnd *parent);
  28. // Show a simple notification
  29. static void Notification(const AnyStringLocale &text, const CWnd *parent = nullptr);
  30. static void Notification(const AnyStringLocale &text, const AnyStringLocale &caption, const CWnd *parent = nullptr);
  31. // Show a simple information
  32. static void Information(const AnyStringLocale &text, const CWnd *parent = nullptr);
  33. static void Information(const AnyStringLocale &text, const AnyStringLocale &caption, const CWnd *parent = nullptr);
  34. // Show a simple warning
  35. static void Warning(const AnyStringLocale &text, const CWnd *parent = nullptr);
  36. static void Warning(const AnyStringLocale &text, const AnyStringLocale &caption, const CWnd *parent = nullptr);
  37. // Show an error box.
  38. static void Error(const AnyStringLocale &text, const CWnd *parent = nullptr);
  39. static void Error(const AnyStringLocale &text, const AnyStringLocale &caption, const CWnd *parent = nullptr);
  40. // Simplified version of the above
  41. static void Message(LogLevel level, const AnyStringLocale &text, const CWnd *parent = nullptr);
  42. static void Message(LogLevel level, const AnyStringLocale &text, const AnyStringLocale &caption, const CWnd *parent = nullptr);
  43. // Show a confirmation dialog.
  44. static ConfirmAnswer Confirm(const AnyStringLocale &text, bool showCancel = false, bool defaultNo = false, const CWnd *parent = nullptr);
  45. static ConfirmAnswer Confirm(const AnyStringLocale &text, const AnyStringLocale &caption, bool showCancel = false, bool defaultNo = false, const CWnd *parent = nullptr);
  46. // work-around string literals for caption decaying to bool and catching the wrong overload instead of converting to a string.
  47. static ConfirmAnswer Confirm(const AnyStringLocale &text, const char *caption, bool showCancel = false, bool defaultNo = false, const CWnd *parent = nullptr) { return Confirm(text, AnyStringLocale(caption), showCancel, defaultNo, parent); }
  48. static ConfirmAnswer Confirm(const AnyStringLocale &text, const wchar_t *caption, bool showCancel = false, bool defaultNo = false, const CWnd *parent = nullptr) { return Confirm(text, AnyStringLocale(caption), showCancel, defaultNo, parent); }
  49. static ConfirmAnswer Confirm(const AnyStringLocale &text, const CString &caption, bool showCancel = false, bool defaultNo = false, const CWnd *parent = nullptr) { return Confirm(text, AnyStringLocale(caption), showCancel, defaultNo, parent); }
  50. // Show a confirmation dialog.
  51. static RetryAnswer RetryCancel(const AnyStringLocale &text, const CWnd *parent = nullptr);
  52. static RetryAnswer RetryCancel(const AnyStringLocale &text, const AnyStringLocale &caption, const CWnd *parent = nullptr);
  53. };
  54. OPENMPT_NAMESPACE_END