Bug 390734 - groupboxes need native theming on Windows. ui-r=faaborg, r+sr=vlad

This commit is contained in:
Robert Strong 2009-03-11 19:11:01 -07:00
parent 7437e2754c
commit 6cfb2b338a
3 changed files with 28 additions and 19 deletions

View File

@ -44,19 +44,11 @@
/* ::::: groupbox ::::: */
groupbox {
margin: 5px;
border: 1px solid ThreeDShadow;
-moz-border-radius: 5px;
padding: 5px;
}
groupbox:-moz-system-metric(windows-classic) {
border-width: 2px;
-moz-border-top-colors: ThreeDShadow ThreeDHighlight;
-moz-border-right-colors: ThreeDHighlight ThreeDShadow;
-moz-border-bottom-colors: ThreeDHighlight ThreeDShadow;
-moz-border-left-colors: ThreeDShadow ThreeDHighlight;
-moz-border-radius: 0px;
-moz-appearance: groupbox;
border: 2px groove ThreeDFace;
-moz-border-radius: 3px;
margin: 3px;
padding: 3px 3px 6px 3px;
}
.groupbox-body {
@ -64,8 +56,7 @@ groupbox:-moz-system-metric(windows-classic) {
}
caption {
margin: 0px 6px 2px 6px;
padding: 0px 3px;
margin: 0px 6px 0px 6px;
background-color: -moz-Dialog;
}
@ -73,9 +64,9 @@ tabpanels caption {
-moz-appearance: tabpanel;
}
/* !important is needed to override label in global.css */
.caption-text {
margin-top: 0;
margin-bottom: 0;
-moz-margin-start: 1px;
-moz-margin-end: 2px;
margin-bottom: 0px !important;
-moz-margin-start: 2px !important;
-moz-margin-end: 2px !important;
}

View File

@ -288,6 +288,7 @@ nsNativeThemeWin::GetTheme(PRUint8 aWidgetType)
case NS_THEME_BUTTON:
case NS_THEME_RADIO:
case NS_THEME_CHECKBOX:
case NS_THEME_GROUPBOX:
return nsUXThemeData::GetTheme(eUXButton);
case NS_THEME_TEXTFIELD:
case NS_THEME_TEXTFIELD_MULTILINE:
@ -455,6 +456,13 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
aState += inputState * 4;
return NS_OK;
}
case NS_THEME_GROUPBOX: {
aPart = BP_GROUPBOX;
aState = TS_NORMAL;
// Since we don't support groupbox disabled and GBS_DISABLED looks the
// same as GBS_NORMAL don't bother supporting GBS_DISABLED.
return NS_OK;
}
case NS_THEME_TEXTFIELD:
case NS_THEME_TEXTFIELD_MULTILINE: {
if (nsUXThemeData::sIsVistaOrLater) {
@ -1738,6 +1746,7 @@ nsNativeThemeWin::ClassicThemeSupportsWidget(nsPresContext* aPresContext,
case NS_THEME_TEXTFIELD_MULTILINE:
case NS_THEME_CHECKBOX:
case NS_THEME_RADIO:
case NS_THEME_GROUPBOX:
case NS_THEME_SCROLLBAR_BUTTON_UP:
case NS_THEME_SCROLLBAR_BUTTON_DOWN:
case NS_THEME_SCROLLBAR_BUTTON_LEFT:
@ -1789,6 +1798,7 @@ nsNativeThemeWin::ClassicGetWidgetBorder(nsIDeviceContext* aContext,
nsIntMargin* aResult)
{
switch (aWidgetType) {
case NS_THEME_GROUPBOX:
case NS_THEME_BUTTON:
(*aResult).top = (*aResult).left = (*aResult).bottom = (*aResult).right = 2;
break;
@ -1917,6 +1927,7 @@ nsNativeThemeWin::ClassicGetMinimumWidgetSize(nsIRenderingContext* aContext, nsI
break;
case NS_THEME_DROPDOWN:
case NS_THEME_BUTTON:
case NS_THEME_GROUPBOX:
case NS_THEME_LISTBOX:
case NS_THEME_TREEVIEW:
case NS_THEME_TEXTFIELD:
@ -2146,6 +2157,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
case NS_THEME_TAB_PANELS:
case NS_THEME_MENUBAR:
case NS_THEME_MENUPOPUP:
case NS_THEME_GROUPBOX:
// these don't use DrawFrameControl
return NS_OK;
case NS_THEME_DROPDOWN_BUTTON: {
@ -2537,6 +2549,10 @@ RENDER_AGAIN:
InflateRect(&widgetRect, -1, -1);
::FillRect(hdc, &widgetRect, ::GetSysColorBrush(COLOR_INFOBK));
break;
case NS_THEME_GROUPBOX:
::DrawEdge(hdc, &widgetRect, EDGE_ETCHED, BF_RECT | BF_ADJUST);
::FillRect(hdc, &widgetRect, (HBRUSH) (COLOR_BTNFACE+1));
break;
// Draw 3D face background controls
case NS_THEME_PROGRESSBAR:
@ -2786,6 +2802,7 @@ nsNativeThemeWin::GetWidgetNativeDrawingFlags(PRUint8 aWidgetType)
// these are definitely no; they're all graphics that don't get scaled up
case NS_THEME_CHECKBOX:
case NS_THEME_RADIO:
case NS_THEME_GROUPBOX:
case NS_THEME_CHECKMENUITEM:
case NS_THEME_RADIOMENUITEM:
case NS_THEME_MENUCHECKBOX:

View File

@ -69,6 +69,7 @@
#define BP_BUTTON 1
#define BP_RADIO 2
#define BP_CHECKBOX 3
#define BP_GROUPBOX 4
// Textfield constants
/* This is the EP_EDITTEXT part */