Deskflow 1.22.0.197
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
MSWindowsClipboard Class Reference

Microsoft windows clipboard implementation. More...

#include <MSWindowsClipboard.h>

Inheritance diagram for MSWindowsClipboard:
Collaboration diagram for MSWindowsClipboard:

Public Member Functions

 MSWindowsClipboard (HWND window)
 MSWindowsClipboard (HWND window, IMSWindowsClipboardFacade &facade)
 ~MSWindowsClipboard () override
bool emptyUnowned ()
 Empty clipboard without ownership.
bool empty () override
 Empty clipboard.
void add (EFormat, const std::string &data) override
 Add data.
bool open (Time) const override
 Open clipboard.
void close () const override
 Close clipboard.
Time getTime () const override
 Get time.
bool has (EFormat) const override
 Check for data.
std::string get (EFormat) const override
 Get data.
void setFacade (IMSWindowsClipboardFacade &facade)
Public Member Functions inherited from IClipboard
Public Member Functions inherited from IInterface
virtual ~IInterface ()=default
 Interface destructor does nothing.

Static Public Member Functions

static bool isOwnedByDeskflow ()
 Test if clipboard is owned by deskflow.
static std::string marshall (const IClipboard *clipboard)
 Marshall clipboard data.
static void unmarshall (IClipboard *clipboard, const std::string_view &data, Time time)
 Unmarshall clipboard data.
static bool copy (IClipboard *dst, const IClipboard *src)
 Copy clipboard.
static bool copy (IClipboard *dst, const IClipboard *src, Time)
 Copy clipboard.

Additional Inherited Members

Public Types inherited from IClipboard
enum  EFormat { kText , kHTML , kBitmap , kNumFormats }
 Clipboard formats. More...
using Time = uint32_t
 Timestamp type.

Detailed Description

Microsoft windows clipboard implementation.

Constructor & Destructor Documentation

◆ MSWindowsClipboard() [1/2]

MSWindowsClipboard::MSWindowsClipboard ( HWND window)

◆ MSWindowsClipboard() [2/2]

MSWindowsClipboard::MSWindowsClipboard ( HWND window,
IMSWindowsClipboardFacade & facade )

◆ ~MSWindowsClipboard()

MSWindowsClipboard::~MSWindowsClipboard ( )
override

Member Function Documentation

◆ add()

void MSWindowsClipboard::add ( EFormat ,
const std::string & data )
overridevirtual

Add data.

Add data in the given format to the clipboard. May only be called after a successful empty().

Implements IClipboard.

◆ close()

void MSWindowsClipboard::close ( ) const
overridevirtual

Close clipboard.

Close the clipboard. close() must match a preceding successful open(). This signals that the clipboard has been filled with all the necessary data or all data has been read. It does not mean the clipboard ownership should be released (if it was taken).

Implements IClipboard.

◆ empty()

bool MSWindowsClipboard::empty ( )
overridevirtual

Empty clipboard.

Take ownership of the clipboard and clear all data from it. This must be called between a successful open() and close(). Return false if the clipboard ownership could not be taken; the clipboard should not be emptied in this case.

Implements IClipboard.

◆ emptyUnowned()

bool MSWindowsClipboard::emptyUnowned ( )

Empty clipboard without ownership.

Take ownership of the clipboard and clear all data from it. This must be called between a successful open() and close(). Return false if the clipboard ownership could not be taken; the clipboard should not be emptied in this case. Unlike empty(), isOwnedByDeskflow() will return false when emptied this way. This is useful when deskflow wants to put data on clipboard but pretend (to itself) that some other app did it. When using empty(), deskflow assumes the data came from the server and doesn't need to be sent back. emptyUnowned() makes deskflow send the data to the server.

◆ get()

std::string MSWindowsClipboard::get ( EFormat ) const
overridevirtual

Get data.

Return the data in the given format. Returns the empty string if there is no data in that format. Must be called between a successful open() and close().

Implements IClipboard.

◆ getTime()

IClipboard::Time MSWindowsClipboard::getTime ( ) const
overridevirtual

Get time.

Return the timestamp passed to the last successful open().

Implements IClipboard.

◆ has()

bool MSWindowsClipboard::has ( EFormat ) const
overridevirtual

Check for data.

Return true iff the clipboard contains data in the given format. Must be called between a successful open() and close().

Implements IClipboard.

◆ isOwnedByDeskflow()

bool MSWindowsClipboard::isOwnedByDeskflow ( )
static

Test if clipboard is owned by deskflow.

◆ open()

bool MSWindowsClipboard::open ( Time time) const
overridevirtual

Open clipboard.

Open the clipboard. Return true iff the clipboard could be opened. If open() returns true then the client must call close() at some later time; if it returns false then close() must not be called. time should be the current time or a time in the past when the open should effectively have taken place.

Implements IClipboard.

◆ setFacade()

void MSWindowsClipboard::setFacade ( IMSWindowsClipboardFacade & facade)

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