JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
juce_MessageBoxOptions.cpp
Go to the documentation of this file.
1 /*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
30 const String& title,
31 const String& message,
32 const String& buttonText,
33 Component* associatedComponent)
34{
35 return MessageBoxOptions()
36 .withIconType (iconType)
37 .withTitle (title)
38 .withMessage (message)
39 .withButton (buttonText.isEmpty() ? TRANS ("OK") : buttonText)
40 .withAssociatedComponent (associatedComponent);
41}
42
44 const String& title,
45 const String& message,
46 const String& button1Text,
47 const String& button2Text,
48 Component* associatedComponent)
49{
50 return MessageBoxOptions()
51 .withIconType (iconType)
52 .withTitle (title)
53 .withMessage (message)
54 .withButton (button1Text.isEmpty() ? TRANS ("OK") : button1Text)
55 .withButton (button2Text.isEmpty() ? TRANS ("Cancel") : button2Text)
56 .withAssociatedComponent (associatedComponent);
57}
58
60 const String& title,
61 const String& message,
62 const String& button1Text,
63 const String& button2Text,
64 Component* associatedComponent)
65{
66 return MessageBoxOptions()
67 .withIconType (iconType)
68 .withTitle (title)
69 .withMessage (message)
70 .withButton (button1Text.isEmpty() ? TRANS ("Yes") : button1Text)
71 .withButton (button2Text.isEmpty() ? TRANS ("No") : button2Text)
72 .withAssociatedComponent (associatedComponent);
73}
74
76 const String& title,
77 const String& message,
78 const String& button1Text,
79 const String& button2Text,
80 const String& button3Text,
81 Component* associatedComponent)
82{
83 return MessageBoxOptions()
84 .withIconType (iconType)
85 .withTitle (title)
86 .withMessage (message)
87 .withButton (button1Text.isEmpty() ? TRANS ("Yes") : button1Text)
88 .withButton (button2Text.isEmpty() ? TRANS ("No") : button2Text)
89 .withButton (button3Text.isEmpty() ? TRANS ("Cancel") : button3Text)
90 .withAssociatedComponent (associatedComponent);
91}
92
93} // namespace juce
The base class for all JUCE user-interface objects.
Class used to create a set of options to pass to the AlertWindow and NativeMessageBox methods for sho...
static MessageBoxOptions makeOptionsYesNo(MessageBoxIconType iconType, const String &title, const String &message, const String &button1Text=String(), const String &button2Text=String(), Component *associatedComponent=nullptr)
Creates options suitable for a message box with two buttons.
MessageBoxOptions withMessage(const String &boxMessage) const
Sets the message that should be displayed in the dialog box.
static MessageBoxOptions makeOptionsYesNoCancel(MessageBoxIconType iconType, const String &title, const String &message, const String &button1Text=String(), const String &button2Text=String(), const String &button3Text=String(), Component *associatedComponent=nullptr)
Creates options suitable for a message box with three buttons.
static MessageBoxOptions makeOptionsOkCancel(MessageBoxIconType iconType, const String &title, const String &message, const String &button1Text=String(), const String &button2Text=String(), Component *associatedComponent=nullptr)
Creates options suitable for a message box with two buttons.
MessageBoxOptions withTitle(const String &boxTitle) const
Sets the title of the dialog box.
MessageBoxOptions withButton(const String &text) const
If the string passed in is not empty, this will add a button to the dialog box with the specified tex...
MessageBoxOptions withIconType(MessageBoxIconType type) const
Sets the type of icon that should be used for the dialog box.
static MessageBoxOptions makeOptionsOk(MessageBoxIconType iconType, const String &title, const String &message, const String &buttonText=String(), Component *associatedComponent=nullptr)
Creates options suitable for a message box with a single button.
MessageBoxOptions withAssociatedComponent(Component *component) const
The component that the dialog box should be associated with.
The JUCE String class!
Definition juce_String.h:53
#define TRANS(stringLiteral)
Uses the LocalisedStrings class to translate the given string literal.
JUCE Namespace.
MessageBoxIconType
The type of icon to show in the dialog box.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
Definition juce_Memory.h:88