|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* vim:expandtab:shiftwidth=2:tabstop=2: |
|
3 */ |
|
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/. */ |
|
7 |
|
8 #ifndef nsWinUtils_h_ |
|
9 #define nsWinUtils_h_ |
|
10 |
|
11 #include <windows.h> |
|
12 |
|
13 #include "nsIDOMCSSStyleDeclaration.h" |
|
14 #include "nsCOMPtr.h" |
|
15 #include "nsRefPtrHashtable.h" |
|
16 |
|
17 class nsIArray; |
|
18 class nsIContent; |
|
19 |
|
20 namespace mozilla { |
|
21 namespace a11y { |
|
22 |
|
23 class DocAccessible; |
|
24 |
|
25 const LPCWSTR kClassNameRoot = L"MozillaUIWindowClass"; |
|
26 const LPCWSTR kClassNameTabContent = L"MozillaContentWindowClass"; |
|
27 |
|
28 class nsWinUtils |
|
29 { |
|
30 public: |
|
31 /** |
|
32 * Return computed styles declaration for the given node. |
|
33 * |
|
34 * @note Please use it carefully since it can shutdown the accessible tree |
|
35 * you operate on. |
|
36 */ |
|
37 static already_AddRefed<nsIDOMCSSStyleDeclaration> |
|
38 GetComputedStyleDeclaration(nsIContent* aContent); |
|
39 |
|
40 /** |
|
41 * Start window emulation if presence of specific AT is detected. |
|
42 */ |
|
43 static bool MaybeStartWindowEmulation(); |
|
44 |
|
45 /** |
|
46 * Free resources used for window emulation. |
|
47 */ |
|
48 static void ShutdownWindowEmulation(); |
|
49 |
|
50 /** |
|
51 * Return true if window emulation is started. |
|
52 */ |
|
53 static bool IsWindowEmulationStarted(); |
|
54 |
|
55 /** |
|
56 * Helper to register window class. |
|
57 */ |
|
58 static void RegisterNativeWindow(LPCWSTR aWindowClass); |
|
59 |
|
60 /** |
|
61 * Helper to create a window. |
|
62 */ |
|
63 static HWND CreateNativeWindow(LPCWSTR aWindowClass, HWND aParentWnd, |
|
64 int aX, int aY, int aWidth, int aHeight, |
|
65 bool aIsActive); |
|
66 |
|
67 /** |
|
68 * Helper to show window. |
|
69 */ |
|
70 static void ShowNativeWindow(HWND aWnd); |
|
71 |
|
72 /** |
|
73 * Helper to hide window. |
|
74 */ |
|
75 static void HideNativeWindow(HWND aWnd); |
|
76 |
|
77 /** |
|
78 * Cache for HWNDs of windows created for document accessibles in windows |
|
79 * emulation mode. |
|
80 */ |
|
81 static nsRefPtrHashtable<nsPtrHashKey<void>, DocAccessible>* sHWNDCache; |
|
82 }; |
|
83 |
|
84 } // namespace a11y |
|
85 } // namespace mozilla |
|
86 |
|
87 #endif |