2012-07-20 02:10:44 -07: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-10 16:17:46 -08:00
|
|
|
|
|
|
|
#ifndef nsWindow_h
|
|
|
|
#define nsWindow_h
|
|
|
|
|
|
|
|
#include "nsBaseWidget.h"
|
2013-08-19 03:15:55 -07:00
|
|
|
#include "nsRegion.h"
|
2012-06-29 01:32:21 -07:00
|
|
|
#include "nsIIdleServiceInternal.h"
|
2011-11-10 16:17:46 -08:00
|
|
|
|
|
|
|
extern nsIntRect gScreenBounds;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace gl {
|
|
|
|
class GLContext;
|
|
|
|
}
|
|
|
|
namespace layers {
|
|
|
|
class LayersManager;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace android {
|
|
|
|
class FramebufferNativeWindow;
|
|
|
|
}
|
|
|
|
|
2011-12-15 15:38:45 -08:00
|
|
|
namespace widget {
|
|
|
|
struct InputContext;
|
|
|
|
struct InputContextAction;
|
|
|
|
}
|
|
|
|
|
2011-11-10 16:17:46 -08:00
|
|
|
class nsWindow : public nsBaseWidget
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsWindow();
|
|
|
|
virtual ~nsWindow();
|
|
|
|
|
|
|
|
static void DoDraw(void);
|
2013-10-01 20:46:03 -07:00
|
|
|
static nsEventStatus DispatchInputEvent(mozilla::WidgetGUIEvent& aEvent,
|
2012-09-11 13:05:52 -07:00
|
|
|
bool* aWasCaptured = nullptr);
|
2011-11-10 16:17:46 -08: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 01:57:50 -07:00
|
|
|
virtual bool IsVisible() const;
|
2011-11-10 16:17:46 -08:00
|
|
|
NS_IMETHOD ConstrainPosition(bool aAllowSlop,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t *aX,
|
|
|
|
int32_t *aY);
|
2012-12-12 01:57:38 -08:00
|
|
|
NS_IMETHOD Move(double aX,
|
|
|
|
double aY);
|
|
|
|
NS_IMETHOD Resize(double aWidth,
|
|
|
|
double aHeight,
|
2011-11-10 16:17:46 -08:00
|
|
|
bool aRepaint);
|
2012-12-12 01:57:38 -08:00
|
|
|
NS_IMETHOD Resize(double aX,
|
|
|
|
double aY,
|
|
|
|
double aWidth,
|
|
|
|
double aHeight,
|
2011-11-10 16:17:46 -08:00
|
|
|
bool aRepaint);
|
|
|
|
NS_IMETHOD Enable(bool aState);
|
2012-07-22 22:19:08 -07:00
|
|
|
virtual bool IsEnabled() const;
|
2011-11-10 16:17:46 -08:00
|
|
|
NS_IMETHOD SetFocus(bool aRaise = false);
|
|
|
|
NS_IMETHOD ConfigureChildren(const nsTArray<nsIWidget::Configuration>&);
|
2012-01-18 13:22:12 -08:00
|
|
|
NS_IMETHOD Invalidate(const nsIntRect &aRect);
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual void* GetNativeData(uint32_t aDataType);
|
2011-11-10 16:17:46 -08:00
|
|
|
NS_IMETHOD SetTitle(const nsAString& aTitle)
|
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
virtual nsIntPoint WidgetToScreenOffset();
|
2013-10-01 20:46:03 -07:00
|
|
|
NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
|
|
|
|
nsEventStatus& aStatus);
|
2011-11-10 16:17:46 -08:00
|
|
|
NS_IMETHOD CaptureRollupEvents(nsIRollupListener *aListener,
|
2012-10-26 06:15:22 -07:00
|
|
|
bool aDoCapture)
|
2011-11-10 16:17:46 -08:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent);
|
|
|
|
|
2012-08-14 23:13:48 -07:00
|
|
|
NS_IMETHOD MakeFullScreen(bool aFullScreen) /*MOZ_OVERRIDE*/;
|
|
|
|
|
2011-11-10 16:17:46 -08:00
|
|
|
virtual float GetDPI();
|
2013-05-01 13:04:56 -07:00
|
|
|
virtual double GetDefaultScaleInternal();
|
2011-11-10 16:17:46 -08:00
|
|
|
virtual mozilla::layers::LayerManager*
|
2013-04-24 11:42:40 -07:00
|
|
|
GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr,
|
2014-01-23 10:26:41 -08:00
|
|
|
LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE,
|
2011-11-10 16:17:46 -08:00
|
|
|
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
|
2012-07-30 07:20:58 -07:00
|
|
|
bool* aAllowRetaining = nullptr);
|
2011-11-10 16:17:46 -08:00
|
|
|
|
2011-12-15 15:38:45 -08:00
|
|
|
NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,
|
|
|
|
const InputContextAction& aAction);
|
|
|
|
NS_IMETHOD_(InputContext) GetInputContext();
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual uint32_t GetGLFrameBufferFormat() MOZ_OVERRIDE;
|
2012-01-25 18:05:34 -08:00
|
|
|
|
2012-07-24 12:01:09 -07:00
|
|
|
virtual nsIntRect GetNaturalBounds() MOZ_OVERRIDE;
|
2012-08-13 19:41:09 -07:00
|
|
|
virtual bool NeedsPaint();
|
2012-07-24 12:01:09 -07:00
|
|
|
|
2012-11-19 09:58:38 -08:00
|
|
|
virtual Composer2D* GetComposer2D() MOZ_OVERRIDE;
|
|
|
|
|
2011-11-10 16:17:46 -08:00
|
|
|
protected:
|
|
|
|
nsWindow* mParent;
|
|
|
|
bool mVisible;
|
2011-12-29 15:01:51 -08:00
|
|
|
InputContext mInputContext;
|
2012-06-29 01:32:21 -07:00
|
|
|
nsCOMPtr<nsIIdleServiceInternal> mIdleService;
|
2011-11-10 16:17:46 -08:00
|
|
|
|
|
|
|
void BringToTop();
|
2012-01-10 18:07:00 -08: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-10 16:17:46 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsWindow_h */
|