| @@ -489,9 +489,17 @@ int LookAndFeel_V2::getAlertBoxWindowFlags() | |||||
| | ComponentPeer::windowHasDropShadow; | | ComponentPeer::windowHasDropShadow; | ||||
| } | } | ||||
| int LookAndFeel_V2::getAlertWindowButtonWidth (TextButton& b) | |||||
| Array<int> LookAndFeel_V2::getWidthsForTextButtons (AlertWindow&, const Array<TextButton*>& buttons) | |||||
| { | { | ||||
| return getTextButtonWidthToFitText (b, getAlertWindowButtonHeight()); | |||||
| const int n = buttons.size(); | |||||
| Array<int> buttonWidths; | |||||
| const int buttonHeight = getAlertWindowButtonHeight(); | |||||
| for (int i = 0; i < n; ++i) | |||||
| buttonWidths.add (getTextButtonWidthToFitText (*buttons.getReference (i), buttonHeight)); | |||||
| return buttonWidths; | |||||
| } | } | ||||
| int LookAndFeel_V2::getAlertWindowButtonHeight() | int LookAndFeel_V2::getAlertWindowButtonHeight() | ||||
| @@ -67,7 +67,7 @@ public: | |||||
| void drawAlertBox (Graphics&, AlertWindow&, const Rectangle<int>& textArea, TextLayout&) override; | void drawAlertBox (Graphics&, AlertWindow&, const Rectangle<int>& textArea, TextLayout&) override; | ||||
| int getAlertBoxWindowFlags() override; | int getAlertBoxWindowFlags() override; | ||||
| int getAlertWindowButtonWidth (TextButton&) override; | |||||
| Array<int> getWidthsForTextButtons (AlertWindow&, const Array<TextButton*>&) override; | |||||
| int getAlertWindowButtonHeight() override; | int getAlertWindowButtonHeight() override; | ||||
| /** Override this function to supply a custom font for the alert window title. | /** Override this function to supply a custom font for the alert window title. | ||||
| @@ -99,8 +99,17 @@ void AlertWindow::addButton (const String& name, | |||||
| b->addShortcut (shortcutKey2); | b->addShortcut (shortcutKey2); | ||||
| b->addListener (this); | b->addListener (this); | ||||
| b->setSize (getLookAndFeel().getAlertWindowButtonWidth (*b), | |||||
| getLookAndFeel().getAlertWindowButtonHeight()); | |||||
| Array<TextButton*> buttonsArray (buttons.begin(), buttons.size()); | |||||
| const int buttonHeight = getLookAndFeel().getAlertWindowButtonHeight(); | |||||
| const Array<int> buttonWidths = getLookAndFeel().getWidthsForTextButtons (*this, buttonsArray); | |||||
| jassert (buttonWidths.size() == buttons.size()); | |||||
| const int n = buttonWidths.size(); | |||||
| for (int i = 0; i < n; ++i) | |||||
| buttons.getUnchecked (i)->setSize (buttonWidths.getReference (i), buttonHeight); | |||||
| addAndMakeVisible (b, 0); | addAndMakeVisible (b, 0); | ||||
| @@ -435,7 +435,7 @@ public: | |||||
| virtual int getAlertBoxWindowFlags() = 0; | virtual int getAlertBoxWindowFlags() = 0; | ||||
| virtual int getAlertWindowButtonWidth (TextButton&) = 0; | |||||
| virtual Array<int> getWidthsForTextButtons (AlertWindow&, const Array<TextButton*>&) = 0; | |||||
| virtual int getAlertWindowButtonHeight() = 0; | virtual int getAlertWindowButtonHeight() = 0; | ||||
| virtual Font getAlertWindowTitleFont() = 0; | virtual Font getAlertWindowTitleFont() = 0; | ||||