зеркало из https://github.com/mozilla/pjs.git
Gtk version of nsClipboard.
This commit is contained in:
Родитель
3a99c257a4
Коммит
88d5b741a8
|
@ -0,0 +1,140 @@
|
||||||
|
/* -*- 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"
|
||||||
|
|
||||||
|
// XXXX #include "nsDataObj.h"
|
||||||
|
#include "nsISupportsArray.h"
|
||||||
|
#include "nsIClipboardOwner.h"
|
||||||
|
#include "nsIDataFlavor.h"
|
||||||
|
|
||||||
|
#include "nsIWidget.h"
|
||||||
|
#include "nsIComponentManager.h"
|
||||||
|
#include "nsWidgetsCID.h"
|
||||||
|
|
||||||
|
// XXXX #include "DDCOMM.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()
|
||||||
|
{
|
||||||
|
//NS_INIT_REFCNT();
|
||||||
|
mIgnoreEmptyNotification = PR_FALSE;
|
||||||
|
mWindow = nsnull;
|
||||||
|
|
||||||
|
// Create a Native window for the shell container...
|
||||||
|
//nsresult rv = nsComponentManager::CreateInstance(kWindowCID, nsnull, kIWidgetIID, (void**)&mWindow);
|
||||||
|
//mWindow->Show(PR_FALSE);
|
||||||
|
//mWindow->Resize(1,1,PR_FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// nsClipboard destructor
|
||||||
|
//
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
nsClipboard::~nsClipboard()
|
||||||
|
{
|
||||||
|
NS_IF_RELEASE(mWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
NS_IMETHODIMP nsClipboard::GetNativeClipboardData(nsITransferable * aTransferable)
|
||||||
|
{
|
||||||
|
// make sure we have a good transferable
|
||||||
|
if (nsnull == aTransferable) {
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
NS_IMETHODIMP nsClipboard::ForceDataToClipboard()
|
||||||
|
{
|
||||||
|
// make sure we have a good transferable
|
||||||
|
if (nsnull == mTransferable) {
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
/* -*- 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 nsClipboard_h__
|
||||||
|
#define nsClipboard_h__
|
||||||
|
|
||||||
|
#include "nsBaseClipboard.h"
|
||||||
|
|
||||||
|
class nsITransferable;
|
||||||
|
class nsIClipboardOwner;
|
||||||
|
class nsIWidget;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Native Gtk Clipboard wrapper
|
||||||
|
*/
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
PRBool mIgnoreEmptyNotification;
|
||||||
|
|
||||||
|
nsIClipboardOwner * mClipboardOwner;
|
||||||
|
nsITransferable * mTransferable;
|
||||||
|
nsIWidget * mWindow;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // nsClipboard_h__
|
Загрузка…
Ссылка в новой задаче