From 8e72f2cd1827c88ce2b153abeb0e0a3e31b12da0 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sat, 28 Jul 2012 19:31:18 +0000 Subject: [PATCH] wxDC::GetHandle support for wxGTK git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72226 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/gtk/dc.h | 3 ++- include/wx/gtk/dcmemory.h | 3 ++- include/wx/gtk/print.h | 3 ++- src/gtk/dcmemory.cpp | 5 +++++ src/gtk/print.cpp | 5 +++++ 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/include/wx/gtk/dc.h b/include/wx/gtk/dc.h index aa97ecb326..3ea33224c2 100644 --- a/include/wx/gtk/dc.h +++ b/include/wx/gtk/dc.h @@ -136,7 +136,8 @@ public: virtual void EndPage() { } virtual GdkWindow* GetGDKWindow() const { return NULL; } - + virtual void* GetHandle() const { return GetGDKWindow(); } + // base class pure virtuals implemented here virtual void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height); virtual void DoGetSizeMM(int* width, int* height) const; diff --git a/include/wx/gtk/dcmemory.h b/include/wx/gtk/dcmemory.h index 9a387dc697..576c5c53af 100644 --- a/include/wx/gtk/dcmemory.h +++ b/include/wx/gtk/dcmemory.h @@ -39,7 +39,8 @@ public: // overridden from wxDCImpl virtual void DoGetSize( int *width, int *height ) const; virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const; - + virtual void* GetHandle() const; + // overridden for wxMemoryDC Impl virtual void DoSelect(const wxBitmap& bitmap); diff --git a/include/wx/gtk/print.h b/include/wx/gtk/print.h index 0c918ee168..c0110a9678 100644 --- a/include/wx/gtk/print.h +++ b/include/wx/gtk/print.h @@ -227,7 +227,8 @@ public: bool IsOk() const; virtual void* GetCairoContext() const; - + virtual void* GetHandle() const; + bool CanDrawBitmap() const { return true; } void Clear(); void SetFont( const wxFont& font ); diff --git a/src/gtk/dcmemory.cpp b/src/gtk/dcmemory.cpp index 4771dfff8e..1933d5000b 100644 --- a/src/gtk/dcmemory.cpp +++ b/src/gtk/dcmemory.cpp @@ -164,3 +164,8 @@ wxBitmap& wxMemoryDCImpl::GetSelectedBitmap() return m_selected; } +void* wxMemoryDCImpl::GetHandle() const +{ + const wxBitmap& bmp = GetSelectedBitmap(); + return bmp.GetPixmap(); +} diff --git a/src/gtk/print.cpp b/src/gtk/print.cpp index 6ead615168..7ef941c862 100644 --- a/src/gtk/print.cpp +++ b/src/gtk/print.cpp @@ -1216,6 +1216,11 @@ void* wxGtkPrinterDCImpl::GetCairoContext() const return (void*) cairo_reference( m_cairo ); } +void* wxGtkPrinterDCImpl::GetHandle() const +{ + return GetCairoContext(); +} + bool wxGtkPrinterDCImpl::DoFloodFill(wxCoord WXUNUSED(x1), wxCoord WXUNUSED(y1), const wxColour& WXUNUSED(col), -- 2.45.2