| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef APP_TREE_MODEL_H_ | 5 #ifndef APP_TREE_MODEL_H_ |
| 6 #define APP_TREE_MODEL_H_ | 6 #define APP_TREE_MODEL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/logging.h" | |
| 12 #include "base/string16.h" | 11 #include "base/string16.h" |
| 13 | 12 |
| 14 class SkBitmap; | 13 class SkBitmap; |
| 15 | 14 |
| 16 class TreeModel; | 15 class TreeModel; |
| 17 | 16 |
| 18 // TreeModelNode -------------------------------------------------------------- | 17 // TreeModelNode -------------------------------------------------------------- |
| 19 | 18 |
| 20 // Type of class returned from the model. | 19 // Type of class returned from the model. |
| 21 class TreeModelNode { | 20 class TreeModelNode { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 virtual TreeModelNode* GetParent(TreeModelNode* node) = 0; | 70 virtual TreeModelNode* GetParent(TreeModelNode* node) = 0; |
| 72 | 71 |
| 73 // Adds an observer of the model. | 72 // Adds an observer of the model. |
| 74 virtual void AddObserver(TreeModelObserver* observer) = 0; | 73 virtual void AddObserver(TreeModelObserver* observer) = 0; |
| 75 | 74 |
| 76 // Removes an observer of the model. | 75 // Removes an observer of the model. |
| 77 virtual void RemoveObserver(TreeModelObserver* observer) = 0; | 76 virtual void RemoveObserver(TreeModelObserver* observer) = 0; |
| 78 | 77 |
| 79 // Sets the title of the specified node. | 78 // Sets the title of the specified node. |
| 80 // This is only invoked if the node is editable and the user edits a node. | 79 // This is only invoked if the node is editable and the user edits a node. |
| 81 virtual void SetTitle(TreeModelNode* node, | 80 virtual void SetTitle(TreeModelNode* node, const string16& title); |
| 82 const string16& title) { | |
| 83 NOTREACHED(); | |
| 84 } | |
| 85 | 81 |
| 86 // Returns the set of icons for the nodes in the tree. You only need override | 82 // Returns the set of icons for the nodes in the tree. You only need override |
| 87 // this if you don't want to use the default folder icons. | 83 // this if you don't want to use the default folder icons. |
| 88 virtual void GetIcons(std::vector<SkBitmap>* icons) {} | 84 virtual void GetIcons(std::vector<SkBitmap>* icons) {} |
| 89 | 85 |
| 90 // Returns the index of the icon to use for |node|. Return -1 to use the | 86 // Returns the index of the icon to use for |node|. Return -1 to use the |
| 91 // default icon. The index is relative to the list of icons returned from | 87 // default icon. The index is relative to the list of icons returned from |
| 92 // GetIcons. | 88 // GetIcons. |
| 93 virtual int GetIconIndex(TreeModelNode* node) { return -1; } | 89 virtual int GetIconIndex(TreeModelNode* node); |
| 94 | 90 |
| 95 protected: | 91 protected: |
| 96 virtual ~TreeModel() {} | 92 virtual ~TreeModel() {} |
| 97 }; | 93 }; |
| 98 | 94 |
| 99 #endif // APP_TREE_MODEL_H_ | 95 #endif // APP_TREE_MODEL_H_ |
| OLD | NEW |