| 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 <gdk/gdkkeysyms.h> | 5 #include <gdk/gdkkeysyms.h> |
| 6 #include <gtk/gtk.h> | 6 #include <gtk/gtk.h> |
| 7 | 7 |
| 8 #include "views/controls/textfield/native_textfield_gtk.h" | 8 #include "views/controls/textfield/native_textfield_gtk.h" |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 !textfield_->IsPassword()); | 250 !textfield_->IsPassword()); |
| 251 } | 251 } |
| 252 } | 252 } |
| 253 | 253 |
| 254 void NativeTextfieldGtk::UpdateEnabled() { | 254 void NativeTextfieldGtk::UpdateEnabled() { |
| 255 if (!native_view()) | 255 if (!native_view()) |
| 256 return; | 256 return; |
| 257 SetEnabled(textfield_->IsEnabled()); | 257 SetEnabled(textfield_->IsEnabled()); |
| 258 } | 258 } |
| 259 | 259 |
| 260 bool NativeTextfieldGtk::IsPassword() { | |
| 261 return textfield_->IsPassword(); | |
| 262 } | |
| 263 | |
| 264 gfx::Insets NativeTextfieldGtk::CalculateInsets() { | 260 gfx::Insets NativeTextfieldGtk::CalculateInsets() { |
| 265 if (!native_view()) | 261 if (!native_view()) |
| 266 return gfx::Insets(); | 262 return gfx::Insets(); |
| 267 | 263 |
| 268 GtkWidget* widget = native_view(); | 264 GtkWidget* widget = native_view(); |
| 269 gfx::Insets insets; | 265 gfx::Insets insets; |
| 270 | 266 |
| 271 if (textfield_->IsMultiLine()) { | 267 if (textfield_->IsMultiLine()) { |
| 272 insets += GetTextViewInnerBorder(GTK_TEXT_VIEW(widget)); | 268 insets += GetTextViewInnerBorder(GTK_TEXT_VIEW(widget)); |
| 273 } else { | 269 } else { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 | 318 |
| 323 if (!textfield_->IsMultiLine()) { | 319 if (!textfield_->IsMultiLine()) { |
| 324 gfx::Insets insets = GetEntryInnerBorder(GTK_ENTRY(native_view())); | 320 gfx::Insets insets = GetEntryInnerBorder(GTK_ENTRY(native_view())); |
| 325 GtkBorder border = {insets.left(), insets.right(), top, bottom}; | 321 GtkBorder border = {insets.left(), insets.right(), top, bottom}; |
| 326 gtk_entry_set_inner_border(GTK_ENTRY(native_view()), &border); | 322 gtk_entry_set_inner_border(GTK_ENTRY(native_view()), &border); |
| 327 } else { | 323 } else { |
| 328 NOTIMPLEMENTED(); | 324 NOTIMPLEMENTED(); |
| 329 } | 325 } |
| 330 } | 326 } |
| 331 | 327 |
| 332 void NativeTextfieldGtk::SetFocus() { | 328 bool NativeTextfieldGtk::SetFocus() { |
| 333 Focus(); | 329 Focus(); |
| 330 return true; |
| 334 } | 331 } |
| 335 | 332 |
| 336 View* NativeTextfieldGtk::GetView() { | 333 View* NativeTextfieldGtk::GetView() { |
| 337 return this; | 334 return this; |
| 338 } | 335 } |
| 339 | 336 |
| 340 gfx::NativeView NativeTextfieldGtk::GetTestingHandle() const { | 337 gfx::NativeView NativeTextfieldGtk::GetTestingHandle() const { |
| 341 return native_view(); | 338 return native_view(); |
| 342 } | 339 } |
| 343 | 340 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 g_signal_connect(widget, "changed", | 436 g_signal_connect(widget, "changed", |
| 440 G_CALLBACK(OnChangedHandler), this); | 437 G_CALLBACK(OnChangedHandler), this); |
| 441 } | 438 } |
| 442 g_signal_connect_after(widget, "key-press-event", | 439 g_signal_connect_after(widget, "key-press-event", |
| 443 G_CALLBACK(OnKeyPressEventHandler), this); | 440 G_CALLBACK(OnKeyPressEventHandler), this); |
| 444 // In order to properly trigger Accelerators bound to VKEY_RETURN, we need to | 441 // In order to properly trigger Accelerators bound to VKEY_RETURN, we need to |
| 445 // send an event when the widget gets the activate signal. | 442 // send an event when the widget gets the activate signal. |
| 446 g_signal_connect(widget, "activate", G_CALLBACK(OnActivateHandler), this); | 443 g_signal_connect(widget, "activate", G_CALLBACK(OnActivateHandler), this); |
| 447 } | 444 } |
| 448 | 445 |
| 446 bool NativeTextfieldGtk::IsPassword() { |
| 447 return textfield_->IsPassword(); |
| 448 } |
| 449 |
| 449 } // namespace views | 450 } // namespace views |
| OLD | NEW |