mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
MessageBoxOptions: DRY implementation
This commit is contained in:
parent
d5076cb873
commit
3816b095a8
1 changed files with 5 additions and 13 deletions
|
|
@ -68,13 +68,13 @@ public:
|
|||
|
||||
//==============================================================================
|
||||
/** Sets the type of icon that should be used for the dialog box. */
|
||||
[[nodiscard]] MessageBoxOptions withIconType (MessageBoxIconType type) const { return with (*this, &MessageBoxOptions::iconType, type); }
|
||||
[[nodiscard]] MessageBoxOptions withIconType (MessageBoxIconType type) const { return withMember (*this, &MessageBoxOptions::iconType, type); }
|
||||
|
||||
/** Sets the title of the dialog box. */
|
||||
[[nodiscard]] MessageBoxOptions withTitle (const String& boxTitle) const { return with (*this, &MessageBoxOptions::title, boxTitle); }
|
||||
[[nodiscard]] MessageBoxOptions withTitle (const String& boxTitle) const { return withMember (*this, &MessageBoxOptions::title, boxTitle); }
|
||||
|
||||
/** Sets the message that should be displayed in the dialog box. */
|
||||
[[nodiscard]] MessageBoxOptions withMessage (const String& boxMessage) const { return with (*this, &MessageBoxOptions::message, boxMessage); }
|
||||
[[nodiscard]] MessageBoxOptions withMessage (const String& boxMessage) const { return withMember (*this, &MessageBoxOptions::message, boxMessage); }
|
||||
|
||||
/** If the string passed in is not empty, this will add a button to the
|
||||
dialog box with the specified text.
|
||||
|
|
@ -85,14 +85,14 @@ public:
|
|||
[[nodiscard]] MessageBoxOptions withButton (const String& text) const { auto copy = *this; copy.buttons.add (text); return copy; }
|
||||
|
||||
/** The component that the dialog box should be associated with. */
|
||||
[[nodiscard]] MessageBoxOptions withAssociatedComponent (Component* component) const { return with (*this, &MessageBoxOptions::associatedComponent, component); }
|
||||
[[nodiscard]] MessageBoxOptions withAssociatedComponent (Component* component) const { return withMember (*this, &MessageBoxOptions::associatedComponent, component); }
|
||||
|
||||
/** 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.
|
||||
*/
|
||||
[[nodiscard]] MessageBoxOptions withParentComponent (Component* component) const { return with (*this, &MessageBoxOptions::parentComponent, component); }
|
||||
[[nodiscard]] MessageBoxOptions withParentComponent (Component* component) const { return withMember (*this, &MessageBoxOptions::parentComponent, component); }
|
||||
|
||||
//==============================================================================
|
||||
/** Returns the icon type of the dialog box.
|
||||
|
|
@ -182,14 +182,6 @@ public:
|
|||
Component* associatedComponent = nullptr);
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
template <typename Member, typename Item>
|
||||
static MessageBoxOptions with (MessageBoxOptions options, Member&& member, Item&& item)
|
||||
{
|
||||
options.*member = std::forward<Item> (item);
|
||||
return options;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
MessageBoxIconType iconType = MessageBoxIconType::InfoIcon;
|
||||
String title, message;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue