OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_GTK_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_GTK_H_ |
6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_GTK_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_GTK_H_ |
7 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 // Internally invoked whenever the text changes in some way. | 310 // Internally invoked whenever the text changes in some way. |
311 void TextChanged(); | 311 void TextChanged(); |
312 | 312 |
313 // Save |selected_text| as the PRIMARY X selection. | 313 // Save |selected_text| as the PRIMARY X selection. |
314 void SavePrimarySelection(const std::string& selected_text); | 314 void SavePrimarySelection(const std::string& selected_text); |
315 | 315 |
316 // Update the field with |text| and set the selection. | 316 // Update the field with |text| and set the selection. |
317 void SetTextAndSelectedRange(const std::wstring& text, | 317 void SetTextAndSelectedRange(const std::wstring& text, |
318 const CharRange& range); | 318 const CharRange& range); |
319 | 319 |
| 320 // Set the selection to |range|. |
| 321 void SetSelectedRange(const CharRange& range); |
| 322 |
320 // The widget we expose, used for vertically centering the real text edit, | 323 // The widget we expose, used for vertically centering the real text edit, |
321 // since the height will change based on the font / font size, etc. | 324 // since the height will change based on the font / font size, etc. |
322 OwnedWidgetGtk alignment_; | 325 OwnedWidgetGtk alignment_; |
323 | 326 |
324 // The actual text entry which will be owned by the alignment_. | 327 // The actual text entry which will be owned by the alignment_. |
325 GtkWidget* text_view_; | 328 GtkWidget* text_view_; |
326 | 329 |
327 GtkTextTagTable* tag_table_; | 330 GtkTextTagTable* tag_table_; |
328 GtkTextBuffer* text_buffer_; | 331 GtkTextBuffer* text_buffer_; |
329 GtkTextTag* faded_text_tag_; | 332 GtkTextTag* faded_text_tag_; |
330 GtkTextTag* secure_scheme_tag_; | 333 GtkTextTag* secure_scheme_tag_; |
331 GtkTextTag* insecure_scheme_tag_; | 334 GtkTextTag* insecure_scheme_tag_; |
332 GtkTextTag* normal_text_tag_; | 335 GtkTextTag* normal_text_tag_; |
333 | 336 |
334 scoped_ptr<AutocompleteEditModel> model_; | 337 scoped_ptr<AutocompleteEditModel> model_; |
335 scoped_ptr<AutocompletePopupView> popup_view_; | 338 scoped_ptr<AutocompletePopupView> popup_view_; |
336 AutocompleteEditController* controller_; | 339 AutocompleteEditController* controller_; |
337 ToolbarModel* toolbar_model_; | 340 ToolbarModel* toolbar_model_; |
338 | 341 |
339 // The object that handles additional command functionality exposed on the | 342 // The object that handles additional command functionality exposed on the |
340 // edit, such as invoking the keyword editor. | 343 // edit, such as invoking the keyword editor. |
341 CommandUpdater* command_updater_; | 344 CommandUpdater* command_updater_; |
342 | 345 |
343 // When true, the location bar view is read only and also is has a slightly | 346 // When true, the location bar view is read only and also is has a slightly |
344 // different presentation (smaller font size). This is used for popups. | 347 // different presentation (smaller font size). This is used for popups. |
345 bool popup_window_mode_; | 348 bool popup_window_mode_; |
346 | 349 |
347 ToolbarModel::SecurityLevel scheme_security_level_; | 350 ToolbarModel::SecurityLevel scheme_security_level_; |
348 | 351 |
349 // Text and selection at the point where the user started using the | 352 // Selection at the point where the user started using the |
350 // arrows to move around in the popup. | 353 // arrows to move around in the popup. |
351 std::wstring saved_temporary_text_; | |
352 CharRange saved_temporary_selection_; | 354 CharRange saved_temporary_selection_; |
353 | 355 |
354 // Tracking state before and after a possible change. | 356 // Tracking state before and after a possible change. |
355 std::wstring text_before_change_; | 357 std::wstring text_before_change_; |
356 CharRange sel_before_change_; | 358 CharRange sel_before_change_; |
357 | 359 |
358 // The most-recently-selected text from the entry. This is updated on-the-fly | 360 // The most-recently-selected text from the entry. This is updated on-the-fly |
359 // as the user selects text. It is used in cases where we need to make the | 361 // as the user selects text. It is used in cases where we need to make the |
360 // PRIMARY selection persist even after the user has unhighlighted the text in | 362 // PRIMARY selection persist even after the user has unhighlighted the text in |
361 // the view (e.g. when they highlight some text and then click to unhighlight | 363 // the view (e.g. when they highlight some text and then click to unhighlight |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 | 407 |
406 // If a character is inserted, store it in this variable so that it can | 408 // If a character is inserted, store it in this variable so that it can |
407 // be used later in "key-press-event" signal handler to determine if a Tab or | 409 // be used later in "key-press-event" signal handler to determine if a Tab or |
408 // Enter key event is handled by IME or not. | 410 // Enter key event is handled by IME or not. |
409 char char_inserted_; | 411 char char_inserted_; |
410 | 412 |
411 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewGtk); | 413 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewGtk); |
412 }; | 414 }; |
413 | 415 |
414 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_GTK_H_ | 416 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_GTK_H_ |
OLD | NEW |