зеркало из https://github.com/mozilla/pjs.git
removing unneeded/unused code/methods
r=kmcclusk, sr=waterson
This commit is contained in:
Родитель
a02d40ce21
Коммит
db9c828730
|
@ -205,8 +205,13 @@ nsFileControlFrame::GetType(PRInt32* aType) const
|
|||
void
|
||||
nsFileControlFrame::SetFocus(PRBool aOn, PRBool aRepaint)
|
||||
{
|
||||
// Fix for Bug 6133
|
||||
if (mTextFrame) {
|
||||
mTextFrame->SetFocus(aOn, aRepaint);
|
||||
nsCOMPtr<nsIContent> content;
|
||||
mTextFrame->GetContent(getter_AddRefs(content));
|
||||
if (content) {
|
||||
content->SetFocus(mPresContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -290,7 +295,7 @@ nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent)
|
|||
currentFile->GetUnicodeLeafName(&leafName);
|
||||
if (leafName) {
|
||||
filePicker->SetDefaultString(leafName);
|
||||
//nsAllocator::Free(leafName);
|
||||
nsMemory::Free(leafName);
|
||||
}
|
||||
|
||||
// set directory
|
||||
|
@ -316,12 +321,12 @@ nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent)
|
|||
nsCOMPtr<nsILocalFile> localFile;
|
||||
result = filePicker->GetFile(getter_AddRefs(localFile));
|
||||
if (localFile) {
|
||||
PRUnichar *nativePath;
|
||||
PRUnichar *nativePath = nsnull;
|
||||
result = localFile->GetUnicodePath(&nativePath);
|
||||
if (nativePath) {
|
||||
nsAutoString pathName(nativePath);
|
||||
mTextFrame->SetProperty(mPresContext, nsHTMLAtoms::value, pathName);
|
||||
//nsAllocator::Free(nativePath);
|
||||
nsMemory::Free(nativePath);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -379,35 +379,6 @@ nsFormControlFrame::GetScrollbarWidth(float aPixToTwip)
|
|||
return NSIntPixelsToTwips(19, aPixToTwip); // XXX this is windows
|
||||
}
|
||||
|
||||
nscoord
|
||||
nsFormControlFrame::GetVerticalBorderWidth(float aPixToTwip) const
|
||||
{
|
||||
return NSIntPixelsToTwips(3, aPixToTwip);
|
||||
}
|
||||
|
||||
nscoord
|
||||
nsFormControlFrame::GetHorizontalBorderWidth(float aPixToTwip) const
|
||||
{
|
||||
return GetVerticalBorderWidth(aPixToTwip);
|
||||
}
|
||||
|
||||
nscoord
|
||||
nsFormControlFrame::GetVerticalInsidePadding(nsIPresContext* aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerHeight) const
|
||||
{
|
||||
return NSIntPixelsToTwips(3, aPixToTwip);
|
||||
}
|
||||
|
||||
nscoord
|
||||
nsFormControlFrame::GetHorizontalInsidePadding(nsIPresContext* aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerWidth,
|
||||
nscoord aCharWidth) const
|
||||
{
|
||||
return GetVerticalInsidePadding(aPresContext, aPixToTwip, aInnerWidth);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsFormControlFrame::GetMaxNumValues()
|
||||
{
|
||||
|
|
|
@ -177,15 +177,7 @@ public:
|
|||
// XXX similar functionality needs to be added to widget library and these
|
||||
// need to change to use it.
|
||||
static nscoord GetScrollbarWidth(float aPixToTwip);
|
||||
virtual nscoord GetVerticalBorderWidth(float aPixToTwip) const;
|
||||
virtual nscoord GetHorizontalBorderWidth(float aPixToTwip) const;
|
||||
virtual nscoord GetVerticalInsidePadding(nsIPresContext* aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerHeight) const;
|
||||
virtual nscoord GetHorizontalInsidePadding(nsIPresContext* aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerWidth,
|
||||
nscoord aCharWidth) const;
|
||||
|
||||
virtual nsresult GetSizeFromContent(PRInt32* aSize) const;
|
||||
NS_IMETHOD GetMaxLength(PRInt32* aSize);
|
||||
|
||||
|
|
|
@ -563,32 +563,6 @@ nsFormControlHelper::CalculateSize (nsIPresContext* aPresContext,
|
|||
}
|
||||
}
|
||||
|
||||
nsWidgetRendering mode;
|
||||
aPresContext->GetWidgetRenderingMode(&mode);
|
||||
|
||||
// only add in padding if we are not Gfx, or if we're a Gfx text widget
|
||||
PRBool requiresWidget = PR_FALSE;
|
||||
aFrame->RequiresWidget(requiresWidget);
|
||||
PRInt32 type;
|
||||
aFrame->GetType(&type);
|
||||
|
||||
if (PR_TRUE == requiresWidget || eWidgetRendering_Native == mode ||
|
||||
type==NS_FORM_INPUT_TEXT || type==NS_FORM_TEXTAREA || type==NS_FORM_INPUT_PASSWORD)
|
||||
{
|
||||
if (!aWidthExplicit && mode == eWidgetRendering_Native) {
|
||||
//if (!aWidthExplicit) {
|
||||
PRInt32 hPadding = (2 * aFrame->GetHorizontalInsidePadding(aPresContext, p2t, aDesiredSize.width, charWidth));
|
||||
aDesiredSize.width += hPadding;
|
||||
aMinSize.width += hPadding;
|
||||
}
|
||||
if (!aHeightExplicit && mode == eWidgetRendering_Native) {
|
||||
//if (!aHeightExplicit) {
|
||||
PRInt32 vPadding = (2 * aFrame->GetVerticalInsidePadding(aPresContext, p2t, aRowHeight));
|
||||
aDesiredSize.height += vPadding;
|
||||
aMinSize.height += vPadding;
|
||||
}
|
||||
}
|
||||
|
||||
NS_RELEASE(hContent);
|
||||
if (ATTR_NOTSET == numRows) {
|
||||
numRows = (aRowHeight > 0) ? (aDesiredSize.height / aRowHeight) : 0;
|
||||
|
@ -718,17 +692,6 @@ nsFormControlHelper::PaintLine(nsIRenderingContext& aRenderingContext,
|
|||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
// Offset for arrow centerpoint
|
||||
static const nscoord nsArrowOffsetX = 3;
|
||||
static const nscoord nsArrowOffsetY = 3;
|
||||
static nscoord nsArrowRightPoints[] = {0, 0, 0, 6, 6, 3 };
|
||||
static nscoord nsArrowLeftPoints[] = {0, 3, 6, 0, 6, 6 };
|
||||
static nscoord nsArrowUpPoints[] = {3, 0, 6, 6, 0, 6 };
|
||||
static nscoord nsArrowDownPoints[] = {0, 0, 3, 6, 6, 0 };
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void
|
||||
nsFormControlHelper::SetupPoints(PRUint32 aNumberOfPoints, nscoord* aPoints, nsPoint* aPolygon, nscoord aScaleFactor, nscoord aX, nscoord aY,
|
||||
|
@ -748,135 +711,6 @@ nsFormControlHelper::SetupPoints(PRUint32 aNumberOfPoints, nscoord* aPoints, nsP
|
|||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void
|
||||
nsFormControlHelper::PaintArrowGlyph(nsIRenderingContext& aRenderingContext,
|
||||
nscoord aSX, nscoord aSY, nsArrowDirection aArrowDirection,
|
||||
nscoord aOnePixel)
|
||||
{
|
||||
nsPoint polygon[3];
|
||||
|
||||
switch(aArrowDirection)
|
||||
{
|
||||
case eArrowDirection_Left:
|
||||
SetupPoints(3, nsArrowLeftPoints, polygon, aOnePixel, aSX, aSY, nsArrowOffsetX, nsArrowOffsetY);
|
||||
break;
|
||||
|
||||
case eArrowDirection_Right:
|
||||
SetupPoints(3, nsArrowRightPoints, polygon, aOnePixel, aSX, aSY, nsArrowOffsetX, nsArrowOffsetY);
|
||||
break;
|
||||
|
||||
case eArrowDirection_Up:
|
||||
SetupPoints(3, nsArrowUpPoints, polygon, aOnePixel, aSX, aSY, nsArrowOffsetX, nsArrowOffsetY);
|
||||
break;
|
||||
|
||||
case eArrowDirection_Down:
|
||||
SetupPoints(3, nsArrowDownPoints, polygon, aOnePixel, aSX, aSY, nsArrowOffsetX, nsArrowOffsetY);
|
||||
break;
|
||||
}
|
||||
|
||||
aRenderingContext.FillPolygon(polygon, 3);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void
|
||||
nsFormControlHelper::PaintArrow(nsArrowDirection aArrowDirection,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
nsIPresContext* aPresContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsRect& aRect,
|
||||
nscoord aOnePixel,
|
||||
nsIStyleContext* aArrowStyle,
|
||||
const nsStyleSpacing& aSpacing,
|
||||
nsIFrame* aForFrame,
|
||||
nsRect& aFrameRect)
|
||||
{
|
||||
// Draw border using CSS
|
||||
const nsStyleColor* color = (const nsStyleColor*)
|
||||
aArrowStyle->GetStyleData(eStyleStruct_Color);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, aRect, *color, aSpacing, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, aRect, aSpacing, aArrowStyle, 0);
|
||||
|
||||
// Draw the glyph in black
|
||||
aRenderingContext.SetColor(NS_RGB(0, 0, 0));
|
||||
// Draw arrow centered in the rectangle
|
||||
PaintArrowGlyph(aRenderingContext, aRect.x + (aRect.width / 2), aRect.y + (aRect.height / 2), aArrowDirection, aOnePixel);
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void
|
||||
nsFormControlHelper::PaintScrollbar(nsIRenderingContext& aRenderingContext,
|
||||
nsIPresContext* aPresContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsRect& aRect,
|
||||
PRBool aHorizontal,
|
||||
nscoord aOnePixel,
|
||||
nsIStyleContext* aScrollbarStyleContext,
|
||||
nsIStyleContext* aScrollbarArrowStyleContext,
|
||||
nsIFrame* aForFrame,
|
||||
nsRect& aFrameRect)
|
||||
{
|
||||
// Get the Scrollbar's Style structs
|
||||
const nsStyleColor* scrollbarColor =
|
||||
(const nsStyleColor*)aScrollbarStyleContext->GetStyleData(eStyleStruct_Color);
|
||||
|
||||
// Get the Scrollbar's Arrow's Style structs
|
||||
const nsStyleSpacing* arrowSpacing =
|
||||
(const nsStyleSpacing*)aScrollbarArrowStyleContext->GetStyleData(eStyleStruct_Spacing);
|
||||
const nsStyleColor* arrowColor =
|
||||
(const nsStyleColor*)aScrollbarArrowStyleContext->GetStyleData(eStyleStruct_Color);
|
||||
|
||||
// Paint background for scrollbar
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, aRect, *scrollbarColor, *arrowSpacing, 0, 0);
|
||||
|
||||
if (PR_TRUE == aHorizontal) {
|
||||
// Draw horizontal Arrow
|
||||
nscoord arrowWidth = aRect.height;
|
||||
nsRect arrowLeftRect(aRect.x, aRect.y, arrowWidth, arrowWidth);
|
||||
PaintArrow(eArrowDirection_Left,aRenderingContext,aPresContext,
|
||||
aDirtyRect, arrowLeftRect,aOnePixel, aScrollbarArrowStyleContext,
|
||||
*arrowSpacing, aForFrame, aFrameRect);
|
||||
|
||||
nsRect thumbRect(aRect.x+arrowWidth, aRect.y, arrowWidth, arrowWidth);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, thumbRect, *arrowColor, *arrowSpacing, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, thumbRect, *arrowSpacing,aScrollbarArrowStyleContext, 0);
|
||||
|
||||
nsRect arrowRightRect(aRect.x + (aRect.width - arrowWidth), aRect.y, arrowWidth, arrowWidth);
|
||||
PaintArrow(eArrowDirection_Right,aRenderingContext,aPresContext,
|
||||
aDirtyRect, arrowRightRect,aOnePixel, aScrollbarArrowStyleContext,
|
||||
*arrowSpacing, aForFrame, aFrameRect);
|
||||
|
||||
}
|
||||
else {
|
||||
// Paint vertical arrow
|
||||
nscoord arrowHeight = aRect.width;
|
||||
nsRect arrowUpRect(aRect.x, aRect.y, arrowHeight, arrowHeight);
|
||||
PaintArrow(eArrowDirection_Up,aRenderingContext,aPresContext,
|
||||
aDirtyRect, arrowUpRect,aOnePixel, aScrollbarArrowStyleContext,
|
||||
*arrowSpacing, aForFrame, aFrameRect);
|
||||
|
||||
nsRect thumbRect(aRect.x, aRect.y+arrowHeight, arrowHeight, arrowHeight);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, thumbRect, *arrowColor, *arrowSpacing, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, thumbRect, *arrowSpacing,aScrollbarArrowStyleContext, 0);
|
||||
|
||||
nsRect arrowDownRect(aRect.x, aRect.y + (aRect.height - arrowHeight), arrowHeight, arrowHeight);
|
||||
PaintArrow(eArrowDirection_Down,aRenderingContext,aPresContext,
|
||||
aDirtyRect, arrowDownRect,aOnePixel, aScrollbarArrowStyleContext,
|
||||
*arrowSpacing, aForFrame, aFrameRect);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
nsFormControlHelper::PaintFixedSizeCheckMark(nsIRenderingContext& aRenderingContext,
|
||||
float aPixelsToTwips)
|
||||
|
@ -982,319 +816,6 @@ nsFormControlHelper::PaintCheckMark(nsIRenderingContext& aRenderingContext,
|
|||
aRenderingContext.FillPolygon(checkedPolygon, checkpoints);
|
||||
}
|
||||
|
||||
void
|
||||
nsFormControlHelper::PaintFocus(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect, nsRect& aInside, nsRect& aOutside)
|
||||
|
||||
{
|
||||
// draw dashed line to indicate selection, XXX don't calc rect every time
|
||||
PRUint8 borderStyles[4];
|
||||
nscolor borderColors[4];
|
||||
nscolor black = NS_RGB(0,0,0);
|
||||
for (PRInt32 i = 0; i < 4; i++) {
|
||||
borderStyles[i] = NS_STYLE_BORDER_STYLE_DOTTED;
|
||||
borderColors[i] = black;
|
||||
}
|
||||
nsCSSRendering::DrawDashedSides(0, aRenderingContext,aDirtyRect, borderStyles, borderColors, aOutside,
|
||||
aInside, PR_FALSE, nsnull);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsFormControlHelper::PaintRectangularButton(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect, const nsRect& aRect,
|
||||
PRBool aPressed,
|
||||
PRBool aShowFocus,
|
||||
PRBool aDisabled,
|
||||
PRBool aDrawOutline,
|
||||
nsIStyleContext* outlineStyle,
|
||||
nsIStyleContext* focusStyle,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsString& aLabel,
|
||||
nsIFrame* aForFrame)
|
||||
|
||||
{
|
||||
nsIFormControlFrame * formFrame;
|
||||
nsresult result = aForFrame->QueryInterface(kIFormControlFrameIID, (void**)&formFrame);
|
||||
if (NS_OK != result) {
|
||||
NS_RELEASE(formFrame);
|
||||
}
|
||||
|
||||
aRenderingContext.PushState();
|
||||
// Draw border using CSS
|
||||
// Get the Scrollbar's Arrow's Style structs
|
||||
const nsStyleSpacing* spacing =
|
||||
(const nsStyleSpacing*)aStyleContext->GetStyleData(eStyleStruct_Spacing);
|
||||
const nsStyleColor* color =
|
||||
(const nsStyleColor*)aStyleContext->GetStyleData(eStyleStruct_Color);
|
||||
|
||||
|
||||
nsRect rect(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
|
||||
const nsStyleSpacing* outline = (const nsStyleSpacing*)outlineStyle->GetStyleData(eStyleStruct_Spacing);
|
||||
const nsStyleSpacing* focus = (const nsStyleSpacing*)focusStyle->GetStyleData(eStyleStruct_Spacing);
|
||||
|
||||
nsMargin outlineBorder;
|
||||
outline->CalcBorderFor(aForFrame, outlineBorder);
|
||||
|
||||
nsMargin focusBorder;
|
||||
focus->CalcBorderFor(aForFrame, focusBorder);
|
||||
|
||||
int left = (focusBorder.left > outlineBorder.left) ? focusBorder.left : outlineBorder.left;
|
||||
int right = (focusBorder.right > outlineBorder.right) ? focusBorder.right : outlineBorder.right;
|
||||
int top = (focusBorder.top > outlineBorder.top) ? focusBorder.top : outlineBorder.top;
|
||||
int bottom = (focusBorder.bottom > outlineBorder.bottom) ? focusBorder.bottom : outlineBorder.bottom;
|
||||
|
||||
if (aShowFocus) {
|
||||
int l = left - focusBorder.left;
|
||||
int t = top - focusBorder.top;
|
||||
int b = bottom - focusBorder.bottom;
|
||||
int r = right - focusBorder.right;
|
||||
|
||||
int w = aRect.width - (l + r);
|
||||
int h = aRect.height - (t + b);
|
||||
|
||||
nsRect focusRect(l, t, w, h);
|
||||
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, focusRect, *focus, aStyleContext, 0);
|
||||
}
|
||||
|
||||
if (aDrawOutline) {
|
||||
int l = left - outlineBorder.left;
|
||||
int t = top - outlineBorder.top;
|
||||
int b = bottom - outlineBorder.bottom;
|
||||
int r = right - outlineBorder.right;
|
||||
|
||||
int w = aRect.width - (l + r);
|
||||
int h = aRect.height - (t + b);
|
||||
|
||||
nsRect outlineRect(l, t, w, h);
|
||||
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, outlineRect, *outline, aStyleContext, 0);
|
||||
}
|
||||
|
||||
rect.x += left;
|
||||
rect.y += right;
|
||||
rect.width -= (left + right);
|
||||
rect.height -= (top + bottom);
|
||||
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, rect, *color, *spacing, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, rect, *spacing,aStyleContext, 0);
|
||||
|
||||
nsMargin border;
|
||||
spacing->CalcBorderFor(aForFrame, border);
|
||||
|
||||
|
||||
float p2t;
|
||||
aPresContext->GetScaledPixelsToTwips(&p2t);
|
||||
nscoord onePixel = NSIntPixelsToTwips(1, p2t);
|
||||
|
||||
nsRect outside(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
outside.Deflate(border);
|
||||
outside.Deflate(onePixel, onePixel);
|
||||
|
||||
nsRect inside(outside);
|
||||
inside.Deflate(onePixel, onePixel);
|
||||
|
||||
/*
|
||||
if (aShowFocus) {
|
||||
PaintFocus(aRenderingContext,
|
||||
aDirtyRect, inside, outside);
|
||||
}
|
||||
*/
|
||||
|
||||
aRenderingContext.SetColor(NS_RGB(255,255,255));
|
||||
|
||||
float appUnits;
|
||||
float devUnits;
|
||||
float scale;
|
||||
nsIDeviceContext * context;
|
||||
aRenderingContext.GetDeviceContext(context);
|
||||
|
||||
context->GetCanonicalPixelScale(scale);
|
||||
context->GetAppUnitsToDevUnits(devUnits);
|
||||
context->GetDevUnitsToAppUnits(appUnits);
|
||||
|
||||
const nsFont * font = nsnull;
|
||||
nsresult res = formFrame->GetFont(aPresContext, font);
|
||||
if (NS_SUCCEEDED(res) && font != nsnull) {
|
||||
aRenderingContext.SetFont(*font);
|
||||
}
|
||||
|
||||
nscoord ascent;
|
||||
nscoord descent;
|
||||
|
||||
nscoord textWidth;
|
||||
nscoord textHeight;
|
||||
aRenderingContext.GetWidth(aLabel, textWidth);
|
||||
|
||||
nsIFontMetrics* metrics;
|
||||
context->GetMetricsFor(*font, metrics);
|
||||
metrics->GetMaxAscent(ascent);
|
||||
metrics->GetMaxDescent(descent);
|
||||
textHeight = ascent + descent;
|
||||
|
||||
nscoord x = ((inside.width - textWidth) / 2) + inside.x;
|
||||
nscoord y = ((inside.height - textHeight) / 2) + inside.y;
|
||||
if (PR_TRUE == aPressed) {
|
||||
x += onePixel;
|
||||
y += onePixel;
|
||||
}
|
||||
|
||||
if (aDisabled) {
|
||||
aRenderingContext.SetColor(NS_RGB(255,255,255));
|
||||
aRenderingContext.DrawString(aLabel, x+onePixel, y+onePixel);
|
||||
}
|
||||
|
||||
aRenderingContext.SetColor(color->mColor);
|
||||
aRenderingContext.DrawString(aLabel, x, y);
|
||||
|
||||
NS_RELEASE(context);
|
||||
PRBool clipEmpty;
|
||||
aRenderingContext.PopState(clipEmpty);
|
||||
|
||||
NS_RELEASE(formFrame);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsFormControlHelper::GetCircularRect(PRUint32 aWidth, PRUint32 aHeight, nsRect& aRect)
|
||||
{
|
||||
if (aWidth > aHeight)
|
||||
aRect.SetRect((aWidth/2) - (aHeight/2), 0, aHeight, aHeight);
|
||||
else
|
||||
aRect.SetRect(0, (aHeight/2) - (aWidth/2), aWidth, aWidth);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsFormControlHelper::PaintCircularBackground(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect, nsIStyleContext* aStyleContext, PRBool aInset,
|
||||
nsIFrame* aForFrame, PRUint32 aWidth, PRUint32 aHeight)
|
||||
{
|
||||
float p2t;
|
||||
aPresContext->GetScaledPixelsToTwips(&p2t);
|
||||
nscoord onePixel = NSIntPixelsToTwips(1, p2t);
|
||||
|
||||
nsRect outside;
|
||||
nsFormControlHelper::GetCircularRect(aWidth, aHeight, outside);
|
||||
|
||||
outside.Deflate(onePixel, onePixel);
|
||||
outside.Deflate(onePixel, onePixel);
|
||||
const nsStyleColor* color = (const nsStyleColor*)
|
||||
aStyleContext->GetStyleData(eStyleStruct_Color);
|
||||
aRenderingContext.SetColor(color->mBackgroundColor);
|
||||
aRenderingContext.FillArc(outside, 0, 180);
|
||||
aRenderingContext.FillArc(outside, 180, 360);
|
||||
}
|
||||
|
||||
//XXX: TODO Remove this. It is no longer needed since circular borders
|
||||
//are painted by the standard border code by setting a border radius
|
||||
//to 1/2 the width of the border
|
||||
void
|
||||
nsFormControlHelper::PaintCircularBorder(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect, nsIStyleContext* aStyleContext, PRBool aInset,
|
||||
nsIFrame* aForFrame, PRUint32 aWidth, PRUint32 aHeight)
|
||||
{
|
||||
const PRUint32 standardWidth = 180;
|
||||
const PRUint32 standardHeight = 180;
|
||||
|
||||
aRenderingContext.PushState();
|
||||
|
||||
float p2t;
|
||||
aPresContext->GetScaledPixelsToTwips(&p2t);
|
||||
|
||||
const nsStyleSpacing* spacing = (const nsStyleSpacing*)aStyleContext->GetStyleData(eStyleStruct_Spacing);
|
||||
nsMargin border;
|
||||
spacing->CalcBorderFor(aForFrame, border);
|
||||
|
||||
nscoord onePixel = NSIntPixelsToTwips(1, p2t);
|
||||
nscoord twelvePixels = NSIntPixelsToTwips(12, p2t);
|
||||
|
||||
nsRect outside(0, 0, aWidth, aHeight);
|
||||
|
||||
PRBool standardSize = ((aWidth == standardWidth) && (aHeight == standardHeight));
|
||||
if (PR_TRUE == standardSize) {
|
||||
outside.SetRect(0, 0, twelvePixels, twelvePixels);
|
||||
|
||||
if (PR_TRUE == aInset) {
|
||||
outside.Deflate(onePixel, onePixel);
|
||||
outside.Deflate(onePixel, onePixel);
|
||||
aRenderingContext.SetColor(NS_RGB(192,192,192));
|
||||
aRenderingContext.FillArc(outside, 0, 180);
|
||||
aRenderingContext.FillArc(outside, 180, 360);
|
||||
outside.SetRect(0, 0, twelvePixels, twelvePixels);
|
||||
}
|
||||
|
||||
// DrakGray
|
||||
// PRUint8 borderStyle = aBorderStyle.GetBorderStyle(NS_SIDE_TOP),
|
||||
// nscolor borderColor = aBorderStyle.GetBorderColor(NS_SIDE_TOP),
|
||||
|
||||
aRenderingContext.SetColor(NS_RGB(128,128,128));
|
||||
// aRenderingContext.SetColor(borderColor);
|
||||
PaintLine(aRenderingContext, 4, 0, 7, 0, PR_TRUE, 1, onePixel);
|
||||
PaintLine(aRenderingContext, 2, 1, 3, 1, PR_TRUE, 1, onePixel);
|
||||
PaintLine(aRenderingContext, 8, 1, 9, 1, PR_TRUE, 1, onePixel);
|
||||
|
||||
PaintLine(aRenderingContext, 1, 2, 1, 3, PR_FALSE, 1, onePixel);
|
||||
PaintLine(aRenderingContext, 0, 4, 0, 7, PR_FALSE, 1, onePixel);
|
||||
PaintLine(aRenderingContext, 1, 8, 1, 9, PR_FALSE, 1, onePixel);
|
||||
|
||||
// Black
|
||||
// nscolor borderColor = aBorderStyle.GetBorderColor(NS_SIDE_BOTTOM);
|
||||
// aRenderingContext.SetColor(borderColor);
|
||||
aRenderingContext.SetColor(NS_RGB(0,0,0));
|
||||
PaintLine(aRenderingContext, 4, 1, 7, 1, PR_TRUE, 1, onePixel);
|
||||
PaintLine(aRenderingContext, 2, 2, 3, 2, PR_TRUE, 1, onePixel);
|
||||
PaintLine(aRenderingContext, 8, 2, 9, 2, PR_TRUE, 1, onePixel);
|
||||
|
||||
PaintLine(aRenderingContext, 2, 2, 2, 3, PR_FALSE, 1, onePixel);
|
||||
PaintLine(aRenderingContext, 1, 4, 1, 7, PR_FALSE, 1, onePixel);
|
||||
PaintLine(aRenderingContext, 2, 8, 2, 8, PR_FALSE, 1, onePixel);
|
||||
|
||||
// Gray
|
||||
aRenderingContext.SetColor(NS_RGB(192, 192, 192));
|
||||
PaintLine(aRenderingContext, 2, 9, 3, 9, PR_TRUE, 1, onePixel);
|
||||
PaintLine(aRenderingContext, 8, 9, 9, 9, PR_TRUE, 1, onePixel);
|
||||
PaintLine(aRenderingContext, 4, 10, 7, 10, PR_TRUE, 1, onePixel);
|
||||
|
||||
PaintLine(aRenderingContext, 9, 3, 9, 3, PR_FALSE, 1, onePixel);
|
||||
PaintLine(aRenderingContext, 10, 4, 10, 7, PR_FALSE, 1, onePixel);
|
||||
PaintLine(aRenderingContext, 9, 8, 9, 9, PR_FALSE, 1, onePixel);
|
||||
|
||||
outside.Deflate(onePixel, onePixel);
|
||||
outside.Deflate(onePixel, onePixel);
|
||||
outside.Deflate(onePixel, onePixel);
|
||||
outside.Deflate(onePixel, onePixel);
|
||||
} else {
|
||||
nsFormControlHelper::GetCircularRect(aWidth, aHeight, outside);
|
||||
|
||||
aRenderingContext.SetColor(NS_RGB(128,128,128));
|
||||
aRenderingContext.FillArc(outside, 46, 225);
|
||||
aRenderingContext.SetColor(NS_RGB(255,255,255));
|
||||
aRenderingContext.FillArc(outside, 225, 360);
|
||||
aRenderingContext.FillArc(outside, 0, 44);
|
||||
|
||||
outside.Deflate(onePixel, onePixel);
|
||||
aRenderingContext.SetColor(NS_RGB(0,0,0));
|
||||
aRenderingContext.FillArc(outside, 46, 225);
|
||||
aRenderingContext.SetColor(NS_RGB(192,192,192));
|
||||
aRenderingContext.FillArc(outside, 225, 360);
|
||||
aRenderingContext.FillArc(outside, 0, 44);
|
||||
}
|
||||
|
||||
PRBool clip;
|
||||
aRenderingContext.PopState(clip);
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsFormControlHelper::GetName(nsIContent* aContent,nsString* aResult)
|
||||
{
|
||||
|
|
|
@ -157,10 +157,6 @@ public:
|
|||
|
||||
static void GetBoolString(const PRBool aValue, nsAWritableString& aResult);
|
||||
|
||||
// XXX similar functionality needs to be added to widget library and these
|
||||
// need to change to use it.
|
||||
static nscoord GetScrollbarWidth(float aPixToTwip);
|
||||
|
||||
static nsCompatibility GetRepChars(nsIPresContext* aPresContext, char& char1, char& char2);
|
||||
|
||||
// wrap can be one of these three values.
|
||||
|
@ -267,69 +263,6 @@ public:
|
|||
nscoord aSX, nscoord aSY, nscoord aEX, nscoord aEY,
|
||||
PRBool aHorz, nscoord aWidth, nscoord aOnePixel);
|
||||
|
||||
/**
|
||||
* Draw an arrow glyph.
|
||||
*
|
||||
* @param aRenderingContext the rendering context
|
||||
* @param aSX upper left x coordinate pixels
|
||||
* @param aSY upper left y coordinate pixels
|
||||
* @param aType @see nsArrowDirection enumeration
|
||||
* @param aOnePixel number of twips in a single pixel.
|
||||
*/
|
||||
|
||||
static void PaintArrowGlyph(nsIRenderingContext& aRenderingContext,
|
||||
nscoord aSX, nscoord aSY, nsArrowDirection aArrowDirection,
|
||||
nscoord aOnePixel);
|
||||
|
||||
/**
|
||||
* Draw an arrow
|
||||
*
|
||||
* @param aArrowDirection @see nsArrowDirection enumeration
|
||||
* @param aRenderingContext the rendering context
|
||||
* @param aPresContext the presentation context
|
||||
* @param aDirtyRect rectangle requiring update
|
||||
* @param aOnePixel number of TWIPS in a single pixel
|
||||
* @param aColor color of the arrow glph
|
||||
* @param aSpacing spacing for the arrow background
|
||||
* @param aForFrame frame which the arrow will be rendered into.
|
||||
* @param aFrameRect rectangle for the frame specified by aForFrame
|
||||
*/
|
||||
|
||||
static void PaintArrow(nsArrowDirection aArrowDirection,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
nsIPresContext* aPresContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsRect& aRect,
|
||||
nscoord aOnePixel,
|
||||
nsIStyleContext* aArrowStyle,
|
||||
const nsStyleSpacing& aSpacing,
|
||||
nsIFrame* aForFrame,
|
||||
nsRect& aFrameRect);
|
||||
/**
|
||||
* Paint a scrollbar
|
||||
*
|
||||
* @param aRenderingContext the rendering context
|
||||
* @param aPresContext the presentation context
|
||||
* @param aDirtyRect rectangle requiring update
|
||||
* @param aRect width and height of the scrollbar
|
||||
* @param aHorizontal if TRUE scrollbar is drawn horizontally, vertical if FALSE
|
||||
* @param aOnePixel number TWIPS per pixel
|
||||
* @param aScrollbarStyleContext style context for the scrollbar
|
||||
* @param aScrollbarArrowStyleContext style context for the scrollbar arrow
|
||||
* @param aForFrame the frame that the scrollbar will be rendered in to
|
||||
* @param aFrameRect the rectangle for the frame passed as aForFrame
|
||||
*/
|
||||
|
||||
static void PaintScrollbar(nsIRenderingContext& aRenderingContext,
|
||||
nsIPresContext* aPresContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsRect& aRect,
|
||||
PRBool aHorizontal,
|
||||
nscoord aOnePixel,
|
||||
nsIStyleContext* aScrollbarStyleContext,
|
||||
nsIStyleContext* aScrollbarArrowStyleContext,
|
||||
nsIFrame* aForFrame,
|
||||
nsRect& aFrameRect);
|
||||
/**
|
||||
* Paint a fixed size checkmark
|
||||
*
|
||||
|
@ -386,68 +319,6 @@ public:
|
|||
nsIStyleContext* aFocusStyle,
|
||||
nsIStyleContext* aStyleContext, nsString& aLabel,
|
||||
nsIFrame* aForFrame);
|
||||
/**
|
||||
* Paint a focus indicator.
|
||||
*
|
||||
* @param aRenderingContext the rendering context
|
||||
* @param aDirtyRect rectangle requiring update
|
||||
* @param aInside border inside
|
||||
* @param aOutside border outside
|
||||
*/
|
||||
|
||||
static void PaintFocus(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect, nsRect& aInside, nsRect& aOutside);
|
||||
|
||||
/**
|
||||
* Get the rectangle for a circular area. To maintain the aspect ratio of the circular
|
||||
* area the rectangle is offset to center the circular area within the width and height
|
||||
* specified.
|
||||
*
|
||||
* @param aWidth width to center within
|
||||
* @param aHeight height to center within
|
||||
* @param aRect the computed rectangle centering the circle by setting the x and y of the rect.
|
||||
*/
|
||||
|
||||
static void GetCircularRect(PRUint32 aWidth, PRUint32 aHeight, nsRect& aRect);
|
||||
|
||||
/**
|
||||
* Paint a circular background
|
||||
*
|
||||
* @param aPresContext the presentation context
|
||||
* @param aRenderingContext the rendering context
|
||||
* @param aDirtyRect rectangle requiring update
|
||||
* @param aStyleContext style context specifying colors and spacing
|
||||
* @param aInset if PR_TRUE draw inset, otherwise draw outset
|
||||
* @param aForFrame the frame that the scrollbar will be rendered in to
|
||||
* @param aWidth width of the border in TWIPS
|
||||
* @param aHeight height ofthe border in TWIPS
|
||||
*/
|
||||
|
||||
static void PaintCircularBackground(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect, nsIStyleContext* aStyleContext, PRBool aInset,
|
||||
nsIFrame* aForFrame, PRUint32 aWidth, PRUint32 aHeight);
|
||||
|
||||
|
||||
/**
|
||||
* Paint a circular border
|
||||
*
|
||||
* @param aPresContext the presentation context
|
||||
* @param aRenderingContext the rendering context
|
||||
* @param aDirtyRect rectangle requiring update
|
||||
* @param aStyleContext style context specifying colors and spacing
|
||||
* @param aInset if PR_TRUE draw inset, otherwise draw outset
|
||||
* @param aForFrame the frame that the scrollbar will be rendered in to
|
||||
* @param aWidth width of the border in TWIPS
|
||||
* @param aHeight height ofthe border in TWIPS
|
||||
*/
|
||||
|
||||
static void PaintCircularBorder(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect, nsIStyleContext* aStyleContext, PRBool aInset,
|
||||
nsIFrame* aForFrame, PRUint32 aWidth, PRUint32 aHeight);
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
nsFormControlHelper();
|
||||
|
|
|
@ -67,15 +67,6 @@ public:
|
|||
|
||||
virtual void SetFormFrame(nsFormFrame* aFrame) = 0;
|
||||
|
||||
virtual nscoord GetVerticalInsidePadding(nsIPresContext* aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerHeight) const = 0;
|
||||
virtual nscoord GetHorizontalInsidePadding(nsIPresContext* aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerWidth,
|
||||
nscoord aCharWidth) const = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Set the suggested size for the form element.
|
||||
* This is used to control the size of the element during reflow if it hasn't had it's size
|
||||
|
|
|
@ -67,15 +67,6 @@ public:
|
|||
|
||||
virtual void SetFormFrame(nsFormFrame* aFrame) = 0;
|
||||
|
||||
virtual nscoord GetVerticalInsidePadding(nsIPresContext* aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerHeight) const = 0;
|
||||
virtual nscoord GetHorizontalInsidePadding(nsIPresContext* aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerWidth,
|
||||
nscoord aCharWidth) const = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Set the suggested size for the form element.
|
||||
* This is used to control the size of the element during reflow if it hasn't had it's size
|
||||
|
|
|
@ -205,8 +205,13 @@ nsFileControlFrame::GetType(PRInt32* aType) const
|
|||
void
|
||||
nsFileControlFrame::SetFocus(PRBool aOn, PRBool aRepaint)
|
||||
{
|
||||
// Fix for Bug 6133
|
||||
if (mTextFrame) {
|
||||
mTextFrame->SetFocus(aOn, aRepaint);
|
||||
nsCOMPtr<nsIContent> content;
|
||||
mTextFrame->GetContent(getter_AddRefs(content));
|
||||
if (content) {
|
||||
content->SetFocus(mPresContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -290,7 +295,7 @@ nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent)
|
|||
currentFile->GetUnicodeLeafName(&leafName);
|
||||
if (leafName) {
|
||||
filePicker->SetDefaultString(leafName);
|
||||
//nsAllocator::Free(leafName);
|
||||
nsMemory::Free(leafName);
|
||||
}
|
||||
|
||||
// set directory
|
||||
|
@ -316,12 +321,12 @@ nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent)
|
|||
nsCOMPtr<nsILocalFile> localFile;
|
||||
result = filePicker->GetFile(getter_AddRefs(localFile));
|
||||
if (localFile) {
|
||||
PRUnichar *nativePath;
|
||||
PRUnichar *nativePath = nsnull;
|
||||
result = localFile->GetUnicodePath(&nativePath);
|
||||
if (nativePath) {
|
||||
nsAutoString pathName(nativePath);
|
||||
mTextFrame->SetProperty(mPresContext, nsHTMLAtoms::value, pathName);
|
||||
//nsAllocator::Free(nativePath);
|
||||
nsMemory::Free(nativePath);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -379,35 +379,6 @@ nsFormControlFrame::GetScrollbarWidth(float aPixToTwip)
|
|||
return NSIntPixelsToTwips(19, aPixToTwip); // XXX this is windows
|
||||
}
|
||||
|
||||
nscoord
|
||||
nsFormControlFrame::GetVerticalBorderWidth(float aPixToTwip) const
|
||||
{
|
||||
return NSIntPixelsToTwips(3, aPixToTwip);
|
||||
}
|
||||
|
||||
nscoord
|
||||
nsFormControlFrame::GetHorizontalBorderWidth(float aPixToTwip) const
|
||||
{
|
||||
return GetVerticalBorderWidth(aPixToTwip);
|
||||
}
|
||||
|
||||
nscoord
|
||||
nsFormControlFrame::GetVerticalInsidePadding(nsIPresContext* aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerHeight) const
|
||||
{
|
||||
return NSIntPixelsToTwips(3, aPixToTwip);
|
||||
}
|
||||
|
||||
nscoord
|
||||
nsFormControlFrame::GetHorizontalInsidePadding(nsIPresContext* aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerWidth,
|
||||
nscoord aCharWidth) const
|
||||
{
|
||||
return GetVerticalInsidePadding(aPresContext, aPixToTwip, aInnerWidth);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsFormControlFrame::GetMaxNumValues()
|
||||
{
|
||||
|
|
|
@ -177,15 +177,7 @@ public:
|
|||
// XXX similar functionality needs to be added to widget library and these
|
||||
// need to change to use it.
|
||||
static nscoord GetScrollbarWidth(float aPixToTwip);
|
||||
virtual nscoord GetVerticalBorderWidth(float aPixToTwip) const;
|
||||
virtual nscoord GetHorizontalBorderWidth(float aPixToTwip) const;
|
||||
virtual nscoord GetVerticalInsidePadding(nsIPresContext* aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerHeight) const;
|
||||
virtual nscoord GetHorizontalInsidePadding(nsIPresContext* aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerWidth,
|
||||
nscoord aCharWidth) const;
|
||||
|
||||
virtual nsresult GetSizeFromContent(PRInt32* aSize) const;
|
||||
NS_IMETHOD GetMaxLength(PRInt32* aSize);
|
||||
|
||||
|
|
|
@ -563,32 +563,6 @@ nsFormControlHelper::CalculateSize (nsIPresContext* aPresContext,
|
|||
}
|
||||
}
|
||||
|
||||
nsWidgetRendering mode;
|
||||
aPresContext->GetWidgetRenderingMode(&mode);
|
||||
|
||||
// only add in padding if we are not Gfx, or if we're a Gfx text widget
|
||||
PRBool requiresWidget = PR_FALSE;
|
||||
aFrame->RequiresWidget(requiresWidget);
|
||||
PRInt32 type;
|
||||
aFrame->GetType(&type);
|
||||
|
||||
if (PR_TRUE == requiresWidget || eWidgetRendering_Native == mode ||
|
||||
type==NS_FORM_INPUT_TEXT || type==NS_FORM_TEXTAREA || type==NS_FORM_INPUT_PASSWORD)
|
||||
{
|
||||
if (!aWidthExplicit && mode == eWidgetRendering_Native) {
|
||||
//if (!aWidthExplicit) {
|
||||
PRInt32 hPadding = (2 * aFrame->GetHorizontalInsidePadding(aPresContext, p2t, aDesiredSize.width, charWidth));
|
||||
aDesiredSize.width += hPadding;
|
||||
aMinSize.width += hPadding;
|
||||
}
|
||||
if (!aHeightExplicit && mode == eWidgetRendering_Native) {
|
||||
//if (!aHeightExplicit) {
|
||||
PRInt32 vPadding = (2 * aFrame->GetVerticalInsidePadding(aPresContext, p2t, aRowHeight));
|
||||
aDesiredSize.height += vPadding;
|
||||
aMinSize.height += vPadding;
|
||||
}
|
||||
}
|
||||
|
||||
NS_RELEASE(hContent);
|
||||
if (ATTR_NOTSET == numRows) {
|
||||
numRows = (aRowHeight > 0) ? (aDesiredSize.height / aRowHeight) : 0;
|
||||
|
@ -718,17 +692,6 @@ nsFormControlHelper::PaintLine(nsIRenderingContext& aRenderingContext,
|
|||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
// Offset for arrow centerpoint
|
||||
static const nscoord nsArrowOffsetX = 3;
|
||||
static const nscoord nsArrowOffsetY = 3;
|
||||
static nscoord nsArrowRightPoints[] = {0, 0, 0, 6, 6, 3 };
|
||||
static nscoord nsArrowLeftPoints[] = {0, 3, 6, 0, 6, 6 };
|
||||
static nscoord nsArrowUpPoints[] = {3, 0, 6, 6, 0, 6 };
|
||||
static nscoord nsArrowDownPoints[] = {0, 0, 3, 6, 6, 0 };
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void
|
||||
nsFormControlHelper::SetupPoints(PRUint32 aNumberOfPoints, nscoord* aPoints, nsPoint* aPolygon, nscoord aScaleFactor, nscoord aX, nscoord aY,
|
||||
|
@ -748,135 +711,6 @@ nsFormControlHelper::SetupPoints(PRUint32 aNumberOfPoints, nscoord* aPoints, nsP
|
|||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void
|
||||
nsFormControlHelper::PaintArrowGlyph(nsIRenderingContext& aRenderingContext,
|
||||
nscoord aSX, nscoord aSY, nsArrowDirection aArrowDirection,
|
||||
nscoord aOnePixel)
|
||||
{
|
||||
nsPoint polygon[3];
|
||||
|
||||
switch(aArrowDirection)
|
||||
{
|
||||
case eArrowDirection_Left:
|
||||
SetupPoints(3, nsArrowLeftPoints, polygon, aOnePixel, aSX, aSY, nsArrowOffsetX, nsArrowOffsetY);
|
||||
break;
|
||||
|
||||
case eArrowDirection_Right:
|
||||
SetupPoints(3, nsArrowRightPoints, polygon, aOnePixel, aSX, aSY, nsArrowOffsetX, nsArrowOffsetY);
|
||||
break;
|
||||
|
||||
case eArrowDirection_Up:
|
||||
SetupPoints(3, nsArrowUpPoints, polygon, aOnePixel, aSX, aSY, nsArrowOffsetX, nsArrowOffsetY);
|
||||
break;
|
||||
|
||||
case eArrowDirection_Down:
|
||||
SetupPoints(3, nsArrowDownPoints, polygon, aOnePixel, aSX, aSY, nsArrowOffsetX, nsArrowOffsetY);
|
||||
break;
|
||||
}
|
||||
|
||||
aRenderingContext.FillPolygon(polygon, 3);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void
|
||||
nsFormControlHelper::PaintArrow(nsArrowDirection aArrowDirection,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
nsIPresContext* aPresContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsRect& aRect,
|
||||
nscoord aOnePixel,
|
||||
nsIStyleContext* aArrowStyle,
|
||||
const nsStyleSpacing& aSpacing,
|
||||
nsIFrame* aForFrame,
|
||||
nsRect& aFrameRect)
|
||||
{
|
||||
// Draw border using CSS
|
||||
const nsStyleColor* color = (const nsStyleColor*)
|
||||
aArrowStyle->GetStyleData(eStyleStruct_Color);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, aRect, *color, aSpacing, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, aRect, aSpacing, aArrowStyle, 0);
|
||||
|
||||
// Draw the glyph in black
|
||||
aRenderingContext.SetColor(NS_RGB(0, 0, 0));
|
||||
// Draw arrow centered in the rectangle
|
||||
PaintArrowGlyph(aRenderingContext, aRect.x + (aRect.width / 2), aRect.y + (aRect.height / 2), aArrowDirection, aOnePixel);
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void
|
||||
nsFormControlHelper::PaintScrollbar(nsIRenderingContext& aRenderingContext,
|
||||
nsIPresContext* aPresContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsRect& aRect,
|
||||
PRBool aHorizontal,
|
||||
nscoord aOnePixel,
|
||||
nsIStyleContext* aScrollbarStyleContext,
|
||||
nsIStyleContext* aScrollbarArrowStyleContext,
|
||||
nsIFrame* aForFrame,
|
||||
nsRect& aFrameRect)
|
||||
{
|
||||
// Get the Scrollbar's Style structs
|
||||
const nsStyleColor* scrollbarColor =
|
||||
(const nsStyleColor*)aScrollbarStyleContext->GetStyleData(eStyleStruct_Color);
|
||||
|
||||
// Get the Scrollbar's Arrow's Style structs
|
||||
const nsStyleSpacing* arrowSpacing =
|
||||
(const nsStyleSpacing*)aScrollbarArrowStyleContext->GetStyleData(eStyleStruct_Spacing);
|
||||
const nsStyleColor* arrowColor =
|
||||
(const nsStyleColor*)aScrollbarArrowStyleContext->GetStyleData(eStyleStruct_Color);
|
||||
|
||||
// Paint background for scrollbar
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, aRect, *scrollbarColor, *arrowSpacing, 0, 0);
|
||||
|
||||
if (PR_TRUE == aHorizontal) {
|
||||
// Draw horizontal Arrow
|
||||
nscoord arrowWidth = aRect.height;
|
||||
nsRect arrowLeftRect(aRect.x, aRect.y, arrowWidth, arrowWidth);
|
||||
PaintArrow(eArrowDirection_Left,aRenderingContext,aPresContext,
|
||||
aDirtyRect, arrowLeftRect,aOnePixel, aScrollbarArrowStyleContext,
|
||||
*arrowSpacing, aForFrame, aFrameRect);
|
||||
|
||||
nsRect thumbRect(aRect.x+arrowWidth, aRect.y, arrowWidth, arrowWidth);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, thumbRect, *arrowColor, *arrowSpacing, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, thumbRect, *arrowSpacing,aScrollbarArrowStyleContext, 0);
|
||||
|
||||
nsRect arrowRightRect(aRect.x + (aRect.width - arrowWidth), aRect.y, arrowWidth, arrowWidth);
|
||||
PaintArrow(eArrowDirection_Right,aRenderingContext,aPresContext,
|
||||
aDirtyRect, arrowRightRect,aOnePixel, aScrollbarArrowStyleContext,
|
||||
*arrowSpacing, aForFrame, aFrameRect);
|
||||
|
||||
}
|
||||
else {
|
||||
// Paint vertical arrow
|
||||
nscoord arrowHeight = aRect.width;
|
||||
nsRect arrowUpRect(aRect.x, aRect.y, arrowHeight, arrowHeight);
|
||||
PaintArrow(eArrowDirection_Up,aRenderingContext,aPresContext,
|
||||
aDirtyRect, arrowUpRect,aOnePixel, aScrollbarArrowStyleContext,
|
||||
*arrowSpacing, aForFrame, aFrameRect);
|
||||
|
||||
nsRect thumbRect(aRect.x, aRect.y+arrowHeight, arrowHeight, arrowHeight);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, thumbRect, *arrowColor, *arrowSpacing, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, thumbRect, *arrowSpacing,aScrollbarArrowStyleContext, 0);
|
||||
|
||||
nsRect arrowDownRect(aRect.x, aRect.y + (aRect.height - arrowHeight), arrowHeight, arrowHeight);
|
||||
PaintArrow(eArrowDirection_Down,aRenderingContext,aPresContext,
|
||||
aDirtyRect, arrowDownRect,aOnePixel, aScrollbarArrowStyleContext,
|
||||
*arrowSpacing, aForFrame, aFrameRect);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
nsFormControlHelper::PaintFixedSizeCheckMark(nsIRenderingContext& aRenderingContext,
|
||||
float aPixelsToTwips)
|
||||
|
@ -982,319 +816,6 @@ nsFormControlHelper::PaintCheckMark(nsIRenderingContext& aRenderingContext,
|
|||
aRenderingContext.FillPolygon(checkedPolygon, checkpoints);
|
||||
}
|
||||
|
||||
void
|
||||
nsFormControlHelper::PaintFocus(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect, nsRect& aInside, nsRect& aOutside)
|
||||
|
||||
{
|
||||
// draw dashed line to indicate selection, XXX don't calc rect every time
|
||||
PRUint8 borderStyles[4];
|
||||
nscolor borderColors[4];
|
||||
nscolor black = NS_RGB(0,0,0);
|
||||
for (PRInt32 i = 0; i < 4; i++) {
|
||||
borderStyles[i] = NS_STYLE_BORDER_STYLE_DOTTED;
|
||||
borderColors[i] = black;
|
||||
}
|
||||
nsCSSRendering::DrawDashedSides(0, aRenderingContext,aDirtyRect, borderStyles, borderColors, aOutside,
|
||||
aInside, PR_FALSE, nsnull);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsFormControlHelper::PaintRectangularButton(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect, const nsRect& aRect,
|
||||
PRBool aPressed,
|
||||
PRBool aShowFocus,
|
||||
PRBool aDisabled,
|
||||
PRBool aDrawOutline,
|
||||
nsIStyleContext* outlineStyle,
|
||||
nsIStyleContext* focusStyle,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsString& aLabel,
|
||||
nsIFrame* aForFrame)
|
||||
|
||||
{
|
||||
nsIFormControlFrame * formFrame;
|
||||
nsresult result = aForFrame->QueryInterface(kIFormControlFrameIID, (void**)&formFrame);
|
||||
if (NS_OK != result) {
|
||||
NS_RELEASE(formFrame);
|
||||
}
|
||||
|
||||
aRenderingContext.PushState();
|
||||
// Draw border using CSS
|
||||
// Get the Scrollbar's Arrow's Style structs
|
||||
const nsStyleSpacing* spacing =
|
||||
(const nsStyleSpacing*)aStyleContext->GetStyleData(eStyleStruct_Spacing);
|
||||
const nsStyleColor* color =
|
||||
(const nsStyleColor*)aStyleContext->GetStyleData(eStyleStruct_Color);
|
||||
|
||||
|
||||
nsRect rect(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
|
||||
const nsStyleSpacing* outline = (const nsStyleSpacing*)outlineStyle->GetStyleData(eStyleStruct_Spacing);
|
||||
const nsStyleSpacing* focus = (const nsStyleSpacing*)focusStyle->GetStyleData(eStyleStruct_Spacing);
|
||||
|
||||
nsMargin outlineBorder;
|
||||
outline->CalcBorderFor(aForFrame, outlineBorder);
|
||||
|
||||
nsMargin focusBorder;
|
||||
focus->CalcBorderFor(aForFrame, focusBorder);
|
||||
|
||||
int left = (focusBorder.left > outlineBorder.left) ? focusBorder.left : outlineBorder.left;
|
||||
int right = (focusBorder.right > outlineBorder.right) ? focusBorder.right : outlineBorder.right;
|
||||
int top = (focusBorder.top > outlineBorder.top) ? focusBorder.top : outlineBorder.top;
|
||||
int bottom = (focusBorder.bottom > outlineBorder.bottom) ? focusBorder.bottom : outlineBorder.bottom;
|
||||
|
||||
if (aShowFocus) {
|
||||
int l = left - focusBorder.left;
|
||||
int t = top - focusBorder.top;
|
||||
int b = bottom - focusBorder.bottom;
|
||||
int r = right - focusBorder.right;
|
||||
|
||||
int w = aRect.width - (l + r);
|
||||
int h = aRect.height - (t + b);
|
||||
|
||||
nsRect focusRect(l, t, w, h);
|
||||
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, focusRect, *focus, aStyleContext, 0);
|
||||
}
|
||||
|
||||
if (aDrawOutline) {
|
||||
int l = left - outlineBorder.left;
|
||||
int t = top - outlineBorder.top;
|
||||
int b = bottom - outlineBorder.bottom;
|
||||
int r = right - outlineBorder.right;
|
||||
|
||||
int w = aRect.width - (l + r);
|
||||
int h = aRect.height - (t + b);
|
||||
|
||||
nsRect outlineRect(l, t, w, h);
|
||||
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, outlineRect, *outline, aStyleContext, 0);
|
||||
}
|
||||
|
||||
rect.x += left;
|
||||
rect.y += right;
|
||||
rect.width -= (left + right);
|
||||
rect.height -= (top + bottom);
|
||||
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, rect, *color, *spacing, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, rect, *spacing,aStyleContext, 0);
|
||||
|
||||
nsMargin border;
|
||||
spacing->CalcBorderFor(aForFrame, border);
|
||||
|
||||
|
||||
float p2t;
|
||||
aPresContext->GetScaledPixelsToTwips(&p2t);
|
||||
nscoord onePixel = NSIntPixelsToTwips(1, p2t);
|
||||
|
||||
nsRect outside(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
outside.Deflate(border);
|
||||
outside.Deflate(onePixel, onePixel);
|
||||
|
||||
nsRect inside(outside);
|
||||
inside.Deflate(onePixel, onePixel);
|
||||
|
||||
/*
|
||||
if (aShowFocus) {
|
||||
PaintFocus(aRenderingContext,
|
||||
aDirtyRect, inside, outside);
|
||||
}
|
||||
*/
|
||||
|
||||
aRenderingContext.SetColor(NS_RGB(255,255,255));
|
||||
|
||||
float appUnits;
|
||||
float devUnits;
|
||||
float scale;
|
||||
nsIDeviceContext * context;
|
||||
aRenderingContext.GetDeviceContext(context);
|
||||
|
||||
context->GetCanonicalPixelScale(scale);
|
||||
context->GetAppUnitsToDevUnits(devUnits);
|
||||
context->GetDevUnitsToAppUnits(appUnits);
|
||||
|
||||
const nsFont * font = nsnull;
|
||||
nsresult res = formFrame->GetFont(aPresContext, font);
|
||||
if (NS_SUCCEEDED(res) && font != nsnull) {
|
||||
aRenderingContext.SetFont(*font);
|
||||
}
|
||||
|
||||
nscoord ascent;
|
||||
nscoord descent;
|
||||
|
||||
nscoord textWidth;
|
||||
nscoord textHeight;
|
||||
aRenderingContext.GetWidth(aLabel, textWidth);
|
||||
|
||||
nsIFontMetrics* metrics;
|
||||
context->GetMetricsFor(*font, metrics);
|
||||
metrics->GetMaxAscent(ascent);
|
||||
metrics->GetMaxDescent(descent);
|
||||
textHeight = ascent + descent;
|
||||
|
||||
nscoord x = ((inside.width - textWidth) / 2) + inside.x;
|
||||
nscoord y = ((inside.height - textHeight) / 2) + inside.y;
|
||||
if (PR_TRUE == aPressed) {
|
||||
x += onePixel;
|
||||
y += onePixel;
|
||||
}
|
||||
|
||||
if (aDisabled) {
|
||||
aRenderingContext.SetColor(NS_RGB(255,255,255));
|
||||
aRenderingContext.DrawString(aLabel, x+onePixel, y+onePixel);
|
||||
}
|
||||
|
||||
aRenderingContext.SetColor(color->mColor);
|
||||
aRenderingContext.DrawString(aLabel, x, y);
|
||||
|
||||
NS_RELEASE(context);
|
||||
PRBool clipEmpty;
|
||||
aRenderingContext.PopState(clipEmpty);
|
||||
|
||||
NS_RELEASE(formFrame);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsFormControlHelper::GetCircularRect(PRUint32 aWidth, PRUint32 aHeight, nsRect& aRect)
|
||||
{
|
||||
if (aWidth > aHeight)
|
||||
aRect.SetRect((aWidth/2) - (aHeight/2), 0, aHeight, aHeight);
|
||||
else
|
||||
aRect.SetRect(0, (aHeight/2) - (aWidth/2), aWidth, aWidth);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsFormControlHelper::PaintCircularBackground(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect, nsIStyleContext* aStyleContext, PRBool aInset,
|
||||
nsIFrame* aForFrame, PRUint32 aWidth, PRUint32 aHeight)
|
||||
{
|
||||
float p2t;
|
||||
aPresContext->GetScaledPixelsToTwips(&p2t);
|
||||
nscoord onePixel = NSIntPixelsToTwips(1, p2t);
|
||||
|
||||
nsRect outside;
|
||||
nsFormControlHelper::GetCircularRect(aWidth, aHeight, outside);
|
||||
|
||||
outside.Deflate(onePixel, onePixel);
|
||||
outside.Deflate(onePixel, onePixel);
|
||||
const nsStyleColor* color = (const nsStyleColor*)
|
||||
aStyleContext->GetStyleData(eStyleStruct_Color);
|
||||
aRenderingContext.SetColor(color->mBackgroundColor);
|
||||
aRenderingContext.FillArc(outside, 0, 180);
|
||||
aRenderingContext.FillArc(outside, 180, 360);
|
||||
}
|
||||
|
||||
//XXX: TODO Remove this. It is no longer needed since circular borders
|
||||
//are painted by the standard border code by setting a border radius
|
||||
//to 1/2 the width of the border
|
||||
void
|
||||
nsFormControlHelper::PaintCircularBorder(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect, nsIStyleContext* aStyleContext, PRBool aInset,
|
||||
nsIFrame* aForFrame, PRUint32 aWidth, PRUint32 aHeight)
|
||||
{
|
||||
const PRUint32 standardWidth = 180;
|
||||
const PRUint32 standardHeight = 180;
|
||||
|
||||
aRenderingContext.PushState();
|
||||
|
||||
float p2t;
|
||||
aPresContext->GetScaledPixelsToTwips(&p2t);
|
||||
|
||||
const nsStyleSpacing* spacing = (const nsStyleSpacing*)aStyleContext->GetStyleData(eStyleStruct_Spacing);
|
||||
nsMargin border;
|
||||
spacing->CalcBorderFor(aForFrame, border);
|
||||
|
||||
nscoord onePixel = NSIntPixelsToTwips(1, p2t);
|
||||
nscoord twelvePixels = NSIntPixelsToTwips(12, p2t);
|
||||
|
||||
nsRect outside(0, 0, aWidth, aHeight);
|
||||
|
||||
PRBool standardSize = ((aWidth == standardWidth) && (aHeight == standardHeight));
|
||||
if (PR_TRUE == standardSize) {
|
||||
outside.SetRect(0, 0, twelvePixels, twelvePixels);
|
||||
|
||||
if (PR_TRUE == aInset) {
|
||||
outside.Deflate(onePixel, onePixel);
|
||||
outside.Deflate(onePixel, onePixel);
|
||||
aRenderingContext.SetColor(NS_RGB(192,192,192));
|
||||
aRenderingContext.FillArc(outside, 0, 180);
|
||||
aRenderingContext.FillArc(outside, 180, 360);
|
||||
outside.SetRect(0, 0, twelvePixels, twelvePixels);
|
||||
}
|
||||
|
||||
// DrakGray
|
||||
// PRUint8 borderStyle = aBorderStyle.GetBorderStyle(NS_SIDE_TOP),
|
||||
// nscolor borderColor = aBorderStyle.GetBorderColor(NS_SIDE_TOP),
|
||||
|
||||
aRenderingContext.SetColor(NS_RGB(128,128,128));
|
||||
// aRenderingContext.SetColor(borderColor);
|
||||
PaintLine(aRenderingContext, 4, 0, 7, 0, PR_TRUE, 1, onePixel);
|
||||
PaintLine(aRenderingContext, 2, 1, 3, 1, PR_TRUE, 1, onePixel);
|
||||
PaintLine(aRenderingContext, 8, 1, 9, 1, PR_TRUE, 1, onePixel);
|
||||
|
||||
PaintLine(aRenderingContext, 1, 2, 1, 3, PR_FALSE, 1, onePixel);
|
||||
PaintLine(aRenderingContext, 0, 4, 0, 7, PR_FALSE, 1, onePixel);
|
||||
PaintLine(aRenderingContext, 1, 8, 1, 9, PR_FALSE, 1, onePixel);
|
||||
|
||||
// Black
|
||||
// nscolor borderColor = aBorderStyle.GetBorderColor(NS_SIDE_BOTTOM);
|
||||
// aRenderingContext.SetColor(borderColor);
|
||||
aRenderingContext.SetColor(NS_RGB(0,0,0));
|
||||
PaintLine(aRenderingContext, 4, 1, 7, 1, PR_TRUE, 1, onePixel);
|
||||
PaintLine(aRenderingContext, 2, 2, 3, 2, PR_TRUE, 1, onePixel);
|
||||
PaintLine(aRenderingContext, 8, 2, 9, 2, PR_TRUE, 1, onePixel);
|
||||
|
||||
PaintLine(aRenderingContext, 2, 2, 2, 3, PR_FALSE, 1, onePixel);
|
||||
PaintLine(aRenderingContext, 1, 4, 1, 7, PR_FALSE, 1, onePixel);
|
||||
PaintLine(aRenderingContext, 2, 8, 2, 8, PR_FALSE, 1, onePixel);
|
||||
|
||||
// Gray
|
||||
aRenderingContext.SetColor(NS_RGB(192, 192, 192));
|
||||
PaintLine(aRenderingContext, 2, 9, 3, 9, PR_TRUE, 1, onePixel);
|
||||
PaintLine(aRenderingContext, 8, 9, 9, 9, PR_TRUE, 1, onePixel);
|
||||
PaintLine(aRenderingContext, 4, 10, 7, 10, PR_TRUE, 1, onePixel);
|
||||
|
||||
PaintLine(aRenderingContext, 9, 3, 9, 3, PR_FALSE, 1, onePixel);
|
||||
PaintLine(aRenderingContext, 10, 4, 10, 7, PR_FALSE, 1, onePixel);
|
||||
PaintLine(aRenderingContext, 9, 8, 9, 9, PR_FALSE, 1, onePixel);
|
||||
|
||||
outside.Deflate(onePixel, onePixel);
|
||||
outside.Deflate(onePixel, onePixel);
|
||||
outside.Deflate(onePixel, onePixel);
|
||||
outside.Deflate(onePixel, onePixel);
|
||||
} else {
|
||||
nsFormControlHelper::GetCircularRect(aWidth, aHeight, outside);
|
||||
|
||||
aRenderingContext.SetColor(NS_RGB(128,128,128));
|
||||
aRenderingContext.FillArc(outside, 46, 225);
|
||||
aRenderingContext.SetColor(NS_RGB(255,255,255));
|
||||
aRenderingContext.FillArc(outside, 225, 360);
|
||||
aRenderingContext.FillArc(outside, 0, 44);
|
||||
|
||||
outside.Deflate(onePixel, onePixel);
|
||||
aRenderingContext.SetColor(NS_RGB(0,0,0));
|
||||
aRenderingContext.FillArc(outside, 46, 225);
|
||||
aRenderingContext.SetColor(NS_RGB(192,192,192));
|
||||
aRenderingContext.FillArc(outside, 225, 360);
|
||||
aRenderingContext.FillArc(outside, 0, 44);
|
||||
}
|
||||
|
||||
PRBool clip;
|
||||
aRenderingContext.PopState(clip);
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsFormControlHelper::GetName(nsIContent* aContent,nsString* aResult)
|
||||
{
|
||||
|
|
|
@ -157,10 +157,6 @@ public:
|
|||
|
||||
static void GetBoolString(const PRBool aValue, nsAWritableString& aResult);
|
||||
|
||||
// XXX similar functionality needs to be added to widget library and these
|
||||
// need to change to use it.
|
||||
static nscoord GetScrollbarWidth(float aPixToTwip);
|
||||
|
||||
static nsCompatibility GetRepChars(nsIPresContext* aPresContext, char& char1, char& char2);
|
||||
|
||||
// wrap can be one of these three values.
|
||||
|
@ -267,69 +263,6 @@ public:
|
|||
nscoord aSX, nscoord aSY, nscoord aEX, nscoord aEY,
|
||||
PRBool aHorz, nscoord aWidth, nscoord aOnePixel);
|
||||
|
||||
/**
|
||||
* Draw an arrow glyph.
|
||||
*
|
||||
* @param aRenderingContext the rendering context
|
||||
* @param aSX upper left x coordinate pixels
|
||||
* @param aSY upper left y coordinate pixels
|
||||
* @param aType @see nsArrowDirection enumeration
|
||||
* @param aOnePixel number of twips in a single pixel.
|
||||
*/
|
||||
|
||||
static void PaintArrowGlyph(nsIRenderingContext& aRenderingContext,
|
||||
nscoord aSX, nscoord aSY, nsArrowDirection aArrowDirection,
|
||||
nscoord aOnePixel);
|
||||
|
||||
/**
|
||||
* Draw an arrow
|
||||
*
|
||||
* @param aArrowDirection @see nsArrowDirection enumeration
|
||||
* @param aRenderingContext the rendering context
|
||||
* @param aPresContext the presentation context
|
||||
* @param aDirtyRect rectangle requiring update
|
||||
* @param aOnePixel number of TWIPS in a single pixel
|
||||
* @param aColor color of the arrow glph
|
||||
* @param aSpacing spacing for the arrow background
|
||||
* @param aForFrame frame which the arrow will be rendered into.
|
||||
* @param aFrameRect rectangle for the frame specified by aForFrame
|
||||
*/
|
||||
|
||||
static void PaintArrow(nsArrowDirection aArrowDirection,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
nsIPresContext* aPresContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsRect& aRect,
|
||||
nscoord aOnePixel,
|
||||
nsIStyleContext* aArrowStyle,
|
||||
const nsStyleSpacing& aSpacing,
|
||||
nsIFrame* aForFrame,
|
||||
nsRect& aFrameRect);
|
||||
/**
|
||||
* Paint a scrollbar
|
||||
*
|
||||
* @param aRenderingContext the rendering context
|
||||
* @param aPresContext the presentation context
|
||||
* @param aDirtyRect rectangle requiring update
|
||||
* @param aRect width and height of the scrollbar
|
||||
* @param aHorizontal if TRUE scrollbar is drawn horizontally, vertical if FALSE
|
||||
* @param aOnePixel number TWIPS per pixel
|
||||
* @param aScrollbarStyleContext style context for the scrollbar
|
||||
* @param aScrollbarArrowStyleContext style context for the scrollbar arrow
|
||||
* @param aForFrame the frame that the scrollbar will be rendered in to
|
||||
* @param aFrameRect the rectangle for the frame passed as aForFrame
|
||||
*/
|
||||
|
||||
static void PaintScrollbar(nsIRenderingContext& aRenderingContext,
|
||||
nsIPresContext* aPresContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsRect& aRect,
|
||||
PRBool aHorizontal,
|
||||
nscoord aOnePixel,
|
||||
nsIStyleContext* aScrollbarStyleContext,
|
||||
nsIStyleContext* aScrollbarArrowStyleContext,
|
||||
nsIFrame* aForFrame,
|
||||
nsRect& aFrameRect);
|
||||
/**
|
||||
* Paint a fixed size checkmark
|
||||
*
|
||||
|
@ -386,68 +319,6 @@ public:
|
|||
nsIStyleContext* aFocusStyle,
|
||||
nsIStyleContext* aStyleContext, nsString& aLabel,
|
||||
nsIFrame* aForFrame);
|
||||
/**
|
||||
* Paint a focus indicator.
|
||||
*
|
||||
* @param aRenderingContext the rendering context
|
||||
* @param aDirtyRect rectangle requiring update
|
||||
* @param aInside border inside
|
||||
* @param aOutside border outside
|
||||
*/
|
||||
|
||||
static void PaintFocus(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect, nsRect& aInside, nsRect& aOutside);
|
||||
|
||||
/**
|
||||
* Get the rectangle for a circular area. To maintain the aspect ratio of the circular
|
||||
* area the rectangle is offset to center the circular area within the width and height
|
||||
* specified.
|
||||
*
|
||||
* @param aWidth width to center within
|
||||
* @param aHeight height to center within
|
||||
* @param aRect the computed rectangle centering the circle by setting the x and y of the rect.
|
||||
*/
|
||||
|
||||
static void GetCircularRect(PRUint32 aWidth, PRUint32 aHeight, nsRect& aRect);
|
||||
|
||||
/**
|
||||
* Paint a circular background
|
||||
*
|
||||
* @param aPresContext the presentation context
|
||||
* @param aRenderingContext the rendering context
|
||||
* @param aDirtyRect rectangle requiring update
|
||||
* @param aStyleContext style context specifying colors and spacing
|
||||
* @param aInset if PR_TRUE draw inset, otherwise draw outset
|
||||
* @param aForFrame the frame that the scrollbar will be rendered in to
|
||||
* @param aWidth width of the border in TWIPS
|
||||
* @param aHeight height ofthe border in TWIPS
|
||||
*/
|
||||
|
||||
static void PaintCircularBackground(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect, nsIStyleContext* aStyleContext, PRBool aInset,
|
||||
nsIFrame* aForFrame, PRUint32 aWidth, PRUint32 aHeight);
|
||||
|
||||
|
||||
/**
|
||||
* Paint a circular border
|
||||
*
|
||||
* @param aPresContext the presentation context
|
||||
* @param aRenderingContext the rendering context
|
||||
* @param aDirtyRect rectangle requiring update
|
||||
* @param aStyleContext style context specifying colors and spacing
|
||||
* @param aInset if PR_TRUE draw inset, otherwise draw outset
|
||||
* @param aForFrame the frame that the scrollbar will be rendered in to
|
||||
* @param aWidth width of the border in TWIPS
|
||||
* @param aHeight height ofthe border in TWIPS
|
||||
*/
|
||||
|
||||
static void PaintCircularBorder(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect, nsIStyleContext* aStyleContext, PRBool aInset,
|
||||
nsIFrame* aForFrame, PRUint32 aWidth, PRUint32 aHeight);
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
nsFormControlHelper();
|
||||
|
|
Загрузка…
Ссылка в новой задаче