OLD | NEW |
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/textfield/textfield.h" | 5 #include "views/controls/textfield/textfield.h" |
6 | 6 |
7 #if defined(OS_LINUX) | 7 #if defined(OS_LINUX) |
8 #include <gdk/gdkkeysyms.h> | 8 #include <gdk/gdkkeysyms.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 native_wrapper_->GetView()->Layout(); | 218 native_wrapper_->GetView()->Layout(); |
219 } | 219 } |
220 } | 220 } |
221 | 221 |
222 gfx::Size Textfield::GetPreferredSize() { | 222 gfx::Size Textfield::GetPreferredSize() { |
223 gfx::Insets insets; | 223 gfx::Insets insets; |
224 if (draw_border_ && native_wrapper_) | 224 if (draw_border_ && native_wrapper_) |
225 insets = native_wrapper_->CalculateInsets(); | 225 insets = native_wrapper_->CalculateInsets(); |
226 return gfx::Size(font_.GetExpectedTextWidth(default_width_in_chars_) + | 226 return gfx::Size(font_.GetExpectedTextWidth(default_width_in_chars_) + |
227 insets.width(), | 227 insets.width(), |
228 num_lines_ * font_.height() + insets.height()); | 228 num_lines_ * font_.GetHeight() + insets.height()); |
229 } | 229 } |
230 | 230 |
231 bool Textfield::IsFocusable() const { | 231 bool Textfield::IsFocusable() const { |
232 return IsEnabled() && !read_only_; | 232 return IsEnabled() && !read_only_; |
233 } | 233 } |
234 | 234 |
235 void Textfield::AboutToRequestFocusFromTabTraversal(bool reverse) { | 235 void Textfield::AboutToRequestFocusFromTabTraversal(bool reverse) { |
236 SelectAll(); | 236 SelectAll(); |
237 } | 237 } |
238 | 238 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 GDK_CONTROL_MASK; | 355 GDK_CONTROL_MASK; |
356 } | 356 } |
357 | 357 |
358 bool Textfield::Keystroke::IsShiftHeld() const { | 358 bool Textfield::Keystroke::IsShiftHeld() const { |
359 return (event_.state & gtk_accelerator_get_default_mod_mask()) == | 359 return (event_.state & gtk_accelerator_get_default_mod_mask()) == |
360 GDK_SHIFT_MASK; | 360 GDK_SHIFT_MASK; |
361 } | 361 } |
362 #endif | 362 #endif |
363 | 363 |
364 } // namespace views | 364 } // namespace views |
OLD | NEW |