From 49913fe7995bf3388653517b7e485d441c0a465d Mon Sep 17 00:00:00 2001 From: "pinkerton%netscape.com" Date: Sat, 20 Aug 2005 07:12:42 +0000 Subject: [PATCH] fix case where some pushbuttons were too narrow. r=sdagley/sr=sfraser. bug# 120896 --- widget/src/mac/nsNativeThemeMac.cpp | 15 ++++++++++++--- widget/src/mac/nsNativeThemeMac.h | 9 +++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/widget/src/mac/nsNativeThemeMac.cpp b/widget/src/mac/nsNativeThemeMac.cpp index eb5d8c7715d6..f714888256dd 100644 --- a/widget/src/mac/nsNativeThemeMac.cpp +++ b/widget/src/mac/nsNativeThemeMac.cpp @@ -815,7 +815,8 @@ nsNativeThemeMac::GetWidgetBorder(nsIDeviceContext* aContext, case NS_THEME_BUTTON: if ( OnMacOSX() ) - aResult->SizeTo(14,2,14,2); // 14px left/right endcaps in aqua. + aResult->SizeTo(kAquaPushButtonEndcaps, kAquaPushButtonTopBottom, + kAquaPushButtonEndcaps, kAquaPushButtonTopBottom); else aResult->SizeTo(5,2,5,2); // 5px for AGA break; @@ -826,7 +827,8 @@ nsNativeThemeMac::GetWidgetBorder(nsIDeviceContext* aContext, case NS_THEME_DROPDOWN: if ( OnMacOSX() ) - aResult->SizeTo(9,2,20,2); // 9px left endcaps in aqua, bigger right border for button + aResult->SizeTo(kAquaDropdownLeftEndcap, kAquaPushButtonTopBottom, + kAquaDropwdonRightEndcap, kAquaPushButtonTopBottom); else aResult->SizeTo(3,0,3,0); // 3px for AGA break; @@ -867,6 +869,14 @@ nsNativeThemeMac::GetMinimumWidgetSize(nsIRenderingContext* aContext, nsIFrame* #if TARGET_CARBON switch ( aWidgetType ) { + case NS_THEME_BUTTON: + { + SInt32 buttonHeight = 0; + ::GetThemeMetric(kThemeMetricPushButtonHeight, &buttonHeight); + aResult->SizeTo(kAquaPushButtonEndcaps*2, buttonHeight); + break; + } + case NS_THEME_CHECKBOX: { SInt32 boxHeight = 0, boxWidth = 0; @@ -884,7 +894,6 @@ nsNativeThemeMac::GetMinimumWidgetSize(nsIRenderingContext* aContext, nsIFrame* ::GetThemeMetric(kThemeMetricCheckBoxHeight, &radioHeight); aResult->SizeTo(radioWidth, radioHeight); *aIsOverridable = PR_FALSE; - aResult->SizeTo(18,18); break; } diff --git a/widget/src/mac/nsNativeThemeMac.h b/widget/src/mac/nsNativeThemeMac.h index ad16d55693e8..c7debf828dad 100644 --- a/widget/src/mac/nsNativeThemeMac.h +++ b/widget/src/mac/nsNativeThemeMac.h @@ -75,6 +75,15 @@ public: protected: + // Some widths and margins. You'd think there would be metrics for these, but no. + enum { + kAquaPushButtonEndcaps = 14, + kAquaPushButtonTopBottom = 2, + + kAquaDropdownLeftEndcap = 9, + kAquaDropwdonRightEndcap = 20 // wider on right to encompass the button + }; + nsresult GetSystemColor(PRUint8 aWidgetType, nsILookAndFeel::nsColorID& aColorID); nsresult GetSystemFont(PRUint8 aWidgetType, nsSystemFontID& aFont);