]> git.saurik.com Git - wxWidgets.git/commitdiff
Use IsDescendant() in wxTopLevelWindow::IsActive() implementation.
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 27 Mar 2012 11:58:05 +0000 (11:58 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 27 Mar 2012 11:58:05 +0000 (11:58 +0000)
Avoid wxGetTopLevelParent() which doesn't work for the strange TLWs which
override IsTopLevel() to return false, as wxMDIChildFrame does in wxMSW.
Using IsDescendant() works in any case and also is arguably more clear.

Closes #3063.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71025 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/toplevel.h

index 0e46dfc3e4e35732e2e9a94f0d393046c15ace20..9f0c365d40a65bc8c8c89f473b2b95a9963c7d80 100644 (file)
@@ -224,7 +224,9 @@ public:
     virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO);
 
     // Is this the active frame (highlighted in the taskbar)?
     virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO);
 
     // Is this the active frame (highlighted in the taskbar)?
-    virtual bool IsActive() { return wxGetTopLevelParent(FindFocus()) == this; }
+    //
+    // A TLW is active only if it contains the currently focused window.
+    virtual bool IsActive() { return IsDescendant(FindFocus()); }
 
     // this function may be overridden to return false to allow closing the
     // application even when this top level window is still open
 
     // this function may be overridden to return false to allow closing the
     // application even when this top level window is still open