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_TABLE_MODEL_H_ | 5 #ifndef APP_TABLE_MODEL_H_ |
6 #define APP_TABLE_MODEL_H_ | 6 #define APP_TABLE_MODEL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/logging.h" | |
13 #include "unicode/coll.h" | 12 #include "unicode/coll.h" |
14 | 13 |
15 class SkBitmap; | 14 class SkBitmap; |
16 | 15 |
17 class TableModelObserver; | 16 class TableModelObserver; |
18 | 17 |
19 // The model driving the TableView. | 18 // The model driving the TableView. |
20 class TableModel { | 19 class TableModel { |
21 public: | 20 public: |
22 // See HasGroups, get GetGroupID for details as to how this is used. | 21 // See HasGroups, get GetGroupID for details as to how this is used. |
(...skipping 14 matching lines...) Expand all Loading... |
37 | 36 |
38 // Returns the small icon (16x16) that should be displayed in the first | 37 // Returns the small icon (16x16) that should be displayed in the first |
39 // column before the text. This is only used when the TableView was created | 38 // column before the text. This is only used when the TableView was created |
40 // with the ICON_AND_TEXT table type. Returns an isNull() bitmap if there is | 39 // with the ICON_AND_TEXT table type. Returns an isNull() bitmap if there is |
41 // no bitmap. | 40 // no bitmap. |
42 virtual SkBitmap GetIcon(int row); | 41 virtual SkBitmap GetIcon(int row); |
43 | 42 |
44 // Returns the tooltip, if any, to show for a particular row. If there are | 43 // Returns the tooltip, if any, to show for a particular row. If there are |
45 // multiple columns in the row, this will only be shown when hovering over | 44 // multiple columns in the row, this will only be shown when hovering over |
46 // column zero. | 45 // column zero. |
47 virtual std::wstring GetTooltip(int row) { | 46 virtual std::wstring GetTooltip(int row); |
48 return std::wstring(); | |
49 } | |
50 | 47 |
51 // Returns true if the TableView has groups. Groups provide a way to visually | 48 // Returns true if the TableView has groups. Groups provide a way to visually |
52 // delineate the rows in a table view. When groups are enabled table view | 49 // delineate the rows in a table view. When groups are enabled table view |
53 // shows a visual separator for each group, followed by all the rows in | 50 // shows a visual separator for each group, followed by all the rows in |
54 // the group. | 51 // the group. |
55 // | 52 // |
56 // On win2k a visual separator is not rendered for the group headers. | 53 // On win2k a visual separator is not rendered for the group headers. |
57 virtual bool HasGroups() { return false; } | 54 virtual bool HasGroups(); |
58 | 55 |
59 // Returns the groups. | 56 // Returns the groups. |
60 // This is only used if HasGroups returns true. | 57 // This is only used if HasGroups returns true. |
61 virtual Groups GetGroups() { | 58 virtual Groups GetGroups(); |
62 // If you override HasGroups to return true, you must override this as | |
63 // well. | |
64 NOTREACHED(); | |
65 return std::vector<Group>(); | |
66 } | |
67 | 59 |
68 // Returns the group id of the specified row. | 60 // Returns the group id of the specified row. |
69 // This is only used if HasGroups returns true. | 61 // This is only used if HasGroups returns true. |
70 virtual int GetGroupID(int row) { | 62 virtual int GetGroupID(int row); |
71 // If you override HasGroups to return true, you must override this as | |
72 // well. | |
73 NOTREACHED(); | |
74 return 0; | |
75 } | |
76 | 63 |
77 // Sets the observer for the model. The TableView should NOT take ownership | 64 // Sets the observer for the model. The TableView should NOT take ownership |
78 // of the observer. | 65 // of the observer. |
79 virtual void SetObserver(TableModelObserver* observer) = 0; | 66 virtual void SetObserver(TableModelObserver* observer) = 0; |
80 | 67 |
81 // Compares the values in the column with id |column_id| for the two rows. | 68 // Compares the values in the column with id |column_id| for the two rows. |
82 // Returns a value < 0, == 0 or > 0 as to whether the first value is | 69 // Returns a value < 0, == 0 or > 0 as to whether the first value is |
83 // <, == or > the second value. | 70 // <, == or > the second value. |
84 // | 71 // |
85 // This implementation does a case insensitive locale specific string | 72 // This implementation does a case insensitive locale specific string |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 // The minimum width required for all items in this column | 129 // The minimum width required for all items in this column |
143 // (including the header) | 130 // (including the header) |
144 // to be visible. | 131 // to be visible. |
145 int min_visible_width; | 132 int min_visible_width; |
146 | 133 |
147 // Is this column sortable? Default is false | 134 // Is this column sortable? Default is false |
148 bool sortable; | 135 bool sortable; |
149 }; | 136 }; |
150 | 137 |
151 #endif // APP_TABLE_MODEL_H_ | 138 #endif // APP_TABLE_MODEL_H_ |
OLD | NEW |