- Main Page
- Packages
- Classes
- Files
- Related Pages

- Class List
- Class Hierarchy
- Class Members

# smjg.libs.sdwf.clipboard.Clipboard Class Reference

The smjg.libs.sdwf.clipboard.Clipboard class holds a lock on the Windows clipboard. More...

List of all members.

## Format Interrogation
deprecated typedef opIn_r | has
| Determines whether the clipboard contains data in the specified format.
int | formats ()
| The number of formats currently on the clipboard.
bool | opIn_r (CLIPBOARD_FORMAT f)
| Determines whether the clipboard contains data in the specified format.
CLIPBOARD_FORMAT | firstOf (CLIPBOARD_FORMAT[] f)
| Checks the clipboard for data in any of the specified formats, in order of priority.
## Public Member Functions
| this (WindowBase w)
| Locks the clipboard, enabling operations to be done on it.
| ~this ()
Copying to the Clipboard
void | reset ()
| Resets the clipboard, ready to copy new data to it.
void | opIndexAssign (ClipboardData data, CLIPBOARD_FORMAT format)
| Copies data to the clipboard in the specified format.
void | opIndexAssign (void[] data, CLIPBOARD_FORMAT format)
| Copies data to the clipboard in the specified format.
void | opIndexAssign (string data, CLIPBOARD_FORMAT format)
| Copies text data to the clipboard in the specified format.
Pasting from the Clipboard
ClipboardData | opIndex (CLIPBOARD_FORMAT format)
| Gets data from the clipboard.

## Detailed Description

The smjg.libs.sdwf.clipboard.Clipboard class holds a lock on the Windows clipboard.

This enables the application to communicate with the clipboard.

Since:
  0.3

## Constructor & Destructor Documentation

smjg.libs.sdwf.clipboard.Clipboard.this | ( | WindowBase | w | ) |

Locks the clipboard, enabling operations to be done on it.

Parameters:

  | w | the window to be associated with the clipboard.

Status:
  done

smjg.libs.sdwf.clipboard.Clipboard.~this | ( |  | ) |

## Member Function Documentation

void smjg.libs.sdwf.clipboard.Clipboard.reset | ( |  | ) |

Resets the clipboard, ready to copy new data to it.

The associated window becomes the clipboard owner.

Status:
  done

void smjg.libs.sdwf.clipboard.Clipboard.opIndexAssign | ( | ClipboardData | data,
|  | CLIPBOARD_FORMAT | format |
| ) |  |  |

Copies data to the clipboard in the specified format.

(Implementation of `this[format] = data`.)

Parameters:

  | data | a ClipboardData object containing the data to be copied.
  | format | identifier of the data format.

Warning:
  Unless `format` is in the range `PRIVATEFIRST` to `GDIOBJLAST`, the data belongs to the clipboard once it has been transferred. The data object will therefore become invalid when the clipboard is subsequently emptied or overwritten. Hence the application should discard the reference immediately. The .dup property of the data object can be used to create an ad-hoc copy of the data for this purpose.

Status:
  done

void smjg.libs.sdwf.clipboard.Clipboard.opIndexAssign | ( | void[] | data,
|  | CLIPBOARD_FORMAT | format |
| ) |  |  |

Copies data to the clipboard in the specified format.

(Implementation of `this[format] = data`.)

Parameters:

  | data | the data to be copied.
  | format | identifier of the data format.

Note:
  This form creates a temporary GlobalMemoryObject, so there's no need to discard the data reference or duplicate the data.

void smjg.libs.sdwf.clipboard.Clipboard.opIndexAssign | ( | string | data,
|  | CLIPBOARD_FORMAT | format |
| ) |  |  |

Copies text data to the clipboard in the specified format.

(Implementation of `this[format] = data`.)

Parameters:

  | data | the data to be copied.
  | format | identifier of the data format.

Note:
  This appears at a glance to be redundant with opIndexAssign, but in fact it null-terminates the text as required by Windows. This form creates a temporary GlobalMemoryObject, so there's no need to discard the data reference or duplicate the data.

Status:
  done

int smjg.libs.sdwf.clipboard.Clipboard.formats | ( |  | ) |

The number of formats currently on the clipboard.

bool smjg.libs.sdwf.clipboard.Clipboard.opIn_r | ( | CLIPBOARD_FORMAT | f | ) |

Determines whether the clipboard contains data in the specified format.

(Implementation of `f in this`.)

Since:
  0.58

CLIPBOARD_FORMAT smjg.libs.sdwf.clipboard.Clipboard.firstOf | ( | CLIPBOARD_FORMAT[] | f | ) |

Checks the clipboard for data in any of the specified formats, in order of priority.

Parameters:

  | f | a list of acceptable formats, with the most preferred format first.

Returns:
  the first of the listed formats to be present on the clipboard.

Return values:

  | CLIPBOARD_FORMAT.EMPTY | if the clipboard is empty.
  | CLIPBOARD_FORMAT.INCOMPATIBLE | if the clipboard contains data, but not in any of the requested formats.

ClipboardData smjg.libs.sdwf.clipboard.Clipboard.opIndex | ( | CLIPBOARD_FORMAT | format | ) |

Gets data from the clipboard.

(Implementation of `this[format]`.)

Parameters:

  | format | the format in which data is to be retrieved.

Returns:
  the pasted data. This is a GlobalMemoryObject except for formats `BITMAP` and `PALETTE`, in which case it is a Bitmap or Palette object.

Warning:
  Unless `format` is in the range `PRIVATEFIRST` to `GDIOBJLAST`, the data continues to belong to the clipboard after it has been transferred. The data object will therefore become invalid when the clipboard is subsequently overwritten. Hence the application should immediately make its own copy of the pasted data. The .dup property of the returned object can be used to create this copy, or alternatively the data itself from a GlobalMemoryObject can be duplicated or inserted as required.

Status:
  done

## Member Data Documentation

deprecated typedef opIn_r smjg.libs.sdwf.clipboard.Clipboard.has

Determines whether the clipboard contains data in the specified format.

Deprecated:
  Superseded by opIn_r.

The documentation for this class was generated from the following file:

- clipboard.d