Added wxGraphicsContext::Create(const wxEnhMetaFileDC& dc) so that wxPrintPreview can work with wxMSW's wxGraphicsContext (closes #12028)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64297 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -57,6 +57,7 @@ class WXDLLIMPEXP_FWD_CORE wxWindowDC;
|
|||||||
class WXDLLIMPEXP_FWD_CORE wxMemoryDC;
|
class WXDLLIMPEXP_FWD_CORE wxMemoryDC;
|
||||||
#if wxUSE_PRINTING_ARCHITECTURE
|
#if wxUSE_PRINTING_ARCHITECTURE
|
||||||
class WXDLLIMPEXP_FWD_CORE wxPrinterDC;
|
class WXDLLIMPEXP_FWD_CORE wxPrinterDC;
|
||||||
|
class WXDLLIMPEXP_FWD_CORE wxEnhMetaFileDC;
|
||||||
#endif
|
#endif
|
||||||
class WXDLLIMPEXP_FWD_CORE wxGraphicsContext;
|
class WXDLLIMPEXP_FWD_CORE wxGraphicsContext;
|
||||||
class WXDLLIMPEXP_FWD_CORE wxGraphicsPath;
|
class WXDLLIMPEXP_FWD_CORE wxGraphicsPath;
|
||||||
@@ -392,7 +393,10 @@ public:
|
|||||||
static wxGraphicsContext * Create( const wxMemoryDC& dc);
|
static wxGraphicsContext * Create( const wxMemoryDC& dc);
|
||||||
#if wxUSE_PRINTING_ARCHITECTURE
|
#if wxUSE_PRINTING_ARCHITECTURE
|
||||||
static wxGraphicsContext * Create( const wxPrinterDC& dc);
|
static wxGraphicsContext * Create( const wxPrinterDC& dc);
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
static wxGraphicsContext * Create( const wxEnhMetaFileDC& dc);
|
||||||
#endif
|
#endif
|
||||||
|
#endif // wxUSE_PRINTING_ARCHITECTURE
|
||||||
|
|
||||||
static wxGraphicsContext* CreateFromNative( void * context );
|
static wxGraphicsContext* CreateFromNative( void * context );
|
||||||
|
|
||||||
@@ -710,7 +714,10 @@ public:
|
|||||||
virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc) = 0;
|
virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc) = 0;
|
||||||
#if wxUSE_PRINTING_ARCHITECTURE
|
#if wxUSE_PRINTING_ARCHITECTURE
|
||||||
virtual wxGraphicsContext * CreateContext( const wxPrinterDC& dc) = 0;
|
virtual wxGraphicsContext * CreateContext( const wxPrinterDC& dc) = 0;
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
virtual wxGraphicsContext * CreateContext( const wxEnhMetaFileDC& dc) = 0;
|
||||||
#endif
|
#endif
|
||||||
|
#endif // wxUSE_PRINTING_ARCHITECTURE
|
||||||
|
|
||||||
virtual wxGraphicsContext * CreateContextFromNativeContext( void * context ) = 0;
|
virtual wxGraphicsContext * CreateContextFromNativeContext( void * context ) = 0;
|
||||||
|
|
||||||
|
@@ -230,6 +230,12 @@ void MyApp::Draw(wxDC&dc)
|
|||||||
if (window_dc)
|
if (window_dc)
|
||||||
gc = wxGraphicsContext::Create( *window_dc );
|
gc = wxGraphicsContext::Create( *window_dc );
|
||||||
|
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
wxEnhMetaFileDC *emf_dc = wxDynamicCast( &dc, wxEnhMetaFileDC );
|
||||||
|
if (emf_dc)
|
||||||
|
gc = wxGraphicsContext::Create( *emf_dc );
|
||||||
|
#endif
|
||||||
|
|
||||||
if (gc)
|
if (gc)
|
||||||
{
|
{
|
||||||
// make a path that contains a circle and some lines, centered at 100,100
|
// make a path that contains a circle and some lines, centered at 100,100
|
||||||
|
@@ -870,8 +870,16 @@ wxGraphicsBitmap wxGraphicsContext::CreateSubBitmap( const wxGraphicsBitmap &bmp
|
|||||||
{
|
{
|
||||||
return wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(dc);
|
return wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(dc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
/* static */ wxGraphicsContext* wxGraphicsContext::Create( const wxEnhMetaFileDC& dc)
|
||||||
|
{
|
||||||
|
return wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(dc);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif // wxUSE_PRINTING_ARCHITECTURE
|
||||||
|
|
||||||
wxGraphicsContext* wxGraphicsContext::CreateFromNative( void * context )
|
wxGraphicsContext* wxGraphicsContext::CreateFromNative( void * context )
|
||||||
{
|
{
|
||||||
return wxGraphicsRenderer::GetDefaultRenderer()->CreateContextFromNativeContext(context);
|
return wxGraphicsRenderer::GetDefaultRenderer()->CreateContextFromNativeContext(context);
|
||||||
|
@@ -40,6 +40,7 @@
|
|||||||
#include "wx/private/graphics.h"
|
#include "wx/private/graphics.h"
|
||||||
#include "wx/msw/wrapgdip.h"
|
#include "wx/msw/wrapgdip.h"
|
||||||
#include "wx/msw/dc.h"
|
#include "wx/msw/dc.h"
|
||||||
|
#include "wx/msw/enhmeta.h"
|
||||||
#include "wx/dcgraph.h"
|
#include "wx/dcgraph.h"
|
||||||
|
|
||||||
#include "wx/msw/private.h" // needs to be before #include <commdlg.h>
|
#include "wx/msw/private.h" // needs to be before #include <commdlg.h>
|
||||||
@@ -1631,6 +1632,8 @@ public :
|
|||||||
|
|
||||||
virtual wxGraphicsContext * CreateContext( const wxPrinterDC& dc);
|
virtual wxGraphicsContext * CreateContext( const wxPrinterDC& dc);
|
||||||
|
|
||||||
|
virtual wxGraphicsContext * CreateContext( const wxEnhMetaFileDC& dc);
|
||||||
|
|
||||||
virtual wxGraphicsContext * CreateContextFromNativeContext( void * context );
|
virtual wxGraphicsContext * CreateContextFromNativeContext( void * context );
|
||||||
|
|
||||||
virtual wxGraphicsContext * CreateContextFromNativeWindow( void * window );
|
virtual wxGraphicsContext * CreateContextFromNativeWindow( void * window );
|
||||||
@@ -1763,6 +1766,14 @@ wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxPrinterDC& dc)
|
|||||||
return new wxGDIPlusContext(this,(HDC) msw->GetHDC(), sz.x, sz.y);
|
return new wxGDIPlusContext(this,(HDC) msw->GetHDC(), sz.x, sz.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxEnhMetaFileDC& dc)
|
||||||
|
{
|
||||||
|
ENSURE_LOADED_OR_RETURN(NULL);
|
||||||
|
wxMSWDCImpl *msw = wxDynamicCast( dc.GetImpl() , wxMSWDCImpl );
|
||||||
|
wxSize sz = dc.GetSize();
|
||||||
|
return new wxGDIPlusContext(this,(HDC) msw->GetHDC(), sz.x, sz.y);
|
||||||
|
}
|
||||||
|
|
||||||
wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxMemoryDC& dc)
|
wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxMemoryDC& dc)
|
||||||
{
|
{
|
||||||
ENSURE_LOADED_OR_RETURN(NULL);
|
ENSURE_LOADED_OR_RETURN(NULL);
|
||||||
|
Reference in New Issue
Block a user