2013-01-07 15:18:11 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef nsWindowBase_h_
|
|
|
|
#define nsWindowBase_h_
|
|
|
|
|
2013-10-22 13:27:35 +00:00
|
|
|
#include "mozilla/EventForwards.h"
|
2013-01-07 15:18:11 +00:00
|
|
|
#include "nsBaseWidget.h"
|
2013-05-29 06:34:47 +00:00
|
|
|
#include <windows.h>
|
2013-01-07 15:18:11 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* nsWindowBase - Base class of common methods other classes need to access
|
|
|
|
* in both win32 and winrt window classes.
|
|
|
|
*/
|
|
|
|
class nsWindowBase : public nsBaseWidget
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/*
|
|
|
|
* Return the HWND or null for this widget.
|
|
|
|
*/
|
|
|
|
virtual HWND GetWindowHandle() MOZ_FINAL {
|
|
|
|
return static_cast<HWND>(GetNativeData(NS_NATIVE_WINDOW));
|
|
|
|
}
|
|
|
|
|
2013-08-09 10:12:38 +00:00
|
|
|
/*
|
|
|
|
* Return the parent window, if it exists.
|
|
|
|
*/
|
|
|
|
virtual nsWindowBase* GetParentWindowBase(bool aIncludeOwner) = 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Return true if this is a top level widget.
|
|
|
|
*/
|
|
|
|
virtual bool IsTopLevelWidget() = 0;
|
|
|
|
|
2013-01-07 15:18:11 +00:00
|
|
|
/*
|
|
|
|
* Init a standard gecko event for this widget.
|
2013-08-12 10:05:04 +00:00
|
|
|
* @param aEvent the event to initialize.
|
|
|
|
* @param aPoint message position in physical coordinates.
|
2013-01-07 15:18:11 +00:00
|
|
|
*/
|
2013-10-02 03:46:03 +00:00
|
|
|
virtual void InitEvent(mozilla::WidgetGUIEvent& aEvent,
|
|
|
|
nsIntPoint* aPoint = nullptr) = 0;
|
2013-01-07 15:18:11 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Dispatch a gecko event for this widget.
|
2013-07-02 04:55:58 +00:00
|
|
|
* Returns true if it's consumed. Otherwise, false.
|
2013-01-07 15:18:11 +00:00
|
|
|
*/
|
2013-10-02 03:46:03 +00:00
|
|
|
virtual bool DispatchWindowEvent(mozilla::WidgetGUIEvent* aEvent) = 0;
|
2013-05-29 06:34:48 +00:00
|
|
|
|
|
|
|
/*
|
2013-09-06 13:11:15 +00:00
|
|
|
* Dispatch a gecko keyboard event for this widget. This
|
|
|
|
* is called by KeyboardLayout to dispatch gecko events.
|
|
|
|
* Returns true if it's consumed. Otherwise, false.
|
|
|
|
*/
|
2013-10-02 03:46:03 +00:00
|
|
|
virtual bool DispatchKeyboardEvent(mozilla::WidgetGUIEvent* aEvent) = 0;
|
2013-09-06 13:11:15 +00:00
|
|
|
|
2013-10-24 21:35:07 +00:00
|
|
|
/*
|
|
|
|
* Dispatch a gecko scroll event for this widget. This
|
|
|
|
* is called by ScrollHandler to dispatch gecko events.
|
|
|
|
* Returns true if it's consumed. Otherwise, false.
|
|
|
|
*/
|
|
|
|
virtual bool DispatchScrollEvent(mozilla::WidgetGUIEvent* aEvent) = 0;
|
|
|
|
|
2013-09-06 13:11:15 +00:00
|
|
|
/*
|
|
|
|
* Default dispatch of a plugin event.
|
2013-05-29 06:34:48 +00:00
|
|
|
*/
|
2013-10-22 13:27:35 +00:00
|
|
|
virtual bool DispatchPluginEvent(const MSG& aMsg);
|
2013-05-29 06:34:48 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Returns true if a plugin has focus on this widget. Otherwise, false.
|
|
|
|
*/
|
|
|
|
virtual bool PluginHasFocus() const MOZ_FINAL
|
|
|
|
{
|
|
|
|
return (mInputContext.mIMEState.mEnabled == IMEState::PLUGIN);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
InputContext mInputContext;
|
2013-01-07 15:18:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsWindowBase_h_
|