Merge branch 'aui-repaint'

Fix some wxAUI repaint problems and switch to using live resize
everywhere by default.

See #24166.
This commit is contained in:
Vadim Zeitlin 2024-01-10 18:43:24 +01:00
commit afc635f845
19 changed files with 174 additions and 81 deletions

View file

@ -45,12 +45,14 @@ enum wxAuiManagerOption
wxAUI_MGR_NO_VENETIAN_BLINDS_FADE = 1 << 7,
/// When a docked pane is resized, its content is refreshed in live (instead of moving
/// the border alone and refreshing the content at the end).
/// Since wxWidgets 3.3.0 this flag is included in the default flags.
wxAUI_MGR_LIVE_RESIZE = 1 << 8,
/// Default behaviour.
wxAUI_MGR_DEFAULT = wxAUI_MGR_ALLOW_FLOATING |
wxAUI_MGR_TRANSPARENT_HINT |
wxAUI_MGR_HINT_FADE |
wxAUI_MGR_NO_VENETIAN_BLINDS_FADE
wxAUI_MGR_NO_VENETIAN_BLINDS_FADE |
wxAUI_MGR_LIVE_RESIZE
};
/**
@ -144,7 +146,11 @@ enum wxAuiManagerOption
docking hint immediately.
@style{wxAUI_MGR_LIVE_RESIZE}
When a docked pane is resized, its content is refreshed in live (instead of moving
the border alone and refreshing the content at the end).
the border alone and refreshing the content at the end). Note that
this flag is included in wxAUI_MGR_DEFAULT and so needs to be
explicitly turned off if you don't need. Also note that it is
always enabled in wxGTK3 and wxOSX ports as non-live resizing is not
implemented in them.
@style{wxAUI_MGR_DEFAULT}
Default behaviour, combines: wxAUI_MGR_ALLOW_FLOATING | wxAUI_MGR_TRANSPARENT_HINT |
wxAUI_MGR_HINT_FADE | wxAUI_MGR_NO_VENETIAN_BLINDS_FADE.
@ -215,12 +221,16 @@ public:
If this function returns true, ::wxAUI_MGR_LIVE_RESIZE flag is ignored
and live resize is always used, whether it's specified or not.
Currently this is the case for wxOSX and wxGTK3 ports, as live resizing
is the only implemented method there.
Currently this is the case for wxOSX and wxGTK3 when using Wayland, as
live resizing is the only implemented method there. See
wxClientDC::CanBeUsedForDrawing() for more details.
@param window The associated window, may be null (this parameter was
added in wxWidgets 3.3.0)
@since 3.1.4
*/
static bool AlwaysUsesLiveResize();
static bool AlwaysUsesLiveResize(const wxWindow* window);
/**
This function is used by controls to calculate the drop hint rectangle.

View file

@ -63,12 +63,13 @@ public:
window from outside an EVT_PAINT() handler in some ports, this does @em not
work on most of the platforms: neither wxOSX nor wxGTK with GTK 3 Wayland
backend support this at all, so drawing using wxClientDC simply doesn't
have any effect there, while wxMSW doesn't support using it for composited
windows, so wxWindow::MSWDisableComposited() must be called to allow it to
work. The only supported way of drawing on a window is via wxPaintDC. To
redraw a small part of the window, use wxWindow::RefreshRect() to
invalidate just this part and check wxWindow::GetUpdateRegion() in the
paint event handler to redraw this part only.
have any effect there. CanBeUsedForDrawing() can be used to determine
whether wxClientDC can be used for drawing in the current environment, but
it is recommended to only draw on the window using wxPaintDC, as this is
guaranteed to work everywhere. To redraw a small part of the window, use
wxWindow::RefreshRect() to invalidate just this part and check
wxWindow::GetUpdateRegion() in the paint event handler to redraw this part
only.
wxClientDC objects should normally be constructed as temporary stack
objects, i.e. don't store a wxClientDC object.
@ -88,6 +89,23 @@ public:
Constructor. Pass a pointer to the window on which you wish to paint.
*/
wxClientDC(wxWindow* window);
/**
Return true if drawing on wxClientDC actually works.
In many environments (currently this includes wxGTK when using Wayland
backend, wxMSW when using double buffering and wxOSX in all cases),
wxClientDC can be only used for obtaining information about the device
context, but not for actually drawing on it. Portable code should avoid
using wxClientDC completely, as explained in the class documentation,
but it is also possible to optionally use it only when it does work,
i.e. when this function returns @true.
@param window The window that would be used with wxClientDC.
@since 3.3.0
*/
static bool CanBeUsedForDrawing(const wxWindow* window);
};

View file

@ -142,6 +142,20 @@ public:
*/
virtual ~wxSplitterWindow();
/**
Returns true if splitter always behaves as if wxSP_LIVE_UPDATE were
specified.
This function returns true if non-live update mode is not supported and
live update is always used, even if wxSP_LIVE_UPDATE was not explicitly
specified.
@see wxClientDC::CanBeUsedForDrawing()
@since 3.3.0
*/
bool AlwaysUsesLiveUpdate() const;
/**
Creation function, for two-step construction.
See wxSplitterWindow() for details.