]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/clipbrd.cpp
A few resize bugs removed
[wxWidgets.git] / src / msw / clipbrd.cpp
index 4ea1d858757c6c20c4c5c0e0df22fa6dc7fd7e17..efca97a0bb649b5498ee61edc3e3765e169c2a86 100644 (file)
@@ -100,8 +100,8 @@ bool wxSetClipboardData(wxDataFormat dataFormat, wxObject *obj, int width, int h
     {
       wxBitmap *wxBM = (wxBitmap *)obj;
 
-      HDC hdcMem = CreateCompatibleDC(NULL);
-      HDC hdcSrc = CreateCompatibleDC(NULL);
+      HDC hdcMem = CreateCompatibleDC((HDC) NULL);
+      HDC hdcSrc = CreateCompatibleDC((HDC) NULL);
       HBITMAP old = (HBITMAP) ::SelectObject(hdcSrc, (HBITMAP) wxBM->GetHBITMAP());
       HBITMAP hBitmap = CreateCompatibleBitmap(hdcSrc,
                                               wxBM->GetWidth(), wxBM->GetHeight());
@@ -133,7 +133,7 @@ bool wxSetClipboardData(wxDataFormat dataFormat, wxObject *obj, int width, int h
     {
 #if wxUSE_IMAGE_LOADING_IN_MSW
       HBITMAP hBitmap=(HBITMAP) ((wxBitmap *)obj)->GetHBITMAP();
-      HANDLE hDIB=BitmapToDIB(hBitmap,NULL); // NULL==uses system palette
+      HANDLE hDIB=BitmapToDIB(hBitmap,(HPALETTE) NULL); // NULL==uses system palette
       bool success = (::SetClipboardData(CF_DIB,hDIB) != 0);
 #else
       bool success=FALSE;
@@ -220,8 +220,8 @@ wxObject *wxGetClipboardData(wxDataFormat dataFormat, long *len)
       if (!hBitmap)
         return NULL;
 
-      HDC hdcMem = CreateCompatibleDC(NULL);
-      HDC hdcSrc = CreateCompatibleDC(NULL);
+      HDC hdcMem = CreateCompatibleDC((HDC) NULL);
+      HDC hdcSrc = CreateCompatibleDC((HDC) NULL);
 
       HBITMAP old = (HBITMAP) ::SelectObject(hdcSrc, hBitmap);
       GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm);
@@ -323,16 +323,14 @@ bool wxGetClipboardFormatName(wxDataFormat dataFormat, char *formatName, int max
   return (::GetClipboardFormatName((int) dataFormat, formatName, maxCount) > 0);
 }
 
-/*
- * wxClipboard
- */
-
 //-----------------------------------------------------------------------------
 // wxClipboard
 //-----------------------------------------------------------------------------
 
 IMPLEMENT_DYNAMIC_CLASS(wxClipboard,wxObject)
 
+wxClipboard* wxTheClipboard = (wxClipboard*) NULL;
+
 wxClipboard::wxClipboard()
 {
     m_open = FALSE;
@@ -345,6 +343,16 @@ wxClipboard::~wxClipboard()
 
 void wxClipboard::Clear()
 {
+#if wxUSE_DRAG_AND_DROP
+    wxNode* node = m_data.First();
+    while (node)
+    {
+        wxDataObject* data = (wxDataObject*) node->Data();
+        delete data;
+        node = node->Next();
+    }
+    m_data.Clear();
+#endif
 }
 
 bool wxClipboard::Open()
@@ -479,4 +487,24 @@ bool wxClipboard::GetData( wxDataObject *data )
 #endif
 }
 
+//-----------------------------------------------------------------------------
+// wxClipboardModule
+//-----------------------------------------------------------------------------
+
+IMPLEMENT_DYNAMIC_CLASS(wxClipboardModule,wxModule)
+
+bool wxClipboardModule::OnInit()
+{
+    wxTheClipboard = new wxClipboard();
+  
+    return TRUE;
+}
+
+void wxClipboardModule::OnExit()
+{
+    if (wxTheClipboard) delete wxTheClipboard;
+    wxTheClipboard = (wxClipboard*) NULL;
+}
+
 #endif // wxUSE_CLIPBOARD
+