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:
@@ -358,7 +358,7 @@ class wxGDIPlusContext : public wxGraphicsContext
|
||||
public:
|
||||
wxGDIPlusContext( wxGraphicsRenderer* renderer, const wxDC& dc );
|
||||
wxGDIPlusContext( wxGraphicsRenderer* renderer, HDC hdc, wxDouble width, wxDouble height );
|
||||
wxGDIPlusContext( wxGraphicsRenderer* renderer, HWND hwnd );
|
||||
wxGDIPlusContext( wxGraphicsRenderer* renderer, HWND hwnd, wxWindow* window = NULL);
|
||||
wxGDIPlusContext( wxGraphicsRenderer* renderer, Graphics* gr);
|
||||
wxGDIPlusContext(wxGraphicsRenderer* renderer);
|
||||
|
||||
@@ -1647,7 +1647,7 @@ wxGDIPlusContext::wxGDIPlusContext( wxGraphicsRenderer* renderer, HDC hdc, wxDou
|
||||
}
|
||||
|
||||
wxGDIPlusContext::wxGDIPlusContext( wxGraphicsRenderer* renderer, const wxDC& dc )
|
||||
: wxGraphicsContext(renderer)
|
||||
: wxGraphicsContext(renderer, dc.GetWindow())
|
||||
{
|
||||
wxMSWDCImpl *msw = wxDynamicCast( dc.GetImpl() , wxMSWDCImpl );
|
||||
HDC hdc = (HDC) msw->GetHDC();
|
||||
@@ -1656,8 +1656,10 @@ wxGDIPlusContext::wxGDIPlusContext( wxGraphicsRenderer* renderer, const wxDC& dc
|
||||
Init(new Graphics(hdc), sz.x, sz.y);
|
||||
}
|
||||
|
||||
wxGDIPlusContext::wxGDIPlusContext( wxGraphicsRenderer* renderer, HWND hwnd )
|
||||
: wxGraphicsContext(renderer)
|
||||
wxGDIPlusContext::wxGDIPlusContext( wxGraphicsRenderer* renderer,
|
||||
HWND hwnd,
|
||||
wxWindow* window )
|
||||
: wxGraphicsContext(renderer, window)
|
||||
{
|
||||
RECT rect = wxGetWindowRect(hwnd);
|
||||
Init(new Graphics(hwnd), rect.right - rect.left, rect.bottom - rect.top);
|
||||
@@ -2492,7 +2494,7 @@ wxGraphicsContext * wxGDIPlusRenderer::CreateContextFromNativeHDC(WXHDC dc)
|
||||
wxGraphicsContext * wxGDIPlusRenderer::CreateContext( wxWindow* window )
|
||||
{
|
||||
ENSURE_LOADED_OR_RETURN(NULL);
|
||||
return new wxGDIPlusContext(this, (HWND) window->GetHWND() );
|
||||
return new wxGDIPlusContext(this, (HWND) window->GetHWND(), window );
|
||||
}
|
||||
|
||||
// Path
|
||||
|
Reference in New Issue
Block a user