OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include <windows.h> | 4 #include <windows.h> |
5 #include <shlobj.h> | 5 #include <shlobj.h> |
6 #include <vsstyle.h> | 6 #include <vsstyle.h> |
7 #include <vssym32.h> | 7 #include <vssym32.h> |
8 | 8 |
9 #include "chrome/browser/views/options/fonts_page_view.h" | 9 #include "chrome/browser/views/options/fonts_page_view.h" |
10 | 10 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 int font_size); | 90 int font_size); |
91 | 91 |
92 void SetFontType(ChromeFont font); | 92 void SetFontType(ChromeFont font); |
93 | 93 |
94 std::wstring font_name() { return font_name_; } | 94 std::wstring font_name() { return font_name_; } |
95 int font_size() { return font_size_; } | 95 int font_size() { return font_size_; } |
96 | 96 |
97 // ChromeViews::View overrides: | 97 // ChromeViews::View overrides: |
98 virtual void Paint(ChromeCanvas* canvas); | 98 virtual void Paint(ChromeCanvas* canvas); |
99 virtual void Layout(); | 99 virtual void Layout(); |
100 virtual void GetPreferredSize(CSize* out); | 100 virtual gfx::Size GetPreferredSize(); |
101 | 101 |
102 private: | 102 private: |
103 ChromeViews::Label* font_text_label_; | 103 ChromeViews::Label* font_text_label_; |
104 std::wstring font_name_; | 104 std::wstring font_name_; |
105 int font_size_; | 105 int font_size_; |
106 std::wstring font_text_label_string_; | 106 std::wstring font_text_label_string_; |
107 | 107 |
108 static const int kFontDisplayMaxWidthChars = 50; | 108 static const int kFontDisplayMaxWidthChars = 50; |
109 static const int kFontDisplayMaxHeightChars = 1; | 109 static const int kFontDisplayMaxHeightChars = 1; |
110 static const int kFontDisplayLabelPadding = 5; | 110 static const int kFontDisplayLabelPadding = 5; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 gfx::NativeTheme::instance()->PaintTextField( | 162 gfx::NativeTheme::instance()->PaintTextField( |
163 dc, EP_BACKGROUND, EBS_NORMAL, 0, &rect, ::GetSysColor(COLOR_3DFACE), | 163 dc, EP_BACKGROUND, EBS_NORMAL, 0, &rect, ::GetSysColor(COLOR_3DFACE), |
164 true, true); | 164 true, true); |
165 canvas->endPlatformPaint(); | 165 canvas->endPlatformPaint(); |
166 } | 166 } |
167 | 167 |
168 void FontDisplayView::Layout() { | 168 void FontDisplayView::Layout() { |
169 font_text_label_->SetBounds(0, 0, width(), height()); | 169 font_text_label_->SetBounds(0, 0, width(), height()); |
170 } | 170 } |
171 | 171 |
172 void FontDisplayView::GetPreferredSize(CSize* out) { | 172 gfx::Size FontDisplayView::GetPreferredSize() { |
173 DCHECK(out); | |
174 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 173 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
175 ChromeFont font = rb.GetFont(ResourceBundle::BaseFont); | 174 ChromeFont font = rb.GetFont(ResourceBundle::BaseFont); |
176 out->cx = font.ave_char_width() * kFontDisplayMaxWidthChars; | 175 return gfx::Size(font.ave_char_width() * kFontDisplayMaxWidthChars, |
177 out->cy = font.height() * kFontDisplayMaxHeightChars | 176 font.height() * kFontDisplayMaxHeightChars |
178 + 2 * kFontDisplayLabelPadding; | 177 + 2 * kFontDisplayLabelPadding); |
179 } | 178 } |
180 | 179 |
181 void EmbellishTitle(ChromeViews::Label* title_label) { | 180 void EmbellishTitle(ChromeViews::Label* title_label) { |
182 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 181 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
183 ChromeFont title_font = | 182 ChromeFont title_font = |
184 rb.GetFont(ResourceBundle::BaseFont).DeriveFont(0, ChromeFont::BOLD); | 183 rb.GetFont(ResourceBundle::BaseFont).DeriveFont(0, ChromeFont::BOLD); |
185 title_label->SetFont(title_font); | 184 title_label->SetFont(title_font); |
186 SkColor title_color = | 185 SkColor title_color = |
187 gfx::NativeTheme::instance()->GetThemeColorWithDefault( | 186 gfx::NativeTheme::instance()->GetThemeColorWithDefault( |
188 gfx::NativeTheme::BUTTON, BP_GROUPBOX, GBS_NORMAL, TMT_TEXTCOLOR, | 187 gfx::NativeTheme::BUTTON, BP_GROUPBOX, GBS_NORMAL, TMT_TEXTCOLOR, |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, | 475 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, |
477 GridLayout::USE_PREF, 0, 0); | 476 GridLayout::USE_PREF, 0, 0); |
478 | 477 |
479 // Add Encoding ComboBox. | 478 // Add Encoding ComboBox. |
480 layout->StartRow(0, double_column_view_set_id); | 479 layout->StartRow(0, double_column_view_set_id); |
481 layout->AddView(default_encoding_combobox_label_); | 480 layout->AddView(default_encoding_combobox_label_); |
482 layout->AddView(default_encoding_combobox_, 1, 1, GridLayout::FILL, | 481 layout->AddView(default_encoding_combobox_, 1, 1, GridLayout::FILL, |
483 GridLayout::CENTER); | 482 GridLayout::CENTER); |
484 } | 483 } |
485 | 484 |
OLD | NEW |