added wxDC::CopyAttributes() and use it in wxBufferedDC to ensure that wxAutoBufferedPaintDC font is correctly initialized from the window font, as it already happens with wxPaintDC that it mimics
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60846 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -341,6 +341,7 @@ All (GUI):
|
|||||||
- Added wxMouseEventsManager.
|
- Added wxMouseEventsManager.
|
||||||
- Building OpenGL library is now enabled by default.
|
- Building OpenGL library is now enabled by default.
|
||||||
- Improve wxTreeCtrl::ScrollTo() in generic version (Raanan Barzel).
|
- Improve wxTreeCtrl::ScrollTo() in generic version (Raanan Barzel).
|
||||||
|
- Added wxDC::CopyAttributes() and use it in wxBufferedDC.
|
||||||
|
|
||||||
MSW:
|
MSW:
|
||||||
|
|
||||||
|
@@ -702,6 +702,9 @@ private:
|
|||||||
class WXDLLIMPEXP_CORE wxDC : public wxObject
|
class WXDLLIMPEXP_CORE wxDC : public wxObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
// copy attributes (font, colours and writing direction) from another DC
|
||||||
|
void CopyAttributes(const wxDC& dc);
|
||||||
|
|
||||||
virtual ~wxDC() { delete m_pimpl; }
|
virtual ~wxDC() { delete m_pimpl; }
|
||||||
|
|
||||||
wxDCImpl *GetImpl()
|
wxDCImpl *GetImpl()
|
||||||
|
@@ -119,7 +119,7 @@ private:
|
|||||||
|
|
||||||
// inherit the same layout direction as the original DC
|
// inherit the same layout direction as the original DC
|
||||||
if ( dc && dc->IsOk() )
|
if ( dc && dc->IsOk() )
|
||||||
SetLayoutDirection(dc->GetLayoutDirection());
|
CopyAttributes(*dc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check that the bitmap is valid and use it
|
// check that the bitmap is valid and use it
|
||||||
|
@@ -1122,6 +1122,19 @@ public:
|
|||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Copy attributes from another DC.
|
||||||
|
|
||||||
|
The copied attributes currently are:
|
||||||
|
- Font
|
||||||
|
- Text foreground and background colours
|
||||||
|
- Background brush
|
||||||
|
- Layout direction
|
||||||
|
|
||||||
|
@param dc
|
||||||
|
A valid (i.e. its IsOk() must return @true) source device context.
|
||||||
|
*/
|
||||||
|
void CopyAttributes(const wxDC& dc);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the depth (number of bits/pixel) of this DC.
|
Returns the depth (number of bits/pixel) of this DC.
|
||||||
|
@@ -1115,7 +1115,8 @@ void wxDCImpl::InheritAttributes(wxWindow *win)
|
|||||||
SetFont(win->GetFont());
|
SetFont(win->GetFont());
|
||||||
SetTextForeground(win->GetForegroundColour());
|
SetTextForeground(win->GetForegroundColour());
|
||||||
SetTextBackground(win->GetBackgroundColour());
|
SetTextBackground(win->GetBackgroundColour());
|
||||||
SetBackground(wxBrush(win->GetBackgroundColour()));
|
SetBackground(win->GetBackgroundColour());
|
||||||
|
SetLayoutDirection(win->GetLayoutDirection());
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -1124,6 +1125,15 @@ void wxDCImpl::InheritAttributes(wxWindow *win)
|
|||||||
|
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
|
IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
|
||||||
|
|
||||||
|
void wxDC::CopyAttributes(const wxDC& dc)
|
||||||
|
{
|
||||||
|
SetFont(dc.GetFont());
|
||||||
|
SetTextForeground(dc.GetTextForeground());
|
||||||
|
SetTextBackground(dc.GetTextBackground());
|
||||||
|
SetBackground(dc.GetBackground());
|
||||||
|
SetLayoutDirection(dc.GetLayoutDirection());
|
||||||
|
}
|
||||||
|
|
||||||
void wxDC::DrawLabel(const wxString& text,
|
void wxDC::DrawLabel(const wxString& text,
|
||||||
const wxBitmap& bitmap,
|
const wxBitmap& bitmap,
|
||||||
const wxRect& rect,
|
const wxRect& rect,
|
||||||
|
Reference in New Issue
Block a user