#include <camelot.h>
Public Member Functions | |
wxWindowDeletionWatcher (wxWindow *pWatchedWindow=NULL) | |
~wxWindowDeletionWatcher () | |
void | RemoveFromList () |
BOOL | HasBeenDeleted () const |
Static Public Member Functions | |
static void | RegisterWindowDeletion (wxWindow *pWindow) |
static void | DeInit () |
Private Member Functions | |
DECLARE_DYNAMIC_CLASS (wxWindowDeletionWatcher) | |
Static Private Member Functions | |
static WindowToWindowDeletionWatcher::iterator | GetHashEntry (wxWindow *pWindow) |
static BOOL | EnsureHash () |
Private Attributes | |
BOOL | m_HasBeenDeleted |
wxWindow * | m_pWatchedWindow |
wxWindowDeletionWatcher * | m_pNext |
wxWindowDeletionWatcher * | m_pPrev |
Static Private Attributes | |
static WindowToWindowDeletionWatcher * | s_UndeletedWindowHash |
Definition at line 255 of file camelot.h.
|
Definition at line 258 of file camelot.h. 00258 : m_HasBeenDeleted(FALSE), m_pWatchedWindow(pWatchedWindow), m_pNext(NULL), m_pPrev(NULL) 00259 { 00260 WindowToWindowDeletionWatcher::iterator i = GetHashEntry(m_pWatchedWindow); 00261 00262 // If there is no list, create a new hash entry, and we are done 00263 if (i == s_UndeletedWindowHash->end() || !(i->second)) 00264 { 00265 ERROR3IF(i != s_UndeletedWindowHash->end(), "wxWindowDeletionWatcher list non-empty but has NULL pointer"); 00266 (*s_UndeletedWindowHash)[m_pWatchedWindow]=this; 00267 } 00268 else 00269 { 00270 // we are going to stick it on the front of the list 00271 m_pNext = i->second; // save the current list (may be NULL). 00272 i->second = this; // stick us on the list 00273 00274 m_pPrev = NULL; 00275 m_pNext->m_pPrev=this; 00276 } 00277 if (m_pWatchedWindow->IsBeingDeleted()) 00278 RegisterWindowDeletion(m_pWatchedWindow); 00279 }
|
|
Definition at line 281 of file camelot.h. 00282 { 00283 RemoveFromList(); 00284 }
|
|
|
|
Definition at line 347 of file camelot.h. 00348 { 00349 if (s_UndeletedWindowHash) 00350 { 00351 ERROR3IF(!s_UndeletedWindowHash->empty(), "wxWindowDeletionWatcher::DeInit() found hash of watched windows was non-empty; someone leaked a wxWindowDeletionWatcher"); 00352 s_UndeletedWindowHash->clear(); 00353 delete s_UndeletedWindowHash; 00354 s_UndeletedWindowHash = NULL; 00355 } 00356 }
|
|
Definition at line 361 of file camelot.h. 00361 {if (!s_UndeletedWindowHash) s_UndeletedWindowHash = new WindowToWindowDeletionWatcher; return s_UndeletedWindowHash!=NULL;}
|
|
Definition at line 359 of file camelot.h. 00359 {EnsureHash(); return s_UndeletedWindowHash->find(pWindow);}
|
|
Definition at line 326 of file camelot.h. 00326 {return m_HasBeenDeleted;}
|
|
Definition at line 328 of file camelot.h. 00329 { 00330 WindowToWindowDeletionWatcher::iterator i = GetHashEntry(pWindow); 00331 if (i != s_UndeletedWindowHash->end()) 00332 { 00333 // OK, there's an entry there 00334 wxWindowDeletionWatcher * pWDW = i->second; // as "i" may become invalid 00335 ERROR3IF(!pWDW, "Empty list in wxWindowDeletionWatcher::RegisterWindowDeletion"); 00336 while (pWDW) 00337 { 00338 ERROR3IF(pWDW->m_pWatchedWindow != pWindow, "Window on the wrong list in wxWindowDeletionWatcher::RegisterWindowDeletion"); 00339 wxWindowDeletionWatcher * next = pWDW->m_pNext; // as removing from the list erases the next pointer 00340 pWDW->m_HasBeenDeleted = TRUE; 00341 pWDW->RemoveFromList(); // note we don't delete the WDW object 00342 pWDW = next; 00343 } 00344 } 00345 }
|
|
Definition at line 286 of file camelot.h. 00287 { 00288 if (m_HasBeenDeleted) 00289 { 00290 ERROR3IF(m_pNext || m_pPrev, "a deleted window appears to still be on the wxWindowDeletionWatcher list"); 00291 return; // it's not on a list anyway 00292 } 00293 00294 BOOL Empty = TRUE; 00295 if (m_pNext) 00296 { 00297 ERROR3IF(m_pNext->m_pPrev != this, "bad wxWindowDeletionWatcher next pointer"); 00298 m_pNext->m_pPrev = m_pPrev; 00299 Empty = FALSE; 00300 } 00301 if (m_pPrev) 00302 { 00303 ERROR3IF(m_pPrev->m_pNext != this, "bad wxWindowDeletionWatcher prev pointer"); 00304 m_pPrev->m_pNext = m_pNext; 00305 Empty = FALSE; 00306 } 00307 m_pPrev = m_pNext = NULL; // disconnect 00308 00309 if (Empty) 00310 { 00311 // Delete the hash table entry 00312 WindowToWindowDeletionWatcher::iterator i = GetHashEntry(m_pWatchedWindow); 00313 if (i->second != this) 00314 { 00315 ERROR3("wxWindowWatcher list appeared to be newly emptied but I wasn't the first item on it"); 00316 } 00317 if (i != s_UndeletedWindowHash->end()) 00318 s_UndeletedWindowHash->erase(i); 00319 else 00320 { 00321 ERROR3("Can't find wxWindowDeletionWatcher list"); 00322 } 00323 } 00324 }
|
|
|
|
|
|
|
|
|
|
|