diff options
Diffstat (limited to 'views')
-rw-r--r-- | views/controls/tree/tree_view.cc | 38 | ||||
-rw-r--r-- | views/controls/tree/tree_view.h | 6 |
2 files changed, 3 insertions, 41 deletions
diff --git a/views/controls/tree/tree_view.cc b/views/controls/tree/tree_view.cc index e47eda8..8657695 100644 --- a/views/controls/tree/tree_view.cc +++ b/views/controls/tree/tree_view.cc @@ -291,44 +291,6 @@ void TreeView::TreeNodesRemoved(TreeModel* model, } } -namespace { - -// Callback function used to compare two items. The first two args are the -// LPARAMs of the HTREEITEMs being compared. The last arg maps from LPARAM -// to order. This is invoked from TreeNodeChildrenReordered. -int CALLBACK CompareTreeItems(LPARAM item1_lparam, - LPARAM item2_lparam, - LPARAM map_as_lparam) { - std::map<int, int>& mapping = - *reinterpret_cast<std::map<int, int>*>(map_as_lparam); - return mapping[static_cast<int>(item1_lparam)] - - mapping[static_cast<int>(item2_lparam)]; -} - -} // namespace - -void TreeView::TreeNodeChildrenReordered(TreeModel* model, - TreeModelNode* parent) { - DCHECK(parent); - if (model_->GetChildCount(parent) <= 1) - return; - - TVSORTCB sort_details; - sort_details.hParent = GetTreeItemForNodeDuringMutation(parent); - if (!sort_details.hParent) - return; - - std::map<int, int> lparam_to_order_map; - for (int i = 0; i < model_->GetChildCount(parent); ++i) { - TreeModelNode* node = model_->GetChild(parent, i); - lparam_to_order_map[GetNodeDetails(node)->id] = i; - } - - sort_details.lpfnCompare = &CompareTreeItems; - sort_details.lParam = reinterpret_cast<LPARAM>(&lparam_to_order_map); - TreeView_SortChildrenCB(tree_view_, &sort_details, 0); -} - void TreeView::TreeNodeChanged(TreeModel* model, TreeModelNode* node) { if (node_to_details_map_.find(node) == node_to_details_map_.end()) { // User hasn't navigated to this entry yet. Ignore the change. diff --git a/views/controls/tree/tree_view.h b/views/controls/tree/tree_view.h index 6d1fdac..c97149b 100644 --- a/views/controls/tree/tree_view.h +++ b/views/controls/tree/tree_view.h @@ -121,7 +121,8 @@ class TreeView : public NativeControl, TreeModelObserver { // true. void SetRootShown(bool root_visible); - // TreeModelObserver methods. Don't call these directly, instead your model + // Begin TreeModelObserver implementation. + // Don't call these directly, instead your model // should notify the observer TreeView adds to it. virtual void TreeNodesAdded(TreeModel* model, TreeModelNode* parent, @@ -131,9 +132,8 @@ class TreeView : public NativeControl, TreeModelObserver { TreeModelNode* parent, int start, int count); - virtual void TreeNodeChildrenReordered(TreeModel* model, - TreeModelNode* parent); virtual void TreeNodeChanged(TreeModel* model, TreeModelNode* node); + // End TreeModelObserver implementation. // Sets the controller, which may be null. TreeView does not take ownership // of the controller. |