1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
7 #ifndef PreXULSkeletonUI_h_
8 #define PreXULSkeletonUI_h_
11 #include "mozilla/EnumSet.h"
12 #include "mozilla/Maybe.h"
13 #include "mozilla/Result.h"
14 #include "mozilla/Types.h"
15 #include "mozilla/Vector.h"
19 // These unfortunately need to be kept in sync with the window style and
20 // extended window style computations in nsWindow. Luckily those styles seem
21 // to not vary based off of any user settings for the initial toplevel window,
22 // so we're safe here for now.
23 static const DWORD kPreXULSkeletonUIWindowStyle
=
24 WS_OVERLAPPED
| WS_CLIPCHILDREN
| WS_DLGFRAME
| WS_BORDER
| WS_THICKFRAME
|
25 WS_MAXIMIZEBOX
| WS_MINIMIZEBOX
| WS_SYSMENU
;
26 static const DWORD kPreXULSkeletonUIWindowStyleEx
= WS_EX_WINDOWEDGE
;
38 enum class SkeletonUIDensity
{ Default
, Touch
, Compact
};
40 struct SkeletonUISettings
{
45 CSSPixelSpan urlbarSpan
;
46 CSSPixelSpan searchbarSpan
;
47 double cssToDevPixelScaling
;
48 Vector
<CSSPixelSpan
> springs
;
51 bool bookmarksToolbarShown
;
54 SkeletonUIDensity uiDensity
;
57 enum class ThemeMode
: uint32_t { Invalid
, Default
, Dark
, Light
};
59 enum class SkeletonUIFlag
: uint8_t {
61 BookmarksToolbarShown
,
69 uint32_t backgroundColor
;
70 uint32_t toolbarForegroundColor
;
71 uint32_t titlebarColor
;
73 uint32_t tabOutlineColor
;
74 uint32_t chromeContentDividerColor
;
76 uint32_t urlbarBorderColor
;
77 uint32_t animationColor
;
80 enum class PreXULSkeletonUIError
: uint32_t {
83 EnabledKeyDoesNotExist
,
87 FailedToOpenRegistryKey
,
89 FailedLoadingDynamicProcs
,
92 NoStartWithLastProfile
,
93 FailedRegisteringWindowClass
,
96 FailedGettingMonitorInfo
,
100 FailedFillingBottomRect
,
106 enum class PreXULSkeletonUIProgress
: uint32_t {
111 MFBT_API
void CreateAndStorePreXULSkeletonUI(HINSTANCE hInstance
, int argc
,
113 MFBT_API
void CleanupProcessRuntime();
114 MFBT_API
bool GetPreXULSkeletonUIWasShown();
115 MFBT_API HWND
ConsumePreXULSkeletonUIHandle();
116 MFBT_API
bool WasPreXULSkeletonUIMaximized();
117 MFBT_API Result
<Ok
, PreXULSkeletonUIError
> PersistPreXULSkeletonUIValues(
118 const SkeletonUISettings
& settings
);
119 MFBT_API
bool GetPreXULSkeletonUIEnabled();
120 MFBT_API Result
<Ok
, PreXULSkeletonUIError
> SetPreXULSkeletonUIEnabledIfAllowed(
122 MFBT_API
void PollPreXULSkeletonUIEvents();
123 MFBT_API Result
<Ok
, PreXULSkeletonUIError
> SetPreXULSkeletonUIThemeId(
125 MFBT_API Result
<Ok
, PreXULSkeletonUIError
> NotePreXULSkeletonUIRestarting();
127 } // namespace mozilla