Back to index

lightning-sunbird  0.9+nobinonly
mozXMLTermListeners.h
Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00003  *
00004  * The contents of this file are subject to the Mozilla Public License Version
00005  * 1.1 (the "License"); you may not use this file except in compliance with
00006  * the License. You may obtain a copy of the License at
00007  * http://www.mozilla.org/MPL/
00008  *
00009  * Software distributed under the License is distributed on an "AS IS" basis,
00010  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00011  * for the specific language governing rights and limitations under the
00012  * License.
00013  *
00014  * The Original Code is XMLterm.
00015  *
00016  * The Initial Developer of the Original Code is
00017  * Ramalingam Saravanan.
00018  * Portions created by the Initial Developer are Copyright (C) 1999
00019  * the Initial Developer. All Rights Reserved.
00020  *
00021  * Contributor(s):
00022  *
00023  * Alternatively, the contents of this file may be used under the terms of
00024  * either the GNU General Public License Version 2 or later (the "GPL"), or
00025  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00026  * in which case the provisions of the GPL or the LGPL are applicable instead
00027  * of those above. If you wish to allow use of your version of this file only
00028  * under the terms of either the GPL or the LGPL, and not to allow others to
00029  * use your version of this file under the terms of the MPL, indicate your
00030  * decision by deleting the provisions above and replace them with the notice
00031  * and other provisions required by the GPL or the LGPL. If you do not delete
00032  * the provisions above, a recipient may use your version of this file under
00033  * the terms of any one of the MPL, the GPL or the LGPL.
00034  *
00035  * ***** END LICENSE BLOCK ***** */
00036 
00037 // mozXMLTermListeners.h: classes for key/text/mouse/drag event listeners
00038 // used by mozXMLTerminal:
00039 //   mozXMLTermKeyListener
00040 //   mozXMLTermTextListener
00041 //   mozXMLTermMouseListener
00042 //   mozXMLTermDragListener
00043 
00044 
00045 #ifndef mozXMLTermListeners_h__
00046 #define mozXMLTermListeners_h__
00047 
00048 #include "nsIDOMEvent.h"
00049 #include "nsIDOMKeyListener.h"
00050 #include "nsIDOMTextListener.h"
00051 #include "nsIDOMMouseListener.h"
00052 #include "nsIDOMDragListener.h"
00053 #include "nsCOMPtr.h"
00054 
00055 #include "mozIXMLTerminal.h"
00056 
00057 /* XMLTerm Key Listener */
00058 class mozXMLTermKeyListener : public nsIDOMKeyListener,
00059                               public mozIXMLTermSuspend
00060 {
00061 public:
00062   mozXMLTermKeyListener();
00063   virtual ~mozXMLTermKeyListener();
00064 
00068   void SetXMLTerminal(mozIXMLTerminal *aXMLTerminal)
00069     {mXMLTerminal = aXMLTerminal;}
00070 
00071   // Interfaces for addref and release and queryinterface
00072   NS_DECL_ISUPPORTS
00073 
00074   // nsIDOMEventListener interface
00075   virtual nsresult HandleEvent(nsIDOMEvent* aEvent);
00076 
00077   // nsIDOMKeyListener interface
00078   virtual nsresult KeyDown(nsIDOMEvent* aKeyEvent);
00079   virtual nsresult KeyUp(nsIDOMEvent* aKeyEvent);
00080   virtual nsresult KeyPress(nsIDOMEvent* aKeyEvent);
00081 
00082   // mozIXMLTermSuspend interface
00083   NS_IMETHOD GetSuspend(PRBool* aSuspend);
00084   NS_IMETHOD SetSuspend(const PRBool aSuspend);
00085 
00086 protected:
00088   mozIXMLTerminal* mXMLTerminal;
00089 
00091   PRBool mSuspend;
00092 };
00093 
00094 
00095 /* XMLTerm Text Listener */
00096 class mozXMLTermTextListener : public nsIDOMTextListener {
00097 public:
00098   mozXMLTermTextListener();
00099   virtual ~mozXMLTermTextListener();
00100 
00104   void SetXMLTerminal(mozIXMLTerminal *aXMLTerminal)
00105     {mXMLTerminal = aXMLTerminal;}
00106 
00107   // Interfaces for addref and release and queryinterface
00108   NS_DECL_ISUPPORTS
00109 
00110   // nsIDOMEventListener interface
00111   virtual nsresult HandleEvent(nsIDOMEvent* aEvent);
00112 
00113   // nsIDOMTextListener interface
00114   virtual nsresult HandleText(nsIDOMEvent* aTextEvent);
00115 
00116 protected:
00118   mozIXMLTerminal* mXMLTerminal;
00119 };
00120 
00121 
00122 /* XMLTerm Mouse Listener */
00123 class mozXMLTermMouseListener : public nsIDOMMouseListener {
00124 public:
00125   mozXMLTermMouseListener();
00126   virtual ~mozXMLTermMouseListener();
00127 
00131   void SetXMLTerminal(mozIXMLTerminal *aXMLTerminal)
00132     {mXMLTerminal = aXMLTerminal;}
00133 
00134   // Interfaces for addref and release and queryinterface
00135   NS_DECL_ISUPPORTS
00136 
00137   // nsIDOMEventListener interface
00138   virtual nsresult HandleEvent(nsIDOMEvent* aEvent);
00139 
00140   // nsIDOMMouseListener interface
00141   virtual nsresult MouseDown(nsIDOMEvent* aMouseEvent);
00142   virtual nsresult MouseUp(nsIDOMEvent* aMouseEvent);
00143   virtual nsresult MouseClick(nsIDOMEvent* aMouseEvent);
00144   virtual nsresult MouseDblClick(nsIDOMEvent* aMouseEvent);
00145   virtual nsresult MouseOver(nsIDOMEvent* aMouseEvent);
00146   virtual nsresult MouseOut(nsIDOMEvent* aMouseEvent);
00147 
00148 protected:
00150   mozIXMLTerminal* mXMLTerminal;
00151 };
00152 
00153 
00154 /* XMLTerm Drag Listener */
00155 class mozXMLTermDragListener : public nsIDOMDragListener {
00156 public:
00157   mozXMLTermDragListener();
00158   virtual ~mozXMLTermDragListener();
00159 
00163   void SetXMLTerminal(mozIXMLTerminal *aXMLTerminal)
00164     {mXMLTerminal = aXMLTerminal;}
00165 
00166   // Interfaces for addref and release and queryinterface
00167   NS_DECL_ISUPPORTS
00168 
00169   // nsIDOMEventListener interface
00170   virtual nsresult HandleEvent(nsIDOMEvent* aEvent);
00171 
00172   // nsIDOMDragListener interface
00173   virtual nsresult DragEnter(nsIDOMEvent* aDragEvent);
00174   virtual nsresult DragOver(nsIDOMEvent* aDragEvent);
00175   virtual nsresult DragExit(nsIDOMEvent* aDragEvent);
00176   virtual nsresult DragDrop(nsIDOMEvent* aDragEvent);
00177   virtual nsresult DragGesture(nsIDOMEvent* aDragEvent);
00178 
00179 protected:
00181   mozIXMLTerminal* mXMLTerminal;
00182 };
00183 
00184 
00185 // Factory for XMLTermKeyListener
00186 extern nsresult NS_NewXMLTermKeyListener(nsIDOMEventListener** aInstancePtrResult, mozIXMLTerminal *aXMLTerminal);
00187 
00188 // Factory for XMLTermTextListener
00189 extern nsresult NS_NewXMLTermTextListener(nsIDOMEventListener** aInstancePtrResult, mozIXMLTerminal *aXMLTerminal);
00190 
00191 // Factory for XMLTermMouseListener
00192 extern nsresult NS_NewXMLTermMouseListener(nsIDOMEventListener** aInstancePtrResult, mozIXMLTerminal *aXMLTerminal);
00193 
00194 // Factory for XMLTermDragListener
00195 extern nsresult NS_NewXMLTermDragListener(nsIDOMEventListener** aInstancePtrResult, mozIXMLTerminal *aXMLTerminal);
00196 
00197 #endif //mozXMLTermListeners_h__