]> git.saurik.com Git - wxWidgets.git/commitdiff
return true from IsBeingDeleted() if any of the parent windows is marked for destruct...
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 12 Sep 2008 14:09:30 +0000 (14:09 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 12 Sep 2008 14:09:30 +0000 (14:09 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55570 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
include/wx/window.h
interface/wx/window.h
src/common/wincmn.cpp

index 9a8617c5d67aa10725d5b26baf65c35578f6143c..114b4b20001041725bce25034e6c797e8397ad9d 100644 (file)
@@ -385,6 +385,8 @@ All (GUI):
 - Show busy cursor in wxLaunchDefaultBrowser and add wxBROWSER_NOBUSYCURSOR.
 - Added wxFlexGridSizer::Is{Row,Col}Growable() (Marcin Wojdyr).
 - Added "enabled" and "hidden" attributes to radio box items in XRC.
+- wxWindow::IsBeingDeleted() now returns true not only if the window itself is
+  marked for destruction but also if any of its parent windows are.
 
 wxGTK:
 
index 59e9eabda4576038346ff77e0f0f312d8c6841d5..268fee782e4f6bae95c8df159c55f1d3cc294398 100644 (file)
@@ -199,7 +199,7 @@ public:
     bool DestroyChildren();
 
         // is the window being deleted?
-    bool IsBeingDeleted() const { return m_isBeingDeleted; }
+    bool IsBeingDeleted() const;
 
     // window attributes
     // -----------------
index b7b8b22875929d482cdd7e87560a0a26cf387031..37998c275f67faf3fe92a8973dec5d08c2f099ad 100644 (file)
     @library{wxcore}
     @category{FIXME}
 
-    @see @ref overview_eventhandling "Event handling overview", 
+    @see @ref overview_eventhandling "Event handling overview",
          @ref overview_windowsizing "Window sizing overview"
 */
 class wxWindow : public wxEvtHandler
@@ -136,7 +136,7 @@ public:
        Default constructor
     */
     wxWindow();
-    
+
     /**
         Constructs a window, which can be a child of a frame, dialog or any other
         non-control window.
@@ -202,7 +202,7 @@ public:
         container windows
      */
     virtual bool AcceptsFocusRecursively() const;
-    
+
     /**
         Adds a child window.  This is called automatically by window creation
         functions so should not be required by the application programmer.
@@ -439,6 +439,20 @@ public:
     */
     virtual void DestroyChildren();
 
+    /**
+        Returns true if this window is in process of being destroyed.
+
+        The top level windows are not deleted immediately but are rather
+        scheduled for later destruction to give them time to process any
+        pending messages, see Destroy() description.
+
+        This function returns @true if this window, or one of its parent
+        windows, is scheduled for destruction and can be useful to avoid
+        manipulating it as it's usually useless to do something with a window
+        which is on the point of disappearing anyhow.
+     */
+    bool IsBeingDeleted() const;
+
     /**
         Disables the window. Same as @ref Enable() Enable(@false).
 
@@ -517,7 +531,7 @@ public:
         it matches itself.
     */
     wxWindow* FindWindow(long id) const;
-    
+
 
     /**
         Find a child of this window, by name. May return @a this if
index c40aa1d746070b42912850d697c976a42a95738a..1a70ba68878bebfbdf95947b606f02ab7aa682ac 100644 (file)
@@ -379,6 +379,12 @@ wxWindowBase::~wxWindowBase()
 #endif
 }
 
+bool wxWindowBase::IsBeingDeleted() const
+{
+    return m_isBeingDeleted ||
+            (!IsTopLevel() && m_parent && m_parent->IsBeingDeleted());
+}
+
 void wxWindowBase::SendDestroyEvent()
 {
     wxWindowDestroyEvent event;