Bug 602787 part.2 Don't implement nsIWidgetListener in its header file r=roc

This commit is contained in:
Masayuki Nakano 2013-10-22 22:27:34 +09:00
parent c3b46ba6e2
commit 7811d5c344
10 changed files with 149 additions and 24 deletions

View File

@ -11,6 +11,7 @@
#include "nsPoint.h"
#include "nsRegion.h"
#include "nsCRT.h"
#include "nsWidgetInitData.h" // for nsWindowType
#include "nsIWidgetListener.h"
#include "mozilla/EventForwards.h"

View File

@ -5,13 +5,15 @@
#ifndef nsIWidgetListener_h__
#define nsIWidgetListener_h__
#include "nscore.h"
#include "nsIXULWindow.h"
#include "nsRegion.h"
#include "mozilla/BasicEvents.h"
#include <stdint.h>
#include "mozilla/EventForwards.h"
class nsView;
class nsIntRegion;
class nsIPresShell;
class nsIWidget;
class nsIXULWindow;
/**
* sizemode is an adjunct to widget size
@ -43,34 +45,35 @@ public:
* this is likely a listener for a view, which can be determined using
* GetView. If both methods return null, this will be an nsWebBrowser.
*/
virtual nsIXULWindow* GetXULWindow() { return nullptr; }
virtual nsIXULWindow* GetXULWindow();
/**
* If this listener is for an nsView, return it.
*/
virtual nsView* GetView() { return nullptr; }
virtual nsView* GetView();
/**
* Return the presshell for this widget listener.
*/
virtual nsIPresShell* GetPresShell() { return nullptr; }
virtual nsIPresShell* GetPresShell();
/**
* Called when a window is moved to location (x, y). Returns true if the
* notification was handled. Coordinates are outer window screen coordinates.
*/
virtual bool WindowMoved(nsIWidget* aWidget, int32_t aX, int32_t aY) { return false; }
virtual bool WindowMoved(nsIWidget* aWidget, int32_t aX, int32_t aY);
/**
* Called when a window is resized to (width, height). Returns true if the
* notification was handled. Coordinates are outer window screen coordinates.
*/
virtual bool WindowResized(nsIWidget* aWidget, int32_t aWidth, int32_t aHeight) { return false; }
virtual bool WindowResized(nsIWidget* aWidget,
int32_t aWidth, int32_t aHeight);
/**
* Called when the size mode (minimized, maximized, fullscreen) is changed.
*/
virtual void SizeModeChanged(nsSizeMode sizeMode) { }
virtual void SizeModeChanged(nsSizeMode aSizeMode);
/**
* Called when the z-order of the window is changed. Returns true if the
@ -79,36 +82,37 @@ public:
* window to place below. On return, aActualBelow will be set to the
* window actually behind. This generally only applies to Windows.
*/
virtual bool ZLevelChanged(bool aImmediate, nsWindowZ *aPlacement,
nsIWidget* aRequestBelow, nsIWidget** aActualBelow) { return false; }
virtual bool ZLevelChanged(bool aImmediate, nsWindowZ* aPlacement,
nsIWidget* aRequestBelow,
nsIWidget** aActualBelow);
/**
* Called when the window is activated and focused.
*/
virtual void WindowActivated() { }
virtual void WindowActivated();
/**
* Called when the window is deactivated and no longer focused.
*/
virtual void WindowDeactivated() { }
virtual void WindowDeactivated();
/**
* Called when the show/hide toolbar button on the Mac titlebar is pressed.
*/
virtual void OSToolbarButtonPressed() { }
virtual void OSToolbarButtonPressed();
/**
* Called when a request is made to close the window. Returns true if the
* notification was handled. Returns true if the notification was handled.
*/
virtual bool RequestWindowClose(nsIWidget* aWidget) { return false; }
virtual bool RequestWindowClose(nsIWidget* aWidget);
/*
* Indicate that a paint is about to occur on this window. This is called
* at a time when it's OK to change the geometry of this widget or of
* other widgets. Must be called before every call to PaintWindow.
*/
virtual void WillPaintWindow(nsIWidget* aWidget) { }
virtual void WillPaintWindow(nsIWidget* aWidget);
/**
* Paint the specified region of the window. Returns true if the
@ -116,7 +120,7 @@ public:
* This is called at a time when it is not OK to change the geometry of
* this widget or of other widgets.
*/
virtual bool PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion) { return false; }
virtual bool PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion);
/**
* Indicates that a paint occurred.
@ -124,21 +128,18 @@ public:
* this widget or of other widgets.
* Must be called after every call to PaintWindow.
*/
virtual void DidPaintWindow() { }
virtual void DidPaintWindow();
/**
* Request that layout schedules a repaint on the next refresh driver tick.
*/
virtual void RequestRepaint() { }
virtual void RequestRepaint();
/**
* Handle an event.
*/
virtual nsEventStatus HandleEvent(mozilla::WidgetGUIEvent* aEvent,
bool aUseAttachedEvents)
{
return nsEventStatus_eIgnore;
}
bool aUseAttachedEvents);
};
#endif

