Bug 373696 - style toolbar separators natively p=Simon Bunzli (busy) <zeniko@gmail.com> r=emaijala, sr=neil, a=dsicore

This commit is contained in:
asqueella@gmail.com 2007-08-25 13:30:43 -07:00
parent 1947edab7c
commit 855391a157
2 changed files with 27 additions and 7 deletions

View File

@ -86,10 +86,13 @@ toolbar[mode="text"] .toolbarbutton-text {
/* ::::: toolbar decorations ::::: */
toolbarseparator {
margin : 2px 0.2em;
border-right : 1px solid ThreeDHighlight;
border-left : 1px solid ThreeDShadow;
width : 2px;
-moz-appearance: separator;
border-top: 2px solid transparent;
border-bottom: 2px solid transparent;
border-left: 3px solid transparent;
border-right: 3px solid transparent;
-moz-border-left-colors : transparent transparent ThreeDShadow;
-moz-border-right-colors : transparent transparent ThreeDHighlight;
}
toolbarspacer {

View File

@ -85,6 +85,9 @@
#define TKP_FOCUSED 4
#define TKP_DISABLED 5
// Toolbar constants
#define TP_SEPARATOR 5
// Toolbarbutton constants
#define TB_CHECKED 5
#define TB_HOVER_CHECKED 6
@ -461,7 +464,8 @@ nsNativeThemeWin::GetTheme(PRUint8 aWidgetType)
return mRebarTheme;
}
case NS_THEME_TOOLBAR:
case NS_THEME_TOOLBAR_BUTTON: {
case NS_THEME_TOOLBAR_BUTTON:
case NS_THEME_TOOLBAR_SEPARATOR: {
if (!mToolbarTheme)
mToolbarTheme = openTheme(NULL, L"Toolbar");
return mToolbarTheme;
@ -734,6 +738,11 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
return NS_OK;
}
case NS_THEME_TOOLBAR_SEPARATOR: {
aPart = TP_SEPARATOR;
aState = TS_NORMAL;
return NS_OK;
}
case NS_THEME_SCROLLBAR_BUTTON_UP:
case NS_THEME_SCROLLBAR_BUTTON_DOWN:
case NS_THEME_SCROLLBAR_BUTTON_LEFT:
@ -1312,7 +1321,8 @@ nsNativeThemeWin::GetWidgetBorder(nsIDeviceContext* aContext,
aWidgetType == NS_THEME_SCROLLBAR_TRACK_VERTICAL ||
aWidgetType == NS_THEME_MENUITEM || aWidgetType == NS_THEME_CHECKMENUITEM ||
aWidgetType == NS_THEME_RADIOMENUITEM || aWidgetType == NS_THEME_MENUPOPUP ||
aWidgetType == NS_THEME_MENUIMAGE || aWidgetType == NS_THEME_MENUITEMTEXT)
aWidgetType == NS_THEME_MENUIMAGE || aWidgetType == NS_THEME_MENUITEMTEXT ||
aWidgetType == NS_THEME_TOOLBAR_SEPARATOR)
return NS_OK; // Don't worry about it.
if (!getThemeContentRect)
@ -1513,6 +1523,12 @@ nsNativeThemeWin::GetMinimumWidgetSize(nsIRenderingContext* aContext, nsIFrame*
aWidgetType == NS_THEME_SCALE_THUMB_VERTICAL) {
*aIsOverridable = PR_FALSE;
}
else if (aWidgetType == NS_THEME_TOOLBAR_SEPARATOR) {
// that's 2px left margin, 2px right margin and 2px separator
// (the margin is drawn as part of the separator, though)
aResult->width = 6;
return NS_OK;
}
PRInt32 part, state;
nsresult rv = GetThemePartAndState(aFrame, aWidgetType, part, state);
@ -1563,7 +1579,8 @@ nsNativeThemeWin::WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType,
aWidgetType == NS_THEME_PROGRESSBAR_VERTICAL ||
aWidgetType == NS_THEME_TOOLTIP ||
aWidgetType == NS_THEME_TAB_PANELS ||
aWidgetType == NS_THEME_TAB_PANEL) {
aWidgetType == NS_THEME_TAB_PANEL ||
aWidgetType == NS_THEME_TOOLBAR_SEPARATOR) {
*aShouldRepaint = PR_FALSE;
return NS_OK;
}