Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: views/controls/table/native_table_gtk.cc

Issue 6256004: views: Implement NativeTableGtk::RemoveColumn method. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "views/controls/table/native_table_gtk.h" 5 #include "views/controls/table/native_table_gtk.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 gfx::NativeView NativeTableGtk::GetTestingHandle() const { 62 gfx::NativeView NativeTableGtk::GetTestingHandle() const {
63 // Note that we are returning the tree view, not the scrolled window as 63 // Note that we are returning the tree view, not the scrolled window as
64 // arguably the tests need to access the tree view. 64 // arguably the tests need to access the tree view.
65 return GTK_WIDGET(tree_view_); 65 return GTK_WIDGET(tree_view_);
66 } 66 }
67 67
68 void NativeTableGtk::InsertColumn(const TableColumn& column, int index) { 68 void NativeTableGtk::InsertColumn(const TableColumn& column, int index) {
69 NOTIMPLEMENTED(); 69 NOTIMPLEMENTED();
70 } 70 }
71 71
72 void NativeTableGtk::RemoveColumn(int index) { 72 void NativeTableGtk::RemoveColumn(int column_index) {
73 NOTIMPLEMENTED(); 73 if (!native_view())
74 return;
75
76 GtkTreeViewColumn* column = gtk_tree_view_get_column(tree_view_,
77 column_index);
78 if (column) {
79 gtk_tree_view_remove_column(tree_view_, column);
80
81 if (table_->model()->RowCount() > 0)
82 OnRowsChanged(0, table_->model()->RowCount() - 1);
83 }
74 } 84 }
75 85
76 int NativeTableGtk::GetColumnWidth(int column_index) const { 86 int NativeTableGtk::GetColumnWidth(int column_index) const {
77 GtkTreeViewColumn* column = gtk_tree_view_get_column(tree_view_, 87 GtkTreeViewColumn* column = gtk_tree_view_get_column(tree_view_,
78 column_index); 88 column_index);
79 return gtk_tree_view_column_get_width(column); 89 return column ? gtk_tree_view_column_get_width(column) : -1;
80 } 90 }
81 91
82 void NativeTableGtk::SetColumnWidth(int column_index, int width) { 92 void NativeTableGtk::SetColumnWidth(int column_index, int width) {
83 GtkTreeViewColumn* column = gtk_tree_view_get_column(tree_view_, 93 GtkTreeViewColumn* column = gtk_tree_view_get_column(tree_view_,
84 column_index); 94 column_index);
85 column->width = width; 95 column->width = width;
86 column->resized_width = width; 96 column->resized_width = width;
87 column->use_resized_width = TRUE; 97 column->use_resized_width = TRUE;
88 // Needed for use_resized_width to be effective. 98 // Needed for use_resized_width to be effective.
89 gtk_widget_queue_resize(GTK_WIDGET(tree_view_)); 99 gtk_widget_queue_resize(GTK_WIDGET(tree_view_));
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 SkBitmap icon = table_->model()->GetIcon(row); 361 SkBitmap icon = table_->model()->GetIcon(row);
352 return gfx::GdkPixbufFromSkBitmap(&icon); 362 return gfx::GdkPixbufFromSkBitmap(&icon);
353 } 363 }
354 364
355 // static 365 // static
356 NativeTableWrapper* NativeTableWrapper::CreateNativeWrapper(TableView2* table) { 366 NativeTableWrapper* NativeTableWrapper::CreateNativeWrapper(TableView2* table) {
357 return new NativeTableGtk(table); 367 return new NativeTableGtk(table);
358 } 368 }
359 369
360 } // namespace views 370 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698