| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef VIEWS_CONTROLS_TABLE_NATIVE_TABLE_WRAPPER_H_ | |
| 6 #define VIEWS_CONTROLS_TABLE_NATIVE_TABLE_WRAPPER_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "ui/gfx/native_widget_types.h" | |
| 10 | |
| 11 namespace ui { | |
| 12 struct TableColumn; | |
| 13 } | |
| 14 | |
| 15 namespace views { | |
| 16 | |
| 17 class TableView2; | |
| 18 class View; | |
| 19 | |
| 20 // An interface implemented by an object that provides a platform-native | |
| 21 // table. | |
| 22 class NativeTableWrapper { | |
| 23 public: | |
| 24 // Returns the number of rows in the table. | |
| 25 virtual int GetRowCount() const = 0; | |
| 26 | |
| 27 // Inserts/removes a column at the specified index. | |
| 28 virtual void InsertColumn(const ui::TableColumn& column, int index) = 0; | |
| 29 virtual void RemoveColumn(int index) = 0; | |
| 30 | |
| 31 // Returns the number of rows that are selected. | |
| 32 virtual int GetSelectedRowCount() const = 0; | |
| 33 | |
| 34 // Returns the first row that is selected/focused in terms of the model. | |
| 35 virtual int GetFirstSelectedRow() const = 0; | |
| 36 virtual int GetFirstFocusedRow() const = 0; | |
| 37 | |
| 38 // Unselect all rows. | |
| 39 virtual void ClearSelection() = 0; | |
| 40 | |
| 41 virtual void ClearRowFocus() = 0; | |
| 42 | |
| 43 virtual void SetSelectedState(int model_row, bool state) = 0; | |
| 44 | |
| 45 virtual void SetFocusState(int model_row, bool state) = 0; | |
| 46 | |
| 47 // Returns true if the row at the specified index is selected. | |
| 48 virtual bool IsRowSelected(int model_row) const = 0; | |
| 49 | |
| 50 // Returns true if the row at the specified index has the focus. | |
| 51 virtual bool IsRowFocused(int model_row) const = 0; | |
| 52 | |
| 53 // Retrieves the views::View that hosts the native control. | |
| 54 virtual View* GetView() = 0; | |
| 55 | |
| 56 // Sets the focus to the table. | |
| 57 virtual void SetFocus() = 0; | |
| 58 | |
| 59 // Returns a handle to the underlying native view for testing. | |
| 60 virtual gfx::NativeView GetTestingHandle() const = 0; | |
| 61 | |
| 62 // Gets/sets the columns width. | |
| 63 virtual int GetColumnWidth(int column_index) const = 0; | |
| 64 virtual void SetColumnWidth(int column_index, int width) = 0; | |
| 65 | |
| 66 // Called by the table view to indicate that some rows have changed, been | |
| 67 // added or been removed. | |
| 68 virtual void OnRowsChanged(int start, int length) = 0; | |
| 69 virtual void OnRowsAdded(int start, int length) = 0; | |
| 70 virtual void OnRowsRemoved(int start, int length) = 0; | |
| 71 | |
| 72 // Returns the bounds of the native table. | |
| 73 virtual gfx::Rect GetBounds() const = 0; | |
| 74 | |
| 75 // Creates an appropriate NativeTableWrapper for the platform. | |
| 76 static NativeTableWrapper* CreateNativeWrapper(TableView2* table); | |
| 77 | |
| 78 protected: | |
| 79 virtual ~NativeTableWrapper() {} | |
| 80 }; | |
| 81 | |
| 82 } // namespace views | |
| 83 | |
| 84 #endif // VIEWS_CONTROLS_TABLE_NATIVE_TABLE_WRAPPER_H_ | |
| OLD | NEW |