1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/widget/gonk/nsWindow.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,130 @@ 1.4 +/* Copyright 2012 Mozilla Foundation and Mozilla contributors 1.5 + * 1.6 + * Licensed under the Apache License, Version 2.0 (the "License"); 1.7 + * you may not use this file except in compliance with the License. 1.8 + * You may obtain a copy of the License at 1.9 + * 1.10 + * http://www.apache.org/licenses/LICENSE-2.0 1.11 + * 1.12 + * Unless required by applicable law or agreed to in writing, software 1.13 + * distributed under the License is distributed on an "AS IS" BASIS, 1.14 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1.15 + * See the License for the specific language governing permissions and 1.16 + * limitations under the License. 1.17 + */ 1.18 + 1.19 +#ifndef nsWindow_h 1.20 +#define nsWindow_h 1.21 + 1.22 +#include "nsBaseWidget.h" 1.23 +#include "nsRegion.h" 1.24 +#include "nsIIdleServiceInternal.h" 1.25 + 1.26 +extern nsIntRect gScreenBounds; 1.27 + 1.28 +namespace mozilla { 1.29 +namespace gl { 1.30 +class GLContext; 1.31 +} 1.32 +namespace layers { 1.33 +class LayersManager; 1.34 +} 1.35 +} 1.36 + 1.37 +namespace android { 1.38 +class FramebufferNativeWindow; 1.39 +} 1.40 + 1.41 +namespace widget { 1.42 +struct InputContext; 1.43 +struct InputContextAction; 1.44 +} 1.45 + 1.46 +class nsWindow : public nsBaseWidget 1.47 +{ 1.48 +public: 1.49 + nsWindow(); 1.50 + virtual ~nsWindow(); 1.51 + 1.52 + static void DoDraw(void); 1.53 + static nsEventStatus DispatchInputEvent(mozilla::WidgetGUIEvent& aEvent, 1.54 + bool* aWasCaptured = nullptr); 1.55 + 1.56 + NS_IMETHOD Create(nsIWidget *aParent, 1.57 + void *aNativeParent, 1.58 + const nsIntRect &aRect, 1.59 + nsDeviceContext *aContext, 1.60 + nsWidgetInitData *aInitData); 1.61 + NS_IMETHOD Destroy(void); 1.62 + 1.63 + NS_IMETHOD Show(bool aState); 1.64 + virtual bool IsVisible() const; 1.65 + NS_IMETHOD ConstrainPosition(bool aAllowSlop, 1.66 + int32_t *aX, 1.67 + int32_t *aY); 1.68 + NS_IMETHOD Move(double aX, 1.69 + double aY); 1.70 + NS_IMETHOD Resize(double aWidth, 1.71 + double aHeight, 1.72 + bool aRepaint); 1.73 + NS_IMETHOD Resize(double aX, 1.74 + double aY, 1.75 + double aWidth, 1.76 + double aHeight, 1.77 + bool aRepaint); 1.78 + NS_IMETHOD Enable(bool aState); 1.79 + virtual bool IsEnabled() const; 1.80 + NS_IMETHOD SetFocus(bool aRaise = false); 1.81 + NS_IMETHOD ConfigureChildren(const nsTArray<nsIWidget::Configuration>&); 1.82 + NS_IMETHOD Invalidate(const nsIntRect &aRect); 1.83 + virtual void* GetNativeData(uint32_t aDataType); 1.84 + NS_IMETHOD SetTitle(const nsAString& aTitle) 1.85 + { 1.86 + return NS_OK; 1.87 + } 1.88 + virtual nsIntPoint WidgetToScreenOffset(); 1.89 + NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent, 1.90 + nsEventStatus& aStatus); 1.91 + NS_IMETHOD CaptureRollupEvents(nsIRollupListener *aListener, 1.92 + bool aDoCapture) 1.93 + { 1.94 + return NS_ERROR_NOT_IMPLEMENTED; 1.95 + } 1.96 + NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent); 1.97 + 1.98 + NS_IMETHOD MakeFullScreen(bool aFullScreen) /*MOZ_OVERRIDE*/; 1.99 + 1.100 + virtual float GetDPI(); 1.101 + virtual double GetDefaultScaleInternal(); 1.102 + virtual mozilla::layers::LayerManager* 1.103 + GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr, 1.104 + LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE, 1.105 + LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT, 1.106 + bool* aAllowRetaining = nullptr); 1.107 + gfxASurface* GetThebesSurface(); 1.108 + 1.109 + NS_IMETHOD_(void) SetInputContext(const InputContext& aContext, 1.110 + const InputContextAction& aAction); 1.111 + NS_IMETHOD_(InputContext) GetInputContext(); 1.112 + 1.113 + virtual uint32_t GetGLFrameBufferFormat() MOZ_OVERRIDE; 1.114 + 1.115 + virtual nsIntRect GetNaturalBounds() MOZ_OVERRIDE; 1.116 + virtual bool NeedsPaint(); 1.117 + 1.118 + virtual Composer2D* GetComposer2D() MOZ_OVERRIDE; 1.119 + 1.120 +protected: 1.121 + nsWindow* mParent; 1.122 + bool mVisible; 1.123 + InputContext mInputContext; 1.124 + nsCOMPtr<nsIIdleServiceInternal> mIdleService; 1.125 + 1.126 + void BringToTop(); 1.127 + 1.128 + // Call this function when the users activity is the direct cause of an 1.129 + // event (like a keypress or mouse click). 1.130 + void UserActivity(); 1.131 +}; 1.132 + 1.133 +#endif /* nsWindow_h */