nsWidgetInitData.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /* -*- Mode: C++; tab-width: 40; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef nsWidgetInitData_h__
  6. #define nsWidgetInitData_h__
  7. /**
  8. * Window types
  9. *
  10. * Don't alter previously encoded enum values - 3rd party apps may look at
  11. * these.
  12. */
  13. enum nsWindowType {
  14. eWindowType_toplevel, // default top level window
  15. eWindowType_dialog, // top level window but usually handled differently
  16. // by the OS
  17. eWindowType_popup, // used for combo boxes, etc
  18. eWindowType_child, // child windows (contained inside a window on the
  19. // desktop (has no border))
  20. eWindowType_invisible, // windows that are invisible or offscreen
  21. eWindowType_plugin, // plugin window
  22. eWindowType_plugin_ipc_chrome, // chrome side native widget for plugins (e10s)
  23. eWindowType_plugin_ipc_content, // content side puppet widget for plugins (e10s)
  24. eWindowType_sheet, // MacOSX sheet (special dialog class)
  25. };
  26. /**
  27. * Popup types
  28. *
  29. * For eWindowType_popup
  30. */
  31. enum nsPopupType {
  32. ePopupTypePanel,
  33. ePopupTypeMenu,
  34. ePopupTypeTooltip,
  35. ePopupTypeAny = 0xF000 // used only to pass to
  36. // nsXULPopupManager::GetTopPopup
  37. };
  38. /**
  39. * Popup levels specify the window ordering behaviour.
  40. */
  41. enum nsPopupLevel {
  42. // the popup appears just above its parent and maintains its position
  43. // relative to the parent
  44. ePopupLevelParent,
  45. // the popup is a floating popup used for tool palettes. A parent window
  46. // must be specified, but a platform implementation need not use this.
  47. // On Windows, floating is generally equivalent to parent. On Mac, floating
  48. // puts the popup at toplevel, but it will hide when the application is deactivated
  49. ePopupLevelFloating,
  50. // the popup appears on top of other windows, including those of other applications
  51. ePopupLevelTop
  52. };
  53. /**
  54. * Border styles
  55. */
  56. enum nsBorderStyle {
  57. eBorderStyle_none = 0, // no border, titlebar, etc.. opposite of
  58. // all
  59. eBorderStyle_all = 1 << 0, // all window decorations
  60. eBorderStyle_border = 1 << 1, // enables the border on the window. these
  61. // are only for decoration and are not
  62. // resize handles
  63. eBorderStyle_resizeh = 1 << 2, // enables the resize handles for the
  64. // window. if this is set, border is
  65. // implied to also be set
  66. eBorderStyle_title = 1 << 3, // enables the titlebar for the window
  67. eBorderStyle_menu = 1 << 4, // enables the window menu button on the
  68. // title bar. this being on should force
  69. // the title bar to display
  70. eBorderStyle_minimize = 1 << 5, // enables the minimize button so the user
  71. // can minimize the window. turned off for
  72. // tranient windows since they can not be
  73. // minimized separate from their parent
  74. eBorderStyle_maximize = 1 << 6, // enables the maxmize button so the user
  75. // can maximize the window
  76. eBorderStyle_close = 1 << 7, // show the close button
  77. eBorderStyle_default = -1 // whatever the OS wants... i.e. don't do
  78. // anything
  79. };
  80. /**
  81. * Basic struct for widget initialization data.
  82. * @see Create member function of nsIWidget
  83. */
  84. struct nsWidgetInitData {
  85. nsWidgetInitData() :
  86. mWindowType(eWindowType_child),
  87. mBorderStyle(eBorderStyle_default),
  88. mPopupHint(ePopupTypePanel),
  89. mPopupLevel(ePopupLevelTop),
  90. mScreenId(0),
  91. clipChildren(false),
  92. clipSiblings(false),
  93. mDropShadow(false),
  94. mListenForResizes(false),
  95. mUnicode(true),
  96. mRTL(false),
  97. mNoAutoHide(false),
  98. mIsDragPopup(false),
  99. mIsAnimationSuppressed(false),
  100. mSupportTranslucency(false),
  101. mMouseTransparent(false)
  102. {
  103. }
  104. nsWindowType mWindowType;
  105. nsBorderStyle mBorderStyle;
  106. nsPopupType mPopupHint;
  107. nsPopupLevel mPopupLevel;
  108. // B2G multi-screen support. Screen ID is for differentiating screens of
  109. // windows, and due to the hardware limitation, it is platform-specific for
  110. // now, which align with the value of display type defined in HWC.
  111. uint32_t mScreenId;
  112. // when painting exclude area occupied by child windows and sibling windows
  113. bool clipChildren, clipSiblings, mDropShadow;
  114. bool mListenForResizes;
  115. bool mUnicode;
  116. bool mRTL;
  117. bool mNoAutoHide; // true for noautohide panels
  118. bool mIsDragPopup; // true for drag feedback panels
  119. // true if window creation animation is suppressed, e.g. for session restore
  120. bool mIsAnimationSuppressed;
  121. // true if the window should support an alpha channel, if available.
  122. bool mSupportTranslucency;
  123. // true if the window should be transparent to mouse events. Currently this is
  124. // only valid for eWindowType_popup widgets
  125. bool mMouseTransparent;
  126. };
  127. #endif // nsWidgetInitData_h__