| 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_CHROMEOS_OPTIONS_LANGUAGE_PINYIN_CONFIG_VIEW_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_OPTIONS_LANGUAGE_PINYIN_CONFIG_VIEW_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <string> | |
| 10 | |
| 11 #include "chrome/browser/chromeos/cros/input_method_library.h" | |
| 12 #include "chrome/browser/chromeos/language_preferences.h" | |
| 13 #include "chrome/browser/prefs/pref_member.h" | |
| 14 #include "chrome/browser/ui/views/options/options_page_view.h" | |
| 15 #include "views/controls/button/checkbox.h" | |
| 16 #include "views/controls/combobox/combobox.h" | |
| 17 #include "views/controls/label.h" | |
| 18 #include "views/window/dialog_delegate.h" | |
| 19 | |
| 20 namespace chromeos { | |
| 21 | |
| 22 class LanguageCombobox; | |
| 23 template <typename DataType> | |
| 24 class LanguageComboboxModel; | |
| 25 | |
| 26 // A dialog box for showing Traditional Chinese (Pinyin) input method | |
| 27 // preferences. | |
| 28 class LanguagePinyinConfigView : public views::ButtonListener, | |
| 29 public views::Combobox::Listener, | |
| 30 public views::DialogDelegate, | |
| 31 public OptionsPageView { | |
| 32 public: | |
| 33 explicit LanguagePinyinConfigView(Profile* profile); | |
| 34 virtual ~LanguagePinyinConfigView(); | |
| 35 | |
| 36 // views::ButtonListener overrides. | |
| 37 virtual void ButtonPressed(views::Button* sender, const views::Event& event); | |
| 38 | |
| 39 // views::Combobox::Listener overrides. | |
| 40 virtual void ItemChanged(views::Combobox* sender, | |
| 41 int prev_index, | |
| 42 int new_index); | |
| 43 | |
| 44 // views::DialogDelegate overrides. | |
| 45 virtual bool IsModal() const { return true; } | |
| 46 virtual views::View* GetContentsView() { return this; } | |
| 47 virtual int GetDialogButtons() const; | |
| 48 virtual std::wstring GetDialogButtonLabel( | |
| 49 MessageBoxFlags::DialogButton button) const; | |
| 50 virtual std::wstring GetWindowTitle() const; | |
| 51 | |
| 52 // views::View overrides. | |
| 53 virtual void Layout(); | |
| 54 virtual gfx::Size GetPreferredSize(); | |
| 55 | |
| 56 // OptionsPageView overrides. | |
| 57 virtual void InitControlLayout(); | |
| 58 | |
| 59 // NotificationObserver overrides. | |
| 60 virtual void Observe(NotificationType type, | |
| 61 const NotificationSource& source, | |
| 62 const NotificationDetails& details); | |
| 63 | |
| 64 private: | |
| 65 // Updates the pinyin checkboxes. | |
| 66 void NotifyPrefChanged(); | |
| 67 | |
| 68 BooleanPrefMember pinyin_boolean_prefs_[ | |
| 69 language_prefs::kNumPinyinBooleanPrefs]; | |
| 70 // TODO(yusukes): Support integer prefs if needed. | |
| 71 views::View* contents_; | |
| 72 | |
| 73 // A checkboxes for Pinyin. | |
| 74 views::Checkbox* pinyin_boolean_checkboxes_[ | |
| 75 language_prefs::kNumPinyinBooleanPrefs]; | |
| 76 | |
| 77 struct DoublePinyinSchemaPrefAndAssociatedCombobox { | |
| 78 IntegerPrefMember multiple_choice_pref; | |
| 79 LanguageComboboxModel<int>* combobox_model; | |
| 80 LanguageCombobox* combobox; | |
| 81 } double_pinyin_schema_; | |
| 82 | |
| 83 DISALLOW_COPY_AND_ASSIGN(LanguagePinyinConfigView); | |
| 84 }; | |
| 85 | |
| 86 } // namespace chromeos | |
| 87 | |
| 88 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_LANGUAGE_PINYIN_CONFIG_VIEW_H_ | |
| OLD | NEW |