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
Родитель da10f70d92
Коммит 58fa2f6350
8 изменённых файлов: 95 добавлений и 47 удалений

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

@ -514,7 +514,15 @@ void
nsNativeThemeMac::DrawTabPanel ( const Rect& inBoxRect, PRBool inIsDisabled )
{
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),
kThemeButtonOn, kThemeAdornmentNone, eventState );
break;
case NS_THEME_TOOLBAR_SEPARATOR:
DrawSeparator ( macRect, IsDisabled(aFrame) );
break;
case NS_THEME_TOOLBAR:
case NS_THEME_TOOLBOX:
@ -1093,6 +1104,7 @@ nsNativeThemeMac::ThemeSupportsWidget(nsIPresContext* aPresContext,
case NS_THEME_PROGRESSBAR_VERTICAL:
case NS_THEME_PROGRESSBAR_CHUNK:
case NS_THEME_PROGRESSBAR_CHUNK_VERTICAL:
case NS_THEME_TOOLBAR_SEPARATOR:
case NS_THEME_LISTBOX:

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

@ -109,6 +109,7 @@ protected:
void DrawTab ( const Rect& inBoxRect, PRBool inIsDisabled, PRBool inIsFrontmost,
PRBool inIsHorizontal, PRBool inTabBottom, PRInt32 inState ) ;
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 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.
nsCOMPtr<nsIStyleContext> separatorContext;
GetPseudoStyleContext(nsXULAtoms::mozoutlinerseparator, getter_AddRefs(separatorContext));
// 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 useTheme = PR_FALSE;
nsCOMPtr<nsITheme> theme;
const nsStyleDisplay* displayData = (const nsStyleDisplay*)separatorContext->GetStyleData(eStyleStruct_Display);
if ( displayData->mAppearance ) {
aPresContext->GetTheme(getter_AddRefs(theme));
if (theme && theme->ThemeSupportsWidget(aPresContext, displayData->mAppearance))
useTheme = PR_TRUE;
}
PRBool clipState;
aRenderingContext.PopState(clipState);
// use -moz-appearance if provided.
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 {
// 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.
nsCOMPtr<nsIStyleContext> separatorContext;
GetPseudoStyleContext(nsXULAtoms::mozoutlinerseparator, getter_AddRefs(separatorContext));
// 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 useTheme = PR_FALSE;
nsCOMPtr<nsITheme> theme;
const nsStyleDisplay* displayData = (const nsStyleDisplay*)separatorContext->GetStyleData(eStyleStruct_Display);
if ( displayData->mAppearance ) {
aPresContext->GetTheme(getter_AddRefs(theme));
if (theme && theme->ThemeSupportsWidget(aPresContext, displayData->mAppearance))
useTheme = PR_TRUE;
}
PRBool clipState;
aRenderingContext.PopState(clipState);
// use -moz-appearance if provided.
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 {
// Now loop over our cells. Only paint a cell if it intersects with our dirty rect.

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

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

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

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

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

@ -86,6 +86,7 @@ outlinerchildren:-moz-outliner-line {
/* ::::: outliner separator ::::: */
outlinerchildren:-moz-outliner-separator {
-moz-appearance: separator;
border-top: 1px solid ThreeDShadow;
border-bottom: 1px solid ThreeDHighlight;
}

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

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