From 79967399fe556f33dfc3537faf1894ce80a87dcd Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 12 May 2009 10:49:16 +0000 Subject: [PATCH] From Fajran Iman Rusadi, fixed to handling of widget indices in insert and remove methods. Merged from svn/trunk using: svn merge -r 10181:10182 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk/src/osgWidget --- src/osgWidget/WindowManager.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/osgWidget/WindowManager.cpp b/src/osgWidget/WindowManager.cpp index 2fb9f4d72..11df694dc 100644 --- a/src/osgWidget/WindowManager.cpp +++ b/src/osgWidget/WindowManager.cpp @@ -232,6 +232,11 @@ void WindowManager::childInserted(unsigned int i) { if(!window) return; + // Update Window's index + for(Iterator w = begin(); w != end(); w++) { + if(w->get()->_index >= i) w->get()->_index++; + } + _objects.push_back(window); window->_index = i; @@ -261,6 +266,12 @@ void WindowManager::childRemoved(unsigned int start, unsigned int numChildren) { window->unmanaged(this); } } + + // Update Window's index + for(Iterator w = begin(); w != end(); w++) { + if(w->get()->_index >= start) w->get()->_index -= numChildren; + } + } // This method performs intersection testing at the given XY coords, and returns true if