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_FONTS_PAGE_VIEW_H_ | |
6 #define CHROME_BROWSER_UI_VIEWS_OPTIONS_FONTS_PAGE_VIEW_H_ | |
7 #pragma once | |
8 | |
9 #include <string> | |
10 | |
11 #include "chrome/browser/prefs/pref_member.h" | |
12 #include "chrome/browser/ui/shell_dialogs.h" | |
13 #include "chrome/browser/ui/views/options/options_page_view.h" | |
14 #include "views/controls/combobox/combobox.h" | |
15 #include "views/controls/button/button.h" | |
16 #include "views/view.h" | |
17 | |
18 class DefaultEncodingComboboxModel; | |
19 class FontDisplayView; | |
20 | |
21 namespace views { | |
22 class GroupboxView; | |
23 class Label; | |
24 class NativeButton; | |
25 class TableView; | |
26 } | |
27 | |
28 /////////////////////////////////////////////////////////////////////////////// | |
29 // FontsPageView | |
30 | |
31 class FontsPageView : public OptionsPageView, | |
32 public views::Combobox::Listener, | |
33 public SelectFontDialog::Listener, | |
34 public views::ButtonListener { | |
35 public: | |
36 explicit FontsPageView(Profile* profile); | |
37 | |
38 // views::ButtonListener implementation: | |
39 virtual void ButtonPressed(views::Button* sender, const views::Event& event); | |
40 | |
41 // views::Combobox::Listener implementation: | |
42 virtual void ItemChanged(views::Combobox* combo_box, | |
43 int prev_index, | |
44 int new_index); | |
45 | |
46 // SelectFontDialog::Listener implementation: | |
47 virtual void FontSelected(const gfx::Font& font, void* params); | |
48 | |
49 // Save Changes made to relevent pref members associated with this tab. | |
50 // This is public since it is called by FontsLanguageWindowView in its | |
51 // Dialog Delegate Accept() method. | |
52 void SaveChanges(); | |
53 | |
54 protected: | |
55 // OptionsPageView implementation: | |
56 virtual void InitControlLayout(); | |
57 virtual void NotifyPrefChanged(const std::string* pref_name); | |
58 | |
59 private: | |
60 enum FontTypeBeingChanged { | |
61 NONE, | |
62 SERIF, | |
63 SANS_SERIF, | |
64 FIXED_WIDTH | |
65 }; | |
66 | |
67 virtual ~FontsPageView(); | |
68 | |
69 // Init Dialog controls. | |
70 void InitFontLayout(); | |
71 void InitEncodingLayout(); | |
72 | |
73 bool serif_button_pressed_; | |
74 bool sans_serif_button_pressed_; | |
75 bool fixed_width_button_pressed_; | |
76 bool encoding_dropdown_clicked_; | |
77 | |
78 views::Label* fonts_group_title_; | |
79 views::Label* encoding_group_title_; | |
80 | |
81 views::View* fonts_contents_; | |
82 views::View* encoding_contents_; | |
83 | |
84 // Fonts settings. | |
85 // Select Font dialogs. | |
86 scoped_refptr<SelectFontDialog> select_font_dialog_; | |
87 | |
88 // Buttons. | |
89 views::NativeButton* fixed_width_font_change_page_button_; | |
90 views::NativeButton* serif_font_change_page_button_; | |
91 views::NativeButton* sans_serif_font_change_page_button_; | |
92 | |
93 // FontDisplayView objects to display selected font. | |
94 FontDisplayView* fixed_width_font_display_view_; | |
95 FontDisplayView* serif_font_display_view_; | |
96 FontDisplayView* sans_serif_font_display_view_; | |
97 | |
98 // Labels to describe what is to be changed. | |
99 views::Label* fixed_width_font_label_; | |
100 views::Label* serif_font_label_; | |
101 views::Label* sans_serif_font_label_; | |
102 | |
103 // Advanced Font names and sizes as PrefMembers. | |
104 StringPrefMember serif_name_; | |
105 StringPrefMember sans_serif_name_; | |
106 StringPrefMember fixed_width_name_; | |
107 IntegerPrefMember serif_size_; | |
108 IntegerPrefMember sans_serif_size_; | |
109 IntegerPrefMember fixed_width_size_; | |
110 int serif_font_size_pixel_; | |
111 int sans_serif_font_size_pixel_; | |
112 int fixed_width_font_size_pixel_; | |
113 StringPrefMember default_encoding_; | |
114 bool font_changed_; | |
115 | |
116 // Windows font picker flag; | |
117 FontTypeBeingChanged font_type_being_changed_; | |
118 | |
119 // Default Encoding. | |
120 scoped_ptr<DefaultEncodingComboboxModel> default_encoding_combobox_model_; | |
121 views::Label* default_encoding_combobox_label_; | |
122 views::Combobox* default_encoding_combobox_; | |
123 std::string default_encoding_selected_; | |
124 bool default_encoding_changed_; | |
125 | |
126 DISALLOW_COPY_AND_ASSIGN(FontsPageView); | |
127 }; | |
128 | |
129 #endif // CHROME_BROWSER_UI_VIEWS_OPTIONS_FONTS_PAGE_VIEW_H_ | |
OLD | NEW |