| 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 <gtk/gtk.h> | 5 #include <gtk/gtk.h> |
| 6 | 6 |
| 7 #include "views/controls/textfield/native_textfield_gtk.h" | 7 #include "views/controls/textfield/native_textfield_gtk.h" |
| 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 } | 292 } |
| 293 | 293 |
| 294 void NativeTextfieldGtk::SetHorizontalMargins(int left, int right) { | 294 void NativeTextfieldGtk::SetHorizontalMargins(int left, int right) { |
| 295 if (!native_view()) | 295 if (!native_view()) |
| 296 return; | 296 return; |
| 297 if (textfield_->IsMultiLine()) { | 297 if (textfield_->IsMultiLine()) { |
| 298 GtkTextView* text_view = GTK_TEXT_VIEW(native_view()); | 298 GtkTextView* text_view = GTK_TEXT_VIEW(native_view()); |
| 299 gtk_text_view_set_left_margin(text_view, left); | 299 gtk_text_view_set_left_margin(text_view, left); |
| 300 gtk_text_view_set_right_margin(text_view, right); | 300 gtk_text_view_set_right_margin(text_view, right); |
| 301 } else { | 301 } else { |
| 302 GtkBorder border = { left, right, 0, 0 }; | 302 gfx::Insets insets = GetEntryInnerBorder(GTK_ENTRY(native_view())); |
| 303 GtkBorder border = {left, right, insets.top(), insets.bottom()}; |
| 303 gtk_entry_set_inner_border(GTK_ENTRY(native_view()), &border); | 304 gtk_entry_set_inner_border(GTK_ENTRY(native_view()), &border); |
| 304 } | 305 } |
| 305 } | 306 } |
| 306 | 307 |
| 307 void NativeTextfieldGtk::SetFocus() { | 308 void NativeTextfieldGtk::SetFocus() { |
| 308 Focus(); | 309 Focus(); |
| 309 } | 310 } |
| 310 | 311 |
| 311 View* NativeTextfieldGtk::GetView() { | 312 View* NativeTextfieldGtk::GetView() { |
| 312 return this; | 313 return this; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 //////////////////////////////////////////////////////////////////////////////// | 392 //////////////////////////////////////////////////////////////////////////////// |
| 392 // NativeTextfieldWrapper, public: | 393 // NativeTextfieldWrapper, public: |
| 393 | 394 |
| 394 // static | 395 // static |
| 395 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( | 396 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( |
| 396 Textfield* field) { | 397 Textfield* field) { |
| 397 return new NativeTextfieldGtk(field); | 398 return new NativeTextfieldGtk(field); |
| 398 } | 399 } |
| 399 | 400 |
| 400 } // namespace views | 401 } // namespace views |
| OLD | NEW |