initialize wx{Client,Paint,Window}DC with fonts/colours of its window
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54324 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -133,17 +133,23 @@ IMPLEMENT_DYNAMIC_CLASS(wxDCFactoryCleanupModule, wxModule)
|
||||
|
||||
wxDCImpl* wxNativeDCFactory::CreateWindowDC( wxWindowDC *owner, wxWindow *window )
|
||||
{
|
||||
return new wxWindowDCImpl( owner, window );
|
||||
wxDCImpl * const impl = new wxWindowDCImpl( owner, window );
|
||||
impl->InheritAttributes(window);
|
||||
return impl;
|
||||
}
|
||||
|
||||
wxDCImpl* wxNativeDCFactory::CreateClientDC( wxClientDC *owner, wxWindow *window )
|
||||
{
|
||||
return new wxClientDCImpl( owner, window );
|
||||
wxDCImpl * const impl = new wxClientDCImpl( owner, window );
|
||||
impl->InheritAttributes(window);
|
||||
return impl;
|
||||
}
|
||||
|
||||
wxDCImpl* wxNativeDCFactory::CreatePaintDC( wxPaintDC *owner, wxWindow *window )
|
||||
{
|
||||
return new wxPaintDCImpl( owner, window );
|
||||
wxDCImpl * const impl = new wxPaintDCImpl( owner, window );
|
||||
impl->InheritAttributes(window);
|
||||
return impl;
|
||||
}
|
||||
|
||||
wxDCImpl* wxNativeDCFactory::CreateMemoryDC( wxMemoryDC *owner )
|
||||
@@ -1092,6 +1098,16 @@ void wxDCImpl::DoGradientFillConcentric(const wxRect& rect,
|
||||
m_pen.SetColour(oldPenColour);
|
||||
}
|
||||
|
||||
void wxDCImpl::InheritAttributes(wxWindow *win)
|
||||
{
|
||||
wxCHECK_RET( win, "window can't be NULL" );
|
||||
|
||||
SetFont(win->GetFont());
|
||||
SetTextForeground(win->GetForegroundColour());
|
||||
SetTextBackground(win->GetBackgroundColour());
|
||||
SetBackground(wxBrush(win->GetBackgroundColour()));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxDC
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user