@@ -367,11 +367,12 @@ void LookAndFeel_V2::drawToggleButton (Graphics& g, ToggleButton& button, | |||||
void LookAndFeel_V2::changeToggleButtonWidthToFitText (ToggleButton& button) | void LookAndFeel_V2::changeToggleButtonWidthToFitText (ToggleButton& button) | ||||
{ | { | ||||
Font font (jmin (15.0f, button.getHeight() * 0.6f)); | |||||
auto fontSize = jmin (15.0f, button.getHeight() * 0.75f); | |||||
auto tickWidth = fontSize * 1.1f; | |||||
const int tickWidth = jmin (24, button.getHeight()); | |||||
Font font (fontSize); | |||||
button.setSize (font.getStringWidth (button.getButtonText()) + tickWidth + 8, | |||||
button.setSize (font.getStringWidth (button.getButtonText()) + roundToInt (tickWidth) + 9, | |||||
button.getHeight()); | button.getHeight()); | ||||
} | } | ||||
@@ -365,6 +365,16 @@ void LookAndFeel_V4::drawTickBox (Graphics& g, Component& component, | |||||
} | } | ||||
} | } | ||||
void LookAndFeel_V4::changeToggleButtonWidthToFitText (ToggleButton& button) | |||||
{ | |||||
auto fontSize = jmin (15.0f, button.getHeight() * 0.75f); | |||||
auto tickWidth = fontSize * 1.1f; | |||||
Font font (fontSize); | |||||
button.setSize (font.getStringWidth (button.getButtonText()) + roundToInt (tickWidth) + 14, button.getHeight()); | |||||
} | |||||
//============================================================================== | //============================================================================== | ||||
AlertWindow* LookAndFeel_V4::createAlertWindow (const String& title, const String& message, | AlertWindow* LookAndFeel_V4::createAlertWindow (const String& title, const String& message, | ||||
const String& button1, const String& button2, const String& button3, | const String& button1, const String& button2, const String& button3, | ||||
@@ -113,6 +113,8 @@ public: | |||||
float x, float y, float w, float h, | float x, float y, float w, float h, | ||||
bool ticked, bool isEnabled, bool isMouseOverButton, bool isButtonDown) override; | bool ticked, bool isEnabled, bool isMouseOverButton, bool isButtonDown) override; | ||||
void changeToggleButtonWidthToFitText (ToggleButton&) override; | |||||
//============================================================================== | //============================================================================== | ||||
AlertWindow* createAlertWindow (const String& title, const String& message, | AlertWindow* createAlertWindow (const String& title, const String& message, | ||||
const String& button1, | const String& button1, | ||||