2006-07-25 22:51:41 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* 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/. */
|
2007-01-18 09:34:07 +03:00
|
|
|
|
|
|
|
#ifndef nsCocoaWindow_h_
|
|
|
|
#define nsCocoaWindow_h_
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2002-12-13 11:43:18 +03:00
|
|
|
#undef DARWIN
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2005-10-08 03:31:45 +04:00
|
|
|
#import <Cocoa/Cocoa.h>
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2016-04-19 13:28:12 +03:00
|
|
|
#include "mozilla/RefPtr.h"
|
2001-11-06 18:35:24 +03:00
|
|
|
#include "nsBaseWidget.h"
|
2006-05-17 22:53:58 +04:00
|
|
|
#include "nsPIWidgetCocoa.h"
|
2009-08-14 10:35:32 +04:00
|
|
|
#include "nsCocoaUtils.h"
|
2001-11-06 18:35:24 +03:00
|
|
|
|
|
|
|
class nsCocoaWindow;
|
2006-07-25 22:51:41 +04:00
|
|
|
class nsChildView;
|
2008-06-28 11:55:30 +04:00
|
|
|
class nsMenuBarX;
|
2013-02-06 01:40:34 +04:00
|
|
|
@class ChildView;
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2008-03-24 01:30:56 +03:00
|
|
|
typedef struct _nsCocoaWindowList {
|
2013-11-11 23:17:14 +04:00
|
|
|
_nsCocoaWindowList() : prev(nullptr), window(nullptr) {}
|
2008-03-24 01:30:56 +03:00
|
|
|
struct _nsCocoaWindowList *prev;
|
|
|
|
nsCocoaWindow *window; // Weak
|
|
|
|
} nsCocoaWindowList;
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2009-11-02 22:07:57 +03:00
|
|
|
// NSWindow subclass that is the base class for all of our own window classes.
|
2009-12-12 00:53:22 +03:00
|
|
|
// 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.
|
2009-11-02 22:07:57 +03:00
|
|
|
// 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
|
|
|
|
{
|
2009-12-12 00:53:22 +03:00
|
|
|
// Data Storage
|
2009-11-02 22:07:57 +03:00
|
|
|
NSMutableDictionary* mState;
|
|
|
|
BOOL mDrawsIntoWindowFrame;
|
|
|
|
NSColor* mActiveTitlebarColor;
|
|
|
|
NSColor* mInactiveTitlebarColor;
|
2009-12-12 00:53:22 +03:00
|
|
|
|
|
|
|
// Shadow
|
|
|
|
BOOL mScheduledShadowInvalidation;
|
2010-08-19 13:35:08 +04:00
|
|
|
|
2014-01-08 13:37:59 +04:00
|
|
|
// Invalidation disabling
|
|
|
|
BOOL mDisabledNeedsDisplay;
|
|
|
|
|
2010-08-19 13:35:08 +04:00
|
|
|
// DPI cache. Getting the physical screen size (CGDisplayScreenSize)
|
|
|
|
// is ridiculously slow, so we cache it in the toplevel window for all
|
|
|
|
// descendants to use.
|
|
|
|
float mDPI;
|
2011-08-08 18:43:13 +04:00
|
|
|
|
|
|
|
NSTrackingArea* mTrackingArea;
|
2013-10-09 18:39:22 +04:00
|
|
|
|
2014-11-07 21:11:48 +03:00
|
|
|
NSRect mDirtyRect;
|
|
|
|
|
2013-10-09 18:39:22 +04:00
|
|
|
BOOL mBeingShown;
|
2013-12-17 20:11:13 +04:00
|
|
|
BOOL mDrawTitle;
|
2014-11-04 06:14:10 +03:00
|
|
|
BOOL mBrightTitlebarForeground;
|
2015-02-05 01:25:19 +03:00
|
|
|
BOOL mUseMenuStyle;
|
2009-11-02 22:07:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)importState:(NSDictionary*)aState;
|
|
|
|
- (NSMutableDictionary*)exportState;
|
|
|
|
- (void)setDrawsContentsIntoWindowFrame:(BOOL)aState;
|
|
|
|
- (BOOL)drawsContentsIntoWindowFrame;
|
|
|
|
- (void)setTitlebarColor:(NSColor*)aColor forActiveWindow:(BOOL)aActive;
|
|
|
|
- (NSColor*)titlebarColorForActiveWindow:(BOOL)aActive;
|
|
|
|
|
2009-12-12 00:53:22 +03:00
|
|
|
- (void)deferredInvalidateShadow;
|
|
|
|
- (void)invalidateShadow;
|
2010-08-19 13:35:08 +04:00
|
|
|
- (float)getDPI;
|
2009-12-12 00:53:22 +03:00
|
|
|
|
2011-08-08 18:43:13 +04:00
|
|
|
- (void)mouseEntered:(NSEvent*)aEvent;
|
|
|
|
- (void)mouseExited:(NSEvent*)aEvent;
|
|
|
|
- (void)mouseMoved:(NSEvent*)aEvent;
|
|
|
|
- (void)updateTrackingArea;
|
|
|
|
- (NSView*)trackingAreaView;
|
|
|
|
|
2013-11-25 22:00:55 +04:00
|
|
|
- (void)setBeingShown:(BOOL)aValue;
|
2014-02-03 20:54:55 +04:00
|
|
|
- (BOOL)isBeingShown;
|
2013-10-09 18:39:22 +04:00
|
|
|
- (BOOL)isVisibleOrBeingShown;
|
|
|
|
|
2013-04-29 19:24:26 +04:00
|
|
|
- (ChildView*)mainChildView;
|
|
|
|
|
2013-05-23 18:49:17 +04:00
|
|
|
- (NSArray*)titlebarControls;
|
|
|
|
|
2013-12-17 20:11:13 +04:00
|
|
|
- (void)setWantsTitleDrawn:(BOOL)aDrawTitle;
|
|
|
|
- (BOOL)wantsTitleDrawn;
|
|
|
|
|
2014-11-04 06:14:10 +03:00
|
|
|
- (void)setUseBrightTitlebarForeground:(BOOL)aBrightForeground;
|
|
|
|
- (BOOL)useBrightTitlebarForeground;
|
|
|
|
|
2014-01-08 13:37:59 +04:00
|
|
|
- (void)disableSetNeedsDisplay;
|
|
|
|
- (void)enableSetNeedsDisplay;
|
|
|
|
|
2014-11-07 21:11:48 +03:00
|
|
|
- (NSRect)getAndResetNativeDirtyRect;
|
|
|
|
|
2015-02-05 01:25:19 +03:00
|
|
|
- (void)setUseMenuStyle:(BOOL)aValue;
|
|
|
|
|
2009-11-02 22:07:57 +03:00
|
|
|
@end
|
|
|
|
|
2007-07-18 00:29:39 +04:00
|
|
|
@interface NSWindow (Undocumented)
|
|
|
|
|
|
|
|
// If a window has been explicitly removed from the "window cache" (to
|
|
|
|
// deactivate it), it's sometimes necessary to "reset" it to reactivate it
|
|
|
|
// (and put it back in the "window cache"). One way to do this, which Apple
|
|
|
|
// often uses, is to set the "window number" to '-1' and then back to its
|
|
|
|
// original value.
|
2009-09-25 08:00:28 +04:00
|
|
|
- (void)_setWindowNumber:(NSInteger)aNumber;
|
2007-07-18 00:29:39 +04:00
|
|
|
|
2007-10-30 07:03:42 +03:00
|
|
|
// If we set the window's stylemask to be textured, the corners on the bottom of
|
|
|
|
// the window are rounded by default. We use this private method to make
|
2013-03-27 19:49:02 +04:00
|
|
|
// the corners square again, a la Safari. Starting with 10.7, all windows have
|
|
|
|
// rounded bottom corners, so this call doesn't have any effect there.
|
2007-10-30 07:03:42 +03:00
|
|
|
- (void)setBottomCornerRounded:(BOOL)rounded;
|
2013-03-27 19:49:02 +04:00
|
|
|
- (BOOL)bottomCornerRounded;
|
2007-10-30 07:03:42 +03:00
|
|
|
|
2013-05-23 18:49:17 +04:00
|
|
|
// 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;
|
|
|
|
|
2013-06-13 01:42:00 +04:00
|
|
|
// 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;
|
|
|
|
|
2007-07-18 00:29:39 +04:00
|
|
|
@end
|
|
|
|
|
2009-11-02 22:07:57 +03:00
|
|
|
@interface PopupWindow : BaseWindow
|
2007-07-18 00:29:39 +04:00
|
|
|
{
|
|
|
|
@private
|
|
|
|
BOOL mIsContextMenu;
|
|
|
|
}
|
|
|
|
|
2009-08-14 10:35:32 +04:00
|
|
|
- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask
|
2007-07-18 00:29:39 +04:00
|
|
|
backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation;
|
|
|
|
- (BOOL)isContextMenu;
|
|
|
|
- (void)setIsContextMenu:(BOOL)flag;
|
2010-07-27 17:38:03 +04:00
|
|
|
- (BOOL)canBecomeMainWindow;
|
2007-07-18 00:29:39 +04:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
2009-11-02 22:07:57 +03:00
|
|
|
@interface BorderlessWindow : BaseWindow
|
2007-10-19 19:47:58 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)canBecomeKeyWindow;
|
|
|
|
- (BOOL)canBecomeMainWindow;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
2010-11-18 00:48:11 +03:00
|
|
|
@interface WindowDelegate : NSObject <NSWindowDelegate>
|
2001-11-06 18:35:24 +03:00
|
|
|
{
|
2007-04-06 04:26:53 +04:00
|
|
|
nsCocoaWindow* mGeckoWindow; // [WEAK] (we are owned by the window)
|
Bug 178324, refactor focus by moving all focus handling into one place and simplifying it, add many tests, fixes many other bugs too numerous to mention in this small checkin comment, r=josh,smichaud,ere,dbaron,marco,neil,gavin,smaug,sr=smaug (CLOSED TREE)
2009-06-10 22:00:39 +04:00
|
|
|
// Used to avoid duplication when we send NS_ACTIVATE and
|
|
|
|
// NS_DEACTIVATE to Gecko for toplevel widgets. Starts out
|
2011-10-01 04:20:33 +04:00
|
|
|
// false.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mToplevelActiveState;
|
2009-08-14 02:02:54 +04:00
|
|
|
BOOL mHasEverBeenZoomed;
|
2001-11-06 18:35:24 +03:00
|
|
|
}
|
2008-03-27 06:42:57 +03:00
|
|
|
+ (void)paintMenubarForWindow:(NSWindow*)aWindow;
|
2001-11-06 18:35:24 +03:00
|
|
|
- (id)initWithGeckoWindow:(nsCocoaWindow*)geckoWind;
|
2006-04-25 23:20:31 +04:00
|
|
|
- (void)windowDidResize:(NSNotification*)aNotification;
|
2006-12-19 22:26:41 +03:00
|
|
|
- (nsCocoaWindow*)geckoWidget;
|
2011-09-29 10:19:26 +04:00
|
|
|
- (bool)toplevelActiveState;
|
2008-05-02 14:40:49 +04:00
|
|
|
- (void)sendToplevelActivateEvents;
|
|
|
|
- (void)sendToplevelDeactivateEvents;
|
2001-11-06 18:35:24 +03:00
|
|
|
@end
|
|
|
|
|
2009-10-21 11:05:39 +04:00
|
|
|
@class ToolbarWindow;
|
|
|
|
|
2016-07-22 11:56:13 +03:00
|
|
|
// NSColor subclass that allows us to draw separate colors both in the titlebar
|
2007-10-30 07:03:42 +03:00
|
|
|
// and for background of the window.
|
|
|
|
@interface TitlebarAndBackgroundColor : NSColor
|
|
|
|
{
|
2009-10-21 11:05:39 +04:00
|
|
|
ToolbarWindow *mWindow; // [WEAK] (we are owned by the window)
|
2007-10-30 07:03:42 +03:00
|
|
|
}
|
|
|
|
|
2009-11-02 22:07:57 +03:00
|
|
|
- (id)initWithWindow:(ToolbarWindow*)aWindow;
|
2007-10-30 07:03:42 +03:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
// NSWindow subclass for handling windows with toolbars.
|
2009-11-02 22:07:57 +03:00
|
|
|
@interface ToolbarWindow : BaseWindow
|
2007-05-31 09:07:18 +04:00
|
|
|
{
|
2007-10-30 07:03:42 +03:00
|
|
|
TitlebarAndBackgroundColor *mColor;
|
2013-05-22 13:50:57 +04:00
|
|
|
CGFloat mUnifiedToolbarHeight;
|
2009-11-02 22:07:57 +03:00
|
|
|
NSColor *mBackgroundColor;
|
2013-02-06 01:40:34 +04:00
|
|
|
NSView *mTitlebarView; // strong
|
2013-06-13 01:42:00 +04:00
|
|
|
NSRect mWindowButtonsRect;
|
|
|
|
NSRect mFullScreenButtonRect;
|
2007-05-31 09:07:18 +04:00
|
|
|
}
|
2009-11-02 22:07:57 +03:00
|
|
|
// Pass nil here to get the default appearance.
|
2008-05-02 15:32:50 +04:00
|
|
|
- (void)setTitlebarColor:(NSColor*)aColor forActiveWindow:(BOOL)aActive;
|
2013-05-22 13:50:57 +04:00
|
|
|
- (void)setUnifiedToolbarHeight:(CGFloat)aHeight;
|
|
|
|
- (CGFloat)unifiedToolbarHeight;
|
|
|
|
- (CGFloat)titlebarHeight;
|
2009-10-21 11:05:39 +04:00
|
|
|
- (NSRect)titlebarRect;
|
|
|
|
- (void)setTitlebarNeedsDisplayInRect:(NSRect)aRect sync:(BOOL)aSync;
|
|
|
|
- (void)setTitlebarNeedsDisplayInRect:(NSRect)aRect;
|
|
|
|
- (void)setDrawsContentsIntoWindowFrame:(BOOL)aState;
|
2015-03-06 22:43:46 +03:00
|
|
|
- (void)setSheetAttachmentPosition:(CGFloat)aY;
|
2013-06-13 01:42:00 +04:00
|
|
|
- (void)placeWindowButtons:(NSRect)aRect;
|
|
|
|
- (void)placeFullScreenButton:(NSRect)aRect;
|
|
|
|
- (NSPoint)windowButtonsPositionWithDefaultPosition:(NSPoint)aDefaultPosition;
|
|
|
|
- (NSPoint)fullScreenButtonPositionWithDefaultPosition:(NSPoint)aDefaultPosition;
|
2016-05-26 17:39:50 +03:00
|
|
|
- (void)setTemporaryBackgroundColor;
|
|
|
|
- (void)restoreBackgroundColor;
|
2007-05-31 09:07:18 +04:00
|
|
|
@end
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2006-05-17 22:53:58 +04:00
|
|
|
class nsCocoaWindow : public nsBaseWidget, public nsPIWidgetCocoa
|
2001-11-06 18:35:24 +03:00
|
|
|
{
|
|
|
|
private:
|
2006-02-02 04:20:54 +03:00
|
|
|
typedef nsBaseWidget Inherited;
|
2001-11-06 18:35:24 +03:00
|
|
|
|
|
|
|
public:
|
2001-11-15 01:29:25 +03:00
|
|
|
|
2001-11-06 18:35:24 +03:00
|
|
|
nsCocoaWindow();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2006-05-17 22:53:58 +04:00
|
|
|
NS_DECL_NSPIWIDGETCOCOA
|
2015-11-16 11:35:18 +03:00
|
|
|
|
2016-01-13 10:32:55 +03:00
|
|
|
NS_IMETHOD Create(nsIWidget* aParent,
|
|
|
|
nsNativeWidget aNativeParent,
|
|
|
|
const DesktopIntRect& aRect,
|
|
|
|
nsWidgetInitData* aInitData = nullptr) override;
|
|
|
|
|
2001-11-06 18:35:24 +03:00
|
|
|
NS_IMETHOD Create(nsIWidget* aParent,
|
2009-09-24 10:18:10 +04:00
|
|
|
nsNativeWidget aNativeParent,
|
2015-11-16 11:35:18 +03:00
|
|
|
const LayoutDeviceIntRect& aRect,
|
|
|
|
nsWidgetInitData* aInitData = nullptr) override;
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD Destroy() override;
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD Show(bool aState) override;
|
|
|
|
virtual nsIWidget* GetSheetWindowParent(void) override;
|
|
|
|
NS_IMETHOD Enable(bool aState) override;
|
|
|
|
virtual bool IsEnabled() const override;
|
|
|
|
NS_IMETHOD SetModal(bool aState) override;
|
2015-11-18 14:12:26 +03:00
|
|
|
NS_IMETHOD SetFakeModal(bool aState) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsVisible() const override;
|
|
|
|
NS_IMETHOD SetFocus(bool aState=false) override;
|
2015-11-13 12:37:02 +03:00
|
|
|
virtual LayoutDeviceIntPoint WidgetToScreenOffset() override;
|
|
|
|
virtual LayoutDeviceIntPoint GetClientOffset() override;
|
|
|
|
virtual LayoutDeviceIntSize
|
|
|
|
ClientToWindowSize(const LayoutDeviceIntSize& aClientSize) override;
|
2010-07-27 17:38:03 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void* GetNativeData(uint32_t aDataType) override;
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHOD ConstrainPosition(bool aAllowSlop,
|
2015-03-21 19:28:04 +03:00
|
|
|
int32_t *aX, int32_t *aY) override;
|
|
|
|
virtual void SetSizeConstraints(const SizeConstraints& aConstraints) override;
|
|
|
|
NS_IMETHOD Move(double aX, double aY) override;
|
2003-10-07 05:19:51 +04:00
|
|
|
NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIWidget *aWidget, bool aActivate) override;
|
2015-08-29 04:12:41 +03:00
|
|
|
NS_IMETHOD SetSizeMode(nsSizeMode aMode) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD HideWindowChrome(bool aShouldHide) override;
|
2015-07-24 02:45:00 +03:00
|
|
|
|
2015-06-04 04:49:34 +03:00
|
|
|
void EnteredFullScreen(bool aFullScreen, bool aNativeMode = true);
|
2015-07-24 02:45:00 +03:00
|
|
|
virtual bool PrepareForFullscreenTransition(nsISupports** aData) override;
|
|
|
|
virtual void PerformFullscreenTransition(FullscreenTransitionStage aStage,
|
|
|
|
uint16_t aDuration,
|
|
|
|
nsISupports* aData,
|
|
|
|
nsIRunnable* aCallback) override;
|
2015-07-13 13:44:36 +03:00
|
|
|
NS_IMETHOD MakeFullScreen(
|
|
|
|
bool aFullScreen, nsIScreen* aTargetScreen = nullptr) override final;
|
|
|
|
NS_IMETHOD MakeFullScreenWithNativeTransition(
|
|
|
|
bool aFullScreen, nsIScreen* aTargetScreen = nullptr) override final;
|
2015-08-06 08:37:48 +03:00
|
|
|
NSAnimation* FullscreenTransitionAnimation() const { return mFullscreenTransitionAnimation; }
|
|
|
|
void ReleaseFullscreenTransitionAnimation()
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mFullscreenTransitionAnimation,
|
|
|
|
"Should only be called when there is animation");
|
|
|
|
[mFullscreenTransitionAnimation release];
|
|
|
|
mFullscreenTransitionAnimation = nil;
|
|
|
|
}
|
2015-07-13 13:44:36 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD Resize(double aWidth, double aHeight, bool aRepaint) override;
|
|
|
|
NS_IMETHOD Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint) override;
|
2016-08-19 02:03:04 +03:00
|
|
|
virtual LayoutDeviceIntRect GetClientBounds() override;
|
|
|
|
virtual LayoutDeviceIntRect GetScreenBounds() override;
|
2010-07-27 17:38:04 +04:00
|
|
|
void ReportMoveEvent();
|
2010-12-21 14:42:47 +03:00
|
|
|
void ReportSizeEvent();
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD SetCursor(nsCursor aCursor) override;
|
|
|
|
NS_IMETHOD SetCursor(imgIContainer* aCursor, uint32_t aHotspotX, uint32_t aHotspotY) override;
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2012-09-29 15:36:09 +04:00
|
|
|
CGFloat BackingScaleFactor();
|
2012-10-16 23:41:20 +04:00
|
|
|
void BackingScaleFactorChanged();
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual double GetDefaultScaleInternal() override;
|
|
|
|
virtual int32_t RoundsWidgetCoordinatesTo() override;
|
2012-09-29 15:36:09 +04:00
|
|
|
|
2015-12-04 19:58:05 +03:00
|
|
|
mozilla::DesktopToLayoutDeviceScale GetDesktopToDeviceScale() final {
|
|
|
|
return mozilla::DesktopToLayoutDeviceScale(BackingScaleFactor());
|
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD SetTitle(const nsAString& aTitle) override;
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2015-11-17 08:18:31 +03:00
|
|
|
NS_IMETHOD Invalidate(const LayoutDeviceIntRect& aRect) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations) override;
|
2013-04-24 22:42:40 +04:00
|
|
|
virtual LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr,
|
2014-01-23 22:26:41 +04:00
|
|
|
LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE,
|
2016-06-24 03:53:27 +03:00
|
|
|
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT) override;
|
2013-10-02 07:46:03 +04:00
|
|
|
NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsEventStatus& aStatus) override;
|
|
|
|
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener, bool aDoCapture) override;
|
|
|
|
NS_IMETHOD GetAttention(int32_t aCycleCount) override;
|
|
|
|
virtual bool HasPendingInputEvent() override;
|
|
|
|
virtual nsTransparencyMode GetTransparencyMode() override;
|
|
|
|
virtual void SetTransparencyMode(nsTransparencyMode aMode) override;
|
|
|
|
NS_IMETHOD SetWindowShadowStyle(int32_t aStyle) override;
|
|
|
|
virtual void SetShowsToolbarButton(bool aShow) override;
|
|
|
|
virtual void SetShowsFullScreenButton(bool aShow) override;
|
|
|
|
virtual void SetWindowAnimationType(WindowAnimationType aType) override;
|
|
|
|
virtual void SetDrawsTitle(bool aDrawTitle) override;
|
|
|
|
virtual void SetUseBrightTitlebarForeground(bool aBrightForeground) override;
|
2015-11-13 12:37:02 +03:00
|
|
|
NS_IMETHOD SetNonClientMargins(LayoutDeviceIntMargin& aMargins) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD SetWindowTitlebarColor(nscolor aColor, bool aActive) override;
|
|
|
|
virtual void SetDrawsInTitlebar(bool aState) override;
|
|
|
|
virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) override;
|
2015-11-13 12:37:02 +03:00
|
|
|
virtual nsresult SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aNativeMessage,
|
2015-04-14 18:36:36 +03:00
|
|
|
uint32_t aModifierFlags,
|
|
|
|
nsIObserver* aObserver) override;
|
2007-04-06 04:11:41 +04:00
|
|
|
|
2009-08-14 02:02:54 +04:00
|
|
|
void DispatchSizeModeEvent();
|
2008-09-10 20:57:57 +04:00
|
|
|
|
2006-02-02 04:20:54 +03:00
|
|
|
// be notified that a some form of drag event needs to go into Gecko
|
2016-06-29 06:24:43 +03:00
|
|
|
virtual bool DragEvent(unsigned int aMessage, mozilla::gfx::Point aMouseGlobal, UInt16 aKeyModifiers);
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool HasModalDescendents() { return mNumModalDescendents > 0; }
|
2008-03-24 01:30:56 +03:00
|
|
|
NSWindow *GetCocoaWindow() { return mWindow; }
|
|
|
|
|
2009-04-08 22:39:58 +04:00
|
|
|
void SetMenuBar(nsMenuBarX* aMenuBar);
|
|
|
|
nsMenuBarX *GetMenuBar();
|
|
|
|
|
2013-05-24 20:27:52 +04:00
|
|
|
NS_IMETHOD_(void) SetInputContext(
|
|
|
|
const InputContext& aContext,
|
2015-03-21 19:28:04 +03:00
|
|
|
const InputContextAction& aAction) override;
|
|
|
|
NS_IMETHOD_(InputContext) GetInputContext() override
|
2011-11-27 15:51:52 +04:00
|
|
|
{
|
|
|
|
return mInputContext;
|
|
|
|
}
|
2014-03-14 17:13:31 +04:00
|
|
|
NS_IMETHOD_(bool) ExecuteNativeKeyBinding(
|
|
|
|
NativeKeyBindingsType aType,
|
|
|
|
const mozilla::WidgetKeyboardEvent& aEvent,
|
|
|
|
DoCommandCallback aCallback,
|
2015-03-21 19:28:04 +03:00
|
|
|
void* aCallbackData) override;
|
2007-09-27 20:01:32 +04:00
|
|
|
|
2010-07-27 17:38:03 +04:00
|
|
|
void SetPopupWindowLevel();
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent) override;
|
2016-04-30 02:23:17 +03:00
|
|
|
|
2005-10-08 03:31:45 +04:00
|
|
|
protected:
|
2014-07-09 01:23:18 +04:00
|
|
|
virtual ~nsCocoaWindow();
|
2009-06-24 19:15:32 +04:00
|
|
|
|
2009-07-22 12:57:39 +04:00
|
|
|
nsresult CreateNativeWindow(const NSRect &aRect,
|
|
|
|
nsBorderStyle aBorderStyle,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aRectIsFrameRect);
|
2015-11-16 11:35:18 +03:00
|
|
|
nsresult CreatePopupContentView(const LayoutDeviceIntRect &aRect);
|
2009-06-24 19:15:32 +04:00
|
|
|
void DestroyNativeWindow();
|
2009-12-30 18:24:08 +03:00
|
|
|
void AdjustWindowShadow();
|
2014-01-03 19:53:41 +04:00
|
|
|
void SetWindowBackgroundBlur();
|
2010-12-21 14:42:47 +03:00
|
|
|
void UpdateBounds();
|
2009-06-24 19:15:32 +04:00
|
|
|
|
2012-12-12 13:57:38 +04:00
|
|
|
nsresult DoResize(double aX, double aY, double aWidth, double aHeight,
|
2012-10-16 23:41:20 +04:00
|
|
|
bool aRepaint, bool aConstrainToCurrentScreen);
|
|
|
|
|
2015-07-13 13:44:36 +03:00
|
|
|
inline bool ShouldToggleNativeFullscreen(bool aFullScreen,
|
|
|
|
bool aUseSystemTransition);
|
|
|
|
nsresult DoMakeFullScreen(bool aFullScreen, bool aUseSystemTransition);
|
|
|
|
|
2010-08-20 23:29:02 +04:00
|
|
|
virtual already_AddRefed<nsIWidget>
|
2015-03-21 19:28:04 +03:00
|
|
|
AllocateChildPopupWidget() override
|
2010-08-20 23:29:02 +04:00
|
|
|
{
|
|
|
|
static NS_DEFINE_IID(kCPopUpCID, NS_POPUP_CID);
|
|
|
|
nsCOMPtr<nsIWidget> widget = do_CreateInstance(kCPopUpCID);
|
|
|
|
return widget.forget();
|
|
|
|
}
|
|
|
|
|
2006-02-07 22:15:42 +03:00
|
|
|
nsIWidget* mParent; // if we're a popup, this is our parent [WEAK]
|
2015-11-18 14:12:26 +03:00
|
|
|
nsIWidget* mAncestorLink; // link to traverse ancestors [WEAK]
|
2009-11-02 22:07:57 +03:00
|
|
|
BaseWindow* mWindow; // our cocoa window [STRONG]
|
2005-10-08 03:31:45 +04:00
|
|
|
WindowDelegate* mDelegate; // our delegate for processing window msgs [STRONG]
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsMenuBarX> mMenuBar;
|
2006-06-08 21:29:18 +04:00
|
|
|
NSWindow* mSheetWindowParent; // if this is a sheet, this is the NSWindow it's attached to
|
2007-08-25 05:55:28 +04:00
|
|
|
nsChildView* mPopupContentView; // if this is a popup, this is its content widget
|
2015-08-06 08:37:48 +03:00
|
|
|
// if this is a toplevel window, and there is any ongoing fullscreen
|
|
|
|
// transition, it is the animation object.
|
|
|
|
NSAnimation* mFullscreenTransitionAnimation;
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mShadowStyle;
|
2006-07-25 22:51:41 +04:00
|
|
|
|
2012-09-29 15:36:09 +04:00
|
|
|
CGFloat mBackingScaleFactor;
|
|
|
|
|
2012-02-17 07:47:39 +04:00
|
|
|
WindowAnimationType mAnimationType;
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mWindowMadeHere; // true if we created the window, false for embedding
|
|
|
|
bool mSheetNeedsShow; // if this is a sheet, are we waiting to be shown?
|
2008-02-20 05:30:24 +03:00
|
|
|
// this is used for sibling sheet contention only
|
2015-06-04 04:49:34 +03:00
|
|
|
bool mInFullScreenMode;
|
2012-03-29 23:18:50 +04:00
|
|
|
bool mInFullScreenTransition; // true from the request to enter/exit fullscreen
|
|
|
|
// (MakeFullScreen() call) to EnteredFullScreen()
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mModal;
|
2015-11-18 14:12:26 +03:00
|
|
|
bool mFakeModal;
|
2008-03-24 01:30:56 +03:00
|
|
|
|
2015-06-04 04:49:34 +03:00
|
|
|
// Only true on 10.7+ if SetShowsFullScreenButton(true) is called.
|
|
|
|
bool mSupportsNativeFullScreen;
|
2016-06-11 00:30:25 +03:00
|
|
|
// Whether we are currently using native fullscreen. It could be false because
|
|
|
|
// we are in the DOM fullscreen where we do not use the native fullscreen.
|
2015-06-04 04:49:34 +03:00
|
|
|
bool mInNativeFullScreenMode;
|
2012-03-21 03:21:14 +04:00
|
|
|
|
2012-02-17 07:47:39 +04:00
|
|
|
bool mIsAnimationSuppressed;
|
|
|
|
|
2011-12-13 20:55:16 +04:00
|
|
|
bool mInReportMoveEvent; // true if in a call to ReportMoveEvent().
|
2014-03-13 16:21:56 +04:00
|
|
|
bool mInResize; // true if in a call to DoResize().
|
2011-12-13 20:55:16 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mNumModalDescendents;
|
2011-11-27 15:51:52 +04:00
|
|
|
InputContext mInputContext;
|
2001-11-06 18:35:24 +03:00
|
|
|
};
|
|
|
|
|
2007-01-18 09:34:07 +03:00
|
|
|
#endif // nsCocoaWindow_h_
|