зеркало из https://github.com/mozilla/pjs.git
First Checked In.
This commit is contained in:
Родитель
ba666df85d
Коммит
398a07b575
|
@ -0,0 +1,107 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
|
||||
#include "nsColorPickerFrame.h"
|
||||
|
||||
#include "nsIContent.h"
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
||||
|
||||
//
|
||||
// NS_NewColorPickerFrame
|
||||
//
|
||||
// Wrapper for creating a new color picker
|
||||
//
|
||||
nsresult
|
||||
NS_NewColorPickerFrame(nsIFrame*& aResult)
|
||||
{
|
||||
aResult = new nsColorPickerFrame;
|
||||
if ( !aResult )
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// nsColorPickerFrame cntr
|
||||
//
|
||||
nsColorPickerFrame::nsColorPickerFrame()
|
||||
{
|
||||
|
||||
} // cntr
|
||||
|
||||
|
||||
//
|
||||
// Paint
|
||||
//
|
||||
// Overidden to handle ???
|
||||
//
|
||||
NS_METHOD
|
||||
nsColorPickerFrame::Paint(nsIPresContext& aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer)
|
||||
{
|
||||
return nsLeafFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// GetDesiredSize
|
||||
//
|
||||
// For now, be as big as CSS wants us to be, or some small default size.
|
||||
//
|
||||
void
|
||||
nsColorPickerFrame :: GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsHTMLReflowMetrics& aDesiredLayoutSize)
|
||||
{
|
||||
const int CSS_NOTSET = -1;
|
||||
const int ATTR_NOTSET = -1;
|
||||
|
||||
nsSize styleSize;
|
||||
if (aReflowState.HaveFixedContentWidth()) {
|
||||
styleSize.width = aReflowState.computedWidth;
|
||||
}
|
||||
else {
|
||||
styleSize.width = CSS_NOTSET;
|
||||
}
|
||||
if (aReflowState.HaveFixedContentHeight()) {
|
||||
styleSize.height = aReflowState.computedHeight;
|
||||
}
|
||||
else {
|
||||
styleSize.height = CSS_NOTSET;
|
||||
}
|
||||
|
||||
// subclasses should always override this method, but if not and no css, make it small
|
||||
aDesiredLayoutSize.width = (styleSize.width > CSS_NOTSET) ? styleSize.width : 200;
|
||||
aDesiredLayoutSize.height = (styleSize.height > CSS_NOTSET) ? styleSize.height : 200;
|
||||
aDesiredLayoutSize.ascent = aDesiredLayoutSize.height;
|
||||
aDesiredLayoutSize.descent = 0;
|
||||
if (aDesiredLayoutSize.maxElementSize) {
|
||||
aDesiredLayoutSize.maxElementSize->width = aDesiredLayoutSize.width;
|
||||
aDesiredLayoutSize.maxElementSize->height = aDesiredLayoutSize.height;
|
||||
}
|
||||
|
||||
} // GetDesiredSize
|
|
@ -0,0 +1,60 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
//
|
||||
// nsColorPickerFrame
|
||||
//
|
||||
|
||||
#ifndef nsColorPickerFrame_h__
|
||||
#define nsColorPickerFrame_h__
|
||||
|
||||
|
||||
#include "nsLeafFrame.h"
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsString;
|
||||
|
||||
|
||||
nsresult NS_NewColorPickerFrame(nsIFrame*& aResult) ;
|
||||
|
||||
|
||||
class nsColorPickerFrame : public nsLeafFrame
|
||||
{
|
||||
public:
|
||||
nsColorPickerFrame();
|
||||
|
||||
// nsIFrame overrides
|
||||
NS_IMETHOD GetFrameName(nsString& aResult) const {
|
||||
return MakeFrameName("ColorPickerFrame", aResult);
|
||||
}
|
||||
NS_IMETHOD Paint(nsIPresContext& aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer);
|
||||
|
||||
protected:
|
||||
|
||||
virtual void GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsHTMLReflowMetrics& aDesiredSize) ;
|
||||
|
||||
}; // class nsColorPickerFrame
|
||||
|
||||
#endif
|
|
@ -0,0 +1,107 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
|
||||
#include "nsFontPickerFrame.h"
|
||||
|
||||
#include "nsIContent.h"
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
||||
|
||||
//
|
||||
// NS_NewFontPickerFrame
|
||||
//
|
||||
// Wrapper for creating a new font picker
|
||||
//
|
||||
nsresult
|
||||
NS_NewFontPickerFrame(nsIFrame*& aResult)
|
||||
{
|
||||
aResult = new nsFontPickerFrame;
|
||||
if ( !aResult )
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// nsFontPickerFrame cntr
|
||||
//
|
||||
nsFontPickerFrame::nsFontPickerFrame()
|
||||
{
|
||||
|
||||
} // cntr
|
||||
|
||||
|
||||
//
|
||||
// Paint
|
||||
//
|
||||
// Overidden to handle ???
|
||||
//
|
||||
NS_METHOD
|
||||
nsFontPickerFrame::Paint(nsIPresContext& aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer)
|
||||
{
|
||||
return nsLeafFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// GetDesiredSize
|
||||
//
|
||||
// For now, be as big as CSS wants us to be, or some small default size.
|
||||
//
|
||||
void
|
||||
nsFontPickerFrame :: GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsHTMLReflowMetrics& aDesiredLayoutSize)
|
||||
{
|
||||
const int CSS_NOTSET = -1;
|
||||
const int ATTR_NOTSET = -1;
|
||||
|
||||
nsSize styleSize;
|
||||
if (aReflowState.HaveFixedContentWidth()) {
|
||||
styleSize.width = aReflowState.computedWidth;
|
||||
}
|
||||
else {
|
||||
styleSize.width = CSS_NOTSET;
|
||||
}
|
||||
if (aReflowState.HaveFixedContentHeight()) {
|
||||
styleSize.height = aReflowState.computedHeight;
|
||||
}
|
||||
else {
|
||||
styleSize.height = CSS_NOTSET;
|
||||
}
|
||||
|
||||
// subclasses should always override this method, but if not and no css, make it small
|
||||
aDesiredLayoutSize.width = (styleSize.width > CSS_NOTSET) ? styleSize.width : 200;
|
||||
aDesiredLayoutSize.height = (styleSize.height > CSS_NOTSET) ? styleSize.height : 200;
|
||||
aDesiredLayoutSize.ascent = aDesiredLayoutSize.height;
|
||||
aDesiredLayoutSize.descent = 0;
|
||||
if (aDesiredLayoutSize.maxElementSize) {
|
||||
aDesiredLayoutSize.maxElementSize->width = aDesiredLayoutSize.width;
|
||||
aDesiredLayoutSize.maxElementSize->height = aDesiredLayoutSize.height;
|
||||
}
|
||||
|
||||
} // GetDesiredSize
|
|
@ -0,0 +1,60 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
//
|
||||
// nsFontPickerFrame
|
||||
//
|
||||
|
||||
#ifndef nsFontPickerFrame_h__
|
||||
#define nsFontPickerFrame_h__
|
||||
|
||||
|
||||
#include "nsLeafFrame.h"
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsString;
|
||||
|
||||
|
||||
nsresult NS_NewFontPickerFrame(nsIFrame*& aResult) ;
|
||||
|
||||
|
||||
class nsFontPickerFrame : public nsLeafFrame
|
||||
{
|
||||
public:
|
||||
nsFontPickerFrame();
|
||||
|
||||
// nsIFrame overrides
|
||||
NS_IMETHOD GetFrameName(nsString& aResult) const {
|
||||
return MakeFrameName("FontPickerFrame", aResult);
|
||||
}
|
||||
NS_IMETHOD Paint(nsIPresContext& aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer);
|
||||
|
||||
protected:
|
||||
|
||||
virtual void GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsHTMLReflowMetrics& aDesiredSize) ;
|
||||
|
||||
}; // class nsFontPickerFrame
|
||||
|
||||
#endif
|
|
@ -0,0 +1,107 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
|
||||
#include "nsScrollbarFrame.h"
|
||||
|
||||
#include "nsIContent.h"
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
||||
|
||||
//
|
||||
// NS_NewScrollbarFrame
|
||||
//
|
||||
// Wrapper for creating a new scrollbar
|
||||
//
|
||||
nsresult
|
||||
NS_NewScrollbarFrame(nsIFrame*& aResult)
|
||||
{
|
||||
aResult = new nsScrollbarFrame;
|
||||
if ( !aResult )
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// nsScrollbarFrame cntr
|
||||
//
|
||||
nsScrollbarFrame::nsScrollbarFrame()
|
||||
{
|
||||
|
||||
} // cntr
|
||||
|
||||
|
||||
//
|
||||
// Paint
|
||||
//
|
||||
// Overidden to handle ???
|
||||
//
|
||||
NS_METHOD
|
||||
nsScrollbarFrame::Paint(nsIPresContext& aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer)
|
||||
{
|
||||
return nsLeafFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// GetDesiredSize
|
||||
//
|
||||
// For now, be as big as CSS wants us to be, or some small default size.
|
||||
//
|
||||
void
|
||||
nsScrollbarFrame :: GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsHTMLReflowMetrics& aDesiredLayoutSize)
|
||||
{
|
||||
const int CSS_NOTSET = -1;
|
||||
const int ATTR_NOTSET = -1;
|
||||
|
||||
nsSize styleSize;
|
||||
if (aReflowState.HaveFixedContentWidth()) {
|
||||
styleSize.width = aReflowState.computedWidth;
|
||||
}
|
||||
else {
|
||||
styleSize.width = CSS_NOTSET;
|
||||
}
|
||||
if (aReflowState.HaveFixedContentHeight()) {
|
||||
styleSize.height = aReflowState.computedHeight;
|
||||
}
|
||||
else {
|
||||
styleSize.height = CSS_NOTSET;
|
||||
}
|
||||
|
||||
// subclasses should always override this method, but if not and no css, make it small
|
||||
aDesiredLayoutSize.width = (styleSize.width > CSS_NOTSET) ? styleSize.width : 200;
|
||||
aDesiredLayoutSize.height = (styleSize.height > CSS_NOTSET) ? styleSize.height : 200;
|
||||
aDesiredLayoutSize.ascent = aDesiredLayoutSize.height;
|
||||
aDesiredLayoutSize.descent = 0;
|
||||
if (aDesiredLayoutSize.maxElementSize) {
|
||||
aDesiredLayoutSize.maxElementSize->width = aDesiredLayoutSize.width;
|
||||
aDesiredLayoutSize.maxElementSize->height = aDesiredLayoutSize.height;
|
||||
}
|
||||
|
||||
} // GetDesiredSize
|
|
@ -0,0 +1,60 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
//
|
||||
// nsScrollbarFrame
|
||||
//
|
||||
|
||||
#ifndef nsScrollbarFrame_h__
|
||||
#define nsScrollbarFrame_h__
|
||||
|
||||
|
||||
#include "nsLeafFrame.h"
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsString;
|
||||
|
||||
|
||||
nsresult NS_NewScrollbarFrame(nsIFrame*& aResult) ;
|
||||
|
||||
|
||||
class nsScrollbarFrame : public nsLeafFrame
|
||||
{
|
||||
public:
|
||||
nsScrollbarFrame();
|
||||
|
||||
// nsIFrame overrides
|
||||
NS_IMETHOD GetFrameName(nsString& aResult) const {
|
||||
return MakeFrameName("ScrollbarFrame", aResult);
|
||||
}
|
||||
NS_IMETHOD Paint(nsIPresContext& aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer);
|
||||
|
||||
protected:
|
||||
|
||||
virtual void GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsHTMLReflowMetrics& aDesiredSize) ;
|
||||
|
||||
}; // class nsScrollbarFrame
|
||||
|
||||
#endif
|
|
@ -0,0 +1,107 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
|
||||
#include "nsSpinnerFrame.h"
|
||||
|
||||
#include "nsIContent.h"
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
||||
|
||||
//
|
||||
// NS_NewSpinnerFrame
|
||||
//
|
||||
// Wrapper for creating a new spinner
|
||||
//
|
||||
nsresult
|
||||
NS_NewSpinnerFrame(nsIFrame*& aResult)
|
||||
{
|
||||
aResult = new nsSpinnerFrame;
|
||||
if ( !aResult )
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// nsSpinnerFrame cntr
|
||||
//
|
||||
nsSpinnerFrame::nsSpinnerFrame()
|
||||
{
|
||||
|
||||
} // cntr
|
||||
|
||||
|
||||
//
|
||||
// Paint
|
||||
//
|
||||
// Overidden to handle ???
|
||||
//
|
||||
NS_METHOD
|
||||
nsSpinnerFrame::Paint(nsIPresContext& aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer)
|
||||
{
|
||||
return nsLeafFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// GetDesiredSize
|
||||
//
|
||||
// For now, be as big as CSS wants us to be, or some small default size.
|
||||
//
|
||||
void
|
||||
nsSpinnerFrame :: GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsHTMLReflowMetrics& aDesiredLayoutSize)
|
||||
{
|
||||
const int CSS_NOTSET = -1;
|
||||
const int ATTR_NOTSET = -1;
|
||||
|
||||
nsSize styleSize;
|
||||
if (aReflowState.HaveFixedContentWidth()) {
|
||||
styleSize.width = aReflowState.computedWidth;
|
||||
}
|
||||
else {
|
||||
styleSize.width = CSS_NOTSET;
|
||||
}
|
||||
if (aReflowState.HaveFixedContentHeight()) {
|
||||
styleSize.height = aReflowState.computedHeight;
|
||||
}
|
||||
else {
|
||||
styleSize.height = CSS_NOTSET;
|
||||
}
|
||||
|
||||
// subclasses should always override this method, but if not and no css, make it small
|
||||
aDesiredLayoutSize.width = (styleSize.width > CSS_NOTSET) ? styleSize.width : 200;
|
||||
aDesiredLayoutSize.height = (styleSize.height > CSS_NOTSET) ? styleSize.height : 200;
|
||||
aDesiredLayoutSize.ascent = aDesiredLayoutSize.height;
|
||||
aDesiredLayoutSize.descent = 0;
|
||||
if (aDesiredLayoutSize.maxElementSize) {
|
||||
aDesiredLayoutSize.maxElementSize->width = aDesiredLayoutSize.width;
|
||||
aDesiredLayoutSize.maxElementSize->height = aDesiredLayoutSize.height;
|
||||
}
|
||||
|
||||
} // GetDesiredSize
|
|
@ -0,0 +1,60 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
//
|
||||
// nsSpinnerFrame
|
||||
//
|
||||
|
||||
#ifndef nsSpinnerFrame_h__
|
||||
#define nsSpinnerFrame_h__
|
||||
|
||||
|
||||
#include "nsLeafFrame.h"
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsString;
|
||||
|
||||
|
||||
nsresult NS_NewSpinnerFrame(nsIFrame*& aResult) ;
|
||||
|
||||
|
||||
class nsSpinnerFrame : public nsLeafFrame
|
||||
{
|
||||
public:
|
||||
nsSpinnerFrame();
|
||||
|
||||
// nsIFrame overrides
|
||||
NS_IMETHOD GetFrameName(nsString& aResult) const {
|
||||
return MakeFrameName("SpinnerFrame", aResult);
|
||||
}
|
||||
NS_IMETHOD Paint(nsIPresContext& aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer);
|
||||
|
||||
protected:
|
||||
|
||||
virtual void GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsHTMLReflowMetrics& aDesiredSize) ;
|
||||
|
||||
}; // class nsSpinnerFrame
|
||||
|
||||
#endif
|
|
@ -0,0 +1,107 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
|
||||
#include "nsSpinnerFrame.h"
|
||||
|
||||
#include "nsIContent.h"
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
||||
|
||||
//
|
||||
// NS_NewSpinnerFrame
|
||||
//
|
||||
// Wrapper for creating a new spinner
|
||||
//
|
||||
nsresult
|
||||
NS_NewSpinnerFrame(nsIFrame*& aResult)
|
||||
{
|
||||
aResult = new nsSpinnerFrame;
|
||||
if ( !aResult )
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// nsSpinnerFrame cntr
|
||||
//
|
||||
nsSpinnerFrame::nsSpinnerFrame()
|
||||
{
|
||||
|
||||
} // cntr
|
||||
|
||||
|
||||
//
|
||||
// Paint
|
||||
//
|
||||
// Overidden to handle ???
|
||||
//
|
||||
NS_METHOD
|
||||
nsSpinnerFrame::Paint(nsIPresContext& aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer)
|
||||
{
|
||||
return nsLeafFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// GetDesiredSize
|
||||
//
|
||||
// For now, be as big as CSS wants us to be, or some small default size.
|
||||
//
|
||||
void
|
||||
nsSpinnerFrame :: GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsHTMLReflowMetrics& aDesiredLayoutSize)
|
||||
{
|
||||
const int CSS_NOTSET = -1;
|
||||
const int ATTR_NOTSET = -1;
|
||||
|
||||
nsSize styleSize;
|
||||
if (aReflowState.HaveFixedContentWidth()) {
|
||||
styleSize.width = aReflowState.computedWidth;
|
||||
}
|
||||
else {
|
||||
styleSize.width = CSS_NOTSET;
|
||||
}
|
||||
if (aReflowState.HaveFixedContentHeight()) {
|
||||
styleSize.height = aReflowState.computedHeight;
|
||||
}
|
||||
else {
|
||||
styleSize.height = CSS_NOTSET;
|
||||
}
|
||||
|
||||
// subclasses should always override this method, but if not and no css, make it small
|
||||
aDesiredLayoutSize.width = (styleSize.width > CSS_NOTSET) ? styleSize.width : 200;
|
||||
aDesiredLayoutSize.height = (styleSize.height > CSS_NOTSET) ? styleSize.height : 200;
|
||||
aDesiredLayoutSize.ascent = aDesiredLayoutSize.height;
|
||||
aDesiredLayoutSize.descent = 0;
|
||||
if (aDesiredLayoutSize.maxElementSize) {
|
||||
aDesiredLayoutSize.maxElementSize->width = aDesiredLayoutSize.width;
|
||||
aDesiredLayoutSize.maxElementSize->height = aDesiredLayoutSize.height;
|
||||
}
|
||||
|
||||
} // GetDesiredSize
|
|
@ -0,0 +1,60 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
//
|
||||
// nsSpinnerFrame
|
||||
//
|
||||
|
||||
#ifndef nsSpinnerFrame_h__
|
||||
#define nsSpinnerFrame_h__
|
||||
|
||||
|
||||
#include "nsLeafFrame.h"
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsString;
|
||||
|
||||
|
||||
nsresult NS_NewSpinnerFrame(nsIFrame*& aResult) ;
|
||||
|
||||
|
||||
class nsSpinnerFrame : public nsLeafFrame
|
||||
{
|
||||
public:
|
||||
nsSpinnerFrame();
|
||||
|
||||
// nsIFrame overrides
|
||||
NS_IMETHOD GetFrameName(nsString& aResult) const {
|
||||
return MakeFrameName("SpinnerFrame", aResult);
|
||||
}
|
||||
NS_IMETHOD Paint(nsIPresContext& aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer);
|
||||
|
||||
protected:
|
||||
|
||||
virtual void GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsHTMLReflowMetrics& aDesiredSize) ;
|
||||
|
||||
}; // class nsSpinnerFrame
|
||||
|
||||
#endif
|
Загрузка…
Ссылка в новой задаче