| 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 #include "views/controls/menu/menu_config.h" | 5 #include "views/controls/menu/menu_config.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <uxtheme.h> | 8 #include <uxtheme.h> |
| 9 #include <Vssym32.h> | 9 #include <Vssym32.h> |
| 10 | 10 |
| 11 #include "app/l10n_util_win.h" | 11 #include "app/l10n_util_win.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/win_util.h" | 13 #include "base/win_util.h" |
| 14 #include "gfx/native_theme_win.h" | 14 #include "gfx/native_theme_win.h" |
| 15 | 15 |
| 16 using gfx::NativeTheme; | 16 using gfx::NativeTheme; |
| 17 | 17 |
| 18 namespace views { | 18 namespace views { |
| 19 | 19 |
| 20 // static | 20 // static |
| 21 MenuConfig* MenuConfig::Create() { | 21 MenuConfig* MenuConfig::Create() { |
| 22 MenuConfig* config = new MenuConfig(); | 22 MenuConfig* config = new MenuConfig(); |
| 23 |
| 24 config->text_color = NativeTheme::instance()->GetThemeColorWithDefault( |
| 25 NativeTheme::MENU, MENU_POPUPITEM, MPI_NORMAL, TMT_TEXTCOLOR, |
| 26 COLOR_MENUTEXT); |
| 27 |
| 23 NONCLIENTMETRICS metrics; | 28 NONCLIENTMETRICS metrics; |
| 24 win_util::GetNonClientMetrics(&metrics); | 29 win_util::GetNonClientMetrics(&metrics); |
| 25 l10n_util::AdjustUIFont(&(metrics.lfMenuFont)); | 30 l10n_util::AdjustUIFont(&(metrics.lfMenuFont)); |
| 26 HFONT font = CreateFontIndirect(&metrics.lfMenuFont); | 31 HFONT font = CreateFontIndirect(&metrics.lfMenuFont); |
| 27 DLOG_ASSERT(font); | 32 DLOG_ASSERT(font); |
| 28 config->font = gfx::Font::CreateFont(font); | 33 config->font = gfx::Font::CreateFont(font); |
| 29 config->font_with_controls = config->font.DeriveFont(0, gfx::Font::BOLD); | |
| 30 | 34 |
| 31 HDC dc = GetDC(NULL); | 35 HDC dc = GetDC(NULL); |
| 32 RECT bounds = { 0, 0, 200, 200 }; | 36 RECT bounds = { 0, 0, 200, 200 }; |
| 33 SIZE check_size; | 37 SIZE check_size; |
| 34 if (NativeTheme::instance()->GetThemePartSize( | 38 if (NativeTheme::instance()->GetThemePartSize( |
| 35 NativeTheme::MENU, dc, MENU_POPUPCHECK, MC_CHECKMARKNORMAL, &bounds, | 39 NativeTheme::MENU, dc, MENU_POPUPCHECK, MC_CHECKMARKNORMAL, &bounds, |
| 36 TS_TRUE, &check_size) == S_OK) { | 40 TS_TRUE, &check_size) == S_OK) { |
| 37 config->check_width = check_size.cx; | 41 config->check_width = check_size.cx; |
| 38 config->check_height = check_size.cy; | 42 config->check_height = check_size.cy; |
| 39 } else { | 43 } else { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 ReleaseDC(NULL, dc); | 80 ReleaseDC(NULL, dc); |
| 77 | 81 |
| 78 BOOL show_cues; | 82 BOOL show_cues; |
| 79 config->show_mnemonics = | 83 config->show_mnemonics = |
| 80 (SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &show_cues, 0) && | 84 (SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &show_cues, 0) && |
| 81 show_cues == TRUE); | 85 show_cues == TRUE); |
| 82 return config; | 86 return config; |
| 83 } | 87 } |
| 84 | 88 |
| 85 } // namespace views | 89 } // namespace views |
| OLD | NEW |