From 6e863adaeafffd8fa5f2c6c733c22d9fc0ee17e7 Mon Sep 17 00:00:00 2001 From: "sky@google.com" Date: Tue, 4 Nov 2008 04:44:35 +0000 Subject: Adds support for models to provide addition icons to the tree. Updates the bookmarks folder tree model to return custom icons for search and recently bookmarked. BUG=674 TEST=none Review URL: http://codereview.chromium.org/9047 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4556 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/views/tree_view.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'chrome/views/tree_view.h') diff --git a/chrome/views/tree_view.h b/chrome/views/tree_view.h index a219f52..fb3f50e 100644 --- a/chrome/views/tree_view.h +++ b/chrome/views/tree_view.h @@ -72,6 +72,15 @@ class TreeModel { const std::wstring& title) { NOTREACHED(); } + + // Returns the set of icons for the nodes in the tree. You only need override + // this if you don't want to use the default folder icons. + virtual void GetIcons(std::vector* icons) {} + + // Returns the index of the icon to use for |node|. Return -1 to use the + // default icon. The index is relative to the list of icons returned from + // GetIcons. + virtual int GetIconIndex(TreeModelNode* node) { return -1; } }; // TreeViewController --------------------------------------------------------- @@ -284,6 +293,9 @@ class TreeView : public NativeControl, TreeModelObserver { // Returns the NodeDetails by HTREEITEM. NodeDetails* GetNodeDetailsByTreeItem(HTREEITEM tree_item); + // Creates the image list to use for the tree. + HIMAGELIST CreateImageList(); + // The window function installed on the treeview. static LRESULT CALLBACK TreeWndProc(HWND window, UINT message, @@ -335,6 +347,11 @@ class TreeView : public NativeControl, TreeModelObserver { bool drag_enabled_; + // Did the model return a non-empty set of icons from GetIcons? + bool has_custom_icons_; + + HIMAGELIST image_list_; + DISALLOW_COPY_AND_ASSIGN(TreeView); }; -- cgit v1.1