OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_CHROMEOS_OPTIONS_LANGUAGE_CHEWING_CONFIG_VIEW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_OPTIONS_LANGUAGE_CHEWING_CONFIG_VIEW_H_ |
6 #define CHROME_BROWSER_CHROMEOS_OPTIONS_LANGUAGE_CHEWING_CONFIG_VIEW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_OPTIONS_LANGUAGE_CHEWING_CONFIG_VIEW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome/browser/chromeos/cros/language_library.h" | 10 #include "chrome/browser/chromeos/cros/language_library.h" |
11 #include "chrome/browser/chromeos/language_preferences.h" | 11 #include "chrome/browser/chromeos/language_preferences.h" |
12 #include "chrome/browser/pref_member.h" | 12 #include "chrome/browser/pref_member.h" |
13 #include "chrome/browser/views/options/options_page_view.h" | 13 #include "chrome/browser/views/options/options_page_view.h" |
14 #include "views/controls/button/checkbox.h" | 14 #include "views/controls/button/checkbox.h" |
15 #include "views/controls/combobox/combobox.h" | 15 #include "views/controls/combobox/combobox.h" |
16 #include "views/controls/label.h" | 16 #include "views/controls/label.h" |
| 17 #include "views/controls/slider/slider.h" |
17 #include "views/window/dialog_delegate.h" | 18 #include "views/window/dialog_delegate.h" |
18 | 19 |
19 namespace chromeos { | 20 namespace chromeos { |
20 | 21 |
21 class ChewingCombobox; | 22 class ChewingCombobox; |
22 class ChewingComboboxModel; | 23 class ChewingComboboxModel; |
23 | 24 |
24 // A dialog box for showing Traditional Chinese (Chewing) input method | 25 // A dialog box for showing Traditional Chinese (Chewing) input method |
25 // preferences. | 26 // preferences. |
26 class LanguageChewingConfigView : public views::ButtonListener, | 27 class LanguageChewingConfigView : public views::ButtonListener, |
27 public views::Combobox::Listener, | 28 public views::Combobox::Listener, |
28 public views::DialogDelegate, | 29 public views::DialogDelegate, |
| 30 public views::SliderListener, |
29 public OptionsPageView { | 31 public OptionsPageView { |
30 public: | 32 public: |
31 explicit LanguageChewingConfigView(Profile* profile); | 33 explicit LanguageChewingConfigView(Profile* profile); |
32 virtual ~LanguageChewingConfigView(); | 34 virtual ~LanguageChewingConfigView(); |
33 | 35 |
34 // views::ButtonListener overrides. | 36 // views::ButtonListener overrides. |
35 virtual void ButtonPressed(views::Button* sender, const views::Event& event); | 37 virtual void ButtonPressed(views::Button* sender, const views::Event& event); |
36 | 38 |
37 // views::Combobox::Listener overrides. | 39 // views::Combobox::Listener overrides. |
38 virtual void ItemChanged(views::Combobox* sender, | 40 virtual void ItemChanged(views::Combobox* sender, |
39 int prev_index, | 41 int prev_index, |
40 int new_index); | 42 int new_index); |
41 | 43 |
| 44 // views::SliderListener overrides. |
| 45 virtual void SliderValueChanged(views::Slider* sender); |
| 46 |
42 // views::DialogDelegate overrides. | 47 // views::DialogDelegate overrides. |
43 virtual bool IsModal() const { return true; } | 48 virtual bool IsModal() const { return true; } |
44 virtual views::View* GetContentsView() { return this; } | 49 virtual views::View* GetContentsView() { return this; } |
45 virtual std::wstring GetWindowTitle() const; | 50 virtual std::wstring GetWindowTitle() const; |
46 | 51 |
47 // views::View overrides. | 52 // views::View overrides. |
48 virtual void Layout(); | 53 virtual void Layout(); |
49 virtual gfx::Size GetPreferredSize(); | 54 virtual gfx::Size GetPreferredSize(); |
50 | 55 |
51 // OptionsPageView overrides. | 56 // OptionsPageView overrides. |
52 virtual void InitControlLayout(); | 57 virtual void InitControlLayout(); |
53 | 58 |
54 // NotificationObserver overrides. | 59 // NotificationObserver overrides. |
55 virtual void Observe(NotificationType type, | 60 virtual void Observe(NotificationType type, |
56 const NotificationSource& source, | 61 const NotificationSource& source, |
57 const NotificationDetails& details); | 62 const NotificationDetails& details); |
58 | 63 |
59 private: | 64 private: |
60 // Updates the chewing checkboxes. | 65 // Updates the chewing checkboxes. |
61 void NotifyPrefChanged(); | 66 void NotifyPrefChanged(); |
62 | 67 |
63 BooleanPrefMember chewing_boolean_prefs_[kNumChewingBooleanPrefs]; | 68 BooleanPrefMember chewing_boolean_prefs_[kNumChewingBooleanPrefs]; |
| 69 IntegerPrefMember chewing_integer_prefs_[kNumChewingIntegerPrefs]; |
64 views::View* contents_; | 70 views::View* contents_; |
65 | 71 |
66 // Checkboxes for Chewing. | 72 // Checkboxes for Chewing. |
67 views::Checkbox* chewing_boolean_checkboxes_[kNumChewingBooleanPrefs]; | 73 views::Checkbox* chewing_boolean_checkboxes_[kNumChewingBooleanPrefs]; |
68 | 74 |
| 75 views::Slider* chewing_integer_sliders_[kNumChewingIntegerPrefs]; |
| 76 |
69 struct ChewingPrefAndAssociatedCombobox { | 77 struct ChewingPrefAndAssociatedCombobox { |
70 StringPrefMember multiple_choice_pref; | 78 StringPrefMember multiple_choice_pref; |
71 ChewingComboboxModel* combobox_model; | 79 ChewingComboboxModel* combobox_model; |
72 ChewingCombobox* combobox; | 80 ChewingCombobox* combobox; |
73 } prefs_and_comboboxes_[kNumChewingMultipleChoicePrefs]; | 81 } prefs_and_comboboxes_[kNumChewingMultipleChoicePrefs]; |
74 | 82 |
75 DISALLOW_COPY_AND_ASSIGN(LanguageChewingConfigView); | 83 DISALLOW_COPY_AND_ASSIGN(LanguageChewingConfigView); |
76 }; | 84 }; |
77 | 85 |
78 } // namespace chromeos | 86 } // namespace chromeos |
79 | 87 |
80 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_LANGUAGE_CHEWING_CONFIG_VIEW_H_ | 88 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_LANGUAGE_CHEWING_CONFIG_VIEW_H_ |
OLD | NEW |