2012-07-20 09:10:44 +00:00
|
|
|
/* Copyright 2012 Mozilla Foundation and Mozilla contributors
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
2011-11-11 00:17:46 +00:00
|
|
|
|
|
|
|
#ifndef nsWindow_h
|
|
|
|
#define nsWindow_h
|
|
|
|
|
|
|
|
#include "nsBaseWidget.h"
|
2013-08-19 10:15:55 +00:00
|
|
|
#include "nsRegion.h"
|
2012-06-29 08:32:21 +00:00
|
|
|
#include "nsIIdleServiceInternal.h"
|
2011-11-11 00:17:46 +00:00
|
|
|
|
|
|
|
extern nsIntRect gScreenBounds;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace gl {
|
|
|
|
class GLContext;
|
|
|
|
}
|
|
|
|
namespace layers {
|
|
|
|
class LayersManager;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace android {
|
|
|
|
class FramebufferNativeWindow;
|
|
|
|
}
|
|
|
|
|
2011-12-15 23:38:45 +00:00
|
|
|
namespace widget {
|
|
|
|
struct InputContext;
|
|
|
|
struct InputContextAction;
|
|
|
|
}
|
|
|
|
|
2011-11-11 00:17:46 +00:00
|
|
|
class nsWindow : public nsBaseWidget
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsWindow();
|
|
|
|
virtual ~nsWindow();
|
|
|
|
|
|
|
|
static void DoDraw(void);
|
2013-10-02 03:46:03 +00:00
|
|
|
static nsEventStatus DispatchInputEvent(mozilla::WidgetGUIEvent& aEvent,
|
2012-09-11 20:05:52 +00:00
|
|
|
bool* aWasCaptured = nullptr);
|
2011-11-11 00:17:46 +00:00
|
|
|
|
|
|
|
NS_IMETHOD Create(nsIWidget *aParent,
|
|
|
|
void *aNativeParent,
|
|
|
|
const nsIntRect &aRect,
|
|
|
|
nsDeviceContext *aContext,
|
|
|
|
nsWidgetInitData *aInitData);
|
|
|
|
NS_IMETHOD Destroy(void);
|
|
|
|
|
|
|
|
NS_IMETHOD Show(bool aState);
|
2012-07-19 08:57:50 +00:00
|
|
|
virtual bool IsVisible() const;
|
2011-11-11 00:17:46 +00:00
|
|
|
NS_IMETHOD ConstrainPosition(bool aAllowSlop,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t *aX,
|
|
|
|
int32_t *aY);
|
2012-12-12 09:57:38 +00:00
|
|
|
NS_IMETHOD Move(double aX,
|
|
|
|
double aY);
|
|
|
|
NS_IMETHOD Resize(double aWidth,
|
|
|
|
double aHeight,
|
2011-11-11 00:17:46 +00:00
|
|
|
bool aRepaint);
|
2012-12-12 09:57:38 +00:00
|
|
|
NS_IMETHOD Resize(double aX,
|
|
|
|
double aY,
|
|
|
|
double aWidth,
|
|
|
|
double aHeight,
|
2011-11-11 00:17:46 +00:00
|
|
|
bool aRepaint);
|
|
|
|
NS_IMETHOD Enable(bool aState);
|
2012-07-23 05:19:08 +00:00
|
|
|
virtual bool IsEnabled() const;
|
2011-11-11 00:17:46 +00:00
|
|
|
NS_IMETHOD SetFocus(bool aRaise = false);
|
|
|
|
NS_IMETHOD ConfigureChildren(const nsTArray<nsIWidget::Configuration>&);
|
2012-01-18 21:22:12 +00:00
|
|
|
NS_IMETHOD Invalidate(const nsIntRect &aRect);
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual void* GetNativeData(uint32_t aDataType);
|
2011-11-11 00:17:46 +00:00
|
|
|
NS_IMETHOD SetTitle(const nsAString& aTitle)
|
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
virtual nsIntPoint WidgetToScreenOffset();
|
2013-10-02 03:46:03 +00:00
|
|
|
NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
|
|
|
|
nsEventStatus& aStatus);
|
2011-11-11 00:17:46 +00:00
|
|
|
NS_IMETHOD CaptureRollupEvents(nsIRollupListener *aListener,
|
2012-10-26 13:15:22 +00:00
|
|
|
bool aDoCapture)
|
2011-11-11 00:17:46 +00:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent);
|
|
|
|
|
2012-08-15 06:13:48 +00:00
|
|
|
NS_IMETHOD MakeFullScreen(bool aFullScreen) /*MOZ_OVERRIDE*/;
|
|
|
|
|
2011-11-11 00:17:46 +00:00
|
|
|
virtual float GetDPI();
|
2013-05-01 20:04:56 +00:00
|
|
|
virtual double GetDefaultScaleInternal();
|
2011-11-11 00:17:46 +00:00
|
|
|
virtual mozilla::layers::LayerManager*
|
2013-04-24 18:42:40 +00:00
|
|
|
GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr,
|
2014-01-23 18:26:41 +00:00
|
|
|
LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE,
|
2011-11-11 00:17:46 +00:00
|
|
|
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
|
2012-07-30 14:20:58 +00:00
|
|
|
bool* aAllowRetaining = nullptr);
|
2011-11-11 00:17:46 +00:00
|
|
|
gfxASurface* GetThebesSurface();
|
|
|
|
|
2011-12-15 23:38:45 +00:00
|
|
|
NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,
|
|
|
|
const InputContextAction& aAction);
|
|
|
|
NS_IMETHOD_(InputContext) GetInputContext();
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual uint32_t GetGLFrameBufferFormat() MOZ_OVERRIDE;
|
2012-01-26 02:05:34 +00:00
|
|
|
|
2012-07-24 19:01:09 +00:00
|
|
|
virtual nsIntRect GetNaturalBounds() MOZ_OVERRIDE;
|
2012-08-14 02:41:09 +00:00
|
|
|
virtual bool NeedsPaint();
|
2012-07-24 19:01:09 +00:00
|
|
|
|
2012-11-19 17:58:38 +00:00
|
|
|
virtual Composer2D* GetComposer2D() MOZ_OVERRIDE;
|
|
|
|
|
2011-11-11 00:17:46 +00:00
|
|
|
protected:
|
|
|
|
nsWindow* mParent;
|
|
|
|
bool mVisible;
|
2011-12-29 23:01:51 +00:00
|
|
|
nsIntRegion mDirtyRegion;
|
|
|
|
InputContext mInputContext;
|
2012-06-29 08:32:21 +00:00
|
|
|
nsCOMPtr<nsIIdleServiceInternal> mIdleService;
|
2011-11-11 00:17:46 +00:00
|
|
|
|
|
|
|
void BringToTop();
|
2012-01-11 02:07:00 +00:00
|
|
|
|
|
|
|
// Call this function when the users activity is the direct cause of an
|
|
|
|
// event (like a keypress or mouse click).
|
|
|
|
void UserActivity();
|
2011-11-11 00:17:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsWindow_h */
|