Do offset wxClientDC and wxPaintDC by client area origin in wxMSW

We didn't use GetClientAreaOrigin() in wxMSW, unlike in all the other
ports, meaning that for the frames with a toolbar the origin of
wxPaintDC was hidden behind the toolbar itself.

Fix this and ensure that the origin is the point just below (or to the
right of) the toolbar instead.
This commit is contained in:
Vadim Zeitlin
2024-10-28 23:43:47 +01:00
parent 6bcbcf9d09
commit 2765d8098f
2 changed files with 10 additions and 3 deletions
+5
View File
@@ -108,6 +108,11 @@ Changes in behaviour not resulting in compilation errors
platforms with RTF support. If you need to save/load plain text even for the
files with the .rtf extension, specify wxTEXT_TYPE_PLAIN explicitly.
- wxClientDC and wxPaintDC now correctly offset their origin by wxFrame
toolbar, if any. This is consistent with the behaviour of the other ports
but may require removing any compensation for not doing this before that may
be present in the application code.
Changes in behaviour which may result in build errors
-----------------------------------------------------
+5 -3
View File
@@ -188,9 +188,8 @@ void wxClientDCImpl::InitDC()
{
wxWindowDCImpl::InitDC();
// in wxUniv build we must manually do some DC adjustments usually
// performed by Windows for us
#if defined(__WXUNIVERSAL__)
// Account for the origin of the client area which is non-zero only for
// TLWs with (left or top) toolbar: we shouldn't draw over the toolbar.
wxPoint ptOrigin = m_window->GetClientAreaOrigin();
if ( ptOrigin.x || ptOrigin.y )
{
@@ -198,6 +197,9 @@ void wxClientDCImpl::InitDC()
SetDeviceOrigin(ptOrigin.x, ptOrigin.y);
}
// in wxUniv build we must manually do some DC adjustments usually
// performed by Windows for us
#if defined(__WXUNIVERSAL__)
// clip the DC to avoid overwriting the non client area
wxSize size = m_window->GetClientSize();
DoSetClippingRegion(0, 0, size.x, size.y);