This commit is contained in:
hyatt%netscape.com 2000-05-30 07:59:13 +00:00
Родитель eb875d5c2d
Коммит ebc54523ca
7 изменённых файлов: 552 добавлений и 0 удалений

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

@ -30,6 +30,10 @@ MODULE = layout
LIBRARY_NAME = raptorxulbase_s
CPPSRCS = \
nsMenuBoxObject.cpp \
nsTreeBoxObject.cpp \
nsPopupSetObject.cpp \
nsBoxObject.cpp \
nsGridLayout.cpp \
nsObeliskLayout.cpp \
nsTempleLayout.cpp \

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

@ -28,6 +28,10 @@ REQUIRES=xpcom raptor pref
DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN
CPPSRCS= \
nsTreeBoxObject.cpp \
nsPopupSetBoxObject.cpp \
nsMenuBoxObject.cpp \
nsBoxObject.cpp \
nsGridLayout.cpp \
nsTempleLayout.cpp \
nsObeliskLayout.cpp \
@ -89,6 +93,10 @@ CPPSRCS= \
$(NULL)
CPP_OBJS= \
.\$(OBJDIR)\nsTreeBoxObject.obj \
.\$(OBJDIR)\nsPopupSetBoxObject.obj \
.\$(OBJDIR)\nsMenuBoxObject.obj \
.\$(OBJDIR)\nsBoxObject.obj \
.\$(OBJDIR)\nsGridLayout.obj \
.\$(OBJDIR)\nsTempleLayout.obj \
.\$(OBJDIR)\nsObeliskLayout.obj \

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

@ -0,0 +1,123 @@
/* -*- 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.1 (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.
*
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
* Contributor(s):
*/
#include "nsBoxObject.h"
#include "nsIBoxLayoutManager.h"
#include "nsIBoxPaintManager.h"
#include "nsIDocument.h"
#include "nsIPresShell.h"
// Static IIDs/CIDs. Try to minimize these.
// None so far.
// Implementation /////////////////////////////////////////////////////////////////
// Static member variable initialization
// Implement our nsISupports methods
NS_IMPL_ISUPPORTS2(nsBoxObject, nsIBoxObject, nsPIBoxObject)
// Constructors/Destructors
nsBoxObject::nsBoxObject(void)
{
NS_INIT_ISUPPORTS();
}
nsBoxObject::~nsBoxObject(void)
{
}
NS_IMETHODIMP
nsBoxObject::GetLayoutManager(nsIBoxLayoutManager** aResult)
{
*aResult = mLayoutManager;
NS_IF_ADDREF(*aResult);
return NS_OK;
}
NS_IMETHODIMP
nsBoxObject::SetLayoutManager(nsIBoxLayoutManager* aLayoutManager)
{
mLayoutManager = aLayoutManager;
return NS_OK;
}
NS_IMETHODIMP
nsBoxObject::GetPaintManager(nsIBoxPaintManager** aResult)
{
*aResult = mPaintManager;
NS_IF_ADDREF(*aResult);
return NS_OK;
}
NS_IMETHODIMP
nsBoxObject::SetPaintManager(nsIBoxPaintManager* aPaintManager)
{
mPaintManager = aPaintManager;
return NS_OK;
}
// nsPIBoxObject //////////////////////////////////////////////////////////////////////////
NS_IMETHODIMP
nsBoxObject::Init(nsIContent* aContent, nsIPresShell* aShell)
{
mContent = aContent;
mPresShell = aShell;
return NS_OK;
}
NS_IMETHODIMP
nsBoxObject::SetDocument(nsIDocument* aDocument)
{
if (aDocument) {
nsCOMPtr<nsIPresShell> shell = getter_AddRefs(aDocument->GetShellAt(0));
mPresShell = shell;
}
else {
mPresShell = nsnull;
}
return NS_OK;
}
nsIFrame*
nsBoxObject::GetFrame()
{
nsIFrame* frame = nsnull;
if (mPresShell)
mPresShell->GetPrimaryFrameFor(mContent, &frame);
return frame;
}
// Creation Routine ///////////////////////////////////////////////////////////////////////
nsresult
NS_NewBoxObject(nsIBoxObject** aResult)
{
*aResult = new nsBoxObject;
if (!*aResult)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*aResult);
return NS_OK;
}

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

