1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Add MessageBoxOptions class for specifying a set of AlertWindow and NativeMessageBox options

- Add AlertWindow::show() and showAsync() methods that take a MessageBoxOptions argument
  - Add NativeMessageBox::show() and showAsync() methods that take a MessageBoxOptions argument
  - Update the DialogsDemo to demonstrate the new methods
  - Deprecate AlertWindow::showNativeDialogBox() in favour of the NativeMessageBox methods
  - Pass button strings specified in MesssageBoxOptions to native dialog boxes correctly
  - Use modern TaskDialog on Windows for the native dialog box where available
This commit is contained in:
ed 2021-07-21 16:34:12 +01:00
parent 89ca17cf34
commit 551d7b9c5b
54 changed files with 1357 additions and 595 deletions

View file

@ -407,7 +407,7 @@ void LookAndFeel_V2::drawDrawableButton (Graphics& g, DrawableButton& button,
//==============================================================================
AlertWindow* LookAndFeel_V2::createAlertWindow (const String& title, const String& message,
const String& button1, const String& button2, const String& button3,
AlertWindow::AlertIconType iconType,
MessageBoxIconType iconType,
int numButtons, Component* associatedComponent)
{
AlertWindow* aw = new AlertWindow (title, message, iconType, associatedComponent);
@ -457,13 +457,13 @@ void LookAndFeel_V2::drawAlertBox (Graphics& g, AlertWindow& alert,
const Rectangle<int> iconRect (iconSize / -10, iconSize / -10,
iconSize, iconSize);
if (alert.getAlertType() != AlertWindow::NoIcon)
if (alert.getAlertType() != MessageBoxIconType::NoIcon)
{
Path icon;
uint32 colour;
char character;
if (alert.getAlertType() == AlertWindow::WarningIcon)
if (alert.getAlertType() == MessageBoxIconType::WarningIcon)
{
colour = 0x55ff5555;
character = '!';
@ -476,8 +476,8 @@ void LookAndFeel_V2::drawAlertBox (Graphics& g, AlertWindow& alert,
}
else
{
colour = alert.getAlertType() == AlertWindow::InfoIcon ? (uint32) 0x605555ff : (uint32) 0x40b69900;
character = alert.getAlertType() == AlertWindow::InfoIcon ? 'i' : '?';
colour = alert.getAlertType() == MessageBoxIconType::InfoIcon ? (uint32) 0x605555ff : (uint32) 0x40b69900;
character = alert.getAlertType() == MessageBoxIconType::InfoIcon ? 'i' : '?';
icon.addEllipse (iconRect.toFloat());
}

View file

@ -67,7 +67,7 @@ public:
const String& button1,
const String& button2,
const String& button3,
AlertWindow::AlertIconType iconType,
MessageBoxIconType iconType,
int numButtons, Component* associatedComponent) override;
void drawAlertBox (Graphics&, AlertWindow&, const Rectangle<int>& textArea, TextLayout&) override;

View file

@ -385,7 +385,7 @@ void LookAndFeel_V4::changeToggleButtonWidthToFitText (ToggleButton& button)
//==============================================================================
AlertWindow* LookAndFeel_V4::createAlertWindow (const String& title, const String& message,
const String& button1, const String& button2, const String& button3,
AlertWindow::AlertIconType iconType,
MessageBoxIconType iconType,
int numButtons, Component* associatedComponent)
{
auto boundsOffset = 50;
@ -429,13 +429,13 @@ void LookAndFeel_V4::drawAlertBox (Graphics& g, AlertWindow& alert,
Rectangle<int> iconRect (iconSize / -10, iconSize / -10,
iconSize, iconSize);
if (alert.getAlertType() != AlertWindow::NoIcon)
if (alert.getAlertType() != MessageBoxIconType::NoIcon)
{
Path icon;
char character;
uint32 colour;
if (alert.getAlertType() == AlertWindow::WarningIcon)
if (alert.getAlertType() == MessageBoxIconType::WarningIcon)
{
character = '!';
@ -449,7 +449,7 @@ void LookAndFeel_V4::drawAlertBox (Graphics& g, AlertWindow& alert,
else
{
colour = Colour (0xff00b0b9).withAlpha (0.4f).getARGB();
character = alert.getAlertType() == AlertWindow::InfoIcon ? 'i' : '?';
character = alert.getAlertType() == MessageBoxIconType::InfoIcon ? 'i' : '?';
icon.addEllipse (iconRect.toFloat());
}

View file

@ -130,7 +130,7 @@ public:
const String& button1,
const String& button2,
const String& button3,
AlertWindow::AlertIconType iconType,
MessageBoxIconType iconType,
int numButtons, Component* associatedComponent) override;
void drawAlertBox (Graphics&, AlertWindow&, const Rectangle<int>& textArea, TextLayout&) override;