2008-07-17 21:19:10 +04: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 15:12:37 +04: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/. */
|
2010-03-18 01:56:00 +03:00
|
|
|
#ifndef __UXThemeData_h__
|
|
|
|
#define __UXThemeData_h__
|
2008-08-14 19:48:06 +04:00
|
|
|
#include <windows.h>
|
2010-03-05 01:52:58 +03:00
|
|
|
#include <uxtheme.h>
|
|
|
|
|
2008-07-17 21:19:10 +04:00
|
|
|
#include "nscore.h"
|
2011-09-09 06:27:12 +04:00
|
|
|
#include "mozilla/LookAndFeel.h"
|
2013-08-15 08:25:12 +04:00
|
|
|
#include "WinUtils.h"
|
2008-07-17 21:19:10 +04:00
|
|
|
|
2009-09-27 02:42:14 +04:00
|
|
|
#include <dwmapi.h>
|
|
|
|
|
2010-08-10 05:49:35 +04:00
|
|
|
#include "nsWindowDefs.h"
|
|
|
|
|
2009-09-27 02:42:14 +04:00
|
|
|
// These window messages are not defined in dwmapi.h
|
2008-08-13 04:44:14 +04:00
|
|
|
#ifndef WM_DWMCOMPOSITIONCHANGED
|
|
|
|
#define WM_DWMCOMPOSITIONCHANGED 0x031E
|
|
|
|
#endif
|
|
|
|
|
2009-09-27 02:42:14 +04:00
|
|
|
// Windows 7 additions
|
|
|
|
#ifndef WM_DWMSENDICONICTHUMBNAIL
|
|
|
|
#define WM_DWMSENDICONICTHUMBNAIL 0x0323
|
|
|
|
#define WM_DWMSENDICONICLIVEPREVIEWBITMAP 0x0326
|
|
|
|
#endif
|
|
|
|
|
2009-10-06 06:26:54 +04:00
|
|
|
#define DWMWA_FORCE_ICONIC_REPRESENTATION 7
|
|
|
|
#define DWMWA_HAS_ICONIC_BITMAP 10
|
|
|
|
|
2008-07-17 21:19:10 +04:00
|
|
|
enum nsUXThemeClass {
|
|
|
|
eUXButton = 0,
|
|
|
|
eUXEdit,
|
|
|
|
eUXTooltip,
|
|
|
|
eUXRebar,
|
|
|
|
eUXMediaRebar,
|
|
|
|
eUXCommunicationsRebar,
|
|
|
|
eUXBrowserTabBarRebar,
|
|
|
|
eUXToolbar,
|
|
|
|
eUXMediaToolbar,
|
|
|
|
eUXCommunicationsToolbar,
|
|
|
|
eUXProgress,
|
|
|
|
eUXTab,
|
|
|
|
eUXScrollbar,
|
|
|
|
eUXTrackbar,
|
|
|
|
eUXSpin,
|
|
|
|
eUXStatus,
|
|
|
|
eUXCombobox,
|
|
|
|
eUXHeader,
|
|
|
|
eUXListview,
|
|
|
|
eUXMenu,
|
2010-08-10 05:49:35 +04:00
|
|
|
eUXWindowFrame,
|
2008-07-17 21:19:10 +04:00
|
|
|
eUXNumClasses
|
|
|
|
};
|
|
|
|
|
2010-10-10 00:53:44 +04:00
|
|
|
// Native windows style constants
|
|
|
|
enum WindowsTheme {
|
|
|
|
WINTHEME_UNRECOGNIZED = 0,
|
|
|
|
WINTHEME_CLASSIC = 1, // no theme
|
|
|
|
WINTHEME_AERO = 2,
|
|
|
|
WINTHEME_LUNA = 3,
|
|
|
|
WINTHEME_ROYALE = 4,
|
2013-06-14 02:41:26 +04:00
|
|
|
WINTHEME_ZUNE = 5,
|
|
|
|
WINTHEME_AERO_LITE = 6
|
2010-10-10 00:53:44 +04:00
|
|
|
};
|
|
|
|
enum WindowsThemeColor {
|
|
|
|
WINTHEMECOLOR_UNRECOGNIZED = 0,
|
|
|
|
WINTHEMECOLOR_NORMAL = 1,
|
|
|
|
WINTHEMECOLOR_HOMESTEAD = 2,
|
|
|
|
WINTHEMECOLOR_METALLIC = 3
|
|
|
|
};
|
|
|
|
|
2010-10-19 21:02:24 +04:00
|
|
|
#define CMDBUTTONIDX_MINIMIZE 0
|
|
|
|
#define CMDBUTTONIDX_RESTORE 1
|
|
|
|
#define CMDBUTTONIDX_CLOSE 2
|
|
|
|
#define CMDBUTTONIDX_BUTTONBOX 3
|
2008-07-17 21:19:10 +04:00
|
|
|
|
|
|
|
class nsUXThemeData {
|
|
|
|
static HMODULE sThemeDLL;
|
|
|
|
static HANDLE sThemes[eUXNumClasses];
|
|
|
|
|
|
|
|
static const wchar_t *GetClassName(nsUXThemeClass);
|
|
|
|
|
|
|
|
public:
|
2013-12-03 19:12:57 +04:00
|
|
|
static const wchar_t kThemeLibraryName[];
|
2012-02-23 18:53:55 +04:00
|
|
|
static bool sFlatMenus;
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool sTitlebarInfoPopulatedAero;
|
|
|
|
static bool sTitlebarInfoPopulatedThemed;
|
2010-10-19 21:02:24 +04:00
|
|
|
static SIZE sCommandButtons[4];
|
2011-09-09 06:27:12 +04:00
|
|
|
static mozilla::LookAndFeel::WindowsTheme sThemeId;
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool sIsDefaultWindowsTheme;
|
2014-03-29 02:13:10 +04:00
|
|
|
static bool sIsHighContrastOn;
|
2010-08-10 05:49:35 +04:00
|
|
|
|
2008-07-17 21:19:10 +04:00
|
|
|
static void Initialize();
|
|
|
|
static void Teardown();
|
|
|
|
static void Invalidate();
|
|
|
|
static HANDLE GetTheme(nsUXThemeClass cls);
|
2010-08-14 11:05:03 +04:00
|
|
|
static HMODULE GetThemeDLL();
|
2008-07-17 21:19:10 +04:00
|
|
|
|
2010-08-10 05:49:35 +04:00
|
|
|
// nsWindow calls this to update desktop settings info
|
|
|
|
static void InitTitlebarInfo();
|
2010-08-10 05:49:35 +04:00
|
|
|
static void UpdateTitlebarInfo(HWND aWnd);
|
2010-08-10 05:49:35 +04:00
|
|
|
|
2010-10-10 00:53:44 +04:00
|
|
|
static void UpdateNativeThemeInfo();
|
2011-09-09 06:27:12 +04:00
|
|
|
static mozilla::LookAndFeel::WindowsTheme GetNativeThemeId();
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool IsDefaultWindowTheme();
|
2014-03-29 02:13:10 +04:00
|
|
|
static bool IsHighContrastOn();
|
2010-10-10 00:53:44 +04:00
|
|
|
|
2010-11-18 05:31:22 +03:00
|
|
|
// This method returns the cached compositor state. Most
|
|
|
|
// callers should call without the argument. The cache
|
|
|
|
// should be modified only when the application receives
|
|
|
|
// WM_DWMCOMPOSITIONCHANGED. This rule prevents inconsistent
|
|
|
|
// results for two or more calls which check the state during
|
|
|
|
// composition transition.
|
2013-08-15 08:25:12 +04:00
|
|
|
static bool CheckForCompositor(bool aUpdateCache = false);
|
2008-07-17 21:19:10 +04:00
|
|
|
};
|
2010-03-18 01:56:00 +03:00
|
|
|
#endif // __UXThemeData_h__
|