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