First pass at XPFC migration to Free Source repo
This commit is contained in:
Родитель
8eeafae249
Коммит
11941ed1bb
|
@ -0,0 +1,23 @@
|
|||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
GDEPTH = ../../../../..
|
||||
|
||||
EXPORTS = \
|
||||
nsXPFCCanvas.h \
|
||||
nsXPFCHTMLCanvas.h \
|
||||
nsXPFCCanvasManager.h \
|
||||
$(NULL)
|
||||
|
||||
PRIVATE_EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
MODULE = xpfc
|
||||
|
||||
REQUIRES = raptor
|
|
@ -0,0 +1,286 @@
|
|||
/* -*- 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.
|
||||
*/
|
||||
|
||||
#ifndef nsXPFCCanvas_h___
|
||||
#define nsXPFCCanvas_h___
|
||||
|
||||
#include "nsxpfc.h"
|
||||
#include "nsAgg.h"
|
||||
#include "nsxpfcCIID.h"
|
||||
#include "nsIVector.h"
|
||||
#include "nsIIterator.h"
|
||||
#include "nsString.h"
|
||||
#include "nsFont.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsIXPFCCanvas.h"
|
||||
#include "nsILayout.h"
|
||||
#include "nsIRenderingContext.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsPoint.h"
|
||||
#include "nsIXPFCObserver.h"
|
||||
#include "nsIXPFCCommandReceiver.h"
|
||||
#include "nsIXPFCSubject.h"
|
||||
#include "nsIXMLParserObject.h"
|
||||
#include "nsIImageGroup.h"
|
||||
#include "nsIImageObserver.h"
|
||||
#include "nsIImageRequest.h"
|
||||
|
||||
CLASS_EXPORT_XPFC nsXPFCCanvas : public nsIXPFCCanvas,
|
||||
public nsIXPFCObserver,
|
||||
public nsIXMLParserObject,
|
||||
public nsIImageRequestObserver
|
||||
|
||||
{
|
||||
public:
|
||||
nsXPFCCanvas(nsISupports* outer);
|
||||
|
||||
NS_DECL_AGGREGATED
|
||||
|
||||
NS_IMETHOD Init();
|
||||
|
||||
NS_IMETHOD Init(nsNativeWidget aNativeParent, const nsRect& aBounds, EVENT_CALLBACK aHandleEventFunction);
|
||||
NS_IMETHOD Init(nsIWidget * aParent, const nsRect& aBounds, EVENT_CALLBACK aHandleEventFunction);
|
||||
|
||||
NS_IMETHOD CreateIterator(nsIIterator ** aIterator) ;
|
||||
NS_IMETHOD Layout() ;
|
||||
NS_IMETHOD_(nsILayout *) GetLayout();
|
||||
|
||||
NS_IMETHOD_(nsString&) GetNameID();
|
||||
NS_IMETHOD SetNameID(nsString& aString);
|
||||
|
||||
NS_IMETHOD_(nsString&) GetLabel();
|
||||
NS_IMETHOD SetLabel(nsString& aString);
|
||||
|
||||
NS_IMETHOD SetBounds(const nsRect& aBounds);
|
||||
NS_IMETHOD_(void) GetBounds(nsRect& aRect);
|
||||
|
||||
NS_IMETHOD_(nsEventStatus) DefaultProcessing(nsGUIEvent *aEvent);
|
||||
NS_IMETHOD_(nsEventStatus) HandleEvent(nsGUIEvent *aEvent);
|
||||
|
||||
NS_IMETHOD_(nsEventStatus) OnPaint(nsGUIEvent *aEvent);
|
||||
NS_IMETHOD_(nsEventStatus) OnResize(nsGUIEvent *aEvent);
|
||||
NS_IMETHOD_(nsEventStatus) OnMove(nsGUIEvent *aEvent);
|
||||
|
||||
NS_IMETHOD_(nsEventStatus) OnGotFocus(nsGUIEvent *aEvent);
|
||||
NS_IMETHOD_(nsEventStatus) OnLostFocus(nsGUIEvent *aEvent);
|
||||
|
||||
NS_IMETHOD_(nsEventStatus) OnLeftButtonDown(nsGUIEvent *aEvent);
|
||||
NS_IMETHOD_(nsEventStatus) OnLeftButtonUp(nsGUIEvent *aEvent);
|
||||
NS_IMETHOD_(nsEventStatus) OnLeftButtonDoubleClick(nsGUIEvent *aEvent);
|
||||
|
||||
NS_IMETHOD_(nsEventStatus) OnMiddleButtonDown(nsGUIEvent *aEvent);
|
||||
NS_IMETHOD_(nsEventStatus) OnMiddleButtonUp(nsGUIEvent *aEvent);
|
||||
NS_IMETHOD_(nsEventStatus) OnMiddleButtonDoubleClick(nsGUIEvent *aEvent);
|
||||
|
||||
NS_IMETHOD_(nsEventStatus) OnRightButtonDown(nsGUIEvent *aEvent);
|
||||
NS_IMETHOD_(nsEventStatus) OnRightButtonUp(nsGUIEvent *aEvent);
|
||||
NS_IMETHOD_(nsEventStatus) OnRightButtonDoubleClick(nsGUIEvent *aEvent);
|
||||
|
||||
NS_IMETHOD_(nsEventStatus) OnMouseEnter(nsGUIEvent *aEvent);
|
||||
NS_IMETHOD_(nsEventStatus) OnMouseExit(nsGUIEvent *aEvent);
|
||||
NS_IMETHOD_(nsEventStatus) OnMouseMove(nsGUIEvent *aEvent);
|
||||
|
||||
NS_IMETHOD_(nsEventStatus) OnKeyUp(nsGUIEvent *aEvent);
|
||||
NS_IMETHOD_(nsEventStatus) OnKeyDown(nsGUIEvent *aEvent);
|
||||
|
||||
NS_IMETHOD_(void) AddChildCanvas(nsIXPFCCanvas * aChildCanvas, PRInt32 aPosition = -1);
|
||||
NS_IMETHOD_(void) RemoveChildCanvas(nsIXPFCCanvas * aChildCanvas);
|
||||
NS_IMETHOD_(void) Reparent(nsIXPFCCanvas * aParentCanvas);
|
||||
NS_IMETHOD_(nsEventStatus) PaintBackground(nsGUIEvent *aEvent);
|
||||
NS_IMETHOD_(nsEventStatus) PaintForeground(nsGUIEvent *aEvent);
|
||||
NS_IMETHOD_(nsEventStatus) PaintBorder(nsGUIEvent *aEvent);
|
||||
NS_IMETHOD_(nsEventStatus) PaintChildWidgets(nsGUIEvent *aEvent);
|
||||
NS_IMETHOD_(nsEventStatus) ResizeChildWidgets(nsGUIEvent *aEvent);
|
||||
|
||||
NS_IMETHOD SetOpacity(PRFloat64 aOpacity) ;
|
||||
NS_IMETHOD_(PRFloat64) GetOpacity() ;
|
||||
NS_IMETHOD SetVisibility(PRBool aVisibility);
|
||||
NS_IMETHOD_(PRBool) GetVisibility();
|
||||
|
||||
NS_IMETHOD SetTabID(PRUint32 aTabID);
|
||||
NS_IMETHOD_(PRUint32) GetTabID();
|
||||
|
||||
NS_IMETHOD SetTabGroup(PRUint32 aTabGroup);
|
||||
NS_IMETHOD_(PRUint32) GetTabGroup();
|
||||
|
||||
NS_IMETHOD_(nsIWidget *) GetWidget();
|
||||
NS_IMETHOD_(nsIXPFCCanvas *) GetParent();
|
||||
NS_IMETHOD_(void) SetParent(nsIXPFCCanvas * aCanvas);
|
||||
|
||||
NS_IMETHOD_(nscolor) GetBackgroundColor(void) ;
|
||||
NS_IMETHOD_(void) SetBackgroundColor(const nscolor &aColor) ;
|
||||
|
||||
NS_IMETHOD_(nscolor) GetForegroundColor(void) ;
|
||||
NS_IMETHOD_(void) SetForegroundColor(const nscolor &aColor) ;
|
||||
|
||||
NS_IMETHOD_(nscolor) GetBorderColor(void) ;
|
||||
NS_IMETHOD_(void) SetBorderColor(const nscolor &aColor) ;
|
||||
|
||||
NS_IMETHOD_(nscolor) Highlight(const nscolor &aColor);
|
||||
NS_IMETHOD_(nscolor) Dim(const nscolor &aColor);
|
||||
|
||||
NS_IMETHOD_(nsIXPFCCanvas *) CanvasFromPoint(const nsPoint &aPoint);
|
||||
NS_IMETHOD_(nsIXPFCCanvas *) CanvasFromTab(PRUint32 aTabGroup, PRUint32 aTabID);
|
||||
|
||||
NS_IMETHOD GetClassPreferredSize(nsSize& aSize);
|
||||
NS_IMETHOD SetFocus();
|
||||
|
||||
NS_IMETHOD GetPreferredSize(nsSize &aSize);
|
||||
NS_IMETHOD GetMaximumSize(nsSize &aSize);
|
||||
NS_IMETHOD GetMinimumSize(nsSize &aSize);
|
||||
|
||||
NS_IMETHOD SetPreferredSize(nsSize &aSize);
|
||||
NS_IMETHOD SetMaximumSize(nsSize &aSize);
|
||||
NS_IMETHOD SetMinimumSize(nsSize &aSize);
|
||||
|
||||
NS_IMETHOD_(PRBool) HasPreferredSize();
|
||||
NS_IMETHOD_(PRBool) HasMinimumSize();
|
||||
NS_IMETHOD_(PRBool) HasMaximumSize();
|
||||
|
||||
NS_IMETHOD_(PRFloat64) GetMajorAxisWeight();
|
||||
NS_IMETHOD_(PRFloat64) GetMinorAxisWeight();
|
||||
NS_IMETHOD SetMajorAxisWeight(PRFloat64 aWeight);
|
||||
NS_IMETHOD SetMinorAxisWeight(PRFloat64 aWeight);
|
||||
|
||||
NS_IMETHOD_(PRUint32) GetChildCount();
|
||||
NS_IMETHOD DeleteChildren();
|
||||
NS_IMETHOD DeleteChildren(PRUint32 aCount);
|
||||
|
||||
NS_IMETHOD_(PRBool) PaintRequested();
|
||||
|
||||
// nsIXPFCObserver methods
|
||||
NS_IMETHOD Update(nsIXPFCSubject * aSubject, nsIXPFCCommand * aCommand);
|
||||
|
||||
|
||||
// nsIXPFCCommandReceiver methods
|
||||
NS_IMETHOD Action(nsIXPFCCommand * aCommand);
|
||||
|
||||
// nsIXMLParserObject methods
|
||||
NS_IMETHOD SetParameter(nsString& aKey, nsString& aValue) ;
|
||||
|
||||
NS_IMETHOD_(nsIXPFCCanvas *) CanvasFromName(nsString& aName);
|
||||
NS_IMETHOD CreateWidget() ;
|
||||
|
||||
/**
|
||||
* Get the font for this canvas
|
||||
* @result nsFont, the canvas font
|
||||
*/
|
||||
NS_IMETHOD_(nsFont&) GetFont() ;
|
||||
|
||||
/**
|
||||
* Set the font for this canvas
|
||||
* @param aFont the nsFont for this canvas
|
||||
* @result nsresult, NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD SetFont(nsFont& aFont) ;
|
||||
|
||||
/**
|
||||
* Get the font metrics for this canvas
|
||||
* @param nsIFontMetrics, the canvas font metrics
|
||||
* @result nsresult, NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD GetFontMetrics(nsIFontMetrics ** aFontMetrics) ;
|
||||
|
||||
/**
|
||||
* Save canvas graphical state
|
||||
* @param aRenderingContext, rendering context to save state to
|
||||
* @result nsresult, NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD PushState(nsIRenderingContext * aRenderingContext) ;
|
||||
|
||||
/**
|
||||
* Get and and set RenderingContext to this graphical state
|
||||
* @param aRenderingContext, rendering context to get previously saved state from
|
||||
* @return if PR_TRUE, indicates that the clipping region after
|
||||
* popping state is empty, else PR_FALSE
|
||||
*/
|
||||
NS_IMETHOD_(PRBool) PopState(nsIRenderingContext * aRenderingContext) ;
|
||||
|
||||
NS_IMETHOD FindLargestTabGroup(PRUint32& aTabGroup);
|
||||
NS_IMETHOD FindLargestTabID(PRUint32 aTabGroup, PRUint32& aTabID);
|
||||
|
||||
// nsIImageRequestObserver
|
||||
virtual void Notify(nsIImageRequest *aImageRequest,
|
||||
nsIImage *aImage,
|
||||
nsImageNotification aNotificationType,
|
||||
PRInt32 aParam1, PRInt32 aParam2,
|
||||
void *aParam3);
|
||||
|
||||
virtual void NotifyError(nsIImageRequest *aImageRequest,
|
||||
nsImageError aErrorType);
|
||||
|
||||
#if defined(DEBUG) && defined(XP_PC)
|
||||
NS_IMETHOD DumpCanvas(FILE * f, PRUint32 indent) ;
|
||||
#endif
|
||||
|
||||
NS_IMETHOD LoadWidget(const nsCID &aClassIID);
|
||||
|
||||
protected:
|
||||
~nsXPFCCanvas();
|
||||
|
||||
|
||||
public:
|
||||
PRBool Create(char * lpszWindowName, const nsRect& rect, EVENT_CALLBACK aHandleEventFunction, nsIWidget * pParent);
|
||||
|
||||
private:
|
||||
|
||||
nsILayout * mLayout;
|
||||
nsIVector * mChildWidgets ;
|
||||
nsRect mBounds;
|
||||
nscolor mBackgroundColor;
|
||||
nscolor mForegroundColor;
|
||||
nscolor mBorderColor;
|
||||
nsSize mPreferredSize;
|
||||
nsSize mMaximumSize;
|
||||
nsSize mMinimumSize;
|
||||
nsString mNameID;
|
||||
nsString mLabel;
|
||||
PRFloat64 mWeightMajor;
|
||||
PRFloat64 mWeightMinor;
|
||||
PRFloat64 mOpacity;
|
||||
PRBool mVisibility;
|
||||
nsFont mFont;
|
||||
PRUint32 mTabID;
|
||||
PRUint32 mTabGroup;
|
||||
nsIImageGroup* mImageGroup;
|
||||
nsIImageRequest* mImageRequest;
|
||||
|
||||
// nsIWidget Aggregation
|
||||
protected:
|
||||
|
||||
// a Canvas CAN aggregate an nsIWidget
|
||||
// mWidgetSupports is the pointer to the widget's real nsISupports. QueryInterace
|
||||
// should be called on mWidgetSupports if any of the widget interface wants to
|
||||
// be exposed,
|
||||
// mWidget is a convenience pointer to the widget functionalities.
|
||||
// mWidget is not AddRef'ed or Released otherwise we'll create a circulare
|
||||
// refcount and the canvas will never go away
|
||||
nsISupports *mWidgetSupports;
|
||||
nsIWidget *mWidget;
|
||||
|
||||
|
||||
nsIRenderingContext *mRenderingContext;
|
||||
nsIXPFCCanvas * mParent;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* nsXPFCCanvas_h___ */
|
|
@ -0,0 +1,64 @@
|
|||
/* -*- 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.
|
||||
*/
|
||||
|
||||
#ifndef nsXPFCCanvasManager_h___
|
||||
#define nsXPFCCanvasManager_h___
|
||||
|
||||
#include "nscore.h"
|
||||
#include "plstr.h"
|
||||
#include "prtypes.h"
|
||||
#include "prmon.h"
|
||||
#include "plstr.h"
|
||||
#include "nsCom.h"
|
||||
#include "nsIVector.h"
|
||||
#include "nsIIterator.h"
|
||||
|
||||
#include "nsIXPFCCanvasManager.h"
|
||||
|
||||
class nsXPFCCanvasManager : public nsIXPFCCanvasManager
|
||||
{
|
||||
public:
|
||||
nsXPFCCanvasManager();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD Init() ;
|
||||
NS_IMETHOD_(nsIXPFCCanvas *) CanvasFromWidget(nsIWidget * aWidget);
|
||||
NS_IMETHOD GetRootCanvas(nsIXPFCCanvas ** aCanvas);
|
||||
NS_IMETHOD SetRootCanvas(nsIXPFCCanvas * aCanvas);
|
||||
NS_IMETHOD Register(nsIXPFCCanvas * aCanvas, nsIWidget * aWidget);
|
||||
NS_IMETHOD Unregister(nsIXPFCCanvas * aCanvas);
|
||||
NS_IMETHOD_(nsIXPFCCanvas *) GetFocusedCanvas();
|
||||
NS_IMETHOD SetFocusedCanvas(nsIXPFCCanvas * aCanvas);
|
||||
|
||||
protected:
|
||||
~nsXPFCCanvasManager();
|
||||
|
||||
public:
|
||||
PRMonitor * monitor;
|
||||
|
||||
public:
|
||||
nsIVector * mList ;
|
||||
|
||||
private:
|
||||
nsIXPFCCanvas * mRootCanvas;
|
||||
nsIXPFCCanvas * mFocusedCanvas;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsXPFCCanvasManager_h___ */
|
|
@ -0,0 +1,54 @@
|
|||
/* -*- 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.
|
||||
*/
|
||||
|
||||
#ifndef nsXPFCHTMLCanvas_h___
|
||||
#define nsXPFCHTMLCanvas_h___
|
||||
|
||||
#include "nsXPFCCanvas.h"
|
||||
#include "nsIWebShell.h"
|
||||
|
||||
class nsXPFCHTMLCanvas : public nsXPFCCanvas
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
nsXPFCHTMLCanvas(nsISupports* outer);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD Init();
|
||||
NS_IMETHOD SetBounds(const nsRect& aBounds);
|
||||
|
||||
// nsIXMLParserObject methods
|
||||
NS_IMETHOD SetParameter(nsString& aKey, nsString& aValue) ;
|
||||
|
||||
NS_IMETHOD_(nsEventStatus) HandleEvent(nsGUIEvent *aEvent);
|
||||
NS_IMETHOD_(nsEventStatus) OnPaint(nsGUIEvent *aEvent);
|
||||
NS_IMETHOD_(nsEventStatus) OnResize(nsGUIEvent *aEvent);
|
||||
NS_IMETHOD GetClassPreferredSize(nsSize& aSize);
|
||||
|
||||
protected:
|
||||
~nsXPFCHTMLCanvas();
|
||||
|
||||
private:
|
||||
nsIWebShell * mWebShell;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsXPFCHTMLCanvas_h___ */
|
|
@ -0,0 +1,15 @@
|
|||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
GDEPTH = ../../../..
|
||||
DEPTH = ../../../..
|
||||
|
||||
DIRS_EXPORT = public inc
|
||||
DIRS_LIBS = src
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
GDEPTH = ../../../../..
|
||||
DEPTH = ../../../../..
|
||||
|
||||
EXPORTS = \
|
||||
nsIXPFCCanvas.h \
|
||||
nsIXPFCCanvasManager.h \
|
||||
$(NULL)
|
||||
|
||||
PRIVATE_EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
MODULE = xpfc
|
||||
|
||||
REQUIRES = raptor
|
|
@ -0,0 +1,624 @@
|
|||
/* -*- 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.
|
||||
*/
|
||||
|
||||
#ifndef nsIXPFCCanvas_h___
|
||||
#define nsIXPFCCanvas_h___
|
||||
|
||||
#include "nsRect.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsIIterator.h"
|
||||
#include "nsSize.h"
|
||||
#include "nsILayout.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsFont.h"
|
||||
#include "nsIFontMetrics.h"
|
||||
#include "nsIRenderingContext.h"
|
||||
|
||||
// IID for the nsIXPFCCanvas interface
|
||||
#define NS_IXPFC_CANVAS_IID \
|
||||
{ 0x6bc9da40, 0xe9e7, 0x11d1, \
|
||||
{ 0x92, 0x44, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } }
|
||||
|
||||
/**
|
||||
* XPFC Canvas interface. This is the core interface to all
|
||||
* renderable components in the XPFC world
|
||||
*/
|
||||
class nsIXPFCCanvas : public nsISupports
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Initialize the XPFCCanvas
|
||||
* @result The result of the initialization, NS_Ok if no errors
|
||||
*/
|
||||
NS_IMETHOD Init() = 0;
|
||||
|
||||
/**
|
||||
* Initialize the XPFCCanvas
|
||||
* @param aNativeParent a native parent for drawing into.
|
||||
* @param aBounds the bounds for thw canvas, relative to it's parent
|
||||
* @param aHandleEventFunction The event procedure for handling GUIEvents
|
||||
* @result The result of the initialization, NS_Ok if no errors
|
||||
*/
|
||||
NS_IMETHOD Init(nsNativeWidget aNativeParent,
|
||||
const nsRect& aBounds,
|
||||
EVENT_CALLBACK aHandleEventFunction) = 0;
|
||||
|
||||
/**
|
||||
* Initialize the XPFCCanvas
|
||||
* @param aParent a nsIWidget pointer to the parent.
|
||||
* @param aBounds the bounds for thw canvas, relative to it's parent
|
||||
* @param aHandleEventFunction The event procedure for handling GUIEvents
|
||||
* @result The result of the initialization, NS_Ok if no errors
|
||||
*/
|
||||
NS_IMETHOD Init(nsIWidget * aParent,
|
||||
const nsRect& aBounds,
|
||||
EVENT_CALLBACK aHandleEventFunction) = 0;
|
||||
|
||||
/**
|
||||
* Create an Iterator for this canvas's children
|
||||
* @param aIterator out paramater which implements the iterator interface.
|
||||
* @result The result of the iterator creation, NS_Ok if no errors
|
||||
*/
|
||||
NS_IMETHOD CreateIterator(nsIIterator ** aIterator) = 0;
|
||||
|
||||
/**
|
||||
* Tells this canvas to layout itself and it's children
|
||||
* @result The result of the layout process, NS_Ok if no errors
|
||||
*/
|
||||
NS_IMETHOD Layout() = 0;
|
||||
|
||||
/**
|
||||
* Get a pointer to the object implementing the nsILayout interface for this canvas
|
||||
* @result nsILayout pointer, nsnull if no layout object assigned, else a pointer to the layout object
|
||||
*/
|
||||
NS_IMETHOD_(nsILayout *) GetLayout() = 0;
|
||||
|
||||
/**
|
||||
* Get the Name of this canvas, relative to itself
|
||||
* @result nsString reference, the name of the canvas
|
||||
*/
|
||||
NS_IMETHOD_(nsString&) GetNameID() = 0;
|
||||
|
||||
/**
|
||||
* Set the Name of this canvas, relative to itself
|
||||
* @result result of setting the name. NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD SetNameID(nsString& aString) = 0;
|
||||
|
||||
/**
|
||||
* Get the Label of this canvas
|
||||
* @result nsString reference, the label of the canvas
|
||||
*/
|
||||
NS_IMETHOD_(nsString&) GetLabel() = 0;
|
||||
|
||||
/**
|
||||
* Set the Label of this canvas
|
||||
* @result result of setting the label. NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD SetLabel(nsString& aString) = 0;
|
||||
|
||||
/**
|
||||
* Handle a GUI Event
|
||||
* @param aEvent The GUI Event to be handled
|
||||
* @result nsEventStatus, status of gui event processing
|
||||
*/
|
||||
NS_IMETHOD_(nsEventStatus) HandleEvent(nsGUIEvent *aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Handle an OnPaint Message
|
||||
* @param aEvent The GUI Event to be handled
|
||||
* @result nsEventStatus, status of OnPaint event processing
|
||||
*/
|
||||
NS_IMETHOD_(nsEventStatus) OnPaint(nsGUIEvent *aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Handle an OnResize Message
|
||||
* @param aEvent The GUI Event to be handled
|
||||
* @result nsEventStatus, status of OnResize event processing
|
||||
*/
|
||||
NS_IMETHOD_(nsEventStatus) OnResize(nsGUIEvent *aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Handle an OnMove Message
|
||||
* @param aEvent The GUI Event to be handled
|
||||
* @result nsEventStatus, status of OnMove event processing
|
||||
*/
|
||||
NS_IMETHOD_(nsEventStatus) OnMove(nsGUIEvent *aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Handle an OnGotFocus Message
|
||||
* @param aEvent The GUI Event to be handled
|
||||
* @result nsEventStatus, status of OnGotFocus event processing
|
||||
*/
|
||||
NS_IMETHOD_(nsEventStatus) OnGotFocus(nsGUIEvent *aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Handle an OnLostFocus Message
|
||||
* @param aEvent The GUI Event to be handled
|
||||
* @result nsEventStatus, status of OnLostFocus event processing
|
||||
*/
|
||||
NS_IMETHOD_(nsEventStatus) OnLostFocus(nsGUIEvent *aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Handle an OnLeftButtonDown Message
|
||||
* @param aEvent The GUI Event to be handled
|
||||
* @result nsEventStatus, status of OnLeftButtonDown event processing
|
||||
*/
|
||||
NS_IMETHOD_(nsEventStatus) OnLeftButtonDown(nsGUIEvent *aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Handle an OnLeftButtonUp Message
|
||||
* @param aEvent The GUI Event to be handled
|
||||
* @result nsEventStatus, status of OnLeftButtonUp event processing
|
||||
*/
|
||||
NS_IMETHOD_(nsEventStatus) OnLeftButtonUp(nsGUIEvent *aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Handle an OnLeftButtonDoubleClick Message
|
||||
* @param aEvent The GUI Event to be handled
|
||||
* @result nsEventStatus, status of OnLeftButtonDoubleClick event processing
|
||||
*/
|
||||
NS_IMETHOD_(nsEventStatus) OnLeftButtonDoubleClick(nsGUIEvent *aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Handle an OnMiddleButtonDown Message
|
||||
* @param aEvent The GUI Event to be handled
|
||||
* @result nsEventStatus, status of OnMiddleButtonDown event processing
|
||||
*/
|
||||
NS_IMETHOD_(nsEventStatus) OnMiddleButtonDown(nsGUIEvent *aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Handle an OnMiddleButtonUp Message
|
||||
* @param aEvent The GUI Event to be handled
|
||||
* @result nsEventStatus, status of OnMiddleButtonUp event processing
|
||||
*/
|
||||
NS_IMETHOD_(nsEventStatus) OnMiddleButtonUp(nsGUIEvent *aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Handle an OnMiddleButtonDoubleClick Message
|
||||
* @param aEvent The GUI Event to be handled
|
||||
* @result nsEventStatus, status of OnMiddleButtonDoubleClick event processing
|
||||
*/
|
||||
NS_IMETHOD_(nsEventStatus) OnMiddleButtonDoubleClick(nsGUIEvent *aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Handle an OnRightButtonDown Message
|
||||
* @param aEvent The GUI Event to be handled
|
||||
* @result nsEventStatus, status of OnRightButtonDown event processing
|
||||
*/
|
||||
NS_IMETHOD_(nsEventStatus) OnRightButtonDown(nsGUIEvent *aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Handle an OnRightButtonUp Message
|
||||
* @param aEvent The GUI Event to be handled
|
||||
* @result nsEventStatus, status of OnRightButtonUp event processing
|
||||
*/
|
||||
NS_IMETHOD_(nsEventStatus) OnRightButtonUp(nsGUIEvent *aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Handle an OnRightButtonDoubleClick Message
|
||||
* @param aEvent The GUI Event to be handled
|
||||
* @result nsEventStatus, status of OnRightButtonDoubleClick event processing
|
||||
*/
|
||||
NS_IMETHOD_(nsEventStatus) OnRightButtonDoubleClick(nsGUIEvent *aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Handle an OnMouseEnter Message
|
||||
* @param aEvent The GUI Event to be handled
|
||||
* @result nsEventStatus, status of OnMouseEnter event processing
|
||||
*/
|
||||
NS_IMETHOD_(nsEventStatus) OnMouseEnter(nsGUIEvent *aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Handle an OnMouseExit Message
|
||||
* @param aEvent The GUI Event to be handled
|
||||
* @result nsEventStatus, status of OnMouseExit event processing
|
||||
*/
|
||||
NS_IMETHOD_(nsEventStatus) OnMouseExit(nsGUIEvent *aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Handle an OnMouseMove Message
|
||||
* @param aEvent The GUI Event to be handled
|
||||
* @result nsEventStatus, status of OnMouseMove event processing
|
||||
*/
|
||||
NS_IMETHOD_(nsEventStatus) OnMouseMove(nsGUIEvent *aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Handle an OnKeyUp Message
|
||||
* @param aEvent The GUI Event to be handled
|
||||
* @result nsEventStatus, status of OnKeyUp event processing
|
||||
*/
|
||||
NS_IMETHOD_(nsEventStatus) OnKeyUp(nsGUIEvent *aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Handle an OnKeyDown Message
|
||||
* @param aEvent The GUI Event to be handled
|
||||
* @result nsEventStatus, status of OnKeyDown event processing
|
||||
*/
|
||||
NS_IMETHOD_(nsEventStatus) OnKeyDown(nsGUIEvent *aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Create an nsIWidget for this canvas
|
||||
* @result nsresult, NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD CreateWidget() = 0;
|
||||
|
||||
/**
|
||||
* Get the nsIWidget aggregated by this canvas
|
||||
* @result nsIWidget pointer, nsnull if no widget aggregated, else the nsIWidget interface
|
||||
*/
|
||||
NS_IMETHOD_(nsIWidget *) GetWidget() = 0;
|
||||
|
||||
/**
|
||||
* Get the parent canvas
|
||||
* @result nsIXPFCCanvas pointer, nsnull if no parent, else the nsIXPFCCanvas interface
|
||||
*/
|
||||
NS_IMETHOD_(nsIXPFCCanvas *) GetParent() = 0;
|
||||
|
||||
/**
|
||||
* Set the parent canvas
|
||||
* @param aCanvas The parent canvas
|
||||
* @result none
|
||||
*/
|
||||
NS_IMETHOD_(void) SetParent(nsIXPFCCanvas * aCanvas) = 0;
|
||||
|
||||
/**
|
||||
* Set the bounds for this container
|
||||
* @param aBounds The new canvas bounds
|
||||
* @result nsresult, NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD SetBounds(const nsRect& aBounds) = 0;
|
||||
|
||||
/**
|
||||
* Get the bounds for this container
|
||||
* @param aRect Reference to an nsRect for the bounds
|
||||
* @result none
|
||||
*/
|
||||
NS_IMETHOD_(void) GetBounds(nsRect& aRect) = 0;
|
||||
|
||||
/**
|
||||
* Add a child canvas
|
||||
* @param aChildCanvas The child canvas to add
|
||||
* @param aPosition a position for inserting, default -1 means append
|
||||
* @result none
|
||||
*/
|
||||
NS_IMETHOD_(void) AddChildCanvas(nsIXPFCCanvas * aChildCanvas,
|
||||
PRInt32 aPosition = -1) = 0;
|
||||
|
||||
/**
|
||||
* Remove a child canvas
|
||||
* @param aChildCanvas The child canvas to be removed
|
||||
* @result none
|
||||
*/
|
||||
NS_IMETHOD_(void) RemoveChildCanvas(nsIXPFCCanvas * aChildCanvas) = 0;
|
||||
|
||||
/**
|
||||
* Reparent this canvas
|
||||
* @param aParentCanvas The new parent
|
||||
* @result none
|
||||
*/
|
||||
NS_IMETHOD_(void) Reparent(nsIXPFCCanvas * aParentCanvas) = 0;
|
||||
|
||||
/**
|
||||
* Get the background color for this canvas
|
||||
* @result nscolor the background color
|
||||
*/
|
||||
NS_IMETHOD_(nscolor) GetBackgroundColor(void) = 0;
|
||||
|
||||
/**
|
||||
* Set the background color for this canvas
|
||||
* @param aColor The background color
|
||||
* @result none
|
||||
*/
|
||||
NS_IMETHOD_(void) SetBackgroundColor(const nscolor &aColor) = 0;
|
||||
|
||||
/**
|
||||
* Get the foreground color for this canvas
|
||||
* @result nscolor the foreground color
|
||||
*/
|
||||
NS_IMETHOD_(nscolor) GetForegroundColor(void) = 0;
|
||||
|
||||
/**
|
||||
* Set the foreground color for this canvas
|
||||
* @param aColor The foreground color
|
||||
* @result none
|
||||
*/
|
||||
NS_IMETHOD_(void) SetForegroundColor(const nscolor &aColor) = 0;
|
||||
|
||||
/**
|
||||
* Get the border color for this canvas
|
||||
* @result nscolor the border color
|
||||
*/
|
||||
NS_IMETHOD_(nscolor) GetBorderColor(void) = 0;
|
||||
|
||||
/**
|
||||
* Set the border color for this canvas
|
||||
* @param aColor The border color
|
||||
* @result none
|
||||
*/
|
||||
NS_IMETHOD_(void) SetBorderColor(const nscolor &aColor) = 0;
|
||||
|
||||
/**
|
||||
* Highlight the incoming color
|
||||
* @param aColor the color to be highlighted
|
||||
* @result nscolor, the highlighted color
|
||||
*/
|
||||
NS_IMETHOD_(nscolor) Highlight(const nscolor &aColor) = 0;
|
||||
|
||||
/**
|
||||
* Dim the incoming color
|
||||
* @param aColor the color to be dimmed
|
||||
* @result nscolor, the dimmed color
|
||||
*/
|
||||
NS_IMETHOD_(nscolor) Dim(const nscolor &aColor) = 0;
|
||||
|
||||
/**
|
||||
* Find the topmost canvas given an nsPoint
|
||||
* @param aPoint The point over the canvas
|
||||
* @result nsIXPFCCanvas pointer, the canvas under the point
|
||||
*/
|
||||
NS_IMETHOD_(nsIXPFCCanvas *) CanvasFromPoint(const nsPoint &aPoint) = 0;
|
||||
|
||||
/**
|
||||
* Find the canvas with the given tabbing data
|
||||
* @param aTabGroup The tab group
|
||||
* @param aTabID The tab id
|
||||
* @result nsIXPFCCanvas pointer, the canvas with the tab data
|
||||
*/
|
||||
NS_IMETHOD_(nsIXPFCCanvas *) CanvasFromTab(PRUint32 aTabGroup, PRUint32 aTabID) = 0;
|
||||
|
||||
/**
|
||||
* The the preferred size for canvas's of this class
|
||||
* @param aSize, the default size for this class of canvas
|
||||
* @return nsresult, NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD GetClassPreferredSize(nsSize& aSize) = 0;
|
||||
|
||||
/**
|
||||
* Get the preferred size for this canvas
|
||||
* @param aSize, the preferred size, [-1,-1] if no preferred size
|
||||
* @result nsresult, NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD GetPreferredSize(nsSize &aSize) = 0;
|
||||
|
||||
/**
|
||||
* Get the maximum size for this canvas
|
||||
* @param aSize, the maximum size, [-1,-1] if no maximum size
|
||||
* @result nsresult, NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD GetMaximumSize(nsSize &aSize) = 0;
|
||||
|
||||
/**
|
||||
* Get the minimum size for this canvas
|
||||
* @param aSize, the minimum size, [-1,-1] if no minimum size
|
||||
* @result nsresult, NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD GetMinimumSize(nsSize &aSize) = 0;
|
||||
|
||||
/**
|
||||
* Set the preferred size for this canvas
|
||||
* @param aSize, the preferred size
|
||||
* @result nsresult, NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD SetPreferredSize(nsSize &aSize) = 0;
|
||||
|
||||
/**
|
||||
* Set the maximum size for this canvas
|
||||
* @param aSize, the maximum size
|
||||
* @result nsresult, NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD SetMaximumSize(nsSize &aSize) = 0;
|
||||
|
||||
/**
|
||||
* Set the minimum size for this canvas
|
||||
* @param aSize, the minimum size
|
||||
* @result nsresult, NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD SetMinimumSize(nsSize &aSize) = 0;
|
||||
|
||||
/**
|
||||
* Get the major axis weight
|
||||
* @result PRFloat64, The weight for the major axis
|
||||
*/
|
||||
NS_IMETHOD_(PRFloat64) GetMajorAxisWeight() = 0;
|
||||
|
||||
/**
|
||||
* Get the minor axis weight
|
||||
* @result PRFloat64, The weight for the minor axis
|
||||
*/
|
||||
NS_IMETHOD_(PRFloat64) GetMinorAxisWeight() = 0;
|
||||
|
||||
/**
|
||||
* Set the major axis weight
|
||||
* @param aWeight, The weight for the major axis
|
||||
* @result nsresult, NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD SetMajorAxisWeight(PRFloat64 aWeight) = 0;
|
||||
|
||||
/**
|
||||
* Set the minor axis weight
|
||||
* @param aWeight, The weight for the minor axis
|
||||
* @result nsresult, NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD SetMinorAxisWeight(PRFloat64 aWeight) = 0;
|
||||
|
||||
/**
|
||||
* Check to see if this container has a preferred size associated with it
|
||||
* @result PRBool, PR_TRUE if the canvas has a preferred size, else PR_FALSE
|
||||
*/
|
||||
NS_IMETHOD_(PRBool) HasPreferredSize() = 0;
|
||||
|
||||
/**
|
||||
* Check to see if this container has a minimu size associated with it
|
||||
* @result PRBool, PR_TRUE if the canvas has a minimum size, else PR_FALSE
|
||||
*/
|
||||
NS_IMETHOD_(PRBool) HasMinimumSize() = 0;
|
||||
|
||||
/**
|
||||
* Check to see if this container has a maximum size associated with it
|
||||
* @result PRBool, PR_TRUE if the canvas has a maximum size, else PR_FALSE
|
||||
*/
|
||||
NS_IMETHOD_(PRBool) HasMaximumSize() = 0;
|
||||
|
||||
/**
|
||||
* Get the number of children this canvas has
|
||||
* @result PRUint32, The number of children
|
||||
*/
|
||||
NS_IMETHOD_(PRUint32) GetChildCount() = 0;
|
||||
|
||||
/**
|
||||
* Delete all child canvas
|
||||
* @result nsresult, NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD DeleteChildren() = 0;
|
||||
|
||||
/**
|
||||
* Delete aCount child canvas's, removing from the end
|
||||
* @param aCount, the number of children to be deleted
|
||||
* @result nsresult, NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD DeleteChildren(PRUint32 aCount) = 0;
|
||||
|
||||
/**
|
||||
* Find the canvas with the given name
|
||||
* @param aName, the name to search for
|
||||
* @result nsIXPFCCanvas pointer, The canvas with aName, nsnull if none found
|
||||
*/
|
||||
NS_IMETHOD_(nsIXPFCCanvas *) CanvasFromName(nsString& aName) = 0;
|
||||
|
||||
/**
|
||||
* Set the opacity for this canvas
|
||||
* @param aOpacity, the opacity
|
||||
* @result nsresult, NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD SetOpacity(PRFloat64 aOpacity) = 0;
|
||||
|
||||
/**
|
||||
* Get the opacity for this canvas
|
||||
* @result PRFloat64, the opacity
|
||||
*/
|
||||
NS_IMETHOD_(PRFloat64) GetOpacity() = 0;
|
||||
|
||||
/**
|
||||
* Set the visibility of this canvas
|
||||
* @param aVisibility, PR_TRUE if visible
|
||||
* @result nsresult, NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD SetVisibility(PRBool aVisibility) = 0;
|
||||
|
||||
/**
|
||||
* Get the visibility of this canvas
|
||||
* @result PRBool, PR_TRUE if visible, else PR_FALSE
|
||||
*/
|
||||
NS_IMETHOD_(PRBool) GetVisibility() = 0;
|
||||
|
||||
/**
|
||||
* Get the font for this canvas
|
||||
* @result nsFont, the canvas font
|
||||
*/
|
||||
NS_IMETHOD_(nsFont&) GetFont() = 0;
|
||||
|
||||
/**
|
||||
* Set the font for this canvas
|
||||
* @param aFont the nsFont for this canvas
|
||||
* @result nsresult, NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD SetFont(nsFont& aFont) = 0;
|
||||
|
||||
/**
|
||||
* Get the font metrics for this canvas
|
||||
* @param nsIFontMetrics, the canvas font metrics
|
||||
* @result nsresult, NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD GetFontMetrics(nsIFontMetrics ** aFontMetrics) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Save canvas graphical state
|
||||
* @param aRenderingContext, rendering context to save state to
|
||||
* @result nsresult, NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD PushState(nsIRenderingContext * aRenderingContext) = 0;
|
||||
|
||||
/**
|
||||
* Get and and set RenderingContext to this graphical state
|
||||
* @param aRenderingContext, rendering context to get previously saved state from
|
||||
* @return if PR_TRUE, indicates that the clipping region after
|
||||
* popping state is empty, else PR_FALSE
|
||||
*/
|
||||
NS_IMETHOD_(PRBool) PopState(nsIRenderingContext * aRenderingContext) = 0;
|
||||
|
||||
/**
|
||||
* Set the tab id for this canvas
|
||||
* @param aTabID, the tab id
|
||||
* @return nsresult NS_OK, if successful
|
||||
*/
|
||||
NS_IMETHOD SetTabID(PRUint32 aTabID) = 0;
|
||||
|
||||
/**
|
||||
* Get the tab id for this canvas
|
||||
* @return PRUint32 the tab id
|
||||
*/
|
||||
NS_IMETHOD_(PRUint32) GetTabID() = 0;
|
||||
|
||||
/**
|
||||
* Set the tab group for this canvas
|
||||
* @param aTabGroup, the tab id
|
||||
* @return nsresult NS_OK, if successful
|
||||
*/
|
||||
NS_IMETHOD SetTabGroup(PRUint32 aTabGroup) = 0;
|
||||
|
||||
/**
|
||||
* Get the tab group for this canvas
|
||||
* @return PRUint32 the tab group
|
||||
*/
|
||||
NS_IMETHOD_(PRUint32) GetTabGroup() = 0;
|
||||
|
||||
/**
|
||||
* Set keyboard focus to this canvas
|
||||
* @return nsresult, NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD SetFocus() = 0;
|
||||
|
||||
NS_IMETHOD FindLargestTabGroup(PRUint32& aTabGroup) = 0;
|
||||
NS_IMETHOD FindLargestTabID(PRUint32 aTabGroup, PRUint32& aTabID) = 0;
|
||||
|
||||
/**
|
||||
* Dump the canvas hierarchy to a file
|
||||
* @param f, the FILE to dump to
|
||||
* @param indent, the indentation level for current canvas list
|
||||
* @result nsresult, NS_OK if successful
|
||||
*/
|
||||
#if defined(DEBUG) && defined(XP_PC)
|
||||
NS_IMETHOD DumpCanvas(FILE * f, PRUint32 indent) = 0 ;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Load a Widget with the given class ID
|
||||
* @param aClassIID, The class of the nsIWidget implementation
|
||||
* @result nsresult, NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD LoadWidget(const nsCID &aClassIID) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsIXPFCCanvas_h___ */
|
|
@ -0,0 +1,99 @@
|
|||
/* -*- 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.
|
||||
*/
|
||||
|
||||
#ifndef nsIXPFCCanvasManager_h___
|
||||
#define nsIXPFCCanvasManager_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIXPFCCanvas;
|
||||
class nsIWidget;
|
||||
|
||||
// IID for the nsIXPFCCanvasManager interface
|
||||
#define NS_IXPFC_CANVAS_MANAGER_IID \
|
||||
{ 0xa4853b10, 0x28a4, 0x11d2, \
|
||||
{ 0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } }
|
||||
|
||||
/**
|
||||
* XPFC CanvasManager interface. This is the interface for managing
|
||||
* canvas's within the scoope of an embeddable widget
|
||||
*/
|
||||
class nsIXPFCCanvasManager : public nsISupports
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Initialize the nsIXPFCCanvasManager
|
||||
* @result The result of the initialization, NS_Ok if no errors
|
||||
*/
|
||||
NS_IMETHOD Init() = 0;
|
||||
|
||||
/**
|
||||
* Find the canvas from the given widget
|
||||
* @param aWidget the widget aggregated by the canvas
|
||||
* @result nsIXPFCCanvas pointer, The resultant canvas, nsnull if none found
|
||||
*/
|
||||
NS_IMETHOD_(nsIXPFCCanvas *) CanvasFromWidget(nsIWidget * aWidget) = 0;
|
||||
|
||||
/**
|
||||
* Get a reference to the root canvas
|
||||
* @param aCanvas out paramater, the root canvas to be filled in
|
||||
* @result nsresult, NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD GetRootCanvas(nsIXPFCCanvas ** aCanvas) = 0;
|
||||
|
||||
/**
|
||||
* Set the Root Canvas
|
||||
* @param aCanvas the root canvas
|
||||
* @result nsresult, NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD SetRootCanvas(nsIXPFCCanvas * aCanvas) = 0;
|
||||
|
||||
/**
|
||||
* Register an association between a canvas and a widget
|
||||
* @param aCanvas the canvas
|
||||
* @param aWidget the widget
|
||||
* @result nsresult, NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD Register(nsIXPFCCanvas * aCanvas,
|
||||
nsIWidget * aWidget) = 0;
|
||||
|
||||
/**
|
||||
* UnRegister an association between a canvas and a widget
|
||||
* @param aCanvas the canvas
|
||||
* @result nsresult, NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD Unregister(nsIXPFCCanvas * aCanvas) = 0;
|
||||
|
||||
/**
|
||||
* Get the canvas with Keyboard Focus
|
||||
* @result nsIXPFCCanvas pointer, the canvas with focus
|
||||
*/
|
||||
NS_IMETHOD_(nsIXPFCCanvas *) GetFocusedCanvas() = 0;
|
||||
|
||||
/**
|
||||
* Set the canvas with Keyboard Focus
|
||||
* @param nsIXPFCCanvas pointer, the canvas to set focus to
|
||||
* @result nsresult, NS_OK if successful
|
||||
*/
|
||||
NS_IMETHOD SetFocusedCanvas(nsIXPFCCanvas * aCanvas) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsIXPFCCanvasManager_h___ */
|
|
@ -0,0 +1,53 @@
|
|||
#! gmake
|
||||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
|
||||
#######################################################################
|
||||
# (1) Include initial platform-independent assignments (MANDATORY). #
|
||||
#######################################################################
|
||||
|
||||
include manifest.mn
|
||||
|
||||
#######################################################################
|
||||
# (2) Include "global" configuration information. (OPTIONAL) #
|
||||
#######################################################################
|
||||
|
||||
include $(GDEPTH)/gconfig/config.mk
|
||||
|
||||
#######################################################################
|
||||
# (3) Include "component" configuration information. (OPTIONAL) #
|
||||
#######################################################################
|
||||
|
||||
|
||||
|
||||
#######################################################################
|
||||
# (4) Include "local" platform-dependent assignments (OPTIONAL). #
|
||||
#######################################################################
|
||||
|
||||
include config.mk
|
||||
|
||||
#######################################################################
|
||||
# (5) Execute "global" rules. (OPTIONAL) #
|
||||
#######################################################################
|
||||
|
||||
include $(GDEPTH)/gconfig/ruleset.mk
|
||||
include $(GDEPTH)/gconfig/rules.mk
|
||||
|
||||
#######################################################################
|
||||
# (6) Execute "component" rules. (OPTIONAL) #
|
||||
#######################################################################
|
||||
|
||||
|
||||
|
||||
#######################################################################
|
||||
# (7) Execute "local" rules. (OPTIONAL). #
|
||||
#######################################################################
|
||||
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
|
||||
#
|
||||
# Override TARGETS variable so that only static libraries
|
||||
# are specifed as dependencies within rules.mk.
|
||||
#
|
||||
|
||||
CFLAGS +=-D_IMPL_NS_XPFC -DNSPR20
|
||||
INCLUDES += -I../inc -I$(GDEPTH)/include
|
||||
|
||||
LIBRARY_NAME = canvas
|
||||
LIBRARY_VERSION = 10
|
||||
|
||||
ARCHIVE_ONLY = 1
|
||||
|
||||
TARGETS = $(LIBRARY)
|
|
@ -0,0 +1,27 @@
|
|||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
GDEPTH = ../../../../..
|
||||
|
||||
EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
PRIVATE_EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
MODULE = xpfc
|
||||
|
||||
CPPSRCS = \
|
||||
nsXPFCCanvas.cpp \
|
||||
nsXPFCHTMLCanvas.cpp \
|
||||
nsXPFCCanvasManager.cpp \
|
||||
$(NULL)
|
||||
|
||||
REQUIRES = xpcom raptor netlib
|
||||
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,197 @@
|
|||
/* -*- 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 "nsXPFCCanvasManager.h"
|
||||
#include "nsIXPFCCanvas.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsxpfcCIID.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kXPFCCanvasManagerIID, NS_IXPFC_CANVAS_MANAGER_IID);
|
||||
|
||||
static NS_DEFINE_IID(kCXPFCCanvasIID, NS_IXPFC_CANVAS_IID);
|
||||
|
||||
class ListEntry {
|
||||
public:
|
||||
nsIWidget * widget;
|
||||
nsIXPFCCanvas * canvas;
|
||||
|
||||
ListEntry(nsIWidget * aWidget,
|
||||
nsIXPFCCanvas * aCanvas) {
|
||||
widget = aWidget;
|
||||
canvas = aCanvas;
|
||||
}
|
||||
~ListEntry() {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
nsXPFCCanvasManager :: nsXPFCCanvasManager()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mList = nsnull;
|
||||
monitor = nsnull;
|
||||
mRootCanvas = nsnull;
|
||||
mFocusedCanvas = nsnull;
|
||||
}
|
||||
|
||||
nsXPFCCanvasManager :: ~nsXPFCCanvasManager()
|
||||
{
|
||||
PR_DestroyMonitor(monitor);
|
||||
NS_IF_RELEASE(mRootCanvas);
|
||||
NS_IF_RELEASE(mList);
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsXPFCCanvasManager)
|
||||
NS_IMPL_RELEASE(nsXPFCCanvasManager)
|
||||
NS_IMPL_QUERY_INTERFACE(nsXPFCCanvasManager, kXPFCCanvasManagerIID)
|
||||
|
||||
nsresult nsXPFCCanvasManager::Init()
|
||||
{
|
||||
if (mList == nsnull) {
|
||||
|
||||
static NS_DEFINE_IID(kCVectorIteratorCID, NS_VECTOR_ITERATOR_CID);
|
||||
static NS_DEFINE_IID(kCVectorCID, NS_VECTOR_CID);
|
||||
|
||||
nsresult res = nsRepository::CreateInstance(kCVectorCID,
|
||||
nsnull,
|
||||
kCVectorCID,
|
||||
(void **)&mList);
|
||||
|
||||
if (NS_OK != res)
|
||||
return res ;
|
||||
|
||||
mList->Init();
|
||||
}
|
||||
|
||||
if (monitor == nsnull) {
|
||||
monitor = PR_NewMonitor();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIXPFCCanvas * nsXPFCCanvasManager::CanvasFromWidget(nsIWidget * aWidget)
|
||||
{
|
||||
nsIXPFCCanvas * canvas = nsnull;
|
||||
|
||||
PR_EnterMonitor(monitor);
|
||||
|
||||
nsIIterator * iterator;
|
||||
|
||||
mList->CreateIterator(&iterator);
|
||||
|
||||
iterator->Init();
|
||||
|
||||
ListEntry * item ;
|
||||
|
||||
while(!(iterator->IsDone()))
|
||||
{
|
||||
item = (ListEntry *) iterator->CurrentItem();
|
||||
|
||||
if (item->widget == aWidget)
|
||||
{
|
||||
canvas = item->canvas;
|
||||
break;
|
||||
}
|
||||
|
||||
iterator->Next();
|
||||
}
|
||||
|
||||
NS_RELEASE(iterator);
|
||||
|
||||
PR_ExitMonitor(monitor);
|
||||
|
||||
return (canvas);
|
||||
}
|
||||
|
||||
nsresult nsXPFCCanvasManager::Register(nsIXPFCCanvas * aCanvas, nsIWidget * aWidget)
|
||||
{
|
||||
PR_EnterMonitor(monitor);
|
||||
|
||||
mList->Append(new ListEntry(aWidget, aCanvas));
|
||||
|
||||
PR_ExitMonitor(monitor);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXPFCCanvasManager::Unregister(nsIXPFCCanvas * aCanvas)
|
||||
{
|
||||
|
||||
PR_EnterMonitor(monitor);
|
||||
|
||||
/*
|
||||
* We need to loop through looking for a match of both and then remove them
|
||||
*/
|
||||
nsIIterator * iterator;
|
||||
|
||||
mList->CreateIterator(&iterator);
|
||||
|
||||
iterator->Init();
|
||||
|
||||
ListEntry * item ;
|
||||
|
||||
while(!(iterator->IsDone()))
|
||||
{
|
||||
item = (ListEntry *) iterator->CurrentItem();
|
||||
|
||||
if (item->canvas == aCanvas)
|
||||
{
|
||||
mList->Remove((nsComponent)item);
|
||||
break;
|
||||
}
|
||||
|
||||
iterator->Next();
|
||||
}
|
||||
|
||||
NS_RELEASE(iterator);
|
||||
|
||||
PR_ExitMonitor(monitor);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXPFCCanvasManager::GetRootCanvas(nsIXPFCCanvas ** aCanvas)
|
||||
{
|
||||
*aCanvas = mRootCanvas;
|
||||
NS_ADDREF(mRootCanvas);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXPFCCanvasManager::SetRootCanvas(nsIXPFCCanvas * aCanvas)
|
||||
{
|
||||
NS_IF_RELEASE(mRootCanvas);
|
||||
mRootCanvas = aCanvas;
|
||||
NS_ADDREF(mRootCanvas);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXPFCCanvasManager::SetFocusedCanvas(nsIXPFCCanvas * aCanvas)
|
||||
{
|
||||
mFocusedCanvas = aCanvas;
|
||||
|
||||
mFocusedCanvas->SetFocus();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIXPFCCanvas * nsXPFCCanvasManager::GetFocusedCanvas()
|
||||
{
|
||||
return(mFocusedCanvas);
|
||||
}
|
|
@ -0,0 +1,149 @@
|
|||
/* -*- 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 "nsXPFCHTMLCanvas.h"
|
||||
#include "nsxpfcCIID.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIDeviceContext.h"
|
||||
#include "nsFont.h"
|
||||
#include "nsIFontMetrics.h"
|
||||
#include "nspr.h"
|
||||
#include "nsxpfcstrings.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kXPFCHTMLCanvasCID, NS_XPFC_HTML_CANVAS_CID);
|
||||
|
||||
#define kNotFound -1
|
||||
|
||||
#define DEFAULT_WIDTH 25
|
||||
#define DEFAULT_HEIGHT 25
|
||||
|
||||
nsXPFCHTMLCanvas :: nsXPFCHTMLCanvas(nsISupports* outer) : nsXPFCCanvas(outer)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mWebShell = nsnull;
|
||||
}
|
||||
|
||||
nsXPFCHTMLCanvas :: ~nsXPFCHTMLCanvas()
|
||||
{
|
||||
NS_IF_RELEASE(mWebShell);
|
||||
}
|
||||
|
||||
nsresult nsXPFCHTMLCanvas::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kClassIID, kXPFCHTMLCanvasCID);
|
||||
if (aIID.Equals(kClassIID)) {
|
||||
*aInstancePtr = (void*) (nsXPFCHTMLCanvas *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) (this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return (nsXPFCCanvas::QueryInterface(aIID, aInstancePtr));
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsXPFCHTMLCanvas)
|
||||
NS_IMPL_RELEASE(nsXPFCHTMLCanvas)
|
||||
|
||||
nsresult nsXPFCHTMLCanvas :: Init()
|
||||
{
|
||||
static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID);
|
||||
static NS_DEFINE_IID(kCWebShellCID, NS_WEB_SHELL_CID);
|
||||
|
||||
nsresult res = nsRepository::CreateInstance(kCWebShellCID,
|
||||
nsnull,
|
||||
kIWebShellIID,
|
||||
(void**)&mWebShell);
|
||||
|
||||
|
||||
if (res != NS_OK)
|
||||
return res;
|
||||
|
||||
mWebShell->Init(GetWidget()->GetNativeData(NS_NATIVE_WIDGET), 0,0,DEFAULT_WIDTH, DEFAULT_HEIGHT);
|
||||
// mWebShell->SetContainer((nsIWebShellContainer*) this);
|
||||
// mWebShell->SetObserver((nsIStreamObserver*)this);
|
||||
// mWebShell->SetPrefs(aPrefs);
|
||||
mWebShell->Show();
|
||||
|
||||
nsString url("about:blank");
|
||||
|
||||
PRUnichar* p = url.ToNewUnicode();
|
||||
|
||||
mWebShell->LoadURL(p, nsnull);
|
||||
|
||||
delete p;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsEventStatus nsXPFCHTMLCanvas :: OnResize(nsGUIEvent *aEvent)
|
||||
{
|
||||
return (nsXPFCCanvas::OnResize(aEvent));
|
||||
}
|
||||
|
||||
nsresult nsXPFCHTMLCanvas :: SetBounds(const nsRect &aBounds)
|
||||
{
|
||||
nsXPFCCanvas::SetBounds(aBounds);
|
||||
if (mWebShell != nsnull)
|
||||
mWebShell->SetBounds(aBounds.x,aBounds.y,aBounds.width,aBounds.height);
|
||||
return (NS_OK);
|
||||
}
|
||||
|
||||
|
||||
nsEventStatus nsXPFCHTMLCanvas :: OnPaint(nsGUIEvent *aEvent)
|
||||
{
|
||||
nsEventStatus es = nsXPFCCanvas::OnPaint(aEvent);
|
||||
if (mWebShell != nsnull)
|
||||
mWebShell->Repaint(PR_FALSE);
|
||||
return (es);
|
||||
}
|
||||
|
||||
nsEventStatus nsXPFCHTMLCanvas :: HandleEvent(nsGUIEvent *aEvent)
|
||||
{
|
||||
return (nsXPFCCanvas::HandleEvent(aEvent));
|
||||
}
|
||||
|
||||
nsresult nsXPFCHTMLCanvas :: GetClassPreferredSize(nsSize& aSize)
|
||||
{
|
||||
aSize.width = DEFAULT_WIDTH;
|
||||
aSize.height = DEFAULT_HEIGHT;
|
||||
return (NS_OK);
|
||||
}
|
||||
|
||||
|
||||
nsresult nsXPFCHTMLCanvas :: SetParameter(nsString& aKey, nsString& aValue)
|
||||
{
|
||||
if (aKey.EqualsIgnoreCase(XPFC_STRING_SRC)) {
|
||||
|
||||
PRUnichar* p = aValue.ToNewUnicode();
|
||||
|
||||
mWebShell->LoadURL(p, nsnull);
|
||||
|
||||
delete p;
|
||||
|
||||
}
|
||||
|
||||
return (nsXPFCCanvas::SetParameter(aKey,aValue));
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
GDEPTH = ../../../../..
|
||||
|
||||
EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
PRIVATE_EXPORTS = \
|
||||
nsMenuContainer.h \
|
||||
nsMenuItem.h \
|
||||
nsXPFCToolbar.h \
|
||||
$(NULL)
|
||||
|
||||
MODULE = xpfc
|
||||
|
||||
REQUIRES = raptor
|
|
@ -0,0 +1,45 @@
|
|||
/* -*- 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.
|
||||
*/
|
||||
|
||||
#ifndef nsXPFCToolbar_h___
|
||||
#define nsXPFCToolbar_h___
|
||||
|
||||
#include "nsIXPFCToolbar.h"
|
||||
#include "nsXPFCCanvas.h"
|
||||
|
||||
class nsXPFCToolbar : public nsIXPFCToolbar,
|
||||
public nsXPFCCanvas
|
||||
|
||||
{
|
||||
public:
|
||||
nsXPFCToolbar(nsISupports* outer);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD Init();
|
||||
|
||||
NS_IMETHOD SetParameter(nsString& aKey, nsString& aValue) ;
|
||||
NS_IMETHOD GetClassPreferredSize(nsSize& aSize);
|
||||
|
||||
protected:
|
||||
~nsXPFCToolbar();
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsXPFCToolbar_h___ */
|
|
@ -0,0 +1,16 @@
|
|||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
GDEPTH = ../../../..
|
||||
DEPTH = ../../../..
|
||||
|
||||
DIRS_EXPORT = public inc
|
||||
DIRS_LIBS = src
|
||||
DIRS = $(PLATFORM_DIRECTORY)
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
GDEPTH = ../../../../..
|
||||
DEPTH = ../../../../..
|
||||
|
||||
EXPORTS = \
|
||||
nsIMenuBar.h \
|
||||
nsIMenuContainer.h \
|
||||
nsIMenuItem.h \
|
||||
nsIXPFCToolbar.h \
|
||||
$(NULL)
|
||||
|
||||
PRIVATE_EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
MODULE = xpfc
|
||||
|
||||
REQUIRES = raptor
|
|
@ -0,0 +1,38 @@
|
|||
/* -*- 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.
|
||||
*/
|
||||
|
||||
#ifndef nsIXPFCToolbar_h___
|
||||
#define nsIXPFCToolbar_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
// deb24690-35f8-11d2-9248-00805f8a7ab6
|
||||
#define NS_IXPFC_TOOLBAR_IID \
|
||||
{ 0xdeb24690, 0x35f8, 0x11d2, \
|
||||
{0x92, 0x48, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} }
|
||||
|
||||
class nsIXPFCToolbar : public nsISupports
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
NS_IMETHOD Init() = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIXPFCToolbar_h___ */
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
GDEPTH = ../../../../..
|
||||
|
||||
EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
PRIVATE_EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
MODULE = xpfc
|
||||
|
||||
CPPSRCS = \
|
||||
nsMenuContainer.cpp \
|
||||
nsMenuItem.cpp \
|
||||
nsXPFCToolbar.cpp \
|
||||
$(NULL)
|
||||
|
||||
REQUIRES = xpcom raptor netlib
|
||||
|
|
@ -0,0 +1,322 @@
|
|||
/* -*- 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 "nscore.h"
|
||||
#include "nsMenuContainer.h"
|
||||
#include "nsIXMLParserObject.h"
|
||||
#include "nspr.h"
|
||||
#include "plstr.h"
|
||||
#include "nsxpfcCIID.h"
|
||||
#include "nsXPFCActionCommand.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsIFileWidget.h"
|
||||
#include "nsIWebViewerContainer.h"
|
||||
|
||||
static NS_DEFINE_IID(kIXMLParserObjectIID, NS_IXML_PARSER_OBJECT_IID);
|
||||
static NS_DEFINE_IID(kCIMenuContainerIID, NS_IMENUCONTAINER_IID);
|
||||
static NS_DEFINE_IID(kCIMenuItemIID, NS_IMENUITEM_IID);
|
||||
static NS_DEFINE_IID(kFileWidgetCID, NS_FILEWIDGET_CID);
|
||||
static NS_DEFINE_IID(kIFileWidgetIID, NS_IFILEWIDGET_IID);
|
||||
static NS_DEFINE_IID(kXPFCCommandReceiverIID, NS_IXPFC_COMMANDRECEIVER_IID);
|
||||
|
||||
nsMenuContainer::nsMenuContainer() : nsMenuItem()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mChildMenus = nsnull;
|
||||
mShellInstance = nsnull;
|
||||
mWebViewerContainer = nsnull;
|
||||
}
|
||||
|
||||
nsMenuContainer::~nsMenuContainer()
|
||||
{
|
||||
}
|
||||
|
||||
NS_DEFINE_IID(kIMenuContainerIID, NS_IMENUCONTAINER_IID);
|
||||
|
||||
NS_IMPL_ADDREF(nsMenuContainer)
|
||||
NS_IMPL_RELEASE(nsMenuContainer)
|
||||
|
||||
nsresult nsMenuContainer::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kClassIID, kIMenuContainerIID);
|
||||
static NS_DEFINE_IID(kIMenuBarIID, NS_IMENUBAR_IID);
|
||||
|
||||
if (aIID.Equals(kClassIID)) {
|
||||
*aInstancePtr = (void*) this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) (this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIMenuBarIID)) {
|
||||
*aInstancePtr = (nsIMenuBar*) (this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kXPFCCommandReceiverIID)) {
|
||||
*aInstancePtr = (void*)(nsIXPFCCommandReceiver *) this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIXMLParserObjectIID)) {
|
||||
*aInstancePtr = (nsIXMLParserObject*) (this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return (nsMenuItem::QueryInterface(aIID,aInstancePtr));
|
||||
|
||||
}
|
||||
|
||||
nsresult nsMenuContainer::Init()
|
||||
{
|
||||
static NS_DEFINE_IID(kCVectorCID, NS_VECTOR_CID);
|
||||
nsresult res = nsRepository::CreateInstance(kCVectorCID,
|
||||
nsnull,
|
||||
kCVectorCID,
|
||||
(void **)&mChildMenus);
|
||||
|
||||
if (NS_OK != res)
|
||||
return res ;
|
||||
|
||||
mChildMenus->Init();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void* nsMenuContainer::GetNativeHandle()
|
||||
{
|
||||
return (nsnull);
|
||||
}
|
||||
|
||||
nsresult nsMenuContainer :: SetParameter(nsString& aKey, nsString& aValue)
|
||||
{
|
||||
return (nsMenuItem::SetParameter(aKey,aValue));
|
||||
}
|
||||
|
||||
nsresult nsMenuContainer :: AddMenuItem(nsIMenuItem * aMenuItem)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsMenuContainer :: AddChild(nsIMenuItem * aItem)
|
||||
{
|
||||
mChildMenus->Append(aItem);
|
||||
|
||||
aItem->SetParent(this);
|
||||
|
||||
return (NS_OK);
|
||||
}
|
||||
|
||||
|
||||
nsresult nsMenuContainer :: Update()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsMenuContainer :: SetShellContainer(nsIShellInstance * aShellInstance,
|
||||
nsIWebViewerContainer * aWebViewerContainer)
|
||||
{
|
||||
mShellInstance = aShellInstance;
|
||||
mWebViewerContainer = aWebViewerContainer;
|
||||
|
||||
/*
|
||||
* Make this the default receiver for the menubar on the webview container
|
||||
*/
|
||||
|
||||
mWebViewerContainer->GetMenuManager()->SetDefaultReceiver((nsIXPFCCommandReceiver *)this);
|
||||
|
||||
return (NS_OK);
|
||||
}
|
||||
|
||||
nsIMenuItem * nsMenuContainer :: MenuItemFromID(PRUint32 aID)
|
||||
{
|
||||
nsresult res;
|
||||
nsIIterator * iterator = nsnull;
|
||||
nsIMenuItem * item = nsnull;
|
||||
nsIMenuItem * child = nsnull;
|
||||
nsIMenuContainer * container = nsnull;
|
||||
PRBool bFoundItem = PR_FALSE;
|
||||
|
||||
res = mChildMenus->CreateIterator(&iterator);
|
||||
|
||||
if (res != NS_OK)
|
||||
return nsnull;
|
||||
|
||||
iterator->Init();
|
||||
|
||||
while(!(iterator->IsDone()))
|
||||
{
|
||||
item = (nsIMenuItem *) iterator->CurrentItem();
|
||||
|
||||
if (item->GetMenuID() == aID)
|
||||
{
|
||||
bFoundItem = PR_TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
iterator->Next();
|
||||
}
|
||||
|
||||
if (bFoundItem == PR_FALSE)
|
||||
{
|
||||
item = nsnull;
|
||||
|
||||
iterator->Init();
|
||||
|
||||
while(!(iterator->IsDone()))
|
||||
{
|
||||
child = (nsIMenuItem *) iterator->CurrentItem();
|
||||
|
||||
res = child->QueryInterface(kCIMenuContainerIID, (void**)&container);
|
||||
|
||||
if (NS_OK == res)
|
||||
{
|
||||
|
||||
item = container->MenuItemFromID(aID);
|
||||
|
||||
NS_RELEASE(container);
|
||||
|
||||
if (item != nsnull)
|
||||
break;
|
||||
}
|
||||
|
||||
iterator->Next();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
NS_RELEASE(iterator);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
nsresult nsMenuContainer :: Action(nsIXPFCCommand * aCommand)
|
||||
{
|
||||
|
||||
/*
|
||||
* Check to see this is an ActionCommand
|
||||
*/
|
||||
|
||||
nsresult res;
|
||||
|
||||
nsXPFCActionCommand * action_command = nsnull;
|
||||
static NS_DEFINE_IID(kXPFCActionCommandCID, NS_XPFC_ACTION_COMMAND_CID);
|
||||
|
||||
res = aCommand->QueryInterface(kXPFCActionCommandCID,(void**)&action_command);
|
||||
|
||||
if (NS_OK != res)
|
||||
return res;
|
||||
|
||||
|
||||
/*
|
||||
* Yeah, this is an action command. Do something
|
||||
*/
|
||||
|
||||
ProcessActionCommand(action_command->mAction);
|
||||
|
||||
NS_RELEASE(action_command);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsMenuContainer::ProcessActionCommand(nsString& aAction)
|
||||
{
|
||||
/*
|
||||
* Handle File Open...
|
||||
*/
|
||||
|
||||
if (aAction == "FileOpen")
|
||||
{
|
||||
PRBool selectedFileName = PR_FALSE;
|
||||
nsIFileWidget *fileWidget;
|
||||
nsString title("Open UI");
|
||||
nsString name;
|
||||
|
||||
nsresult rv = nsRepository::CreateInstance(kFileWidgetCID,
|
||||
nsnull,
|
||||
kIFileWidgetIID,
|
||||
(void**)&fileWidget);
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
nsString titles[] = {"all files","calendar ui", "xpfc ui" };
|
||||
nsString filters[] = {"*.*", "*.cal", "*.ui"};
|
||||
|
||||
fileWidget->SetFilterList(3, titles, filters);
|
||||
|
||||
fileWidget->Create(mShellInstance->GetApplicationWidget(),
|
||||
title,
|
||||
eMode_load,
|
||||
nsnull,
|
||||
nsnull);
|
||||
|
||||
PRUint32 result = fileWidget->Show();
|
||||
|
||||
if (result)
|
||||
{
|
||||
fileWidget->GetFile(name);
|
||||
selectedFileName = PR_TRUE;
|
||||
}
|
||||
|
||||
NS_RELEASE(fileWidget);
|
||||
}
|
||||
|
||||
if (selectedFileName == PR_TRUE)
|
||||
{
|
||||
if (mWebViewerContainer)
|
||||
mWebViewerContainer->LoadURL(name,nsnull);
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle Application Exit
|
||||
*/
|
||||
|
||||
} else if (aAction == "ApplicationExit") {
|
||||
|
||||
mShellInstance->ExitApplication();
|
||||
|
||||
} else if (aAction == "StartCommandServer") {
|
||||
|
||||
nsIApplicationShell * shell = nsnull;
|
||||
|
||||
mWebViewerContainer->GetApplicationShell(shell);
|
||||
|
||||
shell->StartCommandServer();
|
||||
|
||||
} else if (aAction == "LaunchCommandClient") {
|
||||
|
||||
mShellInstance->LaunchApplication(nsString("trextest"));
|
||||
|
||||
} else if (aAction == "ComposeEvent") {
|
||||
|
||||
if (mWebViewerContainer)
|
||||
mWebViewerContainer->LoadURL("resource://res/ui/compose_event.ui",nsnull);
|
||||
|
||||
}
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
|
@ -0,0 +1,240 @@
|
|||
/* -*- 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 "nscore.h"
|
||||
#include "nsMenuItem.h"
|
||||
#include "nsIXMLParserObject.h"
|
||||
#include "nsXPFCActionCommand.h"
|
||||
#include "nsRepository.h"
|
||||
#include "nsxpfcCIID.h"
|
||||
|
||||
static NS_DEFINE_IID(kIXMLParserObjectIID, NS_IXML_PARSER_OBJECT_IID);
|
||||
|
||||
nsMenuItem::nsMenuItem()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mName = "Item";
|
||||
mLabel = "Label";
|
||||
mParent = nsnull;
|
||||
mSeparator = PR_FALSE;
|
||||
mAlignmentStyle = eAlignmentStyle_none;
|
||||
mID = 0;
|
||||
mReceiver = nsnull;
|
||||
mCommand = "Command";
|
||||
mEnabled = PR_TRUE;
|
||||
}
|
||||
|
||||
nsMenuItem::~nsMenuItem()
|
||||
{
|
||||
}
|
||||
|
||||
NS_DEFINE_IID(kIMenuItemIID, NS_IMENUITEM_IID);
|
||||
|
||||
NS_IMPL_ADDREF(nsMenuItem)
|
||||
NS_IMPL_RELEASE(nsMenuItem)
|
||||
|
||||
nsresult nsMenuItem::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kClassIID, kIMenuItemIID);
|
||||
|
||||
if (aIID.Equals(kClassIID)) {
|
||||
*aInstancePtr = (void*) this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) (this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIXMLParserObjectIID)) {
|
||||
*aInstancePtr = (nsIXMLParserObject*) (this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
|
||||
}
|
||||
|
||||
nsresult nsMenuItem::Init()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsMenuItem :: SetParameter(nsString& aKey, nsString& aValue)
|
||||
{
|
||||
if (aKey == "name") {
|
||||
|
||||
SetName(aValue);
|
||||
|
||||
} else if (aKey == "align") {
|
||||
|
||||
if (aValue == "left")
|
||||
mAlignmentStyle = eAlignmentStyle_left;
|
||||
else if (aValue == "right")
|
||||
mAlignmentStyle = eAlignmentStyle_right;
|
||||
|
||||
} else if (aKey == "enable") {
|
||||
|
||||
if (aValue == "False")
|
||||
mEnabled = PR_FALSE;
|
||||
else if (aValue == "True")
|
||||
mEnabled = PR_TRUE;
|
||||
|
||||
} else if (aKey == "type") {
|
||||
|
||||
if (aValue == "separator")
|
||||
mSeparator = PR_TRUE;
|
||||
|
||||
} else if (aKey == "label") {
|
||||
|
||||
SetLabel(aValue);
|
||||
|
||||
} else if (aKey == "command") {
|
||||
|
||||
SetCommand(aValue);
|
||||
|
||||
}
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsMenuItem::IsSeparator()
|
||||
{
|
||||
return (mSeparator);
|
||||
}
|
||||
|
||||
nsAlignmentStyle nsMenuItem::GetAlignmentStyle()
|
||||
{
|
||||
return (mAlignmentStyle);
|
||||
}
|
||||
|
||||
nsresult nsMenuItem::SetAlignmentStyle(nsAlignmentStyle aAlignmentStyle)
|
||||
{
|
||||
mAlignmentStyle = aAlignmentStyle;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsMenuItem::GetEnabled()
|
||||
{
|
||||
return (mEnabled);
|
||||
}
|
||||
|
||||
nsresult nsMenuItem::SetEnabled(PRBool aEnable)
|
||||
{
|
||||
mEnabled = aEnable;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsMenuItem :: SetName(nsString& aName)
|
||||
{
|
||||
mName = aName;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsString& nsMenuItem :: GetName()
|
||||
{
|
||||
return (mName);
|
||||
}
|
||||
|
||||
nsresult nsMenuItem :: SetCommand(nsString& aCommand)
|
||||
{
|
||||
mCommand = aCommand;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsString& nsMenuItem :: GetCommand()
|
||||
{
|
||||
return (mCommand);
|
||||
}
|
||||
|
||||
nsresult nsMenuItem :: SetLabel(nsString& aLabel)
|
||||
{
|
||||
mLabel = aLabel;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsString& nsMenuItem :: GetLabel()
|
||||
{
|
||||
return (mLabel);
|
||||
}
|
||||
|
||||
nsIMenuContainer * nsMenuItem::GetParent()
|
||||
{
|
||||
return (mParent);
|
||||
}
|
||||
|
||||
nsresult nsMenuItem::SetParent(nsIMenuContainer * aParent)
|
||||
{
|
||||
mParent = aParent;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsMenuItem :: SetMenuID(PRUint32 aID)
|
||||
{
|
||||
mID = aID;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRUint32 nsMenuItem :: GetMenuID()
|
||||
{
|
||||
return (mID);
|
||||
}
|
||||
|
||||
nsresult nsMenuItem::SetReceiver(nsIXPFCCommandReceiver * aReceiver)
|
||||
{
|
||||
mReceiver = aReceiver;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsMenuItem :: SendCommand()
|
||||
{
|
||||
if (mReceiver == nsnull)
|
||||
return NS_OK;
|
||||
|
||||
nsXPFCActionCommand * command;
|
||||
|
||||
static NS_DEFINE_IID(kCXPFCActionCommandCID, NS_XPFC_ACTION_COMMAND_CID);
|
||||
static NS_DEFINE_IID(kXPFCCommandIID, NS_IXPFC_COMMAND_IID);
|
||||
|
||||
nsresult res = nsRepository::CreateInstance(kCXPFCActionCommandCID,
|
||||
nsnull,
|
||||
kXPFCCommandIID,
|
||||
(void **)&command);
|
||||
|
||||
if (NS_OK != res)
|
||||
return res ;
|
||||
|
||||
command->Init();
|
||||
|
||||
command->mAction = mCommand;
|
||||
|
||||
mReceiver->Action(command);
|
||||
|
||||
NS_RELEASE(command);
|
||||
|
||||
return (NS_OK);
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
/* -*- 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 "nsXPFCToolbar.h"
|
||||
#include "nsxpfcCIID.h"
|
||||
#include "nspr.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kCXPFCToolbarCID, NS_XPFC_TOOLBAR_CID);
|
||||
static NS_DEFINE_IID(kCIXPFCToolbarIID, NS_IXPFC_TOOLBAR_IID);
|
||||
|
||||
#define DEFAULT_WIDTH 50
|
||||
#define DEFAULT_HEIGHT 50
|
||||
|
||||
nsXPFCToolbar :: nsXPFCToolbar(nsISupports* outer) : nsXPFCCanvas(outer)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsXPFCToolbar :: ~nsXPFCToolbar()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult nsXPFCToolbar::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kClassIID, kCXPFCToolbarCID);
|
||||
if (aIID.Equals(kClassIID)) {
|
||||
*aInstancePtr = (void*) (nsXPFCToolbar *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kCIXPFCToolbarIID)) {
|
||||
*aInstancePtr = (void*) (nsIXPFCToolbar *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) (this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return (nsXPFCCanvas::QueryInterface(aIID, aInstancePtr));
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsXPFCToolbar)
|
||||
NS_IMPL_RELEASE(nsXPFCToolbar)
|
||||
|
||||
nsresult nsXPFCToolbar :: Init()
|
||||
{
|
||||
return (nsXPFCCanvas::Init());
|
||||
}
|
||||
|
||||
nsresult nsXPFCToolbar :: SetParameter(nsString& aKey, nsString& aValue)
|
||||
{
|
||||
return (nsXPFCCanvas::SetParameter(aKey, aValue));
|
||||
}
|
||||
|
||||
nsresult nsXPFCToolbar :: GetClassPreferredSize(nsSize& aSize)
|
||||
{
|
||||
aSize.width = DEFAULT_WIDTH;
|
||||
aSize.height = DEFAULT_HEIGHT;
|
||||
return (NS_OK);
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
GDEPTH = ../../../../../..
|
||||
|
||||
EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
PRIVATE_EXPORTS = \
|
||||
nsMenuContainerUnix.h \
|
||||
$(NULL)
|
||||
|
||||
MODULE = xpfc
|
||||
|
||||
REQUIRES = raptor
|
|
@ -0,0 +1,15 @@
|
|||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
GDEPTH = ../../../../..
|
||||
DEPTH = ../../../../..
|
||||
|
||||
DIRS_EXPORT = inc
|
||||
DIRS_LIBS = src
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
GDEPTH = ../../../../../..
|
||||
|
||||
EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
PRIVATE_EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
MODULE = xpfc
|
||||
|
||||
CPPSRCS = \
|
||||
nsMenuContainerUnix.cpp \
|
||||
$(NULL)
|
||||
|
||||
REQUIRES = xpcom raptor netlib
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
GDEPTH = ../../../../../..
|
||||
|
||||
EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
PRIVATE_EXPORTS = \
|
||||
nsMenuContainerWin.h \
|
||||
$(NULL)
|
||||
|
||||
MODULE = xpfc
|
||||
|
||||
REQUIRES = raptor
|
|
@ -0,0 +1,15 @@
|
|||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
GDEPTH = ../../../../..
|
||||
DEPTH = ../../../../..
|
||||
|
||||
DIRS_EXPORT = inc
|
||||
DIRS_LIBS = src
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
GDEPTH = ../../../../../..
|
||||
|
||||
EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
PRIVATE_EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
MODULE = xpfc
|
||||
|
||||
CPPSRCS = \
|
||||
nsMenuContainerWin.cpp \
|
||||
$(NULL)
|
||||
|
||||
REQUIRES = xpcom raptor netlib
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
GDEPTH = ../../../../..
|
||||
|
||||
EXPORTS = \
|
||||
nsxpfcCIID.h \
|
||||
nsxpfcstrings.h \
|
||||
nsxpfc.h \
|
||||
nsxpfcFactory.h \
|
||||
$(NULL)
|
||||
|
||||
PRIVATE_EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
MODULE = xpfc
|
||||
|
||||
REQUIRES = raptor
|
|
@ -0,0 +1,39 @@
|
|||
/* -*- 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.
|
||||
*/
|
||||
#ifndef nsxpfc_h___
|
||||
#define nsxpfc_h___
|
||||
|
||||
#include "nscore.h"
|
||||
|
||||
#ifdef XP_PC
|
||||
#pragma warning( disable : 4275 4251 ) // Disable warning messages
|
||||
#endif
|
||||
|
||||
#ifdef _IMPL_NS_XPFC
|
||||
#define NS_XPFC NS_EXPORT
|
||||
#else
|
||||
#define NS_XPFC NS_IMPORT
|
||||
#endif
|
||||
|
||||
#if defined(XP_MAC)
|
||||
#define CLASS_EXPORT_XPFC NS_XPFC class
|
||||
#else
|
||||
#define CLASS_EXPORT_XPFC class NS_XPFC
|
||||
#endif
|
||||
|
||||
#endif /* nsxpfc_h___ */
|
|
@ -0,0 +1,176 @@
|
|||
/* -*- 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.
|
||||
*/
|
||||
|
||||
#ifndef nsxpfcCIID_h__
|
||||
#define nsxpfcCIID_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsRepository.h"
|
||||
|
||||
// c38e93c0-386e-11d2-9249-00805f8a7ab6
|
||||
#define NS_XPFC_COMMAND_SERVER_CID \
|
||||
{ 0xc38e93c0, 0x386e, 0x11d2, \
|
||||
{0x92, 0x49, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} }
|
||||
|
||||
#define NS_XPFC_SHELL_INSTANCE_CID \
|
||||
{ 0x90487580, 0xfefe, 0x11d1, \
|
||||
{0xbe, 0xcd, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd} }
|
||||
|
||||
// 03dd8f40-3610-11d2-9248-00805f8a7ab6
|
||||
#define NS_STREAM_MANAGER_CID \
|
||||
{ 0x03dd8f40, 0x3610, 0x11d2, \
|
||||
{0x92, 0x48, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} }
|
||||
|
||||
// cd5cd8b0-3b80-11d2-bee0-00805f8a8dbd
|
||||
#define NS_XPFC_DIALOG_CID \
|
||||
{ 0xcd5cd8b0, 0x3b80, 0x11d2, \
|
||||
{0xbe, 0xe0, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd} }
|
||||
|
||||
// 55395780-3b98-11d2-bee0-00805f8a8dbd
|
||||
#define NS_XPFC_BUTTON_CID \
|
||||
{ 0x55395780, 0x3b98, 0x11d2, \
|
||||
{0xbe, 0xe0, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd} }
|
||||
|
||||
// cd53e4b0-3b99-11d2-bee0-00805f8a8dbd
|
||||
#define NS_XPFC_TEXTWIDGET_CID \
|
||||
{ 0xcd53e4b0, 0x3b99, 0x11d2, \
|
||||
{0xbe, 0xe0, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd} }
|
||||
|
||||
// dafa9a80-3b99-11d2-bee0-00805f8a8dbd
|
||||
#define NS_XPFC_TABWIDGET_CID \
|
||||
{ 0xdafa9a80, 0x3b99, 0x11d2, \
|
||||
{0xbe, 0xe0, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd} }
|
||||
|
||||
// 5de8a290-35f9-11d2-9248-00805f8a7ab6
|
||||
#define NS_XPFC_TOOLBAR_CID \
|
||||
{ 0x5de8a290, 0x35f9, 0x11d2, \
|
||||
{0x92, 0x48, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} }
|
||||
|
||||
// 74222650-2d76-11d2-9246-00805f8a7ab6
|
||||
#define NS_MENUBAR_CID \
|
||||
{ 0x74222650, 0x2d76, 0x11d2, \
|
||||
{0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} }
|
||||
|
||||
// c78daa60-30a9-11d2-9247-00805f8a7ab6
|
||||
#define NS_MENU_MANAGER_CID \
|
||||
{ 0xc78daa60, 0x30a9, 0x11d2, \
|
||||
{0x92, 0x47, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} }
|
||||
|
||||
// 782ae760-35fb-11d2-9248-00805f8a7ab6
|
||||
#define NS_TOOLBAR_MANAGER_CID \
|
||||
{ 0x782ae760, 0x35fb, 0x11d2, \
|
||||
{0x92, 0x48, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} }
|
||||
|
||||
// 6c4e09a0-2f54-11d2-bede-00805f8a8dbd
|
||||
#define NS_MENUCONTAINER_CID \
|
||||
{ 0x6c4e09a0, 0x2f54, 0x11d2, \
|
||||
{0xbe, 0xde, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd} }
|
||||
|
||||
// 7a01c6d0-2d76-11d2-9246-00805f8a7ab6
|
||||
#define NS_MENUITEM_CID \
|
||||
{ 0x7a01c6d0, 0x2d76, 0x11d2, \
|
||||
{0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} }
|
||||
|
||||
#define NS_IAPPLICATIONSHELL_CID \
|
||||
{ 0x2293d960, 0xdeff, 0x11d1, \
|
||||
{0x92, 0x44, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} }
|
||||
|
||||
// ce401b60-2e1e-11d2-9246-00805f8a7ab
|
||||
#define NS_XPFCXMLCONTENTSINK_IID \
|
||||
{ 0xce401b60, 0x2e1e, 0x11d2, \
|
||||
{0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} }
|
||||
|
||||
// d422ca40-2e1e-11d2-9246-00805f8a7ab6
|
||||
#define NS_IXPFCXML_DTD_IID \
|
||||
{ 0xd422ca40, 0x2e1e, 0x11d2, \
|
||||
{0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} }
|
||||
|
||||
//8c091510-eb84-11d1-9244-00805f8a7ab6
|
||||
#define NS_VECTOR_CID \
|
||||
{ 0x8c091510, 0xeb84, 0x11d1, \
|
||||
{ 0x92, 0x44, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } }
|
||||
|
||||
//24439be0-eb85-11d1-9244-00805f8a7ab6
|
||||
#define NS_VECTOR_ITERATOR_CID \
|
||||
{ 0x24439be0, 0xeb85, 0x11d1, \
|
||||
{ 0x92, 0x44, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } }
|
||||
|
||||
//f16fb1e0-27db-11d2-9246-00805f8a7ab6
|
||||
#define NS_STACK_CID \
|
||||
{ 0xf16fb1e0, 0x27db, 0x11d2, \
|
||||
{ 0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } }
|
||||
|
||||
//0156b2a0-f73d-11d1-9244-00805f8a7ab6
|
||||
#define NS_LAYOUT_CID \
|
||||
{ 0x0156b2a0, 0xf73d, 0x11d1, \
|
||||
{ 0x92, 0x44, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } }
|
||||
|
||||
//96562f50-fb29-11d1-becb-00805f8a8dbd
|
||||
#define NS_BOXLAYOUT_CID \
|
||||
{ 0x96562f50, 0xfb29, 0x11d1, \
|
||||
{ 0xbe, 0xcb, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd } }
|
||||
|
||||
//0241c670-1f57-11d2-bed9-00805f8a8dbd
|
||||
#define NS_XPFC_OBSERVERMANAGER_CID \
|
||||
{ 0x0241c670, 0x1f57, 0x11d2, \
|
||||
{ 0xbe, 0xd9, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd } }
|
||||
|
||||
//7a1e8ca0-1f53-11d2-bed9-00805f8a8dbd
|
||||
#define NS_XPFC_OBSERVER_CID \
|
||||
{ 0x7a1e8ca0, 0x1f53, 0x11d2, \
|
||||
{ 0xbe, 0xd9, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd } }
|
||||
|
||||
//a4c7f8b0-1f55-11d2-bed9-00805f8a8dbd
|
||||
#define NS_XPFC_SUBJECT_CID \
|
||||
{ 0xa4c7f8b0, 0x1f55, 0x11d2, \
|
||||
{ 0xbe, 0xd9, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd } }
|
||||
|
||||
//82613bd0-1f46-11d2-bed9-00805f8a8dbd
|
||||
#define NS_XPFC_COMMAND_CID \
|
||||
{ 0x82613bd0, 0x1f46, 0x11d2, \
|
||||
{ 0xbe, 0xd9, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd } }
|
||||
|
||||
//2d093010-e9e7-11d1-9244-00805f8a7ab6
|
||||
#define NS_XPFC_CANVAS_CID \
|
||||
{ 0x2d093010, 0xe9e7, 0x11d1, \
|
||||
{ 0x92, 0x44, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } }
|
||||
|
||||
//0b4ff5b0-3dda-11d2-bee1-00805f8a8dbd
|
||||
#define NS_XPFC_HTML_CANVAS_CID \
|
||||
{ 0x0b4ff5b0, 0x3dda, 0x11d2, \
|
||||
{ 0xbe, 0xe1, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd } }
|
||||
|
||||
//92789710-28a6-11d2-9246-00805f8a7ab6
|
||||
#define NS_XPFC_CANVASMANAGER_CID \
|
||||
{ 0x92789710, 0x28a6, 0x11d2, \
|
||||
{ 0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } }
|
||||
|
||||
//8d2f7410-28c3-11d2-9246-00805f8a7ab6
|
||||
#define NS_XPFC_METHODINVOKER_COMMAND_CID \
|
||||
{ 0x8d2f7410, 0x28c3, 0x11d2, \
|
||||
{ 0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } }
|
||||
|
||||
//667b7530-33b5-11d2-9248-00805f8a7ab6
|
||||
#define NS_XPFC_ACTION_COMMAND_CID \
|
||||
{ 0x667b7530, 0x33b5, 0x11d2, \
|
||||
{ 0x92, 0x48, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } }
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,117 @@
|
|||
/* -*- 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 "nsxpfc.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsxpfcCIID.h"
|
||||
|
||||
#include "nsxpfc.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsxpfcCIID.h"
|
||||
|
||||
#include "nsShellInstance.h"
|
||||
#include "nsIMenuBar.h"
|
||||
#include "nsXPFCToolbar.h"
|
||||
#include "nsXPFCDialog.h"
|
||||
#include "nsXPFCButton.h"
|
||||
#include "nsXPFCTabWidget.h"
|
||||
#include "nsXPFCTextWidget.h"
|
||||
#include "nsMenuContainer.h"
|
||||
#include "nsMenuItem.h"
|
||||
#include "nsXPFCXMLDTD.h"
|
||||
#include "nsXPFCXMLContentSink.h"
|
||||
#include "nsMenuManager.h"
|
||||
#include "nsToolbarManager.h"
|
||||
#include "nsStreamManager.h"
|
||||
#include "nsVector.h"
|
||||
#include "nsVectorIterator.h"
|
||||
#include "nsStack.h"
|
||||
#include "nsLayout.h"
|
||||
#include "nsBoxLayout.h"
|
||||
#include "nsXPFCObserver.h"
|
||||
#include "nsXPFCObserverManager.h"
|
||||
#include "nsXPFCSubject.h"
|
||||
#include "nsXPFCCommand.h"
|
||||
#include "nsXPFCCanvas.h"
|
||||
#include "nsXPFCCanvasManager.h"
|
||||
#include "nsXPFCMethodInvokerCommand.h"
|
||||
#include "nsXPFCActionCommand.h"
|
||||
#include "nsCommandServer.h"
|
||||
#include "nsXPFCHTMLCanvas.h"
|
||||
|
||||
static NS_DEFINE_IID(kCShellInstance, NS_XPFC_SHELL_INSTANCE_CID);
|
||||
static NS_DEFINE_IID(kCMenuItem, NS_MENUITEM_CID);
|
||||
static NS_DEFINE_IID(kCMenuBar, NS_MENUBAR_CID);
|
||||
static NS_DEFINE_IID(kCMenuContainer, NS_MENUCONTAINER_CID);
|
||||
static NS_DEFINE_IID(kCMenuManager, NS_MENU_MANAGER_CID);
|
||||
static NS_DEFINE_IID(kCStreamManager, NS_STREAM_MANAGER_CID);
|
||||
static NS_DEFINE_IID(kIStreamManager, NS_ISTREAM_MANAGER_IID);
|
||||
static NS_DEFINE_IID(kCXPFCDTD, NS_IXPFCXML_DTD_IID);
|
||||
static NS_DEFINE_IID(kCXPFCContentSink, NS_XPFCXMLCONTENTSINK_IID);
|
||||
static NS_DEFINE_IID(kCXPFCToolbar, NS_XPFC_TOOLBAR_CID);
|
||||
static NS_DEFINE_IID(kCToolbarManager, NS_TOOLBAR_MANAGER_CID);
|
||||
static NS_DEFINE_IID(kCXPFCDialog, NS_XPFC_DIALOG_CID);
|
||||
static NS_DEFINE_IID(kCXPFCButton, NS_XPFC_BUTTON_CID);
|
||||
static NS_DEFINE_IID(kCXPFCTabWidget, NS_XPFC_TABWIDGET_CID);
|
||||
static NS_DEFINE_IID(kCXPFCTextWidget, NS_XPFC_TEXTWIDGET_CID);
|
||||
static NS_DEFINE_IID(kCVector, NS_VECTOR_CID);
|
||||
static NS_DEFINE_IID(kCVectorIterator, NS_VECTOR_ITERATOR_CID);
|
||||
static NS_DEFINE_IID(kCLayout, NS_LAYOUT_CID);
|
||||
static NS_DEFINE_IID(kILayout, NS_ILAYOUT_IID);
|
||||
static NS_DEFINE_IID(kCBoxLayout, NS_BOXLAYOUT_CID);
|
||||
static NS_DEFINE_IID(kCXPFCObserver, NS_XPFC_OBSERVER_CID);
|
||||
static NS_DEFINE_IID(kCXPFCObserverManager, NS_XPFC_OBSERVERMANAGER_CID);
|
||||
static NS_DEFINE_IID(kCXPFCSubject, NS_XPFC_SUBJECT_CID);
|
||||
static NS_DEFINE_IID(kCXPFCCommand, NS_XPFC_COMMAND_CID);
|
||||
static NS_DEFINE_IID(kCXPFCCanvas, NS_XPFC_CANVAS_CID);
|
||||
static NS_DEFINE_IID(kCXPFCHTMLCanvas, NS_XPFC_HTML_CANVAS_CID);
|
||||
static NS_DEFINE_IID(kCXPFCCanvasManager, NS_XPFC_CANVASMANAGER_CID);
|
||||
static NS_DEFINE_IID(kIXPFCCanvas, NS_IXPFC_CANVAS_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
static NS_DEFINE_IID(kCStack, NS_STACK_CID);
|
||||
static NS_DEFINE_IID(kCXPFCMethodInvokerCommand, NS_XPFC_METHODINVOKER_COMMAND_CID);
|
||||
static NS_DEFINE_IID(kCXPFCCommandServerCID, NS_XPFC_COMMAND_SERVER_CID);
|
||||
static NS_DEFINE_IID(kCXPFCActionCommand, NS_XPFC_ACTION_COMMAND_CID);
|
||||
|
||||
class nsxpfcFactory : public nsIFactory
|
||||
{
|
||||
public:
|
||||
// nsISupports methods
|
||||
NS_IMETHOD QueryInterface(const nsIID &aIID,
|
||||
void **aResult);
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
|
||||
// nsIFactory methods
|
||||
NS_IMETHOD CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult);
|
||||
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
nsxpfcFactory(const nsCID &aClass);
|
||||
~nsxpfcFactory();
|
||||
|
||||
protected:
|
||||
nsrefcnt mRefCnt;
|
||||
nsCID mClassID;
|
||||
};
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/* -*- 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.
|
||||
*/
|
||||
|
||||
#ifndef NS_XPFCSTRINGS__
|
||||
#define NS_XPFCSTRINGS__
|
||||
|
||||
#define XPFC_STRING_QUESTIONMARK "?"
|
||||
#define XPFC_STRING_BACKGROUNDCOLOR "backgroundcolor"
|
||||
#define XPFC_STRING_BACKGROUNDIMAGE "backgroundimage"
|
||||
#define XPFC_STRING_CLASS "class"
|
||||
#define XPFC_STRING_CONTAINER "container"
|
||||
#define XPFC_STRING_FOREGROUNDCOLOR "foregroundcolor"
|
||||
#define XPFC_STRING_GETBACKGROUNDCOLOR "getbackgroundcolor"
|
||||
#define XPFC_STRING_HEIGHT "height"
|
||||
#define XPFC_STRING_HELP "help"
|
||||
#define XPFC_STRING_HTML_CANVAS "htmlcanvas"
|
||||
#define XPFC_STRING_ID "id"
|
||||
#define XPFC_STRING_KEYBOARDFOCUS "keyboardfocus"
|
||||
#define XPFC_STRING_LABEL "label"
|
||||
#define XPFC_STRING_LAYOUT "layout"
|
||||
#define XPFC_STRING_MENUCONTAINER "menucontainer"
|
||||
#define XPFC_STRING_NAME "name"
|
||||
#define XPFC_STRING_SETBACKGROUNDCOLOR "setbackgroundcolor"
|
||||
#define XPFC_STRING_SRC "src"
|
||||
#define XPFC_STRING_TABGROUP "tabgroup"
|
||||
#define XPFC_STRING_TABID "tabid"
|
||||
#define XPFC_STRING_USEPREFERREDSIZE "usepreferredsize"
|
||||
#define XPFC_STRING_WEIGHTMAJOR "weightmajor"
|
||||
#define XPFC_STRING_WEIGHTMINOR "weightminor"
|
||||
#define XPFC_STRING_WIDTH "width"
|
||||
#define XPFC_STRING_XBOX "xbox"
|
||||
#define XPFC_STRING_YBOX "ybox"
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
GDEPTH = ../../../..
|
||||
DEPTH = ../../../..
|
||||
|
||||
DIRS_EXPORT = inc
|
||||
DIRS_LIBS = src
|
||||
|
||||
DIRS = $(PLATFORM_DIRECTORY)
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
|
||||
#
|
||||
# Override TARGETS variable so that only static libraries
|
||||
# are specifed as dependencies within rules.mk.
|
||||
#
|
||||
|
||||
CFLAGS +=-D_IMPL_NS_XPFC -DNSPR20
|
||||
INCLUDES += -I../inc -I$(GDEPTH)/include
|
||||
|
||||
LIBRARY_NAME = core
|
||||
LIBRARY_VERSION = 10
|
||||
|
||||
ARCHIVE_ONLY = 1
|
||||
|
||||
TARGETS = $(LIBRARY)
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
GDEPTH = ../../../../..
|
||||
|
||||
EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
PRIVATE_EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
MODULE = xpfc
|
||||
|
||||
CPPSRCS = \
|
||||
nsxpfcFactory.cpp \
|
||||
$(NULL)
|
||||
|
||||
REQUIRES = shell xpcom raptor netlib
|
||||
|
|
@ -0,0 +1,166 @@
|
|||
/* -*- 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 "nsxpfc.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsxpfcCIID.h"
|
||||
#include "nsxpfcFactory.h"
|
||||
|
||||
|
||||
nsxpfcFactory::nsxpfcFactory(const nsCID &aClass)
|
||||
{
|
||||
mRefCnt = 0;
|
||||
mClassID = aClass;
|
||||
}
|
||||
|
||||
nsxpfcFactory::~nsxpfcFactory()
|
||||
{
|
||||
NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction");
|
||||
}
|
||||
|
||||
nsresult nsxpfcFactory::QueryInterface(const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
if (aResult == NULL) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
// Always NULL result, in case of failure
|
||||
*aResult = NULL;
|
||||
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aResult = (void *)(nsISupports*)this;
|
||||
} else if (aIID.Equals(kIFactoryIID)) {
|
||||
*aResult = (void *)(nsIFactory*)this;
|
||||
}
|
||||
|
||||
if (*aResult == NULL) {
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
AddRef(); // Increase reference count for caller
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsrefcnt nsxpfcFactory::AddRef()
|
||||
{
|
||||
return ++mRefCnt;
|
||||
}
|
||||
|
||||
nsrefcnt nsxpfcFactory::Release()
|
||||
{
|
||||
if (--mRefCnt == 0) {
|
||||
delete this;
|
||||
return 0; // Don't access mRefCnt after deleting!
|
||||
}
|
||||
return mRefCnt;
|
||||
}
|
||||
|
||||
nsresult nsxpfcFactory::CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
if (aResult == NULL) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aResult = NULL;
|
||||
|
||||
nsISupports *inst = nsnull;
|
||||
|
||||
if (mClassID.Equals(kCShellInstance)) {
|
||||
inst = (nsISupports *)new nsShellInstance();
|
||||
} else if (mClassID.Equals(kCXPFCCanvas)) {
|
||||
nsXPFCCanvas * canvas = (nsXPFCCanvas *)new nsXPFCCanvas(aOuter);
|
||||
canvas->QueryInterface(kISupportsIID,(void **)&inst);
|
||||
} else if (mClassID.Equals(kCXPFCHTMLCanvas)) {
|
||||
nsXPFCHTMLCanvas * canvas = (nsXPFCHTMLCanvas *)new nsXPFCHTMLCanvas(aOuter);
|
||||
canvas->QueryInterface(kISupportsIID,(void **)&inst);
|
||||
} else if (mClassID.Equals(kCMenuContainer)) {
|
||||
inst = (nsISupports *)(nsIMenuContainer *)new nsMenuContainer();
|
||||
} else if (mClassID.Equals(kCXPFCToolbar)) {
|
||||
inst = (nsISupports *)(nsIXPFCToolbar *)new nsXPFCToolbar(aOuter);
|
||||
} else if (mClassID.Equals(kCXPFCDialog)) {
|
||||
inst = (nsISupports *)(nsIXPFCDialog *)new nsXPFCDialog(aOuter);
|
||||
} else if (mClassID.Equals(kCXPFCButton)) {
|
||||
inst = (nsISupports *)(nsIXPFCButton *)new nsXPFCButton(aOuter);
|
||||
} else if (mClassID.Equals(kCXPFCTextWidget)) {
|
||||
inst = (nsISupports *)(nsIXPFCTextWidget *)new nsXPFCTextWidget(aOuter);
|
||||
} else if (mClassID.Equals(kCXPFCTabWidget)) {
|
||||
inst = (nsISupports *)(nsIXPFCTabWidget *)new nsXPFCTabWidget(aOuter);
|
||||
} else if (mClassID.Equals(kCMenuManager)) {
|
||||
inst = (nsISupports *)(nsIMenuManager *)new nsMenuManager();
|
||||
} else if (mClassID.Equals(kCToolbarManager)) {
|
||||
inst = (nsISupports *)(nsIToolbarManager *)new nsToolbarManager();
|
||||
} else if (mClassID.Equals(kCStreamManager)) {
|
||||
inst = (nsISupports *)(nsIStreamManager *)new nsStreamManager();
|
||||
} else if (mClassID.Equals(kCMenuItem)) {
|
||||
inst = (nsISupports *)(nsIMenuItem *)new nsMenuItem();
|
||||
} else if (mClassID.Equals(kCXPFCDTD)) {
|
||||
inst = (nsISupports *)new nsXPFCXMLDTD();
|
||||
} else if (mClassID.Equals(kCXPFCContentSink)) {
|
||||
inst = (nsISupports *)new nsXPFCXMLContentSink();
|
||||
} else if (mClassID.Equals(kCVector)) {
|
||||
inst = (nsISupports *)new nsVector();
|
||||
} else if (mClassID.Equals(kCVectorIterator)) {
|
||||
inst = (nsISupports *)new nsVectorIterator();
|
||||
} else if (mClassID.Equals(kCStack)) {
|
||||
inst = (nsISupports *)new nsStack();
|
||||
} else if (mClassID.Equals(kCLayout)) {
|
||||
inst = (nsISupports *)new nsLayout();
|
||||
} else if (mClassID.Equals(kCBoxLayout)) {
|
||||
inst = (nsISupports *)new nsBoxLayout();
|
||||
} else if (mClassID.Equals(kCXPFCObserver)) {
|
||||
inst = (nsISupports *)new nsXPFCObserver();
|
||||
} else if (mClassID.Equals(kCXPFCObserverManager)) {
|
||||
inst = (nsISupports *)new nsXPFCObserverManager();
|
||||
} else if (mClassID.Equals(kCXPFCMethodInvokerCommand)) {
|
||||
inst = (nsISupports *)new nsXPFCMethodInvokerCommand();
|
||||
} else if (mClassID.Equals(kCXPFCActionCommand)) {
|
||||
inst = (nsISupports *)new nsXPFCActionCommand();
|
||||
} else if (mClassID.Equals(kCXPFCSubject)) {
|
||||
inst = (nsISupports *)new nsXPFCSubject();
|
||||
} else if (mClassID.Equals(kCXPFCCanvasManager)) {
|
||||
inst = (nsISupports *)new nsXPFCCanvasManager();
|
||||
} else if (mClassID.Equals(kCXPFCCommand)) {
|
||||
inst = (nsISupports *)new nsXPFCCommand();
|
||||
} else if (mClassID.Equals(kCXPFCCommandServerCID)) {
|
||||
inst = (nsISupports *)new nsCommandServer();
|
||||
}
|
||||
|
||||
if (inst == NULL) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
|
||||
if (res != NS_OK) {
|
||||
// We didn't get the right interface, so clean up
|
||||
delete inst;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsxpfcFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
// Not implemented in simplest case.
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
GDEPTH = ../../../../..
|
||||
DEPTH = ../../../../..
|
||||
|
||||
DIRS_LIBS = src
|
|
@ -0,0 +1,25 @@
|
|||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
|
||||
#
|
||||
# Override TARGETS variable so that only static libraries
|
||||
# are specifed as dependencies within rules.mk.
|
||||
#
|
||||
|
||||
CFLAGS +=-D_IMPL_NS_XPFC -DNSPR20
|
||||
INCLUDES += -I../inc -I$(GDEPTH)/include
|
||||
|
||||
LIBRARY_NAME = core_unix
|
||||
LIBRARY_VERSION = 10
|
||||
|
||||
ARCHIVE_ONLY = 1
|
||||
|
||||
TARGETS = $(LIBRARY)
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
GDEPTH = ../../../../../..
|
||||
|
||||
EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
PRIVATE_EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
MODULE = xpfc
|
||||
|
||||
CPPSRCS = \
|
||||
nsxpfcFactoryUnix.cpp \
|
||||
$(NULL)
|
||||
|
||||
REQUIRES = shell xpcom raptor netlib
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
/* -*- 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 "nsxpfcFactory.h"
|
||||
#include "nsMenuContainerUnix.h"
|
||||
|
||||
class nsxpfcFactoryUnix : public nsxpfcFactory
|
||||
{
|
||||
public:
|
||||
|
||||
NS_IMETHOD CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult);
|
||||
|
||||
|
||||
nsxpfcFactoryUnix(const nsCID &aClass);
|
||||
~nsxpfcFactoryUnix();
|
||||
|
||||
};
|
||||
|
||||
nsxpfcFactoryUnix::nsxpfcFactoryUnix(const nsCID &aClass) : nsxpfcFactory(aClass)
|
||||
{
|
||||
}
|
||||
|
||||
nsxpfcFactoryUnix::~nsxpfcFactoryUnix()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult nsxpfcFactoryUnix::CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
if (aResult == NULL) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aResult = NULL;
|
||||
|
||||
nsISupports *inst = nsnull;
|
||||
|
||||
if (mClassID.Equals(kCMenuBar)) {
|
||||
inst = (nsISupports *)(nsIMenuBar *)new nsMenuContainerUnix();
|
||||
} else if (mClassID.Equals(kCMenuContainer)) {
|
||||
inst = (nsISupports *)(nsIMenuContainer *)new nsMenuContainerUnix();
|
||||
}
|
||||
|
||||
if (inst == NULL)
|
||||
return (nsxpfcFactory::CreateInstance(aOuter,aIID,aResult));
|
||||
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
|
||||
if (res != NS_OK)
|
||||
delete inst;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
// return the proper factory to the caller
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aClass, nsIFactory **aFactory)
|
||||
{
|
||||
if (nsnull == aFactory) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aFactory = new nsxpfcFactoryUnix(aClass);
|
||||
|
||||
if (nsnull == aFactory) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return (*aFactory)->QueryInterface(kIFactoryIID, (void**)aFactory);
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
GDEPTH = ../../../../..
|
||||
DEPTH = ../../../../..
|
||||
|
||||
DIRS_LIBS = src
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
|
||||
#
|
||||
# Override TARGETS variable so that only static libraries
|
||||
# are specifed as dependencies within rules.mk.
|
||||
#
|
||||
|
||||
CFLAGS +=-D_IMPL_NS_XPFC -DNSPR20
|
||||
INCLUDES += -I../inc -I$(GDEPTH)/include
|
||||
|
||||
LIBRARY_NAME = core_windows
|
||||
LIBRARY_VERSION = 10
|
||||
|
||||
ARCHIVE_ONLY = 1
|
||||
|
||||
TARGETS = $(LIBRARY)
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
GDEPTH = ../../../../../..
|
||||
|
||||
EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
PRIVATE_EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
MODULE = xpfc
|
||||
|
||||
CPPSRCS = \
|
||||
nsxpfcFactoryWin.cpp \
|
||||
$(NULL)
|
||||
|
||||
REQUIRES = shell xpcom raptor netlib
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
/* -*- 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 "nsxpfcFactory.h"
|
||||
#include "nsMenuContainerWin.h"
|
||||
|
||||
class nsxpfcFactoryWin : public nsxpfcFactory
|
||||
{
|
||||
public:
|
||||
|
||||
NS_IMETHOD CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult);
|
||||
|
||||
|
||||
nsxpfcFactoryWin(const nsCID &aClass);
|
||||
~nsxpfcFactoryWin();
|
||||
|
||||
};
|
||||
|
||||
nsxpfcFactoryWin::nsxpfcFactoryWin(const nsCID &aClass) : nsxpfcFactory(aClass)
|
||||
{
|
||||
}
|
||||
|
||||
nsxpfcFactoryWin::~nsxpfcFactoryWin()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult nsxpfcFactoryWin::CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
if (aResult == NULL) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aResult = NULL;
|
||||
|
||||
nsISupports *inst = nsnull;
|
||||
|
||||
if (mClassID.Equals(kCMenuBar)) {
|
||||
inst = (nsISupports *)(nsIMenuBar *)new nsMenuContainerWin();
|
||||
} else if (mClassID.Equals(kCMenuContainer)) {
|
||||
inst = (nsISupports *)(nsIMenuContainer *)new nsMenuContainerWin();
|
||||
}
|
||||
|
||||
if (inst == NULL)
|
||||
return (nsxpfcFactory::CreateInstance(aOuter,aIID,aResult));
|
||||
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
|
||||
if (res != NS_OK)
|
||||
delete inst;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
// return the proper factory to the caller
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aClass, nsIFactory **aFactory)
|
||||
{
|
||||
if (nsnull == aFactory) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aFactory = new nsxpfcFactoryWin(aClass);
|
||||
|
||||
if (nsnull == aFactory) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return (*aFactory)->QueryInterface(kIFactoryIID, (void**)aFactory);
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
GDEPTH = ../../../../..
|
||||
|
||||
EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
PRIVATE_EXPORTS = \
|
||||
nsXPFCDialog.h \
|
||||
$(NULL)
|
||||
|
||||
MODULE = xpfc
|
||||
|
||||
REQUIRES = raptor
|
|
@ -0,0 +1,45 @@
|
|||
/* -*- 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.
|
||||
*/
|
||||
|
||||
#ifndef nsXPFCDialog_h___
|
||||
#define nsXPFCDialog_h___
|
||||
|
||||
#include "nsIXPFCDialog.h"
|
||||
#include "nsXPFCCanvas.h"
|
||||
|
||||
class nsXPFCDialog : public nsIXPFCDialog,
|
||||
public nsXPFCCanvas
|
||||
|
||||
{
|
||||
public:
|
||||
nsXPFCDialog(nsISupports* outer);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD Init();
|
||||
|
||||
NS_IMETHOD SetParameter(nsString& aKey, nsString& aValue) ;
|
||||
NS_IMETHOD GetClassPreferredSize(nsSize& aSize);
|
||||
|
||||
protected:
|
||||
~nsXPFCDialog();
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsXPFCDialog_h___ */
|
|
@ -0,0 +1,15 @@
|
|||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
GDEPTH = ../../../..
|
||||
DEPTH = ../../../..
|
||||
|
||||
DIRS_EXPORT = public inc
|
||||
DIRS_LIBS = src
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
GDEPTH = ../../../../..
|
||||
DEPTH = ../../../../..
|
||||
|
||||
EXPORTS = \
|
||||
nsIXPFCDialog.h \
|
||||
$(NULL)
|
||||
|
||||
PRIVATE_EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
MODULE = xpfc
|
||||
|
||||
REQUIRES = raptor
|
|
@ -0,0 +1,38 @@
|
|||
/* -*- 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.
|
||||
*/
|
||||
|
||||
#ifndef nsIXPFCDialog_h___
|
||||
#define nsIXPFCDialog_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
//52ae6d80-3b81-11d2-bee0-00805f8a8dbd
|
||||
#define NS_IXPFC_DIALOG_IID \
|
||||
{ 0x52ae6d80, 0x3b81, 0x11d2, \
|
||||
{0xbe, 0xe0, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd} }
|
||||
|
||||
class nsIXPFCDialog : public nsISupports
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
NS_IMETHOD Init() = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIXPFCDialog_h___ */
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
GDEPTH = ../../../../..
|
||||
|
||||
EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
PRIVATE_EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
MODULE = xpfc
|
||||
|
||||
CPPSRCS = \
|
||||
nsXPFCDialog.cpp \
|
||||
$(NULL)
|
||||
|
||||
REQUIRES = xpcom raptor netlib
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
/* -*- 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 "nsXPFCDialog.h"
|
||||
#include "nsxpfcCIID.h"
|
||||
#include "nspr.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kCXPFCDialogCID, NS_XPFC_DIALOG_CID);
|
||||
static NS_DEFINE_IID(kCIXPFCDialogIID, NS_IXPFC_DIALOG_IID);
|
||||
|
||||
#define DEFAULT_WIDTH 300
|
||||
#define DEFAULT_HEIGHT 300
|
||||
|
||||
nsXPFCDialog :: nsXPFCDialog(nsISupports* outer) : nsXPFCCanvas(outer)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsXPFCDialog :: ~nsXPFCDialog()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult nsXPFCDialog::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kClassIID, kCXPFCDialogCID);
|
||||
if (aIID.Equals(kClassIID)) {
|
||||
*aInstancePtr = (void*) (nsXPFCDialog *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kCIXPFCDialogIID)) {
|
||||
*aInstancePtr = (void*) (nsIXPFCDialog *)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) (this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return (nsXPFCCanvas::QueryInterface(aIID, aInstancePtr));
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsXPFCDialog)
|
||||
NS_IMPL_RELEASE(nsXPFCDialog)
|
||||
|
||||
nsresult nsXPFCDialog :: Init()
|
||||
{
|
||||
nsresult res = nsXPFCCanvas::Init();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsXPFCDialog :: SetParameter(nsString& aKey, nsString& aValue)
|
||||
{
|
||||
return (nsXPFCCanvas::SetParameter(aKey, aValue));
|
||||
}
|
||||
|
||||
nsresult nsXPFCDialog :: GetClassPreferredSize(nsSize& aSize)
|
||||
{
|
||||
aSize.width = DEFAULT_WIDTH;
|
||||
aSize.height = DEFAULT_HEIGHT;
|
||||
return (NS_OK);
|
||||
}
|
||||
|
Загрузка…
Ссылка в новой задаче