Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 16 matching lines...) Expand all Loading... | |
| 27 | 27 |
| 28 // Border width for GtkTextView. | 28 // Border width for GtkTextView. |
| 29 const int kTextViewBorderWidth = 4; | 29 const int kTextViewBorderWidth = 4; |
| 30 | 30 |
| 31 //////////////////////////////////////////////////////////////////////////////// | 31 //////////////////////////////////////////////////////////////////////////////// |
| 32 // NativeTextfieldGtk, public: | 32 // NativeTextfieldGtk, public: |
| 33 | 33 |
| 34 NativeTextfieldGtk::NativeTextfieldGtk(Textfield* textfield) | 34 NativeTextfieldGtk::NativeTextfieldGtk(Textfield* textfield) |
| 35 : textfield_(textfield), | 35 : textfield_(textfield), |
| 36 paste_clipboard_requested_(false) { | 36 paste_clipboard_requested_(false) { |
| 37 if (textfield_->IsMultiLine() && textfield_->IsPassword()) | 37 if (textfield_->IsPassword()) |
| 38 NOTIMPLEMENTED(); // We don't support multiline password yet. | 38 NOTIMPLEMENTED(); // We don't support multiline password yet. |
|
oshima
2011/06/01 01:29:15
you need to remove this line as this will disallow
Emmanuel Saint-loubert-Bié
2011/06/01 01:50:07
Done.
| |
| 39 // Make |textfield| the focused view, so that when we get focused the focus | 39 // Make |textfield| the focused view, so that when we get focused the focus |
| 40 // manager sees |textfield| as the focused view (since we are just a wrapper | 40 // manager sees |textfield| as the focused view (since we are just a wrapper |
| 41 // view). | 41 // view). |
| 42 set_focus_view(textfield); | 42 set_focus_view(textfield); |
| 43 } | 43 } |
| 44 | 44 |
| 45 NativeTextfieldGtk::~NativeTextfieldGtk() { | 45 NativeTextfieldGtk::~NativeTextfieldGtk() { |
| 46 } | 46 } |
| 47 | 47 |
| 48 // Returns the inner border of an entry. | 48 // Returns the inner border of an entry. |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 67 | 67 |
| 68 gfx::Insets NativeTextfieldGtk::GetTextViewInnerBorder(GtkTextView* text_view) { | 68 gfx::Insets NativeTextfieldGtk::GetTextViewInnerBorder(GtkTextView* text_view) { |
| 69 return gfx::Insets(kTextViewBorderWidth / 2, kTextViewBorderWidth / 2, | 69 return gfx::Insets(kTextViewBorderWidth / 2, kTextViewBorderWidth / 2, |
| 70 kTextViewBorderWidth / 2, kTextViewBorderWidth / 2); | 70 kTextViewBorderWidth / 2, kTextViewBorderWidth / 2); |
| 71 } | 71 } |
| 72 | 72 |
| 73 //////////////////////////////////////////////////////////////////////////////// | 73 //////////////////////////////////////////////////////////////////////////////// |
| 74 // NativeTextfieldGtk, NativeTextfieldWrapper implementation: | 74 // NativeTextfieldGtk, NativeTextfieldWrapper implementation: |
| 75 | 75 |
| 76 string16 NativeTextfieldGtk::GetText() const { | 76 string16 NativeTextfieldGtk::GetText() const { |
| 77 if (textfield_->IsMultiLine()) { | 77 return UTF8ToUTF16(gtk_entry_get_text(GTK_ENTRY(native_view()))); |
| 78 GtkTextBuffer* text_buffer = gtk_text_view_get_buffer( | |
| 79 GTK_TEXT_VIEW(native_view())); | |
| 80 | |
| 81 GtkTextIter start; | |
| 82 GtkTextIter end; | |
| 83 gtk_text_buffer_get_bounds(text_buffer, &start, &end); | |
| 84 | |
| 85 return UTF8ToUTF16(gtk_text_iter_get_visible_text(&start, &end)); | |
| 86 } else { | |
| 87 return UTF8ToUTF16(gtk_entry_get_text(GTK_ENTRY(native_view()))); | |
| 88 } | |
| 89 } | 78 } |
| 90 | 79 |
| 91 void NativeTextfieldGtk::UpdateText() { | 80 void NativeTextfieldGtk::UpdateText() { |
| 92 if (!native_view()) | 81 if (!native_view()) |
| 93 return; | 82 return; |
| 94 if (textfield_->IsMultiLine()) { | 83 gtk_entry_set_text(GTK_ENTRY(native_view()), |
| 95 GtkTextBuffer* text_buffer = gtk_text_view_get_buffer( | |
| 96 GTK_TEXT_VIEW(native_view())); | |
| 97 | |
| 98 std::string utf8 = UTF16ToUTF8(textfield_->text()); | |
| 99 gtk_text_buffer_set_text(text_buffer, utf8.c_str(), utf8.length()); | |
| 100 } else { | |
| 101 gtk_entry_set_text(GTK_ENTRY(native_view()), | |
| 102 UTF16ToUTF8(textfield_->text()).c_str()); | 84 UTF16ToUTF8(textfield_->text()).c_str()); |
| 103 } | |
| 104 } | 85 } |
| 105 | 86 |
| 106 void NativeTextfieldGtk::AppendText(const string16& text) { | 87 void NativeTextfieldGtk::AppendText(const string16& text) { |
| 107 if (!native_view()) | 88 if (!native_view()) |
| 108 return; | 89 return; |
| 109 if (textfield_->IsMultiLine()) { | 90 gtk_entry_append_text(GTK_ENTRY(native_view()), UTF16ToUTF8(text).c_str()); |
| 110 GtkTextBuffer* text_buffer = gtk_text_view_get_buffer( | |
| 111 GTK_TEXT_VIEW(native_view())); | |
| 112 | |
| 113 GtkTextIter end; | |
| 114 gtk_text_buffer_get_end_iter(text_buffer, &end); | |
| 115 | |
| 116 std::string utf8 = UTF16ToUTF8(text); | |
| 117 gtk_text_buffer_insert(text_buffer, &end, utf8.c_str(), utf8.length()); | |
| 118 } else { | |
| 119 gtk_entry_append_text(GTK_ENTRY(native_view()), UTF16ToUTF8(text).c_str()); | |
| 120 } | |
| 121 } | 91 } |
| 122 | 92 |
| 123 string16 NativeTextfieldGtk::GetSelectedText() const { | 93 string16 NativeTextfieldGtk::GetSelectedText() const { |
| 124 if (!native_view()) | 94 if (!native_view()) |
| 125 return string16(); | 95 return string16(); |
| 126 | 96 |
| 127 string16 result; | 97 string16 result; |
| 128 | 98 |
| 129 if (textfield_->IsMultiLine()) { | 99 gint start_pos; |
| 130 GtkTextBuffer* text_buffer = gtk_text_view_get_buffer( | 100 gint end_pos; |
| 131 GTK_TEXT_VIEW(native_view())); | 101 if (!gtk_editable_get_selection_bounds(GTK_EDITABLE(native_view()), |
| 102 &start_pos, &end_pos)) | |
| 103 return result; // No selection. | |
| 132 | 104 |
| 133 GtkTextIter start; | 105 UTF8ToUTF16(gtk_editable_get_chars(GTK_EDITABLE(native_view()), |
| 134 GtkTextIter end; | 106 start_pos, end_pos), |
| 135 if (gtk_text_buffer_get_selection_bounds(text_buffer, &start, &end)) { | 107 end_pos - start_pos, &result); |
| 136 gchar* selected_text = gtk_text_iter_get_visible_text(&start, &end); | |
| 137 if (selected_text) | |
| 138 UTF8ToUTF16(selected_text, strlen(selected_text), &result); | |
| 139 } | |
| 140 } else { | |
| 141 gint start_pos; | |
| 142 gint end_pos; | |
| 143 if (!gtk_editable_get_selection_bounds(GTK_EDITABLE(native_view()), | |
| 144 &start_pos, &end_pos)) | |
| 145 return result; // No selection. | |
| 146 | |
| 147 UTF8ToUTF16(gtk_editable_get_chars(GTK_EDITABLE(native_view()), | |
| 148 start_pos, end_pos), | |
| 149 end_pos - start_pos, &result); | |
| 150 } | |
| 151 | 108 |
| 152 return result; | 109 return result; |
| 153 } | 110 } |
| 154 | 111 |
| 155 void NativeTextfieldGtk::SelectAll() { | 112 void NativeTextfieldGtk::SelectAll() { |
| 156 if (!native_view()) | 113 if (!native_view()) |
| 157 return; | 114 return; |
| 158 if (textfield_->IsMultiLine()) { | 115 // -1 as the end position selects to the end of the text. |
| 159 GtkTextBuffer* text_buffer = gtk_text_view_get_buffer( | 116 gtk_editable_select_region(GTK_EDITABLE(native_view()), 0, -1); |
| 160 GTK_TEXT_VIEW(native_view())); | |
| 161 | |
| 162 GtkTextIter start; | |
| 163 GtkTextIter end; | |
| 164 gtk_text_buffer_get_bounds(text_buffer, &start, &end); | |
| 165 gtk_text_buffer_select_range(text_buffer, &start, &end); | |
| 166 } else { | |
| 167 // -1 as the end position selects to the end of the text. | |
| 168 gtk_editable_select_region(GTK_EDITABLE(native_view()), 0, -1); | |
| 169 } | |
| 170 } | 117 } |
| 171 | 118 |
| 172 void NativeTextfieldGtk::ClearSelection() { | 119 void NativeTextfieldGtk::ClearSelection() { |
| 173 if (!native_view()) | 120 if (!native_view()) |
| 174 return; | 121 return; |
| 175 if (textfield_->IsMultiLine()) { | 122 gtk_editable_select_region(GTK_EDITABLE(native_view()), 0, 0); |
| 176 GtkTextBuffer* text_buffer = gtk_text_view_get_buffer( | |
| 177 GTK_TEXT_VIEW(native_view())); | |
| 178 | |
| 179 GtkTextMark* insert_mark = gtk_text_buffer_get_insert(text_buffer); | |
| 180 GtkTextIter insert; | |
| 181 gtk_text_buffer_get_iter_at_mark(text_buffer, &insert, insert_mark); | |
| 182 gtk_text_buffer_select_range(text_buffer, &insert, &insert); | |
| 183 } else { | |
| 184 gtk_editable_select_region(GTK_EDITABLE(native_view()), 0, 0); | |
| 185 } | |
| 186 } | 123 } |
| 187 | 124 |
| 188 void NativeTextfieldGtk::UpdateBorder() { | 125 void NativeTextfieldGtk::UpdateBorder() { |
| 189 if (!native_view()) | 126 if (!native_view()) |
| 190 return; | 127 return; |
| 191 | 128 |
| 192 if (textfield_->IsMultiLine()) { | 129 if (!textfield_->draw_border()) |
| 193 if (!textfield_->draw_border()) { | 130 gtk_entry_set_has_frame(GTK_ENTRY(native_view()), false); |
| 194 gtk_container_set_border_width(GTK_CONTAINER(native_view()), 0); | |
| 195 | |
| 196 // Use margin to match entry with no border | |
| 197 textfield_->SetHorizontalMargins(kTextViewBorderWidth / 2 + 1, | |
| 198 kTextViewBorderWidth / 2 + 1); | |
| 199 } | |
| 200 } else { | |
| 201 if (!textfield_->draw_border()) | |
| 202 gtk_entry_set_has_frame(GTK_ENTRY(native_view()), false); | |
| 203 } | |
| 204 } | 131 } |
| 205 | 132 |
| 206 void NativeTextfieldGtk::UpdateTextColor() { | 133 void NativeTextfieldGtk::UpdateTextColor() { |
| 207 if (textfield_->use_default_text_color()) { | 134 if (textfield_->use_default_text_color()) { |
| 208 // Passing NULL as the color undoes the effect of previous calls to | 135 // Passing NULL as the color undoes the effect of previous calls to |
| 209 // gtk_widget_modify_text. | 136 // gtk_widget_modify_text. |
| 210 gtk_widget_modify_text(native_view(), GTK_STATE_NORMAL, NULL); | 137 gtk_widget_modify_text(native_view(), GTK_STATE_NORMAL, NULL); |
| 211 return; | 138 return; |
| 212 } | 139 } |
| 213 GdkColor gdk_color = gfx::SkColorToGdkColor(textfield_->text_color()); | 140 GdkColor gdk_color = gfx::SkColorToGdkColor(textfield_->text_color()); |
| 214 gtk_widget_modify_text(native_view(), GTK_STATE_NORMAL, &gdk_color); | 141 gtk_widget_modify_text(native_view(), GTK_STATE_NORMAL, &gdk_color); |
| 215 } | 142 } |
| 216 | 143 |
| 217 void NativeTextfieldGtk::UpdateBackgroundColor() { | 144 void NativeTextfieldGtk::UpdateBackgroundColor() { |
| 218 if (textfield_->use_default_background_color()) { | 145 if (textfield_->use_default_background_color()) { |
| 219 // Passing NULL as the color undoes the effect of previous calls to | 146 // Passing NULL as the color undoes the effect of previous calls to |
| 220 // gtk_widget_modify_base. | 147 // gtk_widget_modify_base. |
| 221 gtk_widget_modify_base(native_view(), GTK_STATE_NORMAL, NULL); | 148 gtk_widget_modify_base(native_view(), GTK_STATE_NORMAL, NULL); |
| 222 return; | 149 return; |
| 223 } | 150 } |
| 224 GdkColor gdk_color = gfx::SkColorToGdkColor(textfield_->background_color()); | 151 GdkColor gdk_color = gfx::SkColorToGdkColor(textfield_->background_color()); |
| 225 gtk_widget_modify_base(native_view(), GTK_STATE_NORMAL, &gdk_color); | 152 gtk_widget_modify_base(native_view(), GTK_STATE_NORMAL, &gdk_color); |
| 226 } | 153 } |
| 227 | 154 |
| 228 void NativeTextfieldGtk::UpdateReadOnly() { | 155 void NativeTextfieldGtk::UpdateReadOnly() { |
| 229 if (!native_view()) | 156 if (!native_view()) |
| 230 return; | 157 return; |
| 231 | 158 gtk_editable_set_editable(GTK_EDITABLE(native_view()), |
| 232 if (textfield_->IsMultiLine()) { | |
| 233 gtk_text_view_set_editable(GTK_TEXT_VIEW(native_view()), | |
| 234 !textfield_->read_only()); | |
| 235 } else { | |
| 236 gtk_editable_set_editable(GTK_EDITABLE(native_view()), | |
| 237 !textfield_->read_only()); | 159 !textfield_->read_only()); |
|
oshima
2011/06/01 01:29:15
indent
Emmanuel Saint-loubert-Bié
2011/06/01 01:50:07
Done.
| |
| 238 } | |
| 239 } | 160 } |
| 240 | 161 |
| 241 void NativeTextfieldGtk::UpdateFont() { | 162 void NativeTextfieldGtk::UpdateFont() { |
| 242 if (!native_view()) | 163 if (!native_view()) |
| 243 return; | 164 return; |
| 244 PangoFontDescription* pfd = textfield_->font().GetNativeFont(); | 165 PangoFontDescription* pfd = textfield_->font().GetNativeFont(); |
| 245 gtk_widget_modify_font(native_view(), pfd); | 166 gtk_widget_modify_font(native_view(), pfd); |
| 246 pango_font_description_free(pfd); | 167 pango_font_description_free(pfd); |
| 247 } | 168 } |
| 248 | 169 |
| 249 void NativeTextfieldGtk::UpdateIsPassword() { | 170 void NativeTextfieldGtk::UpdateIsPassword() { |
| 250 if (!native_view()) | 171 if (!native_view()) |
| 251 return; | 172 return; |
| 252 if (!textfield_->IsMultiLine()) { | 173 gtk_entry_set_visibility(GTK_ENTRY(native_view()), |
| 253 gtk_entry_set_visibility(GTK_ENTRY(native_view()), | |
| 254 !textfield_->IsPassword()); | 174 !textfield_->IsPassword()); |
|
oshima
2011/06/01 01:29:15
indent
Emmanuel Saint-loubert-Bié
2011/06/01 01:50:07
Done.
| |
| 255 } | |
| 256 } | 175 } |
| 257 | 176 |
| 258 void NativeTextfieldGtk::UpdateEnabled() { | 177 void NativeTextfieldGtk::UpdateEnabled() { |
| 259 if (!native_view()) | 178 if (!native_view()) |
| 260 return; | 179 return; |
| 261 SetEnabled(textfield_->IsEnabled()); | 180 SetEnabled(textfield_->IsEnabled()); |
| 262 } | 181 } |
| 263 | 182 |
| 264 gfx::Insets NativeTextfieldGtk::CalculateInsets() { | 183 gfx::Insets NativeTextfieldGtk::CalculateInsets() { |
| 265 if (!native_view()) | 184 if (!native_view()) |
| 266 return gfx::Insets(); | 185 return gfx::Insets(); |
| 267 | 186 |
| 268 GtkWidget* widget = native_view(); | 187 GtkWidget* widget = native_view(); |
| 269 gfx::Insets insets; | 188 gfx::Insets insets; |
| 270 | 189 |
| 271 if (textfield_->IsMultiLine()) { | 190 GtkEntry* entry = GTK_ENTRY(widget); |
| 272 insets += GetTextViewInnerBorder(GTK_TEXT_VIEW(widget)); | 191 insets += GetEntryInnerBorder(entry); |
| 273 } else { | 192 if (entry->has_frame) { |
| 274 GtkEntry* entry = GTK_ENTRY(widget); | 193 insets += gfx::Insets(widget->style->ythickness, |
| 275 insets += GetEntryInnerBorder(entry); | |
| 276 if (entry->has_frame) { | |
| 277 insets += gfx::Insets(widget->style->ythickness, | |
| 278 widget->style->xthickness, | 194 widget->style->xthickness, |
| 279 widget->style->ythickness, | 195 widget->style->ythickness, |
| 280 widget->style->xthickness); | 196 widget->style->xthickness); |
| 281 } | |
| 282 } | 197 } |
| 283 | 198 |
| 284 gboolean interior_focus; | 199 gboolean interior_focus; |
| 285 gint focus_width; | 200 gint focus_width; |
| 286 gtk_widget_style_get(widget, | 201 gtk_widget_style_get(widget, |
| 287 "focus-line-width", &focus_width, | 202 "focus-line-width", &focus_width, |
| 288 "interior-focus", &interior_focus, | 203 "interior-focus", &interior_focus, |
| 289 NULL); | 204 NULL); |
| 290 if (!interior_focus) | 205 if (!interior_focus) |
| 291 insets += gfx::Insets(focus_width, focus_width, focus_width, focus_width); | 206 insets += gfx::Insets(focus_width, focus_width, focus_width, focus_width); |
| 292 | 207 |
| 293 return insets; | 208 return insets; |
| 294 } | 209 } |
| 295 | 210 |
| 296 void NativeTextfieldGtk::UpdateHorizontalMargins() { | 211 void NativeTextfieldGtk::UpdateHorizontalMargins() { |
| 297 if (!native_view()) | 212 if (!native_view()) |
| 298 return; | 213 return; |
| 299 | 214 |
| 300 int left, right; | 215 int left, right; |
| 301 if (!textfield_->GetHorizontalMargins(&left, &right)) | 216 if (!textfield_->GetHorizontalMargins(&left, &right)) |
| 302 return; | 217 return; |
| 303 | 218 |
| 304 if (textfield_->IsMultiLine()) { | 219 gfx::Insets insets = GetEntryInnerBorder(GTK_ENTRY(native_view())); |
| 305 GtkTextView* text_view = GTK_TEXT_VIEW(native_view()); | 220 GtkBorder border = {left, right, insets.top(), insets.bottom()}; |
| 306 gtk_text_view_set_left_margin(text_view, left); | 221 gtk_entry_set_inner_border(GTK_ENTRY(native_view()), &border); |
| 307 gtk_text_view_set_right_margin(text_view, right); | |
| 308 } else { | |
| 309 gfx::Insets insets = GetEntryInnerBorder(GTK_ENTRY(native_view())); | |
| 310 GtkBorder border = {left, right, insets.top(), insets.bottom()}; | |
| 311 gtk_entry_set_inner_border(GTK_ENTRY(native_view()), &border); | |
| 312 } | |
| 313 } | 222 } |
| 314 | 223 |
| 315 void NativeTextfieldGtk::UpdateVerticalMargins() { | 224 void NativeTextfieldGtk::UpdateVerticalMargins() { |
| 316 if (!native_view()) | 225 if (!native_view()) |
| 317 return; | 226 return; |
| 318 | 227 |
| 319 int top, bottom; | 228 int top, bottom; |
| 320 if (!textfield_->GetVerticalMargins(&top, &bottom)) | 229 if (!textfield_->GetVerticalMargins(&top, &bottom)) |
| 321 return; | 230 return; |
| 322 | 231 |
| 323 if (!textfield_->IsMultiLine()) { | 232 gfx::Insets insets = GetEntryInnerBorder(GTK_ENTRY(native_view())); |
| 324 gfx::Insets insets = GetEntryInnerBorder(GTK_ENTRY(native_view())); | 233 GtkBorder border = {insets.left(), insets.right(), top, bottom}; |
| 325 GtkBorder border = {insets.left(), insets.right(), top, bottom}; | 234 gtk_entry_set_inner_border(GTK_ENTRY(native_view()), &border); |
| 326 gtk_entry_set_inner_border(GTK_ENTRY(native_view()), &border); | |
| 327 } else { | |
| 328 NOTIMPLEMENTED(); | |
| 329 } | |
| 330 } | 235 } |
| 331 | 236 |
| 332 bool NativeTextfieldGtk::SetFocus() { | 237 bool NativeTextfieldGtk::SetFocus() { |
| 333 OnFocus(); | 238 OnFocus(); |
| 334 return true; | 239 return true; |
| 335 } | 240 } |
| 336 | 241 |
| 337 View* NativeTextfieldGtk::GetView() { | 242 View* NativeTextfieldGtk::GetView() { |
| 338 return this; | 243 return this; |
| 339 } | 244 } |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 461 | 366 |
| 462 void NativeTextfieldGtk::OnPasteClipboard(GtkWidget* widget) { | 367 void NativeTextfieldGtk::OnPasteClipboard(GtkWidget* widget) { |
| 463 if (!textfield_->read_only()) | 368 if (!textfield_->read_only()) |
| 464 paste_clipboard_requested_ = true; | 369 paste_clipboard_requested_ = true; |
| 465 } | 370 } |
| 466 | 371 |
| 467 //////////////////////////////////////////////////////////////////////////////// | 372 //////////////////////////////////////////////////////////////////////////////// |
| 468 // NativeTextfieldGtk, NativeControlGtk overrides: | 373 // NativeTextfieldGtk, NativeControlGtk overrides: |
| 469 | 374 |
| 470 void NativeTextfieldGtk::CreateNativeControl() { | 375 void NativeTextfieldGtk::CreateNativeControl() { |
| 471 if (textfield_->IsMultiLine()) { | 376 NativeControlCreated(gtk_views_entry_new(this)); |
| 472 NativeControlCreated(gtk_views_textview_new(this)); | 377 gtk_entry_set_invisible_char(GTK_ENTRY(native_view()), |
| 473 if (textfield_->draw_border()) | |
| 474 gtk_container_set_border_width(GTK_CONTAINER(native_view()), | |
| 475 kTextViewBorderWidth); | |
| 476 | |
| 477 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(native_view()), | |
| 478 GTK_WRAP_WORD_CHAR); | |
| 479 } else { | |
| 480 NativeControlCreated(gtk_views_entry_new(this)); | |
| 481 gtk_entry_set_invisible_char(GTK_ENTRY(native_view()), | |
| 482 static_cast<gunichar>(kPasswordChar)); | 378 static_cast<gunichar>(kPasswordChar)); |
| 483 } | |
| 484 textfield_->UpdateAllProperties(); | 379 textfield_->UpdateAllProperties(); |
| 485 } | 380 } |
| 486 | 381 |
| 487 void NativeTextfieldGtk::NativeControlCreated(GtkWidget* widget) { | 382 void NativeTextfieldGtk::NativeControlCreated(GtkWidget* widget) { |
| 488 NativeControlGtk::NativeControlCreated(widget); | 383 NativeControlGtk::NativeControlCreated(widget); |
| 489 | 384 |
| 490 if (GTK_IS_TEXT_VIEW(widget)) { | 385 if (GTK_IS_TEXT_VIEW(widget)) { |
| 491 GtkTextBuffer* text_buffer = gtk_text_view_get_buffer( | 386 GtkTextBuffer* text_buffer = gtk_text_view_get_buffer( |
| 492 GTK_TEXT_VIEW(widget)); | 387 GTK_TEXT_VIEW(widget)); |
| 493 g_signal_connect(text_buffer, "changed", G_CALLBACK(OnChangedThunk), this); | 388 g_signal_connect(text_buffer, "changed", G_CALLBACK(OnChangedThunk), this); |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 521 // static | 416 // static |
| 522 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( | 417 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( |
| 523 Textfield* field) { | 418 Textfield* field) { |
| 524 if (NativeTextfieldViews::IsTextfieldViewsEnabled()) { | 419 if (NativeTextfieldViews::IsTextfieldViewsEnabled()) { |
| 525 return new NativeTextfieldViews(field); | 420 return new NativeTextfieldViews(field); |
| 526 } | 421 } |
| 527 return new NativeTextfieldGtk(field); | 422 return new NativeTextfieldGtk(field); |
| 528 } | 423 } |
| 529 | 424 |
| 530 } // namespace views | 425 } // namespace views |
| OLD | NEW |