Allow to retrieve the wxWindow associated with a wxBufferedPaintDC
When a wxBufferedPaintDC is created, the base classes does not initialize the m_window variable with the used wxWindow. Only the associated m_paintdc initializes this variable. Add a protected function that allows to set the wxWindow of a wxDC so GetWindow() will return the window. This fixes the font size of custom attributes in wxDataViewCtrl when the DPI changes.
This commit is contained in:
@@ -269,6 +269,8 @@ public:
|
|||||||
|
|
||||||
wxWindow* GetWindow() const { return m_window; }
|
wxWindow* GetWindow() const { return m_window; }
|
||||||
|
|
||||||
|
void SetWindow(wxWindow* w) { m_window = w; }
|
||||||
|
|
||||||
virtual bool IsOk() const { return m_ok; }
|
virtual bool IsOk() const { return m_ok; }
|
||||||
|
|
||||||
// query capabilities
|
// query capabilities
|
||||||
@@ -1364,6 +1366,9 @@ protected:
|
|||||||
|
|
||||||
wxDCImpl * const m_pimpl;
|
wxDCImpl * const m_pimpl;
|
||||||
|
|
||||||
|
void SetWindow(wxWindow* w)
|
||||||
|
{ return m_pimpl->SetWindow(w); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxDECLARE_ABSTRACT_CLASS(wxDC);
|
wxDECLARE_ABSTRACT_CLASS(wxDC);
|
||||||
wxDECLARE_NO_COPY_CLASS(wxDC);
|
wxDECLARE_NO_COPY_CLASS(wxDC);
|
||||||
|
@@ -153,6 +153,8 @@ public:
|
|||||||
wxBufferedPaintDC(wxWindow *window, wxBitmap& buffer, int style = wxBUFFER_CLIENT_AREA)
|
wxBufferedPaintDC(wxWindow *window, wxBitmap& buffer, int style = wxBUFFER_CLIENT_AREA)
|
||||||
: m_paintdc(window)
|
: m_paintdc(window)
|
||||||
{
|
{
|
||||||
|
SetWindow(window);
|
||||||
|
|
||||||
// If we're buffering the virtual window, scale the paint DC as well
|
// If we're buffering the virtual window, scale the paint DC as well
|
||||||
if (style & wxBUFFER_VIRTUAL_AREA)
|
if (style & wxBUFFER_VIRTUAL_AREA)
|
||||||
window->PrepareDC( m_paintdc );
|
window->PrepareDC( m_paintdc );
|
||||||
@@ -167,6 +169,8 @@ public:
|
|||||||
wxBufferedPaintDC(wxWindow *window, int style = wxBUFFER_CLIENT_AREA)
|
wxBufferedPaintDC(wxWindow *window, int style = wxBUFFER_CLIENT_AREA)
|
||||||
: m_paintdc(window)
|
: m_paintdc(window)
|
||||||
{
|
{
|
||||||
|
SetWindow(window);
|
||||||
|
|
||||||
// If we're using the virtual window, scale the paint DC as well
|
// If we're using the virtual window, scale the paint DC as well
|
||||||
if (style & wxBUFFER_VIRTUAL_AREA)
|
if (style & wxBUFFER_VIRTUAL_AREA)
|
||||||
window->PrepareDC( m_paintdc );
|
window->PrepareDC( m_paintdc );
|
||||||
|
Reference in New Issue
Block a user