Remove users of deprecated, no-op, NS_INIT_ISUPPORTS macro from tree. b=178643 r+sr=bryner

This commit is contained in:
dbaron%dbaron.org 2004-01-23 23:12:44 +00:00
Родитель 367ac2cf5c
Коммит ca4e64fa50
64 изменённых файлов: 1 добавлений и 1748 удалений

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

@ -53,7 +53,6 @@
AppDirServiceProvider::AppDirServiceProvider(const nsACString& productDirName)
{
NS_INIT_ISUPPORTS();
mProductDirName.Assign(productDirName);
}

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

@ -66,7 +66,6 @@ NS_IMPL_ISUPPORTS1(nsConsoleListener, nsIConsoleListener)
nsConsoleListener::nsConsoleListener()
{
NS_INIT_ISUPPORTS();
}
nsConsoleListener::~nsConsoleListener()

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

@ -50,7 +50,6 @@
CocoaPromptService::CocoaPromptService()
{
NS_INIT_ISUPPORTS();
}
CocoaPromptService::~CocoaPromptService()

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

@ -58,7 +58,6 @@ NS_IMPL_ISUPPORTS2(ContentClickListener, nsIDOMMouseListener, nsIDOMEventListene
ContentClickListener::ContentClickListener(id aBrowserController)
:mBrowserController(aBrowserController)
{
NS_INIT_ISUPPORTS();
}
ContentClickListener::~ContentClickListener()

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

@ -65,7 +65,6 @@ public:
, mUserData(inUserData)
, mURI(inURI)
{
NS_INIT_ISUPPORTS();
[mLoadListener retain];
}
@ -129,7 +128,6 @@ protected:
RemoteURILoadManager::RemoteURILoadManager()
{
NS_INIT_ISUPPORTS();
}
RemoteURILoadManager::~RemoteURILoadManager()

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

@ -50,7 +50,6 @@
SecurityDialogs::SecurityDialogs()
{
NS_INIT_ISUPPORTS();
}
SecurityDialogs::~SecurityDialogs()

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

@ -70,7 +70,6 @@ nsHeaderSniffer::nsHeaderSniffer(nsIWebBrowserPersist* aPersist, nsIFile* aFile,
, mBypassCache(aBypassCache)
, mFilterView(aFilterView)
{
NS_INIT_ISUPPORTS();
}
nsHeaderSniffer::~nsHeaderSniffer()

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

@ -61,7 +61,6 @@
CHBrowserListener::CHBrowserListener(CHBrowserView* aView)
: mView(aView), mContainer(nsnull), mIsModal(PR_FALSE), mChromeFlags(0)
{
NS_INIT_ISUPPORTS();
mListeners = [[NSMutableArray alloc] init];
}

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

@ -106,7 +106,6 @@ NS_IMPL_ISUPPORTS2(CHClickListener, nsIDOMMouseListener, nsIDOMEventListener)
CHClickListener::CHClickListener()
{
NS_INIT_ISUPPORTS();
}
CHClickListener::~CHClickListener()

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

@ -67,7 +67,6 @@ protected:
DownloadListenerFactory::DownloadListenerFactory()
: mControllerFactory(nil)
{
NS_INIT_ISUPPORTS();
mControllerFactory = [[ChimeraDownloadControllerFactory alloc] init];
}

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

@ -45,7 +45,6 @@ CHDownloader::CHDownloader()
, mDownloadDisplay(nil)
, mIsFileSave(PR_FALSE)
{
NS_INIT_ISUPPORTS();
}
CHDownloader::~CHDownloader()

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

@ -68,7 +68,6 @@ public:
HistoryRDFObserver(HistoryDataSource* dataSource)
: mHistoryDataSource(dataSource)
{
NS_INIT_ISUPPORTS();
}
virtual ~HistoryRDFObserver() { }

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

@ -1,609 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Chimera code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Simon Fraser <sfraser@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#import <Cocoa/Cocoa.h>
#import "NSString+Utils.h"
// Embedding includes
#include "nsIWebBrowser.h"
#include "nsIWebNavigation.h"
#include "nsIURI.h"
#include "nsIDOMWindow.h"
//#include "nsIWidget.h"
// XPCOM and String includes
#include "nsCRT.h"
#include "nsString.h"
#include "nsCOMPtr.h"
#import "CHBrowserView.h"
#include "CHBrowserListener.h"
CHBrowserListener::CHBrowserListener(CHBrowserView* aView)
: mView(aView), mContainer(nsnull), mIsModal(PR_FALSE), mChromeFlags(0)
{
NS_INIT_ISUPPORTS();
mListeners = [[NSMutableArray alloc] init];
}
CHBrowserListener::~CHBrowserListener()
{
[mListeners release];
mView = nsnull;
if (mContainer) {
[mContainer release];
}
}
NS_IMPL_ISUPPORTS9(CHBrowserListener,
nsIInterfaceRequestor,
nsIWebBrowserChrome,
nsIWindowCreator,
nsIEmbeddingSiteWindow,
nsIEmbeddingSiteWindow2,
nsIWebProgressListener,
nsISupportsWeakReference,
nsIContextMenuListener,
nsITooltipListener)
// Implementation of nsIInterfaceRequestor
NS_IMETHODIMP
CHBrowserListener::GetInterface(const nsIID &aIID, void** aInstancePtr)
{
if (aIID.Equals(NS_GET_IID(nsIDOMWindow))) {
nsCOMPtr<nsIWebBrowser> browser = dont_AddRef([mView getWebBrowser]);
if (browser)
return browser->GetContentDOMWindow((nsIDOMWindow **) aInstancePtr);
}
return QueryInterface(aIID, aInstancePtr);
}
// Implementation of nsIWindowCreator. The CocoaBrowserService forwards requests
// for a new window that have a parent to us, and we take over from there.
/* nsIWebBrowserChrome createChromeWindow (in nsIWebBrowserChrome parent, in PRUint32 chromeFlags); */
NS_IMETHODIMP
CHBrowserListener::CreateChromeWindow(nsIWebBrowserChrome *parent,
PRUint32 chromeFlags,
nsIWebBrowserChrome **_retval)
{
if (parent != this) {
#if DEBUG
NSLog(@"Mismatch in CHBrowserListener::CreateChromeWindow. We should be the owning parent.");
#endif
return NS_ERROR_FAILURE;
}
CHBrowserView* childView = [mContainer createBrowserWindow: chromeFlags];
if (!childView) {
#if DEBUG
NSLog(@"No CHBrowserView hooked up for a newly created window yet.");
#endif
return NS_ERROR_FAILURE;
}
CHBrowserListener* listener = [childView getCocoaBrowserListener];
if (!listener) {
#if DEBUG
NSLog(@"Uh-oh! No listener yet for a newly created window (nsCocoaBrowserlistener)");
return NS_ERROR_FAILURE;
#endif
}
#if DEBUG
NSLog(@"Made a chrome window.");
#endif
*_retval = listener;
NS_IF_ADDREF(*_retval);
return NS_OK;
}
// Implementation of nsIContextMenuListener
NS_IMETHODIMP
CHBrowserListener::OnShowContextMenu(PRUint32 aContextFlags, nsIDOMEvent* aEvent, nsIDOMNode* aNode)
{
[mContainer onShowContextMenu: aContextFlags domEvent: aEvent domNode: aNode];
return NS_OK;
}
// Implementation of nsITooltipListener
NS_IMETHODIMP
CHBrowserListener::OnShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords, const PRUnichar *aTipText)
{
NSPoint where;
where.x = aXCoords; where.y = aYCoords;
[mContainer onShowTooltip:where withText:[NSString stringWithPRUnichars:aTipText]];
return NS_OK;
}
NS_IMETHODIMP
CHBrowserListener::OnHideTooltip()
{
[mContainer onHideTooltip];
return NS_OK;
}
// Implementation of nsIWebBrowserChrome
/* void setStatus (in unsigned long statusType, in wstring status); */
NS_IMETHODIMP
CHBrowserListener::SetStatus(PRUint32 statusType, const PRUnichar *status)
{
if (!mContainer) {
return NS_ERROR_FAILURE;
}
NSString* str = nsnull;
if (status && (*status != PRUnichar(0))) {
str = [NSString stringWithPRUnichars:status];
}
[mContainer setStatus:str ofType:(NSStatusType)statusType];
return NS_OK;
}
/* attribute nsIWebBrowser webBrowser; */
NS_IMETHODIMP
CHBrowserListener::GetWebBrowser(nsIWebBrowser * *aWebBrowser)
{
NS_ENSURE_ARG_POINTER(aWebBrowser);
if (!mView) {
return NS_ERROR_FAILURE;
}
*aWebBrowser = [mView getWebBrowser];
return NS_OK;
}
NS_IMETHODIMP
CHBrowserListener::SetWebBrowser(nsIWebBrowser * aWebBrowser)
{
if (!mView) {
return NS_ERROR_FAILURE;
}
[mView setWebBrowser:aWebBrowser];
return NS_OK;
}
/* attribute unsigned long chromeFlags; */
NS_IMETHODIMP
CHBrowserListener::GetChromeFlags(PRUint32 *aChromeFlags)
{
NS_ENSURE_ARG_POINTER(aChromeFlags);
*aChromeFlags = mChromeFlags;
return NS_OK;
}
NS_IMETHODIMP
CHBrowserListener::SetChromeFlags(PRUint32 aChromeFlags)
{
// XXX Do nothing with them for now
mChromeFlags = aChromeFlags;
return NS_OK;
}
/* void destroyBrowserWindow (); */
NS_IMETHODIMP
CHBrowserListener::DestroyBrowserWindow()
{
// XXX Could send this up to the container, but for now,
// we just destroy the enclosing window.
NSWindow* window = [mView window];
if (window) {
[window close];
}
return NS_OK;
}
/* void sizeBrowserTo (in long aCX, in long aCY); */
NS_IMETHODIMP
CHBrowserListener::SizeBrowserTo(PRInt32 aCX, PRInt32 aCY)
{
if (mContainer) {
NSSize size;
size.width = (float)aCX;
size.height = (float)aCY;
[mContainer sizeBrowserTo:size];
}
return NS_OK;
}
/* void showAsModal (); */
NS_IMETHODIMP
CHBrowserListener::ShowAsModal()
{
if (!mView) {
return NS_ERROR_FAILURE;
}
NSWindow* window = [mView window];
if (!window) {
return NS_ERROR_FAILURE;
}
mIsModal = PR_TRUE;
//int result = [NSApp runModalForWindow:window];
mIsModal = PR_FALSE;
return NS_OK;
}
/* boolean isWindowModal (); */
NS_IMETHODIMP
CHBrowserListener::IsWindowModal(PRBool *_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
*_retval = mIsModal;
return NS_OK;
}
/* void exitModalEventLoop (in nsresult aStatus); */
NS_IMETHODIMP
CHBrowserListener::ExitModalEventLoop(nsresult aStatus)
{
// [NSApp stopModalWithCode:(int)aStatus];
return NS_OK;
}
// Implementation of nsIEmbeddingSiteWindow2
NS_IMETHODIMP
CHBrowserListener::Blur()
{
return NS_OK;
}
// Implementation of nsIEmbeddingSiteWindow
/* void setDimensions (in unsigned long flags, in long x, in long y, in long cx, in long cy); */
NS_IMETHODIMP
CHBrowserListener::SetDimensions(PRUint32 flags, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy)
{
if (!mView)
return NS_ERROR_FAILURE;
NSWindow* window = [mView window];
if (!window)
return NS_ERROR_FAILURE;
if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION) {
NSPoint origin;
origin.x = (float)x;
origin.y = (float)y;
// websites assume the origin is the topleft of the window and that the screen origin
// is "topleft" (quickdraw coordinates). As a result, we have to convert it.
GDHandle screenDevice = ::GetMainDevice();
Rect screenRect = (**screenDevice).gdRect;
short screenHeight = screenRect.bottom - screenRect.top;
origin.y = screenHeight - origin.y;
[window setFrameTopLeftPoint:origin];
}
if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER) {
NSRect frame = [window frame];
frame.size.width = (float)cx;
frame.size.height = (float)cy;
[window setFrame:frame display:YES];
}
else if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER) {
NSSize size;
size.width = (float)cx;
size.height = (float)cy;
[window setContentSize:size];
}
return NS_OK;
}
/* void getDimensions (in unsigned long flags, out long x, out long y, out long cx, out long cy); */
NS_IMETHODIMP
CHBrowserListener::GetDimensions(PRUint32 flags, PRInt32 *x, PRInt32 *y, PRInt32 *cx, PRInt32 *cy)
{
if (!mView)
return NS_ERROR_FAILURE;
NSWindow* window = [mView window];
if (!window)
return NS_ERROR_FAILURE;
NSRect frame = [window frame];
if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION) {
if ( x )
*x = (PRInt32)frame.origin.x;
if ( y )
*y = (PRInt32)frame.origin.y;
}
if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER) {
if ( cx )
*cx = (PRInt32)frame.size.width;
if ( cy )
*cy = (PRInt32)frame.size.height;
}
else if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER) {
NSView* contentView = [window contentView];
NSRect contentFrame = [contentView frame];
if ( cx )
*cx = (PRInt32)contentFrame.size.width;
if ( cy )
*cy = (PRInt32)contentFrame.size.height;
}
return NS_OK;
}
/* void setFocus (); */
NS_IMETHODIMP
CHBrowserListener::SetFocus()
{
if (!mView) {
return NS_ERROR_FAILURE;
}
NSWindow* window = [mView window];
if (!window) {
return NS_ERROR_FAILURE;
}
[window makeKeyAndOrderFront:window];
return NS_OK;
}
/* attribute boolean visibility; */
NS_IMETHODIMP
CHBrowserListener::GetVisibility(PRBool *aVisibility)
{
NS_ENSURE_ARG_POINTER(aVisibility);
if (!mView) {
return NS_ERROR_FAILURE;
}
NSWindow* window = [mView window];
if (!window) {
return NS_ERROR_FAILURE;
}
*aVisibility = [window isMiniaturized];
return NS_OK;
}
NS_IMETHODIMP
CHBrowserListener::SetVisibility(PRBool aVisibility)
{
if (!mView) {
return NS_ERROR_FAILURE;
}
NSWindow* window = [mView window];
if (!window) {
return NS_ERROR_FAILURE;
}
if (aVisibility) {
[window deminiaturize:window];
}
else {
[window miniaturize:window];
}
return NS_OK;
}
/* attribute wstring title; */
NS_IMETHODIMP
CHBrowserListener::GetTitle(PRUnichar * *aTitle)
{
NS_ENSURE_ARG_POINTER(aTitle);
if (!mContainer) {
return NS_ERROR_FAILURE;
}
NSString* title = [mContainer title];
unsigned int length = [title length];
if (length) {
*aTitle = (PRUnichar*)nsMemory::Alloc((length+1)*sizeof(PRUnichar));
if (!*aTitle) {
return NS_ERROR_OUT_OF_MEMORY;
}
[title getCharacters:*aTitle];
}
else {
*aTitle = nsnull;
}
return NS_OK;
}
NS_IMETHODIMP
CHBrowserListener::SetTitle(const PRUnichar * aTitle)
{
NS_ENSURE_ARG(aTitle);
if (!mContainer) {
return NS_ERROR_FAILURE;
}
NSString* str = [NSString stringWithPRUnichars:aTitle];
[mContainer setTitle:str];
return NS_OK;
}
/* [noscript] readonly attribute voidPtr siteWindow; */
NS_IMETHODIMP
CHBrowserListener::GetSiteWindow(void * *aSiteWindow)
{
NS_ENSURE_ARG_POINTER(aSiteWindow);
*aSiteWindow = nsnull;
if (!mView) {
return NS_ERROR_FAILURE;
}
NSWindow* window = [mView window];
if (!window) {
return NS_ERROR_FAILURE;
}
*aSiteWindow = (void*)window;
return NS_OK;
}
//
// Implementation of nsIWebProgressListener
//
/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aStateFlags, in unsigned long aStatus); */
NS_IMETHODIMP
CHBrowserListener::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest,
PRUint32 aStateFlags, PRUint32 aStatus)
{
NSEnumerator* enumerator = [mListeners objectEnumerator];
id<CHBrowserListener> obj;
if (aStateFlags & nsIWebProgressListener::STATE_IS_NETWORK) {
if (aStateFlags & nsIWebProgressListener::STATE_START) {
while ((obj = [enumerator nextObject]))
[obj onLoadingStarted];
}
else if (aStateFlags & nsIWebProgressListener::STATE_STOP) {
while ((obj = [enumerator nextObject]))
[obj onLoadingCompleted:(NS_SUCCEEDED(aStatus))];
}
}
return NS_OK;
}
/* void onProgressChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aCurSelfProgress, in long aMaxSelfProgress, in long aCurTotalProgress, in long aMaxTotalProgress); */
NS_IMETHODIMP
CHBrowserListener::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest,
PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress,
PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress)
{
NSEnumerator* enumerator = [mListeners objectEnumerator];
id<CHBrowserListener> obj;
while ((obj = [enumerator nextObject]))
[obj onProgressChange:aCurTotalProgress outOf:aMaxTotalProgress];
return NS_OK;
}
/* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location); */
NS_IMETHODIMP
CHBrowserListener::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest,
nsIURI *location)
{
if (!location)
return NS_ERROR_FAILURE;
nsCAutoString spec;
location->GetSpec(spec);
NSString* str = [NSString stringWithCString:spec.get()];
NSEnumerator* enumerator = [mListeners objectEnumerator];
id<CHBrowserListener> obj;
while ((obj = [enumerator nextObject]))
[obj onLocationChange:str];
return NS_OK;
}
/* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */
NS_IMETHODIMP
CHBrowserListener::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus,
const PRUnichar *aMessage)
{
NSString* str = [NSString stringWithPRUnichars:aMessage];
NSEnumerator* enumerator = [mListeners objectEnumerator];
id<CHBrowserListener> obj;
while ((obj = [enumerator nextObject]))
[obj onStatusChange: str];
return NS_OK;
}
/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */
NS_IMETHODIMP
CHBrowserListener::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 state)
{
NSEnumerator* enumerator = [mListeners objectEnumerator];
id<CHBrowserListener> obj;
while ((obj = [enumerator nextObject]))
[obj onSecurityStateChange: state];
return NS_OK;
}
void
CHBrowserListener::AddListener(id <CHBrowserListener> aListener)
{
[mListeners addObject:aListener];
}
void
CHBrowserListener::RemoveListener(id <CHBrowserListener> aListener)
{
[mListeners removeObject:aListener];
}
void
CHBrowserListener::SetContainer(id <CHBrowserContainer> aContainer)
{
[mContainer autorelease];
mContainer = aContainer;
[mContainer retain];
}

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

