|
Jon Ciesla |
9880a95 |
--- wesnoth-1.8.6/src/gui/widgets/tree_view_node.cpp~ 2011-07-21 23:05:56.594879049 +0200
|
|
Jon Ciesla |
9cb8b99 |
+++ wesnoth-1.8.6/src/gui/widgets/tree_view_node.cpp 2011-07-21 23:28:07.540358742 +0200
|
|
Jon Ciesla |
9880a95 |
@@ -238,6 +238,17 @@ void ttree_view_node::clear()
|
|
Jon Ciesla |
9880a95 |
|
|
Jon Ciesla |
9880a95 |
struct ttree_view_node_implementation
|
|
Jon Ciesla |
9880a95 |
{
|
|
Jon Ciesla |
9880a95 |
+ template<class W, class It>
|
|
Jon Ciesla |
9880a95 |
+ static W* find_at_aux(It begin, It end,
|
|
Jon Ciesla |
9880a95 |
+ const tpoint& coordinate, const bool must_be_active) {
|
|
Jon Ciesla |
9880a95 |
+ for (It it = begin; it != end; ++it) {
|
|
Jon Ciesla |
9880a95 |
+ if(W* widget = it->find_at(coordinate, must_be_active)) {
|
|
Jon Ciesla |
9880a95 |
+ return widget;
|
|
Jon Ciesla |
9880a95 |
+ }
|
|
Jon Ciesla |
9880a95 |
+ }
|
|
Jon Ciesla |
9880a95 |
+ return NULL;
|
|
Jon Ciesla |
9880a95 |
+ }
|
|
Jon Ciesla |
9880a95 |
+
|
|
Jon Ciesla |
9880a95 |
template<class W>
|
|
Jon Ciesla |
9880a95 |
static W* find_at(
|
|
Jon Ciesla |
9880a95 |
typename tconst_duplicator<W, ttree_view_node>::type&
|
|
Jon Ciesla |
9880a95 |
@@ -255,13 +266,9 @@ struct ttree_view_node_implementation
|
|
Jon Ciesla |
9880a95 |
}
|
|
Jon Ciesla |
9880a95 |
|
|
Jon Ciesla |
9880a95 |
typedef typename tconst_duplicator<W, ttree_view_node>::type thack;
|
|
Jon Ciesla |
9880a95 |
- foreach(thack& node, tree_view_node.children_) {
|
|
Jon Ciesla |
9880a95 |
- if(W* widget = node.find_at(coordinate, must_be_active)) {
|
|
Jon Ciesla |
9880a95 |
- return widget;
|
|
Jon Ciesla |
9880a95 |
- }
|
|
Jon Ciesla |
9880a95 |
- }
|
|
Jon Ciesla |
9880a95 |
-
|
|
Jon Ciesla |
9880a95 |
- return NULL;
|
|
Jon Ciesla |
9880a95 |
+ return find_at_aux<W>(tree_view_node.children_.begin(),
|
|
Jon Ciesla |
9880a95 |
+ tree_view_node.children_.end(),
|
|
Jon Ciesla |
9880a95 |
+ coordinate, must_be_active);
|
|
Jon Ciesla |
9880a95 |
}
|
|
Jon Ciesla |
9880a95 |
};
|
|
Jon Ciesla |
9880a95 |
|
|
Jon Ciesla |
9880a95 |
@@ -313,7 +320,9 @@ tpoint ttree_view_node::get_current_size
|
|
Jon Ciesla |
9880a95 |
return size;
|
|
Jon Ciesla |
9880a95 |
}
|
|
Jon Ciesla |
9880a95 |
|
|
Jon Ciesla |
9880a95 |
- foreach(const ttree_view_node& node, children_) {
|
|
Jon Ciesla |
9880a95 |
+ for (boost::ptr_vector<ttree_view_node>::const_iterator it
|
|
Jon Ciesla |
9880a95 |
+ = children_.begin (); it != children_.end (); ++it) {
|
|
Jon Ciesla |
9880a95 |
+ const ttree_view_node& node = *it;
|
|
Jon Ciesla |
9880a95 |
|
|
Jon Ciesla |
9880a95 |
if(node.grid_.get_visible() == twidget::INVISIBLE) {
|
|
Jon Ciesla |
9880a95 |
continue;
|
|
Jon Ciesla |
9880a95 |
@@ -344,7 +353,9 @@ tpoint ttree_view_node::get_unfolded_siz
|
|
Jon Ciesla |
9880a95 |
size.x += (get_indention_level() - 1) * tree_view().indention_step_size_;
|
|
Jon Ciesla |
9880a95 |
}
|
|
Jon Ciesla |
9880a95 |
|
|
Jon Ciesla |
9880a95 |
- foreach(const ttree_view_node& node, children_) {
|
|
Jon Ciesla |
9880a95 |
+ for (boost::ptr_vector<ttree_view_node>::const_iterator it
|
|
Jon Ciesla |
9880a95 |
+ = children_.begin (); it != children_.end (); ++it) {
|
|
Jon Ciesla |
9880a95 |
+ const ttree_view_node& node = *it;
|
|
Jon Ciesla |
9880a95 |
|
|
Jon Ciesla |
9880a95 |
if(node.grid_.get_visible() == twidget::INVISIBLE) {
|
|
Jon Ciesla |
9880a95 |
continue;
|
|
Jon Ciesla |
9880a95 |
@@ -378,7 +389,9 @@ tpoint ttree_view_node::calculate_best_s
|
|
Jon Ciesla |
9880a95 |
|
|
Jon Ciesla |
9880a95 |
DBG_GUI_L << LOG_HEADER << " own grid best size " << best_size << ".\n";
|
|
Jon Ciesla |
9880a95 |
|
|
Jon Ciesla |
9880a95 |
- foreach(const ttree_view_node& node, children_) {
|
|
Jon Ciesla |
9880a95 |
+ for (boost::ptr_vector<ttree_view_node>::const_iterator it
|
|
Jon Ciesla |
9880a95 |
+ = children_.begin (); it != children_.end (); ++it) {
|
|
Jon Ciesla |
9880a95 |
+ const ttree_view_node& node = *it;
|
|
Jon Ciesla |
9880a95 |
|
|
Jon Ciesla |
9880a95 |
if(node.grid_.get_visible() == twidget::INVISIBLE) {
|
|
Jon Ciesla |
9880a95 |
continue;
|