1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:expandtab:shiftwidth=2:tabstop=2:
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
14 #include "nsICSSDeclaration.h"
24 const LPCWSTR kClassNameRoot
= L
"MozillaUIWindowClass";
25 const LPCWSTR kClassNameTabContent
= L
"MozillaContentWindowClass";
26 const LPCWSTR kPropNameDocAcc
= L
"MozDocAccessible";
27 const LPCWSTR kPropNameDocAccParent
= L
"MozDocAccessibleParent";
32 * Return computed styles declaration for the given node.
34 * @note Please use it carefully since it can shutdown the accessible tree
37 static already_AddRefed
<nsICSSDeclaration
> GetComputedStyleDeclaration(
38 nsIContent
* aContent
);
41 * Start window emulation if presence of specific AT is detected.
43 static bool MaybeStartWindowEmulation();
46 * Free resources used for window emulation.
48 static void ShutdownWindowEmulation();
51 * Return true if window emulation is started.
53 static bool IsWindowEmulationStarted() { return sWindowEmulationStarted
; }
56 * Helper to register window class.
58 static void RegisterNativeWindow(LPCWSTR aWindowClass
);
60 typedef std::function
<void(HWND
)> NativeWindowCreateProc
;
63 * Helper to create a window.
65 * NB: If additional setup needs to be done once the window has been created,
66 * you should do so via aOnCreateProc. Hooks will fire during the
67 * CreateNativeWindow call, thus triggering events in the AT.
68 * Using aOnCreateProc guarantees that your additional initialization will
69 * have completed prior to the AT receiving window creation events.
73 * nsWinUtils::NativeWindowCreateProc onCreate([](HWND aHwnd) -> void {
74 * DoSomeAwesomeInitializationStuff(aHwnd);
75 * DoMoreAwesomeInitializationStuff(aHwnd);
77 * HWND hwnd = nsWinUtils::CreateNativeWindow(..., &onCreate);
78 * // Doing further initialization work to hwnd on this line is too late!
80 static HWND
CreateNativeWindow(
81 LPCWSTR aWindowClass
, HWND aParentWnd
, int aX
, int aY
, int aWidth
,
82 int aHeight
, bool aIsActive
,
83 NativeWindowCreateProc
* aOnCreateProc
= nullptr);
86 * Helper to show window.
88 static void ShowNativeWindow(HWND aWnd
);
91 * Helper to hide window.
93 static void HideNativeWindow(HWND aWnd
);
97 * Flag that indicates if window emulation is started.
99 static bool sWindowEmulationStarted
;
103 } // namespace mozilla