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