2006-07-25 18:51:41 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00: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 06:34:07 +00:00
|
|
|
|
|
|
|
#ifndef nsCocoaWindow_h_
|
|
|
|
#define nsCocoaWindow_h_
|
2001-11-06 15:35:24 +00:00
|
|
|
|
2002-12-13 08:43:18 +00:00
|
|
|
#undef DARWIN
|
2001-11-06 15:35:24 +00:00
|
|
|
|
2005-10-07 23:31:45 +00:00
|
|
|
#import <Cocoa/Cocoa.h>
|
2001-11-06 15:35:24 +00:00
|
|
|
|
|
|
|
#include "nsBaseWidget.h"
|
2006-05-17 18:53:58 +00:00
|
|
|
#include "nsPIWidgetCocoa.h"
|
2008-06-28 07:55:30 +00:00
|
|
|
#include "nsAutoPtr.h"
|
2009-08-14 06:35:32 +00:00
|
|
|
#include "nsCocoaUtils.h"
|
2001-11-06 15:35:24 +00:00
|
|
|
|
|
|
|
class nsCocoaWindow;
|
2006-07-25 18:51:41 +00:00
|
|
|
class nsChildView;
|
2008-06-28 07:55:30 +00:00
|
|
|
class nsMenuBarX;
|
2013-02-05 21:40:34 +00:00
|
|
|
@class ChildView;
|
2001-11-06 15:35:24 +00:00
|
|
|
|
2012-08-01 15:30:31 +00:00
|
|
|
// Value copied from BITMAP_MAX_AREA, used in nsNativeThemeCocoa.mm
|
|
|
|
#define CUIDRAW_MAX_AREA 500000
|
|
|
|
|
2012-03-20 23:21:14 +00:00
|
|
|
// If we are using an SDK older than 10.7, define bits we need that are missing
|
|
|
|
// from it.
|
|
|
|
#if !defined(MAC_OS_X_VERSION_10_7) || \
|
|
|
|
MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
|
|
|
|
|
|
|
|
enum {
|
2012-03-22 02:43:13 +00:00
|
|
|
NSWindowAnimationBehaviorDefault = 0,
|
|
|
|
NSWindowAnimationBehaviorNone = 2,
|
|
|
|
NSWindowAnimationBehaviorDocumentWindow = 3,
|
|
|
|
NSWindowAnimationBehaviorUtilityWindow = 4,
|
|
|
|
NSWindowAnimationBehaviorAlertPanel = 5,
|
|
|
|
NSWindowCollectionBehaviorFullScreenPrimary = 128, // 1 << 7
|
2012-03-20 23:21:14 +00:00
|
|
|
};
|
|
|
|
|
2012-03-22 02:43:13 +00:00
|
|
|
typedef NSInteger NSWindowAnimationBehavior;
|
|
|
|
|
|
|
|
@interface NSWindow (LionWindowFeatures)
|
|
|
|
- (void)setAnimationBehavior:(NSWindowAnimationBehavior)newAnimationBehavior;
|
2012-03-20 23:21:14 +00:00
|
|
|
- (void)toggleFullScreen:(id)sender;
|
|
|
|
@end
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2008-03-23 22:30:56 +00:00
|
|
|
typedef struct _nsCocoaWindowList {
|
|
|
|
_nsCocoaWindowList() : prev(NULL), window(NULL) {}
|
|
|
|
struct _nsCocoaWindowList *prev;
|
|
|
|
nsCocoaWindow *window; // Weak
|
|
|
|
} nsCocoaWindowList;
|
2001-11-06 15:35:24 +00:00
|
|
|
|
2009-11-02 19:07:57 +00:00
|
|
|
// NSWindow subclass that is the base class for all of our own window classes.
|
2009-12-11 21:53:22 +00: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 19:07:57 +00: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-11 21:53:22 +00:00
|
|
|
// Data Storage
|
2009-11-02 19:07:57 +00:00
|
|
|
NSMutableDictionary* mState;
|
|
|
|
BOOL mDrawsIntoWindowFrame;
|
|
|
|
NSColor* mActiveTitlebarColor;
|
|
|
|
NSColor* mInactiveTitlebarColor;
|
2009-12-11 21:53:22 +00:00
|
|
|
|
|
|
|
// Shadow
|
|
|
|
BOOL mScheduledShadowInvalidation;
|
2010-08-19 09:35:08 +00: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 14:43:13 +00:00
|
|
|
|
|
|
|
NSTrackingArea* mTrackingArea;
|
2009-11-02 19:07:57 +00: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-11 21:53:22 +00:00
|
|
|
- (void)deferredInvalidateShadow;
|
|
|
|
- (void)invalidateShadow;
|
2010-08-19 09:35:08 +00:00
|
|
|
- (float)getDPI;
|
2009-12-11 21:53:22 +00:00
|
|
|
|
2011-08-08 14:43:13 +00:00
|
|
|
- (void)mouseEntered:(NSEvent*)aEvent;
|
|
|
|
- (void)mouseExited:(NSEvent*)aEvent;
|
|
|
|
- (void)mouseMoved:(NSEvent*)aEvent;
|
|
|
|
- (void)updateTrackingArea;
|
|
|
|
- (NSView*)trackingAreaView;
|
|
|
|
|
2013-04-29 15:24:26 +00:00
|
|
|
- (ChildView*)mainChildView;
|
|
|
|
|
2013-05-23 14:49:17 +00:00
|
|
|
- (NSArray*)titlebarControls;
|
|
|
|
|
2009-11-02 19:07:57 +00:00
|
|
|
@end
|
|
|
|
|
2007-07-17 20:29:39 +00: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 04:00:28 +00:00
|
|
|
- (void)_setWindowNumber:(NSInteger)aNumber;
|
2007-07-17 20:29:39 +00:00
|
|
|
|
2007-10-30 04:03:42 +00: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 15:49:02 +00: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 04:03:42 +00:00
|
|
|
- (void)setBottomCornerRounded:(BOOL)rounded;
|
2013-03-27 15:49:02 +00:00
|
|
|
- (BOOL)bottomCornerRounded;
|
2007-10-30 04:03:42 +00:00
|
|
|
|
2013-05-23 14:49:17 +00: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;
|
|
|
|
|
2007-07-17 20:29:39 +00:00
|
|
|
@end
|
|
|
|
|
2009-11-02 19:07:57 +00:00
|
|
|
@interface PopupWindow : BaseWindow
|
2007-07-17 20:29:39 +00:00
|
|
|
{
|
|
|
|
@private
|
|
|
|
BOOL mIsContextMenu;
|
|
|
|
}
|
|
|
|
|
2009-08-14 06:35:32 +00:00
|
|
|
- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask
|
2007-07-17 20:29:39 +00:00
|
|
|
backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation;
|
|
|
|
- (BOOL)isContextMenu;
|
|
|
|
- (void)setIsContextMenu:(BOOL)flag;
|
2010-07-27 13:38:03 +00:00
|
|
|
- (BOOL)canBecomeMainWindow;
|
2007-07-17 20:29:39 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
2009-11-02 19:07:57 +00:00
|
|
|
@interface BorderlessWindow : BaseWindow
|
2007-10-19 15:47:58 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)canBecomeKeyWindow;
|
|
|
|
- (BOOL)canBecomeMainWindow;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
2010-11-17 21:48:11 +00:00
|
|
|
#if defined( MAC_OS_X_VERSION_10_6 ) && ( MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 )
|
|
|
|
@interface WindowDelegate : NSObject <NSWindowDelegate>
|
|
|
|
#else
|
2001-11-06 15:35:24 +00:00
|
|
|
@interface WindowDelegate : NSObject
|
2010-11-17 21:48:11 +00:00
|
|
|
#endif
|
2001-11-06 15:35:24 +00:00
|
|
|
{
|
2007-04-06 00:26:53 +00: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 18:00:39 +00:00
|
|
|
// Used to avoid duplication when we send NS_ACTIVATE and
|
|
|
|
// NS_DEACTIVATE to Gecko for toplevel widgets. Starts out
|
2011-10-01 00:20:33 +00:00
|
|
|
// false.
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mToplevelActiveState;
|
2009-08-13 22:02:54 +00:00
|
|
|
BOOL mHasEverBeenZoomed;
|
2001-11-06 15:35:24 +00:00
|
|
|
}
|
2008-03-27 03:42:57 +00:00
|
|
|
+ (void)paintMenubarForWindow:(NSWindow*)aWindow;
|
2001-11-06 15:35:24 +00:00
|
|
|
- (id)initWithGeckoWindow:(nsCocoaWindow*)geckoWind;
|
2006-04-25 19:20:31 +00:00
|
|
|
- (void)windowDidResize:(NSNotification*)aNotification;
|
2006-12-19 19:26:41 +00:00
|
|
|
- (nsCocoaWindow*)geckoWidget;
|
2011-09-29 06:19:26 +00:00
|
|
|
- (bool)toplevelActiveState;
|
2008-05-02 10:40:49 +00:00
|
|
|
- (void)sendToplevelActivateEvents;
|
|
|
|
- (void)sendToplevelDeactivateEvents;
|
2001-11-06 15:35:24 +00:00
|
|
|
@end
|
|
|
|
|
2009-10-21 07:05:39 +00:00
|
|
|
@class ToolbarWindow;
|
|
|
|
|
2007-10-30 04:03:42 +00:00
|
|
|
// NSColor subclass that allows us to draw separate colors both in the titlebar
|
|
|
|
// and for background of the window.
|
|
|
|
@interface TitlebarAndBackgroundColor : NSColor
|
|
|
|
{
|
2009-10-21 07:05:39 +00:00
|
|
|
ToolbarWindow *mWindow; // [WEAK] (we are owned by the window)
|
2007-10-30 04:03:42 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 19:07:57 +00:00
|
|
|
- (id)initWithWindow:(ToolbarWindow*)aWindow;
|
2007-10-30 04:03:42 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
// NSWindow subclass for handling windows with toolbars.
|
2009-11-02 19:07:57 +00:00
|
|
|
@interface ToolbarWindow : BaseWindow
|
2007-05-31 05:07:18 +00:00
|
|
|
{
|
2007-10-30 04:03:42 +00:00
|
|
|
TitlebarAndBackgroundColor *mColor;
|
2013-05-22 09:50:57 +00:00
|
|
|
CGFloat mUnifiedToolbarHeight;
|
2009-11-02 19:07:57 +00:00
|
|
|
NSColor *mBackgroundColor;
|
2013-02-05 21:40:34 +00:00
|
|
|
NSView *mTitlebarView; // strong
|
2007-05-31 05:07:18 +00:00
|
|
|
}
|
2009-11-02 19:07:57 +00:00
|
|
|
// Pass nil here to get the default appearance.
|
2008-05-02 11:32:50 +00:00
|
|
|
- (void)setTitlebarColor:(NSColor*)aColor forActiveWindow:(BOOL)aActive;
|
2013-05-22 09:50:57 +00:00
|
|
|
- (void)setUnifiedToolbarHeight:(CGFloat)aHeight;
|
|
|
|
- (CGFloat)unifiedToolbarHeight;
|
|
|
|
- (CGFloat)titlebarHeight;
|
2009-10-21 07:05:39 +00:00
|
|
|
- (NSRect)titlebarRect;
|
|
|
|
- (void)setTitlebarNeedsDisplayInRect:(NSRect)aRect sync:(BOOL)aSync;
|
|
|
|
- (void)setTitlebarNeedsDisplayInRect:(NSRect)aRect;
|
|
|
|
- (void)setDrawsContentsIntoWindowFrame:(BOOL)aState;
|
2007-05-31 05:07:18 +00:00
|
|
|
@end
|
2001-11-06 15:35:24 +00:00
|
|
|
|
2006-05-17 18:53:58 +00:00
|
|
|
class nsCocoaWindow : public nsBaseWidget, public nsPIWidgetCocoa
|
2001-11-06 15:35:24 +00:00
|
|
|
{
|
|
|
|
private:
|
2006-12-23 20:25:51 +00:00
|
|
|
|
2006-02-02 01:20:54 +00:00
|
|
|
typedef nsBaseWidget Inherited;
|
2001-11-06 15:35:24 +00:00
|
|
|
|
|
|
|
public:
|
2001-11-14 22:29:25 +00:00
|
|
|
|
2001-11-06 15:35:24 +00:00
|
|
|
nsCocoaWindow();
|
|
|
|
virtual ~nsCocoaWindow();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2006-05-17 18:53:58 +00:00
|
|
|
NS_DECL_NSPIWIDGETCOCOA
|
2001-11-06 15:35:24 +00:00
|
|
|
|
|
|
|
NS_IMETHOD Create(nsIWidget* aParent,
|
2009-09-24 06:18:10 +00:00
|
|
|
nsNativeWidget aNativeParent,
|
2009-01-15 03:27:09 +00:00
|
|
|
const nsIntRect &aRect,
|
2011-04-17 01:22:44 +00:00
|
|
|
nsDeviceContext *aContext,
|
2012-07-30 14:20:58 +00:00
|
|
|
nsWidgetInitData *aInitData = nullptr);
|
2001-11-06 15:35:24 +00:00
|
|
|
|
2006-07-25 18:51:41 +00:00
|
|
|
NS_IMETHOD Destroy();
|
2001-11-06 15:35:24 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
NS_IMETHOD Show(bool aState);
|
2008-05-02 11:32:50 +00:00
|
|
|
virtual nsIWidget* GetSheetWindowParent(void);
|
2011-09-29 06:19:26 +00:00
|
|
|
NS_IMETHOD Enable(bool aState);
|
2012-07-23 05:19:08 +00:00
|
|
|
virtual bool IsEnabled() const;
|
2011-09-29 06:19:26 +00:00
|
|
|
NS_IMETHOD SetModal(bool aState);
|
2012-07-19 08:57:50 +00:00
|
|
|
virtual bool IsVisible() const;
|
2011-09-29 06:19:26 +00:00
|
|
|
NS_IMETHOD SetFocus(bool aState=false);
|
2009-02-19 00:11:49 +00:00
|
|
|
virtual nsIntPoint WidgetToScreenOffset();
|
2010-07-27 13:38:03 +00:00
|
|
|
virtual nsIntPoint GetClientOffset();
|
|
|
|
virtual nsIntSize ClientToWindowSize(const nsIntSize& aClientSize);
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual void* GetNativeData(uint32_t aDataType) ;
|
2001-11-06 15:35:24 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
NS_IMETHOD ConstrainPosition(bool aAllowSlop,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t *aX, int32_t *aY);
|
2012-07-31 00:43:29 +00:00
|
|
|
virtual void SetSizeConstraints(const SizeConstraints& aConstraints);
|
2012-12-12 09:57:38 +00:00
|
|
|
NS_IMETHOD Move(double aX, double aY);
|
2003-10-07 01:19:51 +00:00
|
|
|
NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
|
2011-09-29 06:19:26 +00:00
|
|
|
nsIWidget *aWidget, bool aActivate);
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHOD SetSizeMode(int32_t aMode);
|
2011-09-29 06:19:26 +00:00
|
|
|
NS_IMETHOD HideWindowChrome(bool aShouldHide);
|
2012-03-20 23:21:14 +00:00
|
|
|
void EnteredFullScreen(bool aFullScreen);
|
2011-09-29 06:19:26 +00:00
|
|
|
NS_IMETHOD MakeFullScreen(bool aFullScreen);
|
2012-12-12 09:57:38 +00:00
|
|
|
NS_IMETHOD Resize(double aWidth, double aHeight, bool aRepaint);
|
|
|
|
NS_IMETHOD Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint);
|
2010-12-21 11:42:47 +00:00
|
|
|
NS_IMETHOD GetClientBounds(nsIntRect &aRect);
|
2009-01-15 03:27:09 +00:00
|
|
|
NS_IMETHOD GetScreenBounds(nsIntRect &aRect);
|
2010-07-27 13:38:04 +00:00
|
|
|
void ReportMoveEvent();
|
2010-12-21 11:42:47 +00:00
|
|
|
void ReportSizeEvent();
|
2009-09-27 21:04:16 +00:00
|
|
|
NS_IMETHOD SetCursor(nsCursor aCursor);
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHOD SetCursor(imgIContainer* aCursor, uint32_t aHotspotX, uint32_t aHotspotY);
|
2001-11-06 15:35:24 +00:00
|
|
|
|
2012-09-29 11:36:09 +00:00
|
|
|
CGFloat BackingScaleFactor();
|
2012-10-16 19:41:20 +00:00
|
|
|
void BackingScaleFactorChanged();
|
2012-10-31 00:31:35 +00:00
|
|
|
virtual double GetDefaultScaleInternal();
|
2013-07-30 16:22:41 +00:00
|
|
|
virtual int32_t RoundsWidgetCoordinatesTo() MOZ_OVERRIDE;
|
2012-09-29 11:36:09 +00:00
|
|
|
|
2006-02-02 01:20:54 +00:00
|
|
|
NS_IMETHOD SetTitle(const nsAString& aTitle);
|
2001-11-06 15:35:24 +00:00
|
|
|
|
2011-12-24 03:52:21 +00:00
|
|
|
NS_IMETHOD Invalidate(const nsIntRect &aRect);
|
2009-07-22 00:44:55 +00:00
|
|
|
virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations);
|
2013-04-24 18:42:40 +00:00
|
|
|
virtual LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr,
|
2012-07-18 16:31:40 +00:00
|
|
|
LayersBackend aBackendHint = mozilla::layers::LAYERS_NONE,
|
2011-08-09 19:38:26 +00:00
|
|
|
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
|
2012-07-30 14:20:58 +00:00
|
|
|
bool* aAllowRetaining = nullptr);
|
2001-11-06 15:35:24 +00:00
|
|
|
NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus) ;
|
2012-10-26 13:15:22 +00:00
|
|
|
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener, bool aDoCapture);
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHOD GetAttention(int32_t aCycleCount);
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool HasPendingInputEvent();
|
2008-08-13 00:44:14 +00:00
|
|
|
virtual nsTransparencyMode GetTransparencyMode();
|
|
|
|
virtual void SetTransparencyMode(nsTransparencyMode aMode);
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHOD SetWindowShadowStyle(int32_t aStyle);
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual void SetShowsToolbarButton(bool aShow);
|
2012-03-20 23:21:14 +00:00
|
|
|
virtual void SetShowsFullScreenButton(bool aShow);
|
2012-02-17 03:47:39 +00:00
|
|
|
virtual void SetWindowAnimationType(WindowAnimationType aType);
|
2011-09-29 06:19:26 +00:00
|
|
|
NS_IMETHOD SetWindowTitlebarColor(nscolor aColor, bool aActive);
|
|
|
|
virtual void SetDrawsInTitlebar(bool aState);
|
2009-09-23 02:31:37 +00:00
|
|
|
virtual nsresult SynthesizeNativeMouseEvent(nsIntPoint aPoint,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t aNativeMessage,
|
|
|
|
uint32_t aModifierFlags);
|
2007-04-06 00:11:41 +00:00
|
|
|
|
2009-08-13 22:02:54 +00:00
|
|
|
void DispatchSizeModeEvent();
|
2008-09-10 16:57:57 +00:00
|
|
|
|
2007-08-02 18:48:28 +00:00
|
|
|
virtual gfxASurface* GetThebesSurface();
|
|
|
|
|
2006-02-02 01:20:54 +00:00
|
|
|
// be notified that a some form of drag event needs to go into Gecko
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool DragEvent(unsigned int aMessage, Point aMouseGlobal, UInt16 aKeyModifiers);
|
2001-11-06 15:35:24 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool HasModalDescendents() { return mNumModalDescendents > 0; }
|
2008-03-23 22:30:56 +00:00
|
|
|
NSWindow *GetCocoaWindow() { return mWindow; }
|
|
|
|
|
2009-04-08 18:39:58 +00:00
|
|
|
void SetMenuBar(nsMenuBarX* aMenuBar);
|
|
|
|
nsMenuBarX *GetMenuBar();
|
|
|
|
|
2013-05-24 16:27:52 +00:00
|
|
|
NS_IMETHOD NotifyIME(NotificationToIME aNotification) MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD_(void) SetInputContext(
|
|
|
|
const InputContext& aContext,
|
|
|
|
const InputContextAction& aAction) MOZ_OVERRIDE;
|
2011-11-27 11:51:52 +00:00
|
|
|
NS_IMETHOD_(InputContext) GetInputContext()
|
|
|
|
{
|
2012-10-26 23:35:21 +00:00
|
|
|
NSView* view = mWindow ? [mWindow contentView] : nil;
|
|
|
|
if (view) {
|
|
|
|
mInputContext.mNativeIMEContext = [view inputContext];
|
|
|
|
}
|
|
|
|
// If inputContext isn't available on this window, returns this window's
|
|
|
|
// pointer since nullptr means the platform has only one context per
|
|
|
|
// process.
|
|
|
|
if (!mInputContext.mNativeIMEContext) {
|
|
|
|
mInputContext.mNativeIMEContext = this;
|
|
|
|
}
|
2011-11-27 11:51:52 +00:00
|
|
|
return mInputContext;
|
|
|
|
}
|
2007-09-27 16:01:32 +00:00
|
|
|
|
2010-07-27 13:38:03 +00:00
|
|
|
void SetPopupWindowLevel();
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool IsChildInFailingLeftClickThrough(NSView *aChild);
|
|
|
|
bool ShouldFocusPlugin();
|
2010-11-15 21:12:50 +00:00
|
|
|
|
2010-09-18 11:28:50 +00:00
|
|
|
NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent);
|
2005-10-07 23:31:45 +00:00
|
|
|
protected:
|
2009-06-24 15:15:32 +00:00
|
|
|
|
2009-07-22 08:57:39 +00:00
|
|
|
nsresult CreateNativeWindow(const NSRect &aRect,
|
|
|
|
nsBorderStyle aBorderStyle,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aRectIsFrameRect);
|
2009-06-24 15:15:32 +00:00
|
|
|
nsresult CreatePopupContentView(const nsIntRect &aRect,
|
2011-10-25 15:05:32 +00:00
|
|
|
nsDeviceContext *aContext);
|
2009-06-24 15:15:32 +00:00
|
|
|
void DestroyNativeWindow();
|
2009-12-30 15:24:08 +00:00
|
|
|
void AdjustWindowShadow();
|
2010-01-13 16:10:25 +00:00
|
|
|
void SetUpWindowFilter();
|
|
|
|
void CleanUpWindowFilter();
|
2010-12-21 11:42:47 +00:00
|
|
|
void UpdateBounds();
|
2009-06-24 15:15:32 +00:00
|
|
|
|
2012-12-12 09:57:38 +00:00
|
|
|
nsresult DoResize(double aX, double aY, double aWidth, double aHeight,
|
2012-10-16 19:41:20 +00:00
|
|
|
bool aRepaint, bool aConstrainToCurrentScreen);
|
|
|
|
|
2010-08-20 19:29:02 +00:00
|
|
|
virtual already_AddRefed<nsIWidget>
|
|
|
|
AllocateChildPopupWidget()
|
|
|
|
{
|
|
|
|
static NS_DEFINE_IID(kCPopUpCID, NS_POPUP_CID);
|
|
|
|
nsCOMPtr<nsIWidget> widget = do_CreateInstance(kCPopUpCID);
|
|
|
|
return widget.forget();
|
|
|
|
}
|
|
|
|
|
2006-02-07 19:15:42 +00:00
|
|
|
nsIWidget* mParent; // if we're a popup, this is our parent [WEAK]
|
2009-11-02 19:07:57 +00:00
|
|
|
BaseWindow* mWindow; // our cocoa window [STRONG]
|
2005-10-07 23:31:45 +00:00
|
|
|
WindowDelegate* mDelegate; // our delegate for processing window msgs [STRONG]
|
2008-06-28 07:55:30 +00:00
|
|
|
nsRefPtr<nsMenuBarX> mMenuBar;
|
2006-06-08 17:29:18 +00:00
|
|
|
NSWindow* mSheetWindowParent; // if this is a sheet, this is the NSWindow it's attached to
|
2007-08-25 01:55:28 +00:00
|
|
|
nsChildView* mPopupContentView; // if this is a popup, this is its content widget
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mShadowStyle;
|
2010-01-13 16:10:25 +00:00
|
|
|
NSUInteger mWindowFilter;
|
2006-07-25 18:51:41 +00:00
|
|
|
|
2012-09-29 11:36:09 +00:00
|
|
|
CGFloat mBackingScaleFactor;
|
|
|
|
|
2012-02-17 03:47:39 +00:00
|
|
|
WindowAnimationType mAnimationType;
|
|
|
|
|
2011-09-29 06:19:26 +00: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 02:30:24 +00:00
|
|
|
// this is used for sibling sheet contention only
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mFullScreen;
|
2012-03-29 19:18:50 +00:00
|
|
|
bool mInFullScreenTransition; // true from the request to enter/exit fullscreen
|
|
|
|
// (MakeFullScreen() call) to EnteredFullScreen()
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mModal;
|
2008-03-23 22:30:56 +00:00
|
|
|
|
2012-03-20 23:21:14 +00:00
|
|
|
bool mUsesNativeFullScreen; // only true on Lion if SetShowsFullScreenButton(true);
|
|
|
|
|
2012-02-17 03:47:39 +00:00
|
|
|
bool mIsAnimationSuppressed;
|
|
|
|
|
2011-12-13 16:55:16 +00:00
|
|
|
bool mInReportMoveEvent; // true if in a call to ReportMoveEvent().
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mNumModalDescendents;
|
2011-11-27 11:51:52 +00:00
|
|
|
InputContext mInputContext;
|
2001-11-06 15:35:24 +00:00
|
|
|
};
|
|
|
|
|
2007-01-18 06:34:07 +00:00
|
|
|
#endif // nsCocoaWindow_h_
|