/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
class nsCocoaWindow; class nsChildView; class nsMenuBarX;
@class ChildView;
namespace mozilla { enumclass NativeKeyBindingsType : uint8_t;
} // namespace mozilla
// NSWindow subclass that is the base class for all of our own window classes. // Among other things, this class handles the storage of those settings that // need to be persisted across window destruction and reconstruction, i.e. when // switching to and from fullscreen mode. // We don't save shadow, transparency mode or background color because it's not // worth the hassle - Gecko will reset them anyway as soon as the window is // resized.
@interface BaseWindow : NSWindow { // Data Storage
NSMutableDictionary* mState; BOOL mDrawsIntoWindowFrame;
// These two methods are like contentRectForFrameRect and // frameRectForContentRect, but they deal with the rect of the window's "main // ChildView" instead of the rect of the window's content view. The two are // sometimes sized differently: The window's content view always covers the // entire window, whereas the ChildView only covers the full window when // drawsContentsIntoWindowFrame is YES. When drawsContentsIntoWindowFrame is NO, // there's a titlebar-sized gap above the ChildView within the content view.
- (NSRect)childViewRectForFrameRect:(NSRect)aFrameRect;
- (NSRect)frameRectForChildViewRect:(NSRect)aChildViewRect;
// Returns an autoreleased NSArray containing the NSViews that we consider the // "contents" of this window. All views in the returned array are subviews of // this window's content view. However, the array may not include all of the // content view's subviews; concretely, the ToolbarWindow implementation will // exclude its MOZTitlebarView from the array that is returned here. // In the vast majority of cases, the array will only have a single element: // this window's mainChildView.
- (NSArray<NSView*>*)contentViewContents;
// Present in the same form on OS X since at least OS X 10.5.
- (NSRect)contentRectForFrameRect:(NSRect)windowFrame
styleMask:(NSUInteger)windowStyle;
- (NSRect)frameRectForContentRect:(NSRect)windowContentRect
styleMask:(NSUInteger)windowStyle;
// Present since at least OS X 10.5. The OS calls this method on NSWindow // (and its subclasses) to find out which NSFrameView subclass to instantiate // to create its "frame view".
+ (Class)frameViewClassForStyleMask:(NSUInteger)styleMask;
// NSWindow subclass for handling windows with toolbars.
@interface ToolbarWindow : BaseWindow { // mFullscreenTitlebarTracker attaches an invisible rectangle to the system // title bar. This allows us to detect when the title bar is showing in // fullscreen.
FullscreenTitlebarTracker* mFullscreenTitlebarTracker;
// be notified that a some form of drag event needs to go into Gecko bool DragEvent(unsignedint aMessage, mozilla::gfx::Point aMouseGlobal,
UInt16 aKeyModifiers);
// Called when something has happened that might cause us to update our // fullscreen state. Returns true if we updated state. We'll call this // on window resize, and we'll call it when we enter or exit fullscreen, // since fullscreen to-and-from zoomed windows won't necessarily trigger // a resize. bool HandleUpdateFullscreenOnResize();
BaseWindow* mWindow; // our cocoa window [STRONG]
BaseWindow* mClosedRetainedWindow; // a second strong reference to our // window upon closing it, held through our destructor. This is useful // to ensure that macOS run loops which reference the window will still // have something to point to even if they don't use proper retain and // release patterns.
WindowDelegate*
mDelegate; // our delegate for processing window msgs [STRONG]
RefPtr<nsMenuBarX> mMenuBar;
nsChildView*
mPopupContentView; // if this is a popup, this is its content widget // if this is a toplevel window, and there is any ongoing fullscreen // transition, it is the animation object.
NSAnimation* mFullscreenTransitionAnimation;
mozilla::WindowShadow mShadowStyle;
bool mWindowMadeHere; // true if we created the window, false for embedding
nsSizeMode mSizeMode; bool mInFullScreenMode; // Whether we are currently using native fullscreen. It could be false because // we are in the emulated fullscreen where we do not use the native // fullscreen. bool mInNativeFullScreenMode;
// A runnable we might assign to run ProcessTransitions at a later event loop. // Cancelable so we can cancel it in CancelAllTransitions(), if needed.
RefPtr<mozilla::CancelableRunnable> mProcessTransitionsPending;
// Sometimes we add a transition that wasn't requested by a caller. We do this // to manage transitions between states that otherwise would be rejected by // Cocoa. When we do this, it's useful to know when we are handling an added // transition because we don't want to send size mode events when they // execute. bool mIsTransitionCurrentAdded = false;
// Whether we are treating the next resize as the start of a fullscreen // transition. If we are, which direction are we going: Fullscreen or // Windowed.
mozilla::Maybe<TransitionType> mUpdateFullscreenOnResize;
// Call this to stop all transition processing, which is useful during // window closing and shutdown. void CancelAllTransitions();
bool mInProcessTransitions = false;
// While running an emulated fullscreen transition, we want to suppress // sending size mode events due to window resizing. We fix it up at the end // when the transition is complete. bool mSuppressSizeModeEvents = false;
// Ignore occlusion events caused by displaying the temporary fullscreen // window during the fullscreen transition animation because only focused // contexts are permitted to enter DOM fullscreen. int mIgnoreOcclusionCount;
// Set to true when a native fullscreen transition is initiated -- either to // or from fullscreen -- and set to false when it is complete. During this // period, we presume the window is visible, which prevents us from sending // unnecessary OcclusionStateChanged events. bool mHasStartedNativeFullscreen;
bool mInReportMoveEvent = false; // true if in a call to ReportMoveEvent(). bool mInResize = false; // true if in a call to DoResize(). bool mWindowTransformIsIdentity = true; bool mAlwaysOnTop = false; bool mAspectRatioLocked = false; bool mIsAlert = false; // True if this is an non-native alert window. bool mWasShown = false;
private: // This is class state for tracking which nsCocoaWindow, if any, is in the // middle of a native fullscreen transition. static nsCocoaWindow* sWindowInNativeTransition;
// This function returns true if the caller has been able to claim the sole // permission to start a native transition. It must be followed by a call // to EndOurNativeTransition() when the native transition is complete. bool CanStartNativeTransition(); void EndOurNativeTransition();
};
#endif// nsCocoaWindow_h_
¤ Dauer der Verarbeitung: 0.34 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.