From 30f5eae6a7017c712438c1b5bed36037ecef29ca Mon Sep 17 00:00:00 2001 From: "pinkerton%netscape.com" Date: Thu, 1 Apr 1999 18:37:45 +0000 Subject: [PATCH] First Checked In. --- widget/src/mac/nsClipboard.cpp | 116 +++++++++++++++++++++++++++++++++ widget/src/mac/nsClipboard.h | 53 +++++++++++++++ 2 files changed, 169 insertions(+) create mode 100644 widget/src/mac/nsClipboard.cpp create mode 100644 widget/src/mac/nsClipboard.h diff --git a/widget/src/mac/nsClipboard.cpp b/widget/src/mac/nsClipboard.cpp new file mode 100644 index 00000000000..4b4f95dbe8d --- /dev/null +++ b/widget/src/mac/nsClipboard.cpp @@ -0,0 +1,116 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "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 "nsClipboard.h" + +#include "nsISupportsArray.h" +#include "nsIClipboardOwner.h" +#include "nsIDataFlavor.h" + +#include "nsIWidget.h" +#include "nsIComponentManager.h" +#include "nsWidgetsCID.h" + +// interface definitions +static NS_DEFINE_IID(kIDataFlavorIID, NS_IDATAFLAVOR_IID); + +static NS_DEFINE_IID(kIWidgetIID, NS_IWIDGET_IID); +static NS_DEFINE_IID(kWindowCID, NS_WINDOW_CID); + +NS_IMPL_ADDREF_INHERITED(nsClipboard, nsBaseClipboard) +NS_IMPL_RELEASE_INHERITED(nsClipboard, nsBaseClipboard) + +//------------------------------------------------------------------------- +// +// nsClipboard constructor +// +//------------------------------------------------------------------------- +nsClipboard::nsClipboard() : nsBaseClipboard() +{ + +} + +//------------------------------------------------------------------------- +// +// nsClipboard destructor +// +//------------------------------------------------------------------------- +nsClipboard::~nsClipboard() +{ +} + +/** + * @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 nsClipboard::QueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + + if (NULL == aInstancePtr) { + return NS_ERROR_NULL_POINTER; + } + + nsresult rv = NS_NOINTERFACE; + + static NS_DEFINE_IID(kIClipboard, NS_ICLIPBOARD_IID); + if (aIID.Equals(kIClipboard)) { + *aInstancePtr = (void*) ((nsIClipboard*)this); + NS_ADDREF_THIS(); + return NS_OK; + } + + return rv; +} + + +/** + * + * + */ +NS_IMETHODIMP nsClipboard::SetNativeClipboardData() +{ + mIgnoreEmptyNotification = PR_TRUE; + + // make sure we have a good transferable + if (nsnull == mTransferable) { + return NS_ERROR_FAILURE; + } + + //XXX DO THE WORK + + return NS_OK; +} + + +/** + * + * + */ +NS_IMETHODIMP nsClipboard::GetNativeClipboardData(nsITransferable * aTransferable) +{ + // make sure we have a good transferable + if (nsnull == aTransferable) { + return NS_ERROR_FAILURE; + } + + //XXX DO THE WORK + + return NS_OK; +} diff --git a/widget/src/mac/nsClipboard.h b/widget/src/mac/nsClipboard.h new file mode 100644 index 00000000000..e320d9cc189 --- /dev/null +++ b/widget/src/mac/nsClipboard.h @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.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. + */ + +// +// Mike Pinkerton +// Netscape Communications +// +// Native MacOS Clipboard Implementation +// + +#ifndef nsClipboard_h__ +#define nsClipboard_h__ + +#include "nsBaseClipboard.h" + +class nsITransferable; + + +class nsClipboard : public nsBaseClipboard +{ + +public: + nsClipboard(); + virtual ~nsClipboard(); + + //nsISupports + NS_DECL_ISUPPORTS_INHERITED + + // nsIClipboard + //NS_IMETHOD ForceDataToClipboard(); + +protected: + NS_IMETHOD SetNativeClipboardData(); + NS_IMETHOD GetNativeClipboardData(nsITransferable * aTransferable); + +}; // nsClipboard + +#endif // nsClipboard_h__