2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
#ifndef nsBaseWidget_h__
|
|
|
|
#define nsBaseWidget_h__
|
|
|
|
|
|
|
|
#include "nsRect.h"
|
|
|
|
#include "nsIWidget.h"
|
2010-08-20 12:29:02 -07:00
|
|
|
#include "nsWidgetsCID.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsILocalFile.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsGUIEvent.h"
|
2009-07-21 17:44:55 -07:00
|
|
|
#include "nsAutoPtr.h"
|
2010-07-15 14:08:04 -07:00
|
|
|
#include "BasicLayers.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-12-03 08:33:42 -08:00
|
|
|
class nsIContent;
|
|
|
|
class nsAutoRollup;
|
2010-03-01 00:03:49 -08:00
|
|
|
class gfxContext;
|
2007-12-03 08:33:42 -08:00
|
|
|
|
2012-01-19 06:45:37 -08:00
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
class CompositorChild;
|
|
|
|
class CompositorParent;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace base {
|
|
|
|
class Thread;
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/**
|
|
|
|
* Common widget implementation used as base class for native
|
|
|
|
* or crossplatform implementations of Widgets.
|
|
|
|
* All cross-platform behavior that all widgets need to implement
|
|
|
|
* should be placed in this class.
|
|
|
|
* (Note: widget implementations are not required to use this
|
|
|
|
* class, but it gives them a head start.)
|
|
|
|
*/
|
|
|
|
|
2011-03-25 08:03:35 -07:00
|
|
|
class nsBaseWidget : public nsIWidget
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2007-12-03 08:33:42 -08:00
|
|
|
friend class nsAutoRollup;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-07-15 14:08:04 -07:00
|
|
|
protected:
|
|
|
|
typedef mozilla::layers::BasicLayerManager BasicLayerManager;
|
2012-01-19 06:45:37 -08:00
|
|
|
typedef mozilla::layers::CompositorChild CompositorChild;
|
|
|
|
typedef mozilla::layers::CompositorParent CompositorParent;
|
|
|
|
typedef base::Thread Thread;
|
2010-07-15 14:08:04 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
public:
|
|
|
|
nsBaseWidget();
|
|
|
|
virtual ~nsBaseWidget();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
// nsIWidget interface
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD CaptureMouse(bool aCapture);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD GetClientData(void*& aClientData);
|
|
|
|
NS_IMETHOD SetClientData(void* aClientData);
|
|
|
|
NS_IMETHOD Destroy();
|
|
|
|
NS_IMETHOD SetParent(nsIWidget* aNewParent);
|
|
|
|
virtual nsIWidget* GetParent(void);
|
2009-08-03 15:25:20 -07:00
|
|
|
virtual nsIWidget* GetTopLevelWidget();
|
2008-05-02 04:32:50 -07:00
|
|
|
virtual nsIWidget* GetSheetWindowParent(void);
|
2010-08-13 02:57:48 -07:00
|
|
|
virtual float GetDPI();
|
|
|
|
virtual double GetDefaultScale();
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual void AddChild(nsIWidget* aChild);
|
|
|
|
virtual void RemoveChild(nsIWidget* aChild);
|
|
|
|
|
|
|
|
NS_IMETHOD SetZIndex(PRInt32 aZIndex);
|
|
|
|
NS_IMETHOD GetZIndex(PRInt32* aZIndex);
|
|
|
|
NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
|
2011-09-28 23:19:26 -07:00
|
|
|
nsIWidget *aWidget, bool aActivate);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
NS_IMETHOD SetSizeMode(PRInt32 aMode);
|
|
|
|
NS_IMETHOD GetSizeMode(PRInt32* aMode);
|
|
|
|
|
|
|
|
virtual nscolor GetForegroundColor(void);
|
|
|
|
NS_IMETHOD SetForegroundColor(const nscolor &aColor);
|
|
|
|
virtual nscolor GetBackgroundColor(void);
|
|
|
|
NS_IMETHOD SetBackgroundColor(const nscolor &aColor);
|
|
|
|
virtual nsCursor GetCursor();
|
|
|
|
NS_IMETHOD SetCursor(nsCursor aCursor);
|
|
|
|
NS_IMETHOD SetCursor(imgIContainer* aCursor,
|
|
|
|
PRUint32 aHotspotX, PRUint32 aHotspotY);
|
|
|
|
NS_IMETHOD GetWindowType(nsWindowType& aWindowType);
|
2008-08-12 17:44:14 -07:00
|
|
|
virtual void SetTransparencyMode(nsTransparencyMode aMode);
|
|
|
|
virtual nsTransparencyMode GetTransparencyMode();
|
2009-07-21 17:44:55 -07:00
|
|
|
virtual void GetWindowClipRegion(nsTArray<nsIntRect>* aRects);
|
2008-10-14 08:33:40 -07:00
|
|
|
NS_IMETHOD SetWindowShadowStyle(PRInt32 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) {}
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD HideWindowChrome(bool aShouldHide);
|
|
|
|
NS_IMETHOD MakeFullScreen(bool aFullScreen);
|
2011-04-16 18:22:44 -07:00
|
|
|
virtual nsDeviceContext* GetDeviceContext();
|
2011-08-09 12:38:26 -07:00
|
|
|
virtual LayerManager* GetLayerManager(PLayersChild* aShadowManager = nsnull,
|
|
|
|
LayersBackend aBackendHint = LayerManager::LAYERS_NONE,
|
|
|
|
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
|
2010-12-06 18:05:52 -08:00
|
|
|
bool* aAllowRetaining = nsnull);
|
2011-03-25 08:03:35 -07:00
|
|
|
|
2012-01-19 06:45:37 -08:00
|
|
|
virtual void CreateCompositor();
|
2012-02-09 19:47:50 -08:00
|
|
|
virtual void DrawWindowUnderlay(LayerManager* aManager, nsIntRect aRect) {}
|
2012-01-21 18:01:17 -08:00
|
|
|
virtual void DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect) {}
|
2011-01-11 05:03:16 -08:00
|
|
|
virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) {}
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual gfxASurface* GetThebesSurface();
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD SetModal(bool aModal);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD SetWindowClass(const nsAString& xulWinType);
|
2011-12-01 13:35:42 -08:00
|
|
|
NS_IMETHOD MoveClient(PRInt32 aX, PRInt32 aY);
|
|
|
|
NS_IMETHOD ResizeClient(PRInt32 aWidth, PRInt32 aHeight, bool aRepaint);
|
|
|
|
NS_IMETHOD ResizeClient(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight, bool aRepaint);
|
2009-01-14 19:27:09 -08:00
|
|
|
NS_IMETHOD SetBounds(const nsIntRect &aRect);
|
|
|
|
NS_IMETHOD GetBounds(nsIntRect &aRect);
|
|
|
|
NS_IMETHOD GetClientBounds(nsIntRect &aRect);
|
|
|
|
NS_IMETHOD GetScreenBounds(nsIntRect &aRect);
|
2011-12-01 13:35:42 -08:00
|
|
|
NS_IMETHOD GetNonClientMargins(nsIntMargin &margins);
|
|
|
|
NS_IMETHOD SetNonClientMargins(nsIntMargin &margins);
|
2010-07-27 06:38:03 -07:00
|
|
|
virtual nsIntPoint GetClientOffset();
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD EnableDragDrop(bool aEnable);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD GetAttention(PRInt32 aCycleCount);
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool HasPendingInputEvent();
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD SetIcon(const nsAString &anIconSpec);
|
2007-09-27 09:01:32 -07:00
|
|
|
NS_IMETHOD BeginSecureKeyboardInput();
|
|
|
|
NS_IMETHOD EndSecureKeyboardInput();
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD SetWindowTitlebarColor(nscolor aColor, bool aActive);
|
|
|
|
virtual void SetDrawsInTitlebar(bool aState) {}
|
|
|
|
virtual bool ShowsResizeIndicator(nsIntRect* aResizerRect);
|
2007-09-27 09:01:32 -07:00
|
|
|
virtual void FreeNativeData(void * data, PRUint32 aDataType) {}
|
2007-12-11 02:08:35 -08:00
|
|
|
NS_IMETHOD BeginResizeDrag(nsGUIEvent* aEvent, PRInt32 aHorizontal, PRInt32 aVertical);
|
2010-07-17 01:11:54 -07:00
|
|
|
NS_IMETHOD BeginMoveDrag(nsMouseEvent* aEvent);
|
2008-06-28 00:55:30 -07:00
|
|
|
virtual nsresult ActivateNativeMenuItemAt(const nsAString& indexString) { return NS_ERROR_NOT_IMPLEMENTED; }
|
2008-10-29 22:36:01 -07:00
|
|
|
virtual nsresult ForceUpdateNativeMenuAt(const nsAString& indexString) { return NS_ERROR_NOT_IMPLEMENTED; }
|
2009-02-10 12:56:51 -08:00
|
|
|
NS_IMETHOD ResetInputState() { return NS_OK; }
|
|
|
|
NS_IMETHOD CancelIMEComposition() { return NS_OK; }
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD SetAcceleratedRendering(bool aEnabled);
|
|
|
|
virtual bool GetAcceleratedRendering();
|
|
|
|
virtual bool GetShouldAccelerate();
|
|
|
|
NS_IMETHOD GetToggledKeyState(PRUint32 aKeyCode, bool* aLEDState) { return NS_ERROR_NOT_IMPLEMENTED; }
|
|
|
|
NS_IMETHOD OnIMEFocusChange(bool aFocus) { return NS_ERROR_NOT_IMPLEMENTED; }
|
2009-02-10 12:56:51 -08:00
|
|
|
NS_IMETHOD OnIMETextChange(PRUint32 aStart, PRUint32 aOldEnd, PRUint32 aNewEnd) { return NS_ERROR_NOT_IMPLEMENTED; }
|
|
|
|
NS_IMETHOD OnIMESelectionChange(void) { return NS_ERROR_NOT_IMPLEMENTED; }
|
2011-10-17 07:59:28 -07:00
|
|
|
virtual nsIMEUpdatePreference GetIMEUpdatePreference() { return nsIMEUpdatePreference(false, false); }
|
2009-07-15 02:54:30 -07:00
|
|
|
NS_IMETHOD OnDefaultButtonLoaded(const nsIntRect &aButtonRect) { return NS_ERROR_NOT_IMPLEMENTED; }
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD OverrideSystemMouseScrollSpeed(PRInt32 aOriginalDelta, bool aIsHorizontal, PRInt32 &aOverriddenDelta);
|
2010-08-20 12:29:02 -07:00
|
|
|
virtual already_AddRefed<nsIWidget>
|
|
|
|
CreateChild(const nsIntRect &aRect,
|
|
|
|
EVENT_CALLBACK aHandleEventFunction,
|
2011-04-16 18:22:44 -07:00
|
|
|
nsDeviceContext *aContext,
|
2010-08-20 12:29:02 -07:00
|
|
|
nsWidgetInitData *aInitData = nsnull,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aForceUseIWidgetParent = false);
|
2012-01-31 13:55:54 -08:00
|
|
|
NS_IMETHOD SetEventCallback(EVENT_CALLBACK aEventFunction, nsDeviceContext *aContext);
|
2011-04-16 18:22:44 -07:00
|
|
|
NS_IMETHOD AttachViewToTopLevel(EVENT_CALLBACK aViewEventFunction, nsDeviceContext *aContext);
|
2010-06-24 19:01:06 -07:00
|
|
|
virtual ViewWrapper* GetAttachedViewPtr();
|
|
|
|
NS_IMETHOD SetAttachedViewPtr(ViewWrapper* aViewWrapper);
|
2010-08-02 06:34:54 -07:00
|
|
|
NS_IMETHOD RegisterTouchWindow();
|
|
|
|
NS_IMETHOD UnregisterTouchWindow();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-07-27 06:38:03 -07:00
|
|
|
nsPopupLevel PopupLevel() { return mPopupLevel; }
|
|
|
|
|
2010-07-27 06:38:03 -07:00
|
|
|
virtual nsIntSize ClientToWindowSize(const nsIntSize& aClientSize)
|
|
|
|
{
|
|
|
|
return aClientSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
// return true if this is a popup widget with a native titlebar
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsPopupWithTitleBar() const
|
2010-07-27 06:38:03 -07:00
|
|
|
{
|
|
|
|
return (mWindowType == eWindowType_popup &&
|
|
|
|
mBorderStyle != eBorderStyle_default &&
|
|
|
|
mBorderStyle & eBorderStyle_title);
|
|
|
|
}
|
|
|
|
|
2010-09-18 04:28:50 -07:00
|
|
|
NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent) = 0;
|
2012-01-25 18:05:34 -08:00
|
|
|
|
|
|
|
virtual PRUint32 GetGLFrameBufferFormat() MOZ_OVERRIDE;
|
|
|
|
|
2010-03-01 00:03:49 -08:00
|
|
|
/**
|
|
|
|
* Use this when GetLayerManager() returns a BasicLayerManager
|
|
|
|
* (nsBaseWidget::GetLayerManager() does). This sets up the widget's
|
|
|
|
* layer manager to temporarily render into aTarget.
|
|
|
|
*/
|
|
|
|
class AutoLayerManagerSetup {
|
|
|
|
public:
|
2010-07-15 14:08:04 -07:00
|
|
|
AutoLayerManagerSetup(nsBaseWidget* aWidget, gfxContext* aTarget,
|
|
|
|
BasicLayerManager::BufferMode aDoubleBuffering);
|
2010-03-01 00:03:49 -08:00
|
|
|
~AutoLayerManagerSetup();
|
|
|
|
private:
|
|
|
|
nsBaseWidget* mWidget;
|
|
|
|
};
|
|
|
|
friend class AutoLayerManagerSetup;
|
|
|
|
|
2010-10-15 03:34:29 -07:00
|
|
|
class AutoUseBasicLayerManager {
|
|
|
|
public:
|
|
|
|
AutoUseBasicLayerManager(nsBaseWidget* aWidget);
|
|
|
|
~AutoUseBasicLayerManager();
|
|
|
|
private:
|
|
|
|
nsBaseWidget* mWidget;
|
|
|
|
};
|
|
|
|
friend class AutoUseBasicLayerManager;
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool HasDestroyStarted() const
|
2011-09-28 07:02:36 -07:00
|
|
|
{
|
|
|
|
return mOnDestroyCalled;
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool Destroyed() { return mOnDestroyCalled; }
|
2011-09-22 02:17:40 -07:00
|
|
|
|
2012-03-05 19:20:29 -08:00
|
|
|
nsWindowType GetWindowType() { return mWindowType; }
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual void ResolveIconName(const nsAString &aIconName,
|
|
|
|
const nsAString &aIconSuffix,
|
|
|
|
nsILocalFile **aResult);
|
|
|
|
virtual void OnDestroy();
|
|
|
|
virtual void BaseCreate(nsIWidget *aParent,
|
2009-01-14 19:27:09 -08:00
|
|
|
const nsIntRect &aRect,
|
2007-03-22 10:30:00 -07:00
|
|
|
EVENT_CALLBACK aHandleEventFunction,
|
2011-04-16 18:22:44 -07:00
|
|
|
nsDeviceContext *aContext,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsWidgetInitData *aInitData);
|
|
|
|
|
2007-12-03 08:33:42 -08:00
|
|
|
virtual nsIContent* GetLastRollup()
|
|
|
|
{
|
|
|
|
return mLastRollup;
|
|
|
|
}
|
|
|
|
|
2008-05-06 21:46:37 -07:00
|
|
|
virtual nsresult SynthesizeNativeKeyEvent(PRInt32 aNativeKeyboardLayout,
|
|
|
|
PRInt32 aNativeKeyCode,
|
|
|
|
PRUint32 aModifierFlags,
|
|
|
|
const nsAString& aCharacters,
|
|
|
|
const nsAString& aUnmodifiedCharacters)
|
|
|
|
{ return NS_ERROR_UNEXPECTED; }
|
2008-05-05 16:01:07 -07:00
|
|
|
|
2009-09-22 19:31:37 -07:00
|
|
|
virtual nsresult SynthesizeNativeMouseEvent(nsIntPoint aPoint,
|
|
|
|
PRUint32 aNativeMessage,
|
|
|
|
PRUint32 aModifierFlags)
|
|
|
|
{ return NS_ERROR_UNEXPECTED; }
|
|
|
|
|
2012-04-11 14:55:21 -07:00
|
|
|
virtual nsresult SynthesizeNativeMouseMove(nsIntPoint aPoint)
|
|
|
|
{ return NS_ERROR_UNEXPECTED; }
|
|
|
|
|
2012-03-21 17:59:12 -07:00
|
|
|
virtual nsresult SynthesizeNativeMouseScrollEvent(nsIntPoint aPoint,
|
|
|
|
PRUint32 aNativeMessage,
|
|
|
|
double aDeltaX,
|
|
|
|
double aDeltaY,
|
|
|
|
double aDeltaZ,
|
|
|
|
PRUint32 aModifierFlags,
|
|
|
|
PRUint32 aAdditionalFlags)
|
|
|
|
{ return NS_ERROR_UNEXPECTED; }
|
|
|
|
|
2009-07-26 14:19:15 -07:00
|
|
|
// Stores the clip rectangles in aRects into mClipRects. Returns true
|
|
|
|
// if the new rectangles are different from the old rectangles.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool StoreWindowClipRegion(const nsTArray<nsIntRect>& aRects);
|
2009-07-21 17:44:55 -07:00
|
|
|
|
2010-08-20 12:29:02 -07:00
|
|
|
virtual already_AddRefed<nsIWidget>
|
|
|
|
AllocateChildPopupWidget()
|
|
|
|
{
|
|
|
|
static NS_DEFINE_IID(kCPopUpCID, NS_CHILD_CID);
|
|
|
|
nsCOMPtr<nsIWidget> widget = do_CreateInstance(kCPopUpCID);
|
|
|
|
return widget.forget();
|
|
|
|
}
|
|
|
|
|
2010-09-14 16:40:23 -07:00
|
|
|
BasicLayerManager* CreateBasicLayerManager();
|
|
|
|
|
2011-08-31 15:58:19 -07:00
|
|
|
protected:
|
2007-03-22 10:30:00 -07:00
|
|
|
void* mClientData;
|
2010-06-24 19:01:06 -07:00
|
|
|
ViewWrapper* mViewWrapperPtr;
|
2007-03-22 10:30:00 -07:00
|
|
|
EVENT_CALLBACK mEventCallback;
|
2010-06-24 19:01:06 -07:00
|
|
|
EVENT_CALLBACK mViewCallback;
|
2011-04-16 18:22:44 -07:00
|
|
|
nsDeviceContext* mContext;
|
2010-03-01 00:03:49 -08:00
|
|
|
nsRefPtr<LayerManager> mLayerManager;
|
2010-10-15 03:34:29 -07:00
|
|
|
nsRefPtr<LayerManager> mBasicLayerManager;
|
2012-01-19 06:45:37 -08:00
|
|
|
nsRefPtr<CompositorChild> mCompositorChild;
|
|
|
|
nsRefPtr<CompositorParent> mCompositorParent;
|
|
|
|
Thread* mCompositorThread;
|
2007-03-22 10:30:00 -07:00
|
|
|
nscolor mBackground;
|
|
|
|
nscolor mForeground;
|
|
|
|
nsCursor mCursor;
|
|
|
|
nsWindowType mWindowType;
|
|
|
|
nsBorderStyle mBorderStyle;
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mOnDestroyCalled;
|
|
|
|
bool mUseAcceleratedRendering;
|
2012-02-27 13:33:19 -08:00
|
|
|
bool mForceLayersAcceleration;
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mTemporarilyUseBasicLayerManager;
|
2009-01-14 19:27:09 -08:00
|
|
|
nsIntRect mBounds;
|
|
|
|
nsIntRect* mOriginalBounds;
|
2009-07-21 17:44:55 -07:00
|
|
|
// When this pointer is null, the widget is not clipped
|
|
|
|
nsAutoArrayPtr<nsIntRect> mClipRects;
|
2009-12-13 13:01:33 -08:00
|
|
|
PRUint32 mClipRectCount;
|
2007-03-22 10:30:00 -07:00
|
|
|
PRInt32 mZIndex;
|
|
|
|
nsSizeMode mSizeMode;
|
2010-07-27 06:38:03 -07:00
|
|
|
nsPopupLevel mPopupLevel;
|
2007-12-03 08:33:42 -08:00
|
|
|
|
|
|
|
// the last rolled up popup. Only set this when an nsAutoRollup is in scope,
|
|
|
|
// so it can be cleared automatically.
|
|
|
|
static nsIContent* mLastRollup;
|
2011-08-31 15:58:19 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#ifdef DEBUG
|
|
|
|
protected:
|
|
|
|
static nsAutoString debug_GuiEventToString(nsGUIEvent * aGuiEvent);
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool debug_WantPaintFlashing();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
static void debug_DumpInvalidate(FILE * aFileOut,
|
|
|
|
nsIWidget * aWidget,
|
2009-01-14 19:27:09 -08:00
|
|
|
const nsIntRect * aRect,
|
2007-03-22 10:30:00 -07:00
|
|
|
const nsCAutoString & aWidgetName,
|
|
|
|
PRInt32 aWindowID);
|
|
|
|
|
|
|
|
static void debug_DumpEvent(FILE * aFileOut,
|
|
|
|
nsIWidget * aWidget,
|
|
|
|
nsGUIEvent * aGuiEvent,
|
|
|
|
const nsCAutoString & aWidgetName,
|
|
|
|
PRInt32 aWindowID);
|
2011-08-31 15:58:19 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
static void debug_DumpPaintEvent(FILE * aFileOut,
|
|
|
|
nsIWidget * aWidget,
|
|
|
|
nsPaintEvent * aPaintEvent,
|
|
|
|
const nsCAutoString & aWidgetName,
|
|
|
|
PRInt32 aWindowID);
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool debug_GetCachedBoolPref(const char* aPrefName);
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2007-12-03 08:33:42 -08:00
|
|
|
// A situation can occur when a mouse event occurs over a menu label while the
|
|
|
|
// menu popup is already open. The expected behaviour is to close the popup.
|
|
|
|
// This happens by calling nsIRollupListener::Rollup before the mouse event is
|
|
|
|
// processed. However, in cases where the mouse event is not consumed, this
|
|
|
|
// event will then get targeted at the menu label causing the menu to open
|
|
|
|
// again. To prevent this, we store in mLastRollup a reference to the popup
|
|
|
|
// that was closed during the Rollup call, and prevent this popup from
|
|
|
|
// reopening while processing the mouse event.
|
|
|
|
// mLastRollup should only be set while an nsAutoRollup is in scope;
|
|
|
|
// when it goes out of scope mLastRollup is cleared automatically.
|
|
|
|
// As mLastRollup is static, it can be retrieved by calling
|
|
|
|
// nsIWidget::GetLastRollup on any widget.
|
|
|
|
class nsAutoRollup
|
|
|
|
{
|
2011-09-28 23:19:26 -07:00
|
|
|
bool wasClear;
|
2007-12-03 08:33:42 -08:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
nsAutoRollup();
|
|
|
|
~nsAutoRollup();
|
|
|
|
};
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif // nsBaseWidget_h__
|