| 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_MOZC_CONFIG_VIEW_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_OPTIONS_LANGUAGE_MOZC_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/combobox/combobox.h" | |
| 16 #include "views/controls/label.h" | |
| 17 #include "views/controls/slider/slider.h" | |
| 18 #include "views/window/dialog_delegate.h" | |
| 19 | |
| 20 namespace views { | |
| 21 class Button; | |
| 22 class Checkbox; | |
| 23 } | |
| 24 | |
| 25 namespace chromeos { | |
| 26 | |
| 27 class LanguageCombobox; | |
| 28 template <typename DataType> | |
| 29 class LanguageComboboxModel; | |
| 30 | |
| 31 // A dialog box for showing Mozc (Japanese input method) preferences. | |
| 32 class LanguageMozcConfigView : public views::ButtonListener, | |
| 33 public views::Combobox::Listener, | |
| 34 public views::DialogDelegate, | |
| 35 public views::SliderListener, | |
| 36 public OptionsPageView { | |
| 37 public: | |
| 38 explicit LanguageMozcConfigView(Profile* profile); | |
| 39 virtual ~LanguageMozcConfigView(); | |
| 40 | |
| 41 // views::ButtonListener overrides. | |
| 42 virtual void ButtonPressed(views::Button* sender, const views::Event& event); | |
| 43 | |
| 44 // views::Combobox::Listener overrides. | |
| 45 virtual void ItemChanged(views::Combobox* sender, | |
| 46 int prev_index, | |
| 47 int new_index); | |
| 48 | |
| 49 // views::SliderListener overrides. | |
| 50 virtual void SliderValueChanged(views::Slider* sender); | |
| 51 | |
| 52 // views::DialogDelegate overrides. | |
| 53 virtual bool IsModal() const { return true; } | |
| 54 virtual views::View* GetContentsView() { return this; } | |
| 55 virtual int GetDialogButtons() const; | |
| 56 virtual std::wstring GetDialogButtonLabel( | |
| 57 MessageBoxFlags::DialogButton button) const; | |
| 58 virtual std::wstring GetWindowTitle() const; | |
| 59 | |
| 60 // views::View overrides. | |
| 61 virtual void Layout(); | |
| 62 virtual gfx::Size GetPreferredSize(); | |
| 63 | |
| 64 // OptionsPageView overrides. | |
| 65 virtual void InitControlLayout(); | |
| 66 | |
| 67 // NotificationObserver overrides. | |
| 68 virtual void Observe(NotificationType type, | |
| 69 const NotificationSource& source, | |
| 70 const NotificationDetails& details); | |
| 71 | |
| 72 private: | |
| 73 // Updates the mozc keyboard combobox. | |
| 74 void NotifyPrefChanged(); | |
| 75 | |
| 76 // Resets all the preferences to the default values. | |
| 77 void ResetToDefaults(); | |
| 78 | |
| 79 views::View* contents_; | |
| 80 | |
| 81 views::Button* reset_to_defaults_button_; | |
| 82 | |
| 83 struct MozcPrefAndAssociatedCheckbox { | |
| 84 BooleanPrefMember boolean_pref; | |
| 85 views::Checkbox* checkbox; | |
| 86 } prefs_and_checkboxes_[language_prefs::kNumMozcBooleanPrefs]; | |
| 87 | |
| 88 struct MozcPrefAndAssociatedCombobox { | |
| 89 StringPrefMember multiple_choice_pref; | |
| 90 LanguageComboboxModel<const char*>* combobox_model; | |
| 91 LanguageCombobox* combobox; | |
| 92 } prefs_and_comboboxes_[language_prefs::kNumMozcMultipleChoicePrefs]; | |
| 93 | |
| 94 struct MozcPrefAndAssociatedSlider { | |
| 95 IntegerPrefMember integer_pref; | |
| 96 views::Slider* slider; | |
| 97 } prefs_and_sliders_[language_prefs::kNumMozcIntegerPrefs]; | |
| 98 | |
| 99 DISALLOW_COPY_AND_ASSIGN(LanguageMozcConfigView); | |
| 100 }; | |
| 101 | |
| 102 } // namespace chromeos | |
| 103 | |
| 104 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_LANGUAGE_MOZC_CONFIG_VIEW_H_ | |
| OLD | NEW |