2008-07-17 10:19:10 -07:00
|
|
|
/* vim: se cin sw=2 ts=2 et : */
|
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
2012-05-21 04:12:37 -07:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2008-07-17 10:19:10 -07:00
|
|
|
|
2013-12-08 18:52:54 -08:00
|
|
|
#include "mozilla/ArrayUtils.h"
|
2013-11-21 19:35:42 -08:00
|
|
|
#include "mozilla/WindowsVersion.h"
|
2011-10-10 22:50:08 -07:00
|
|
|
|
2009-09-26 15:42:14 -07:00
|
|
|
#include "nsUXThemeData.h"
|
2008-07-17 10:19:10 -07:00
|
|
|
#include "nsDebug.h"
|
2012-01-04 02:21:44 -08:00
|
|
|
#include "nsToolkit.h"
|
2008-07-17 10:19:10 -07:00
|
|
|
#include "nsUXThemeConstants.h"
|
|
|
|
|
2011-09-08 19:27:12 -07:00
|
|
|
using namespace mozilla;
|
2012-01-04 02:21:44 -08:00
|
|
|
using namespace mozilla::widget;
|
2011-09-08 19:27:12 -07:00
|
|
|
|
2013-12-03 07:12:57 -08:00
|
|
|
const wchar_t
|
2008-09-27 15:40:34 -07:00
|
|
|
nsUXThemeData::kThemeLibraryName[] = L"uxtheme.dll";
|
2008-07-17 10:19:10 -07:00
|
|
|
|
|
|
|
HANDLE
|
|
|
|
nsUXThemeData::sThemes[eUXNumClasses];
|
|
|
|
|
|
|
|
HMODULE
|
2013-10-08 11:48:20 -07:00
|
|
|
nsUXThemeData::sThemeDLL = nullptr;
|
2008-07-17 10:19:10 -07:00
|
|
|
|
2012-02-23 06:53:55 -08:00
|
|
|
bool
|
|
|
|
nsUXThemeData::sFlatMenus = false;
|
2008-07-17 10:19:10 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool nsUXThemeData::sTitlebarInfoPopulatedAero = false;
|
|
|
|
bool nsUXThemeData::sTitlebarInfoPopulatedThemed = false;
|
2010-10-19 10:02:24 -07:00
|
|
|
SIZE nsUXThemeData::sCommandButtons[4];
|
2010-08-09 18:49:35 -07:00
|
|
|
|
2008-07-17 10:19:10 -07:00
|
|
|
void
|
|
|
|
nsUXThemeData::Teardown() {
|
|
|
|
Invalidate();
|
|
|
|
if(sThemeDLL)
|
|
|
|
FreeLibrary(sThemeDLL);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsUXThemeData::Initialize()
|
|
|
|
{
|
|
|
|
::ZeroMemory(sThemes, sizeof(sThemes));
|
|
|
|
NS_ASSERTION(!sThemeDLL, "nsUXThemeData being initialized twice!");
|
2010-08-14 00:05:03 -07:00
|
|
|
|
2013-08-14 21:25:12 -07:00
|
|
|
CheckForCompositor(true);
|
2008-07-21 12:55:31 -07:00
|
|
|
Invalidate();
|
2008-07-17 10:19:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsUXThemeData::Invalidate() {
|
|
|
|
for(int i = 0; i < eUXNumClasses; i++) {
|
|
|
|
if(sThemes[i]) {
|
2012-02-23 06:53:55 -08:00
|
|
|
CloseThemeData(sThemes[i]);
|
2013-10-08 11:48:20 -07:00
|
|
|
sThemes[i] = nullptr;
|
2008-07-17 10:19:10 -07:00
|
|
|
}
|
|
|
|
}
|
2012-02-23 06:53:55 -08:00
|
|
|
BOOL useFlat = FALSE;
|
2012-02-15 11:10:17 -08:00
|
|
|
sFlatMenus = ::SystemParametersInfo(SPI_GETFLATMENU, 0, &useFlat, 0) ?
|
|
|
|
useFlat : false;
|
2008-07-17 10:19:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
HANDLE
|
|
|
|
nsUXThemeData::GetTheme(nsUXThemeClass cls) {
|
|
|
|
NS_ASSERTION(cls < eUXNumClasses, "Invalid theme class!");
|
|
|
|
if(!sThemes[cls])
|
|
|
|
{
|
2013-10-08 11:48:20 -07:00
|
|
|
sThemes[cls] = OpenThemeData(nullptr, GetClassName(cls));
|
2008-07-17 10:19:10 -07:00
|
|
|
}
|
|
|
|
return sThemes[cls];
|
|
|
|
}
|
|
|
|
|
2010-08-14 00:05:03 -07:00
|
|
|
HMODULE
|
|
|
|
nsUXThemeData::GetThemeDLL() {
|
2012-02-15 11:10:17 -08:00
|
|
|
if (!sThemeDLL)
|
2010-08-14 00:05:03 -07:00
|
|
|
sThemeDLL = ::LoadLibraryW(kThemeLibraryName);
|
|
|
|
return sThemeDLL;
|
|
|
|
}
|
|
|
|
|
2008-07-17 10:19:10 -07:00
|
|
|
const wchar_t *nsUXThemeData::GetClassName(nsUXThemeClass cls) {
|
|
|
|
switch(cls) {
|
|
|
|
case eUXButton:
|
|
|
|
return L"Button";
|
|
|
|
case eUXEdit:
|
|
|
|
return L"Edit";
|
|
|
|
case eUXTooltip:
|
|
|
|
return L"Tooltip";
|
|
|
|
case eUXRebar:
|
|
|
|
return L"Rebar";
|
|
|
|
case eUXMediaRebar:
|
|
|
|
return L"Media::Rebar";
|
|
|
|
case eUXCommunicationsRebar:
|
|
|
|
return L"Communications::Rebar";
|
|
|
|
case eUXBrowserTabBarRebar:
|
|
|
|
return L"BrowserTabBar::Rebar";
|
|
|
|
case eUXToolbar:
|
|
|
|
return L"Toolbar";
|
|
|
|
case eUXMediaToolbar:
|
|
|
|
return L"Media::Toolbar";
|
|
|
|
case eUXCommunicationsToolbar:
|
|
|
|
return L"Communications::Toolbar";
|
|
|
|
case eUXProgress:
|
|
|
|
return L"Progress";
|
|
|
|
case eUXTab:
|
|
|
|
return L"Tab";
|
|
|
|
case eUXScrollbar:
|
|
|
|
return L"Scrollbar";
|
|
|
|
case eUXTrackbar:
|
|
|
|
return L"Trackbar";
|
|
|
|
case eUXSpin:
|
|
|
|
return L"Spin";
|
|
|
|
case eUXStatus:
|
|
|
|
return L"Status";
|
|
|
|
case eUXCombobox:
|
|
|
|
return L"Combobox";
|
|
|
|
case eUXHeader:
|
|
|
|
return L"Header";
|
|
|
|
case eUXListview:
|
|
|
|
return L"Listview";
|
|
|
|
case eUXMenu:
|
|
|
|
return L"Menu";
|
2010-08-09 18:49:35 -07:00
|
|
|
case eUXWindowFrame:
|
|
|
|
return L"Window";
|
2008-07-17 10:19:10 -07:00
|
|
|
default:
|
|
|
|
NS_NOTREACHED("unknown uxtheme class");
|
|
|
|
return L"";
|
|
|
|
}
|
|
|
|
}
|
2010-08-09 18:49:35 -07:00
|
|
|
|
|
|
|
// static
|
|
|
|
void
|
|
|
|
nsUXThemeData::InitTitlebarInfo()
|
|
|
|
{
|
|
|
|
// Pre-populate with generic metrics. These likley will not match
|
|
|
|
// the current theme, but they insure the buttons at least show up.
|
|
|
|
sCommandButtons[0].cx = GetSystemMetrics(SM_CXSIZE);
|
|
|
|
sCommandButtons[0].cy = GetSystemMetrics(SM_CYSIZE);
|
|
|
|
sCommandButtons[1].cx = sCommandButtons[2].cx = sCommandButtons[0].cx;
|
|
|
|
sCommandButtons[1].cy = sCommandButtons[2].cy = sCommandButtons[0].cy;
|
2010-10-19 10:02:24 -07:00
|
|
|
sCommandButtons[3].cx = sCommandButtons[0].cx * 3;
|
|
|
|
sCommandButtons[3].cy = sCommandButtons[0].cy;
|
2010-08-09 18:49:35 -07:00
|
|
|
|
2010-11-29 08:19:17 -08:00
|
|
|
// Use system metrics for pre-vista, otherwise trigger a
|
|
|
|
// refresh on the next layout.
|
|
|
|
sTitlebarInfoPopulatedAero = sTitlebarInfoPopulatedThemed =
|
2013-11-21 19:35:42 -08:00
|
|
|
!IsVistaOrLater();
|
2010-08-09 18:49:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
void
|
2010-08-09 18:49:35 -07:00
|
|
|
nsUXThemeData::UpdateTitlebarInfo(HWND aWnd)
|
2010-08-09 18:49:35 -07:00
|
|
|
{
|
2010-11-11 18:39:02 -08:00
|
|
|
if (!aWnd)
|
2010-08-09 18:49:35 -07:00
|
|
|
return;
|
|
|
|
|
2010-11-11 18:39:02 -08:00
|
|
|
if (!sTitlebarInfoPopulatedAero && nsUXThemeData::CheckForCompositor()) {
|
2010-10-19 10:02:24 -07:00
|
|
|
RECT captionButtons;
|
2013-08-14 21:25:12 -07:00
|
|
|
if (SUCCEEDED(WinUtils::dwmGetWindowAttributePtr(aWnd,
|
|
|
|
DWMWA_CAPTION_BUTTON_BOUNDS,
|
|
|
|
&captionButtons,
|
|
|
|
sizeof(captionButtons)))) {
|
2010-11-11 18:39:02 -08:00
|
|
|
sCommandButtons[CMDBUTTONIDX_BUTTONBOX].cx = captionButtons.right - captionButtons.left - 3;
|
|
|
|
sCommandButtons[CMDBUTTONIDX_BUTTONBOX].cy = (captionButtons.bottom - captionButtons.top) - 1;
|
2011-10-01 19:16:19 -07:00
|
|
|
sTitlebarInfoPopulatedAero = true;
|
2010-10-19 10:02:24 -07:00
|
|
|
}
|
2010-08-24 20:03:37 -07:00
|
|
|
}
|
|
|
|
|
2010-11-11 18:39:02 -08:00
|
|
|
if (sTitlebarInfoPopulatedThemed)
|
|
|
|
return;
|
|
|
|
|
2010-08-24 20:03:37 -07:00
|
|
|
// Query a temporary, visible window with command buttons to get
|
|
|
|
// the right metrics.
|
2010-11-08 01:06:13 -08:00
|
|
|
nsAutoString className;
|
|
|
|
className.AssignLiteral(kClassNameTemp);
|
2010-08-24 20:03:37 -07:00
|
|
|
WNDCLASSW wc;
|
|
|
|
wc.style = 0;
|
|
|
|
wc.lpfnWndProc = ::DefWindowProcW;
|
|
|
|
wc.cbClsExtra = 0;
|
|
|
|
wc.cbWndExtra = 0;
|
|
|
|
wc.hInstance = nsToolkit::mDllInstance;
|
2013-10-08 11:48:20 -07:00
|
|
|
wc.hIcon = nullptr;
|
|
|
|
wc.hCursor = nullptr;
|
|
|
|
wc.hbrBackground = nullptr;
|
|
|
|
wc.lpszMenuName = nullptr;
|
2010-11-08 01:06:13 -08:00
|
|
|
wc.lpszClassName = className.get();
|
2010-08-24 20:03:37 -07:00
|
|
|
::RegisterClassW(&wc);
|
|
|
|
|
2010-11-11 18:39:02 -08:00
|
|
|
// Create a transparent descendant of the window passed in. This
|
2010-08-24 20:03:37 -07:00
|
|
|
// keeps the window from showing up on the desktop or the taskbar.
|
|
|
|
// Note the parent (browser) window is usually still hidden, we
|
|
|
|
// don't want to display it, so we can't query it directly.
|
2010-11-11 18:39:02 -08:00
|
|
|
HWND hWnd = CreateWindowExW(WS_EX_LAYERED,
|
2010-11-08 01:06:13 -08:00
|
|
|
className.get(), L"",
|
2010-08-24 21:05:11 -07:00
|
|
|
WS_OVERLAPPEDWINDOW,
|
2013-10-08 11:48:20 -07:00
|
|
|
0, 0, 0, 0, aWnd, nullptr,
|
|
|
|
nsToolkit::mDllInstance, nullptr);
|
2010-08-24 20:03:37 -07:00
|
|
|
NS_ASSERTION(hWnd, "UpdateTitlebarInfo window creation failed.");
|
|
|
|
|
2010-11-11 18:39:02 -08:00
|
|
|
ShowWindow(hWnd, SW_SHOW);
|
2010-08-09 18:49:35 -07:00
|
|
|
TITLEBARINFOEX info = {0};
|
|
|
|
info.cbSize = sizeof(TITLEBARINFOEX);
|
2010-08-24 20:03:37 -07:00
|
|
|
SendMessage(hWnd, WM_GETTITLEBARINFOEX, 0, (LPARAM)&info);
|
|
|
|
DestroyWindow(hWnd);
|
2010-08-09 18:49:35 -07:00
|
|
|
|
2010-08-09 18:49:35 -07:00
|
|
|
// Only set if we have valid data for all three buttons we use.
|
|
|
|
if ((info.rgrect[2].right - info.rgrect[2].left) == 0 ||
|
|
|
|
(info.rgrect[3].right - info.rgrect[3].left) == 0 ||
|
2010-08-24 20:03:37 -07:00
|
|
|
(info.rgrect[5].right - info.rgrect[5].left) == 0) {
|
|
|
|
NS_WARNING("WM_GETTITLEBARINFOEX query failed to find usable metrics.");
|
2010-08-09 18:49:35 -07:00
|
|
|
return;
|
2010-08-24 20:03:37 -07:00
|
|
|
}
|
2010-08-09 18:49:35 -07:00
|
|
|
// minimize
|
|
|
|
sCommandButtons[0].cx = info.rgrect[2].right - info.rgrect[2].left;
|
|
|
|
sCommandButtons[0].cy = info.rgrect[2].bottom - info.rgrect[2].top;
|
|
|
|
// maximize/restore
|
|
|
|
sCommandButtons[1].cx = info.rgrect[3].right - info.rgrect[3].left;
|
|
|
|
sCommandButtons[1].cy = info.rgrect[3].bottom - info.rgrect[3].top;
|
|
|
|
// close
|
|
|
|
sCommandButtons[2].cx = info.rgrect[5].right - info.rgrect[5].left;
|
|
|
|
sCommandButtons[2].cy = info.rgrect[5].bottom - info.rgrect[5].top;
|
|
|
|
|
2011-10-01 19:16:19 -07:00
|
|
|
sTitlebarInfoPopulatedThemed = true;
|
2010-08-09 18:49:35 -07:00
|
|
|
}
|
2010-10-09 13:53:44 -07:00
|
|
|
|
|
|
|
// visual style (aero glass, aero basic)
|
|
|
|
// theme (aero, luna, zune)
|
|
|
|
// theme color (silver, olive, blue)
|
|
|
|
// system colors
|
|
|
|
|
|
|
|
struct THEMELIST {
|
|
|
|
LPCWSTR name;
|
|
|
|
int type;
|
|
|
|
};
|
|
|
|
|
|
|
|
const THEMELIST knownThemes[] = {
|
|
|
|
{ L"aero.msstyles", WINTHEME_AERO },
|
2013-06-13 15:41:26 -07:00
|
|
|
{ L"aerolite.msstyles", WINTHEME_AERO_LITE },
|
2010-10-09 13:53:44 -07:00
|
|
|
{ L"luna.msstyles", WINTHEME_LUNA },
|
|
|
|
{ L"zune.msstyles", WINTHEME_ZUNE },
|
|
|
|
{ L"royale.msstyles", WINTHEME_ROYALE }
|
|
|
|
};
|
|
|
|
|
|
|
|
const THEMELIST knownColors[] = {
|
|
|
|
{ L"normalcolor", WINTHEMECOLOR_NORMAL },
|
|
|
|
{ L"homestead", WINTHEMECOLOR_HOMESTEAD },
|
|
|
|
{ L"metallic", WINTHEMECOLOR_METALLIC }
|
|
|
|
};
|
|
|
|
|
2011-09-08 19:27:12 -07:00
|
|
|
LookAndFeel::WindowsTheme
|
|
|
|
nsUXThemeData::sThemeId = LookAndFeel::eWindowsTheme_Generic;
|
2010-10-09 13:53:44 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool
|
2011-10-01 19:16:19 -07:00
|
|
|
nsUXThemeData::sIsDefaultWindowsTheme = false;
|
2014-03-28 15:13:10 -07:00
|
|
|
bool
|
|
|
|
nsUXThemeData::sIsHighContrastOn = false;
|
2010-10-09 13:53:44 -07:00
|
|
|
|
|
|
|
// static
|
2011-09-08 19:27:12 -07:00
|
|
|
LookAndFeel::WindowsTheme
|
2010-10-09 13:53:44 -07:00
|
|
|
nsUXThemeData::GetNativeThemeId()
|
|
|
|
{
|
|
|
|
return sThemeId;
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
2011-09-28 23:19:26 -07:00
|
|
|
bool nsUXThemeData::IsDefaultWindowTheme()
|
2010-10-09 13:53:44 -07:00
|
|
|
{
|
|
|
|
return sIsDefaultWindowsTheme;
|
|
|
|
}
|
|
|
|
|
2014-03-28 15:13:10 -07:00
|
|
|
bool nsUXThemeData::IsHighContrastOn()
|
|
|
|
{
|
|
|
|
return sIsHighContrastOn;
|
|
|
|
}
|
|
|
|
|
2013-08-14 21:25:12 -07:00
|
|
|
// static
|
|
|
|
bool nsUXThemeData::CheckForCompositor(bool aUpdateCache)
|
|
|
|
{
|
|
|
|
static BOOL sCachedValue = FALSE;
|
|
|
|
if (aUpdateCache && WinUtils::dwmIsCompositionEnabledPtr) {
|
|
|
|
WinUtils::dwmIsCompositionEnabledPtr(&sCachedValue);
|
|
|
|
}
|
|
|
|
return sCachedValue;
|
|
|
|
}
|
|
|
|
|
2010-10-09 13:53:44 -07:00
|
|
|
// static
|
|
|
|
void
|
|
|
|
nsUXThemeData::UpdateNativeThemeInfo()
|
|
|
|
{
|
2010-11-14 09:34:13 -08:00
|
|
|
// Trigger a refresh of themed button metrics if needed
|
2013-11-21 19:35:42 -08:00
|
|
|
sTitlebarInfoPopulatedThemed = !IsVistaOrLater();
|
2010-11-11 18:39:02 -08:00
|
|
|
|
2011-10-01 19:16:19 -07:00
|
|
|
sIsDefaultWindowsTheme = false;
|
2011-09-08 19:27:12 -07:00
|
|
|
sThemeId = LookAndFeel::eWindowsTheme_Generic;
|
2010-10-09 13:53:44 -07:00
|
|
|
|
2014-03-28 15:13:10 -07:00
|
|
|
HIGHCONTRAST highContrastInfo;
|
|
|
|
highContrastInfo.cbSize = sizeof(HIGHCONTRAST);
|
|
|
|
if (SystemParametersInfo(SPI_GETHIGHCONTRAST, 0, &highContrastInfo, 0)) {
|
|
|
|
sIsHighContrastOn = ((highContrastInfo.dwFlags & HCF_HIGHCONTRASTON) != 0);
|
|
|
|
} else {
|
|
|
|
sIsHighContrastOn = false;
|
|
|
|
}
|
|
|
|
|
2014-07-24 06:28:00 -07:00
|
|
|
if (!IsAppThemed()) {
|
|
|
|
sThemeId = LookAndFeel::eWindowsTheme_Classic;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-10-09 13:53:44 -07:00
|
|
|
WCHAR themeFileName[MAX_PATH + 1];
|
|
|
|
WCHAR themeColor[MAX_PATH + 1];
|
2012-02-23 06:53:55 -08:00
|
|
|
if (FAILED(GetCurrentThemeName(themeFileName,
|
2010-10-09 13:53:44 -07:00
|
|
|
MAX_PATH,
|
|
|
|
themeColor,
|
|
|
|
MAX_PATH,
|
2013-10-08 11:48:20 -07:00
|
|
|
nullptr, 0))) {
|
2011-09-08 19:27:12 -07:00
|
|
|
sThemeId = LookAndFeel::eWindowsTheme_Classic;
|
2010-10-09 13:53:44 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
LPCWSTR themeName = wcsrchr(themeFileName, L'\\');
|
|
|
|
themeName = themeName ? themeName + 1 : themeFileName;
|
|
|
|
|
|
|
|
WindowsTheme theme = WINTHEME_UNRECOGNIZED;
|
2013-11-04 16:12:31 -08:00
|
|
|
for (size_t i = 0; i < ArrayLength(knownThemes); ++i) {
|
2010-10-09 13:53:44 -07:00
|
|
|
if (!lstrcmpiW(themeName, knownThemes[i].name)) {
|
|
|
|
theme = (WindowsTheme)knownThemes[i].type;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (theme == WINTHEME_UNRECOGNIZED)
|
|
|
|
return;
|
|
|
|
|
2014-03-28 15:13:10 -07:00
|
|
|
// We're using the default theme if we're using any of Aero, Aero Lite, or
|
|
|
|
// luna. However, on Win8, GetCurrentThemeName (see above) returns
|
|
|
|
// AeroLite.msstyles for the 4 builtin highcontrast themes as well. Those
|
|
|
|
// themes "don't count" as default themes, so we specifically check for high
|
|
|
|
// contrast mode in that situation.
|
|
|
|
if (!(IsWin8OrLater() && sIsHighContrastOn) &&
|
|
|
|
(theme == WINTHEME_AERO || theme == WINTHEME_AERO_LITE || theme == WINTHEME_LUNA)) {
|
2011-10-01 19:16:19 -07:00
|
|
|
sIsDefaultWindowsTheme = true;
|
2014-03-28 15:13:10 -07:00
|
|
|
}
|
|
|
|
|
2010-10-09 13:53:44 -07:00
|
|
|
if (theme != WINTHEME_LUNA) {
|
|
|
|
switch(theme) {
|
|
|
|
case WINTHEME_AERO:
|
2011-09-08 19:27:12 -07:00
|
|
|
sThemeId = LookAndFeel::eWindowsTheme_Aero;
|
2010-10-09 13:53:44 -07:00
|
|
|
return;
|
2013-06-13 15:41:26 -07:00
|
|
|
case WINTHEME_AERO_LITE:
|
|
|
|
sThemeId = LookAndFeel::eWindowsTheme_AeroLite;
|
|
|
|
return;
|
2010-10-09 13:53:44 -07:00
|
|
|
case WINTHEME_ZUNE:
|
2011-09-08 19:27:12 -07:00
|
|
|
sThemeId = LookAndFeel::eWindowsTheme_Zune;
|
2010-10-09 13:53:44 -07:00
|
|
|
return;
|
|
|
|
case WINTHEME_ROYALE:
|
2011-09-08 19:27:12 -07:00
|
|
|
sThemeId = LookAndFeel::eWindowsTheme_Royale;
|
2010-10-09 13:53:44 -07:00
|
|
|
return;
|
|
|
|
default:
|
|
|
|
NS_WARNING("unhandled theme type.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// calculate the luna color scheme
|
|
|
|
WindowsThemeColor color = WINTHEMECOLOR_UNRECOGNIZED;
|
2013-11-04 16:12:31 -08:00
|
|
|
for (size_t i = 0; i < ArrayLength(knownColors); ++i) {
|
2010-10-09 13:53:44 -07:00
|
|
|
if (!lstrcmpiW(themeColor, knownColors[i].name)) {
|
|
|
|
color = (WindowsThemeColor)knownColors[i].type;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(color) {
|
|
|
|
case WINTHEMECOLOR_NORMAL:
|
2011-09-08 19:27:12 -07:00
|
|
|
sThemeId = LookAndFeel::eWindowsTheme_LunaBlue;
|
2010-10-09 13:53:44 -07:00
|
|
|
return;
|
|
|
|
case WINTHEMECOLOR_HOMESTEAD:
|
2011-09-08 19:27:12 -07:00
|
|
|
sThemeId = LookAndFeel::eWindowsTheme_LunaOlive;
|
2010-10-09 13:53:44 -07:00
|
|
|
return;
|
|
|
|
case WINTHEMECOLOR_METALLIC:
|
2011-09-08 19:27:12 -07:00
|
|
|
sThemeId = LookAndFeel::eWindowsTheme_LunaSilver;
|
2010-10-09 13:53:44 -07:00
|
|
|
return;
|
|
|
|
default:
|
|
|
|
NS_WARNING("unhandled theme color.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|