@ -0,0 +1,53 @@
/* -*- 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.1 (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.
*
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
* Contributor(s):
*/
#include "nsCOMPtr.h"
#include "nsIBoxObject.h"
#include "nsPIBoxObject.h"
class nsIBoxLayoutManager;
class nsIBoxPaintManager;
class nsIFrame;
class nsBoxObject : public nsIBoxObject, public nsPIBoxObject
{
NS_DECL_ISUPPORTS
NS_DECL_NSIBOXOBJECT
public:
nsBoxObject();
virtual ~nsBoxObject();
// nsPIBoxObject
NS_IMETHOD Init(nsIContent* aContent, nsIPresShell* aPresShell);
NS_IMETHOD SetDocument(nsIDocument* aDocument);
nsIFrame* GetFrame();
// MEMBER VARIABLES
protected:
nsCOMPtr<nsIBoxLayoutManager> mLayoutManager; // [OWNER]
nsCOMPtr<nsIBoxPaintManager> mPaintManager; // [OWNER]
nsIContent* mContent; // [WEAK]
nsIPresShell* mPresShell; // [WEAK]
};

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

@ -0,0 +1,98 @@
/* -*- 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.1 (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.
*
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
* Contributor(s):
*/
#include "nsCOMPtr.h"
#include "nsIMenuBoxObject.h"
#include "nsBoxObject.h"
#include "nsIPresShell.h"
#include "nsIMenuFrame.h"
#include "nsIFrame.h"
class nsMenuBoxObject : public nsIMenuBoxObject, public nsBoxObject
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIMENUBOXOBJECT
nsMenuBoxObject();
virtual ~nsMenuBoxObject();
protected:
};
/* Implementation file */
NS_IMPL_ADDREF(nsMenuBoxObject)
NS_IMPL_RELEASE(nsMenuBoxObject)
NS_IMETHODIMP
nsMenuBoxObject::QueryInterface(REFNSIID iid, void** aResult)
{
if (!aResult)
return NS_ERROR_NULL_POINTER;
if (iid.Equals(NS_GET_IID(nsIMenuBoxObject))) {
*aResult = (nsIMenuBoxObject*)this;
NS_ADDREF(this);
return NS_OK;
}
return nsBoxObject::QueryInterface(iid, aResult);
}
nsMenuBoxObject::nsMenuBoxObject()
{
NS_INIT_ISUPPORTS();
}
nsMenuBoxObject::~nsMenuBoxObject()
{
/* destructor code */
}
/* void openMenu (in boolean openFlag); */
NS_IMETHODIMP nsMenuBoxObject::OpenMenu(PRBool aOpenFlag)
{
nsIFrame* frame = GetFrame();
if (!frame)
return NS_OK;
nsCOMPtr<nsIMenuFrame> menuFrame(do_QueryInterface(frame));
if (!menuFrame)
return NS_OK;
return menuFrame->OpenMenu(aOpenFlag);
}
// Creation Routine ///////////////////////////////////////////////////////////////////////
nsresult
NS_NewMenuBoxObject(nsIBoxObject** aResult)
{
*aResult = new nsMenuBoxObject;
if (!*aResult)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*aResult);
return NS_OK;
}

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

