| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 } else { | 177 } else { |
| 178 gtk_editable_select_region(GTK_EDITABLE(native_view()), 0, 0); | 178 gtk_editable_select_region(GTK_EDITABLE(native_view()), 0, 0); |
| 179 } | 179 } |
| 180 } | 180 } |
| 181 | 181 |
| 182 void NativeTextfieldGtk::UpdateBorder() { | 182 void NativeTextfieldGtk::UpdateBorder() { |
| 183 if (!native_view()) | 183 if (!native_view()) |
| 184 return; | 184 return; |
| 185 | 185 |
| 186 if (textfield_->IsMultiLine()) { | 186 if (textfield_->IsMultiLine()) { |
| 187 if (!textfield_->draw_border()) | 187 if (!textfield_->draw_border()) { |
| 188 gtk_container_set_border_width(GTK_CONTAINER(native_view()), 0); | 188 gtk_container_set_border_width(GTK_CONTAINER(native_view()), 0); |
| 189 |
| 190 // Use margin to match entry with no border |
| 191 SetHorizontalMargins(kTextViewBorderWidth / 2 + 1, |
| 192 kTextViewBorderWidth / 2 + 1); |
| 193 } |
| 189 } else { | 194 } else { |
| 190 if (!textfield_->draw_border()) | 195 if (!textfield_->draw_border()) |
| 191 gtk_entry_set_has_frame(GTK_ENTRY(native_view()), false); | 196 gtk_entry_set_has_frame(GTK_ENTRY(native_view()), false); |
| 192 } | 197 } |
| 193 } | 198 } |
| 194 | 199 |
| 195 void NativeTextfieldGtk::UpdateTextColor() { | 200 void NativeTextfieldGtk::UpdateTextColor() { |
| 196 if (textfield_->use_default_text_color()) { | 201 if (textfield_->use_default_text_color()) { |
| 197 // Passing NULL as the color undoes the effect of previous calls to | 202 // Passing NULL as the color undoes the effect of previous calls to |
| 198 // gtk_widget_modify_text. | 203 // gtk_widget_modify_text. |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 //////////////////////////////////////////////////////////////////////////////// | 385 //////////////////////////////////////////////////////////////////////////////// |
| 381 // NativeTextfieldWrapper, public: | 386 // NativeTextfieldWrapper, public: |
| 382 | 387 |
| 383 // static | 388 // static |
| 384 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( | 389 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( |
| 385 Textfield* field) { | 390 Textfield* field) { |
| 386 return new NativeTextfieldGtk(field); | 391 return new NativeTextfieldGtk(field); |
| 387 } | 392 } |
| 388 | 393 |
| 389 } // namespace views | 394 } // namespace views |
| OLD | NEW |