| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 CHROME_COMMON_GTK_TREE_H_ | 5 #ifndef CHROME_COMMON_GTK_TREE_H_ |
| 6 #define CHROME_COMMON_GTK_TREE_H_ | 6 #define CHROME_COMMON_GTK_TREE_H_ |
| 7 | 7 |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include "app/table_model_observer.h" | 10 #include "app/table_model_observer.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 // Should fill in the column and row. | 36 // Should fill in the column and row. |
| 37 virtual void SetColumnValues(int row, GtkTreeIter* iter) = 0; | 37 virtual void SetColumnValues(int row, GtkTreeIter* iter) = 0; |
| 38 | 38 |
| 39 // Called after any change to the TableModel. Overriding optional. | 39 // Called after any change to the TableModel. Overriding optional. |
| 40 virtual void OnAnyModelUpdate() {} | 40 virtual void OnAnyModelUpdate() {} |
| 41 | 41 |
| 42 // When the TableModel has been completely changed, called by OnModelChanged | 42 // When the TableModel has been completely changed, called by OnModelChanged |
| 43 // after clearing the list store. Can be overriden by the delegate if it | 43 // after clearing the list store. Can be overriden by the delegate if it |
| 44 // needs to do extra initialization before the list store is populated. | 44 // needs to do extra initialization before the list store is populated. |
| 45 virtual void OnModelChanged() {} | 45 virtual void OnModelChanged() {} |
| 46 | |
| 47 protected: | |
| 48 ~Delegate() {} | |
| 49 }; | 46 }; |
| 50 | 47 |
| 51 // |table_model| may be NULL. | 48 // |table_model| may be NULL. |
| 52 explicit ModelAdapter(Delegate* delegate, GtkListStore* list_store, | 49 explicit ModelAdapter(Delegate* delegate, GtkListStore* list_store, |
| 53 TableModel* table_model); | 50 TableModel* table_model); |
| 54 virtual ~ModelAdapter() {} | 51 virtual ~ModelAdapter() {} |
| 55 | 52 |
| 56 // Replace the TableModel with a different one. If the list store currenty | 53 // Replace the TableModel with a different one. If the list store currenty |
| 57 // has items this would cause weirdness, so this should generally only be | 54 // has items this would cause weirdness, so this should generally only be |
| 58 // called during the Delegate's OnModelChanged call, or if the adapter was | 55 // called during the Delegate's OnModelChanged call, or if the adapter was |
| (...skipping 13 matching lines...) Expand all Loading... |
| 72 Delegate* delegate_; | 69 Delegate* delegate_; |
| 73 GtkListStore* list_store_; | 70 GtkListStore* list_store_; |
| 74 TableModel* table_model_; | 71 TableModel* table_model_; |
| 75 | 72 |
| 76 DISALLOW_COPY_AND_ASSIGN(ModelAdapter); | 73 DISALLOW_COPY_AND_ASSIGN(ModelAdapter); |
| 77 }; | 74 }; |
| 78 | 75 |
| 79 } // namespace gtk_tree | 76 } // namespace gtk_tree |
| 80 | 77 |
| 81 #endif // CHROME_COMMON_GTK_TREE_H_ | 78 #endif // CHROME_COMMON_GTK_TREE_H_ |
| OLD | NEW |