Replace wxAuiManager_HasLiveResize() hack with normal accessor

For some unknown reason a free function taking "*this" was used instead
of just an accessor. Add the latter to make this code less unusual.
This commit is contained in:
Vadim Zeitlin
2020-05-24 02:39:09 +02:00
parent 758a81bc89
commit 74bc08535b
3 changed files with 20 additions and 8 deletions

View File

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

View File

@@ -310,6 +310,20 @@ public:
wxAuiPaneInfo& GetPane(const wxString& name);
//@}
/**
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.
Using this accessor allows to verify whether live resizing is being
actually used.
@since 3.1.4
*/
bool HasLiveResize() const;
/**
HideHint() hides any docking hint that may be visible.
*/

View File

@@ -771,17 +771,14 @@ unsigned int wxAuiManager::GetFlags() const
return m_flags;
}
// Convenience function
static
bool wxAuiManager_HasLiveResize(wxAuiManager& manager)
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__)
wxUnusedVar(manager);
return true;
#else
return (manager.GetFlags() & wxAUI_MGR_LIVE_RESIZE) == wxAUI_MGR_LIVE_RESIZE;
return (GetFlags() & wxAUI_MGR_LIVE_RESIZE) == wxAUI_MGR_LIVE_RESIZE;
#endif
}
@@ -4429,13 +4426,13 @@ void wxAuiManager::OnLeftUp(wxMouseEvent& event)
{
m_frame->ReleaseMouse();
if (!wxAuiManager_HasLiveResize(*this))
if (!HasLiveResize())
{
// get rid of the hint rectangle
wxScreenDC dc;
DrawResizeHint(dc, m_actionHintRect);
}
if (m_currentDragItem != -1 && wxAuiManager_HasLiveResize(*this))
if (m_currentDragItem != -1 && HasLiveResize())
m_actionPart = & (m_uiParts.Item(m_currentDragItem));
DoEndResizeAction(event);
@@ -4539,7 +4536,7 @@ void wxAuiManager::OnMotion(wxMouseEvent& event)
else
pos.x = wxMax(0, event.m_x - m_actionOffset.x);
if (wxAuiManager_HasLiveResize(*this))
if (HasLiveResize())
{
m_frame->ReleaseMouse();
DoEndResizeAction(event);