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

Side by Side Diff: ui/views/controls/table/table_view_views.cc

Issue 10825254: Remove views::KeyEvent, replacing uses of it with ui::KeyEvent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/controls/table/table_view_views.h" 5 #include "ui/views/controls/table/table_view_views.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "ui/base/event.h"
8 #include "ui/base/models/table_model.h" 9 #include "ui/base/models/table_model.h"
9 #include "ui/base/native_theme/native_theme.h" 10 #include "ui/base/native_theme/native_theme.h"
10 #include "ui/gfx/canvas.h" 11 #include "ui/gfx/canvas.h"
11 #include "ui/gfx/image/image_skia.h" 12 #include "ui/gfx/image/image_skia.h"
12 #include "ui/gfx/skia_util.h" 13 #include "ui/gfx/skia_util.h"
13 #include "ui/views/border.h" 14 #include "ui/views/border.h"
14 #include "ui/views/controls/scroll_view.h" 15 #include "ui/views/controls/scroll_view.h"
15 #include "ui/views/controls/table/table_view_observer.h" 16 #include "ui/views/controls/table/table_view_observer.h"
16 17
17 // Padding around the text (on each side). 18 // Padding around the text (on each side).
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 width = std::max(parent()->width(), width); 116 width = std::max(parent()->width(), width);
116 height = std::max(parent()->height(), height); 117 height = std::max(parent()->height(), height);
117 } 118 }
118 SetBounds(x(), y(), width, height); 119 SetBounds(x(), y(), width, height);
119 } 120 }
120 121
121 gfx::Size TableView::GetPreferredSize() { 122 gfx::Size TableView::GetPreferredSize() {
122 return gfx::Size(50, RowCount() * row_height_); 123 return gfx::Size(50, RowCount() * row_height_);
123 } 124 }
124 125
125 bool TableView::OnKeyPressed(const KeyEvent& event) { 126 bool TableView::OnKeyPressed(const ui::KeyEvent& event) {
126 if (!HasFocus()) 127 if (!HasFocus())
127 return false; 128 return false;
128 129
129 switch (event.key_code()) { 130 switch (event.key_code()) {
130 case ui::VKEY_UP: 131 case ui::VKEY_UP:
131 if (selected_row_ > 0) 132 if (selected_row_ > 0)
132 Select(selected_row_ - 1); 133 Select(selected_row_ - 1);
133 else if (selected_row_ == -1 && RowCount()) 134 else if (selected_row_ == -1 && RowCount())
134 Select(RowCount() - 1); 135 Select(RowCount() - 1);
135 return true; 136 return true;
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 void TableView::NumRowsChanged() { 282 void TableView::NumRowsChanged() {
282 PreferredSizeChanged(); 283 PreferredSizeChanged();
283 SchedulePaint(); 284 SchedulePaint();
284 } 285 }
285 286
286 gfx::Rect TableView::GetRowBounds(int row) { 287 gfx::Rect TableView::GetRowBounds(int row) {
287 return gfx::Rect(0, row * row_height_, width(), row_height_); 288 return gfx::Rect(0, row * row_height_, width(), row_height_);
288 } 289 }
289 290
290 } // namespace views 291 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/table/table_view_views.h ('k') | ui/views/controls/textfield/native_textfield_views.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698