瀏覽代碼

manage things correctly

Cary Sandvig 25 年之前
父節點
當前提交
698ce93e15
共有 1 個文件被更改,包括 38 次插入12 次删除
  1. 38 12
      panda/src/gui/guiListBox.cxx

+ 38 - 12
panda/src/gui/guiListBox.cxx

@@ -76,8 +76,12 @@ void GuiListBox::visible_patching(void) {
       _arrow_top = false;
       _arrow_top = false;
       _visible[0]->unmanage();
       _visible[0]->unmanage();
       _visible[0] = *(_top_stack.begin());
       _visible[0] = *(_top_stack.begin());
-      if (_mgr != (GuiManager*)0L)
-	_visible[0]->manage(_mgr, *_eh);
+      if (_mgr != (GuiManager*)0L) {
+	if (_alt_root.is_null())
+	  _visible[0]->manage(_mgr, *_eh);
+	else
+	  _visible[0]->manage(_mgr, *_eh, _alt_root);
+      }
       _top_stack.pop_back();
       _top_stack.pop_back();
     }
     }
   } else {
   } else {
@@ -89,7 +93,10 @@ void GuiListBox::visible_patching(void) {
       _top_stack.push_back(_visible[0]);
       _top_stack.push_back(_visible[0]);
       _visible[0] = _up_arrow;
       _visible[0] = _up_arrow;
       if (_mgr != (GuiManager*)0L) {
       if (_mgr != (GuiManager*)0L) {
-	_up_arrow->manage(_mgr, *_eh);
+	if (_alt_root.is_null())
+	  _up_arrow->manage(_mgr, *_eh);
+	else
+	  _up_arrow->manage(_mgr, *_eh, _alt_root);
       }
       }
     }
     }
   }
   }
@@ -102,8 +109,12 @@ void GuiListBox::visible_patching(void) {
       int last = _n_visible-1;
       int last = _n_visible-1;
       _visible[last]->unmanage();
       _visible[last]->unmanage();
       _visible[last] = *(_bottom_stack.begin());
       _visible[last] = *(_bottom_stack.begin());
-      if (_mgr != (GuiManager*)0L)
-	_visible[last]->manage(_mgr, *_eh);
+      if (_mgr != (GuiManager*)0L) {
+	if (_alt_root.is_null())
+	  _visible[last]->manage(_mgr, *_eh);
+	else
+	  _visible[last]->manage(_mgr, *_eh, _alt_root);
+      }
       _bottom_stack.pop_back();
       _bottom_stack.pop_back();
     }
     }
   } else {
   } else {
@@ -116,7 +127,10 @@ void GuiListBox::visible_patching(void) {
       _bottom_stack.push_back(_visible[last]);
       _bottom_stack.push_back(_visible[last]);
       _visible[last] = _down_arrow;
       _visible[last] = _down_arrow;
       if (_mgr != (GuiManager*)0L) {
       if (_mgr != (GuiManager*)0L) {
-	_down_arrow->manage(_mgr, *_eh);
+	if (_alt_root.is_null())
+	  _down_arrow->manage(_mgr, *_eh);
+	else
+	  _down_arrow->manage(_mgr, *_eh, _alt_root);
       }
       }
     }
     }
   }
   }
@@ -189,8 +203,12 @@ void GuiListBox::scroll_down(void) {
     _visible[i] = _visible[i+1];
     _visible[i] = _visible[i+1];
   // then add one from the bottom stack to the bottom
   // then add one from the bottom stack to the bottom
   _visible[last] = *(_bottom_stack.rbegin());
   _visible[last] = *(_bottom_stack.rbegin());
-  if (_mgr != (GuiManager*)0L)
-    _visible[last]->manage(_mgr, *_eh);
+  if (_mgr != (GuiManager*)0L) {
+    if (_alt_root.is_null())
+      _visible[last]->manage(_mgr, *_eh);
+    else
+      _visible[last]->manage(_mgr, *_eh, _alt_root);
+  }
   // and pop it off the bottom stack
   // and pop it off the bottom stack
   _bottom_stack.pop_back();
   _bottom_stack.pop_back();
   // now patch-up any dangling items
   // now patch-up any dangling items
@@ -219,8 +237,12 @@ void GuiListBox::scroll_up(void) {
     _visible[i] = _visible[i-1];
     _visible[i] = _visible[i-1];
   // then add one from the top stack to the top
   // then add one from the top stack to the top
   _visible[first] = *(_top_stack.rbegin());
   _visible[first] = *(_top_stack.rbegin());
-  if (_mgr != (GuiManager*)0L)
-    _visible[first]->manage(_mgr, *_eh);
+  if (_mgr != (GuiManager*)0L) {
+    if (_alt_root.is_null())
+      _visible[first]->manage(_mgr, *_eh);
+    else
+      _visible[first]->manage(_mgr, *_eh, _alt_root);
+  }
   // and pop it off the top stack
   // and pop it off the top stack
   _top_stack.pop_back();
   _top_stack.pop_back();
   // now patch-up any dangling item
   // now patch-up any dangling item
@@ -237,8 +259,12 @@ void GuiListBox::add_item(GuiItem* item) {
   else {
   else {
     if (_visible.size() < _n_visible) {
     if (_visible.size() < _n_visible) {
       _visible.push_back(item);
       _visible.push_back(item);
-      if (_mgr != (GuiManager*)0L)
-	item->manage(_mgr, *_eh);
+      if (_mgr != (GuiManager*)0L) {
+	if (_alt_root.is_null())
+	  item->manage(_mgr, *_eh);
+	else
+	  item->manage(_mgr, *_eh, _alt_root);
+      }
     } else
     } else
       _bottom_stack.push_back(item);
       _bottom_stack.push_back(item);
   }
   }