Streamline fetching topLevelParent.
This commit is contained in:
parent
ddb141ff08
commit
4eb51be0a2
|
@ -118,10 +118,7 @@ int EDA_3D_CONTROLLER::Main( const TOOL_EVENT& aEvent )
|
|||
if( evt->IsCancelInteractive() )
|
||||
{
|
||||
wxWindow* canvas = m_toolMgr->GetToolHolder()->GetToolCanvas();
|
||||
wxWindow* topLevelParent = canvas->GetParent();
|
||||
|
||||
while( topLevelParent && !topLevelParent->IsTopLevel() )
|
||||
topLevelParent = topLevelParent->GetParent();
|
||||
wxWindow* topLevelParent = wxGetTopLevelParent( canvas->GetParent() );
|
||||
|
||||
if( topLevelParent && dynamic_cast<DIALOG_SHIM*>( topLevelParent ) )
|
||||
{
|
||||
|
|
|
@ -200,10 +200,7 @@ COLOR_SWATCH::COLOR_SWATCH( wxWindow* aParent, wxWindowID aID, const wxPoint& aP
|
|||
|
||||
void COLOR_SWATCH::setupEvents( bool aTriggerWithSingleClick )
|
||||
{
|
||||
wxWindow* topLevelParent = GetParent();
|
||||
|
||||
while( topLevelParent && !topLevelParent->IsTopLevel() )
|
||||
topLevelParent = topLevelParent->GetParent();
|
||||
wxWindow* topLevelParent = wxGetTopLevelParent( GetParent() );
|
||||
|
||||
if( topLevelParent && dynamic_cast<DIALOG_SHIM*>( topLevelParent ) )
|
||||
{
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <wx/sizer.h>
|
||||
#include <wx/srchctrl.h>
|
||||
#include <wx/popupwin.h>
|
||||
#include "wx/app.h"
|
||||
|
||||
constexpr int RECENT_SEARCHES_MAX = 10;
|
||||
|
||||
|
@ -610,10 +611,7 @@ void LIB_TREE::showPreview( wxDataViewItem aItem )
|
|||
{
|
||||
m_hoverItem = aItem;
|
||||
|
||||
wxWindow* topLevelParent = m_parent;
|
||||
|
||||
while( topLevelParent && !topLevelParent->IsTopLevel() )
|
||||
topLevelParent = topLevelParent->GetParent();
|
||||
wxWindow* topLevelParent = wxGetTopLevelParent( m_parent );
|
||||
|
||||
m_previewWindow = new wxPopupWindow( topLevelParent );
|
||||
m_previewWindow->SetPosition( wxPoint( m_tree_ctrl->GetScreenRect().GetRight() - 10,
|
||||
|
@ -647,15 +645,8 @@ void LIB_TREE::onIdle( wxIdleEvent& aEvent )
|
|||
// The wxDataViewCtrl won't give us its mouseMoved events so we're forced to use idle
|
||||
// events to track the hover state
|
||||
|
||||
wxWindow* topLevelParent = m_parent;
|
||||
|
||||
while( topLevelParent && !topLevelParent->IsTopLevel() )
|
||||
topLevelParent = topLevelParent->GetParent();
|
||||
|
||||
wxWindow* topLevelFocus = FindFocus();
|
||||
|
||||
while( topLevelFocus && !topLevelFocus->IsTopLevel() )
|
||||
topLevelFocus = topLevelFocus->GetParent();
|
||||
wxWindow* topLevelParent = wxGetTopLevelParent( m_parent );
|
||||
wxWindow* topLevelFocus = wxGetTopLevelParent( wxWindow::FindFocus() );
|
||||
|
||||
wxPoint screenPos = wxGetMousePosition();
|
||||
wxRect screenRect = m_tree_ctrl->GetScreenRect();
|
||||
|
|
Loading…
Reference in New Issue