зеркало из https://github.com/mozilla/pjs.git
changes to the editor api interface in core. also "Javadocing" the interfaces in public
This commit is contained in:
Родитель
e248cb0b50
Коммит
5f76ab55c1
|
@ -20,44 +20,51 @@
|
|||
#include "COM_auto_ptr.h"
|
||||
|
||||
|
||||
/*implementation of an editor object. it ALSO supplies an nsIEditor Interface*/
|
||||
|
||||
/** implementation of an editor object. it will be the controler/focal point
|
||||
* for the main editor services. i.e. the GUIControler, publishing, transaction
|
||||
* manager, event interfaces. the idea for the event interfaces is to have them
|
||||
* delegate the actual commands to the editor independent of the XPFE implementation.
|
||||
*/
|
||||
class Editor : public nsIEditor
|
||||
{
|
||||
private:
|
||||
COM_auto_ptr<nsIDOMDocument> mDomInterfaceP;
|
||||
public:
|
||||
/*nsIEditorInterfaces*/
|
||||
/*BEGIN nsIEditor interfaces*/
|
||||
/*see the nsIEditor for more details*/
|
||||
virtual nsresult Init();
|
||||
virtual nsresult Init() = 0;
|
||||
|
||||
/*BEGIN interface manipulators and accessors*/
|
||||
|
||||
/*SetDomInterface accepts an interface to a nsIDOMDocument and it will add a reference to it
|
||||
since it will keep it for some time*/
|
||||
virtual nsresult SetDomInterface(nsIDOMDocument *aDomInterface){mDomInterfaceP = aDomInterface}
|
||||
|
||||
/*GetDomInterface returns a "look" at the dom interface. it will NOT ADD A REFERENCE!!!!!.*/
|
||||
virtual nsresult GetDomInterface(nsIDOMDocument **aDomInterface){*aDomInterface = mDomInterfaceP;}
|
||||
/*END interface manipulators*/
|
||||
|
||||
virtual nsresult SetProperties(PROPERTIES aProperty){}
|
||||
virtual nsresult GetProperties(PROPERTIES &){}
|
||||
/*END nsIEditor interfaces*/
|
||||
|
||||
/*EditorInterfaces*/
|
||||
/*BEGIN Editor interfaces*/
|
||||
|
||||
/** The default constructor. This should suffice. the setting of the interfaces is done
|
||||
* after the construction of the editor class.
|
||||
*/
|
||||
Editor();
|
||||
/** The default destructor. This should suffice. Should this be pure virtual
|
||||
* for someone to derive from the Editor later? I dont believe so.
|
||||
*/
|
||||
~Editor();
|
||||
|
||||
/*KeyListener Methods*/
|
||||
|
||||
/*KeyDown :accepts a keycode
|
||||
:returns False if ignored*/
|
||||
PR_Bool KeyDown(int keycode);
|
||||
/** KeyDown
|
||||
* @param int aKeycode the keycode or ascii
|
||||
* value of the key that was hit for now
|
||||
* @return False if ignored
|
||||
*/
|
||||
PR_Bool KeyDown(int aKeycode);
|
||||
|
||||
/*MouseListener Methods*/
|
||||
|
||||
/* Mouse Click accepts an x and
|
||||
a y for location in the webshell*/
|
||||
/** MouseClick
|
||||
* @param int x the xposition of the click
|
||||
* @param int y the yposition of the click
|
||||
*/
|
||||
PR_Bool MouseClick(int x,int y); //it should also tell us the dom element that was selected.
|
||||
};
|
||||
|
||||
|
|
|
@ -20,44 +20,51 @@
|
|||
#include "COM_auto_ptr.h"
|
||||
|
||||
|
||||
/*implementation of an editor object. it ALSO supplies an nsIEditor Interface*/
|
||||
|
||||
/** implementation of an editor object. it will be the controler/focal point
|
||||
* for the main editor services. i.e. the GUIControler, publishing, transaction
|
||||
* manager, event interfaces. the idea for the event interfaces is to have them
|
||||
* delegate the actual commands to the editor independent of the XPFE implementation.
|
||||
*/
|
||||
class Editor : public nsIEditor
|
||||
{
|
||||
private:
|
||||
COM_auto_ptr<nsIDOMDocument> mDomInterfaceP;
|
||||
public:
|
||||
/*nsIEditorInterfaces*/
|
||||
/*BEGIN nsIEditor interfaces*/
|
||||
/*see the nsIEditor for more details*/
|
||||
virtual nsresult Init();
|
||||
virtual nsresult Init() = 0;
|
||||
|
||||
/*BEGIN interface manipulators and accessors*/
|
||||
|
||||
/*SetDomInterface accepts an interface to a nsIDOMDocument and it will add a reference to it
|
||||
since it will keep it for some time*/
|
||||
virtual nsresult SetDomInterface(nsIDOMDocument *aDomInterface){mDomInterfaceP = aDomInterface}
|
||||
|
||||
/*GetDomInterface returns a "look" at the dom interface. it will NOT ADD A REFERENCE!!!!!.*/
|
||||
virtual nsresult GetDomInterface(nsIDOMDocument **aDomInterface){*aDomInterface = mDomInterfaceP;}
|
||||
/*END interface manipulators*/
|
||||
|
||||
virtual nsresult SetProperties(PROPERTIES aProperty){}
|
||||
virtual nsresult GetProperties(PROPERTIES &){}
|
||||
/*END nsIEditor interfaces*/
|
||||
|
||||
/*EditorInterfaces*/
|
||||
/*BEGIN Editor interfaces*/
|
||||
|
||||
/** The default constructor. This should suffice. the setting of the interfaces is done
|
||||
* after the construction of the editor class.
|
||||
*/
|
||||
Editor();
|
||||
/** The default destructor. This should suffice. Should this be pure virtual
|
||||
* for someone to derive from the Editor later? I dont believe so.
|
||||
*/
|
||||
~Editor();
|
||||
|
||||
/*KeyListener Methods*/
|
||||
|
||||
/*KeyDown :accepts a keycode
|
||||
:returns False if ignored*/
|
||||
PR_Bool KeyDown(int keycode);
|
||||
/** KeyDown
|
||||
* @param int aKeycode the keycode or ascii
|
||||
* value of the key that was hit for now
|
||||
* @return False if ignored
|
||||
*/
|
||||
PR_Bool KeyDown(int aKeycode);
|
||||
|
||||
/*MouseListener Methods*/
|
||||
|
||||
/* Mouse Click accepts an x and
|
||||
a y for location in the webshell*/
|
||||
/** MouseClick
|
||||
* @param int x the xposition of the click
|
||||
* @param int y the yposition of the click
|
||||
*/
|
||||
PR_Bool MouseClick(int x,int y); //it should also tell us the dom element that was selected.
|
||||
};
|
||||
|
||||
|
|
|
@ -1,76 +0,0 @@
|
|||
/* -*- 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 nsEditorInterfaces_h__
|
||||
#define nsEditorInterfaces_h__
|
||||
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMKeyListener.h"
|
||||
#include "nsIDOMMouseListener.h"
|
||||
|
||||
//nsIDOMKeyListener interface
|
||||
class nsEditorKeyListener : public nsIDOMKeyListener {
|
||||
Editor *mEditorP;
|
||||
public:
|
||||
nsEditorKeyListener();
|
||||
virtual ~nsEditorKeyListener();
|
||||
|
||||
void SetEditor(Editor *aEditorP){mEditorP = mEditorP;}
|
||||
Editor *GetEditor(){ return mEditorP; }
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
virtual nsresult ProcessEvent(nsIDOMEvent* aEvent);
|
||||
|
||||
public:
|
||||
virtual nsresult KeyDown(nsIDOMEvent* aKeyEvent);
|
||||
virtual nsresult KeyUp(nsIDOMEvent* aKeyEvent);
|
||||
virtual nsresult KeyPress(nsIDOMEvent* aKeyEvent);
|
||||
private:
|
||||
virtual nsresult GetCharFromKeyCode(PRUint32 aKeyCode, PRBool aIsShift, char *aChar);
|
||||
};
|
||||
//editor Implementation of the MouseListener interface
|
||||
//nsIDOMMouseListener interface
|
||||
class nsEditorMouseListener : public nsIDOMMouseListener {
|
||||
Editor *mEditorP;
|
||||
public:
|
||||
nsEditorMouseListener();
|
||||
virtual ~nsEditorMouseListener();
|
||||
|
||||
void SetEditor(Editor *aEditorP){mEditorP = mEditorP;}
|
||||
Editor *GetEditor(){ return mEditorP; }
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
|
||||
extern nsresult NS_NewEditorKeyListener(nsIDOMEventListener ** aInstancePtrResult, Editor *aEditorP);
|
||||
|
||||
extern nsresult NS_NewEditorMouseListener(nsIDOMEventListener ** aInstancePtrResult, Editor *aEditorP);
|
||||
|
||||
#endif //nsEditorInterfaces_h__
|
|
@ -42,11 +42,38 @@ class nsIEditor : public nsISupports{
|
|||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
/**
|
||||
* Init() tells is to tell the implementation of nsIEditor to begin its services
|
||||
*/
|
||||
virtual nsresult Init() = 0;
|
||||
|
||||
/**
|
||||
* SetDomInterface() WILL BE ADDREFFED
|
||||
*
|
||||
* @param aDomInterface The dom interface being observed
|
||||
*/
|
||||
virtual nsresult SetDomInterface(nsIDOMDocument *aDomInterface)=0;
|
||||
|
||||
/**
|
||||
* GetDomInterface() WILL NOT RETURN AN ADDREFFED POINTER
|
||||
*
|
||||
* @param aDomInterface The dom interface being observed
|
||||
*/
|
||||
virtual nsresult GetDomInterface(nsIDOMDocument **)=0;
|
||||
|
||||
/**
|
||||
* SetProperties() sets the properties of the current selection
|
||||
*
|
||||
* @param aProperty An enum that lists the various properties that can be applied, bold, ect.
|
||||
*/
|
||||
virtual nsresult SetProperties(PROPERTIES aProperty)=0;
|
||||
virtual nsresult GetProperties(PROPERTIES &)=0;
|
||||
|
||||
/**
|
||||
* SetProperties() sets the properties of the current selection
|
||||
*
|
||||
* @param aProperty An enum that will recieve the various properties that can be applied from the current selection.
|
||||
*/
|
||||
virtual nsresult GetProperties(PROPERTIES &aProperty)=0;
|
||||
};
|
||||
|
||||
#endif //nsIEditor_h__
|
||||
|
|
Загрузка…
Ссылка в новой задаче