mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-31 19:10:36 +00:00
twisties, upside down tabs, and tree implementation on mac. Also adding constants for window, menu, and dialog backgrounds XP. bug 115747, r=sdagley/sr=hyatt,sfraser.
This commit is contained in:
parent
341b18d960
commit
e6af3350ab
@ -266,6 +266,7 @@ CSS_KEY(margin-box, margin_box)
|
||||
CSS_KEY(marker, marker)
|
||||
CSS_KEY(medium, medium)
|
||||
CSS_KEY(menu, menu)
|
||||
CSS_KEY(menubar, menubar)
|
||||
CSS_KEY(menutext, menutext)
|
||||
CSS_KEY(message-box, message_box)
|
||||
CSS_KEY(middle, middle)
|
||||
@ -429,6 +430,7 @@ CSS_KEY(listitem, listitem)
|
||||
CSS_KEY(treeview, treeview)
|
||||
CSS_KEY(treeitem, treeitem)
|
||||
CSS_KEY(treetwisty, treetwisty)
|
||||
CSS_KEY(treetwistyopen, treetwistyopen)
|
||||
CSS_KEY(treeline, treeline)
|
||||
CSS_KEY(treeheader, treeheader)
|
||||
CSS_KEY(treeheadercell, treeheadercell)
|
||||
|
@ -145,6 +145,7 @@ const PRInt32 nsCSSProps::kAppearanceKTable[] = {
|
||||
eCSSKeyword_treeview, NS_THEME_TREEVIEW,
|
||||
eCSSKeyword_treeitem, NS_THEME_TREEVIEW_TREEITEM,
|
||||
eCSSKeyword_treetwisty, NS_THEME_TREEVIEW_TWISTY,
|
||||
eCSSKeyword_treetwistyopen, NS_THEME_TREEVIEW_TWISTY_OPEN,
|
||||
eCSSKeyword_treeline, NS_THEME_TREEVIEW_LINE,
|
||||
eCSSKeyword_treeheader, NS_THEME_TREEVIEW_HEADER,
|
||||
eCSSKeyword_treeheadercell, NS_THEME_TREEVIEW_HEADER_CELL,
|
||||
@ -185,6 +186,10 @@ const PRInt32 nsCSSProps::kAppearanceKTable[] = {
|
||||
eCSSKeyword_sliderthumbtick, NS_THEME_SLIDER_TICK,
|
||||
eCSSKeyword_checkboxcontainer, NS_THEME_CHECKBOX_CONTAINER,
|
||||
eCSSKeyword_radiocontainer, NS_THEME_RADIO_CONTAINER,
|
||||
eCSSKeyword_window, NS_THEME_WINDOW,
|
||||
eCSSKeyword_dialog, NS_THEME_DIALOG,
|
||||
eCSSKeyword_menu, NS_THEME_MENU,
|
||||
eCSSKeyword_menubar, NS_THEME_MENUBAR,
|
||||
-1,-1
|
||||
};
|
||||
|
||||
|
@ -71,6 +71,9 @@
|
||||
// The sort arrow for a header.
|
||||
#define NS_THEME_TREEVIEW_HEADER_SORTARROW 47
|
||||
|
||||
// Open tree widget twisty
|
||||
#define NS_THEME_TREEVIEW_TWISTY_OPEN 48
|
||||
|
||||
// A horizontal progress bar.
|
||||
#define NS_THEME_PROGRESSBAR 51
|
||||
|
||||
@ -165,3 +168,11 @@
|
||||
// radio buttons work.
|
||||
#define NS_THEME_CHECKBOX_CONTAINER 200
|
||||
#define NS_THEME_RADIO_CONTAINER 201
|
||||
|
||||
// Window and dialog backgrounds
|
||||
#define NS_THEME_WINDOW 250
|
||||
#define NS_THEME_DIALOG 251
|
||||
|
||||
// Menu and Menu Bar backgrounds
|
||||
#define NS_THEME_MENU 260
|
||||
#define NS_THEME_MENUBAR 261
|
||||
|
@ -179,6 +179,20 @@ CheckBooleanAttr(nsIFrame* aFrame, nsIAtom* aAtom)
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// DoNothing
|
||||
//
|
||||
// An eraseProc for drawing theme buttons so that we don't erase over anything
|
||||
// that might be drawn before us in the background layer. Does absolutely
|
||||
// nothing.
|
||||
//
|
||||
static pascal void
|
||||
DoNothing(const Rect *bounds, UInt32 eraseData, SInt16 depth, Boolean isColorDev)
|
||||
{
|
||||
// be gentle, erase nothing.
|
||||
}
|
||||
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
@ -187,9 +201,12 @@ CheckBooleanAttr(nsIFrame* aFrame, nsIAtom* aAtom)
|
||||
NS_IMPL_ISUPPORTS1(nsNativeThemeMac, nsITheme)
|
||||
|
||||
nsNativeThemeMac::nsNativeThemeMac()
|
||||
: mEraseProc(nsnull)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
|
||||
mEraseProc = NewThemeEraseUPP(DoNothing);
|
||||
|
||||
mCheckedAtom = do_GetAtom("checked");
|
||||
mDisabledAtom = do_GetAtom("disabled");
|
||||
mSelectedAtom = do_GetAtom("selected");
|
||||
@ -200,11 +217,14 @@ nsNativeThemeMac::nsNativeThemeMac()
|
||||
mCurPosAtom = do_GetAtom("curpos");
|
||||
mMaxPosAtom = do_GetAtom("maxpos");
|
||||
mScrollbarAtom = do_GetAtom("scrollbar");
|
||||
mClassAtom = do_GetAtom("class");
|
||||
mSortDirectionAtom = do_GetAtom("sortDirection");
|
||||
}
|
||||
|
||||
nsNativeThemeMac::~nsNativeThemeMac()
|
||||
{
|
||||
|
||||
if ( mEraseProc )
|
||||
::DisposeThemeEraseUPP(mEraseProc);
|
||||
}
|
||||
|
||||
|
||||
@ -237,6 +257,40 @@ nsNativeThemeMac::IsSelected(nsIFrame* aFrame)
|
||||
}
|
||||
|
||||
|
||||
PRBool
|
||||
nsNativeThemeMac::IsSortedColumn(nsIFrame* aFrame)
|
||||
{
|
||||
// if the "sortDirection" attribute is set, we're the sorted column
|
||||
nsCAutoString mode;
|
||||
if ( GetAttribute(aFrame, mSortDirectionAtom, mode) )
|
||||
return !mode.IsEmpty();
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PRBool
|
||||
nsNativeThemeMac::IsSortReversed(nsIFrame* aFrame)
|
||||
{
|
||||
nsCAutoString mode;
|
||||
if ( GetAttribute(aFrame, mSortDirectionAtom, mode) )
|
||||
return mode.Equals("descending");
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PRBool
|
||||
nsNativeThemeMac::DoTabsPointUp(nsIFrame* aFrame)
|
||||
{
|
||||
nsCAutoString mode;
|
||||
if ( GetAttribute(aFrame, mClassAtom, mode) )
|
||||
return mode.Find("tab-bottom") != kNotFound;
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
PRBool
|
||||
nsNativeThemeMac::IsIndeterminate(nsIFrame* aFrame)
|
||||
{
|
||||
@ -270,17 +324,25 @@ nsNativeThemeMac::GetScrollbarParent(nsIFrame* inButton, nsPoint* outOffset)
|
||||
// |scrollbar|. If not, keep going up the chain.
|
||||
nsCOMPtr<nsIContent> content;
|
||||
currFrame->GetContent(getter_AddRefs(content));
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
content->GetTag(*getter_AddRefs(tag));
|
||||
if ( tag == mScrollbarAtom )
|
||||
found = PR_TRUE;
|
||||
NS_ASSERTION(content, "Couldn't get content from frame, are we in a scrollbar?");
|
||||
if ( content ) {
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
content->GetTag(*getter_AddRefs(tag));
|
||||
if ( tag == mScrollbarAtom )
|
||||
found = PR_TRUE;
|
||||
else {
|
||||
// drat, add to our offset and check the parent
|
||||
nsPoint offsetFromParent;
|
||||
currFrame->GetOrigin(offsetFromParent);
|
||||
*outOffset += offsetFromParent;
|
||||
|
||||
currFrame->GetParent(&currFrame);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// drat, add to our offset and check the parent
|
||||
nsPoint offsetFromParent;
|
||||
currFrame->GetOrigin(offsetFromParent);
|
||||
*outOffset += offsetFromParent;
|
||||
|
||||
currFrame->GetParent(&currFrame);
|
||||
// hrm, no content, we're probably not in a scrollbar. just bail
|
||||
currFrame = nsnull;
|
||||
found = PR_TRUE;
|
||||
}
|
||||
} while ( !found && currFrame );
|
||||
|
||||
@ -359,7 +421,8 @@ nsNativeThemeMac::DrawRadio ( const Rect& inBoxRect, PRBool inChecked, PRBool in
|
||||
|
||||
void
|
||||
nsNativeThemeMac::DrawButton ( ThemeButtonKind inKind, const Rect& inBoxRect, PRBool inIsDefault,
|
||||
PRBool inDisabled, PRInt32 inState )
|
||||
PRBool inDisabled, ThemeButtonValue inValue, ThemeButtonAdornment inAdornment,
|
||||
PRInt32 inState )
|
||||
{
|
||||
ThemeButtonDrawInfo info;
|
||||
if ( inDisabled )
|
||||
@ -367,14 +430,14 @@ nsNativeThemeMac::DrawButton ( ThemeButtonKind inKind, const Rect& inBoxRect, PR
|
||||
else
|
||||
info.state = ((inState & NS_EVENT_STATE_ACTIVE) && (inState & NS_EVENT_STATE_HOVER)) ?
|
||||
kThemeStatePressed : kThemeStateActive;
|
||||
info.value = kThemeButtonOn;
|
||||
info.adornment = kThemeAdornmentNone;
|
||||
info.value = inValue;
|
||||
info.adornment = inAdornment;
|
||||
if ( inState & NS_EVENT_STATE_FOCUS )
|
||||
info.adornment = kThemeAdornmentFocus;
|
||||
if ( inIsDefault )
|
||||
info.adornment |= kThemeAdornmentDefault;
|
||||
|
||||
::DrawThemeButton ( &inBoxRect, inKind, &info, nsnull, nsnull, nsnull, 0L );
|
||||
::DrawThemeButton ( &inBoxRect, inKind, &info, nsnull, mEraseProc, nsnull, 0L );
|
||||
}
|
||||
|
||||
|
||||
@ -446,7 +509,7 @@ nsNativeThemeMac::DrawTabPanel ( const Rect& inBoxRect, PRBool inIsDisabled )
|
||||
|
||||
void
|
||||
nsNativeThemeMac::DrawTab ( const Rect& inBoxRect, PRBool inIsDisabled, PRBool inIsFrontmost,
|
||||
PRBool inIsHorizontal, PRInt32 inState )
|
||||
PRBool inIsHorizontal, PRBool inTabBottom, PRInt32 inState )
|
||||
{
|
||||
ThemeTabStyle style = 0L;
|
||||
if ( inIsFrontmost ) {
|
||||
@ -464,7 +527,8 @@ nsNativeThemeMac::DrawTab ( const Rect& inBoxRect, PRBool inIsDisabled, PRBool i
|
||||
style = kThemeTabNonFront;
|
||||
}
|
||||
|
||||
::DrawThemeTab(&inBoxRect, style, kThemeTabNorth, nsnull, 0L);
|
||||
ThemeTabDirection direction = inTabBottom ? kThemeTabSouth : kThemeTabNorth; // don't yet support vertical tabs
|
||||
::DrawThemeTab(&inBoxRect, style, direction, nsnull, 0L);
|
||||
}
|
||||
|
||||
|
||||
@ -587,6 +651,18 @@ nsNativeThemeMac::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame*
|
||||
|
||||
switch ( aWidgetType ) {
|
||||
|
||||
case NS_THEME_DIALOG:
|
||||
printf("!!! draw dialog bg\n");
|
||||
::SetThemeBackground(kThemeBrushDialogBackgroundActive, 24, true);
|
||||
::EraseRect(&macRect);
|
||||
break;
|
||||
|
||||
case NS_THEME_MENU:
|
||||
printf("!!! draw menu bg\n");
|
||||
::SetThemeBackground(kThemeBrushDialogBackgroundActive, 24, true);
|
||||
::EraseRect(&macRect);
|
||||
break;
|
||||
|
||||
case NS_THEME_CHECKBOX:
|
||||
DrawCheckbox ( macRect, IsChecked(aFrame), IsDisabled(aFrame), eventState );
|
||||
break;
|
||||
@ -594,10 +670,12 @@ nsNativeThemeMac::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame*
|
||||
DrawRadio ( macRect, IsSelected(aFrame), IsDisabled(aFrame), eventState );
|
||||
break;
|
||||
case NS_THEME_BUTTON:
|
||||
DrawButton ( kThemePushButton, macRect, IsDefaultButton(aFrame), IsDisabled(aFrame), eventState );
|
||||
DrawButton ( kThemePushButton, macRect, IsDefaultButton(aFrame), IsDisabled(aFrame),
|
||||
kThemeButtonOn, kThemeAdornmentNone, eventState );
|
||||
break;
|
||||
case NS_THEME_TOOLBAR_BUTTON:
|
||||
DrawButton ( kThemePushButton, macRect, IsDefaultButton(aFrame), IsDisabled(aFrame), eventState );
|
||||
DrawButton ( kThemePushButton, macRect, IsDefaultButton(aFrame), IsDisabled(aFrame),
|
||||
kThemeButtonOn, kThemeAdornmentNone, eventState );
|
||||
break;
|
||||
|
||||
case NS_THEME_TOOLBAR:
|
||||
@ -607,7 +685,8 @@ nsNativeThemeMac::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame*
|
||||
break;
|
||||
|
||||
case NS_THEME_DROPDOWN:
|
||||
DrawButton ( kThemePopupButton, macRect, IsDefaultButton(aFrame), IsDisabled(aFrame), eventState );
|
||||
DrawButton ( kThemePopupButton, macRect, IsDefaultButton(aFrame), IsDisabled(aFrame),
|
||||
kThemeButtonOn, kThemeAdornmentNone, eventState );
|
||||
break;
|
||||
case NS_THEME_DROPDOWN_BUTTON:
|
||||
// do nothing, this is covered by the DROPDOWN case
|
||||
@ -629,9 +708,31 @@ nsNativeThemeMac::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame*
|
||||
break;
|
||||
|
||||
case NS_THEME_TREEVIEW_TWISTY:
|
||||
DrawButton ( kThemeDisclosureButton, macRect, PR_FALSE, IsDisabled(aFrame), eventState );
|
||||
DrawButton ( kThemeDisclosureButton, macRect, PR_FALSE, IsDisabled(aFrame),
|
||||
kThemeDisclosureRight, kThemeAdornmentNone, eventState );
|
||||
break;
|
||||
|
||||
case NS_THEME_TREEVIEW_TWISTY_OPEN:
|
||||
DrawButton ( kThemeDisclosureButton, macRect, PR_FALSE, IsDisabled(aFrame),
|
||||
kThemeDisclosureDown, kThemeAdornmentNone, eventState );
|
||||
break;
|
||||
case NS_THEME_TREEVIEW_HEADER_CELL:
|
||||
DrawButton ( kThemeListHeaderButton, macRect, PR_FALSE, IsDisabled(aFrame),
|
||||
IsSortedColumn(aFrame) ? kThemeButtonOn : kThemeButtonOff,
|
||||
IsSortReversed(aFrame) ? kThemeAdornmentHeaderButtonSortUp : kThemeAdornmentNone,
|
||||
eventState );
|
||||
break;
|
||||
case NS_THEME_TREEVIEW_TREEITEM:
|
||||
case NS_THEME_TREEVIEW:
|
||||
::EraseRect ( &macRect );
|
||||
break;
|
||||
case NS_THEME_TREEVIEW_HEADER:
|
||||
// do nothing, taken care of by individual header cells
|
||||
case NS_THEME_TREEVIEW_HEADER_SORTARROW:
|
||||
// do nothing, taken care of by treeview header
|
||||
case NS_THEME_TREEVIEW_LINE:
|
||||
// do nothing, these lines don't exist on macos
|
||||
break;
|
||||
|
||||
#if 0
|
||||
case NS_THEME_SCROLLBAR:
|
||||
break;
|
||||
@ -681,9 +782,8 @@ nsNativeThemeMac::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame*
|
||||
break;
|
||||
|
||||
case NS_THEME_TAB:
|
||||
DrawTab(macRect, IsDisabled(aFrame), IsSelected(aFrame), PR_TRUE, eventState);
|
||||
break;
|
||||
|
||||
DrawTab(macRect, IsDisabled(aFrame), IsSelected(aFrame), PR_TRUE, DoTabsPointUp(aFrame), eventState);
|
||||
break;
|
||||
case NS_THEME_TAB_PANELS:
|
||||
DrawTabPanel(macRect, IsDisabled(aFrame));
|
||||
break;
|
||||
@ -784,6 +884,7 @@ nsNativeThemeMac::GetMinimumWidgetSize(nsIRenderingContext* aContext, nsIFrame*
|
||||
::GetThemeMetric(kThemeMetricCheckBoxHeight, &radioHeight);
|
||||
aResult->SizeTo(radioWidth, radioHeight);
|
||||
*aIsOverridable = PR_FALSE;
|
||||
aResult->SizeTo(18,18);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -814,6 +915,7 @@ nsNativeThemeMac::GetMinimumWidgetSize(nsIRenderingContext* aContext, nsIFrame*
|
||||
}
|
||||
|
||||
case NS_THEME_TREEVIEW_TWISTY:
|
||||
case NS_THEME_TREEVIEW_TWISTY_OPEN:
|
||||
{
|
||||
SInt32 twistyHeight = 0, twistyWidth = 0;
|
||||
::GetThemeMetric(kThemeMetricDisclosureButtonWidth, &twistyWidth);
|
||||
@ -823,6 +925,15 @@ nsNativeThemeMac::GetMinimumWidgetSize(nsIRenderingContext* aContext, nsIFrame*
|
||||
break;
|
||||
}
|
||||
|
||||
case NS_THEME_TREEVIEW_HEADER:
|
||||
case NS_THEME_TREEVIEW_HEADER_CELL:
|
||||
{
|
||||
SInt32 headerHeight = 0;
|
||||
::GetThemeMetric(kThemeMetricListHeaderHeight, &headerHeight);
|
||||
aResult->SizeTo(0, headerHeight);
|
||||
break;
|
||||
}
|
||||
|
||||
case NS_THEME_SCROLLBAR:
|
||||
case NS_THEME_SCROLLBAR_BUTTON_UP:
|
||||
case NS_THEME_SCROLLBAR_BUTTON_DOWN:
|
||||
@ -913,6 +1024,10 @@ nsNativeThemeMac::ThemeSupportsWidget(nsIPresContext* aPresContext,
|
||||
PRBool retVal = PR_FALSE;
|
||||
|
||||
switch ( aWidgetType ) {
|
||||
case NS_THEME_DIALOG:
|
||||
case NS_THEME_WINDOW:
|
||||
case NS_THEME_MENU:
|
||||
|
||||
case NS_THEME_CHECKBOX:
|
||||
case NS_THEME_CHECKBOX_CONTAINER:
|
||||
case NS_THEME_RADIO:
|
||||
@ -930,7 +1045,6 @@ nsNativeThemeMac::ThemeSupportsWidget(nsIPresContext* aPresContext,
|
||||
case NS_THEME_PROGRESSBAR_VERTICAL:
|
||||
case NS_THEME_PROGRESSBAR_CHUNK:
|
||||
case NS_THEME_PROGRESSBAR_CHUNK_VERTICAL:
|
||||
case NS_THEME_TREEVIEW_TWISTY:
|
||||
|
||||
case NS_THEME_LISTBOX:
|
||||
|
||||
@ -939,6 +1053,15 @@ nsNativeThemeMac::ThemeSupportsWidget(nsIPresContext* aPresContext,
|
||||
case NS_THEME_TAB_LEFT_EDGE:
|
||||
case NS_THEME_TAB_RIGHT_EDGE:
|
||||
|
||||
case NS_THEME_TREEVIEW_TWISTY:
|
||||
case NS_THEME_TREEVIEW_TWISTY_OPEN:
|
||||
case NS_THEME_TREEVIEW:
|
||||
case NS_THEME_TREEVIEW_HEADER:
|
||||
case NS_THEME_TREEVIEW_HEADER_CELL:
|
||||
case NS_THEME_TREEVIEW_HEADER_SORTARROW:
|
||||
case NS_THEME_TREEVIEW_TREEITEM:
|
||||
case NS_THEME_TREEVIEW_LINE:
|
||||
|
||||
case NS_THEME_SCROLLBAR:
|
||||
case NS_THEME_SCROLLBAR_BUTTON_UP:
|
||||
case NS_THEME_SCROLLBAR_BUTTON_DOWN:
|
||||
|
@ -83,6 +83,9 @@ protected:
|
||||
PRBool IsSelected(nsIFrame* aFrame);
|
||||
PRBool IsDefaultButton(nsIFrame* aFrame);
|
||||
PRBool IsIndeterminate(nsIFrame* aFrame);
|
||||
PRBool IsSortedColumn(nsIFrame* aFrame);
|
||||
PRBool IsSortReversed(nsIFrame* aFrame);
|
||||
PRBool DoTabsPointUp(nsIFrame* aFrame);
|
||||
|
||||
// Appearance Manager drawing routines
|
||||
void DrawCheckbox ( const Rect& inBoxRect, PRBool inChecked, PRBool inDisabled, PRInt32 inState ) ;
|
||||
@ -95,12 +98,12 @@ protected:
|
||||
void DrawFullScrollbar ( const Rect& inScrollbarRect, PRInt32 inWidgetHit, PRInt32 inLineHeight, PRBool inIsDisabled,
|
||||
PRInt32 inMax, PRInt32 inValue, PRInt32 inState ) ;
|
||||
void DrawTab ( const Rect& inBoxRect, PRBool inIsDisabled, PRBool inIsFrontmost,
|
||||
PRBool inIsHorizontal, PRInt32 inState ) ;
|
||||
PRBool inIsHorizontal, PRBool inTabBottom, PRInt32 inState ) ;
|
||||
void DrawTabPanel ( 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,
|
||||
PRBool inDisabled, PRInt32 inState ) ;
|
||||
PRBool inDisabled, ThemeButtonValue inValue, ThemeButtonAdornment inAdornment, PRInt32 inState ) ;
|
||||
void DrawCheckboxRadio ( ThemeButtonKind inKind, const Rect& inBoxRect, PRBool inChecked,
|
||||
PRBool inDisabled, PRInt32 inState ) ;
|
||||
|
||||
@ -110,6 +113,8 @@ protected:
|
||||
|
||||
private:
|
||||
|
||||
ThemeEraseUPP mEraseProc;
|
||||
|
||||
nsCOMPtr<nsIAtom> mCheckedAtom;
|
||||
nsCOMPtr<nsIAtom> mDisabledAtom;
|
||||
nsCOMPtr<nsIAtom> mSelectedAtom;
|
||||
@ -120,4 +125,6 @@ private:
|
||||
nsCOMPtr<nsIAtom> mCurPosAtom;
|
||||
nsCOMPtr<nsIAtom> mMaxPosAtom;
|
||||
nsCOMPtr<nsIAtom> mScrollbarAtom;
|
||||
nsCOMPtr<nsIAtom> mClassAtom;
|
||||
nsCOMPtr<nsIAtom> mSortDirectionAtom;
|
||||
};
|
||||
|
@ -266,6 +266,7 @@ CSS_KEY(margin-box, margin_box)
|
||||
CSS_KEY(marker, marker)
|
||||
CSS_KEY(medium, medium)
|
||||
CSS_KEY(menu, menu)
|
||||
CSS_KEY(menubar, menubar)
|
||||
CSS_KEY(menutext, menutext)
|
||||
CSS_KEY(message-box, message_box)
|
||||
CSS_KEY(middle, middle)
|
||||
@ -429,6 +430,7 @@ CSS_KEY(listitem, listitem)
|
||||
CSS_KEY(treeview, treeview)
|
||||
CSS_KEY(treeitem, treeitem)
|
||||
CSS_KEY(treetwisty, treetwisty)
|
||||
CSS_KEY(treetwistyopen, treetwistyopen)
|
||||
CSS_KEY(treeline, treeline)
|
||||
CSS_KEY(treeheader, treeheader)
|
||||
CSS_KEY(treeheadercell, treeheadercell)
|
||||
|
@ -145,6 +145,7 @@ const PRInt32 nsCSSProps::kAppearanceKTable[] = {
|
||||
eCSSKeyword_treeview, NS_THEME_TREEVIEW,
|
||||
eCSSKeyword_treeitem, NS_THEME_TREEVIEW_TREEITEM,
|
||||
eCSSKeyword_treetwisty, NS_THEME_TREEVIEW_TWISTY,
|
||||
eCSSKeyword_treetwistyopen, NS_THEME_TREEVIEW_TWISTY_OPEN,
|
||||
eCSSKeyword_treeline, NS_THEME_TREEVIEW_LINE,
|
||||
eCSSKeyword_treeheader, NS_THEME_TREEVIEW_HEADER,
|
||||
eCSSKeyword_treeheadercell, NS_THEME_TREEVIEW_HEADER_CELL,
|
||||
@ -185,6 +186,10 @@ const PRInt32 nsCSSProps::kAppearanceKTable[] = {
|
||||
eCSSKeyword_sliderthumbtick, NS_THEME_SLIDER_TICK,
|
||||
eCSSKeyword_checkboxcontainer, NS_THEME_CHECKBOX_CONTAINER,
|
||||
eCSSKeyword_radiocontainer, NS_THEME_RADIO_CONTAINER,
|
||||
eCSSKeyword_window, NS_THEME_WINDOW,
|
||||
eCSSKeyword_dialog, NS_THEME_DIALOG,
|
||||
eCSSKeyword_menu, NS_THEME_MENU,
|
||||
eCSSKeyword_menubar, NS_THEME_MENUBAR,
|
||||
-1,-1
|
||||
};
|
||||
|
||||
|
@ -85,6 +85,7 @@
|
||||
#include "nsOutlinerUtils.h"
|
||||
#include "nsChildIterator.h"
|
||||
#include "nsIScrollableView.h"
|
||||
#include "nsITheme.h"
|
||||
|
||||
#ifdef USE_IMG2
|
||||
#include "imgIRequest.h"
|
||||
@ -1991,10 +1992,29 @@ NS_IMETHODIMP nsOutlinerBodyFrame::PaintRow(int aRowIndex, const nsRect& aRowRec
|
||||
rowRect.Deflate(rowMargin);
|
||||
|
||||
// If the layer is the background layer, we must paint our borders and background for our
|
||||
// row rect.
|
||||
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer)
|
||||
PaintBackgroundLayer(rowContext, aPresContext, aRenderingContext, rowRect, aDirtyRect);
|
||||
|
||||
// row rect. If a -moz-appearance is provided, use theme drawing only if the current row
|
||||
// is not selected (since we draw the selection as part of drawing the background).
|
||||
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) {
|
||||
PRBool useTheme = PR_FALSE;
|
||||
nsCOMPtr<nsITheme> theme;
|
||||
const nsStyleDisplay* displayData = (const nsStyleDisplay*)rowContext->GetStyleData(eStyleStruct_Display);
|
||||
if ( displayData->mAppearance ) {
|
||||
aPresContext->GetTheme(getter_AddRefs(theme));
|
||||
if (theme && theme->ThemeSupportsWidget(aPresContext, displayData->mAppearance))
|
||||
useTheme = PR_TRUE;
|
||||
}
|
||||
PRBool isSelected = PR_FALSE;
|
||||
nsCOMPtr<nsIOutlinerSelection> selection;
|
||||
GetSelection(getter_AddRefs(selection));
|
||||
if ( selection )
|
||||
selection->IsSelected(aRowIndex, &isSelected);
|
||||
if ( useTheme && !isSelected )
|
||||
theme->DrawWidgetBackground(&aRenderingContext, this,
|
||||
displayData->mAppearance, rowRect, aDirtyRect);
|
||||
else
|
||||
PaintBackgroundLayer(rowContext, aPresContext, aRenderingContext, rowRect, aDirtyRect);
|
||||
}
|
||||
|
||||
// Adjust the rect for its border and padding.
|
||||
AdjustForBorderPadding(rowContext, rowRect);
|
||||
|
||||
@ -2255,6 +2275,15 @@ nsOutlinerBodyFrame::PaintTwisty(int aRowIndex,
|
||||
nsCOMPtr<nsIStyleContext> twistyContext;
|
||||
GetPseudoStyleContext(nsXULAtoms::mozoutlinertwisty, getter_AddRefs(twistyContext));
|
||||
|
||||
PRBool useTheme = PR_FALSE;
|
||||
nsCOMPtr<nsITheme> theme;
|
||||
const nsStyleDisplay* twistyDisplayData = (const nsStyleDisplay*)twistyContext->GetStyleData(eStyleStruct_Display);
|
||||
if ( twistyDisplayData->mAppearance ) {
|
||||
aPresContext->GetTheme(getter_AddRefs(theme));
|
||||
if (theme && theme->ThemeSupportsWidget(aPresContext, twistyDisplayData->mAppearance))
|
||||
useTheme = PR_TRUE;
|
||||
}
|
||||
|
||||
// Obtain the margins for the twisty and then deflate our rect by that
|
||||
// amount. The twisty is assumed to be contained within the deflated rect.
|
||||
nsRect twistyRect(aTwistyRect);
|
||||
@ -2266,10 +2295,26 @@ nsOutlinerBodyFrame::PaintTwisty(int aRowIndex,
|
||||
// The twisty rect extends all the way to the end of the cell. This is incorrect. We need to
|
||||
// determine the twisty rect's true width. This is done by examining the style context for
|
||||
// a width first. If it has one, we use that. If it doesn't, we use the image's natural width.
|
||||
// If the image hasn't loaded and if no width is specified, then we just bail.
|
||||
// If the image hasn't loaded and if no width is specified, then we just bail. If there is
|
||||
// a -moz-apperance involved, adjust the rect by the minimum widget size provided by
|
||||
// the theme implementation.
|
||||
nsRect imageSize = GetImageSize(aRowIndex, aColumn->GetID().get(), twistyContext);
|
||||
twistyRect.width = imageSize.width;
|
||||
if ( useTheme ) {
|
||||
nsSize minTwistySize(0,0);
|
||||
PRBool canOverride = PR_TRUE;
|
||||
theme->GetMinimumWidgetSize(&aRenderingContext, this, twistyDisplayData->mAppearance, &minTwistySize, &canOverride);
|
||||
|
||||
// GMWS() returns size in pixels, we need to convert it back to twips
|
||||
float p2t;
|
||||
aPresContext->GetScaledPixelsToTwips(&p2t);
|
||||
minTwistySize.width = NSIntPixelsToTwips(minTwistySize.width, p2t);
|
||||
minTwistySize.height = NSIntPixelsToTwips(minTwistySize.height, p2t);
|
||||
|
||||
if ( twistyRect.width < minTwistySize.width || !canOverride )
|
||||
twistyRect.width = minTwistySize.width;
|
||||
}
|
||||
|
||||
// Subtract out the remaining width. This is done even when we don't actually paint a twisty in
|
||||
// this cell, so that cells in different rows still line up.
|
||||
nsRect copyRect(twistyRect);
|
||||
@ -2283,34 +2328,41 @@ nsOutlinerBodyFrame::PaintTwisty(int aRowIndex,
|
||||
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer)
|
||||
PaintBackgroundLayer(twistyContext, aPresContext, aRenderingContext, twistyRect, aDirtyRect);
|
||||
else if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) {
|
||||
// Time to paint the twisty.
|
||||
// Adjust the rect for its border and padding.
|
||||
AdjustForBorderPadding(twistyContext, twistyRect);
|
||||
AdjustForBorderPadding(twistyContext, imageSize);
|
||||
|
||||
#ifdef USE_IMG2
|
||||
// Get the image for drawing.
|
||||
nsCOMPtr<imgIContainer> image;
|
||||
GetImage(aRowIndex, aColumn->GetID().get(), twistyContext, getter_AddRefs(image));
|
||||
if (image) {
|
||||
nsPoint p(twistyRect.x, twistyRect.y);
|
||||
|
||||
// Center the image. XXX Obey vertical-align style prop?
|
||||
if (imageSize.height < twistyRect.height) {
|
||||
p.y += (twistyRect.height - imageSize.height)/2;
|
||||
float t2p;
|
||||
mPresContext->GetTwipsToPixels(&t2p);
|
||||
if (NSTwipsToIntPixels(twistyRect.height - imageSize.height, t2p)%2 != 0) {
|
||||
float p2t;
|
||||
mPresContext->GetPixelsToTwips(&p2t);
|
||||
p.y -= NSIntPixelsToTwips(1, p2t);
|
||||
}
|
||||
}
|
||||
|
||||
// Paint the image.
|
||||
aRenderingContext.DrawImage(image, &imageSize, &p);
|
||||
if ( useTheme ) {
|
||||
// yeah, i know it says we're drawing a background, but a twisty is really a fg
|
||||
// object since it doesn't have anything that gecko would want to draw over it. Besides,
|
||||
// we have to prevent imagelib from drawing it.
|
||||
theme->DrawWidgetBackground(&aRenderingContext, this,
|
||||
twistyDisplayData->mAppearance, twistyRect, aDirtyRect);
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
// Time to paint the twisty.
|
||||
// Adjust the rect for its border and padding.
|
||||
AdjustForBorderPadding(twistyContext, twistyRect);
|
||||
AdjustForBorderPadding(twistyContext, imageSize);
|
||||
|
||||
// Get the image for drawing.
|
||||
nsCOMPtr<imgIContainer> image;
|
||||
GetImage(aRowIndex, aColumn->GetID().get(), twistyContext, getter_AddRefs(image));
|
||||
if (image) {
|
||||
nsPoint p(twistyRect.x, twistyRect.y);
|
||||
|
||||
// Center the image. XXX Obey vertical-align style prop?
|
||||
if (imageSize.height < twistyRect.height) {
|
||||
p.y += (twistyRect.height - imageSize.height)/2;
|
||||
float t2p;
|
||||
mPresContext->GetTwipsToPixels(&t2p);
|
||||
if (NSTwipsToIntPixels(twistyRect.height - imageSize.height, t2p)%2 != 0) {
|
||||
float p2t;
|
||||
mPresContext->GetPixelsToTwips(&p2t);
|
||||
p.y -= NSIntPixelsToTwips(1, p2t);
|
||||
}
|
||||
}
|
||||
|
||||
// Paint the image.
|
||||
aRenderingContext.DrawImage(image, &imageSize, &p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,6 +85,7 @@
|
||||
#include "nsOutlinerUtils.h"
|
||||
#include "nsChildIterator.h"
|
||||
#include "nsIScrollableView.h"
|
||||
#include "nsITheme.h"
|
||||
|
||||
#ifdef USE_IMG2
|
||||
#include "imgIRequest.h"
|
||||
@ -1991,10 +1992,29 @@ NS_IMETHODIMP nsOutlinerBodyFrame::PaintRow(int aRowIndex, const nsRect& aRowRec
|
||||
rowRect.Deflate(rowMargin);
|
||||
|
||||
// If the layer is the background layer, we must paint our borders and background for our
|
||||
// row rect.
|
||||
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer)
|
||||
PaintBackgroundLayer(rowContext, aPresContext, aRenderingContext, rowRect, aDirtyRect);
|
||||
|
||||
// row rect. If a -moz-appearance is provided, use theme drawing only if the current row
|
||||
// is not selected (since we draw the selection as part of drawing the background).
|
||||
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) {
|
||||
PRBool useTheme = PR_FALSE;
|
||||
nsCOMPtr<nsITheme> theme;
|
||||
const nsStyleDisplay* displayData = (const nsStyleDisplay*)rowContext->GetStyleData(eStyleStruct_Display);
|
||||
if ( displayData->mAppearance ) {
|
||||
aPresContext->GetTheme(getter_AddRefs(theme));
|
||||
if (theme && theme->ThemeSupportsWidget(aPresContext, displayData->mAppearance))
|
||||
useTheme = PR_TRUE;
|
||||
}
|
||||
PRBool isSelected = PR_FALSE;
|
||||
nsCOMPtr<nsIOutlinerSelection> selection;
|
||||
GetSelection(getter_AddRefs(selection));
|
||||
if ( selection )
|
||||
selection->IsSelected(aRowIndex, &isSelected);
|
||||
if ( useTheme && !isSelected )
|
||||
theme->DrawWidgetBackground(&aRenderingContext, this,
|
||||
displayData->mAppearance, rowRect, aDirtyRect);
|
||||
else
|
||||
PaintBackgroundLayer(rowContext, aPresContext, aRenderingContext, rowRect, aDirtyRect);
|
||||
}
|
||||
|
||||
// Adjust the rect for its border and padding.
|
||||
AdjustForBorderPadding(rowContext, rowRect);
|
||||
|
||||
@ -2255,6 +2275,15 @@ nsOutlinerBodyFrame::PaintTwisty(int aRowIndex,
|
||||
nsCOMPtr<nsIStyleContext> twistyContext;
|
||||
GetPseudoStyleContext(nsXULAtoms::mozoutlinertwisty, getter_AddRefs(twistyContext));
|
||||
|
||||
PRBool useTheme = PR_FALSE;
|
||||
nsCOMPtr<nsITheme> theme;
|
||||
const nsStyleDisplay* twistyDisplayData = (const nsStyleDisplay*)twistyContext->GetStyleData(eStyleStruct_Display);
|
||||
if ( twistyDisplayData->mAppearance ) {
|
||||
aPresContext->GetTheme(getter_AddRefs(theme));
|
||||
if (theme && theme->ThemeSupportsWidget(aPresContext, twistyDisplayData->mAppearance))
|
||||
useTheme = PR_TRUE;
|
||||
}
|
||||
|
||||
// Obtain the margins for the twisty and then deflate our rect by that
|
||||
// amount. The twisty is assumed to be contained within the deflated rect.
|
||||
nsRect twistyRect(aTwistyRect);
|
||||
@ -2266,10 +2295,26 @@ nsOutlinerBodyFrame::PaintTwisty(int aRowIndex,
|
||||
// The twisty rect extends all the way to the end of the cell. This is incorrect. We need to
|
||||
// determine the twisty rect's true width. This is done by examining the style context for
|
||||
// a width first. If it has one, we use that. If it doesn't, we use the image's natural width.
|
||||
// If the image hasn't loaded and if no width is specified, then we just bail.
|
||||
// If the image hasn't loaded and if no width is specified, then we just bail. If there is
|
||||
// a -moz-apperance involved, adjust the rect by the minimum widget size provided by
|
||||
// the theme implementation.
|
||||
nsRect imageSize = GetImageSize(aRowIndex, aColumn->GetID().get(), twistyContext);
|
||||
twistyRect.width = imageSize.width;
|
||||
if ( useTheme ) {
|
||||
nsSize minTwistySize(0,0);
|
||||
PRBool canOverride = PR_TRUE;
|
||||
theme->GetMinimumWidgetSize(&aRenderingContext, this, twistyDisplayData->mAppearance, &minTwistySize, &canOverride);
|
||||
|
||||
// GMWS() returns size in pixels, we need to convert it back to twips
|
||||
float p2t;
|
||||
aPresContext->GetScaledPixelsToTwips(&p2t);
|
||||
minTwistySize.width = NSIntPixelsToTwips(minTwistySize.width, p2t);
|
||||
minTwistySize.height = NSIntPixelsToTwips(minTwistySize.height, p2t);
|
||||
|
||||
if ( twistyRect.width < minTwistySize.width || !canOverride )
|
||||
twistyRect.width = minTwistySize.width;
|
||||
}
|
||||
|
||||
// Subtract out the remaining width. This is done even when we don't actually paint a twisty in
|
||||
// this cell, so that cells in different rows still line up.
|
||||
nsRect copyRect(twistyRect);
|
||||
@ -2283,34 +2328,41 @@ nsOutlinerBodyFrame::PaintTwisty(int aRowIndex,
|
||||
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer)
|
||||
PaintBackgroundLayer(twistyContext, aPresContext, aRenderingContext, twistyRect, aDirtyRect);
|
||||
else if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) {
|
||||
// Time to paint the twisty.
|
||||
// Adjust the rect for its border and padding.
|
||||
AdjustForBorderPadding(twistyContext, twistyRect);
|
||||
AdjustForBorderPadding(twistyContext, imageSize);
|
||||
|
||||
#ifdef USE_IMG2
|
||||
// Get the image for drawing.
|
||||
nsCOMPtr<imgIContainer> image;
|
||||
GetImage(aRowIndex, aColumn->GetID().get(), twistyContext, getter_AddRefs(image));
|
||||
if (image) {
|
||||
nsPoint p(twistyRect.x, twistyRect.y);
|
||||
|
||||
// Center the image. XXX Obey vertical-align style prop?
|
||||
if (imageSize.height < twistyRect.height) {
|
||||
p.y += (twistyRect.height - imageSize.height)/2;
|
||||
float t2p;
|
||||
mPresContext->GetTwipsToPixels(&t2p);
|
||||
if (NSTwipsToIntPixels(twistyRect.height - imageSize.height, t2p)%2 != 0) {
|
||||
float p2t;
|
||||
mPresContext->GetPixelsToTwips(&p2t);
|
||||
p.y -= NSIntPixelsToTwips(1, p2t);
|
||||
}
|
||||
}
|
||||
|
||||
// Paint the image.
|
||||
aRenderingContext.DrawImage(image, &imageSize, &p);
|
||||
if ( useTheme ) {
|
||||
// yeah, i know it says we're drawing a background, but a twisty is really a fg
|
||||
// object since it doesn't have anything that gecko would want to draw over it. Besides,
|
||||
// we have to prevent imagelib from drawing it.
|
||||
theme->DrawWidgetBackground(&aRenderingContext, this,
|
||||
twistyDisplayData->mAppearance, twistyRect, aDirtyRect);
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
// Time to paint the twisty.
|
||||
// Adjust the rect for its border and padding.
|
||||
AdjustForBorderPadding(twistyContext, twistyRect);
|
||||
AdjustForBorderPadding(twistyContext, imageSize);
|
||||
|
||||
// Get the image for drawing.
|
||||
nsCOMPtr<imgIContainer> image;
|
||||
GetImage(aRowIndex, aColumn->GetID().get(), twistyContext, getter_AddRefs(image));
|
||||
if (image) {
|
||||
nsPoint p(twistyRect.x, twistyRect.y);
|
||||
|
||||
// Center the image. XXX Obey vertical-align style prop?
|
||||
if (imageSize.height < twistyRect.height) {
|
||||
p.y += (twistyRect.height - imageSize.height)/2;
|
||||
float t2p;
|
||||
mPresContext->GetTwipsToPixels(&t2p);
|
||||
if (NSTwipsToIntPixels(twistyRect.height - imageSize.height, t2p)%2 != 0) {
|
||||
float p2t;
|
||||
mPresContext->GetPixelsToTwips(&p2t);
|
||||
p.y -= NSIntPixelsToTwips(1, p2t);
|
||||
}
|
||||
}
|
||||
|
||||
// Paint the image.
|
||||
aRenderingContext.DrawImage(image, &imageSize, &p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,7 @@
|
||||
/* ::::: dialog ::::: */
|
||||
|
||||
dialog {
|
||||
-moz-appearance: dialog;
|
||||
padding: 8px 10px 10px 8px;
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
menu,
|
||||
menuitem {
|
||||
-moz-appearance: menu !important;
|
||||
-moz-box-align: center;
|
||||
color: MenuText;
|
||||
font: menu;
|
||||
|
@ -30,6 +30,7 @@
|
||||
/* ::::: outliner ::::: */
|
||||
|
||||
outliner {
|
||||
-moz-appearance: tree;
|
||||
border: 2px solid;
|
||||
-moz-border-top-colors: ThreeDShadow ThreeDDarkShadow;
|
||||
-moz-border-right-colors: ThreeDHighlight ThreeDLightShadow;
|
||||
@ -43,6 +44,7 @@ outliner {
|
||||
/* ::::: outliner rows ::::: */
|
||||
|
||||
outlinerchildren:-moz-outliner-row {
|
||||
-moz-appearance: treeitem;
|
||||
border-top: 1px solid -moz-Field;
|
||||
height: 18px;
|
||||
}
|
||||
@ -101,6 +103,7 @@ 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;
|
||||
}
|
||||
|
||||
@ -113,6 +116,7 @@ outlinerchildren:-moz-outliner-separator {
|
||||
|
||||
outlinercol,
|
||||
outlinercolpicker {
|
||||
-moz-appearance: treeheadercell;
|
||||
-moz-box-align: center;
|
||||
-moz-box-pack: center;
|
||||
border: 2px solid;
|
||||
@ -185,14 +189,17 @@ outlinerchildren:-moz-outliner-column(insertafter) {
|
||||
/* ::::: 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");
|
||||
}
|
||||
|
||||
@ -212,7 +219,7 @@ outlinerchildren:-moz-outliner-twisty {
|
||||
}
|
||||
|
||||
outlinerchildren:-moz-outliner-twisty(open) {
|
||||
-moz-appearance: treetwisty;
|
||||
-moz-appearance: treetwistyopen;
|
||||
width: 10px; /* The image's width is 10 pixels */
|
||||
list-style-image: url("chrome://global/skin/tree/twisty-open.gif");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user