| 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_TABLE_MODEL_H_ | 5 #ifndef UI_BASE_MODELS_TABLE_MODEL_H_ |
| 6 #define UI_BASE_MODELS_TABLE_MODEL_H_ | 6 #define UI_BASE_MODELS_TABLE_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/base/ui_export.h" | 12 #include "ui/base/ui_export.h" |
| 13 #include "unicode/coll.h" | 13 #include "unicode/coll.h" |
| 14 | 14 |
| 15 class SkBitmap; | 15 namespace gfx { |
| 16 class ImageSkia; |
| 17 } |
| 16 | 18 |
| 17 namespace ui { | 19 namespace ui { |
| 18 | 20 |
| 19 class TableModelObserver; | 21 class TableModelObserver; |
| 20 | 22 |
| 21 // The model driving the TableView. | 23 // The model driving the TableView. |
| 22 class UI_EXPORT TableModel { | 24 class UI_EXPORT TableModel { |
| 23 public: | 25 public: |
| 24 // See HasGroups, get GetGroupID for details as to how this is used. | 26 // See HasGroups, get GetGroupID for details as to how this is used. |
| 25 struct Group { | 27 struct Group { |
| 26 // The title text for the group. | 28 // The title text for the group. |
| 27 string16 title; | 29 string16 title; |
| 28 | 30 |
| 29 // Unique id for the group. | 31 // Unique id for the group. |
| 30 int id; | 32 int id; |
| 31 }; | 33 }; |
| 32 typedef std::vector<Group> Groups; | 34 typedef std::vector<Group> Groups; |
| 33 | 35 |
| 34 // Number of rows in the model. | 36 // Number of rows in the model. |
| 35 virtual int RowCount() = 0; | 37 virtual int RowCount() = 0; |
| 36 | 38 |
| 37 // Returns the value at a particular location in text. | 39 // Returns the value at a particular location in text. |
| 38 virtual string16 GetText(int row, int column_id) = 0; | 40 virtual string16 GetText(int row, int column_id) = 0; |
| 39 | 41 |
| 40 // Returns the small icon (16x16) that should be displayed in the first | 42 // Returns the small icon (16x16) that should be displayed in the first |
| 41 // column before the text. This is only used when the TableView was created | 43 // column before the text. This is only used when the TableView was created |
| 42 // with the ICON_AND_TEXT table type. Returns an isNull() bitmap if there is | 44 // with the ICON_AND_TEXT table type. Returns an isNull() image if there is |
| 43 // no bitmap. | 45 // no image. |
| 44 virtual SkBitmap GetIcon(int row); | 46 virtual gfx::ImageSkia GetIcon(int row); |
| 45 | 47 |
| 46 // Returns the tooltip, if any, to show for a particular row. If there are | 48 // Returns the tooltip, if any, to show for a particular row. If there are |
| 47 // multiple columns in the row, this will only be shown when hovering over | 49 // multiple columns in the row, this will only be shown when hovering over |
| 48 // column zero. | 50 // column zero. |
| 49 virtual string16 GetTooltip(int row); | 51 virtual string16 GetTooltip(int row); |
| 50 | 52 |
| 51 // If true, this row should be indented. | 53 // If true, this row should be indented. |
| 52 virtual bool ShouldIndent(int row); | 54 virtual bool ShouldIndent(int row); |
| 53 | 55 |
| 54 // Returns true if the TableView has groups. Groups provide a way to visually | 56 // Returns true if the TableView has groups. Groups provide a way to visually |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 // to be visible. | 139 // to be visible. |
| 138 int min_visible_width; | 140 int min_visible_width; |
| 139 | 141 |
| 140 // Is this column sortable? Default is false | 142 // Is this column sortable? Default is false |
| 141 bool sortable; | 143 bool sortable; |
| 142 }; | 144 }; |
| 143 | 145 |
| 144 } // namespace ui | 146 } // namespace ui |
| 145 | 147 |
| 146 #endif // UI_BASE_MODELS_TABLE_MODEL_H_ | 148 #endif // UI_BASE_MODELS_TABLE_MODEL_H_ |
| OLD | NEW |