View File

@ -29,6 +29,7 @@ CPP_SOURCES += [
'nsFilePickerProxy.cpp',
'nsHTMLFormatConverter.cpp',
'nsIdleService.cpp',
'nsIWidgetListener.cpp',
'nsPrimitiveHelpers.cpp',
'nsPrintOptionsImpl.cpp',
'nsPrintSession.cpp',

View File

@ -0,0 +1,114 @@
/* -*- Mode: C++; tab-width: 2; 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/. */
#include "nsIWidgetListener.h"
#include "nsRegion.h"
#include "nsView.h"
#include "nsIPresShell.h"
#include "nsIWidget.h"
#include "nsIXULWindow.h"
#include "mozilla/BasicEvents.h"
using namespace mozilla;
nsIXULWindow*
nsIWidgetListener::GetXULWindow()
{
return nullptr;
}
nsView*
nsIWidgetListener::GetView()
{
return nullptr;
}
nsIPresShell*
nsIWidgetListener::GetPresShell()
{
return nullptr;
}
bool
nsIWidgetListener::WindowMoved(nsIWidget* aWidget,
int32_t aX,
int32_t aY)
{
return false;
}
bool
nsIWidgetListener::WindowResized(nsIWidget* aWidget,
int32_t aWidth,
int32_t aHeight)
{
return false;
}
void
nsIWidgetListener::SizeModeChanged(nsSizeMode aSizeMode)
{
}
bool
nsIWidgetListener::ZLevelChanged(bool aImmediate,
nsWindowZ* aPlacement,
nsIWidget* aRequestBelow,
nsIWidget** aActualBelow)
{
return false;
}
void
nsIWidgetListener::WindowActivated()
{
}
void
nsIWidgetListener::WindowDeactivated()
{
}
void
nsIWidgetListener::OSToolbarButtonPressed()
{
}
bool
nsIWidgetListener::RequestWindowClose(nsIWidget* aWidget)
{
return false;
}
void
nsIWidgetListener::WillPaintWindow(nsIWidget* aWidget)
{
}
bool
nsIWidgetListener::PaintWindow(nsIWidget* aWidget,
nsIntRegion aRegion)
{
return false;
}
void
nsIWidgetListener::DidPaintWindow()
{
}
void
nsIWidgetListener::RequestRepaint()
{
}
nsEventStatus
nsIWidgetListener::HandleEvent(WidgetGUIEvent* aEvent,
bool aUseAttachedEvents)
{
return nsEventStatus_eIgnore;
}

View File

@ -23,7 +23,9 @@
#include "nsCRT.h"
#include "prprf.h"
#include "nsWidgetInitData.h"
#include "nsWidgetsCID.h"
#include "nsIWidget.h"
#include "nsIRequestObserver.h"
/* For implementing GetHiddenWindowAndJSContext */

View File

@ -19,6 +19,7 @@
#include "nsIAuthPrompt.h"
#include "nsIBrowserDOMWindow.h"
#include "nsIWebProgress.h"
#include "nsIWidget.h"
#include "nsIWindowMediator.h"
#include "nsIDOMChromeWindow.h"
#include "nsIDOMNode.h"

View File

@ -34,6 +34,7 @@
#include "nsDocShellCID.h"
#include "nsIExternalURLHandlerService.h"
#include "nsIMIMEInfo.h"
#include "nsIWidget.h"
#include "mozilla/BrowserElementParent.h"
#include "nsIDOMDocument.h"

View File

@ -26,6 +26,7 @@
#include "nsIDOMXULElement.h"
#include "nsWidgetInitData.h"
#include "nsWidgetsCID.h"
#include "nsIWidget.h"
#include "nsIWidgetListener.h"

View File

@ -16,6 +16,8 @@
/* Forward declarations.... */
class nsIURI;
struct nsWidgetInitData;
namespace mozilla {
class WebShellWindowTimerCallback;
} // namespace mozilla

View File

@ -17,6 +17,7 @@
#include "nsString.h"
#include "nsWeakReference.h"
#include "nsCOMArray.h"
#include "nsRect.h"
// Interfaces needed
#include "nsIBaseWindow.h"