+ // make win position relative to the m_targetWindow viewing area instead of
+ // its parent
+ const wxRect
+ winRect(m_targetWindow->ScreenToClient(win->GetScreenPosition()),
+ win->GetSize());
+
+ // check if it's fully visible
+ if ( viewRect.Contains(winRect) )
+ {
+ // it is, nothing to do
+ return;
+ }
+
+ // check if we can make it fully visible: this is only possible if it's not
+ // larger than our view area
+ if ( winRect.GetWidth() > viewRect.GetWidth() ||
+ winRect.GetHeight() > viewRect.GetHeight() )
+ {
+ // we can't make it fit so avoid scrolling it at all, this is only
+ // going to be confusing and not helpful
+ return;
+ }
+
+
+ // do make the window fit inside the view area by scrolling to it