--- trunk/src/gui/widgets/tree_view_node.cpp 2011/10/25 17:07:13 51637 +++ trunk/src/gui/widgets/tree_view_node.cpp 2011/10/25 19:31:42 51638 @@ -233,6 +233,25 @@ struct ttree_view_node_implementation { +private: + + template + static W* find_at_aux( + It begin + , It end + , const tpoint& coordinate + , const bool must_be_active) + { + for(It it = begin; it != end; ++it) { + if(W* widget = it->find_at(coordinate, must_be_active)) { + return widget; + } + } + return NULL; + } + +public: + template static W* find_at( typename tconst_duplicator::type& @@ -250,13 +269,9 @@ } typedef typename tconst_duplicator::type thack; - foreach(thack& node, tree_view_node.children_) { - if(W* widget = node.find_at(coordinate, must_be_active)) { - return widget; - } - } - - return NULL; + return find_at_aux(tree_view_node.children_.begin(), + tree_view_node.children_.end(), + coordinate, must_be_active); } }; @@ -308,7 +323,10 @@ return size; } - foreach(const ttree_view_node& node, children_) { + for(boost::ptr_vector::const_iterator itor = + children_.begin (); itor != children_.end (); ++itor) { + + const ttree_view_node& node = *itor; if(node.grid_.get_visible() == twidget::INVISIBLE) { continue; @@ -339,7 +357,10 @@ size.x += (get_indention_level() - 1) * tree_view().indention_step_size_; } - foreach(const ttree_view_node& node, children_) { + for(boost::ptr_vector::const_iterator itor = + children_.begin (); itor != children_.end (); ++itor) { + + const ttree_view_node& node = *itor; if(node.grid_.get_visible() == twidget::INVISIBLE) { continue; @@ -373,7 +394,10 @@ DBG_GUI_L << LOG_HEADER << " own grid best size " << best_size << ".\n"; - foreach(const ttree_view_node& node, children_) { + for(boost::ptr_vector::const_iterator itor = + children_.begin (); itor != children_.end (); ++itor) { + + const ttree_view_node& node = *itor; if(node.grid_.get_visible() == twidget::INVISIBLE) { continue;