michael@0: /* Copyright 2012 Mozilla Foundation and Mozilla contributors michael@0: * michael@0: * Licensed under the Apache License, Version 2.0 (the "License"); michael@0: * you may not use this file except in compliance with the License. michael@0: * You may obtain a copy of the License at michael@0: * michael@0: * http://www.apache.org/licenses/LICENSE-2.0 michael@0: * michael@0: * Unless required by applicable law or agreed to in writing, software michael@0: * distributed under the License is distributed on an "AS IS" BASIS, michael@0: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. michael@0: * See the License for the specific language governing permissions and michael@0: * limitations under the License. michael@0: */ michael@0: michael@0: #ifndef nsWindow_h michael@0: #define nsWindow_h michael@0: michael@0: #include "nsBaseWidget.h" michael@0: #include "nsRegion.h" michael@0: #include "nsIIdleServiceInternal.h" michael@0: michael@0: extern nsIntRect gScreenBounds; michael@0: michael@0: namespace mozilla { michael@0: namespace gl { michael@0: class GLContext; michael@0: } michael@0: namespace layers { michael@0: class LayersManager; michael@0: } michael@0: } michael@0: michael@0: namespace android { michael@0: class FramebufferNativeWindow; michael@0: } michael@0: michael@0: namespace widget { michael@0: struct InputContext; michael@0: struct InputContextAction; michael@0: } michael@0: michael@0: class nsWindow : public nsBaseWidget michael@0: { michael@0: public: michael@0: nsWindow(); michael@0: virtual ~nsWindow(); michael@0: michael@0: static void DoDraw(void); michael@0: static nsEventStatus DispatchInputEvent(mozilla::WidgetGUIEvent& aEvent, michael@0: bool* aWasCaptured = nullptr); michael@0: michael@0: NS_IMETHOD Create(nsIWidget *aParent, michael@0: void *aNativeParent, michael@0: const nsIntRect &aRect, michael@0: nsDeviceContext *aContext, michael@0: nsWidgetInitData *aInitData); michael@0: NS_IMETHOD Destroy(void); michael@0: michael@0: NS_IMETHOD Show(bool aState); michael@0: virtual bool IsVisible() const; michael@0: NS_IMETHOD ConstrainPosition(bool aAllowSlop, michael@0: int32_t *aX, michael@0: int32_t *aY); michael@0: NS_IMETHOD Move(double aX, michael@0: double aY); michael@0: NS_IMETHOD Resize(double aWidth, michael@0: double aHeight, michael@0: bool aRepaint); michael@0: NS_IMETHOD Resize(double aX, michael@0: double aY, michael@0: double aWidth, michael@0: double aHeight, michael@0: bool aRepaint); michael@0: NS_IMETHOD Enable(bool aState); michael@0: virtual bool IsEnabled() const; michael@0: NS_IMETHOD SetFocus(bool aRaise = false); michael@0: NS_IMETHOD ConfigureChildren(const nsTArray&); michael@0: NS_IMETHOD Invalidate(const nsIntRect &aRect); michael@0: virtual void* GetNativeData(uint32_t aDataType); michael@0: NS_IMETHOD SetTitle(const nsAString& aTitle) michael@0: { michael@0: return NS_OK; michael@0: } michael@0: virtual nsIntPoint WidgetToScreenOffset(); michael@0: NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent, michael@0: nsEventStatus& aStatus); michael@0: NS_IMETHOD CaptureRollupEvents(nsIRollupListener *aListener, michael@0: bool aDoCapture) michael@0: { michael@0: return NS_ERROR_NOT_IMPLEMENTED; michael@0: } michael@0: NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent); michael@0: michael@0: NS_IMETHOD MakeFullScreen(bool aFullScreen) /*MOZ_OVERRIDE*/; michael@0: michael@0: virtual float GetDPI(); michael@0: virtual double GetDefaultScaleInternal(); michael@0: virtual mozilla::layers::LayerManager* michael@0: GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr, michael@0: LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE, michael@0: LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT, michael@0: bool* aAllowRetaining = nullptr); michael@0: gfxASurface* GetThebesSurface(); michael@0: michael@0: NS_IMETHOD_(void) SetInputContext(const InputContext& aContext, michael@0: const InputContextAction& aAction); michael@0: NS_IMETHOD_(InputContext) GetInputContext(); michael@0: michael@0: virtual uint32_t GetGLFrameBufferFormat() MOZ_OVERRIDE; michael@0: michael@0: virtual nsIntRect GetNaturalBounds() MOZ_OVERRIDE; michael@0: virtual bool NeedsPaint(); michael@0: michael@0: virtual Composer2D* GetComposer2D() MOZ_OVERRIDE; michael@0: michael@0: protected: michael@0: nsWindow* mParent; michael@0: bool mVisible; michael@0: InputContext mInputContext; michael@0: nsCOMPtr mIdleService; michael@0: michael@0: void BringToTop(); michael@0: michael@0: // Call this function when the users activity is the direct cause of an michael@0: // event (like a keypress or mouse click). michael@0: void UserActivity(); michael@0: }; michael@0: michael@0: #endif /* nsWindow_h */