src/window.cpp
changeset 10184 bf4e3ff4cf16
parent 10180 a99cf854c6d0
child 10207 c291a21b304e
equal deleted inserted replaced
10183:5425d6526d6e 10184:bf4e3ff4cf16
   390 		w->window_class, w->window_number);
   390 		w->window_class, w->window_number);
   391 	return NULL;
   391 	return NULL;
   392 }
   392 }
   393 
   393 
   394 /**
   394 /**
       
   395  * Delete all children a window might have in a head-recursive manner
       
   396  */
       
   397 void Window::DeleteChildWindows() const
       
   398 {
       
   399 	Window *child = FindChildWindow(this);
       
   400 	while (child != NULL) {
       
   401 		delete child;
       
   402 		child = FindChildWindow(this);
       
   403 	}
       
   404 }
       
   405 
       
   406 /**
   395  * Remove window and all its child windows from the window stack.
   407  * Remove window and all its child windows from the window stack.
   396  */
   408  */
   397 Window::~Window()
   409 Window::~Window()
   398 {
   410 {
   399 	if (_thd.place_mode != VHM_NONE &&
   411 	if (_thd.place_mode != VHM_NONE &&
   412 	Window **wz = FindWindowZPosition(this);
   424 	Window **wz = FindWindowZPosition(this);
   413 	if (wz == NULL) return;
   425 	if (wz == NULL) return;
   414 	memmove(wz, wz + 1, (byte*)_last_z_window - (byte*)wz);
   426 	memmove(wz, wz + 1, (byte*)_last_z_window - (byte*)wz);
   415 	_last_z_window--;
   427 	_last_z_window--;
   416 
   428 
   417 	/* Delete all children a window might have in a head-recursive manner */
   429 	this->DeleteChildWindows();
   418 	Window *child = FindChildWindow(this);
       
   419 	while (child != NULL) {
       
   420 		delete child;
       
   421 		child = FindChildWindow(this);
       
   422 	}
       
   423 
   430 
   424 	if (this->viewport != NULL) DeleteWindowViewport(this);
   431 	if (this->viewport != NULL) DeleteWindowViewport(this);
   425 
   432 
   426 	this->SetDirty();
   433 	this->SetDirty();
   427 	free(this->widget);
   434 	free(this->widget);