Add wxAuiManager::AlwaysUsesLiveResize()

This allows to check if it's worth specifying wxAUI_MGR_LIVE_RESIZE or
not and allows to get rid of the corresponding menu item in the sample
if it doesn't do anything anyhow.
This commit is contained in:
Vadim Zeitlin 2020-05-25 17:59:42 +02:00
parent 4f7eb2b145
commit f6727a17a2
4 changed files with 35 additions and 7 deletions

View File

@ -412,6 +412,8 @@ public:
void SetFlags(unsigned int flags);
unsigned int GetFlags() const;
static bool AlwaysUsesLiveResize();
bool HasLiveResize() const;
void SetManagedWindow(wxWindow* managedWnd);

View File

@ -207,6 +207,19 @@ public:
const wxPoint& drop_pos);
//@}
/**
Returns true if live resize is always used on the current platform.
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 port, as live resizing is the only
implemented method there.
@since 3.1.4
*/
static bool AlwaysUsesLiveResize();
/**
This function is used by controls to calculate the drop hint rectangle.
@ -313,9 +326,9 @@ public:
/**
Returns true if windows are resized live.
Live resizing behaviour is specified by wxAUI_MGR_LIVE_RESIZE flag,
however some platforms (currently wxOSX) ignore it and always use live
resizing because this is the only implemented resize mode.
This function combines the check for AlwaysUsesLiveResize() and, for
the platforms where live resizing is optional, the check for
wxAUI_MGR_LIVE_RESIZE flag.
Using this accessor allows to verify whether live resizing is being
actually used.

View File

@ -709,7 +709,9 @@ MyFrame::MyFrame(wxWindow* parent,
options_menu->AppendCheckItem(ID_NoVenetianFade, _("Disable Venetian Blinds Hint Fade-in"));
options_menu->AppendCheckItem(ID_TransparentDrag, _("Transparent Drag"));
options_menu->AppendCheckItem(ID_AllowActivePane, _("Allow Active Pane"));
options_menu->AppendCheckItem(ID_LiveUpdate, _("Live Resize Update"));
// Only show "live resize" toggle if it's actually functional.
if ( !wxAuiManager::AlwaysUsesLiveResize() )
options_menu->AppendCheckItem(ID_LiveUpdate, _("Live Resize Update"));
options_menu->AppendSeparator();
options_menu->AppendRadioItem(ID_NoGradient, _("No Caption Gradient"));
options_menu->AppendRadioItem(ID_VerticalGradient, _("Vertical Caption Gradient"));

View File

@ -772,11 +772,22 @@ unsigned int wxAuiManager::GetFlags() const
return m_flags;
}
// With Core Graphics on Mac, it's not possible to show sash feedback,
// so we'll always use live update instead.
#if defined(__WXMAC__)
#define wxUSE_AUI_LIVE_RESIZE_ALWAYS 1
#else
#define wxUSE_AUI_LIVE_RESIZE_ALWAYS 0
#endif
/* static */ bool wxAuiManager::AlwaysUsesLiveResize()
{
return wxUSE_AUI_LIVE_RESIZE_ALWAYS;
}
bool wxAuiManager::HasLiveResize() const
{
// With Core Graphics on Mac, it's not possible to show sash feedback,
// so we'll always use live update instead.
#if defined(__WXMAC__)
#if wxUSE_AUI_LIVE_RESIZE_ALWAYS
return true;
#else
return (GetFlags() & wxAUI_MGR_LIVE_RESIZE) == wxAUI_MGR_LIVE_RESIZE;