Qt 4.8
Classes | Macros | Typedefs | Functions | Variables
qclipboard_win.cpp File Reference
#include "qclipboard.h"
#include "qapplication.h"
#include "qapplication_p.h"
#include "qeventloop.h"
#include "qwidget.h"
#include "qevent.h"
#include "qmime.h"
#include "qt_windows.h"
#include "qdnd_p.h"
#include <private/qwidget_p.h>
#include <private/qsystemlibrary_p.h>
#include "qguifunctions_wince.h"

Go to the source code of this file.

Classes

class  QClipboardData
 
class  QClipboardWatcher
 

Macros

#define OleFlushClipboard   QtCeFlushClipboard
 
#define OleGetClipboard   QtCeGetClipboard
 
#define OleSetClipboard   QtCeSetClipboard
 

Typedefs

typedef BOOL(WINAPI * PtrIsHungAppWindow) (HWND)
 

Functions

static void cleanupClipboardData ()
 
static QClipboardDataclipboardData ()
 
static bool isProcessBeingDebugged (HWND)
 
void QtCeFlushClipboard ()
 
HRESULT QtCeGetClipboard (IDataObject **obj)
 
HRESULT QtCeSetClipboard (IDataObject *obj)
 

Variables

static QClipboardDataptrClipboardData = 0
 
static PtrIsHungAppWindow ptrIsHungAppWindow = 0
 

Macro Definition Documentation

◆ OleFlushClipboard

#define OleFlushClipboard   QtCeFlushClipboard

Definition at line 70 of file qclipboard_win.cpp.

Referenced by isProcessBeingDebugged().

◆ OleGetClipboard

#define OleGetClipboard   QtCeGetClipboard

◆ OleSetClipboard

#define OleSetClipboard   QtCeSetClipboard

Definition at line 69 of file qclipboard_win.cpp.

Referenced by QClipboard::~QClipboard().

Typedef Documentation

◆ PtrIsHungAppWindow

typedef BOOL(WINAPI * PtrIsHungAppWindow) (HWND)

Definition at line 74 of file qclipboard_win.cpp.

Function Documentation

◆ cleanupClipboardData()

static void cleanupClipboardData ( )
static

Definition at line 190 of file qclipboard_win.cpp.

Referenced by QClipboard::~QClipboard().

191 {
192  delete ptrClipboardData;
193  ptrClipboardData = 0;
194 }
static QClipboardData * ptrClipboardData

◆ clipboardData()

static QClipboardData* clipboardData ( )
static

Definition at line 179 of file qclipboard_win.cpp.

Referenced by isProcessBeingDebugged(), and QClipboard::~QClipboard().

180 {
181  if (ptrClipboardData == 0) {
183  // this needs to be done here to avoid recursion
186  }
187  return ptrClipboardData;
188 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QWidget * clipBoardViewer
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
#define SetClipboardViewer(a)
WId internalWinId() const
Returns the window system identifier of the widget, or 0 if the widget is not created yet...
Definition: qwidget.h:244
static QClipboardData * ptrClipboardData

◆ isProcessBeingDebugged()

static bool isProcessBeingDebugged ( HWND  )
static

Definition at line 318 of file qclipboard_win.cpp.

Referenced by QClipboard::~QClipboard().

318 { return false; }

◆ QtCeFlushClipboard()

void QtCeFlushClipboard ( )

Definition at line 249 of file qclipboard_win.cpp.

249 { }

◆ QtCeGetClipboard()

HRESULT QtCeGetClipboard ( IDataObject **  obj)

Definition at line 197 of file qclipboard_win.cpp.

198 {
200  if (!OpenClipboard(owner))
201  return !S_OK;
202 
203  if (!IsClipboardFormatAvailable(CF_TEXT) && !IsClipboardFormatAvailable(CF_UNICODETEXT))
204  return !S_OK;
205 
206  HANDLE clipData = GetClipboardData(CF_TEXT);
207  QString clipText;
208  if (clipData == 0) {
209  clipData = GetClipboardData(CF_UNICODETEXT);
210  if (clipData != 0)
211  clipText = QString::fromWCharArray((wchar_t *)clipData);
212  } else {
213  clipText = QString::fromLatin1((const char*)clipData);
214  }
215 
216  QMimeData *mimeData = new QMimeData();
217  mimeData->setText(clipText);
218  QOleDataObject* data = new QOleDataObject(mimeData);
219  *obj = data;
220  CloseClipboard();
221  return S_OK;
222 }
static QString fromWCharArray(const wchar_t *, int size=-1)
Returns a copy of the string, where the encoding of string depends on the size of wchar...
Definition: qstring.cpp:1019
The QString class provides a Unicode character string.
Definition: qstring.h:83
static QWidget * owner
QWidget * clipBoardViewer
static const char * data(const QByteArray &arr)
void * HANDLE
Definition: qnamespace.h:1671
The QMimeData class provides a container for data that records information about its MIME type...
Definition: qmimedata.h:57
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
WId internalWinId() const
Returns the window system identifier of the widget, or 0 if the widget is not created yet...
Definition: qwidget.h:244
void setText(const QString &text)
Sets text as the plain text (MIME type text/plain) used to represent the data.
Definition: qmimedata.cpp:377
static QClipboardData * ptrClipboardData

◆ QtCeSetClipboard()

HRESULT QtCeSetClipboard ( IDataObject *  obj)

Definition at line 224 of file qclipboard_win.cpp.

225 {
227  if (!OpenClipboard(owner))
228  return !S_OK;
229 
230  bool result = false;
231  if (obj == 0) {
232  result = true;
233  EmptyClipboard();
234  CloseClipboard();
235  } else {
236  QOleDataObject* qobj = static_cast<QOleDataObject*>(obj);
237 
238  const QMimeData* data = qobj->mimeData();
239  if (data->hasText()) {
240  EmptyClipboard();
241  result = SetClipboardData(CF_UNICODETEXT, wcsdup(reinterpret_cast<const wchar_t *> (data->text().utf16()))) != NULL;
242  CloseClipboard();
243  result = true;
244  }
245  }
246  return result ? S_OK : !S_OK;
247 }
static QWidget * owner
QWidget * clipBoardViewer
QString text() const
Returns a plain text (MIME type text/plain) representation of the data.
Definition: qmimedata.cpp:364
static const char * data(const QByteArray &arr)
The QMimeData class provides a container for data that records information about its MIME type...
Definition: qmimedata.h:57
const QMimeData * mimeData() const
Definition: qdnd_win.cpp:94
bool hasText() const
Returns true if the object can return plain text (MIME type text/plain); otherwise returns false...
Definition: qmimedata.cpp:389
WId internalWinId() const
Returns the window system identifier of the widget, or 0 if the widget is not created yet...
Definition: qwidget.h:244
static QClipboardData * ptrClipboardData
const ushort * utf16() const
Returns the QString as a &#39;\0\&#39;-terminated array of unsigned shorts.
Definition: qstring.cpp:5290

Variable Documentation

◆ ptrClipboardData

QClipboardData* ptrClipboardData = 0
static

Definition at line 177 of file qclipboard_win.cpp.

Referenced by cleanupClipboardData(), and clipboardData().

◆ ptrIsHungAppWindow

PtrIsHungAppWindow ptrIsHungAppWindow = 0
static

Definition at line 76 of file qclipboard_win.cpp.

Referenced by isProcessBeingDebugged().