nsWinUtils.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. #ifndef nsWinUtils_h_
  8. #define nsWinUtils_h_
  9. #include <windows.h>
  10. #include "nsIDOMCSSStyleDeclaration.h"
  11. #include "nsCOMPtr.h"
  12. class nsIContent;
  13. namespace mozilla {
  14. namespace a11y {
  15. class DocAccessible;
  16. const LPCWSTR kClassNameRoot = L"MozillaUIWindowClass";
  17. const LPCWSTR kClassNameTabContent = L"MozillaContentWindowClass";
  18. const LPCWSTR kPropNameDocAcc = L"MozDocAccessible";
  19. class nsWinUtils
  20. {
  21. public:
  22. /**
  23. * Return computed styles declaration for the given node.
  24. *
  25. * @note Please use it carefully since it can shutdown the accessible tree
  26. * you operate on.
  27. */
  28. static already_AddRefed<nsIDOMCSSStyleDeclaration>
  29. GetComputedStyleDeclaration(nsIContent* aContent);
  30. /**
  31. * Start window emulation if presence of specific AT is detected.
  32. */
  33. static bool MaybeStartWindowEmulation();
  34. /**
  35. * Free resources used for window emulation.
  36. */
  37. static void ShutdownWindowEmulation();
  38. /**
  39. * Return true if window emulation is started.
  40. */
  41. static bool IsWindowEmulationStarted() { return sWindowEmulationStarted; }
  42. /**
  43. * Helper to register window class.
  44. */
  45. static void RegisterNativeWindow(LPCWSTR aWindowClass);
  46. /**
  47. * Helper to create a window.
  48. */
  49. static HWND CreateNativeWindow(LPCWSTR aWindowClass, HWND aParentWnd,
  50. int aX, int aY, int aWidth, int aHeight,
  51. bool aIsActive);
  52. /**
  53. * Helper to show window.
  54. */
  55. static void ShowNativeWindow(HWND aWnd);
  56. /**
  57. * Helper to hide window.
  58. */
  59. static void HideNativeWindow(HWND aWnd);
  60. private:
  61. /**
  62. * Flag that indicates if window emulation is started.
  63. */
  64. static bool sWindowEmulationStarted;
  65. };
  66. } // namespace a11y
  67. } // namespace mozilla
  68. #endif