@ -63,7 +63,6 @@ PRBool CHBrowserService::sCanTerminate = PR_FALSE;
// CHBrowserService implementation
CHBrowserService::CHBrowserService()
{
NS_INIT_ISUPPORTS();
}
CHBrowserService::~CHBrowserService()

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

@ -108,7 +108,6 @@ NS_IMPL_ISUPPORTS2(CHClickListener, nsIDOMMouseListener, nsIDOMEventListener)
CHClickListener::CHClickListener()
{
NS_INIT_ISUPPORTS();
}
CHClickListener::~CHClickListener()

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

@ -1,122 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Chimera code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Simon Fraser <sfraser@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// This file contains implementations of factories for various
// downloading-related interfaces.
#warning ProgressDlgController shouldnt be included in embedding
#import "ProgressDlgController.h"
#import "CHDownloadProgressDisplay.h"
#include "nsCOMPtr.h"
#include "nsIFactory.h"
#include "nsDownloadListener.h"
#include "CHDownloadFactories.h"
// factory for nsIDownload objects
// XXX replace with generic factory stuff
class DownloadListenerFactory : public nsIFactory
{
public:
DownloadListenerFactory();
virtual ~DownloadListenerFactory();
NS_DECL_ISUPPORTS
NS_DECL_NSIFACTORY
protected:
DownloadControllerFactory* mControllerFactory; // factory which creates the Cocoa window controller
};
DownloadListenerFactory::DownloadListenerFactory()
: mControllerFactory(nil)
{
NS_INIT_ISUPPORTS();
mControllerFactory = [[ChimeraDownloadControllerFactory alloc] init];
}
DownloadListenerFactory::~DownloadListenerFactory()
{
[mControllerFactory release];
}
NS_IMPL_ISUPPORTS1(DownloadListenerFactory, nsIFactory)
/* void createInstance (in nsISupports aOuter, in nsIIDRef iid, [iid_is (iid), retval] out nsQIResult result); */
NS_IMETHODIMP
DownloadListenerFactory::CreateInstance(nsISupports *aOuter, const nsIID& aIID, void* *aResult)
{
nsresult rv;
if (aIID.Equals(NS_GET_IID(nsIDownload)))
{
nsDownloadListener* downloadListener = new nsDownloadListener(mControllerFactory);
if (!downloadListener) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(downloadListener);
rv = downloadListener->QueryInterface(aIID, aResult);
NS_RELEASE(downloadListener);
return rv;
}
return NS_ERROR_NO_INTERFACE;
}
/* void lockFactory (in PRBool lock); */
NS_IMETHODIMP
DownloadListenerFactory::LockFactory(PRBool lock)
{
return NS_OK;
}
#pragma mark -
nsresult NewDownloadListenerFactory(nsIFactory* *outFactory)
{
DownloadListenerFactory* newFactory = new DownloadListenerFactory();
if (!newFactory) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(newFactory);
nsresult rv = newFactory->QueryInterface(NS_GET_IID(nsIFactory), (void **)outFactory);
NS_RELEASE(newFactory);
return rv;
}

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

