The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
4.2KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2022 - Raw Material Software Limited
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. By using JUCE, you agree to the terms of both the JUCE 7 End-User License
  8. Agreement and JUCE Privacy Policy.
  9. End User License Agreement: www.juce.com/juce-7-licence
  10. Privacy Policy: www.juce.com/juce-privacy-policy
  11. Or: You may also use this code under the terms of the GPL v3 (see
  12. www.gnu.org/licenses).
  13. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  14. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  15. DISCLAIMED.
  16. ==============================================================================
  17. */
  18. namespace juce
  19. {
  20. MessageBoxOptions MessageBoxOptions::makeOptionsOk (MessageBoxIconType iconType,
  21. const String& title,
  22. const String& message,
  23. const String& buttonText,
  24. Component* associatedComponent)
  25. {
  26. return MessageBoxOptions()
  27. .withIconType (iconType)
  28. .withTitle (title)
  29. .withMessage (message)
  30. .withButton (buttonText.isEmpty() ? TRANS ("OK") : buttonText)
  31. .withAssociatedComponent (associatedComponent);
  32. }
  33. MessageBoxOptions MessageBoxOptions::makeOptionsOkCancel (MessageBoxIconType iconType,
  34. const String& title,
  35. const String& message,
  36. const String& button1Text,
  37. const String& button2Text,
  38. Component* associatedComponent)
  39. {
  40. return MessageBoxOptions()
  41. .withIconType (iconType)
  42. .withTitle (title)
  43. .withMessage (message)
  44. .withButton (button1Text.isEmpty() ? TRANS ("OK") : button1Text)
  45. .withButton (button2Text.isEmpty() ? TRANS ("Cancel") : button2Text)
  46. .withAssociatedComponent (associatedComponent);
  47. }
  48. MessageBoxOptions MessageBoxOptions::makeOptionsYesNo (MessageBoxIconType iconType,
  49. const String& title,
  50. const String& message,
  51. const String& button1Text,
  52. const String& button2Text,
  53. Component* associatedComponent)
  54. {
  55. return MessageBoxOptions()
  56. .withIconType (iconType)
  57. .withTitle (title)
  58. .withMessage (message)
  59. .withButton (button1Text.isEmpty() ? TRANS ("Yes") : button1Text)
  60. .withButton (button2Text.isEmpty() ? TRANS ("No") : button2Text)
  61. .withAssociatedComponent (associatedComponent);
  62. }
  63. MessageBoxOptions MessageBoxOptions::makeOptionsYesNoCancel (MessageBoxIconType iconType,
  64. const String& title,
  65. const String& message,
  66. const String& button1Text,
  67. const String& button2Text,
  68. const String& button3Text,
  69. Component* associatedComponent)
  70. {
  71. return MessageBoxOptions()
  72. .withIconType (iconType)
  73. .withTitle (title)
  74. .withMessage (message)
  75. .withButton (button1Text.isEmpty() ? TRANS ("Yes") : button1Text)
  76. .withButton (button2Text.isEmpty() ? TRANS ("No") : button2Text)
  77. .withButton (button3Text.isEmpty() ? TRANS ("Cancel") : button3Text)
  78. .withAssociatedComponent (associatedComponent);
  79. }
  80. } // namespace juce