OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_BASE_MODELS_TREE_MODEL_H_ | 5 #ifndef UI_BASE_MODELS_TREE_MODEL_H_ |
6 #define UI_BASE_MODELS_TREE_MODEL_H_ | 6 #define UI_BASE_MODELS_TREE_MODEL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
11 #include "ui/base/ui_export.h" | 11 #include "ui/base/ui_base_export.h" |
12 | 12 |
13 namespace gfx { | 13 namespace gfx { |
14 class ImageSkia; | 14 class ImageSkia; |
15 } | 15 } |
16 | 16 |
17 namespace ui { | 17 namespace ui { |
18 | 18 |
19 class TreeModel; | 19 class TreeModel; |
20 | 20 |
21 // TreeModelNode -------------------------------------------------------------- | 21 // TreeModelNode -------------------------------------------------------------- |
22 | 22 |
23 // Type of class returned from the model. | 23 // Type of class returned from the model. |
24 class TreeModelNode { | 24 class TreeModelNode { |
25 public: | 25 public: |
26 // Returns the title for the node. | 26 // Returns the title for the node. |
27 virtual const base::string16& GetTitle() const = 0; | 27 virtual const base::string16& GetTitle() const = 0; |
28 | 28 |
29 protected: | 29 protected: |
30 virtual ~TreeModelNode() {} | 30 virtual ~TreeModelNode() {} |
31 }; | 31 }; |
32 | 32 |
33 // Observer for the TreeModel. Notified of significant events to the model. | 33 // Observer for the TreeModel. Notified of significant events to the model. |
34 class UI_EXPORT TreeModelObserver { | 34 class UI_BASE_EXPORT TreeModelObserver { |
35 public: | 35 public: |
36 // Notification that nodes were added to the specified parent. | 36 // Notification that nodes were added to the specified parent. |
37 virtual void TreeNodesAdded(TreeModel* model, | 37 virtual void TreeNodesAdded(TreeModel* model, |
38 TreeModelNode* parent, | 38 TreeModelNode* parent, |
39 int start, | 39 int start, |
40 int count) = 0; | 40 int count) = 0; |
41 | 41 |
42 // Notification that nodes were removed from the specified parent. | 42 // Notification that nodes were removed from the specified parent. |
43 virtual void TreeNodesRemoved(TreeModel* model, | 43 virtual void TreeNodesRemoved(TreeModel* model, |
44 TreeModelNode* parent, | 44 TreeModelNode* parent, |
45 int start, | 45 int start, |
46 int count) = 0; | 46 int count) = 0; |
47 | 47 |
48 // Notification that the contents of a node has changed. | 48 // Notification that the contents of a node has changed. |
49 virtual void TreeNodeChanged(TreeModel* model, TreeModelNode* node) = 0; | 49 virtual void TreeNodeChanged(TreeModel* model, TreeModelNode* node) = 0; |
50 | 50 |
51 protected: | 51 protected: |
52 virtual ~TreeModelObserver() {} | 52 virtual ~TreeModelObserver() {} |
53 }; | 53 }; |
54 | 54 |
55 // TreeModel ------------------------------------------------------------------ | 55 // TreeModel ------------------------------------------------------------------ |
56 | 56 |
57 // The model for TreeView. | 57 // The model for TreeView. |
58 class UI_EXPORT TreeModel { | 58 class UI_BASE_EXPORT TreeModel { |
59 public: | 59 public: |
60 // Returns the root of the tree. This may or may not be shown in the tree, | 60 // Returns the root of the tree. This may or may not be shown in the tree, |
61 // see SetRootShown for details. | 61 // see SetRootShown for details. |
62 virtual TreeModelNode* GetRoot() = 0; | 62 virtual TreeModelNode* GetRoot() = 0; |
63 | 63 |
64 // Returns the number of children in |parent|. | 64 // Returns the number of children in |parent|. |
65 virtual int GetChildCount(TreeModelNode* parent) = 0; | 65 virtual int GetChildCount(TreeModelNode* parent) = 0; |
66 | 66 |
67 // Returns the child node of |parent| at |index|. | 67 // Returns the child node of |parent| at |index|. |
68 virtual TreeModelNode* GetChild(TreeModelNode* parent, int index) = 0; | 68 virtual TreeModelNode* GetChild(TreeModelNode* parent, int index) = 0; |
(...skipping 23 matching lines...) Expand all Loading... |
92 // GetIcons. | 92 // GetIcons. |
93 virtual int GetIconIndex(TreeModelNode* node); | 93 virtual int GetIconIndex(TreeModelNode* node); |
94 | 94 |
95 protected: | 95 protected: |
96 virtual ~TreeModel() {} | 96 virtual ~TreeModel() {} |
97 }; | 97 }; |
98 | 98 |
99 } // namespace ui | 99 } // namespace ui |
100 | 100 |
101 #endif // UI_BASE_MODELS_TREE_MODEL_H_ | 101 #endif // UI_BASE_MODELS_TREE_MODEL_H_ |
OLD | NEW |