@ -0,0 +1,158 @@
/* -*- 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.1 (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.
*
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
* Contributor(s):
*/
#include "nsCOMPtr.h"
#include "nsIPopupSetBoxObject.h"
#include "nsBoxObject.h"
#include "nsIPresShell.h"
#include "nsIPopupSetFrame.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIDOMElement.h"
#include "nsIFrame.h"
class nsPopupSetBoxObject : public nsIPopupSetBoxObject, public nsBoxObject
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIPOPUPSETBOXOBJECT
nsPopupSetBoxObject();
virtual ~nsPopupSetBoxObject();
protected:
};
/* Implementation file */
NS_IMPL_ADDREF(nsPopupSetBoxObject)
NS_IMPL_RELEASE(nsPopupSetBoxObject)
NS_IMETHODIMP
nsPopupSetBoxObject::QueryInterface(REFNSIID iid, void** aResult)
{
if (!aResult)
return NS_ERROR_NULL_POINTER;
if (iid.Equals(NS_GET_IID(nsIPopupSetBoxObject))) {
*aResult = (nsIPopupSetBoxObject*)this;
NS_ADDREF(this);
return NS_OK;
}
return nsBoxObject::QueryInterface(iid, aResult);
}
nsPopupSetBoxObject::nsPopupSetBoxObject()
{
NS_INIT_ISUPPORTS();
}
nsPopupSetBoxObject::~nsPopupSetBoxObject()
{
/* destructor code */
}
/* void openPopupSet (in boolean openFlag); */
NS_IMETHODIMP
nsPopupSetBoxObject::HidePopup()
{
nsIFrame* frame = GetFrame();
if (!frame)
return NS_OK;
nsCOMPtr<nsIPopupSetFrame> popupFrame(do_QueryInterface(frame));
if (!popupFrame)
return NS_OK;
return popupFrame->HidePopup();
}
NS_IMETHODIMP
nsPopupSetBoxObject::DestroyPopup()
{
nsIFrame* frame = GetFrame();
if (!frame)
return NS_OK;
nsCOMPtr<nsIPopupSetFrame> popupFrame(do_QueryInterface(frame));
if (!popupFrame)
return NS_OK;
return popupFrame->DestroyPopup();
}
NS_IMETHODIMP
nsPopupSetBoxObject::CreatePopup(nsIDOMElement* aSrcContent,
nsIDOMElement* aPopupContent,
PRInt32 aXPos, PRInt32 aYPos,
const PRUnichar *aPopupType, const PRUnichar *anAnchorAlignment,
const PRUnichar *aPopupAlignment)
{
nsIFrame* frame = GetFrame();
if (!frame)
return NS_OK;
nsCOMPtr<nsIPopupSetFrame> popupFrame(do_QueryInterface(frame));
if (!popupFrame)
return NS_OK;
nsCOMPtr<nsIContent> popupContent(do_QueryInterface(aPopupContent));
if (!popupContent)
return NS_OK;
nsCOMPtr<nsIContent> srcContent(do_QueryInterface(aSrcContent));
if (!srcContent)
return NS_OK;
nsCOMPtr<nsIDOMDocument> doc;
aSrcContent->GetOwnerDocument(getter_AddRefs(doc));
if (!doc)
return NS_OK;
nsCOMPtr<nsIDocument> document(do_QueryInterface(doc));
nsCOMPtr<nsIPresShell> shell = getter_AddRefs(document->GetShellAt(0));
if (!shell)
return NS_OK;
nsIFrame* srcFrame;
shell->GetPrimaryFrameFor(srcContent, &srcFrame);
if (!srcFrame)
return NS_OK;
return popupFrame->CreatePopup(srcFrame, popupContent, aXPos, aYPos, aPopupType, anAnchorAlignment, aPopupAlignment);
}
// Creation Routine ///////////////////////////////////////////////////////////////////////
nsresult
NS_NewPopupSetBoxObject(nsIBoxObject** aResult)
{
*aResult = new nsPopupSetBoxObject;
if (!*aResult)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*aResult);
return NS_OK;
}

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

@ -0,0 +1,108 @@
/* -*- 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.1 (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.
*
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
* Contributor(s):
*/
#include "nsCOMPtr.h"
#include "nsITreeBoxObject.h"
#include "nsBoxObject.h"
#include "nsIPresShell.h"
#include "nsITreeFrame.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIDOMElement.h"
#include "nsIFrame.h"
class nsTreeBoxObject : public nsITreeBoxObject, public nsBoxObject
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSITREEBOXOBJECT
nsTreeBoxObject();
virtual ~nsTreeBoxObject();
protected:
};
/* Implementation file */
NS_IMPL_ADDREF(nsTreeBoxObject)
NS_IMPL_RELEASE(nsTreeBoxObject)
NS_IMETHODIMP
nsTreeBoxObject::QueryInterface(REFNSIID iid, void** aResult)
{
if (!aResult)
return NS_ERROR_NULL_POINTER;
if (iid.Equals(NS_GET_IID(nsITreeBoxObject))) {
*aResult = (nsITreeBoxObject*)this;
NS_ADDREF(this);
return NS_OK;
}
return nsBoxObject::QueryInterface(iid, aResult);
}
nsTreeBoxObject::nsTreeBoxObject()
{
NS_INIT_ISUPPORTS();
}
nsTreeBoxObject::~nsTreeBoxObject()
{
/* destructor code */
}
/* void ensureRowIsVisible (in long rowIndex); */
NS_IMETHODIMP nsTreeBoxObject::EnsureRowIsVisible(PRInt32 aRowIndex)
{
nsIFrame* frame = GetFrame();
if (!frame)
return NS_OK;
nsCOMPtr<nsITreeFrame> treeFrame(do_QueryInterface(frame));
if (!treeFrame)
return NS_OK;
return treeFrame->EnsureRowIsVisible(aRowIndex);
}
/* void fireOnSelect (); */
NS_IMETHODIMP nsTreeBoxObject::FireOnSelect()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
// Creation Routine ///////////////////////////////////////////////////////////////////////
nsresult
NS_NewTreeBoxObject(nsIBoxObject** aResult)
{
*aResult = new nsTreeBoxObject;
if (!*aResult)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*aResult);
return NS_OK;
}