public override void DestroyWidget()
        {
            removeAndDestroyAllChildWidgets();
            mWindows.Clear();

            OverlayManager om = OverlayManager.Singleton;

            //destroy menu container
            mMenuOverlay.Remove2D(mMenuContainer);
            om.DestroyOverlayElement(mMenuContainer);
            mMenuContainer = null;

            // destroy menu overlay
            om.Destroy(mMenuOverlay);
            mMenuOverlay = null;

            // destroy background overlay element
            mOverlayContainer.RemoveChild(mOverlayElement.Name);
            om.DestroyOverlayElement(mOverlayElement);
            mOverlayElement = null;

            // destroy Children container
            mOverlayContainer.RemoveChild(mChildrenContainer.Name);
            om.DestroyOverlayElement(mChildrenContainer);
            mChildrenContainer = null;

            // destroy default container
            mOverlay.Remove2D(mOverlayContainer);
            om.DestroyOverlayElement(mOverlayContainer);
            mOverlayContainer = null;

            // destroy overlay
            om.Destroy(mOverlay);

            base.DestroyWidget();
        }
        public override void DestroyWidget()
        {
            _destroyBorders();
            OverlayManager om = OverlayManager.Singleton;

            // Delete all child widgets before deleting the window widget
            removeAndDestroyAllChildWidgets();

            //// destroy background overlay element
            mOverlayContainer.RemoveChild(mOverlayElement.Name);
            om.DestroyOverlayElement(mOverlayElement);
            mOverlayElement = null;

            // destroy TitleBar container
            mChildrenContainer.RemoveChild(mTitleBarContainer.Name);
            om.DestroyOverlayElement(mTitleBarContainer);
            mTitleBarContainer = null;

            // destroy Children container
            mOverlayContainer.RemoveChild(mChildrenContainer.Name);
            om.DestroyOverlayElement(mChildrenContainer);
            mChildrenContainer = null;

            // destroy default container
            mOverlay.Remove2D(mOverlayContainer);
            om.DestroyOverlayElement(mOverlayContainer);
            mOverlayContainer = null;

            // destroy overlay
            om.Destroy(mOverlay);
//            base.DestroyWidget();

            unregisterZOrder(false);
            mParentWidget = null;

            GUIManager.Singleton.removeWidgetName(mInstanceName);
        }