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/. */
|
2010-03-17 15:56:00 -07:00
|
|
|
#ifndef __UXThemeData_h__
|
|
|
|
#define __UXThemeData_h__
|
2008-08-14 08:48:06 -07:00
|
|
|
#include <windows.h>
|
2010-03-04 14:52:58 -08:00
|
|
|
#include <uxtheme.h>
|
|
|
|
|
2008-07-17 10:19:10 -07:00
|
|
|
#include "nscore.h"
|
2011-09-08 19:27:12 -07:00
|
|
|
#include "mozilla/LookAndFeel.h"
|
2013-08-14 21:25:12 -07:00
|
|
|
#include "WinUtils.h"
|
2008-07-17 10:19:10 -07:00
|
|
|
|
2009-09-26 15:42:14 -07:00
|
|
|
#include <dwmapi.h>
|
|
|
|
|
2010-08-09 18:49:35 -07:00
|
|
|
#include "nsWindowDefs.h"
|
|
|
|
|
2009-09-26 15:42:14 -07:00
|
|
|
// These window messages are not defined in dwmapi.h
|
2008-08-12 17:44:14 -07:00
|
|
|
#ifndef WM_DWMCOMPOSITIONCHANGED
|
|
|
|
#define WM_DWMCOMPOSITIONCHANGED 0x031E
|
|
|
|
#endif
|
|
|
|
|
2009-09-26 15:42:14 -07:00
|
|
|
// Windows 7 additions
|
|
|
|
#ifndef WM_DWMSENDICONICTHUMBNAIL
|
|
|
|
#define WM_DWMSENDICONICTHUMBNAIL 0x0323
|
|
|
|
#define WM_DWMSENDICONICLIVEPREVIEWBITMAP 0x0326
|
|
|
|
#endif
|
|
|
|
|
2009-10-05 19:26:54 -07:00
|
|
|
#define DWMWA_FORCE_ICONIC_REPRESENTATION 7
|
|
|
|
#define DWMWA_HAS_ICONIC_BITMAP 10
|
|
|
|
|
2008-07-17 10:19:10 -07: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-09 18:49:35 -07:00
|
|
|
eUXWindowFrame,
|
2008-07-17 10:19:10 -07:00
|
|
|
eUXNumClasses
|
|
|
|
};
|
|
|
|
|
2010-10-09 13:53:44 -07: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-13 15:41:26 -07:00
|
|
|
WINTHEME_ZUNE = 5,
|
|
|
|
WINTHEME_AERO_LITE = 6
|
2010-10-09 13:53:44 -07:00
|
|
|
};
|
|
|
|
enum WindowsThemeColor {
|
|
|
|
WINTHEMECOLOR_UNRECOGNIZED = 0,
|
|
|
|
WINTHEMECOLOR_NORMAL = 1,
|
|
|
|
WINTHEMECOLOR_HOMESTEAD = 2,
|
|
|
|
WINTHEMECOLOR_METALLIC = 3
|
|
|
|
};
|
|
|
|
|
2010-10-19 10:02:24 -07:00
|
|
|
#define CMDBUTTONIDX_MINIMIZE 0
|
|
|
|
#define CMDBUTTONIDX_RESTORE 1
|
|
|
|
#define CMDBUTTONIDX_CLOSE 2
|
|
|
|
#define CMDBUTTONIDX_BUTTONBOX 3
|
2008-07-17 10:19:10 -07:00
|
|
|
|
|
|
|
class nsUXThemeData {
|
|
|
|
static HMODULE sThemeDLL;
|
|
|
|
static HANDLE sThemes[eUXNumClasses];
|
|
|
|
|
|
|
|
static const wchar_t *GetClassName(nsUXThemeClass);
|
|
|
|
|
|
|
|
public:
|
2008-09-27 15:40:34 -07:00
|
|
|
static const PRUnichar kThemeLibraryName[];
|
2012-02-23 06:53:55 -08:00
|
|
|
static bool sFlatMenus;
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool sTitlebarInfoPopulatedAero;
|
|
|
|
static bool sTitlebarInfoPopulatedThemed;
|
2010-10-19 10:02:24 -07:00
|
|
|
static SIZE sCommandButtons[4];
|
2011-09-08 19:27:12 -07:00
|
|
|
static mozilla::LookAndFeel::WindowsTheme sThemeId;
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool sIsDefaultWindowsTheme;
|
2010-08-09 18:49:35 -07:00
|
|
|
|
2008-07-17 10:19:10 -07:00
|
|
|
static void Initialize();
|
|
|
|
static void Teardown();
|
|
|
|
static void Invalidate();
|
|
|
|
static HANDLE GetTheme(nsUXThemeClass cls);
|
2010-08-14 00:05:03 -07:00
|
|
|
static HMODULE GetThemeDLL();
|
2008-07-17 10:19:10 -07:00
|
|
|
|
2010-08-09 18:49:35 -07:00
|
|
|
// nsWindow calls this to update desktop settings info
|
|
|
|
static void InitTitlebarInfo();
|
2010-08-09 18:49:35 -07:00
|
|
|
static void UpdateTitlebarInfo(HWND aWnd);
|
2010-08-09 18:49:35 -07:00
|
|
|
|
2010-10-09 13:53:44 -07:00
|
|
|
static void UpdateNativeThemeInfo();
|
2011-09-08 19:27:12 -07:00
|
|
|
static mozilla::LookAndFeel::WindowsTheme GetNativeThemeId();
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool IsDefaultWindowTheme();
|
2010-10-09 13:53:44 -07:00
|
|
|
|
2010-11-17 18:31:22 -08: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-14 21:25:12 -07:00
|
|
|
static bool CheckForCompositor(bool aUpdateCache = false);
|
2008-07-17 10:19:10 -07:00
|
|
|
};
|
2010-03-17 15:56:00 -07:00
|
|
|
#endif // __UXThemeData_h__
|