| 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 VIEWS_CONTROLS_TABLE_TABLE_VIEW_H_ | 5 #ifndef VIEWS_CONTROLS_TABLE_TABLE_VIEW_H_ |
| 6 #define VIEWS_CONTROLS_TABLE_TABLE_VIEW_H_ | 6 #define VIEWS_CONTROLS_TABLE_TABLE_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 | 10 |
| 11 #if defined(OS_WIN) | 11 #if defined(OS_WIN) |
| 12 #include <windows.h> | 12 #include <windows.h> |
| 13 typedef struct tagNMLVCUSTOMDRAW NMLVCUSTOMDRAW; | 13 typedef struct tagNMLVCUSTOMDRAW NMLVCUSTOMDRAW; |
| 14 #endif // defined(OS_WIN) | 14 #endif // defined(OS_WIN) |
| 15 | 15 |
| 16 #include <map> | 16 #include <map> |
| 17 #include <vector> | 17 #include <vector> |
| 18 | 18 |
| 19 #include "base/gtest_prod_util.h" | 19 #include "base/gtest_prod_util.h" |
| 20 #include "third_party/skia/include/core/SkColor.h" | 20 #include "third_party/skia/include/core/SkColor.h" |
| 21 #include "ui/base/keycodes/keyboard_codes.h" | 21 #include "ui/base/keycodes/keyboard_codes.h" |
| 22 #include "ui/base/models/table_model_observer.h" | 22 #include "ui/base/models/table_model_observer.h" |
| 23 #include "views/views_api.h" | 23 #include "views/views_export.h" |
| 24 | 24 |
| 25 #if defined(OS_WIN) | 25 #if defined(OS_WIN) |
| 26 // TODO(port): remove the ifdef when native_control.h is ported. | 26 // TODO(port): remove the ifdef when native_control.h is ported. |
| 27 #include "views/controls/native_control.h" | 27 #include "views/controls/native_control.h" |
| 28 #endif // defined(OS_WIN) | 28 #endif // defined(OS_WIN) |
| 29 | 29 |
| 30 class SkBitmap; | 30 class SkBitmap; |
| 31 | 31 |
| 32 namespace ui { | 32 namespace ui { |
| 33 struct TableColumn; | 33 struct TableColumn; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // - only text | 74 // - only text |
| 75 // - a small icon (16x16) and some text | 75 // - a small icon (16x16) and some text |
| 76 // - a check box and some text | 76 // - a check box and some text |
| 77 enum TableTypes { | 77 enum TableTypes { |
| 78 TEXT_ONLY = 0, | 78 TEXT_ONLY = 0, |
| 79 ICON_AND_TEXT, | 79 ICON_AND_TEXT, |
| 80 CHECK_BOX_AND_TEXT | 80 CHECK_BOX_AND_TEXT |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 // Returned from SelectionBegin/SelectionEnd | 83 // Returned from SelectionBegin/SelectionEnd |
| 84 class VIEWS_API TableSelectionIterator { | 84 class VIEWS_EXPORT TableSelectionIterator { |
| 85 public: | 85 public: |
| 86 TableSelectionIterator(TableView* view, int view_index); | 86 TableSelectionIterator(TableView* view, int view_index); |
| 87 TableSelectionIterator& operator=(const TableSelectionIterator& other); | 87 TableSelectionIterator& operator=(const TableSelectionIterator& other); |
| 88 bool operator==(const TableSelectionIterator& other); | 88 bool operator==(const TableSelectionIterator& other); |
| 89 bool operator!=(const TableSelectionIterator& other); | 89 bool operator!=(const TableSelectionIterator& other); |
| 90 TableSelectionIterator& operator++(); | 90 TableSelectionIterator& operator++(); |
| 91 int operator*(); | 91 int operator*(); |
| 92 | 92 |
| 93 private: | 93 private: |
| 94 void UpdateModelIndexFromViewIndex(); | 94 void UpdateModelIndexFromViewIndex(); |
| 95 | 95 |
| 96 TableView* table_view_; | 96 TableView* table_view_; |
| 97 int view_index_; | 97 int view_index_; |
| 98 | 98 |
| 99 // The index in terms of the model. This is returned from the * operator. This | 99 // The index in terms of the model. This is returned from the * operator. This |
| 100 // is cached to avoid dependencies on the view_to_model mapping. | 100 // is cached to avoid dependencies on the view_to_model mapping. |
| 101 int model_index_; | 101 int model_index_; |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 #if defined(OS_WIN) | 104 #if defined(OS_WIN) |
| 105 // TODO(port): Port TableView. | 105 // TODO(port): Port TableView. |
| 106 class VIEWS_API TableView : public NativeControl, | 106 class VIEWS_EXPORT TableView : public NativeControl, |
| 107 public TableModelObserver { | 107 public TableModelObserver { |
| 108 public: | 108 public: |
| 109 typedef TableSelectionIterator iterator; | 109 typedef TableSelectionIterator iterator; |
| 110 | 110 |
| 111 // A helper struct for GetCellColors. Set |color_is_set| to true if color is | 111 // A helper struct for GetCellColors. Set |color_is_set| to true if color is |
| 112 // set. See OnCustomDraw for more details on why we need this. | 112 // set. See OnCustomDraw for more details on why we need this. |
| 113 struct ItemColor { | 113 struct ItemColor { |
| 114 bool color_is_set; | 114 bool color_is_set; |
| 115 SkColor color; | 115 SkColor color; |
| 116 }; | 116 }; |
| 117 | 117 |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 | 500 |
| 501 string16 alt_text_; | 501 string16 alt_text_; |
| 502 | 502 |
| 503 DISALLOW_COPY_AND_ASSIGN(TableView); | 503 DISALLOW_COPY_AND_ASSIGN(TableView); |
| 504 }; | 504 }; |
| 505 #endif // defined(OS_WIN) | 505 #endif // defined(OS_WIN) |
| 506 | 506 |
| 507 } // namespace views | 507 } // namespace views |
| 508 | 508 |
| 509 #endif // VIEWS_CONTROLS_TABLE_TABLE_VIEW_H_ | 509 #endif // VIEWS_CONTROLS_TABLE_TABLE_VIEW_H_ |
| OLD | NEW |