Changeset 326 for trunk/src/gui

Timestamp:
Nov 19, 2009, 2:44:19 AM (16 years ago)
Author:
Dmitry A. Kuminov
Message:

gui/kernel: QClipboard: Added watching for the clipboard data changes and support for delayed data rendering.

Location:
trunk/src/gui/kernel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gui/kernel/qclipboard_pm.cpp

    r324 r326  
    9292    if (!WinOpenClipbrd(NULLHANDLE)) {
    9393#ifndef QT_NO_DEBUG
    94         qWarning("QClipboardWatcher: WinOpenClipbrd failed with 0x%lX",
    95                  WinGetLastError(NULLHANDLE));
     94        qWarning("QClipboardWatcher:
     95                 WinGetLastError(NULLHANDLE));
    9696#endif
    9797        return;
     
    168168    ~QClipboardData();
    169169
    170     void setSource(QMimeData *s)
     170    void setSource(QMimeData *s);
     171
     172    void setAsClipboardViewer();
     173    bool ownsClipboard();
     174    void renderAllFormats(bool isDelayed);
     175
     176    static QClipboardData *instance()
    171177    {
    172         if (s == src)
    173             return;
    174         delete src;
    175         src = s;
    176     }
    177 
    178     QMimeData *source()
     178        if (instancePtr == 0) {
     179            instancePtr = new QClipboardData;
     180        }
     181        Q_ASSERT(instancePtr);
     182        return instancePtr;
     183    }
     184
     185    static void deleteInstance()
    179186    {
    180         return src;
    181     }
    182 
     187        delete instancePtr;
     188        instancePtr = 0;
     189    }
     190
     191private:
     192    bool openClipboard();
     193    void closeClipboard();
    183194    bool setClipboard(QPMMime *converter, ULONG format, bool isDelayed);
     195
    184196
    185197    MRESULT message(ULONG msg, MPARAM mp1, MPARAM mp2);
    186198
    187 private:
    188199    QMimeData *src;
     200
     201
     202
     203
     204
     205
    189206};
    190207
    191 QClipboardData::QClipboardData() : src(0)
     208// static
     209QClipboardData *QClipboardData::instancePtr = 0;
     210
     211QClipboardData::QClipboardData()
     212    : src(0), prevClipboardViewer(NULLHANDLE)
     213    , ignore_WM_DESTROYCLIPBOARD(false)
    192214{
    193215}
     
    195217QClipboardData::~QClipboardData()
    196218{
     219
     220
     221
     222
     223
     224
     225
     226
     227
     228
     229
     230
    197231    delete src;
     232
     233
     234
     235
     236
     237
     238
     239
     240
     241
     242
     243
     244
     245
     246
     247
     248
     249
     250
     251
     252
     253