Add wxGraphicsContext::GetWindow()

This method allows to retrieve the window this context is associated
with, if any.

Add "wxWindow*" argument to wxGraphicsContext ctor and provide the
window pointer to it when available, i.e. when creating the context from
a wxWindow directly or from wxWindowDC, which is also associated with a
window, in platform-specific code.

No real changes yet.
This commit is contained in:
Vadim Zeitlin
2018-11-06 03:17:49 +01:00
parent 81c67c3686
commit 5e53b22bd4
8 changed files with 96 additions and 45 deletions

View File

@@ -1830,7 +1830,7 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxPrinterDC&
#endif
wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxWindowDC& dc )
: wxGraphicsContext(renderer)
: wxGraphicsContext(renderer, dc.GetWindow())
{
int width, height;
dc.GetSize( &width, &height );
@@ -2244,7 +2244,7 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, cairo_t *context )
}
wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, wxWindow *window)
: wxGraphicsContext(renderer)
: wxGraphicsContext(renderer, window)
#ifdef __WXMSW__
, m_mswWindowHDC(GetHwndOf(window))
#endif