| OLD | NEW |
| 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/combobox/native_combobox_views.h" | 5 #include "ui/views/controls/combobox/native_combobox_views.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 SchedulePaint(); | 133 SchedulePaint(); |
| 134 } | 134 } |
| 135 | 135 |
| 136 return true; | 136 return true; |
| 137 } | 137 } |
| 138 | 138 |
| 139 bool NativeComboboxViews::OnKeyReleased(const views::KeyEvent& key_event) { | 139 bool NativeComboboxViews::OnKeyReleased(const views::KeyEvent& key_event) { |
| 140 return true; | 140 return true; |
| 141 } | 141 } |
| 142 | 142 |
| 143 void NativeComboboxViews::OnPaint(gfx::Canvas* canvas) { | 143 void NativeComboboxViews::OnPaint(gfx::CanvasSkia* canvas) { |
| 144 text_border_->set_has_focus(combobox_->HasFocus()); | 144 text_border_->set_has_focus(combobox_->HasFocus()); |
| 145 OnPaintBackground(canvas); | 145 OnPaintBackground(canvas); |
| 146 PaintText(canvas); | 146 PaintText(canvas); |
| 147 OnPaintBorder(canvas); | 147 OnPaintBorder(canvas); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void NativeComboboxViews::OnFocus() { | 150 void NativeComboboxViews::OnFocus() { |
| 151 NOTREACHED(); | 151 NOTREACHED(); |
| 152 } | 152 } |
| 153 | 153 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 | 270 |
| 271 const gfx::Font& NativeComboboxViews::GetFont() const { | 271 const gfx::Font& NativeComboboxViews::GetFont() const { |
| 272 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 272 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 273 return rb.GetFont(ResourceBundle::BaseFont); | 273 return rb.GetFont(ResourceBundle::BaseFont); |
| 274 } | 274 } |
| 275 | 275 |
| 276 void NativeComboboxViews::AdjustBoundsForRTLUI(gfx::Rect* rect) const { | 276 void NativeComboboxViews::AdjustBoundsForRTLUI(gfx::Rect* rect) const { |
| 277 rect->set_x(GetMirroredXForRect(*rect)); | 277 rect->set_x(GetMirroredXForRect(*rect)); |
| 278 } | 278 } |
| 279 | 279 |
| 280 void NativeComboboxViews::PaintText(gfx::Canvas* canvas) { | 280 void NativeComboboxViews::PaintText(gfx::CanvasSkia* canvas) { |
| 281 gfx::Insets insets = GetInsets(); | 281 gfx::Insets insets = GetInsets(); |
| 282 | 282 |
| 283 canvas->Save(); | 283 canvas->Save(); |
| 284 canvas->ClipRect(GetContentsBounds()); | 284 canvas->ClipRect(GetContentsBounds()); |
| 285 | 285 |
| 286 int x = insets.left(); | 286 int x = insets.left(); |
| 287 int y = insets.top(); | 287 int y = insets.top(); |
| 288 int text_height = height() - insets.height(); | 288 int text_height = height() - insets.height(); |
| 289 SkColor text_color = kTextColor; | 289 SkColor text_color = kTextColor; |
| 290 | 290 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 | 356 |
| 357 #if defined(USE_AURA) | 357 #if defined(USE_AURA) |
| 358 // static | 358 // static |
| 359 NativeComboboxWrapper* NativeComboboxWrapper::CreateWrapper( | 359 NativeComboboxWrapper* NativeComboboxWrapper::CreateWrapper( |
| 360 Combobox* combobox) { | 360 Combobox* combobox) { |
| 361 return new NativeComboboxViews(combobox); | 361 return new NativeComboboxViews(combobox); |
| 362 } | 362 } |
| 363 #endif | 363 #endif |
| 364 | 364 |
| 365 } // namespace views | 365 } // namespace views |
| OLD | NEW |