Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* Copyright 2012 Mozilla Foundation and Mozilla contributors |
michael@0 | 2 | * |
michael@0 | 3 | * Licensed under the Apache License, Version 2.0 (the "License"); |
michael@0 | 4 | * you may not use this file except in compliance with the License. |
michael@0 | 5 | * You may obtain a copy of the License at |
michael@0 | 6 | * |
michael@0 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
michael@0 | 8 | * |
michael@0 | 9 | * Unless required by applicable law or agreed to in writing, software |
michael@0 | 10 | * distributed under the License is distributed on an "AS IS" BASIS, |
michael@0 | 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
michael@0 | 12 | * See the License for the specific language governing permissions and |
michael@0 | 13 | * limitations under the License. |
michael@0 | 14 | */ |
michael@0 | 15 | |
michael@0 | 16 | #ifndef nsWindow_h |
michael@0 | 17 | #define nsWindow_h |
michael@0 | 18 | |
michael@0 | 19 | #include "nsBaseWidget.h" |
michael@0 | 20 | #include "nsRegion.h" |
michael@0 | 21 | #include "nsIIdleServiceInternal.h" |
michael@0 | 22 | |
michael@0 | 23 | extern nsIntRect gScreenBounds; |
michael@0 | 24 | |
michael@0 | 25 | namespace mozilla { |
michael@0 | 26 | namespace gl { |
michael@0 | 27 | class GLContext; |
michael@0 | 28 | } |
michael@0 | 29 | namespace layers { |
michael@0 | 30 | class LayersManager; |
michael@0 | 31 | } |
michael@0 | 32 | } |
michael@0 | 33 | |
michael@0 | 34 | namespace android { |
michael@0 | 35 | class FramebufferNativeWindow; |
michael@0 | 36 | } |
michael@0 | 37 | |
michael@0 | 38 | namespace widget { |
michael@0 | 39 | struct InputContext; |
michael@0 | 40 | struct InputContextAction; |
michael@0 | 41 | } |
michael@0 | 42 | |
michael@0 | 43 | class nsWindow : public nsBaseWidget |
michael@0 | 44 | { |
michael@0 | 45 | public: |
michael@0 | 46 | nsWindow(); |
michael@0 | 47 | virtual ~nsWindow(); |
michael@0 | 48 | |
michael@0 | 49 | static void DoDraw(void); |
michael@0 | 50 | static nsEventStatus DispatchInputEvent(mozilla::WidgetGUIEvent& aEvent, |
michael@0 | 51 | bool* aWasCaptured = nullptr); |
michael@0 | 52 | |
michael@0 | 53 | NS_IMETHOD Create(nsIWidget *aParent, |
michael@0 | 54 | void *aNativeParent, |
michael@0 | 55 | const nsIntRect &aRect, |
michael@0 | 56 | nsDeviceContext *aContext, |
michael@0 | 57 | nsWidgetInitData *aInitData); |
michael@0 | 58 | NS_IMETHOD Destroy(void); |
michael@0 | 59 | |
michael@0 | 60 | NS_IMETHOD Show(bool aState); |
michael@0 | 61 | virtual bool IsVisible() const; |
michael@0 | 62 | NS_IMETHOD ConstrainPosition(bool aAllowSlop, |
michael@0 | 63 | int32_t *aX, |
michael@0 | 64 | int32_t *aY); |
michael@0 | 65 | NS_IMETHOD Move(double aX, |
michael@0 | 66 | double aY); |
michael@0 | 67 | NS_IMETHOD Resize(double aWidth, |
michael@0 | 68 | double aHeight, |
michael@0 | 69 | bool aRepaint); |
michael@0 | 70 | NS_IMETHOD Resize(double aX, |
michael@0 | 71 | double aY, |
michael@0 | 72 | double aWidth, |
michael@0 | 73 | double aHeight, |
michael@0 | 74 | bool aRepaint); |
michael@0 | 75 | NS_IMETHOD Enable(bool aState); |
michael@0 | 76 | virtual bool IsEnabled() const; |
michael@0 | 77 | NS_IMETHOD SetFocus(bool aRaise = false); |
michael@0 | 78 | NS_IMETHOD ConfigureChildren(const nsTArray<nsIWidget::Configuration>&); |
michael@0 | 79 | NS_IMETHOD Invalidate(const nsIntRect &aRect); |
michael@0 | 80 | virtual void* GetNativeData(uint32_t aDataType); |
michael@0 | 81 | NS_IMETHOD SetTitle(const nsAString& aTitle) |
michael@0 | 82 | { |
michael@0 | 83 | return NS_OK; |
michael@0 | 84 | } |
michael@0 | 85 | virtual nsIntPoint WidgetToScreenOffset(); |
michael@0 | 86 | NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent, |
michael@0 | 87 | nsEventStatus& aStatus); |
michael@0 | 88 | NS_IMETHOD CaptureRollupEvents(nsIRollupListener *aListener, |
michael@0 | 89 | bool aDoCapture) |
michael@0 | 90 | { |
michael@0 | 91 | return NS_ERROR_NOT_IMPLEMENTED; |
michael@0 | 92 | } |
michael@0 | 93 | NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent); |
michael@0 | 94 | |
michael@0 | 95 | NS_IMETHOD MakeFullScreen(bool aFullScreen) /*MOZ_OVERRIDE*/; |
michael@0 | 96 | |
michael@0 | 97 | virtual float GetDPI(); |
michael@0 | 98 | virtual double GetDefaultScaleInternal(); |
michael@0 | 99 | virtual mozilla::layers::LayerManager* |
michael@0 | 100 | GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr, |
michael@0 | 101 | LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE, |
michael@0 | 102 | LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT, |
michael@0 | 103 | bool* aAllowRetaining = nullptr); |
michael@0 | 104 | gfxASurface* GetThebesSurface(); |
michael@0 | 105 | |
michael@0 | 106 | NS_IMETHOD_(void) SetInputContext(const InputContext& aContext, |
michael@0 | 107 | const InputContextAction& aAction); |
michael@0 | 108 | NS_IMETHOD_(InputContext) GetInputContext(); |
michael@0 | 109 | |
michael@0 | 110 | virtual uint32_t GetGLFrameBufferFormat() MOZ_OVERRIDE; |
michael@0 | 111 | |
michael@0 | 112 | virtual nsIntRect GetNaturalBounds() MOZ_OVERRIDE; |
michael@0 | 113 | virtual bool NeedsPaint(); |
michael@0 | 114 | |
michael@0 | 115 | virtual Composer2D* GetComposer2D() MOZ_OVERRIDE; |
michael@0 | 116 | |
michael@0 | 117 | protected: |
michael@0 | 118 | nsWindow* mParent; |
michael@0 | 119 | bool mVisible; |
michael@0 | 120 | InputContext mInputContext; |
michael@0 | 121 | nsCOMPtr<nsIIdleServiceInternal> mIdleService; |
michael@0 | 122 | |
michael@0 | 123 | void BringToTop(); |
michael@0 | 124 | |
michael@0 | 125 | // Call this function when the users activity is the direct cause of an |
michael@0 | 126 | // event (like a keypress or mouse click). |
michael@0 | 127 | void UserActivity(); |
michael@0 | 128 | }; |
michael@0 | 129 | |
michael@0 | 130 | #endif /* nsWindow_h */ |