diff options
author | ian@chromium.org <ian@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-18 17:27:45 +0000 |
---|---|---|
committer | ian@chromium.org <ian@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-18 17:27:45 +0000 |
commit | 9f07e60d403013e3f17b5dd55e5031318c34d4cd (patch) | |
tree | 2a77f71eec1bfe99effe284cea5e6b127ec3e3ee /views/controls/tree/tree_view.cc | |
parent | 5d71030fd14f4481f1e574d28042c9f86731c933 (diff) | |
download | chromium_src-9f07e60d403013e3f17b5dd55e5031318c34d4cd.zip chromium_src-9f07e60d403013e3f17b5dd55e5031318c34d4cd.tar.gz chromium_src-9f07e60d403013e3f17b5dd55e5031318c34d4cd.tar.bz2 |
Add an option to tree_view for whether to show lines from the root node
to children nodes (sets TVS_LINESATROOT). Set this to false by default
(maintaining existing behaviour by default), except for cookies_view where
we set it to true.
BUG=27657
TEST=open cookies dialog, make sure the origins have a + box next to them,
and that expanding these also expands the cookies folder beneath them.
Review URL: http://codereview.chromium.org/399030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32334 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/tree/tree_view.cc')
-rw-r--r-- | views/controls/tree/tree_view.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/views/controls/tree/tree_view.cc b/views/controls/tree/tree_view.cc index f3888e6..0c2a7c6 100644 --- a/views/controls/tree/tree_view.cc +++ b/views/controls/tree/tree_view.cc @@ -26,11 +26,13 @@ namespace views { TreeView::TreeView() : tree_view_(NULL), model_(NULL), + auto_expand_children_(false), editable_(true), next_id_(0), controller_(NULL), editing_node_(NULL), root_shown_(true), + lines_at_root_(false), process_enter_(false), show_context_menu_only_when_node_selected_(true), select_on_right_mouse_down_(true), @@ -351,6 +353,8 @@ HWND TreeView::CreateNativeControl(HWND parent_container) { style |= TVS_DISABLEDRAGDROP; if (editable_) style |= TVS_EDITLABELS; + if (lines_at_root_) + style |= TVS_LINESATROOT; tree_view_ = ::CreateWindowEx(WS_EX_CLIENTEDGE | GetAdditionalExStyle(), WC_TREEVIEW, L"", @@ -415,9 +419,12 @@ LRESULT TreeView::OnNotify(int w_param, LPNMHDR l_param) { GetNodeDetailsByID(static_cast<int>(info->itemNew.lParam)); if (!details->loaded_children) { details->loaded_children = true; - for (int i = 0; i < model_->GetChildCount(details->node); ++i) + for (int i = 0; i < model_->GetChildCount(details->node); ++i) { CreateItem(details->tree_item, TVI_LAST, model_->GetChild(details->node, i)); + if (auto_expand_children_) + Expand(model_->GetChild(details->node, i)); + } } // Return FALSE to allow the item to be expanded. return FALSE; |