Add wxSplitterWindow::AlwaysUsesLiveUpdate()

This is similar to wxAuiManager::AlwaysUsesLiveResize() and does the
same thing, i.e. returns true if live update is always used, whether
wxSP_LIVE_UPDATE is enabled or not.

Use the new function in the sample to disable the menu item in the
environments where it doesn't do anything, as it was confusing to have
it under e.g. Wayland.
This commit is contained in:
Vadim Zeitlin 2023-12-26 18:51:42 +01:00
parent 298fef23ad
commit 1d328aa4e1
4 changed files with 30 additions and 5 deletions

View file

@ -254,7 +254,7 @@ MyFrame::MyFrame()
"Toggle sash invisibility");
splitMenu->AppendSeparator();
splitMenu->AppendCheckItem(SPLIT_LIVE,
auto itemLive = splitMenu->AppendCheckItem(SPLIT_LIVE,
"&Live update\tCtrl-L",
"Toggle live update mode");
splitMenu->AppendCheckItem(SPLIT_BORDER,
@ -306,6 +306,12 @@ MyFrame::MyFrame()
menuBar->Check(SPLIT_LIVE, true);
m_splitter = new MySplitterWindow(this);
if ( m_splitter->AlwaysUsesLiveUpdate() )
{
// Only live update mode is supported, so this menu item can't be used.
itemLive->Enable(false);
}
// If you use non-zero gravity you must initialize the splitter with its
// correct initial size, otherwise it will change the sash position by a
// huge amount when it's resized from its initial default size to its real