mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 10:00:54 +00:00
First Checked In.
This commit is contained in:
parent
a7255be50d
commit
9112196e08
29
layout/xul/base/Makefile.in
Normal file
29
layout/xul/base/Makefile.in
Normal file
@ -0,0 +1,29 @@
|
||||
#!gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = src
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
22
layout/xul/base/makefile.win
Normal file
22
layout/xul/base/makefile.win
Normal file
@ -0,0 +1,22 @@
|
||||
#!nmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
DEPTH=..\..\..
|
||||
|
||||
DIRS=src
|
||||
|
||||
include <$(DEPTH)\layout\config\rules.mak>
|
116
layout/xul/base/src/nsToolbarFrame.cpp
Normal file
116
layout/xul/base/src/nsToolbarFrame.cpp
Normal file
@ -0,0 +1,116 @@
|
||||
/* -*- 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 "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
* the License for the specific language governing rights and limitations
|
||||
* under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
|
||||
//
|
||||
// Mike Pinkerton
|
||||
// Netscape Communications
|
||||
//
|
||||
// See documentation in associated header file
|
||||
//
|
||||
|
||||
#include "nsToolbarFrame.h"
|
||||
|
||||
|
||||
//
|
||||
// NS_NewToolbarFrame
|
||||
//
|
||||
// Creates a new Toolbar frame and returns it in |aNewFrame|
|
||||
//
|
||||
nsresult
|
||||
NS_NewToolbarFrame ( nsIFrame*& aNewFrame, PRUint32 aFlags )
|
||||
{
|
||||
nsToolbarFrame* it = new nsToolbarFrame;
|
||||
if (nsnull == it)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
it->SetFlags(aFlags);
|
||||
aNewFrame = it;
|
||||
return NS_OK;
|
||||
|
||||
} // NS_NewToolbarFrame
|
||||
|
||||
|
||||
//
|
||||
// nsToolbarFrame dstr
|
||||
//
|
||||
// Cleanup, if necessary
|
||||
//
|
||||
nsToolbarFrame :: ~nsToolbarFrame ( )
|
||||
{
|
||||
//*** anything?
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Paint
|
||||
//
|
||||
// Paint our background and border like normal frames, but before we draw the
|
||||
// children, draw our grippies for each toolbar.
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
nsToolbarFrame :: Paint ( nsIPresContext& aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer)
|
||||
{
|
||||
if (eFramePaintLayer_Underlay == aWhichLayer) {
|
||||
const nsStyleDisplay* disp = (const nsStyleDisplay*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
if (disp->mVisible && mRect.width && mRect.height) {
|
||||
// Paint our background and border
|
||||
PRIntn skipSides = GetSkipSides();
|
||||
const nsStyleColor* color = (const nsStyleColor*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Color);
|
||||
const nsStyleSpacing* spacing = (const nsStyleSpacing*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Spacing);
|
||||
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *color, *spacing, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *spacing, skipSides);
|
||||
}
|
||||
}
|
||||
|
||||
//*** anything toolbar specific here???
|
||||
|
||||
// Now paint the items. Note that child elements have the opportunity to
|
||||
// override the visibility property and display even if their parent is
|
||||
// hidden
|
||||
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
|
||||
return NS_OK;
|
||||
|
||||
} // Paint
|
||||
|
||||
|
||||
//
|
||||
// Reflow
|
||||
//
|
||||
// Handle moving children around.
|
||||
//
|
||||
NS_IMETHOD
|
||||
nsToolbarFrame :: Reflow ( nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
nsBlockFrame::Reflow ( aPresContext, aDesiredSize, aReflowState, aStatus );
|
||||
|
||||
} // Reflow
|
||||
|
65
layout/xul/base/src/nsToolbarFrame.h
Normal file
65
layout/xul/base/src/nsToolbarFrame.h
Normal file
@ -0,0 +1,65 @@
|
||||
/* -*- 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 "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
* the License for the specific language governing rights and limitations
|
||||
* under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
|
||||
//
|
||||
// Mike Pinkerton
|
||||
// Netscape Communications
|
||||
//
|
||||
// nsToolbarFrame is a layout object that contains items (specified as
|
||||
// children in the DOM). The layout for toolbars is a little complicated, but
|
||||
// it basically just lays out its children in order. Toolbars themselves
|
||||
// don't know anything about grippies (as in 4.x) but are associated with them
|
||||
// through toolboxes. This allows a developer to create a standalone toolbar
|
||||
// (for inclusion in a webpage), which obviously doesn't need to have a grippy.
|
||||
//
|
||||
// As mentioned above, the Toolbar expects its toolbars to be its children in
|
||||
// the DOM. The exact structure of the children is documented on:
|
||||
// http://www.mozilla.org/xpfe/DMWSpecNew.html
|
||||
//
|
||||
// <<describe toolbar layout in detail>>
|
||||
//
|
||||
|
||||
|
||||
#include "nsBlockFrame.h"
|
||||
|
||||
class nsToolbarFrame : public nsBlockFrame
|
||||
{
|
||||
public:
|
||||
friend nsresult NS_NewToolbarFrame(nsIFrame*& aNewFrame, PRUint32 aFlags);
|
||||
|
||||
// nsIHTMLReflow overrides
|
||||
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
NS_IMETHOD Paint(nsIPresContext& aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer);
|
||||
|
||||
protected:
|
||||
nsToolbarFrame();
|
||||
virtual ~nsToolbarFrame();
|
||||
|
||||
// pass-by-value not allowed for a coordinator because it corresponds 1-to-1
|
||||
// with an element in the UI.
|
||||
nsToolbarFrame ( const nsToolbarFrame& aFrame ) ; // DO NOT IMPLEMENT
|
||||
nsToolbarFrame& operator= ( const nsToolbarFrame& aFrame ) ; // DO NOT IMPLEMENT
|
||||
|
||||
}; // class nsToolbarFrame
|
118
layout/xul/base/src/nsToolboxFrame.cpp
Normal file
118
layout/xul/base/src/nsToolboxFrame.cpp
Normal file
@ -0,0 +1,118 @@
|
||||
/* -*- 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 "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
* the License for the specific language governing rights and limitations
|
||||
* under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
|
||||
//
|
||||
// Mike Pinkerton
|
||||
// Netscape Communications
|
||||
//
|
||||
// See documentation in associated header file
|
||||
//
|
||||
|
||||
#include "nsToolboxFrame.h"
|
||||
|
||||
|
||||
//
|
||||
// NS_NewToolboxFrame
|
||||
//
|
||||
// Creates a new toolbox frame and returns it in |aNewFrame|
|
||||
//
|
||||
nsresult
|
||||
NS_NewToolboxFrame ( nsIFrame*& aNewFrame, PRUint32 aFlags )
|
||||
{
|
||||
nsToolboxFrame* it = new nsToolboxFrame;
|
||||
if (nsnull == it)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
it->SetFlags(aFlags);
|
||||
aNewFrame = it;
|
||||
return NS_OK;
|
||||
|
||||
} // NS_NewToolboxFrame
|
||||
|
||||
|
||||
//
|
||||
// nsToolboxFrame dstr
|
||||
//
|
||||
// Cleanup, if necessary
|
||||
//
|
||||
nsToolboxFrame :: ~nsToolboxFrame ( )
|
||||
{
|
||||
//*** anything?
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Paint
|
||||
//
|
||||
// Paint our background and border like normal frames, but before we draw the
|
||||
// children, draw our grippies for each toolbar.
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
nsToolboxFrame :: Paint ( nsIPresContext& aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer)
|
||||
{
|
||||
if (eFramePaintLayer_Underlay == aWhichLayer) {
|
||||
const nsStyleDisplay* disp = (const nsStyleDisplay*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
if (disp->mVisible && mRect.width && mRect.height) {
|
||||
// Paint our background and border
|
||||
PRIntn skipSides = GetSkipSides();
|
||||
const nsStyleColor* color = (const nsStyleColor*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Color);
|
||||
const nsStyleSpacing* spacing = (const nsStyleSpacing*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Spacing);
|
||||
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *color, *spacing, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *spacing, skipSides);
|
||||
}
|
||||
}
|
||||
|
||||
//*** draw grippies
|
||||
//*** draw collapsed area under toolbars (is that a frame itself???)
|
||||
|
||||
// Now paint the toolbars. Note that child elements have the opportunity to
|
||||
// override the visibility property and display even if their parent is
|
||||
// hidden
|
||||
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
|
||||
return NS_OK;
|
||||
|
||||
} // Paint
|
||||
|
||||
|
||||
//
|
||||
// Reflow
|
||||
//
|
||||
// Handle moving children around. This may have to account for toolbars that
|
||||
// grew to multiple lines or collapsed toolbars and the expando-dock at the bottom
|
||||
//
|
||||
NS_IMETHOD
|
||||
nsToolboxFrame :: Reflow ( nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
nsHTMLContainerFrame::Reflow ( aPresContext, aDesiredSize, aReflowState, aStatus );
|
||||
|
||||
} // Reflow
|
||||
|
66
layout/xul/base/src/nsToolboxFrame.h
Normal file
66
layout/xul/base/src/nsToolboxFrame.h
Normal file
@ -0,0 +1,66 @@
|
||||
/* -*- 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 "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
* the License for the specific language governing rights and limitations
|
||||
* under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
|
||||
//
|
||||
// Mike Pinkerton
|
||||
// Netscape Communications
|
||||
//
|
||||
// nsToolboxFrame is a layout object that contains one or more toolbar frames
|
||||
// (specified as children in the DOM). These toolbars are laid out one on top
|
||||
// of the other, and can be of varying heights but are all of the same width
|
||||
// (the full width of the toolbox). Each toolbar is associated with a "grippy"
|
||||
// which can be used to either collapse a particular toolbar or as a handle to
|
||||
// pick up and move a toolbar to a new position within the toolbox. When toolbars
|
||||
// are collapsed, it's grippy is moved to the bottom of the box and laid on
|
||||
// its side. Clicking again on the grippy will reinstate the toolbar to its previous
|
||||
// position in the toolbox.
|
||||
//
|
||||
// As mentioned above, the toolbox expects its toolbars to be its children in
|
||||
// the DOM. The exact structure of the children is documented on:
|
||||
// http://www.mozilla.org/xpfe/DMWSpecNew.html
|
||||
//
|
||||
|
||||
#include "nsHTMLContainerFrame.h"
|
||||
|
||||
|
||||
class nsToolboxFrame : public nsHTMLContainerFrame
|
||||
{
|
||||
public:
|
||||
friend nsresult NS_NewToolboxFrame(nsIFrame*& aNewFrame, PRUint32 aFlags);
|
||||
|
||||
// nsIHTMLReflow overrides
|
||||
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
NS_IMETHOD Paint(nsIPresContext& aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer);
|
||||
|
||||
protected:
|
||||
nsToolboxFrame();
|
||||
virtual ~nsToolboxFrame();
|
||||
|
||||
// pass-by-value not allowed for a coordinator because it corresponds 1-to-1
|
||||
// with an element in the UI.
|
||||
nsToolboxFrame ( const nsToolboxFrame& aFrame ) ; // DO NOT IMPLEMENT
|
||||
nsToolboxFrame& operator= ( const nsToolboxFrame& aFrame ) ; // DO NOT IMPLEMENT
|
||||
|
||||
}; // class nsToolboxFrame
|
Loading…
Reference in New Issue
Block a user