@ -1,76 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Chimera code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Simon Fraser <sfraser@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#import "CHDownloadProgressDisplay.h"
@implementation DownloadControllerFactory
- (NSWindowController<CHDownloadProgressDisplay> *)createDownloadController
{
// a dummy implementation. You should provide a subclass that
// returns an instance of your progress dialog controller.
return nil;
}
@end
#pragma mark -
// see the header file for comments
CHDownloader::CHDownloader(DownloadControllerFactory* inControllerFactory)
: mControllerFactory(inControllerFactory)
, mDownloadDisplay(nil)
, mIsFileSave(PR_FALSE)
{
NS_INIT_ISUPPORTS();
[mControllerFactory retain];
}
CHDownloader::~CHDownloader()
{
[mControllerFactory release];
}
NS_IMPL_ISUPPORTS1(CHDownloader, nsISupports)
void
CHDownloader::CreateDownloadDisplay()
{
mDownloadDisplay = [mControllerFactory createDownloadController];
[mDownloadDisplay setDownloadListener:this];
}

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

@ -66,7 +66,6 @@ nsHeaderSniffer::nsHeaderSniffer(nsIWebBrowserPersist* aPersist, nsIFile* aFile,
, mFilterView(aFilterView)
, mFilterList(aFilterList)
{
NS_INIT_ISUPPORTS();
}
nsHeaderSniffer::~nsHeaderSniffer()

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

@ -30,7 +30,6 @@
EmbedEventListener::EmbedEventListener(void)
{
NS_INIT_ISUPPORTS();
mOwner = nsnull;
}

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

@ -47,7 +47,6 @@
EmbedProgress::EmbedProgress(void)
{
NS_INIT_ISUPPORTS();
mOwner = nsnull;
mSkipOnState = mDownloadDocument = 0;
}

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

@ -41,7 +41,6 @@ NS_IMPL_ISUPPORTS1(EmbedStream, nsIInputStream)
EmbedStream::EmbedStream()
{
NS_INIT_ISUPPORTS();
mOwner = nsnull;
mOffset = 0;
mDoingStream = PR_FALSE;

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

@ -51,7 +51,6 @@ PtWidget_t *EmbedWindow::sTipWindow = nsnull;
EmbedWindow::EmbedWindow(void)
{
NS_INIT_ISUPPORTS();
mOwner = nsnull;
mVisibility = PR_FALSE;
mIsModal = PR_FALSE;

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

@ -29,7 +29,6 @@
EmbedWindowCreator::EmbedWindowCreator(void)
{
NS_INIT_ISUPPORTS();
}
EmbedWindowCreator::~EmbedWindowCreator()

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

@ -84,7 +84,6 @@ NS_IMPL_ISUPPORTS2(CPromptService, nsIPromptService, nsPIPromptService)
CPromptService::CPromptService() :
mWWatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")) {
NS_INIT_ISUPPORTS();
}
CPromptService::~CPromptService() {
@ -386,7 +385,6 @@ NS_IMPL_ISUPPORTS1(CPromptServiceFactory, nsIFactory)
CPromptServiceFactory::CPromptServiceFactory() {
NS_INIT_ISUPPORTS();
}
CPromptServiceFactory::~CPromptServiceFactory() {

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

@ -66,8 +66,6 @@ nsPrintSettings::nsPrintSettings() :
mPrintPageDelay(500),
mPrintSilent(PR_FALSE)
{
NS_INIT_ISUPPORTS();
/* member initializers and constructor code */
nscoord halfInch = NS_INCHES_TO_TWIPS(0.5);
mMargin.SizeTo(halfInch, halfInch, halfInch, halfInch);

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

@ -53,7 +53,6 @@
#include <photon/PtWebClient.h>
nsUnknownContentTypeHandler::nsUnknownContentTypeHandler( ) {
NS_INIT_ISUPPORTS();
}
nsUnknownContentTypeHandler::~nsUnknownContentTypeHandler( ) { }
@ -153,7 +152,6 @@ PtWidget_t *nsUnknownContentTypeHandler::GetWebBrowser(nsIDOMWindow *aWindow)
NS_IMPL_ISUPPORTS2(nsWebProgressListener, nsIWebProgressListener, nsISupportsWeakReference)
nsWebProgressListener::nsWebProgressListener() {
NS_INIT_ISUPPORTS();
}
nsWebProgressListener::~nsWebProgressListener() { }

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

@ -137,8 +137,6 @@ nsLayoutDebuggingTools::nsLayoutDebuggingTools()
mCrossingEventDumping(PR_FALSE),
mReflowCounts(PR_FALSE)
{
NS_INIT_ISUPPORTS();
NewURILoaded();
}

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

@ -78,7 +78,6 @@ nsPolicyReference::nsPolicyReference()
: mFlags (0),
mError (0)
{
NS_INIT_ISUPPORTS();
}
nsPolicyReference::~nsPolicyReference()

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

@ -73,7 +73,6 @@ const PRInt32 kFirstDirSize=8;
mozMySpell::mozMySpell()
{
NS_INIT_ISUPPORTS();
}
mozMySpell::~mozMySpell()

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

@ -42,7 +42,6 @@ NS_IMPL_ISUPPORTS1(mozGenericWordUtils, mozISpellI18NUtil)
mozGenericWordUtils::mozGenericWordUtils()
{
NS_INIT_ISUPPORTS();
/* member initializers and constructor code */
}

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

@ -44,7 +44,6 @@ NS_IMPL_ISUPPORTS1(mozSpellChecker, nsISpellChecker)
mozSpellChecker::mozSpellChecker()
{
NS_INIT_ISUPPORTS();
mDictionaryName.SetLength(0);
nsresult rv;

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

@ -44,7 +44,6 @@ NS_IMPL_ISUPPORTS1(mozSpellI18NManager, mozISpellI18NManager)
mozSpellI18NManager::mozSpellI18NManager()
{
NS_INIT_ISUPPORTS();
/* member initializers and constructor code */
}

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

@ -9,7 +9,6 @@ mozSqlConnection::mozSqlConnection()
mShutdown(PR_FALSE),
mWaiting(PR_FALSE)
{
NS_INIT_ISUPPORTS();
mExecLock = PR_NewLock();
}

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

@ -6,7 +6,6 @@ mozSqlRequest::mozSqlRequest(mozISqlConnection* aConnection)
mIsQuery(PR_TRUE),
mStatus(mozISqlRequest::STATUS_NONE)
{
NS_INIT_ISUPPORTS();
mConnection = do_GetWeakReference(aConnection);
}

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

@ -31,7 +31,6 @@ mozSqlResult::mozSqlResult(mozISqlConnection* aConnection,
mCanUpdate(-1),
mCanDelete(-1)
{
NS_INIT_ISUPPORTS();
}
nsresult
@ -1177,7 +1176,6 @@ mozSqlResultEnumerator::mozSqlResultEnumerator(mozSqlResult* aResult)
mCurrentIndex(-1),
mCurrentRow(nsnull)
{
NS_INIT_ISUPPORTS();
NS_ADDREF(mResult);
mBuffer = Row::Create(mResult->mAllocator, nsnull, mResult->mColumnInfo);
@ -1778,7 +1776,6 @@ mozSqlResultStream::mozSqlResultStream(mozSqlResult* aResult)
mLength(0),
mPosition(0)
{
NS_INIT_ISUPPORTS();
NS_ADDREF(mResult);
}

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

@ -33,7 +33,6 @@ nsIRDFResource* mozSqlService::kSQL_Database;
mozSqlService::mozSqlService()
: mConnectionCache(nsnull)
{
NS_INIT_ISUPPORTS();
}
mozSqlService::~mozSqlService()

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

@ -49,7 +49,6 @@
nsDeviceContextSpecFactoryPh :: nsDeviceContextSpecFactoryPh()
{
NS_INIT_ISUPPORTS();
}
nsDeviceContextSpecFactoryPh :: ~nsDeviceContextSpecFactoryPh()

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

@ -58,7 +58,6 @@
nsDeviceContextSpecPh :: nsDeviceContextSpecPh()
{
NS_INIT_ISUPPORTS();
mPC = PpCreatePC();
}
@ -186,7 +185,6 @@ PpPrintContext_t *nsDeviceContextSpecPh :: GetPrintContext()
//***********************************************************
nsPrinterEnumeratorPh::nsPrinterEnumeratorPh()
{
NS_INIT_ISUPPORTS();
}
nsPrinterEnumeratorPh::~nsPrinterEnumeratorPh()

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

@ -72,8 +72,6 @@ NS_IMPL_ISUPPORTS2( nsDrawingSurfacePh, nsIDrawingSurface, nsIDrawingSurfacePh )
nsDrawingSurfacePh :: nsDrawingSurfacePh( )
{
NS_INIT_ISUPPORTS();
mDrawContext = nsnull;
mGC = nsnull;
mWidth = 0;

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

@ -61,7 +61,6 @@ static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
nsFontMetricsPh::nsFontMetricsPh()
{
NS_INIT_ISUPPORTS();
mDeviceContext = nsnull;
mFont = nsnull;
@ -300,7 +299,6 @@ struct nsFontFamily
// The Font Enumerator
nsFontEnumeratorPh::nsFontEnumeratorPh()
{
NS_INIT_ISUPPORTS();
}
NS_IMPL_ISUPPORTS1(nsFontEnumeratorPh, nsIFontEnumerator)

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

@ -187,7 +187,6 @@ NS_IMPL_ISUPPORTS1(nsImagePh, nsIImage)
// ----------------------------------------------------------------
nsImagePh :: nsImagePh()
{
NS_INIT_ISUPPORTS();
mImageBits = nsnull;
mWidth = 0;
mHeight = 0;

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

@ -48,14 +48,12 @@ class nsRegionPh : public nsIRegion
public:
inline nsRegionPh()
{
NS_INIT_ISUPPORTS();
mRegion = NULL;
mRegionType = eRegionComplexity_empty;
}
inline nsRegionPh(PhTile_t *tiles)
{
NS_INIT_ISUPPORTS();
mRegion = tiles; /* assume ownership */
mRegionType = (mRegion == NULL) ? eRegionComplexity_empty : eRegionComplexity_complex;
}

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

@ -62,8 +62,6 @@ NS_IMPL_ISUPPORTS1(nsRenderingContextPh, nsIRenderingContext)
nsRenderingContextPh :: nsRenderingContextPh()
{
NS_INIT_ISUPPORTS();
mGC = nsnull;
mTranMatrix = nsnull;
mClipRegion = nsnull;

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

@ -42,7 +42,6 @@
#include "nsPhGfxLog.h"
nsScreenManagerPh :: nsScreenManagerPh( ) {
NS_INIT_ISUPPORTS();
// nothing else to do. I guess we could cache a bunch of information
// here, but we want to ask the device at runtime in case anything
// has changed.

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

@ -49,8 +49,6 @@ nsScreenPh :: nsScreenPh ( ) {
PhRid_t rid;
PhRegion_t region;
NS_INIT_ISUPPORTS();
p = NULL;
/* Initialize the data members */

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

@ -50,8 +50,6 @@ nsUnicodeToSunIndic::nsUnicodeToSunIndic()
static NS_DEFINE_CID(kLECID, NS_ULE_CID);
nsresult rv;
NS_INIT_ISUPPORTS();
mCtlObj = do_CreateInstance(kLECID, &rv);
if (NS_FAILED(rv)) {

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

@ -48,8 +48,6 @@ nsUnicodeToTIS620::nsUnicodeToTIS620()
static NS_DEFINE_CID(kLECID, NS_ULE_CID);
nsresult rv;
NS_INIT_ISUPPORTS();
mCtlObj = do_CreateInstance(kLECID, &rv);
if (NS_FAILED(rv)) {
#ifdef DEBUG_prabhath

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

@ -98,7 +98,6 @@ NS_IMPL_ISUPPORTS1(nsUnicodeNormalizer, nsIUnicodeNormalizer)
nsUnicodeNormalizer::nsUnicodeNormalizer()
{
NS_INIT_ISUPPORTS();
}
nsUnicodeNormalizer::~nsUnicodeNormalizer()

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

@ -152,8 +152,6 @@ ipcService::ipcService()
: mTransport(nsnull)
, mClientID(0)
{
NS_INIT_ISUPPORTS();
IPC_InitLog(">>>");
}

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

@ -96,7 +96,7 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_IPCIMESSAGEOBSERVER
myIpcMessageObserver() { NS_INIT_ISUPPORTS(); }
myIpcMessageObserver() {}
};
NS_IMPL_ISUPPORTS1(myIpcMessageObserver, ipcIMessageObserver)

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

@ -50,7 +50,6 @@
nsMessengerContentHandler::nsMessengerContentHandler()
{
NS_INIT_ISUPPORTS();
}
/* the following macro actually implement addref, release and query interface for our component. */

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

@ -106,8 +106,6 @@ NS_IMETHODIMP nsIDNService::Observe(nsISupports *aSubject,
nsIDNService::nsIDNService()
{
NS_INIT_ISUPPORTS();
nsresult rv;
// initialize to the official prefix (RFC 3490 "5. ACE prefix")

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

@ -81,7 +81,6 @@ static NS_DEFINE_CID(kCmdLineServiceCID, NS_COMMANDLINE_SERVICE_CID);
//-------------------------------------------------------------------------
nsAppShell::nsAppShell()
{
NS_INIT_ISUPPORTS();
mEventQueue = nsnull;
mFD = -1;
}

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

@ -41,7 +41,6 @@ NS_IMPL_ISUPPORTS1(nsBidiKeyboard, nsIBidiKeyboard)
nsBidiKeyboard::nsBidiKeyboard() : nsIBidiKeyboard()
{
NS_INIT_ISUPPORTS();
}
nsBidiKeyboard::~nsBidiKeyboard()

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

@ -1,177 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsButton.h"
#include "nsToolkit.h"
#include "nsColor.h"
#include "nsGUIEvent.h"
#include "nsString.h"
#include <Pt.h>
#include "nsILookAndFeel.h"
#include "nsWidgetsCID.h"
#include "nsIComponentManager.h"
#include "nsIDeviceContext.h"
#include "nsIFontMetrics.h"
#include "nsPhWidgetLog.h"
NS_IMPL_ISUPPORTS_INHERITED1(nsButton, nsWidget, nsIButton)
//-------------------------------------------------------------------------
//
// nsButton constructor
//
//-------------------------------------------------------------------------
nsButton::nsButton() : nsWidget(), nsIButton()
{
NS_INIT_ISUPPORTS();
}
//-------------------------------------------------------------------------
//
// nsButton destructor
//
//-------------------------------------------------------------------------
nsButton::~nsButton()
{
}
//-------------------------------------------------------------------------
//
// Set this button label
//
//-------------------------------------------------------------------------
NS_METHOD nsButton::SetLabel(const nsString& aText)
{
mLabel = aText;
if( mWidget )
{
PtArg_t arg;
PtSetArg( &arg, Pt_ARG_TEXT_STRING,
NS_ConvertUCS2toUTF8(aText).get(), 0 );
PtSetResources( mWidget, 1, &arg );
}
return NS_OK;
}
//-------------------------------------------------------------------------
//
// Get this button label
//
//-------------------------------------------------------------------------
NS_METHOD nsButton::GetLabel(nsString& aBuffer)
{
aBuffer = mLabel;
return NS_OK;
}
//-------------------------------------------------------------------------
//
// move, paint, resizes message - ignore
//
//-------------------------------------------------------------------------
// Not Implemented
PRBool nsButton::OnMove(PRInt32, PRInt32)
{
return PR_FALSE;
}
// Not Implemented
PRBool nsButton::OnPaint()
{
return PR_FALSE;
}
// Not Implemented
PRBool nsButton::OnResize(nsRect &aWindowRect)
{
return PR_FALSE;
}
/**
* Renders the Button for Printing
*
**/
// Not Implemented
NS_METHOD nsButton::Paint(nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect)
{
return NS_OK;
}
NS_METHOD nsButton::CreateNative( PtWidget_t* aParent )
{
nsresult res = NS_ERROR_FAILURE;
PtArg_t arg[5];
PhPoint_t pos;
PhDim_t dim;
const unsigned short BorderWidth = 2;
NS_PRECONDITION(aParent, "nsButton::CreateNative aParent is NULL");
pos.x = mBounds.x;
pos.y = mBounds.y;
dim.w = mBounds.width - (2*BorderWidth); // Correct for border width
dim.h = mBounds.height - (2*BorderWidth);
PtSetArg( &arg[0], Pt_ARG_POS, &pos, 0 );
PtSetArg( &arg[1], Pt_ARG_DIM, &dim, 0 );
PtSetArg( &arg[2], Pt_ARG_BORDER_WIDTH, BorderWidth, 0 );
mWidget = PtCreateWidget( PtButton, aParent, 3, arg );
if( mWidget )
{
PtAddEventHandler( mWidget,
Ph_EV_BUT_PRESS | Ph_EV_BUT_RELEASE |Ph_EV_BOUNDARY,
RawEventHandler, this );
res = NS_OK;
}
NS_POSTCONDITION(mWidget, "nsButton::CreateNative Failed to create Native Button");
return res;
}

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

@ -1,295 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsCheckButton.h"
#include "nsToolkit.h"
#include "nsColor.h"
#include "nsGUIEvent.h"
#include "nsString.h"
#include <Pt.h>
#include "nsILookAndFeel.h"
#include "nsWidgetsCID.h"
#include "nsIComponentManager.h"
#include "nsIDeviceContext.h"
#include "nsIFontMetrics.h"
#include "nsPhWidgetLog.h"
NS_IMPL_ADDREF(nsCheckButton)
NS_IMPL_RELEASE(nsCheckButton)
//-------------------------------------------------------------------------
//
// nsCheckButton constructor
//
//-------------------------------------------------------------------------
nsCheckButton::nsCheckButton() : nsWidget(), nsICheckButton(),
mState(PR_FALSE)
{
NS_INIT_ISUPPORTS();
}
//-------------------------------------------------------------------------
//
// nsCheckButton destructor
//
//-------------------------------------------------------------------------
nsCheckButton::~nsCheckButton()
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsCheckButton::~nsCheckButton - Not Implemented!\n"));
}
/**
* Implement the standard QueryInterface for NS_IWIDGET_IID and NS_ISUPPORTS_IID
* @modify gpk 8/4/98
* @param aIID The name of the class implementing the method
* @param _classiiddef The name of the #define symbol that defines the IID
* for the class (e.g. NS_ISUPPORTS_IID)
*
*/
nsresult nsCheckButton::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsCheckButton:QueryInterface, mWidget=%p\n", mWidget));
if (NULL == aInstancePtr)
{
return NS_ERROR_NULL_POINTER;
}
static NS_DEFINE_IID(kICheckButton, NS_ICHECKBUTTON_IID);
if (aIID.Equals(kICheckButton)) {
*aInstancePtr = (void*) ((nsICheckButton*)this);
NS_ADDREF_THIS();
return NS_OK;
}
return nsWidget::QueryInterface(aIID,aInstancePtr);
}
//-------------------------------------------------------------------------
//
// Set the CheckButton State
//
//-------------------------------------------------------------------------
NS_METHOD nsCheckButton::SetState(const PRBool aState)
{
// PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsCheckButton:SetState, mWidget=%p new state is <%d>\n", mWidget, aState));
nsresult res = NS_ERROR_FAILURE;
mState = aState;
if (mWidget)
{
PtArg_t arg;
if (mState)
PtSetArg( &arg, Pt_ARG_FLAGS, Pt_SET, Pt_SET );
else
PtSetArg( &arg, Pt_ARG_FLAGS, 0, Pt_SET );
if( PtSetResources( mWidget, 1, &arg ) == 0 )
res = NS_OK;
}
return res;
}
//-------------------------------------------------------------------------
//
// Get the CheckButton State
//
//-------------------------------------------------------------------------
NS_METHOD nsCheckButton::GetState(PRBool & aState)
{
// PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsCheckButton:GetState, mWidget=%p\n", mWidget));
nsresult res = NS_ERROR_FAILURE;
if (mWidget)
{
PtArg_t arg;
long *flags;
PtSetArg( &arg, Pt_ARG_FLAGS, &flags, 0);
if( PtGetResources( mWidget, 1, &arg ) == 0 )
{
if( *flags & Pt_SET )
mState = PR_TRUE;
else
mState = PR_FALSE;
res = NS_OK;
}
}
aState = mState;
return res;
}
//-------------------------------------------------------------------------
//
// Set this button label
//
//-------------------------------------------------------------------------
NS_METHOD nsCheckButton::SetLabel(const nsString& aText)
{
nsresult res = NS_ERROR_FAILURE;
PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsCheckButton:SetLabel, mWidget=%p\n", mWidget));
if( mWidget )
{
PtArg_t arg;
PtSetArg( &arg, Pt_ARG_TEXT_STRING,
NS_ConvertUCS2toUTF8(aText).get(), 0 );
if( PtSetResources( mWidget, 1, &arg ) == 0 )
res = NS_OK;
}
return res;
}
//-------------------------------------------------------------------------
//
// Get this button label
//
//-------------------------------------------------------------------------
NS_METHOD nsCheckButton::GetLabel(nsString& aBuffer)
{
nsresult res = NS_ERROR_FAILURE;
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsCheckButton::GetLabel\n"));
aBuffer.SetLength(0);
if( mWidget )
{
PtArg_t arg;
char *label;
PtSetArg( &arg, Pt_ARG_TEXT_STRING, &label, 0 );
if( PtGetResources( mWidget, 1, &arg ) == 0 )
{
aBuffer.Append( label );
res = NS_OK;
}
}
return res;
}
//-------------------------------------------------------------------------
//
// move, paint, resizes message - ignore
//
//-------------------------------------------------------------------------
PRBool nsCheckButton::OnMove(PRInt32, PRInt32)
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsCheckButton::OnMove - Not Implemented\n"));
return PR_FALSE;
}
PRBool nsCheckButton::OnPaint()
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsCheckButton::OnPaint - Not Implemented\n"));
return PR_FALSE;
}
PRBool nsCheckButton::OnResize(nsRect &aWindowRect)
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsCheckButton::OnResize - Not Implemented\n"));
return PR_FALSE;
}
/**
* Renders the CheckButton for Printing
*
**/
NS_METHOD nsCheckButton::Paint(nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect)
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsCheckButton::Paint - Not Implemented\n"));
return NS_OK;
}
NS_METHOD nsCheckButton::CreateNative( PtWidget_t* aParent )
{
nsresult res = NS_ERROR_FAILURE;
PtArg_t arg[15];
PhPoint_t pos;
PhDim_t dim;
PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsCheckButton::CreateNative this=<%p>\n", this));
pos.x = mBounds.x;
pos.y = mBounds.y;
dim.w = mBounds.width; // Correct for border width
dim.h = mBounds.height;
PtSetArg( &arg[0], Pt_ARG_POS, &pos, 0 );
PtSetArg( &arg[1], Pt_ARG_DIM, &dim, 0 );
PtSetArg( &arg[2], Pt_ARG_BORDER_WIDTH, 0, 0 );
PtSetArg( &arg[3], Pt_ARG_INDICATOR_TYPE, Pt_CHECK, 0 );
PtSetArg( &arg[4], Pt_ARG_INDICATOR_COLOR, Pg_BLACK, 0 );
PtSetArg( &arg[5], Pt_ARG_SPACING, 0, 0 );
PtSetArg( &arg[6], Pt_ARG_MARGIN_TOP, 0, 0 );
PtSetArg( &arg[7], Pt_ARG_MARGIN_LEFT, 0, 0 );
PtSetArg( &arg[8], Pt_ARG_MARGIN_BOTTOM, 0, 0 );
PtSetArg( &arg[9], Pt_ARG_MARGIN_RIGHT, 0, 0 );
PtSetArg( &arg[10], Pt_ARG_MARGIN_WIDTH, 0, 0 );
PtSetArg( &arg[11], Pt_ARG_MARGIN_HEIGHT, 0, 0 );
PtSetArg( &arg[12], Pt_ARG_VERTICAL_ALIGNMENT, Pt_TOP, 0 );
PtSetArg( &arg[13], Pt_ARG_FLAGS, 0, Pt_SELECTABLE );
mWidget = PtCreateWidget( PtToggleButton, aParent, 14, arg );
if( mWidget )
{
PtAddEventHandler( mWidget,
Ph_EV_BUT_PRESS | Ph_EV_BUT_RELEASE |Ph_EV_BOUNDARY,
RawEventHandler, this );
res = NS_OK;
}
return res;
}

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

@ -79,7 +79,6 @@ nsClipboard::nsClipboard()
printf("nsClipboard::nsClipboard()\n");
#endif /* DEBUG_CLIPBOARD */
NS_INIT_ISUPPORTS();
mIgnoreEmptyNotification = PR_FALSE;
mGlobalTransferable = nsnull;
mSelectionTransferable = nsnull;

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

@ -60,7 +60,6 @@ NS_IMPL_QUERY_INTERFACE2(nsDragService, nsIDragService, nsIDragSession)
//-------------------------------------------------------------------------
nsDragService::nsDragService()
{
NS_INIT_ISUPPORTS();
mDndWidget = nsnull;
mDndEvent = nsnull;
mNativeCtrl = nsnull;

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

@ -55,7 +55,6 @@ nsFilePicker::nsFilePicker()
, mUnicodeEncoder(nsnull)
, mUnicodeDecoder(nsnull)
{
NS_INIT_ISUPPORTS();
mDisplayDirectory = do_CreateInstance("@mozilla.org/file/local;1");
char *path = getenv( "HOME" );
if( path ) {

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

@ -1,226 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsLabel.h"
#include "nsToolkit.h"
#include "nsColor.h"
#include "nsGUIEvent.h"
#include "nsString.h"
#include <Pt.h>
#include "nsPhWidgetLog.h"
NS_IMPL_ADDREF_INHERITED(nsLabel, nsWidget)
NS_IMPL_RELEASE_INHERITED(nsLabel, nsWidget)
//-------------------------------------------------------------------------
//
// nsLabel constructor
//
//-------------------------------------------------------------------------
nsLabel::nsLabel() : nsWidget(), nsILabel()
{
NS_INIT_ISUPPORTS();
mAlignment = eAlign_Left;
}
//-------------------------------------------------------------------------
//
// nsLabel destructor
//
//-------------------------------------------------------------------------
nsLabel::~nsLabel()
{
}
//-------------------------------------------------------------------------
//
// Create the nativeLabel widget
//
//-------------------------------------------------------------------------
NS_METHOD nsLabel::CreateNative( PtWidget_t *aParent )
{
nsresult res = NS_ERROR_FAILURE;
PtArg_t arg[5];
PhPoint_t pos;
PhDim_t dim;
PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsLabel::CreateNative at (%d,%d) for (%d,%d)\n",mBounds.x,mBounds.y, mBounds.width, mBounds.height));
NS_PRECONDITION(aParent, "nsLabel::CreateNative aParent is NULL");
pos.x = mBounds.x;
pos.y = mBounds.y;
dim.w = mBounds.width;
dim.h = mBounds.height;
PtSetArg( &arg[0], Pt_ARG_POS, &pos, 0 );
PtSetArg( &arg[1], Pt_ARG_DIM, &dim, 0 );
PtSetArg( &arg[2], Pt_ARG_BORDER_WIDTH, 0, 0 );
mWidget = PtCreateWidget( PtButton, aParent, 3, arg );
if( mWidget )
{
res = NS_OK;
}
NS_POSTCONDITION(mWidget, "nsLabel::CreateNative Failed to create native label");
return res;
}
//-------------------------------------------------------------------------
//
//
//-------------------------------------------------------------------------
NS_METHOD nsLabel::PreCreateWidget(nsWidgetInitData *aInitData)
{
if (nsnull != aInitData) {
nsLabelInitData* data = (nsLabelInitData *) aInitData;
mAlignment = data->mAlignment;
}
return NS_OK;
}
//-------------------------------------------------------------------------
//
// Set alignment
//
//-------------------------------------------------------------------------
NS_METHOD nsLabel::SetAlignment(nsLabelAlignment aAlignment)
{
mAlignment = aAlignment;
return NS_OK;
}
//-------------------------------------------------------------------------
//
// Query interface implementation
//
//-------------------------------------------------------------------------
nsresult nsLabel::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
nsresult result = nsWidget::QueryInterface(aIID, aInstancePtr);
static NS_DEFINE_IID(kILabelIID, NS_ILABEL_IID);
if (result == NS_NOINTERFACE && aIID.Equals(kILabelIID)) {
*aInstancePtr = (void*) ((nsILabel*)this);
AddRef();
result = NS_OK;
}
return result;
}
//-------------------------------------------------------------------------
//
// Set this button label
//
//-------------------------------------------------------------------------
NS_METHOD nsLabel::SetLabel(const nsString& aText)
{
nsresult res = NS_ERROR_FAILURE;
PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsLabel:SetLabel\n"));
if( mWidget )
{
PtArg_t arg;
PtSetArg( &arg, Pt_ARG_TEXT_STRING,
NS_ConvertUCS2toUTF8(aText).get(), 0 );
if( PtSetResources( mWidget, 1, &arg ) == 0 )
res = NS_OK;
}
return res;
}
//-------------------------------------------------------------------------
//
// Get this button label
//
//-------------------------------------------------------------------------
NS_METHOD nsLabel::GetLabel(nsString& aBuffer)
{
nsresult res = NS_ERROR_FAILURE;
PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsLabel:GetLabel\n"));
aBuffer.SetLength(0);
if( mWidget )
{
PtArg_t arg;
char *label;
PtSetArg( &arg, Pt_ARG_TEXT_STRING, &label, 0 );
if( PtGetResources( mWidget, 1, &arg ) == 0 )
{
aBuffer.Append( label );
res = NS_OK;
}
}
return res;
}
//-------------------------------------------------------------------------
//
// paint message. Don't send the paint out
//
//-------------------------------------------------------------------------
PRBool nsLabel::OnMove(PRInt32, PRInt32)
{
return PR_FALSE;
}
PRBool nsLabel::OnPaint(nsPaintEvent &aEvent)
{
//printf("** nsLabel::OnPaint **\n");
return PR_FALSE;
}
PRBool nsLabel::OnResize(nsSizeEvent &aEvent)
{
return PR_FALSE;
}

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

@ -55,7 +55,6 @@ NS_IMPL_ISUPPORTS2(nsSound, nsISound, nsIStreamLoaderObserver)
////////////////////////////////////////////////////////////////////////
nsSound::nsSound()
{
NS_INIT_ISUPPORTS();
mInited = PR_FALSE;
}

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

@ -1,167 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsTextWidget.h"
#include "nsToolkit.h"
#include "nsColor.h"
#include "nsGUIEvent.h"
#include "nsString.h"
#include "nsILookAndFeel.h"
#include "nsWidgetsCID.h"
#include "nsIComponentManager.h"
#include "nsIDeviceContext.h"
#include "nsIFontMetrics.h"
#include <Pt.h>
#include "nsPhWidgetLog.h"
NS_IMPL_ADDREF(nsTextWidget)
NS_IMPL_RELEASE(nsTextWidget)
//-------------------------------------------------------------------------
//
// nsTextWidget constructor
//
//-------------------------------------------------------------------------
nsTextWidget::nsTextWidget() : nsTextHelper()
{
NS_INIT_ISUPPORTS();
mBackground = NS_RGB(124, 124, 124);
}
//-------------------------------------------------------------------------
//
// nsTextWidget destructor
//
//-------------------------------------------------------------------------
nsTextWidget::~nsTextWidget()
{
}
//-------------------------------------------------------------------------
//
// Query interface implementation
//
//-------------------------------------------------------------------------
nsresult nsTextWidget::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
nsresult result = nsWidget::QueryInterface(aIID, aInstancePtr);
static NS_DEFINE_IID(kInsTextWidgetIID, NS_ITEXTWIDGET_IID);
if (result == NS_NOINTERFACE && aIID.Equals(kInsTextWidgetIID)) {
*aInstancePtr = (void*) ((nsITextWidget*)this);
NS_ADDREF_THIS();
result = NS_OK;
}
return result;
}
//-------------------------------------------------------------------------
//
//
//-------------------------------------------------------------------------
PRBool nsTextWidget::OnPaint()
{
return PR_FALSE;
}
PRBool nsTextWidget::OnResize(nsRect &aWindowRect)
{
return PR_FALSE;
}
NS_METHOD nsTextWidget::CreateNative( PtWidget_t* aParent )
{
nsresult res = NS_ERROR_FAILURE;
PtArg_t arg[5];
PhPoint_t pos;
PhDim_t dim;
pos.x = mBounds.x;
pos.y = mBounds.y;
dim.w = mBounds.width - 4; // Correct for border width
dim.h = mBounds.height - 4;
PtSetArg( &arg[0], Pt_ARG_POS, &pos, 0 );
PtSetArg( &arg[1], Pt_ARG_DIM, &dim, 0 );
PtSetArg( &arg[2], Pt_ARG_BORDER_WIDTH, 2, 0 );
mWidget = PtCreateWidget( PtText, aParent, 3, arg );
if( mWidget )
{
res = NS_OK;
PtAddEventHandler(mWidget, Ph_EV_KEY, RawEventHandler, this);
/* Add an Activate Callback */
PtAddCallback(mWidget, Pt_CB_ACTIVATE, handle_activate_event, this);
}
return res;
}
int nsTextWidget::RawEventHandler(PtWidget_t *aWidget, void *aData, PtCallbackInfo_t *aCbInfo )
{
nsTextWidget *me = (nsTextWidget *) aData; /* Mozilla object that created the event */
if( aCbInfo->reason == Pt_CB_RAW )
{
PhEvent_t* event = aCbInfo->event;
switch( event->type )
{
case Ph_EV_KEY:
{
PhKeyEvent_t* keyev = (PhKeyEvent_t*) PhGetData( event );
me->DispatchKeyEvent(keyev);
break;
}
default:
break;
}
}
return (Pt_CONTINUE);
}
int nsTextWidget::handle_activate_event (PtWidget_t *aWidget, void *aData, PtCallbackInfo_t *aCbinfo )
{
return (Pt_CONTINUE);
}

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

@ -55,7 +55,6 @@ NS_IMPL_ISUPPORTS1(nsToolkit,nsIToolkit)
//-------------------------------------------------------------------------
nsToolkit::nsToolkit()
{
NS_INIT_ISUPPORTS();
}

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

@ -90,9 +90,6 @@ PRBool nsWidget::sJustGotDeactivated = PR_FALSE;
nsWidget::nsWidget()
{
// XXX Shouldn't this be done in nsBaseWidget?
// NS_INIT_ISUPPORTS();
if (!sLookAndFeel) {
if (NS_OK != nsComponentManager::CreateInstance(kLookAndFeelCID,
nsnull,