IWebInterfaceBrowserDialog.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. // Engine/Source/Runtime/WebBrowser/Public/IWebBrowserDialog.h
  2. #pragma once
  3. #include "CoreMinimal.h"
  4. /**
  5. * Type of browser dialog to show.
  6. */
  7. enum class EWebInterfaceBrowserDialogType
  8. {
  9. /** Alert dialog. Used to show a message to a user. It should only have a single button to dismiss it. */
  10. Alert = 0,
  11. /** Confirm dialog. Shows a message to the user. It should have two buttons to either accept or decline the prompt. */
  12. Confirm,
  13. /** Prompt dialog. Shows a prompt asking for user input. The user can enter text and either confirm or dismiss it. */
  14. Prompt,
  15. /** Unload dialog. This type of dialog is shown to confirm navigating away from a page containing user-edited content. */
  16. Unload = 127,
  17. };
  18. /**
  19. * Return value from dialog event handle specifying what action should be taken.
  20. */
  21. enum class EWebInterfaceBrowserDialogEventResponse
  22. {
  23. /** Return Unhandled to use the default dialog implementation. This is the default behavior when no handler is attached. */
  24. Unhandled,
  25. /** Do not show any dialog and return as if the user accepted the action. */
  26. Continue,
  27. /** Do not show any dialog and return as if the user dismissed the action. */
  28. Ignore,
  29. /** The event handler will take care of showing the dialog. It must call IWebBrowserDialog::Continue once it has been dismissed. */
  30. Handled,
  31. };
  32. /**
  33. * Browser dialog parameters passed to OnBrowserDialog event handlers.
  34. */
  35. class IWebInterfaceBrowserDialog
  36. {
  37. public:
  38. virtual ~IWebInterfaceBrowserDialog()
  39. {}
  40. /**
  41. * What kind of dialog should be shown.
  42. * @return the dialog type
  43. */
  44. virtual EWebInterfaceBrowserDialogType GetType() = 0;
  45. /**
  46. * Tell the browser to continue with the result of the dialog.
  47. * If this method is used, the original event handler must return EWebBrowserDialogEventResponse::Handled.
  48. *
  49. * @param Success Did the user accept the dialog or not?
  50. * @param UserResponse Only for Prompt dialog, the text entered by the user.
  51. */
  52. virtual void Continue(bool Success = true, const FText& UserResponse = FText::GetEmpty()) = 0;
  53. /**
  54. * Get the dialog message.
  55. * @return the message to show in the dialog.
  56. */
  57. virtual const FText& GetMessageText() = 0;
  58. /**
  59. * Only valid for Prompt dialogs.
  60. * @return the default value to show in the text entry box.
  61. */
  62. virtual const FText& GetDefaultPrompt() = 0;
  63. /**
  64. * Only valid for Unload dialogs.
  65. * @return true if the dialog is confirming a reload of the current page.
  66. */
  67. virtual bool IsReload() = 0;
  68. };