]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/dcscreen.cpp
Clean up memory if have to exit early
[wxWidgets.git] / src / msw / dcscreen.cpp
index 64c6908cfd47dccc1987b05bd96b3327b8451bf4..4a2aa9ed8b003d5a7635a6ee3726dd2eef8b19b0 100644 (file)
@@ -1,12 +1,12 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        dcscreen.cpp
+// Name:        src/msw/dcscreen.cpp
 // Purpose:     wxScreenDC class
 // Author:      Julian Smart
 // Modified by:
 // Created:     01/02/97
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart and Markus Holzem
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
 #ifndef WX_PRECOMP
    #include "wx/string.h"
    #include "wx/window.h"
-   #include "wx/msw/private.h"
 #endif
 
-#include "wx/dcscreen.h"
+#include "wx/msw/private.h"
 
+#include "wx/dcscreen.h"
 
-#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC)
-#endif
 
 // Create a DC representing the whole screen
-wxScreenDC::wxScreenDC(void)
+wxScreenDC::wxScreenDC()
 {
-  m_hDC = (WXHDC) ::GetDC((HWND) NULL);
-  m_hDCCount ++;
+    m_hDC = (WXHDC) ::GetDC((HWND) NULL);
+
+    // the background mode is only used for text background and is set in
+    // DrawText() to OPAQUE as required, otherwise always TRANSPARENT
+    ::SetBkMode( GetHdc(), TRANSPARENT );
 }
 
-wxScreenDC::~wxScreenDC(void)
+void wxScreenDC::DoGetSize(int *width, int *height) const
 {
-  SelectOldObjects(m_hDC);
-  ::ReleaseDC((HWND) NULL, (HDC) m_hDC);
-  m_hDC = 0;
-  m_hDCCount --;
+    // skip wxWindowDC version because it doesn't work without a valid m_canvas
+    // (which we don't have)
+    wxDC::DoGetSize(width, height);
 }