Browse Source

Added LookAndFeel getAlertWindowButtonWidth method to override the width of alert buttons

tags/2021-05-28
hogliux 9 years ago
parent
commit
1c2d1479b4
4 changed files with 11 additions and 1 deletions
  1. +5
    -0
      modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.cpp
  2. +2
    -0
      modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.h
  3. +3
    -1
      modules/juce_gui_basics/windows/juce_AlertWindow.cpp
  4. +1
    -0
      modules/juce_gui_basics/windows/juce_AlertWindow.h

+ 5
- 0
modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.cpp View File

@@ -489,6 +489,11 @@ int LookAndFeel_V2::getAlertBoxWindowFlags()
| ComponentPeer::windowHasDropShadow;
}
int LookAndFeel_V2::getAlertWindowButtonWidth (TextButton& b)
{
return getTextButtonWidthToFitText (b, getAlertWindowButtonHeight());
}
int LookAndFeel_V2::getAlertWindowButtonHeight()
{
return 28;


+ 2
- 0
modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.h View File

@@ -66,6 +66,8 @@ public:
void drawAlertBox (Graphics&, AlertWindow&, const Rectangle<int>& textArea, TextLayout&) override;
int getAlertBoxWindowFlags() override;
int getAlertWindowButtonWidth (TextButton&) override;
int getAlertWindowButtonHeight() override;
/** Override this function to supply a custom font for the alert window title.


+ 3
- 1
modules/juce_gui_basics/windows/juce_AlertWindow.cpp View File

@@ -98,7 +98,9 @@ void AlertWindow::addButton (const String& name,
b->addShortcut (shortcutKey1);
b->addShortcut (shortcutKey2);
b->addListener (this);
b->changeWidthToFitText (getLookAndFeel().getAlertWindowButtonHeight());
b->setSize (getLookAndFeel().getAlertWindowButtonWidth (*b),
getLookAndFeel().getAlertWindowButtonHeight());
addAndMakeVisible (b, 0);


+ 1
- 0
modules/juce_gui_basics/windows/juce_AlertWindow.h View File

@@ -435,6 +435,7 @@ public:
virtual int getAlertBoxWindowFlags() = 0;
virtual int getAlertWindowButtonWidth (TextButton&) = 0;
virtual int getAlertWindowButtonHeight() = 0;
virtual Font getAlertWindowTitleFont() = 0;


Loading…
Cancel
Save