Bug 1692971 [wpt PR 27638] - WebKit export of https://bugs.webkit.org/show_bug.cgi...
[gecko.git] / widget / nsWidgetInitData.h
blobacda84ef7e7abf1d0fd66f5c69097698ae0113e2
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/. */
6 #ifndef nsWidgetInitData_h__
7 #define nsWidgetInitData_h__
9 /**
10 * Window types
12 * Don't alter previously encoded enum values - 3rd party apps may look at
13 * these.
15 enum nsWindowType {
16 eWindowType_toplevel, // default top level window
17 eWindowType_dialog, // top level window but usually handled differently
18 // by the OS
19 eWindowType_sheet, // MacOSX sheet (special dialog class)
20 eWindowType_popup, // used for combo boxes, etc
21 eWindowType_child, // child windows (contained inside a window on the
22 // desktop (has no border))
23 eWindowType_invisible, // windows that are invisible or offscreen
24 eWindowType_plugin, // plugin window
25 eWindowType_plugin_ipc_chrome, // chrome side native widget for plugins
26 // (e10s)
27 eWindowType_plugin_ipc_content, // content side puppet widget for plugins
28 // (e10s)
31 /**
32 * Popup types
34 * For eWindowType_popup
36 enum nsPopupType {
37 ePopupTypePanel,
38 ePopupTypeMenu,
39 ePopupTypeTooltip,
40 ePopupTypeAny = 0xF000 // used only to pass to
41 // nsXULPopupManager::GetTopPopup
44 /**
45 * Popup levels specify the window ordering behaviour.
47 enum nsPopupLevel {
48 // the popup appears just above its parent and maintains its position
49 // relative to the parent
50 ePopupLevelParent,
51 // the popup is a floating popup used for tool palettes. A parent window
52 // must be specified, but a platform implementation need not use this.
53 // On Windows, floating is generally equivalent to parent. On Mac, floating
54 // puts the popup at toplevel, but it will hide when the application is
55 // deactivated
56 ePopupLevelFloating,
57 // the popup appears on top of other windows, including those of other
58 // applications
59 ePopupLevelTop
62 /**
63 * Border styles
65 enum nsBorderStyle {
66 eBorderStyle_none = 0, // no border, titlebar, etc.. opposite of
67 // all
68 eBorderStyle_all = 1 << 0, // all window decorations
69 eBorderStyle_border = 1 << 1, // enables the border on the window. these
70 // are only for decoration and are not
71 // resize handles
72 eBorderStyle_resizeh = 1 << 2, // enables the resize handles for the
73 // window. if this is set, border is
74 // implied to also be set
75 eBorderStyle_title = 1 << 3, // enables the titlebar for the window
76 eBorderStyle_menu = 1 << 4, // enables the window menu button on the
77 // title bar. this being on should force
78 // the title bar to display
79 eBorderStyle_minimize = 1 << 5, // enables the minimize button so the user
80 // can minimize the window. turned off for
81 // tranient windows since they can not be
82 // minimized separate from their parent
83 eBorderStyle_maximize = 1 << 6, // enables the maxmize button so the user
84 // can maximize the window
85 eBorderStyle_close = 1 << 7, // show the close button
86 eBorderStyle_default = -1 // whatever the OS wants... i.e. don't do
87 // anything
90 /**
91 * Basic struct for widget initialization data.
92 * @see Create member function of nsIWidget
95 struct nsWidgetInitData {
96 nsWidgetInitData()
97 : mWindowType(eWindowType_child),
98 mBorderStyle(eBorderStyle_default),
99 mPopupHint(ePopupTypePanel),
100 mPopupLevel(ePopupLevelTop),
101 mScreenId(0),
102 clipChildren(false),
103 clipSiblings(false),
104 mDropShadow(false),
105 mListenForResizes(false),
106 mRTL(false),
107 mNoAutoHide(false),
108 mIsDragPopup(false),
109 mIsAnimationSuppressed(false),
110 mSupportTranslucency(false),
111 mMouseTransparent(false),
112 mHasRemoteContent(false),
113 mAlwaysOnTop(false),
114 mPIPWindow(false),
115 mFissionWindow(false),
116 mResizable(false) {}
118 nsWindowType mWindowType;
119 nsBorderStyle mBorderStyle;
120 nsPopupType mPopupHint;
121 nsPopupLevel mPopupLevel;
122 // B2G multi-screen support. Screen ID is for differentiating screens of
123 // windows, and due to the hardware limitation, it is platform-specific for
124 // now, which align with the value of display type defined in HWC.
125 uint32_t mScreenId;
126 // when painting exclude area occupied by child windows and sibling windows
127 bool clipChildren, clipSiblings, mDropShadow;
128 bool mListenForResizes;
129 bool mRTL;
130 bool mNoAutoHide; // true for noautohide panels
131 bool mIsDragPopup; // true for drag feedback panels
132 // true if window creation animation is suppressed, e.g. for session restore
133 bool mIsAnimationSuppressed;
134 // true if the window should support an alpha channel, if available.
135 bool mSupportTranslucency;
136 // true if the window should be transparent to mouse events. Currently this is
137 // only valid for eWindowType_popup widgets
138 bool mMouseTransparent;
139 bool mHasRemoteContent;
140 bool mAlwaysOnTop;
141 // Is PictureInPicture window
142 bool mPIPWindow;
143 // True if fission is enabled for this window
144 bool mFissionWindow;
145 // True if the window is user-resizable.
146 bool mResizable;
149 #endif // nsWidgetInitData_h__