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