/////////////////////////////////////////////////////////////////////////////
// Name: dcmemory.cpp
// Purpose: wxMemoryDC class
-// Author: AUTHOR
+// Author: David Webster
// Modified by:
-// Created: 01/02/97
+// Created: 10/14/99
// RCS-ID: $Id$
-// Copyright: (c) AUTHOR
-// Licence: wxWindows licence
+// Copyright: (c) David Webster
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
-#pragma implementation "dcmemory.h"
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifndef WX_PRECOMP
+#include "wx/utils.h"
#endif
+#include "wx/os2/private.h"
+
#include "wx/dcmemory.h"
-//-----------------------------------------------------------------------------
-// wxMemoryDC
-//-----------------------------------------------------------------------------
+#if !USE_SHARED_LIBRARY
+IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxDC)
+#endif
-IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxPaintDC)
+/*
+ * Memory DC
+ *
+ */
wxMemoryDC::wxMemoryDC(void)
{
- m_ok = FALSE;
-};
+ // TODO:
+/*
+ m_hDC = (WXHDC) ::CreateCompatibleDC((HDC) NULL);
+ m_ok = (m_hDC != 0);
+ m_bOwnsDC = TRUE;
-wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
+ SetBrush(*wxWHITE_BRUSH);
+ SetPen(*wxBLACK_PEN);
+
+ // the background mode is only used for text background
+ // and is set in DrawText() to OPAQUE as required, other-
+ // wise always TRANSPARENT, RR
+ ::SetBkMode( GetHdc(), TRANSPARENT );
+*/
+}
+
+wxMemoryDC::wxMemoryDC(wxDC *old_dc)
{
- m_ok = FALSE;
-};
+ // TODO:
+/*
+ old_dc->BeginDrawing();
+
+ m_hDC = (WXHDC) ::CreateCompatibleDC((HDC) old_dc->GetHDC());
+ m_ok = (m_hDC != 0);
+
+ old_dc->EndDrawing();
+
+ SetBrush(*wxWHITE_BRUSH);
+ SetPen(*wxBLACK_PEN);
+
+ // the background mode is only used for text background
+ // and is set in DrawText() to OPAQUE as required, other-
+ // wise always TRANSPARENT, RR
+ ::SetBkMode( GetHdc(), TRANSPARENT );
+*/
+}
wxMemoryDC::~wxMemoryDC(void)
{
void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
{
- m_selected = bitmap;
- if (m_selected.Ok())
- {
- }
- else
- {
- m_ok = FALSE;
- };
+ // TODO:
};
-void wxMemoryDC::GetSize( int *width, int *height ) const
+void wxMemoryDC::DoGetSize( int *width, int *height ) const
{
- if (m_selected.Ok())
+ if (!m_selectedBitmap.Ok())
{
- if (width) (*width) = m_selected.GetWidth();
- if (height) (*height) = m_selected.GetHeight();
+ *width = 0; *height = 0;
+ return;
}
- else
- {
- if (width) (*width) = 0;
- if (height) (*height) = 0;
- };
+ *width = m_selectedBitmap.GetWidth();
+ *height = m_selectedBitmap.GetHeight();
};