| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_OPTIONS_LANGUAGES_PAGE_VIEW_H__ | |
| 6 #define CHROME_BROWSER_UI_VIEWS_OPTIONS_LANGUAGES_PAGE_VIEW_H__ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "chrome/browser/prefs/pref_member.h" | |
| 10 #include "chrome/browser/ui/views/options/options_page_view.h" | |
| 11 #include "views/controls/combobox/combobox.h" | |
| 12 #include "views/controls/button/button.h" | |
| 13 #include "views/controls/table/table_view_observer.h" | |
| 14 #include "views/view.h" | |
| 15 | |
| 16 class AddLanguageView; | |
| 17 class LanguageComboboxModel; | |
| 18 class LanguageOrderTableModel; | |
| 19 | |
| 20 namespace views { | |
| 21 class Checkbox; | |
| 22 class Label; | |
| 23 class NativeButton; | |
| 24 class TableView; | |
| 25 } | |
| 26 | |
| 27 /////////////////////////////////////////////////////////////////////////////// | |
| 28 // LanguagesPageView | |
| 29 | |
| 30 class LanguagesPageView : public OptionsPageView, | |
| 31 public views::ButtonListener, | |
| 32 public views::TableViewObserver, | |
| 33 public views::Combobox::Listener { | |
| 34 public: | |
| 35 explicit LanguagesPageView(Profile* profile); | |
| 36 virtual ~LanguagesPageView(); | |
| 37 | |
| 38 // views::ButtonListener implementation: | |
| 39 virtual void ButtonPressed(views::Button* sender, const views::Event& event); | |
| 40 | |
| 41 // Save Changes made to relevant pref members associated with this tab. | |
| 42 // This is public since it is called by FontsLanguageWindowView in its | |
| 43 // Dialog Delegate Accept() method. | |
| 44 void SaveChanges(); | |
| 45 | |
| 46 // This is public because when user clicks OK in AddLanguageView dialog, | |
| 47 // this is called back in the LanguagePageView delegate in order to add | |
| 48 // this language to the table model in this tab. | |
| 49 void OnAddLanguage(const std::string& new_language); | |
| 50 | |
| 51 protected: | |
| 52 // OptionsPageView implementation: | |
| 53 virtual void InitControlLayout(); | |
| 54 virtual void NotifyPrefChanged(const std::string* pref_name); | |
| 55 | |
| 56 // views::Combobox::Listener implementation: | |
| 57 virtual void ItemChanged(views::Combobox* sender, | |
| 58 int prev_index, | |
| 59 int new_index); | |
| 60 | |
| 61 private: | |
| 62 // Invoked when the selection of the table view changes. Updates the enabled | |
| 63 // property of the remove button. | |
| 64 virtual void OnSelectionChanged(); | |
| 65 void OnRemoveLanguage(); | |
| 66 void OnMoveDownLanguage(); | |
| 67 void OnMoveUpLanguage(); | |
| 68 | |
| 69 views::Label* languages_instructions_; | |
| 70 views::View* languages_contents_; | |
| 71 views::View* button_stack_; | |
| 72 views::TableView* language_order_table_; | |
| 73 views::NativeButton* move_up_button_; | |
| 74 views::NativeButton* move_down_button_; | |
| 75 views::NativeButton* add_button_; | |
| 76 views::NativeButton* remove_button_; | |
| 77 views::Label* language_info_label_; | |
| 78 views::Label* ui_language_label_; | |
| 79 views::Combobox* change_ui_language_combobox_; | |
| 80 views::Combobox* change_dictionary_language_combobox_; | |
| 81 views::Checkbox* enable_autospellcorrect_checkbox_; | |
| 82 views::Checkbox* enable_spellchecking_checkbox_; | |
| 83 views::Label* dictionary_language_label_; | |
| 84 | |
| 85 scoped_ptr<LanguageOrderTableModel> language_order_table_model_; | |
| 86 AddLanguageView* add_language_instance_; | |
| 87 StringPrefMember accept_languages_; | |
| 88 | |
| 89 // The contents of the "user interface language" combobox. | |
| 90 scoped_ptr<LanguageComboboxModel> ui_language_model_; | |
| 91 StringPrefMember app_locale_; | |
| 92 int ui_language_index_selected_; | |
| 93 int starting_ui_language_index_; | |
| 94 | |
| 95 // The contents of the "dictionary language" combobox. | |
| 96 scoped_ptr<LanguageComboboxModel> dictionary_language_model_; | |
| 97 StringPrefMember dictionary_language_; | |
| 98 | |
| 99 // SpellChecker enable pref. | |
| 100 BooleanPrefMember enable_spellcheck_; | |
| 101 | |
| 102 // Auto spell correction pref. | |
| 103 BooleanPrefMember enable_autospellcorrect_; | |
| 104 | |
| 105 // This is assigned the new index of spellcheck language if the language | |
| 106 // is changed. Otherwise, it remains -1, and pref members are not updated. | |
| 107 int spellcheck_language_index_selected_; | |
| 108 std::string spellcheck_language_added_; | |
| 109 | |
| 110 bool language_table_edited_; | |
| 111 bool language_warning_shown_; | |
| 112 bool enable_spellcheck_checkbox_clicked_; | |
| 113 bool enable_autospellcorrect_checkbox_clicked_; | |
| 114 | |
| 115 DISALLOW_COPY_AND_ASSIGN(LanguagesPageView); | |
| 116 }; | |
| 117 | |
| 118 #endif // CHROME_BROWSER_UI_VIEWS_OPTIONS_LANGUAGES_PAGE_VIEW_H__ | |
| OLD | NEW |