зеркало из https://github.com/mozilla/gecko-dev.git
changes for better naming conventions of interfaces and their implementation
This commit is contained in:
Родитель
baca672151
Коммит
b0e2c08be3
|
@ -15,23 +15,22 @@
|
||||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||||
* Reserved.
|
* Reserved.
|
||||||
*/
|
*/
|
||||||
#include "nsEditorInterfaces.h"
|
#include "editorInterfaces.h"
|
||||||
#include "nsEditorMode.h"
|
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nsEditorKeyListener implementation
|
* editorKeyListener implementation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
nsEditorKeyListener::nsEditorKeyListener()
|
editorKeyListener::editorKeyListener()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
nsEditorKeyListener::~nsEditorKeyListener()
|
editorKeyListener::~editorKeyListener()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEditorKeyListener::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
nsresult editorKeyListener::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||||
{
|
{
|
||||||
if (NULL == aInstancePtr) {
|
if (NULL == aInstancePtr) {
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
@ -57,16 +56,16 @@ nsresult nsEditorKeyListener::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||||
return NS_NOINTERFACE;
|
return NS_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_ADDREF(nsEditorKeyListener)
|
NS_IMPL_ADDREF(editorKeyListener)
|
||||||
|
|
||||||
NS_IMPL_RELEASE(nsEditorKeyListener)
|
NS_IMPL_RELEASE(editorKeyListener)
|
||||||
|
|
||||||
nsresult nsEditorKeyListener::ProcessEvent(nsIDOMEvent* aEvent)
|
nsresult editorKeyListener::ProcessEvent(nsIDOMEvent* aEvent)
|
||||||
{
|
{
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEditorKeyListener::GetCharFromKeyCode(PRUint32 aKeyCode, PRBool aIsShift, char *aChar)
|
nsresult editorKeyListener::GetCharFromKeyCode(PRUint32 aKeyCode, PRBool aIsShift, char *aChar)
|
||||||
{
|
{
|
||||||
/* This is completely temporary to get this working while I check out Unicode conversion code. */
|
/* This is completely temporary to get this working while I check out Unicode conversion code. */
|
||||||
if (aKeyCode >= 0x41 && aKeyCode <= 0x5A) {
|
if (aKeyCode >= 0x41 && aKeyCode <= 0x5A) {
|
||||||
|
@ -85,7 +84,7 @@ nsresult nsEditorKeyListener::GetCharFromKeyCode(PRUint32 aKeyCode, PRBool aIsSh
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEditorKeyListener::KeyDown(nsIDOMEvent* aKeyEvent)
|
nsresult editorKeyListener::KeyDown(nsIDOMEvent* aKeyEvent)
|
||||||
{
|
{
|
||||||
PRUint32 mKeyCode;
|
PRUint32 mKeyCode;
|
||||||
PRBool mIsShift;
|
PRBool mIsShift;
|
||||||
|
@ -117,29 +116,29 @@ nsresult nsEditorKeyListener::KeyDown(nsIDOMEvent* aKeyEvent)
|
||||||
return NS_ERROR_BASE;
|
return NS_ERROR_BASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEditorKeyListener::KeyUp(nsIDOMEvent* aKeyEvent)
|
nsresult editorKeyListener::KeyUp(nsIDOMEvent* aKeyEvent)
|
||||||
{
|
{
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEditorKeyListener::KeyPress(nsIDOMEvent* aKeyEvent)
|
nsresult editorKeyListener::KeyPress(nsIDOMEvent* aKeyEvent)
|
||||||
{
|
{
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nsEditorMouseListener implementation
|
* editorMouseListener implementation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
nsEditorMouseListener::nsEditorMouseListener()
|
editorMouseListener::editorMouseListener()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
nsEditorMouseListener::~nsEditorMouseListener()
|
editorMouseListener::~editorMouseListener()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEditorMouseListener::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
nsresult editorMouseListener::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||||
{
|
{
|
||||||
if (NULL == aInstancePtr) {
|
if (NULL == aInstancePtr) {
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
@ -165,16 +164,16 @@ nsresult nsEditorMouseListener::QueryInterface(REFNSIID aIID, void** aInstancePt
|
||||||
return NS_NOINTERFACE;
|
return NS_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_ADDREF(nsEditorMouseListener)
|
NS_IMPL_ADDREF(editorMouseListener)
|
||||||
|
|
||||||
NS_IMPL_RELEASE(nsEditorMouseListener)
|
NS_IMPL_RELEASE(editorMouseListener)
|
||||||
|
|
||||||
nsresult nsEditorMouseListener::ProcessEvent(nsIDOMEvent* aEvent)
|
nsresult editorMouseListener::ProcessEvent(nsIDOMEvent* aEvent)
|
||||||
{
|
{
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEditorMouseListener::MouseDown(nsIDOMEvent* aMouseEvent)
|
nsresult editorMouseListener::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||||
{
|
{
|
||||||
nsIDOMNode *aTarget;
|
nsIDOMNode *aTarget;
|
||||||
if (NS_OK == aMouseEvent->GetTarget(&aTarget)) {
|
if (NS_OK == aMouseEvent->GetTarget(&aTarget)) {
|
||||||
|
@ -185,27 +184,27 @@ nsresult nsEditorMouseListener::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||||
return NS_ERROR_BASE;
|
return NS_ERROR_BASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEditorMouseListener::MouseUp(nsIDOMEvent* aMouseEvent)
|
nsresult editorMouseListener::MouseUp(nsIDOMEvent* aMouseEvent)
|
||||||
{
|
{
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEditorMouseListener::MouseClick(nsIDOMEvent* aMouseEvent)
|
nsresult editorMouseListener::MouseClick(nsIDOMEvent* aMouseEvent)
|
||||||
{
|
{
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEditorMouseListener::MouseDblClick(nsIDOMEvent* aMouseEvent)
|
nsresult editorMouseListener::MouseDblClick(nsIDOMEvent* aMouseEvent)
|
||||||
{
|
{
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEditorMouseListener::MouseOver(nsIDOMEvent* aMouseEvent)
|
nsresult editorMouseListener::MouseOver(nsIDOMEvent* aMouseEvent)
|
||||||
{
|
{
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEditorMouseListener::MouseOut(nsIDOMEvent* aMouseEvent)
|
nsresult editorMouseListener::MouseOut(nsIDOMEvent* aMouseEvent)
|
||||||
{
|
{
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -216,7 +215,7 @@ nsresult nsEditorMouseListener::MouseOut(nsIDOMEvent* aMouseEvent)
|
||||||
|
|
||||||
nsresult NS_NewEditorKeyListener(nsIDOMEventListener ** aInstancePtrResult)
|
nsresult NS_NewEditorKeyListener(nsIDOMEventListener ** aInstancePtrResult)
|
||||||
{
|
{
|
||||||
nsEditorKeyListener* it = new nsEditorKeyListener();
|
editorKeyListener* it = new editorKeyListener();
|
||||||
if (NULL == it) {
|
if (NULL == it) {
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
@ -228,7 +227,7 @@ nsresult NS_NewEditorKeyListener(nsIDOMEventListener ** aInstancePtrResult)
|
||||||
|
|
||||||
nsresult NS_NewEditorMouseListener(nsIDOMEventListener ** aInstancePtrResult)
|
nsresult NS_NewEditorMouseListener(nsIDOMEventListener ** aInstancePtrResult)
|
||||||
{
|
{
|
||||||
nsEditorMouseListener* it = new nsEditorMouseListener();
|
editorMouseListener* it = new editorMouseListener();
|
||||||
if (NULL == it) {
|
if (NULL == it) {
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
|
@ -16,8 +16,8 @@
|
||||||
* Reserved.
|
* Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef nsEditorInterfaces_h__
|
#ifndef editorInterfaces_h__
|
||||||
#define nsEditorInterfaces_h__
|
#define editorInterfaces_h__
|
||||||
|
|
||||||
#include "nsIDOMEvent.h"
|
#include "nsIDOMEvent.h"
|
||||||
#include "nsIDOMKeyListener.h"
|
#include "nsIDOMKeyListener.h"
|
||||||
|
@ -27,20 +27,20 @@
|
||||||
class Editor;
|
class Editor;
|
||||||
|
|
||||||
//nsIDOMKeyListener interface
|
//nsIDOMKeyListener interface
|
||||||
/** The nsEditorKeyListener public nsIDOMKeyListener
|
/** The editorKeyListener public nsIDOMKeyListener
|
||||||
* This class will delegate events to its editor according to the translation
|
* This class will delegate events to its editor according to the translation
|
||||||
* it is responsible for. i.e. 'c' becomes a keydown, but 'ESC' becomes nothing.
|
* it is responsible for. i.e. 'c' becomes a keydown, but 'ESC' becomes nothing.
|
||||||
* This should be done through contexts that are loaded from URLs
|
* This should be done through contexts that are loaded from URLs
|
||||||
*/
|
*/
|
||||||
class nsEditorKeyListener : public nsIDOMKeyListener {
|
class editorKeyListener : public nsIDOMKeyListener {
|
||||||
Editor *mEditorP;
|
Editor *mEditorP;
|
||||||
public:
|
public:
|
||||||
/** the default constructor
|
/** the default constructor
|
||||||
*/
|
*/
|
||||||
nsEditorKeyListener();
|
editorKeyListener();
|
||||||
/** the default destructor. virtual due to the possibility of derivation.
|
/** the default destructor. virtual due to the possibility of derivation.
|
||||||
*/
|
*/
|
||||||
virtual ~nsEditorKeyListener();
|
virtual ~editorKeyListener();
|
||||||
|
|
||||||
/** SetEditor gives an address to the editor that will be accessed
|
/** SetEditor gives an address to the editor that will be accessed
|
||||||
* @param Editor *aEditor simple
|
* @param Editor *aEditor simple
|
||||||
|
@ -72,16 +72,16 @@ private:
|
||||||
/** editor Implementation of the MouseListener interface
|
/** editor Implementation of the MouseListener interface
|
||||||
* nsIDOMMouseListener interface
|
* nsIDOMMouseListener interface
|
||||||
*/
|
*/
|
||||||
class nsEditorMouseListener : public nsIDOMMouseListener
|
class editorMouseListener : public nsIDOMMouseListener
|
||||||
{
|
{
|
||||||
Editor *mEditorP;
|
Editor *mEditorP;
|
||||||
public:
|
public:
|
||||||
/** default constructor
|
/** default constructor
|
||||||
*/
|
*/
|
||||||
nsEditorMouseListener();
|
editorMouseListener();
|
||||||
/** default destructor
|
/** default destructor
|
||||||
*/
|
*/
|
||||||
virtual ~nsEditorMouseListener();
|
virtual ~editorMouseListener();
|
||||||
|
|
||||||
/** SetEditor gives an address to the editor that will be accessed
|
/** SetEditor gives an address to the editor that will be accessed
|
||||||
* @param Editor *aEditor simple
|
* @param Editor *aEditor simple
|
||||||
|
@ -116,5 +116,5 @@ extern nsresult NS_NewEditorKeyListener(nsIDOMEventListener ** aInstancePtrResul
|
||||||
*/
|
*/
|
||||||
extern nsresult NS_NewEditorMouseListener(nsIDOMEventListener ** aInstancePtrResult, Editor *aEditorP);
|
extern nsresult NS_NewEditorMouseListener(nsIDOMEventListener ** aInstancePtrResult, Editor *aEditorP);
|
||||||
|
|
||||||
#endif //nsEditorInterfaces_h__
|
#endif //editorInterfaces_h__
|
||||||
|
|
|
@ -15,23 +15,22 @@
|
||||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||||
* Reserved.
|
* Reserved.
|
||||||
*/
|
*/
|
||||||
#include "nsEditorInterfaces.h"
|
#include "editorInterfaces.h"
|
||||||
#include "nsEditorMode.h"
|
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nsEditorKeyListener implementation
|
* editorKeyListener implementation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
nsEditorKeyListener::nsEditorKeyListener()
|
editorKeyListener::editorKeyListener()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
nsEditorKeyListener::~nsEditorKeyListener()
|
editorKeyListener::~editorKeyListener()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEditorKeyListener::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
nsresult editorKeyListener::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||||
{
|
{
|
||||||
if (NULL == aInstancePtr) {
|
if (NULL == aInstancePtr) {
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
@ -57,16 +56,16 @@ nsresult nsEditorKeyListener::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||||
return NS_NOINTERFACE;
|
return NS_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_ADDREF(nsEditorKeyListener)
|
NS_IMPL_ADDREF(editorKeyListener)
|
||||||
|
|
||||||
NS_IMPL_RELEASE(nsEditorKeyListener)
|
NS_IMPL_RELEASE(editorKeyListener)
|
||||||
|
|
||||||
nsresult nsEditorKeyListener::ProcessEvent(nsIDOMEvent* aEvent)
|
nsresult editorKeyListener::ProcessEvent(nsIDOMEvent* aEvent)
|
||||||
{
|
{
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEditorKeyListener::GetCharFromKeyCode(PRUint32 aKeyCode, PRBool aIsShift, char *aChar)
|
nsresult editorKeyListener::GetCharFromKeyCode(PRUint32 aKeyCode, PRBool aIsShift, char *aChar)
|
||||||
{
|
{
|
||||||
/* This is completely temporary to get this working while I check out Unicode conversion code. */
|
/* This is completely temporary to get this working while I check out Unicode conversion code. */
|
||||||
if (aKeyCode >= 0x41 && aKeyCode <= 0x5A) {
|
if (aKeyCode >= 0x41 && aKeyCode <= 0x5A) {
|
||||||
|
@ -85,7 +84,7 @@ nsresult nsEditorKeyListener::GetCharFromKeyCode(PRUint32 aKeyCode, PRBool aIsSh
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEditorKeyListener::KeyDown(nsIDOMEvent* aKeyEvent)
|
nsresult editorKeyListener::KeyDown(nsIDOMEvent* aKeyEvent)
|
||||||
{
|
{
|
||||||
PRUint32 mKeyCode;
|
PRUint32 mKeyCode;
|
||||||
PRBool mIsShift;
|
PRBool mIsShift;
|
||||||
|
@ -117,29 +116,29 @@ nsresult nsEditorKeyListener::KeyDown(nsIDOMEvent* aKeyEvent)
|
||||||
return NS_ERROR_BASE;
|
return NS_ERROR_BASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEditorKeyListener::KeyUp(nsIDOMEvent* aKeyEvent)
|
nsresult editorKeyListener::KeyUp(nsIDOMEvent* aKeyEvent)
|
||||||
{
|
{
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEditorKeyListener::KeyPress(nsIDOMEvent* aKeyEvent)
|
nsresult editorKeyListener::KeyPress(nsIDOMEvent* aKeyEvent)
|
||||||
{
|
{
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nsEditorMouseListener implementation
|
* editorMouseListener implementation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
nsEditorMouseListener::nsEditorMouseListener()
|
editorMouseListener::editorMouseListener()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
nsEditorMouseListener::~nsEditorMouseListener()
|
editorMouseListener::~editorMouseListener()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEditorMouseListener::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
nsresult editorMouseListener::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||||
{
|
{
|
||||||
if (NULL == aInstancePtr) {
|
if (NULL == aInstancePtr) {
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
@ -165,16 +164,16 @@ nsresult nsEditorMouseListener::QueryInterface(REFNSIID aIID, void** aInstancePt
|
||||||
return NS_NOINTERFACE;
|
return NS_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_ADDREF(nsEditorMouseListener)
|
NS_IMPL_ADDREF(editorMouseListener)
|
||||||
|
|
||||||
NS_IMPL_RELEASE(nsEditorMouseListener)
|
NS_IMPL_RELEASE(editorMouseListener)
|
||||||
|
|
||||||
nsresult nsEditorMouseListener::ProcessEvent(nsIDOMEvent* aEvent)
|
nsresult editorMouseListener::ProcessEvent(nsIDOMEvent* aEvent)
|
||||||
{
|
{
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEditorMouseListener::MouseDown(nsIDOMEvent* aMouseEvent)
|
nsresult editorMouseListener::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||||
{
|
{
|
||||||
nsIDOMNode *aTarget;
|
nsIDOMNode *aTarget;
|
||||||
if (NS_OK == aMouseEvent->GetTarget(&aTarget)) {
|
if (NS_OK == aMouseEvent->GetTarget(&aTarget)) {
|
||||||
|
@ -185,27 +184,27 @@ nsresult nsEditorMouseListener::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||||
return NS_ERROR_BASE;
|
return NS_ERROR_BASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEditorMouseListener::MouseUp(nsIDOMEvent* aMouseEvent)
|
nsresult editorMouseListener::MouseUp(nsIDOMEvent* aMouseEvent)
|
||||||
{
|
{
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEditorMouseListener::MouseClick(nsIDOMEvent* aMouseEvent)
|
nsresult editorMouseListener::MouseClick(nsIDOMEvent* aMouseEvent)
|
||||||
{
|
{
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEditorMouseListener::MouseDblClick(nsIDOMEvent* aMouseEvent)
|
nsresult editorMouseListener::MouseDblClick(nsIDOMEvent* aMouseEvent)
|
||||||
{
|
{
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEditorMouseListener::MouseOver(nsIDOMEvent* aMouseEvent)
|
nsresult editorMouseListener::MouseOver(nsIDOMEvent* aMouseEvent)
|
||||||
{
|
{
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEditorMouseListener::MouseOut(nsIDOMEvent* aMouseEvent)
|
nsresult editorMouseListener::MouseOut(nsIDOMEvent* aMouseEvent)
|
||||||
{
|
{
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -216,7 +215,7 @@ nsresult nsEditorMouseListener::MouseOut(nsIDOMEvent* aMouseEvent)
|
||||||
|
|
||||||
nsresult NS_NewEditorKeyListener(nsIDOMEventListener ** aInstancePtrResult)
|
nsresult NS_NewEditorKeyListener(nsIDOMEventListener ** aInstancePtrResult)
|
||||||
{
|
{
|
||||||
nsEditorKeyListener* it = new nsEditorKeyListener();
|
editorKeyListener* it = new editorKeyListener();
|
||||||
if (NULL == it) {
|
if (NULL == it) {
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
@ -228,7 +227,7 @@ nsresult NS_NewEditorKeyListener(nsIDOMEventListener ** aInstancePtrResult)
|
||||||
|
|
||||||
nsresult NS_NewEditorMouseListener(nsIDOMEventListener ** aInstancePtrResult)
|
nsresult NS_NewEditorMouseListener(nsIDOMEventListener ** aInstancePtrResult)
|
||||||
{
|
{
|
||||||
nsEditorMouseListener* it = new nsEditorMouseListener();
|
editorMouseListener* it = new editorMouseListener();
|
||||||
if (NULL == it) {
|
if (NULL == it) {
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
|
@ -0,0 +1,120 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Netscape Public License
|
||||||
|
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||||
|
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||||
|
* http://www.mozilla.org/NPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* NPL.
|
||||||
|
*
|
||||||
|
* The Initial Developer of this code under the NPL is Netscape
|
||||||
|
* Communications Corporation. Portions created by Netscape are
|
||||||
|
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||||
|
* Reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef editorInterfaces_h__
|
||||||
|
#define editorInterfaces_h__
|
||||||
|
|
||||||
|
#include "nsIDOMEvent.h"
|
||||||
|
#include "nsIDOMKeyListener.h"
|
||||||
|
#include "nsIDOMMouseListener.h"
|
||||||
|
|
||||||
|
//prototype for the Editor class that will be included in the .cpp file
|
||||||
|
class Editor;
|
||||||
|
|
||||||
|
//nsIDOMKeyListener interface
|
||||||
|
/** The editorKeyListener public nsIDOMKeyListener
|
||||||
|
* This class will delegate events to its editor according to the translation
|
||||||
|
* it is responsible for. i.e. 'c' becomes a keydown, but 'ESC' becomes nothing.
|
||||||
|
* This should be done through contexts that are loaded from URLs
|
||||||
|
*/
|
||||||
|
class editorKeyListener : public nsIDOMKeyListener {
|
||||||
|
Editor *mEditorP;
|
||||||
|
public:
|
||||||
|
/** the default constructor
|
||||||
|
*/
|
||||||
|
editorKeyListener();
|
||||||
|
/** the default destructor. virtual due to the possibility of derivation.
|
||||||
|
*/
|
||||||
|
virtual ~editorKeyListener();
|
||||||
|
|
||||||
|
/** SetEditor gives an address to the editor that will be accessed
|
||||||
|
* @param Editor *aEditor simple
|
||||||
|
*/
|
||||||
|
void SetEditor(Editor *aEditorP){mEditorP = mEditorP;}
|
||||||
|
|
||||||
|
/** GetEditor returns a copy of the address the keylistener has
|
||||||
|
* @return copy of the editor address
|
||||||
|
*/
|
||||||
|
Editor *GetEditor(){ return mEditorP; }
|
||||||
|
|
||||||
|
/*interfaces for addref and release and queryinterface*/
|
||||||
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
|
/*BEGIN interfaces in to the keylister base interface. must be supplied to handle pure virtual interfaces
|
||||||
|
see the nsIDOMKeyListener interface implementation for details
|
||||||
|
*/
|
||||||
|
virtual nsresult ProcessEvent(nsIDOMEvent* aEvent);
|
||||||
|
public:
|
||||||
|
virtual nsresult KeyDown(nsIDOMEvent* aKeyEvent);
|
||||||
|
virtual nsresult KeyUp(nsIDOMEvent* aKeyEvent);
|
||||||
|
virtual nsresult KeyPress(nsIDOMEvent* aKeyEvent);
|
||||||
|
/*END interfaces from nsIDOMKeyListener*/
|
||||||
|
private:
|
||||||
|
virtual nsresult GetCharFromKeyCode(PRUint32 aKeyCode, PRBool aIsShift, char *aChar);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/** editor Implementation of the MouseListener interface
|
||||||
|
* nsIDOMMouseListener interface
|
||||||
|
*/
|
||||||
|
class editorMouseListener : public nsIDOMMouseListener
|
||||||
|
{
|
||||||
|
Editor *mEditorP;
|
||||||
|
public:
|
||||||
|
/** default constructor
|
||||||
|
*/
|
||||||
|
editorMouseListener();
|
||||||
|
/** default destructor
|
||||||
|
*/
|
||||||
|
virtual ~editorMouseListener();
|
||||||
|
|
||||||
|
/** SetEditor gives an address to the editor that will be accessed
|
||||||
|
* @param Editor *aEditor simple
|
||||||
|
*/
|
||||||
|
void SetEditor(Editor *aEditorP){mEditorP = mEditorP;}
|
||||||
|
|
||||||
|
/** GetEditor returns a copy of the address the keylistener has
|
||||||
|
* @return copy of the editor address
|
||||||
|
*/
|
||||||
|
Editor *GetEditor(){ return mEditorP; }
|
||||||
|
|
||||||
|
/*interfaces for addref and release and queryinterface*/
|
||||||
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
|
/*BEGIN implementations of mouseevent handler interface*/
|
||||||
|
virtual nsresult ProcessEvent(nsIDOMEvent* aEvent);
|
||||||
|
public:
|
||||||
|
virtual nsresult MouseDown(nsIDOMEvent* aMouseEvent);
|
||||||
|
virtual nsresult MouseUp(nsIDOMEvent* aMouseEvent);
|
||||||
|
virtual nsresult MouseClick(nsIDOMEvent* aMouseEvent);
|
||||||
|
virtual nsresult MouseDblClick(nsIDOMEvent* aMouseEvent);
|
||||||
|
virtual nsresult MouseOver(nsIDOMEvent* aMouseEvent);
|
||||||
|
virtual nsresult MouseOut(nsIDOMEvent* aMouseEvent);
|
||||||
|
/*END implementations of mouseevent handler interface*/
|
||||||
|
};
|
||||||
|
|
||||||
|
/** factory for the editor key listener
|
||||||
|
*/
|
||||||
|
extern nsresult NS_NewEditorKeyListener(nsIDOMEventListener ** aInstancePtrResult, Editor *aEditorP);
|
||||||
|
|
||||||
|
/** factory for the editor mouse listener
|
||||||
|
*/
|
||||||
|
extern nsresult NS_NewEditorMouseListener(nsIDOMEventListener ** aInstancePtrResult, Editor *aEditorP);
|
||||||
|
|
||||||
|
#endif //editorInterfaces_h__
|
||||||
|
|
Загрузка…
Ссылка в новой задаче