1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/src/windows/msaa/nsWinUtils.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,87 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim:expandtab:shiftwidth=2:tabstop=2: 1.6 + */ 1.7 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.8 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.9 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.10 + 1.11 +#ifndef nsWinUtils_h_ 1.12 +#define nsWinUtils_h_ 1.13 + 1.14 +#include <windows.h> 1.15 + 1.16 +#include "nsIDOMCSSStyleDeclaration.h" 1.17 +#include "nsCOMPtr.h" 1.18 +#include "nsRefPtrHashtable.h" 1.19 + 1.20 +class nsIArray; 1.21 +class nsIContent; 1.22 + 1.23 +namespace mozilla { 1.24 +namespace a11y { 1.25 + 1.26 +class DocAccessible; 1.27 + 1.28 +const LPCWSTR kClassNameRoot = L"MozillaUIWindowClass"; 1.29 +const LPCWSTR kClassNameTabContent = L"MozillaContentWindowClass"; 1.30 + 1.31 +class nsWinUtils 1.32 +{ 1.33 +public: 1.34 + /** 1.35 + * Return computed styles declaration for the given node. 1.36 + * 1.37 + * @note Please use it carefully since it can shutdown the accessible tree 1.38 + * you operate on. 1.39 + */ 1.40 + static already_AddRefed<nsIDOMCSSStyleDeclaration> 1.41 + GetComputedStyleDeclaration(nsIContent* aContent); 1.42 + 1.43 + /** 1.44 + * Start window emulation if presence of specific AT is detected. 1.45 + */ 1.46 + static bool MaybeStartWindowEmulation(); 1.47 + 1.48 + /** 1.49 + * Free resources used for window emulation. 1.50 + */ 1.51 + static void ShutdownWindowEmulation(); 1.52 + 1.53 + /** 1.54 + * Return true if window emulation is started. 1.55 + */ 1.56 + static bool IsWindowEmulationStarted(); 1.57 + 1.58 + /** 1.59 + * Helper to register window class. 1.60 + */ 1.61 + static void RegisterNativeWindow(LPCWSTR aWindowClass); 1.62 + 1.63 + /** 1.64 + * Helper to create a window. 1.65 + */ 1.66 + static HWND CreateNativeWindow(LPCWSTR aWindowClass, HWND aParentWnd, 1.67 + int aX, int aY, int aWidth, int aHeight, 1.68 + bool aIsActive); 1.69 + 1.70 + /** 1.71 + * Helper to show window. 1.72 + */ 1.73 + static void ShowNativeWindow(HWND aWnd); 1.74 + 1.75 + /** 1.76 + * Helper to hide window. 1.77 + */ 1.78 + static void HideNativeWindow(HWND aWnd); 1.79 + 1.80 + /** 1.81 + * Cache for HWNDs of windows created for document accessibles in windows 1.82 + * emulation mode. 1.83 + */ 1.84 + static nsRefPtrHashtable<nsPtrHashKey<void>, DocAccessible>* sHWNDCache; 1.85 +}; 1.86 + 1.87 +} // namespace a11y 1.88 +} // namespace mozilla 1.89 + 1.90 +#endif