JUCE

- Main Page
- Related Pages
- Topics
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
MessageBoxOptions Class Reference
juce_gui_basics » windows

Class used to create a set of options to pass to the AlertWindow and NativeMessageBox methods for showing dialog boxes. More...

`#include <juce_MessageBoxOptions.h>`

## Public Member Functions
| MessageBoxOptions ()=default
| MessageBoxOptions (const MessageBoxOptions &)=default
MessageBoxOptions & | operator= (const MessageBoxOptions &)=default
MessageBoxOptions | withIconType (MessageBoxIconType type) const
| Sets the type of icon that should be used for the dialog box.
MessageBoxOptions | withTitle (const String &boxTitle) const
| Sets the title of the dialog box.
MessageBoxOptions | withMessage (const String &boxMessage) const
| Sets the message that should be displayed in 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 text.
MessageBoxOptions | withAssociatedComponent (Component *component) const
| The component that the dialog box should be associated with.
MessageBoxOptions | withParentComponent (Component *component) const
| The component that will contain the message box (e.g.
MessageBoxIconType | getIconType () const noexcept
| Returns the icon type of the dialog box.
String | getTitle () const
| Returns the title of the dialog box.
String | getMessage () const
| Returns the message of the dialog box.
int | getNumButtons () const noexcept
| Returns the number of buttons that have been added to the dialog box.
String | getButtonText (int buttonIndex) const
| Returns the text that has been set for one of the buttons of the dialog box.
Component * | getAssociatedComponent () const noexcept
| Returns the component that the dialog box is associated with.
Component * | getParentComponent () const noexcept
| Returns the component that will be used as the parent of the dialog box.

## Static Public Member Functions
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.
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.
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.
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.

## Detailed Description

Class used to create a set of options to pass to the AlertWindow and NativeMessageBox methods for showing dialog boxes.

You can chain together a series of calls to this class's methods to create a set of whatever options you want to specify.

E.g.

AlertWindow::showAsync (MessageBoxOptions()
.withIconType (MessageBoxIconType::InfoIcon)
.withTitle ("A Title")
.withMessage ("A message.")
.withButton ("OK")
.withButton ("Cancel")
.withAssociatedComponent (myComp),
myCallback);
AlertWindow::showAsync
static void JUCE_CALLTYPE showAsync(const MessageBoxOptions &options, ModalComponentManager::Callback *callback)
Shows a dialog box using the specified options.
MessageBoxOptions::withButton
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...
Definition juce_MessageBoxOptions.h:86
MessageBoxOptions::withIconType
MessageBoxOptions withIconType(MessageBoxIconType type) const
Sets the type of icon that should be used for the dialog box.
Definition juce_MessageBoxOptions.h:72
MessageBoxOptions::withTitle
MessageBoxOptions withTitle(const String &boxTitle) const
Sets the title of the dialog box.
Definition juce_MessageBoxOptions.h:75
MessageBoxOptions::withAssociatedComponent
MessageBoxOptions withAssociatedComponent(Component *component) const
The component that the dialog box should be associated with.
Definition juce_MessageBoxOptions.h:89
MessageBoxOptions::withMessage
MessageBoxOptions withMessage(const String &boxMessage) const
Sets the message that should be displayed in the dialog box.
Definition juce_MessageBoxOptions.h:78
MessageBoxOptions::MessageBoxOptions
MessageBoxOptions()=default
MessageBoxIconType::InfoIcon
@ InfoIcon
An icon that indicates that the dialog box is just giving the user some information,...

## Constructor & Destructor Documentation

## ◆ MessageBoxOptions() [1/2]

MessageBoxOptions::MessageBoxOptions | ( |  | ) |
| default

## ◆ MessageBoxOptions() [2/2]

MessageBoxOptions::MessageBoxOptions | ( | const MessageBoxOptions & |  | ) |
| default

## Member Function Documentation

## ◆ operator=()

MessageBoxOptions & MessageBoxOptions::operator= | ( | const MessageBoxOptions & |  | ) |
| default

## ◆ withIconType()

MessageBoxOptions MessageBoxOptions::withIconType | ( | MessageBoxIconType | type | ) | const

Sets the type of icon that should be used for the dialog box.

References withMember().

## ◆ withTitle()

MessageBoxOptions MessageBoxOptions::withTitle | ( | const String & | boxTitle | ) | const

Sets the title of the dialog box.

References withMember().

## ◆ withMessage()

MessageBoxOptions MessageBoxOptions::withMessage | ( | const String & | boxMessage | ) | const

Sets the message that should be displayed in the dialog box.

References withMember().

## ◆ withButton()

MessageBoxOptions 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 text.

Generally up to 3 buttons are supported for dialog boxes, so adding any more than this may have no effect.

## ◆ withAssociatedComponent()

MessageBoxOptions MessageBoxOptions::withAssociatedComponent | ( | Component * | component | ) | const

The component that the dialog box should be associated with.

References withMember().

## ◆ withParentComponent()

MessageBoxOptions MessageBoxOptions::withParentComponent | ( | Component * | component | ) | const

The component that will contain the message box (e.g.

the AudioProcessorEditor in a plugin).

This will only affect JUCE AlertWindows. It won't affect the drawing of native message boxes. This is mainly intended for use in AU plugins, where opening additional windows can be problematic.

References withMember().

## ◆ getIconType()

MessageBoxIconType MessageBoxOptions::getIconType | ( |  | ) | const
| noexcept

Returns the icon type of the dialog box.

See also
  withIconType

## ◆ getTitle()

String MessageBoxOptions::getTitle | ( |  | ) | const

Returns the title of the dialog box.

See also
  withTitle

## ◆ getMessage()

String MessageBoxOptions::getMessage | ( |  | ) | const

Returns the message of the dialog box.

See also
  withMessage

## ◆ getNumButtons()

int MessageBoxOptions::getNumButtons | ( |  | ) | const
| noexcept

Returns the number of buttons that have been added to the dialog box.

See also
  withButtonText

## ◆ getButtonText()

String MessageBoxOptions::getButtonText | ( | int | buttonIndex | ) | const

Returns the text that has been set for one of the buttons of the dialog box.

See also
  withButtonText, getNumButtons

## ◆ getAssociatedComponent()

Component * MessageBoxOptions::getAssociatedComponent | ( |  | ) | const
| noexcept

Returns the component that the dialog box is associated with.

See also
  withAssociatedComponent

## ◆ getParentComponent()

Component * MessageBoxOptions::getParentComponent | ( |  | ) | const
| noexcept

Returns the component that will be used as the parent of the dialog box.

See also
  withParentComponent

## ◆ makeOptionsOk()

static MessageBoxOptions MessageBoxOptions::makeOptionsOk | ( | MessageBoxIconType | iconType,
|  | const String & | title,
|  | const String & | message,
|  | const String & | buttonText = String(),
|  | Component * | associatedComponent = nullptr )
| static

Creates options suitable for a message box with a single button.

If no button text is supplied, "OK" will be used.

Referenced by StandalonePluginHolder::askUserToLoadState(), and StandalonePluginHolder::askUserToSaveState().

## ◆ makeOptionsOkCancel()

static MessageBoxOptions MessageBoxOptions::makeOptionsOkCancel | ( | MessageBoxIconType | iconType,
|  | const String & | title,
|  | const String & | message,
|  | const String & | button1Text = String(),
|  | const String & | button2Text = String(),
|  | Component * | associatedComponent = nullptr )
| static

Creates options suitable for a message box with two buttons.

If no button text is supplied, "OK" and "Cancel" will be used.

## ◆ makeOptionsYesNo()

static MessageBoxOptions MessageBoxOptions::makeOptionsYesNo | ( | MessageBoxIconType | iconType,
|  | const String & | title,
|  | const String & | message,
|  | const String & | button1Text = String(),
|  | const String & | button2Text = String(),
|  | Component * | associatedComponent = nullptr )
| static

Creates options suitable for a message box with two buttons.

If no button text is supplied, "Yes" and "No" will be used.

## ◆ makeOptionsYesNoCancel()

static MessageBoxOptions 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 )
| static

Creates options suitable for a message box with three buttons.

If no button text is supplied, "Yes", "No", and "Cancel" will be used.

The documentation for this class was generated from the following file:

- juce_MessageBoxOptions.h