Mozilla.com

  1. MDC
  2. Main Page
  3. nsIClipboard

nsIClipboard

The nsIClipboard interface supports basic clipboard operations such as: setting, retrieving, emptying, matching and supporting clipboard data.


nsIClipboard is defined in widget/public/nsIClipboard.idl . It is scriptable and unfrozen (hasn't changed since Mozilla 1.8) .

Inherits from: nsISupports

Method overview

void setData(in nsITransferable aTransferable, in nsIClipboardOwner anOwner, in long aWhichClipboard);
void getData(in nsITransferable aTransferable, in long aWhichClipboard);
void emptyClipboard(in long aWhichClipboard);
boolean hasDataMatchingFlavors([array, size_is(aLength)] in string aFlavorList, in unsigned long aLength, in long aWhichClipboard);
boolean supportsSelectionClipboard();

Constants

Constant Value Description
kSelectionClipboard 0 Clipboard for selection.
kGlobalClipboard 1 Clipboard for global use.

Methods

setData()

This method is given a transferable, and it sets the data on the native clipboard. It results into a NS_Ok if there are no errors.

 void setData( 
   in nsITransferable aTransferable, 
   in nsIClipboardOwner anOwner,
   in long aWhichClipboard
 );
Parameters
aTransferable
The transferable.
anOwner
The owner of the transferable.
aWhichClipboard
Specifies the clipboard to which this operation applies.

getData()

This method is given a transferable, and it retrieves the clipboard data. It results into a NS_Ok, if there are no errors.

 void getData(
   in nsITransferable aTransferable, 
   in long aWhichClipboard
 );
Parameters
aTransferable
The transferable.
aWhichClipboard
Specifies the clipboard to which this operation applies.

emptyClipboard()

This method empties the clipboard and notifies the clipboard owner. It empties the "logical" clipboard. It does not clear the native clipboard. It results into a NS_OK, if it is successful.

 void emptyClipboard(
   in long aWhichClipboard
 );
Parameters
aWhichClipboard
Specifies the clipboard to which this operation applies.

hasDataMatchingFlavors()

This method provides a way to give correct UI feedback about, for instance, a paste should be allowed. It does not actually retreive the data and should be a very inexpensive call. All it does is check if there is data on the clipboard matching any of the flavors in the given list. It results into a NS_OK, if it is successful.

 boolean hasDataMatchingFlavors(
   [array, size_is(aLength)] in string aFlavorList,
   in unsigned long aLength,
   in long aWhichClipboard 
 );
Parameters
aFlavorList
An array of ASCII strings.
aLength
The length of the aFlavorList.
aWhichClipboard
Specifies the clipboard to which this operation applies.
Return value

Returns true, if data is present and it matches the specified flavor. Otherwise it returns false.

supportsSelectionClipboard()

This method allows clients to determine if the implementation supports the concept of a separate clipboard for selection. It results into a NS_OK, if it is successful.

 boolean supportsSelectionClipboard();
Parameters

None.

Return value

Returns true, if implementation supports the separate clipboard for selection. Otherwise it returns false.

Page last modified 00:31, 3 Jan 2008 by Arehman4

Files (0)