Code

Warning cleanup
[inkscape.git] / src / dom / events.h
1 #ifndef __EVENTS_H__
2 #define __EVENTS_H__
4 /**
5  * Phoebe DOM Implementation.
6  *
7  * This is a C++ approximation of the W3C DOM model, which follows
8  * fairly closely the specifications in the various .idl files, copies of
9  * which are provided for reference.  Most important is this one:
10  *
11  * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
12  *
13  * Authors:
14  *   Bob Jamison
15  *
16  * Copyright (C) 2005 Bob Jamison
17  *
18  *  This library is free software; you can redistribute it and/or
19  *  modify it under the terms of the GNU Lesser General Public
20  *  License as published by the Free Software Foundation; either
21  *  version 2.1 of the License, or (at your option) any later version.
22  *
23  *  This library is distributed in the hope that it will be useful,
24  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
25  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
26  *  Lesser General Public License for more details.
27  *
28  *  You should have received a copy of the GNU Lesser General Public
29  *  License along with this library; if not, write to the Free Software
30  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
31  */
34 #include "dom.h"
35 #include "views.h"
40 namespace org    {
41 namespace w3c    {
42 namespace dom    {
43 namespace events {
48 //Local definitions
49 typedef dom::DOMString DOMString;
50 typedef dom::DOMTimeStamp DOMTimeStamp;
51 typedef dom::NodePtr  NodePtr ;
56 //forward declarations
57 class Event;
58 class EventTarget;
59 class EventListener;
60 class DocumentEvent;
61 class CustomEvent;
62 class UIEvent;
63 class TextEvent;
64 class MouseEvent;
65 class KeyboardEvent;
66 class MutationEvent;
67 class MutationNameEvent;
71 /*#########################################################################
72 ## EventException
73 #########################################################################*/
75 /**
76  *
77  */
78 class EventException
79 {
80 public:
82     EventException(short theCode)
83         {
84             code = theCode;
85         }
87     virtual ~EventException() throw()
88        {}
90     unsigned short code;
91 };
93     /**
94      * EventExceptionCode
95      */
96     enum
97         {
98         UNSPECIFIED_EVENT_TYPE_ERR = 0,
99         DISPATCH_REQUEST_ERR       = 1
100         };
104 /*#########################################################################
105 ## Event
106 #########################################################################*/
108 /**
109  *
110  */
111 class Event
113 public:
115     /**
116      * PhaseType
117      */
118     typedef enum
119         {
120         CAPTURING_PHASE = 1,
121         AT_TARGET       = 2,
122         BUBBLING_PHASE  = 3
123         } PhaseType;
125     /**
126      *
127      */
128     virtual DOMString getType() const
129         { return eventType; }
131     /**
132      *
133      */
134     virtual EventTarget *getTarget()
135         { return target; }
137     /**
138      *
139      */
140     virtual EventTarget *getCurrentTarget()
141         { return currentTarget; }
143     /**
144      *
145      */
146     virtual unsigned short getEventPhase()
147         { return eventPhase; }
149     /**
150      *
151      */
152     virtual bool getBubbles()
153         { return canBubble; }
155     /**
156      *
157      */
158     virtual bool getCancelable()
159         { return cancelable; }
161     /**
162      *
163      */
164     virtual DOMTimeStamp getTimeStamp()
165         { return timeStamp; }
167     /**
168      *
169      */
170     virtual void stopPropagation()
171         {
172         }
174     /**
175      *
176      */
177     virtual void preventDefault()
178         {
179         }
181     /**
182      *
183      */
184     virtual void initEvent(const DOMString &eventTypeArg,
185                            bool canBubbleArg,
186                            bool cancelableArg)
187         {
188         namespaceURI = "";
189         eventType    = eventTypeArg;
190         canBubble    = canBubbleArg;
191         cancelable   = cancelableArg;
192         }
195     /**
196      *
197      */
198     virtual DOMString getNamespaceURI() const
199         { return namespaceURI; }
201     /**
202      *
203      */
204     virtual bool isCustom()
205         { return custom; }
207     /**
208      *
209      */
210     virtual void stopImmediatePropagation()
211         {
212         }
214     /**
215      *
216      */
217     virtual bool isDefaultPrevented()
218         { return defaultPrevented; }
220     /**
221      *
222      */
223     virtual void initEventNS(const DOMString &namespaceURIArg,
224                              const DOMString &eventTypeArg,
225                              bool canBubbleArg,
226                              bool cancelableArg)
227         {
228         namespaceURI = namespaceURIArg;
229         eventType    = eventTypeArg;
230         canBubble    = canBubbleArg;
231         cancelable   = cancelableArg;
232         }
234     //##################
235     //# Non-API methods
236     //##################
238     /**
239      *
240      */
241     Event()
242         {
243         init();
244         }
246     /**
247      *
248      */
249     Event(const DOMString &eventTypeArg)
250         {
251         init();
252         eventType     = eventTypeArg;
253         }
256     /**
257      *
258      */
259     Event(const Event &other)
260         {
261         eventType        = other.eventType;
262         target           = other.target;
263         currentTarget    = other.currentTarget;
264         eventPhase       = other.eventPhase;
265         canBubble        = other.canBubble;
266         cancelable       = other.cancelable;
267         timeStamp        = other.timeStamp;
268         namespaceURI     = other.namespaceURI;
269         custom           = other.custom;
270         defaultPrevented = other.defaultPrevented;
271         }
273     /**
274      *
275      */
276     virtual ~Event() {}
278 protected:
280     /**
281      *
282      */
283     void init()
284         {
285         eventType        = "";
286         target           = NULL;
287         currentTarget    = NULL;
288         eventPhase       = 0;
289         canBubble        = false;
290         cancelable       = false;
291         //timeStamp      = other.timeStamp;
292         namespaceURI     = "";
293         custom           = false;
294         defaultPrevented = false;
295         }
297     DOMString      eventType;
298     EventTarget    *target;
299     EventTarget    *currentTarget;
300     unsigned short eventPhase;
301     bool           canBubble;
302     bool           cancelable;
303     DOMTimeStamp   timeStamp;
304     DOMString      namespaceURI;
305     bool           custom;
306     bool           defaultPrevented;
308 };
313 /*#########################################################################
314 ## EventListener
315 #########################################################################*/
317 /**
318  *
319  */
320 class EventListener
322 public:
324     /**
325      *
326      */
327     virtual void handleEvent(const Event &/*evt*/)
328         {}
330     //##################
331     //# Non-API methods
332     //##################
334     /**
335      *
336      */
337     virtual ~EventListener() {}
338 };
345 /*#########################################################################
346 ## EventTarget
347 #########################################################################*/
349 class EventListenerEntry
351 public:
352     EventListenerEntry(const DOMString &namespaceURIArg,
353                        const DOMString &eventTypeArg,
354                        const EventListener *listenerArg,
355                        bool useCaptureArg)
356         {
357         namespaceURI = namespaceURIArg;
358         eventType    = eventTypeArg;
359         listener     = (EventListener *)listenerArg;
360         useCapture   = useCaptureArg;
361         }
363     EventListenerEntry(const EventListenerEntry &other)
364         {
365         namespaceURI = other.namespaceURI;
366         eventType    = other.eventType;
367         listener     = other.listener;
368         useCapture   = other.useCapture;
369         }
371     virtual ~EventListenerEntry() {}
373     DOMString namespaceURI;
374     DOMString eventType;
375     EventListener *listener;
376     bool useCapture;
377 };
380 /**
381  *
382  */
383 class EventTarget
385 public:
387     /**
388      *
389      */
390     virtual void addEventListener(const DOMString &type,
391                                   const EventListener *listener,
392                                   bool useCapture)
393         {
394         EventListenerEntry entry("", type, listener, useCapture);
395         listeners.push_back(entry);
396         }
398     /**
399      *
400      */
401     virtual void removeEventListener(const DOMString &type,
402                                      const EventListener *listener,
403                                      bool useCapture)
404         {
405         std::vector<EventListenerEntry>::iterator iter;
406         for (iter = listeners.begin() ; iter != listeners.end() ; iter++)
407             {
408             EventListenerEntry entry = *iter;
409             if (entry.eventType == type &&
410                 entry.listener  == listener &&
411                 useCapture && entry.useCapture)
412                 listeners.erase(iter);
413             }
414         }
416     /**
417      *
418      */
419     virtual bool dispatchEvent(const Event &evt) throw(EventException)
420         {
422         for (unsigned int i=0 ; i<listeners.size() ; i++)
423             {
424             EventListenerEntry listener = listeners[i];
425             if (listener.namespaceURI == evt.getNamespaceURI()  &&
426                 listener.eventType    == evt.getType())
427                 {
428                 if (listener.listener)
429                     listener.listener->handleEvent(evt);
430                 }
431             }
432         return true;
433         }
436     /**
437      *
438      */
439     virtual void addEventListenerNS(const DOMString &namespaceURI,
440                                     const DOMString &type,
441                                     const EventListener *listener,
442                                     bool useCapture)
443         {
444         EventListenerEntry entry(namespaceURI, type, listener, useCapture);
445         listeners.push_back(entry);
446         }
448     /**
449      *
450      */
451     virtual void removeEventListenerNS(const DOMString &namespaceURI,
452                                        const DOMString &type,
453                                        const EventListener *listener,
454                                        bool useCapture)
455         {
456         std::vector<EventListenerEntry>::iterator iter;
457         for (iter = listeners.begin() ; iter != listeners.end() ; iter++)
458             {
459             EventListenerEntry entry = *iter;
460             if (entry.namespaceURI == namespaceURI &&
461                 entry.eventType    == type &&
462                 entry.listener     == listener &&
463                 useCapture && entry.useCapture)
464                 listeners.erase(iter);
465             }
466         }
468     /**
469      *
470      */
471     virtual bool willTriggerNS(const DOMString &namespaceURI,
472                                const DOMString &type)
473         {
474         std::vector<EventListenerEntry>::iterator iter;
475         for (iter = listeners.begin() ; iter != listeners.end() ; iter++)
476             {
477             EventListenerEntry entry = *iter;
478             if (entry.namespaceURI == namespaceURI &&
479                 entry.eventType    == type)
480                 return true;
481             }
482         return false;
483         }
485     /**
486      *
487      */
488     virtual bool hasEventListenerNS(const DOMString &namespaceURI,
489                                     const DOMString &type)
490         {
491         std::vector<EventListenerEntry>::iterator iter;
492         for (iter = listeners.begin() ; iter != listeners.end() ; iter++)
493             {
494             EventListenerEntry entry = *iter;
495             if (entry.namespaceURI == namespaceURI &&
496                 entry.eventType    == type)
497                 return true;
498             }
499         return false;
500         }
503     //##################
504     //# Non-API methods
505     //##################
507     /**
508      *
509      */
510     EventTarget() {}
512     /**
513      *
514      */
515     EventTarget(const EventTarget &other)
516         {
517         listeners = other.listeners;
518         }
520     /**
521      *
522      */
523     virtual ~EventTarget() {}
525 protected:
527     std::vector<EventListenerEntry> listeners;
529 };
534 /*#########################################################################
535 ## DocumentEvent
536 #########################################################################*/
538 /*
539  *
540  */
541 class DocumentEvent : virtual public Event
543 public:
545     /**
546      *
547      */
548     virtual Event createEvent(const DOMString &/*eventType*/)
549                                throw (dom::DOMException)
550         {
551         Event event;
552         return event;
553         }
555     /**
556      *
557      */
558     virtual bool canDispatch(const DOMString &/*namespaceURI*/,
559                              const DOMString &/*type*/)
560         {
561         return dispatchable;
562         }
564     //##################
565     //# Non-API methods
566     //##################
568     /**
569      *
570      */
571     DocumentEvent() {}
573     /**
574      *
575      */
576     DocumentEvent(const DocumentEvent &other) : Event(other)
577         {
578         dispatchable = other.dispatchable;
579         }
581     /**
582      *
583      */
584     virtual ~DocumentEvent() {}
586 protected:
588     bool dispatchable;
591 };
594 /*#########################################################################
595 ## CustomEvent
596 #########################################################################*/
598 /*
599  *
600  */
601 class CustomEvent : virtual public Event
603 public:
605     /**
606      *
607      */
608     virtual void setDispatchState(const EventTarget */*target*/,
609                                   unsigned short /*phase*/)
610         {
611         }
613     /**
614      *
615      */
616     virtual bool isPropagationStopped()
617         {
618         return propagationStopped;
619         }
621     /**
622      *
623      */
624     virtual bool isImmediatePropagationStopped()
625         {
626         return immediatePropagationStopped;
627         }
629     //##################
630     //# Non-API methods
631     //##################
633     /**
634      *
635      */
636     CustomEvent() {}
638     /**
639      *
640      */
641     CustomEvent(const CustomEvent &other) : Event(other)
642         {
643         propagationStopped          = other.propagationStopped;
644         immediatePropagationStopped = other.immediatePropagationStopped;
645         }
647     /**
648      *
649      */
650     virtual ~CustomEvent() {}
652 protected:
654     bool propagationStopped;
655     bool immediatePropagationStopped;
659 };
664 /*#########################################################################
665 ## UIEvent
666 #########################################################################*/
668 /**
669  *
670  */
671 class UIEvent : virtual public Event
673 public:
675     /**
676      *  Note that the return type as listed in level3 events.idl is
677      *  AbstractView, while in level3 views.idl it is called View
678      */
679     virtual views::View getView()
680         { return view; }
682     /**
683      *
684      */
685     virtual long getDetail()
686         { return detail; }
688     /**
689      *  Note that views.idl and events.idl disagree on the name of Views
690      */
691     virtual void initUIEvent(const DOMString &/*typeArg*/,
692                              bool /*canBubbleArg*/,
693                              bool /*cancelableArg*/,
694                              const views::View */*viewArg*/,
695                              long /*detailArg*/)
696         {
697         }
699     /**
700      *  Note that views.idl and events.idl disagree on the name of Views
701      */
702     virtual void initUIEventNS(const DOMString &/*namespaceURI*/,
703                                const DOMString &/*typeArg*/,
704                                bool /*canBubbleArg*/,
705                                bool /*cancelableArg*/,
706                                const views::View */*viewArg*/,
707                                long /*detailArg*/)
708         {
709         }
711     //##################
712     //# Non-API methods
713     //##################
715     /**
716      *
717      */
718     UIEvent() {}
720     /**
721      *
722      */
723     UIEvent(const UIEvent &other) : Event(other)
724         {
725         view   = other.view;
726         detail = other.detail;
727         }
729     /**
730      *
731      */
732     virtual ~UIEvent() {}
734 protected:
736     views::View view;
737     long detail;
738 };
743 /*#########################################################################
744 ## TextEvent
745 #########################################################################*/
747 /**
748  *
749  */
750 class TextEvent : virtual public UIEvent
752 public:
754     /**
755      *
756      */
757     virtual DOMString getData()
758         { return data; }
760     /**
761      *  Note that views.idl and events.idl disagree on the name of Views
762      */
763     virtual void initTextEvent(const DOMString &/*typeArg*/,
764                                bool /*canBubbleArg*/,
765                                bool /*cancelableArg*/,
766                                const views::View */*viewArg*/,
767                                long /*detailArg*/)
768         {
769         }
771     /**
772      *
773      */
774     virtual void initTextEventNS(const DOMString &/*namespaceURI*/,
775                                  const DOMString &/*typeArg*/,
776                                  bool /*canBubbleArg*/,
777                                  bool /*cancelableArg*/,
778                                  const views::View */*viewArg*/,
779                                  long /*detailArg*/)
780         {
781         }
783     //##################
784     //# Non-API methods
785     //##################
787     /**
788      *
789      */
790     TextEvent() {}
792     /**
793      *
794      */
795     TextEvent(const TextEvent &other) : Event(other), UIEvent(other)
796         {
797         data = other.data;
798         }
800     /**
801      *
802      */
803     virtual ~TextEvent() {}
805 protected:
807     DOMString data;
809 };
818 /*#########################################################################
819 ## MouseEvent
820 #########################################################################*/
822 /**
823  *
824  */
825 class MouseEvent : virtual public UIEvent
827 public:
829     /**
830      *
831      */
832     virtual long getScreenX()
833         { return screenX; }
835     /**
836      *
837      */
838     virtual long getScreenY()
839         { return screenY; }
841     /**
842      *
843      */
844     virtual long getClientX()
845         { return clientX; }
847     /**
848      *
849      */
850     virtual long getClientY()
851         { return clientY; }
853     /**
854      *
855      */
856     virtual bool getCtrlKey()
857         { return ctrlKey; }
859     /**
860      *
861      */
862     virtual bool getShiftKey()
863         { return shiftKey; }
865     /**
866      *
867      */
868     virtual bool getAltKey()
869         { return altKey; }
871     /**
872      *
873      */
874     virtual bool getMetaKey()
875         { return metaKey; }
877     /**
878      *
879      */
880     virtual unsigned short getButton()
881         { return button; }
883     /**
884      *
885      */
886     virtual EventTarget *getRelatedTarget()
887         { return relatedTarget; }
890     /**
891      *
892      */
893     virtual bool getModifierState()
894         { return modifierState; }
896     /**
897      *
898      */
899     virtual void initMouseEvent(const DOMString &/*typeArg*/,
900                                 bool /*canBubbleArg*/,
901                                 bool /*cancelableArg*/,
902                                 const views::View */*viewArg*/,
903                                 long /*detailArg*/,
904                                 long /*screenXArg*/,
905                                 long /*screenYArg*/,
906                                 long /*clientXArg*/,
907                                 long /*clientYArg*/,
908                                 bool /*ctrlKeyArg*/,
909                                 bool /*altKeyArg*/,
910                                 bool /*shiftKeyArg*/,
911                                 bool /*metaKeyArg*/,
912                                 unsigned short /*buttonArg*/,
913                                 const EventTarget */*relatedTargetArg*/)
914         {
915         }
918     /**
919      *
920      */
921     virtual void initMouseEventNS(const DOMString &/*namespaceURI*/,
922                                   const DOMString &/*typeArg*/,
923                                   bool /*canBubbleArg*/,
924                                   bool /*cancelableArg*/,
925                                   const views::View */*viewArg*/,
926                                   long /*detailArg*/,
927                                   long /*screenXArg*/,
928                                   long /*screenYArg*/,
929                                   long /*clientXArg*/,
930                                   long /*clientYArg*/,
931                                   unsigned short /*buttonArg*/,
932                                   const EventTarget */*relatedTargetArg*/,
933                                   const DOMString &/*modifiersList*/)
934         {
935         }
937     //##################
938     //# Non-API methods
939     //##################
941     /**
942      *
943      */
944     MouseEvent() {}
946     /**
947      *
948      */
949     MouseEvent(const MouseEvent &other) : Event(other), UIEvent(other)
950         {
951         screenX       = other.screenX;
952         screenY       = other.screenY;
953         clientX       = other.clientX;
954         clientY       = other.clientY;
955         ctrlKey       = other.ctrlKey;
956         shiftKey      = other.shiftKey;
957         altKey        = other.altKey;
958         metaKey       = other.metaKey;
959         button        = other.button;
960         relatedTarget = other.relatedTarget;
961         modifierState = other.modifierState;
962         }
964     /**
965      *
966      */
967     virtual ~MouseEvent() {}
969 protected:
971     long screenX;
972     long screenY;
973     long clientX;
974     long clientY;
975     bool ctrlKey;
976     bool shiftKey;
977     bool altKey;
978     bool metaKey;
979     unsigned short button;
980     EventTarget *relatedTarget;
981     bool modifierState;
984 };
989 /*#########################################################################
990 ## KeyboardEvent
991 #########################################################################*/
993 /**
994  *
995  */
996 class KeyboardEvent : virtual public UIEvent
998 public:
1000     typedef enum
1001         {
1002         DOM_KEY_LOCATION_STANDARD      = 0x00,
1003         DOM_KEY_LOCATION_LEFT          = 0x01,
1004         DOM_KEY_LOCATION_RIGHT         = 0x02,
1005         DOM_KEY_LOCATION_NUMPAD        = 0x03
1006         } KeyLocationCode;
1008     /**
1009      *
1010      */
1011     virtual DOMString getKeyIdentifier()
1012         { return keyIdentifier; }
1014     /**
1015      *
1016      */
1017     virtual unsigned long getKeyLocation()
1018         { return keyLocation; }
1020     /**
1021      *
1022      */
1023     virtual bool getCtrlKey()
1024         { return ctrlKey; }
1026     /**
1027      *
1028      */
1029     virtual bool getShiftKey()
1030         { return shiftKey; }
1032     /**
1033      *
1034      */
1035     virtual bool getAltKey()
1036         { return altKey; }
1038     /**
1039      *
1040      */
1041     virtual bool getMetaKey()
1042         { return metaKey; }
1044     /**
1045      *
1046      */
1047     virtual bool getModifierState()
1048         { return modifierState; }
1050     /**
1051      *
1052      */
1053     virtual void initKeyboardEvent(const DOMString &/*typeArg*/,
1054                                    bool /*canBubbleArg*/,
1055                                    bool /*cancelableArg*/,
1056                                    const views::View */*viewArg*/,
1057                                    const DOMString &/*keyIdentifier*/,
1058                                    unsigned long /*keyLocation*/,
1059                                    const DOMString /*modifiersList*/)
1060         {
1061         }
1065     /**
1066      *
1067      */
1068     virtual void initKeyboardEventNS(const DOMString &/*namespaceURI*/,
1069                                      const DOMString &/*typeArg*/,
1070                                      bool /*canBubbleArg*/,
1071                                      bool /*cancelableArg*/,
1072                                      const views::View */*viewArg*/,
1073                                      const DOMString &/*keyIdentifier*/,
1074                                      unsigned long /*keyLocation*/,
1075                                      const DOMString /*modifiersList*/)
1076         {
1077         }
1079     //##################
1080     //# Non-API methods
1081     //##################
1083     /**
1084      *
1085      */
1086     KeyboardEvent() {}
1088     /**
1089      *
1090      */
1091     KeyboardEvent(const KeyboardEvent &other) : Event(other), UIEvent(other)
1092         {
1093         keyIdentifier = other.keyIdentifier;
1094         keyLocation   = other.keyLocation;
1095         ctrlKey       = other.ctrlKey;
1096         shiftKey      = other.shiftKey;
1097         altKey        = other.altKey;
1098         metaKey       = other.metaKey;
1099         modifierState = other.modifierState;
1100         }
1102     /**
1103      *
1104      */
1105     virtual ~KeyboardEvent() {}
1107 protected:
1109     DOMString keyIdentifier;
1110     unsigned long keyLocation;
1111     bool ctrlKey;
1112     bool shiftKey;
1113     bool altKey;
1114     bool metaKey;
1115     bool modifierState;
1116 };
1126 /*#########################################################################
1127 ## MutationEvent
1128 #########################################################################*/
1130 /**
1131  *
1132  */
1133 class MutationEvent : virtual public Event
1135 public:
1137     /**
1138      * attrChangeType
1139      */
1140     typedef enum
1141         {
1142         MODIFICATION = 1,
1143         ADDITION     = 2,
1144         REMOVAL      = 3
1145         } AttrChangeType;
1147     /**
1148      *
1149      */
1150     virtual NodePtr getRelatedNodePtr ()
1151         { return relatedNodePtr ; }
1153     /**
1154      *
1155      */
1156     virtual DOMString getPrevValue()
1157         { return prevValue; }
1159     /**
1160      *
1161      */
1162     virtual DOMString getNewValue()
1163         { return newValue; }
1165     /**
1166      *
1167      */
1168     virtual DOMString getAttrName()
1169         { return attrName; }
1171     /**
1172      *
1173      */
1174     virtual unsigned short getAttrChange()
1175         {
1176         return attrChange;
1177         }
1179     /**
1180      *
1181      */
1182     virtual void initMutationEvent(const DOMString &/*typeArg*/,
1183                                    bool /*canBubbleArg*/,
1184                                    bool /*cancelableArg*/,
1185                                    const NodePtr   /*relatedNodeArg*/,
1186                                    const DOMString &/*prevValueArg*/,
1187                                    const DOMString &/*newValueArg*/,
1188                                    const DOMString &/*attrNameArg*/,
1189                                    unsigned short /*attrChangeArg*/)
1190         {
1191         }
1193     /**
1194      *
1195      */
1196     virtual void initMutationEventNS(const DOMString &/*namespaceURI*/,
1197                                      const DOMString &/*typeArg*/,
1198                                      bool /*canBubbleArg*/,
1199                                      bool /*cancelableArg*/,
1200                                      const NodePtr   /*relatedNodeArg*/,
1201                                      const DOMString &/*prevValueArg*/,
1202                                      const DOMString &/*newValueArg*/,
1203                                      const DOMString &/*attrNameArg*/,
1204                                      unsigned short /*attrChangeArg*/)
1205         {
1206         }
1209     //##################
1210     //# Non-API methods
1211     //##################
1213     /**
1214      *
1215      */
1216     MutationEvent()
1217         {
1218         relatedNodePtr  = NULL;
1219         }
1221     /**
1222      *
1223      */
1224     MutationEvent(const MutationEvent &other) : Event(other)
1225         {
1226         relatedNodePtr  = other.relatedNodePtr ;
1227         prevValue   = other.prevValue;
1228         newValue    = other.newValue;
1229         attrName    = other.attrName;
1230         attrChange  = other.attrChange;
1231         }
1233     /**
1234      *
1235      */
1236     virtual ~MutationEvent() {}
1238 protected:
1240     NodePtr   relatedNodePtr ;
1241     DOMString prevValue;
1242     DOMString newValue;
1243     DOMString attrName;
1244     unsigned short attrChange;
1246 };
1251 /*#########################################################################
1252 ## MutationNameEvent
1253 #########################################################################*/
1255 /**
1256  *
1257  */
1258 class MutationNameEvent : virtual public MutationEvent
1260 public:
1262     /**
1263      *
1264      */
1265     virtual DOMString getPrevNamespaceURI()
1266         { return prevNamespaceURI; }
1268     /**
1269      *
1270      */
1271     virtual DOMString getPrevNodeName()
1272         { return prevNodeName; }
1274     /**
1275      *
1276      */
1277     virtual void initMutationNameEvent(const DOMString &/*typeArg*/,
1278                                        bool /*canBubbleArg*/,
1279                                        bool /*cancelableArg*/,
1280                                        const NodePtr   /*relatedNodeArg*/,
1281                                        const DOMString &/*prevNamespaceURIArg*/,
1282                                        const DOMString &/*prevNodeNameArg*/)
1283         {
1284         }
1287     /**
1288      *
1289      */
1290     virtual void initMutationNameEventNS(const DOMString &/*namespaceURI*/,
1291                                          const DOMString &/*typeArg*/,
1292                                          bool /*canBubbleArg*/,
1293                                          bool /*cancelableArg*/,
1294                                          const NodePtr   /*relatedNodeArg*/,
1295                                          const DOMString &/*prevNamespaceURIArg*/,
1296                                          const DOMString &/*prevNodeNameArg*/)
1297         {
1298         }
1302     //##################
1303     //# Non-API methods
1304     //##################
1306     /**
1307      *
1308      */
1309     MutationNameEvent() {}
1312     /**
1313      *
1314      */
1315     MutationNameEvent(const MutationNameEvent &other) 
1316                           : Event(other), MutationEvent(other)
1317         {
1318         prevNamespaceURI  = other.prevNamespaceURI;
1319         prevNodeName      = other.prevNodeName;
1320         }
1323     /**
1324      *
1325      */
1326     virtual ~MutationNameEvent() {}
1328 protected:
1330     DOMString prevNamespaceURI;
1331     DOMString prevNodeName;
1334 };
1341 }  //namespace events
1342 }  //namespace dom
1343 }  //namespace w3c
1344 }  //namespace org
1346 #endif   /* __EVENTS_H__ */
1348 /*#########################################################################
1349 ## E N D    O F    F I L E
1350 #########################################################################*/