implement NS_THEME_TOOLBAR_SEPARATOR, also patch outliner to support it. r=bryner,smfr/sr=blake/a=shaver. bug#127722

This commit is contained in:
pinkerton%netscape.com 2002-02-25 22:14:55 +00:00
Родитель 4ff667aa6a
Коммит d6b4794602
8 изменённых файлов: 94 добавлений и 274 удалений

Просмотреть файл

@ -514,7 +514,15 @@ void
nsNativeThemeMac::DrawTabPanel ( const Rect& inBoxRect, PRBool inIsDisabled ) nsNativeThemeMac::DrawTabPanel ( const Rect& inBoxRect, PRBool inIsDisabled )
{ {
ThemeDrawState drawState = inIsDisabled ? kThemeStateActive : kThemeStateDisabled; ThemeDrawState drawState = inIsDisabled ? kThemeStateActive : kThemeStateDisabled;
::DrawThemeTabPane(&inBoxRect, kThemeStateActive); ::DrawThemeTabPane(&inBoxRect, drawState);
}
void
nsNativeThemeMac::DrawSeparator ( const Rect& inBoxRect, PRBool inIsDisabled )
{
ThemeDrawState drawState = inIsDisabled ? kThemeStateActive : kThemeStateDisabled;
::DrawThemeSeparator(&inBoxRect, drawState);
} }
@ -705,6 +713,9 @@ nsNativeThemeMac::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame*
DrawButton ( kThemePushButton, macRect, IsDefaultButton(aFrame), IsDisabled(aFrame), DrawButton ( kThemePushButton, macRect, IsDefaultButton(aFrame), IsDisabled(aFrame),
kThemeButtonOn, kThemeAdornmentNone, eventState ); kThemeButtonOn, kThemeAdornmentNone, eventState );
break; break;
case NS_THEME_TOOLBAR_SEPARATOR:
DrawSeparator ( macRect, IsDisabled(aFrame) );
break;
case NS_THEME_TOOLBAR: case NS_THEME_TOOLBAR:
case NS_THEME_TOOLBOX: case NS_THEME_TOOLBOX:
@ -1093,6 +1104,7 @@ nsNativeThemeMac::ThemeSupportsWidget(nsIPresContext* aPresContext,
case NS_THEME_PROGRESSBAR_VERTICAL: case NS_THEME_PROGRESSBAR_VERTICAL:
case NS_THEME_PROGRESSBAR_CHUNK: case NS_THEME_PROGRESSBAR_CHUNK:
case NS_THEME_PROGRESSBAR_CHUNK_VERTICAL: case NS_THEME_PROGRESSBAR_CHUNK_VERTICAL:
case NS_THEME_TOOLBAR_SEPARATOR:
case NS_THEME_LISTBOX: case NS_THEME_LISTBOX:

Просмотреть файл

@ -109,6 +109,7 @@ protected:
void DrawTab ( const Rect& inBoxRect, PRBool inIsDisabled, PRBool inIsFrontmost, void DrawTab ( const Rect& inBoxRect, PRBool inIsDisabled, PRBool inIsFrontmost,
PRBool inIsHorizontal, PRBool inTabBottom, PRInt32 inState ) ; PRBool inIsHorizontal, PRBool inTabBottom, PRInt32 inState ) ;
void DrawTabPanel ( const Rect& inBoxRect, PRBool inIsDisabled ) ; void DrawTabPanel ( const Rect& inBoxRect, PRBool inIsDisabled ) ;
void DrawSeparator ( const Rect& inBoxRect, PRBool inIsDisabled ) ;
// void DrawScrollArrows ( const Rect& inScrollbarRect, PRBool inIsDisabled, PRInt32 inWidget, PRInt32 inState ) ; // void DrawScrollArrows ( const Rect& inScrollbarRect, PRBool inIsDisabled, PRInt32 inWidget, PRInt32 inState ) ;
void DrawButton ( ThemeButtonKind inKind, const Rect& inBoxRect, PRBool inIsDefault, void DrawButton ( ThemeButtonKind inKind, const Rect& inBoxRect, PRBool inIsDefault,

Просмотреть файл

@ -2041,31 +2041,45 @@ NS_IMETHODIMP nsOutlinerBodyFrame::PaintRow(int aRowIndex, const nsRect& aRowRec
// Resolve style for the separator. // Resolve style for the separator.
nsCOMPtr<nsIStyleContext> separatorContext; nsCOMPtr<nsIStyleContext> separatorContext;
GetPseudoStyleContext(nsXULAtoms::mozoutlinerseparator, getter_AddRefs(separatorContext)); GetPseudoStyleContext(nsXULAtoms::mozoutlinerseparator, getter_AddRefs(separatorContext));
PRBool useTheme = PR_FALSE;
// Get border style nsCOMPtr<nsITheme> theme;
const nsStyleBorder* borderStyle = (const nsStyleBorder*)separatorContext->GetStyleData(eStyleStruct_Border); const nsStyleDisplay* displayData = (const nsStyleDisplay*)separatorContext->GetStyleData(eStyleStruct_Display);
if ( displayData->mAppearance ) {
aRenderingContext.PushState(); aPresContext->GetTheme(getter_AddRefs(theme));
if (theme && theme->ThemeSupportsWidget(aPresContext, displayData->mAppearance))
PRUint8 side = NS_SIDE_TOP; useTheme = PR_TRUE;
nscoord currY = rowRect.y + rowRect.height / 2;
for (PRInt32 i = 0; i < 2; i++) {
nscolor color;
PRBool transparent; PRBool foreground;
borderStyle->GetBorderColor(side, color, transparent, foreground);
aRenderingContext.SetColor(color);
PRUint8 style;
style = borderStyle->GetBorderStyle(side);
aRenderingContext.SetLineStyle(ConvertBorderStyleToLineStyle(style));
aRenderingContext.DrawLine(rowRect.x, currY, rowRect.x + rowRect.width, currY);
side = NS_SIDE_BOTTOM;
currY += 16;
} }
PRBool clipState; // use -moz-appearance if provided.
aRenderingContext.PopState(clipState); if ( useTheme )
theme->DrawWidgetBackground(&aRenderingContext, this,
displayData->mAppearance, rowRect, aDirtyRect);
else {
// Get border style
const nsStyleBorder* borderStyle = (const nsStyleBorder*)separatorContext->GetStyleData(eStyleStruct_Border);
aRenderingContext.PushState();
PRUint8 side = NS_SIDE_TOP;
nscoord currY = rowRect.y + rowRect.height / 2;
for (PRInt32 i = 0; i < 2; i++) {
nscolor color;
PRBool transparent; PRBool foreground;
borderStyle->GetBorderColor(side, color, transparent, foreground);
aRenderingContext.SetColor(color);
PRUint8 style;
style = borderStyle->GetBorderStyle(side);
aRenderingContext.SetLineStyle(ConvertBorderStyleToLineStyle(style));
aRenderingContext.DrawLine(rowRect.x, currY, rowRect.x + rowRect.width, currY);
side = NS_SIDE_BOTTOM;
currY += 16;
}
PRBool clipState;
aRenderingContext.PopState(clipState);
}
} }
else { else {
// Now loop over our cells. Only paint a cell if it intersects with our dirty rect. // Now loop over our cells. Only paint a cell if it intersects with our dirty rect.

Просмотреть файл

@ -2041,31 +2041,45 @@ NS_IMETHODIMP nsOutlinerBodyFrame::PaintRow(int aRowIndex, const nsRect& aRowRec
// Resolve style for the separator. // Resolve style for the separator.
nsCOMPtr<nsIStyleContext> separatorContext; nsCOMPtr<nsIStyleContext> separatorContext;
GetPseudoStyleContext(nsXULAtoms::mozoutlinerseparator, getter_AddRefs(separatorContext)); GetPseudoStyleContext(nsXULAtoms::mozoutlinerseparator, getter_AddRefs(separatorContext));
PRBool useTheme = PR_FALSE;
// Get border style nsCOMPtr<nsITheme> theme;
const nsStyleBorder* borderStyle = (const nsStyleBorder*)separatorContext->GetStyleData(eStyleStruct_Border); const nsStyleDisplay* displayData = (const nsStyleDisplay*)separatorContext->GetStyleData(eStyleStruct_Display);
if ( displayData->mAppearance ) {
aRenderingContext.PushState(); aPresContext->GetTheme(getter_AddRefs(theme));
if (theme && theme->ThemeSupportsWidget(aPresContext, displayData->mAppearance))
PRUint8 side = NS_SIDE_TOP; useTheme = PR_TRUE;
nscoord currY = rowRect.y + rowRect.height / 2;
for (PRInt32 i = 0; i < 2; i++) {
nscolor color;
PRBool transparent; PRBool foreground;
borderStyle->GetBorderColor(side, color, transparent, foreground);
aRenderingContext.SetColor(color);
PRUint8 style;
style = borderStyle->GetBorderStyle(side);
aRenderingContext.SetLineStyle(ConvertBorderStyleToLineStyle(style));
aRenderingContext.DrawLine(rowRect.x, currY, rowRect.x + rowRect.width, currY);
side = NS_SIDE_BOTTOM;
currY += 16;
} }
PRBool clipState; // use -moz-appearance if provided.
aRenderingContext.PopState(clipState); if ( useTheme )
theme->DrawWidgetBackground(&aRenderingContext, this,
displayData->mAppearance, rowRect, aDirtyRect);
else {
// Get border style
const nsStyleBorder* borderStyle = (const nsStyleBorder*)separatorContext->GetStyleData(eStyleStruct_Border);
aRenderingContext.PushState();
PRUint8 side = NS_SIDE_TOP;
nscoord currY = rowRect.y + rowRect.height / 2;
for (PRInt32 i = 0; i < 2; i++) {
nscolor color;
PRBool transparent; PRBool foreground;
borderStyle->GetBorderColor(side, color, transparent, foreground);
aRenderingContext.SetColor(color);
PRUint8 style;
style = borderStyle->GetBorderStyle(side);
aRenderingContext.SetLineStyle(ConvertBorderStyleToLineStyle(style));
aRenderingContext.DrawLine(rowRect.x, currY, rowRect.x + rowRect.width, currY);
side = NS_SIDE_BOTTOM;
currY += 16;
}
PRBool clipState;
aRenderingContext.PopState(clipState);
}
} }
else { else {
// Now loop over our cells. Only paint a cell if it intersects with our dirty rect. // Now loop over our cells. Only paint a cell if it intersects with our dirty rect.

Просмотреть файл

@ -75,6 +75,7 @@
separator.groove, separator.groove,
separator.groove[orient="horizontal"] separator.groove[orient="horizontal"]
{ {
-moz-apperance: separator;
border-top: 1px solid ThreeDShadow; border-top: 1px solid ThreeDShadow;
border-bottom: 1px solid ThreeDHighlight; border-bottom: 1px solid ThreeDHighlight;
height: 0px; height: 0px;
@ -84,6 +85,7 @@
separator.groove[orient="vertical"] separator.groove[orient="vertical"]
{ {
-moz-apperance: separator;
border-left: 1px solid ThreeDShadow; border-left: 1px solid ThreeDShadow;
border-right: 1px solid ThreeDHighlight; border-right: 1px solid ThreeDHighlight;
margin-left: 0.4em; margin-left: 0.4em;
@ -93,6 +95,7 @@
/* groove separators (0 padding, for dividing effects) */ /* groove separators (0 padding, for dividing effects) */
separator.groove-thin separator.groove-thin
{ {
-moz-apperance: separator;
border-top: 1px solid ThreeDShadow; border-top: 1px solid ThreeDShadow;
border-bottom: 1px solid ThreeDHighlight; border-bottom: 1px solid ThreeDHighlight;
height: 0px; height: 0px;
@ -100,6 +103,7 @@
separator[orient="vertical"].groove-thin separator[orient="vertical"].groove-thin
{ {
-moz-apperance: separator;
border-left: 1px solid ThreeDShadow; border-left: 1px solid ThreeDShadow;
border-right: 1px solid ThreeDHighlight; border-right: 1px solid ThreeDHighlight;
} }

Просмотреть файл

@ -202,6 +202,7 @@ menulist > menupopup > menuitem[menuactive="true"][selected="true"],
/* ::::: menuseparator ::::: */ /* ::::: menuseparator ::::: */
menuseparator { menuseparator {
-moz-apperance: separator;
margin: 2px 3px; margin: 2px 3px;
border-top: 1px solid ThreeDShadow; border-top: 1px solid ThreeDShadow;
border-bottom: 1px solid ThreeDHighlight; border-bottom: 1px solid ThreeDHighlight;

Просмотреть файл

@ -1,227 +0,0 @@
/*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Joe Hewitt (hewitt@netscape.com)
*/
/* ===== outliner.css ===================================================
== Styles used by the XUL outline element.
======================================================================= */
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
/* ::::: outliner ::::: */
outliner {
-moz-appearance: treeview;
border: 2px solid;
-moz-border-top-colors: ThreeDShadow ThreeDDarkShadow;
-moz-border-right-colors: ThreeDHighlight ThreeDLightShadow;
-moz-border-bottom-colors: ThreeDHighlight ThreeDLightShadow;
-moz-border-left-colors: ThreeDShadow ThreeDDarkShadow;
background-color: #EEEEEE;
color: -moz-DialogText;
margin: 0px 4px 0px 4px;
}
/* ::::: outliner rows ::::: */
outlinerchildren:-moz-outliner-row {
-moz-appearance: treeitem;
border-top: 1px solid -moz-Field;
height: 18px;
}
outlinerchildren:-moz-outliner-row(selected, focus) {
background-color: Highlight;
}
/* ::::: outliner cells ::::: */
outlinerchildren:-moz-outliner-cell {
padding: 0px 2px 0px 2px;
}
outlinerchildren:-moz-outliner-cell-text {
color: inherit;
}
outlinerchildren:-moz-outliner-cell-text(selected) {
color: -moz-DialogText;
}
outlinerchildren:-moz-outliner-cell-text(selected, focus) {
color: HighlightText;
}
/* ::::: lines connecting cells ::::: */
outlinerchildren:-moz-outliner-line {
/* XXX there should be no border on Mac, but outliners currently
paint the line black by default, so I'll just leave this
for now. */
visibility: hidden;
border: 1px dotted grey;
}
/* ::::: outliner separator ::::: */
outlinerchildren:-moz-outliner-separator {
border-top: 1px solid ThreeDShadow;
border-bottom: 1px solid ThreeDHighlight;
}
/* ::::: drop feedback ::::: */
outlinerchildren:-moz-outliner-cell-text(dropOn) {
background-color: Highlight;
color: HighlightText;
}
outlinerchildren:-moz-outliner-drop-feedback {
background-color: Highlight;
width: 50px;
height: 2px;
margin-left: 5px;
}
outlinerchildren:-moz-outliner-drop-feedback(selected) {
background-color: HighlightText;
}
/* ::::: outliner columns ::::: */
outlinercol,
outlinercolpicker {
-moz-appearance: treeheadercell;
-moz-box-align: center;
-moz-box-pack: center;
border: 2px solid;
-moz-border-top-colors: ThreeDHighlight ThreeDLightShadow;
-moz-border-right-colors: ThreeDDarkShadow ThreeDShadow;
-moz-border-bottom-colors: ThreeDDarkShadow ThreeDShadow;
-moz-border-left-colors: ThreeDHighlight ThreeDLightShadow;
background-color: -moz-Dialog;
color: -moz-DialogText;
padding: 0px 4px;
}
.outlinercol-image {
padding: 0px 1px;
}
.outlinercol-text {
margin: 0px !important;
}
/* ..... internal box ..... */
outlinercol:hover:active,
outlinercolpicker:hover:active {
border-top: 2px solid;
border-right: 1px solid;
border-bottom: 1px solid;
border-left: 2px solid;
-moz-border-top-colors: ThreeDDarkShadow ThreeDShadow;
-moz-border-right-colors: ThreeDDarkShadow;
-moz-border-bottom-colors: ThreeDDarkShadow;
-moz-border-left-colors: ThreeDDarkShadow ThreeDShadow;
background-color: #666666;
color: #FFFFFF;
padding: 1px 4px 0px 5px;
}
.outlinercol-image:hover:active {
padding: 1px 1px 0px 2px;
}
/* ::::: column drag and drop styles ::::: */
outlinercol[dragging="true"] {
-moz-border-top-colors: ThreeDDarkShadow ThreeDShadow !important;
-moz-border-right-colors: ThreeDDarkShadow ThreeDShadow!important;
-moz-border-bottom-colors: ThreeDDarkShadow ThreeDShadow !important;
-moz-border-left-colors: ThreeDDarkShadow ThreeDShadow !important;
padding: 0px 4px !important;
background-color: ThreeDShadow !important;
color: ThreeDHighlight !important;
}
outlinercol[insertafter="true"] {
-moz-border-right-colors: ThreeDDarkShadow ThreeDShadow;
}
outlinercol[insertbefore="true"] {
-moz-border-left-colors: ThreeDDarkShadow ThreeDShadow;
}
outlinerchildren:-moz-outliner-column(insertbefore) {
border-left: 1px solid ThreeDShadow;
}
outlinerchildren:-moz-outliner-column(insertafter) {
border-right: 1px solid ThreeDShadow;
}
/* ::::: sort direction indicator ::::: */
.outlinercol-sortdirection {
-moz-appearance: treeheadersortarrow;
list-style-image: none;
}
.sortDirectionIndicator[sortDirection="ascending"] > .outlinercol-sortdirection {
-moz-appearance: treeheadersortarrow;
list-style-image: url("chrome://global/skin/tree/sort-asc.gif");
}
.sortDirectionIndicator[sortDirection="descending"] > .outlinercol-sortdirection {
-moz-appearance: treeheadersortarrow;
list-style-image: url("chrome://global/skin/tree/sort-dsc.gif");
}
/* ::::: column picker ::::: */
.outliner-columnpicker-icon {
list-style-image: url("chrome://global/skin/tree/columnpicker.gif");
}
/* ::::: twisty ::::: */
outlinerchildren:-moz-outliner-twisty {
-moz-appearance: treetwisty;
padding-right: 2px;
width: 10px; /* The image's width is 10 pixels */
list-style-image: url("chrome://global/skin/tree/twisty-clsd.gif");
}
outlinerchildren:-moz-outliner-twisty(open) {
-moz-appearance: treetwistyopen;
width: 10px; /* The image's width is 10 pixels */
list-style-image: url("chrome://global/skin/tree/twisty-open.gif");
}
outlinerchildren:-moz-outliner-indentation {
width: 16px;
}

Просмотреть файл

@ -106,6 +106,7 @@ toolbargrippy[tbgrippy-collapsed="true"] > .toolbargrippy-texture {
/* ::::: toolbarseparator ::::: */ /* ::::: toolbarseparator ::::: */
toolbarseparator { toolbarseparator {
-moz-appearance : separator;
margin : 2px 0.2em 2px 0.2em; margin : 2px 0.2em 2px 0.2em;
border-right : 1px solid ThreeDHighlight; border-right : 1px solid ThreeDHighlight;
border-left : 1px solid ThreeDShadow; border-left : 1px solid ThreeDShadow;