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