Author: toshok
Date: 2007-12-02 14:52:25 -0500 (Sun, 02 Dec 2007)
New Revision: 90531

Modified:
   trunk/olive/class/PresentationCore/System.Windows/ContentElement.cs
   trunk/olive/class/PresentationCore/System.Windows/UIElement.cs
Log:
add most of the routed events (which according to the unit tests, mostly come 
from other classes) to ContentElement and UIElement.

Modified: trunk/olive/class/PresentationCore/System.Windows/ContentElement.cs
===================================================================
--- trunk/olive/class/PresentationCore/System.Windows/ContentElement.cs 
2007-12-02 19:51:45 UTC (rev 90530)
+++ trunk/olive/class/PresentationCore/System.Windows/ContentElement.cs 
2007-12-02 19:52:25 UTC (rev 90531)
@@ -45,85 +45,113 @@
                public static readonly DependencyProperty 
IsStylusDirectlyOverProperty;
                public static readonly DependencyProperty IsStylusOverProperty;
 
-               public static readonly RoutedEvent DragEnterEvent;
-               public static readonly RoutedEvent DragLeaveEvent;
-               public static readonly RoutedEvent DragOverEvent;
-               public static readonly RoutedEvent DropEvent;
-               public static readonly RoutedEvent GiveFeedbackEvent;
-               public static readonly RoutedEvent GotFocusEvent;
-               public static readonly RoutedEvent GotKeyboardFocusEvent;
-               public static readonly RoutedEvent GotMouseCaptureEvent;
-               public static readonly RoutedEvent GotStylusCaptureEvent;
-               public static readonly RoutedEvent KeyDownEvent;
-               public static readonly RoutedEvent KeyUpEvent;
-               public static readonly RoutedEvent LostFocusEvent;
-               public static readonly RoutedEvent LostKeyboardFocusEvent;
-               public static readonly RoutedEvent LostMouseCaptureEvent;
-               public static readonly RoutedEvent LostStylusCaptureEvent;
-               public static readonly RoutedEvent MouseDownEvent;
-               public static readonly RoutedEvent MouseEnterEvent;
-               public static readonly RoutedEvent MouseLeaveEvent;
-               public static readonly RoutedEvent MouseLeftButtonDownEvent;
-               public static readonly RoutedEvent MouseLeftButtonUpEvent;
-               public static readonly RoutedEvent MouseMoveEvent;
-               public static readonly RoutedEvent MouseRightButtonDownEvent;
-               public static readonly RoutedEvent MouseRightButtonUpEvent;
-               public static readonly RoutedEvent MouseUpEvent;
-               public static readonly RoutedEvent MouseWheelEvent;
-               public static readonly RoutedEvent PreviewDragEnterEvent;
-               public static readonly RoutedEvent PreviewDragLeaveEvent;
-               public static readonly RoutedEvent PreviewDragOverEvent;
-               public static readonly RoutedEvent PreviewDropEvent;
-               public static readonly RoutedEvent PreviewGiveFeedbackEvent;
-               public static readonly RoutedEvent PreviewGotKeyboardFocusEvent;
-               public static readonly RoutedEvent PreviewKeyDownEvent;
-               public static readonly RoutedEvent PreviewKeyUpEvent;
-               public static readonly RoutedEvent 
PreviewLostKeyboardFocusEvent;
-               public static readonly RoutedEvent PreviewMouseDownEvent;
-               public static readonly RoutedEvent 
PreviewMouseLeftButtonDownEvent;
-               public static readonly RoutedEvent 
PreviewMouseLeftButtonUpEvent;
-               public static readonly RoutedEvent PreviewMouseMoveEvent;
-               public static readonly RoutedEvent 
PreviewMouseRightButtonDownEvent;
-               public static readonly RoutedEvent 
PreviewMouseRightButtonUpEvent;
-               public static readonly RoutedEvent PreviewMouseUpEvent;
-               public static readonly RoutedEvent PreviewMouseWheelEvent;
-               public static readonly RoutedEvent 
PreviewQueryContinueDragEvent;
-               public static readonly RoutedEvent PreviewStylusButtonDownEvent;
-               public static readonly RoutedEvent PreviewStylusButtonUpEvent;
-               public static readonly RoutedEvent PreviewStylusDownEvent;
-               public static readonly RoutedEvent PreviewStylusInAirMoveEvent;
-               public static readonly RoutedEvent PreviewStylusInRangeEvent;
-               public static readonly RoutedEvent PreviewStylusMoveEvent;
-               public static readonly RoutedEvent PreviewStylusOutOfRangeEvent;
-               public static readonly RoutedEvent 
PreviewStylusSystemGestureEvent;
-               public static readonly RoutedEvent PreviewStylusUpEvent;
-               public static readonly RoutedEvent PreviewTextInputEvent;
-               public static readonly RoutedEvent QueryContinueDragEvent;
-               public static readonly RoutedEvent QueryCursorEvent;
-               public static readonly RoutedEvent StylusButtonDownEvent;
-               public static readonly RoutedEvent StylusButtonUpEvent;
-               public static readonly RoutedEvent StylusDownEvent;
-               public static readonly RoutedEvent StylusEnterEvent;
-               public static readonly RoutedEvent StylusInAirMoveEvent;
-               public static readonly RoutedEvent StylusInRangeEvent;
-               public static readonly RoutedEvent StylusLeaveEvent;
-               public static readonly RoutedEvent StylusMoveEvent;
-               public static readonly RoutedEvent StylusOutOfRangeEvent;
-               public static readonly RoutedEvent StylusSystemGestureEvent;
-               public static readonly RoutedEvent StylusUpEvent;
-               public static readonly RoutedEvent TextInputEvent;
+               public static readonly RoutedEvent DragEnterEvent = 
DragDrop.DragEnterEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent DragLeaveEvent = 
DragDrop.DragLeaveEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent DragOverEvent = 
DragDrop.DragOverEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent DropEvent = 
DragDrop.DropEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent GiveFeedbackEvent = 
DragDrop.GiveFeedbackEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent GotFocusEvent = 
FocusManager.GotFocusEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent GotKeyboardFocusEvent = 
Keyboard.GotKeyboardFocusEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent GotMouseCaptureEvent = 
Mouse.GotMouseCaptureEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent GotStylusCaptureEvent; // XXX
+               public static readonly RoutedEvent KeyDownEvent = 
Keyboard.KeyDownEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent KeyUpEvent = 
Keyboard.KeyUpEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent LostFocusEvent = 
FocusManager.LostFocusEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent LostKeyboardFocusEvent = 
Keyboard.LostKeyboardFocusEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent LostMouseCaptureEvent = 
Mouse.LostMouseCaptureEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent LostStylusCaptureEvent; // 
XXX
+               public static readonly RoutedEvent MouseDownEvent = 
Mouse.MouseDownEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent MouseEnterEvent = 
Mouse.MouseEnterEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent MouseLeaveEvent = 
Mouse.MouseLeaveEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent MouseLeftButtonDownEvent = 
UIElement.MouseLeftButtonDownEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent MouseLeftButtonUpEvent = 
UIElement.MouseLeftButtonUpEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent MouseMoveEvent = 
Mouse.MouseMoveEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent MouseRightButtonDownEvent = 
UIElement.MouseRightButtonDownEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent MouseRightButtonUpEvent = 
UIElement.MouseRightButtonUpEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent MouseUpEvent = 
Mouse.MouseUpEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent MouseWheelEvent = 
Mouse.MouseWheelEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent PreviewDragEnterEvent =  
DragDrop.PreviewDragEnterEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent PreviewDragLeaveEvent = 
DragDrop.PreviewDragLeaveEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent PreviewDragOverEvent = 
DragDrop.PreviewDragOverEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent PreviewDropEvent = 
DragDrop.PreviewDropEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent PreviewGiveFeedbackEvent = 
DragDrop.PreviewGiveFeedbackEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent PreviewGotKeyboardFocusEvent 
= Keyboard.PreviewGotKeyboardFocusEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent PreviewKeyDownEvent = 
Keyboard.PreviewKeyDownEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent PreviewKeyUpEvent = 
Keyboard.PreviewKeyUpEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent 
PreviewLostKeyboardFocusEvent = Keyboard.PreviewLostKeyboardFocusEvent.AddOwner 
(typeof (ContentElement));
+               public static readonly RoutedEvent PreviewMouseDownEvent = 
Mouse.PreviewMouseDownEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent 
PreviewMouseLeftButtonDownEvent = 
UIElement.PreviewMouseLeftButtonDownEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent 
PreviewMouseLeftButtonUpEvent = 
UIElement.PreviewMouseLeftButtonUpEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent PreviewMouseMoveEvent = 
Mouse.PreviewMouseMoveEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent 
PreviewMouseRightButtonDownEvent = 
UIElement.PreviewMouseRightButtonDownEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent 
PreviewMouseRightButtonUpEvent = 
UIElement.PreviewMouseRightButtonUpEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent PreviewMouseUpEvent = 
Mouse.PreviewMouseUpEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent PreviewMouseWheelEvent = 
Mouse.PreviewMouseWheelEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent 
PreviewQueryContinueDragEvent = DragDrop.PreviewQueryContinueDragEvent.AddOwner 
(typeof (ContentElement));
+               public static readonly RoutedEvent 
PreviewStylusButtonDownEvent; // XXX
+               public static readonly RoutedEvent PreviewStylusButtonUpEvent; 
// XXX
+               public static readonly RoutedEvent PreviewStylusDownEvent; // 
XXX
+               public static readonly RoutedEvent PreviewStylusInAirMoveEvent; 
// XXX
+               public static readonly RoutedEvent PreviewStylusInRangeEvent; 
// XXX
+               public static readonly RoutedEvent PreviewStylusMoveEvent; // 
XXX
+               public static readonly RoutedEvent 
PreviewStylusOutOfRangeEvent; // XXX
+               public static readonly RoutedEvent 
PreviewStylusSystemGestureEvent; // XXX
+               public static readonly RoutedEvent PreviewStylusUpEvent; // XXX
+               public static readonly RoutedEvent PreviewTextInputEvent = 
TextCompositionManager.PreviewTextInputEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent QueryContinueDragEvent = 
DragDrop.QueryContinueDragEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent QueryCursorEvent = 
Mouse.QueryCursorEvent.AddOwner (typeof (ContentElement));
+               public static readonly RoutedEvent StylusButtonDownEvent; // XXX
+               public static readonly RoutedEvent StylusButtonUpEvent; // XXX
+               public static readonly RoutedEvent StylusDownEvent; // XXX
+               public static readonly RoutedEvent StylusEnterEvent; // XXX
+               public static readonly RoutedEvent StylusInAirMoveEvent; // XXX
+               public static readonly RoutedEvent StylusInRangeEvent; // XXX
+               public static readonly RoutedEvent StylusLeaveEvent; // XXX
+               public static readonly RoutedEvent StylusMoveEvent; // XXX
+               public static readonly RoutedEvent StylusOutOfRangeEvent; // XXX
+               public static readonly RoutedEvent StylusSystemGestureEvent; // 
XXX
+               public static readonly RoutedEvent StylusUpEvent; // XXX
+               public static readonly RoutedEvent TextInputEvent = 
TextCompositionManager.TextInputEvent.AddOwner (typeof (ContentElement));
 
+               public event DragEventHandler DragEnter {
+                       add    { AddHandler (DragEnterEvent, value); }
+                       remove { RemoveHandler (DragEnterEvent, value); }
+               }
 
-               public event DragEventHandler DragEnter;
-               public event DragEventHandler DragLeave;
-               public event DragEventHandler DragOver;
-               public event DragEventHandler Drop;
+               public event DragEventHandler DragLeave {
+                       add { AddHandler (DragLeaveEvent, value); }
+                       remove { RemoveHandler (DragLeaveEvent, value); }
+               }
+               public event DragEventHandler DragOver {
+                       add { AddHandler (DragOverEvent, value); }
+                       remove { RemoveHandler (DragOverEvent, value); }
+               }
+               public event DragEventHandler Drop {
+                       add { AddHandler (DropEvent, value); }
+                       remove { RemoveHandler (DropEvent, value); }
+               }
+               public event GiveFeedbackEventHandler GiveFeedback {
+                       add { AddHandler (GiveFeedbackEvent, value); }
+                       remove { RemoveHandler (GiveFeedbackEvent, value); }
+               }
+               public event RoutedEventHandler GotFocus {
+                       add { AddHandler (GotFocusEvent, value); }
+                       remove { RemoveHandler (GotFocusEvent, value); }
+               }
+               public event KeyboardFocusChangedEventHandler GotKeyboardFocus {
+                       add { AddHandler (GotKeyboardFocusEvent, value); }
+                       remove { RemoveHandler (GotKeyboardFocusEvent, value); }
+               }
+               public event MouseEventHandler GotMouseCapture {
+                       add { AddHandler (GotMouseCaptureEvent, value); }
+                       remove { RemoveHandler (GotMouseCaptureEvent, value); }
+               }
+               public event StylusEventHandler GotStylusCapture {
+                       add { AddHandler (GotStylusCaptureEvent, value); }
+                       remove { RemoveHandler (GotStylusCaptureEvent, value); }
+               }
+
                public event DependencyPropertyChangedEventHandler 
FocusableChanged;
-               public event GiveFeedbackEventHandler GiveFeedback;
-               public event RoutedEventHandler GotFocus;
-               public event KeyboardFocusChangedEventHandler GotKeyboardFocus;
-               public event MouseEventHandler GotMouseCapture;
-               public event StylusEventHandler GotStylusCapture;
                public event DependencyPropertyChangedEventHandler 
IsEnabledChanged;
                public event DependencyPropertyChangedEventHandler 
IsKeyboardFocusedChanged;
                public event DependencyPropertyChangedEventHandler 
IsKeyboardFocusWithinChanged;
@@ -133,65 +161,240 @@
                public event DependencyPropertyChangedEventHandler 
IsStylusCapturedChanged;
                public event DependencyPropertyChangedEventHandler 
IsStylusCaptureWithinChanged;
                public event DependencyPropertyChangedEventHandler 
IsStylusDirectlyOverChanged;
-               public event KeyEventHandler KeyDown;
-               public event KeyEventHandler KeyUp;
-               public event RoutedEventHandler LostFocus;
-               public event KeyboardFocusChangedEventHandler LostKeyboardFocus;
-               public event MouseEventHandler LostMouseCapture;
-               public event StylusEventHandler LostStylusCapture;
-               public event MouseButtonEventHandler MouseDown;
-               public event MouseEventHandler MouseEnter;
-               public event MouseEventHandler MouseLeave;
-               public event MouseButtonEventHandler MouseLeftButtonDown;
-               public event MouseButtonEventHandler MouseLeftButtonUp;
-               public event MouseEventHandler MouseMove;
-               public event MouseButtonEventHandler MouseRightButtonDown;
-               public event MouseButtonEventHandler MouseRightButtonUp;
-               public event MouseButtonEventHandler MouseUp;
-               public event MouseWheelEventHandler MouseWheel;
-               public event DragEventHandler PreviewDragEnter;
-               public event DragEventHandler PreviewDragLeave;
-               public event DragEventHandler PreviewDragOver;
-               public event DragEventHandler PreviewDrop;
-               public event GiveFeedbackEventHandler PreviewGiveFeedback;
-               public event KeyboardFocusChangedEventHandler 
PreviewGotKeyboardFocus;
-               public event KeyEventHandler PreviewKeyDown;
-               public event KeyEventHandler PreviewKeyUp;
-               public event KeyboardFocusChangedEventHandler 
PreviewLostKeyboardFocus;
-               public event MouseButtonEventHandler PreviewMouseDown;
-               public event MouseButtonEventHandler PreviewMouseLeftButtonDown;
-               public event MouseButtonEventHandler PreviewMouseLeftButtonUp;
-               public event MouseEventHandler PreviewMouseMove;
-               public event MouseButtonEventHandler 
PreviewMouseRightButtonDown;
-               public event MouseButtonEventHandler PreviewMouseRightButtonUp;
-               public event MouseButtonEventHandler PreviewMouseUp;
-               public event MouseWheelEventHandler PreviewMouseWheel;
-               public event QueryContinueDragEventHandler 
PreviewQueryContinueDrag;
-               public event StylusButtonEventHandler PreviewStylusButtonDown;
-               public event StylusButtonEventHandler PreviewStylusButtonUp;
-               public event StylusDownEventHandler PreviewStylusDown;
-               public event StylusEventHandler PreviewStylusInAirMove;
-               public event StylusEventHandler PreviewStylusInRange;
-               public event StylusEventHandler PreviewStylusMove;
-               public event StylusEventHandler PreviewStylusOutOfRange;
-               public event StylusSystemGestureEventHandler 
PreviewStylusSystemGesture;
-               public event StylusEventHandler PreviewStylusUp;
-               public event TextCompositionEventHandler PreviewTextInput;
-               public event QueryContinueDragEventHandler QueryContinueDrag;
-               public event QueryCursorEventHandler QueryCursor;
-               public event StylusButtonEventHandler StylusButtonDown;
-               public event StylusButtonEventHandler StylusButtonUp;
-               public event StylusDownEventHandler StylusDown;
-               public event StylusEventHandler StylusEnter;
-               public event StylusEventHandler StylusInAirMove;
-               public event StylusEventHandler StylusInRange;
-               public event StylusEventHandler StylusLeave;
-               public event StylusEventHandler StylusMove;
-               public event StylusEventHandler StylusOutOfRange;
-               public event StylusSystemGestureEventHandler 
StylusSystemGesture;
-               public event StylusEventHandler StylusUp;
-               public event TextCompositionEventHandler TextInput;
 
+               public event KeyEventHandler KeyDown {
+                       add { AddHandler (KeyDownEvent, value); }
+                       remove { RemoveHandler (KeyDownEvent, value); }
+               }
+               public event KeyEventHandler KeyUp {
+                       add { AddHandler (KeyUpEvent, value); }
+                       remove { RemoveHandler (KeyUpEvent, value); }
+               }
+               public event RoutedEventHandler LostFocus {
+                       add { AddHandler (LostFocusEvent, value); }
+                       remove { RemoveHandler (LostFocusEvent, value); }
+               }
+               public event KeyboardFocusChangedEventHandler LostKeyboardFocus 
{
+                       add { AddHandler (LostKeyboardFocusEvent, value); }
+                       remove { RemoveHandler (LostKeyboardFocusEvent, value); 
}
+               }
+               public event MouseEventHandler LostMouseCapture {
+                       add { AddHandler (LostMouseCaptureEvent, value); }
+                       remove { RemoveHandler (LostMouseCaptureEvent, value); }
+               }
+               public event StylusEventHandler LostStylusCapture {
+                       add { AddHandler (LostStylusCaptureEvent, value); }
+                       remove { RemoveHandler (LostStylusCaptureEvent, value); 
}
+               }
+               public event MouseButtonEventHandler MouseDown {
+                       add { AddHandler (MouseDownEvent, value); }
+                       remove { RemoveHandler (MouseDownEvent, value); }
+               }
+               public event MouseEventHandler MouseEnter {
+                       add { AddHandler (MouseEnterEvent, value); }
+                       remove { RemoveHandler (MouseEnterEvent, value); }
+               }
+               public event MouseEventHandler MouseLeave {
+                       add { AddHandler (MouseLeaveEvent, value); }
+                       remove { RemoveHandler (MouseLeaveEvent, value); }
+               }
+               public event MouseButtonEventHandler MouseLeftButtonDown {
+                       add { AddHandler (MouseLeftButtonDownEvent, value); }
+                       remove { RemoveHandler (MouseLeftButtonDownEvent, 
value); }
+               }
+               public event MouseButtonEventHandler MouseLeftButtonUp {
+                       add { AddHandler (MouseLeftButtonUpEvent, value); }
+                       remove { RemoveHandler (MouseLeftButtonUpEvent, value); 
}
+               }
+               public event MouseEventHandler MouseMove {
+                       add { AddHandler (MouseMoveEvent, value); }
+                       remove { RemoveHandler (MouseMoveEvent, value); }
+               }
+               public event MouseButtonEventHandler MouseRightButtonDown {
+                       add { AddHandler (MouseRightButtonDownEvent, value); }
+                       remove { RemoveHandler (MouseRightButtonDownEvent, 
value); }
+               }
+               public event MouseButtonEventHandler MouseRightButtonUp {
+                       add { AddHandler (MouseRightButtonUpEvent, value); }
+                       remove { RemoveHandler (MouseRightButtonUpEvent, 
value); }
+               }
+               public event MouseButtonEventHandler MouseUp {
+                       add { AddHandler (MouseUpEvent, value); }
+                       remove { RemoveHandler (MouseUpEvent, value); }
+               }
+               public event MouseWheelEventHandler MouseWheel {
+                       add { AddHandler (MouseWheelEvent, value); }
+                       remove { RemoveHandler (MouseWheelEvent, value); }
+               }
+               public event DragEventHandler PreviewDragEnter {
+                       add { AddHandler (PreviewDragEnterEvent, value); }
+                       remove { RemoveHandler (PreviewDragEnterEvent, value); }
+               }
+               public event DragEventHandler PreviewDragLeave {
+                       add { AddHandler (PreviewDragLeaveEvent, value); }
+                       remove { RemoveHandler (PreviewDragLeaveEvent, value); }
+               }
+               public event DragEventHandler PreviewDragOver {
+                       add { AddHandler (PreviewDragOverEvent, value); }
+                       remove { RemoveHandler (PreviewDragOverEvent, value); }
+               }
+               public event DragEventHandler PreviewDrop {
+                       add { AddHandler (PreviewDropEvent, value); }
+                       remove { RemoveHandler (PreviewDropEvent, value); }
+               }
+               public event GiveFeedbackEventHandler PreviewGiveFeedback {
+                       add { AddHandler (PreviewGiveFeedbackEvent, value); }
+                       remove { RemoveHandler (PreviewGiveFeedbackEvent, 
value); }
+               }
+               public event KeyboardFocusChangedEventHandler 
PreviewGotKeyboardFocus {
+                       add { AddHandler (PreviewGotKeyboardFocusEvent, value); 
}
+                       remove { RemoveHandler (PreviewGotKeyboardFocusEvent, 
value); }
+               }
+               public event KeyEventHandler PreviewKeyDown {
+                       add { AddHandler (PreviewKeyDownEvent, value); }
+                       remove { RemoveHandler (PreviewKeyDownEvent, value); }
+               }
+               public event KeyEventHandler PreviewKeyUp {
+                       add { AddHandler (PreviewKeyUpEvent, value); }
+                       remove { RemoveHandler (PreviewKeyUpEvent, value); }
+               }
+               public event KeyboardFocusChangedEventHandler 
PreviewLostKeyboardFocus {
+                       add { AddHandler (PreviewLostKeyboardFocusEvent, 
value); }
+                       remove { RemoveHandler (PreviewLostKeyboardFocusEvent, 
value); }
+               }
+               public event MouseButtonEventHandler PreviewMouseDown {
+                       add { AddHandler (PreviewMouseDownEvent, value); }
+                       remove { RemoveHandler (PreviewMouseDownEvent, value); }
+               }
+               public event MouseButtonEventHandler PreviewMouseLeftButtonDown 
{
+                       add { AddHandler (PreviewMouseLeftButtonDownEvent, 
value); }
+                       remove { RemoveHandler 
(PreviewMouseLeftButtonDownEvent, value); }
+               }
+               public event MouseButtonEventHandler PreviewMouseLeftButtonUp {
+                       add { AddHandler (PreviewMouseLeftButtonUpEvent, 
value); }
+                       remove { RemoveHandler (PreviewMouseLeftButtonUpEvent, 
value); }
+               }
+               public event MouseEventHandler PreviewMouseMove {
+                       add { AddHandler (PreviewMouseMoveEvent, value); }
+                       remove { RemoveHandler (PreviewMouseMoveEvent, value); }
+               }
+               public event MouseButtonEventHandler 
PreviewMouseRightButtonDown {
+                       add { AddHandler (PreviewMouseRightButtonDownEvent, 
value); }
+                       remove { RemoveHandler 
(PreviewMouseRightButtonDownEvent, value); }
+               }
+               public event MouseButtonEventHandler PreviewMouseRightButtonUp {
+                       add { AddHandler (PreviewMouseRightButtonUpEvent, 
value); }
+                       remove { RemoveHandler (PreviewMouseRightButtonUpEvent, 
value); }
+               }
+               public event MouseButtonEventHandler PreviewMouseUp {
+                       add { AddHandler (PreviewMouseUpEvent, value); }
+                       remove { RemoveHandler (PreviewMouseUpEvent, value); }
+               }
+               public event MouseWheelEventHandler PreviewMouseWheel {
+                       add { AddHandler (PreviewMouseWheelEvent, value); }
+                       remove { RemoveHandler (PreviewMouseWheelEvent, value); 
}
+               }
+               public event QueryContinueDragEventHandler 
PreviewQueryContinueDrag {
+                       add { AddHandler (PreviewQueryContinueDragEvent, 
value); }
+                       remove { RemoveHandler (PreviewQueryContinueDragEvent, 
value); }
+               }
+               public event StylusButtonEventHandler PreviewStylusButtonDown {
+                       add { AddHandler (PreviewStylusButtonDownEvent, value); 
}
+                       remove { RemoveHandler (PreviewStylusButtonDownEvent, 
value); }
+               }
+               public event StylusButtonEventHandler PreviewStylusButtonUp {
+                       add { AddHandler (PreviewStylusButtonUpEvent, value); }
+                       remove { RemoveHandler (PreviewStylusButtonUpEvent, 
value); }
+               }
+               public event StylusDownEventHandler PreviewStylusDown {
+                       add { AddHandler (PreviewStylusDownEvent, value); }
+                       remove { RemoveHandler (PreviewStylusDownEvent, value); 
}
+               }
+               public event StylusEventHandler PreviewStylusInAirMove {
+                       add { AddHandler (PreviewStylusInAirMoveEvent, value); }
+                       remove { RemoveHandler (PreviewStylusInAirMoveEvent, 
value); }
+               }
+               public event StylusEventHandler PreviewStylusInRange {
+                       add { AddHandler (PreviewStylusInRangeEvent, value); }
+                       remove { RemoveHandler (PreviewStylusInRangeEvent, 
value); }
+               }
+               public event StylusEventHandler PreviewStylusMove {
+                       add { AddHandler (PreviewStylusMoveEvent, value); }
+                       remove { RemoveHandler (PreviewStylusMoveEvent, value); 
}
+               }
+               public event StylusEventHandler PreviewStylusOutOfRange {
+                       add { AddHandler (PreviewStylusOutOfRangeEvent, value); 
}
+                       remove { RemoveHandler (PreviewStylusOutOfRangeEvent, 
value); }
+               }
+               public event StylusSystemGestureEventHandler 
PreviewStylusSystemGesture {
+                       add { AddHandler (PreviewStylusSystemGestureEvent, 
value); }
+                       remove { RemoveHandler 
(PreviewStylusSystemGestureEvent, value); }
+               }
+               public event StylusEventHandler PreviewStylusUp {
+                       add { AddHandler (PreviewStylusUpEvent, value); }
+                       remove { RemoveHandler (PreviewStylusUpEvent, value); }
+               }
+               public event TextCompositionEventHandler PreviewTextInput {
+                       add { AddHandler (PreviewTextInputEvent, value); }
+                       remove { RemoveHandler (PreviewTextInputEvent, value); }
+               }
+               public event QueryContinueDragEventHandler QueryContinueDrag {
+                       add { AddHandler (QueryContinueDragEvent, value); }
+                       remove { RemoveHandler (QueryContinueDragEvent, value); 
}
+               }
+               public event QueryCursorEventHandler QueryCursor {
+                       add { AddHandler (QueryCursorEvent, value); }
+                       remove { RemoveHandler (QueryCursorEvent, value); }
+               }
+               public event StylusButtonEventHandler StylusButtonDown {
+                       add { AddHandler (StylusButtonDownEvent, value); }
+                       remove { RemoveHandler (StylusButtonDownEvent, value); }
+               }
+               public event StylusButtonEventHandler StylusButtonUp {
+                       add { AddHandler (StylusButtonUpEvent, value); }
+                       remove { RemoveHandler (StylusButtonUpEvent, value); }
+               }
+               public event StylusDownEventHandler StylusDown {
+                       add { AddHandler (StylusDownEvent, value); }
+                       remove { RemoveHandler (StylusDownEvent, value); }
+               }
+               public event StylusEventHandler StylusEnter {
+                       add { AddHandler (StylusEnterEvent, value); }
+                       remove { RemoveHandler (StylusEnterEvent, value); }
+               }
+               public event StylusEventHandler StylusInAirMove {
+                       add { AddHandler (StylusInAirMoveEvent, value); }
+                       remove { RemoveHandler (StylusInAirMoveEvent, value); }
+               }
+               public event StylusEventHandler StylusInRange {
+                       add { AddHandler (StylusInRangeEvent, value); }
+                       remove { RemoveHandler (StylusInRangeEvent, value); }
+               }
+               public event StylusEventHandler StylusLeave {
+                       add { AddHandler (StylusLeaveEvent, value); }
+                       remove { RemoveHandler (StylusLeaveEvent, value); }
+               }
+               public event StylusEventHandler StylusMove {
+                       add { AddHandler (StylusMoveEvent, value); }
+                       remove { RemoveHandler (StylusMoveEvent, value); }
+               }
+               public event StylusEventHandler StylusOutOfRange {
+                       add { AddHandler (StylusOutOfRangeEvent, value); }
+                       remove { RemoveHandler (StylusOutOfRangeEvent, value); }
+               }
+               public event StylusSystemGestureEventHandler 
StylusSystemGesture {
+                       add { AddHandler (StylusSystemGestureEvent, value); }
+                       remove { RemoveHandler (StylusSystemGestureEvent, 
value); }
+               }
+               public event StylusEventHandler StylusUp {
+                       add { AddHandler (StylusUpEvent, value); }
+                       remove { RemoveHandler (StylusUpEvent, value); }
+               }
+               public event TextCompositionEventHandler TextInput {
+                       add { AddHandler (TextInputEvent, value); }
+                       remove { RemoveHandler (TextInputEvent, value); }
+               }
+
                public ContentElement ()
                {
                }
@@ -271,14 +474,17 @@
                {
                        throw new NotImplementedException ();
                }
+
                protected virtual void OnDragLeave (DragEventArgs e)
                {
                        throw new NotImplementedException ();
                }
+
                protected virtual void OnDragOver (DragEventArgs e)
                {
                        throw new NotImplementedException ();
                }
+
                protected virtual void OnDrop (DragEventArgs e)
                {
                        throw new NotImplementedException ();

Modified: trunk/olive/class/PresentationCore/System.Windows/UIElement.cs
===================================================================
--- trunk/olive/class/PresentationCore/System.Windows/UIElement.cs      
2007-12-02 19:51:45 UTC (rev 90530)
+++ trunk/olive/class/PresentationCore/System.Windows/UIElement.cs      
2007-12-02 19:52:25 UTC (rev 90531)
@@ -25,6 +25,8 @@
 
 using System.Windows.Media;
 
+using System.Windows.Input;
+
 namespace System.Windows {
 
        public class UIElement : Visual {
@@ -54,73 +56,73 @@
                public static readonly DependencyProperty 
RenderTransformProperty;
                public static readonly DependencyProperty 
SnapsToDevicePixelsProperty;
 
-               public static readonly RoutedEvent DragEnterEvent;
-               public static readonly RoutedEvent DragLeaveEvent;
-               public static readonly RoutedEvent DragOverEvent;
-               public static readonly RoutedEvent DropEvent;
-               public static readonly RoutedEvent GiveFeedbackEvent;
-               public static readonly RoutedEvent GotFocusEvent;
-               public static readonly RoutedEvent GotKeyboardFocusEvent;
-               public static readonly RoutedEvent GotMouseCaptureEvent;
-               public static readonly RoutedEvent GotStylusCaptureEvent;
-               public static readonly RoutedEvent KeyDownEvent;
-               public static readonly RoutedEvent KeyUpEvent;
-               public static readonly RoutedEvent LostFocusEvent;
-               public static readonly RoutedEvent LostKeyboardFocusEvent;
-               public static readonly RoutedEvent LostMouseFocusEvent;
-               public static readonly RoutedEvent LostStylusFocusEvent;
-               public static readonly RoutedEvent MouseDownEvent;
-               public static readonly RoutedEvent MouseEnterEvent;
-               public static readonly RoutedEvent MouseLeaveEvent;
-               public static readonly RoutedEvent MouseLeftButtonDownEvent;
-               public static readonly RoutedEvent MouseLeftButtonUpEvent;
-               public static readonly RoutedEvent MouseMoveEvent;
-               public static readonly RoutedEvent MouseRightButtonDownEvent;
-               public static readonly RoutedEvent MouseRightButtonUpEvent;
-               public static readonly RoutedEvent MouseUpEvent;
-               public static readonly RoutedEvent MouseWheelEvent;
-               public static readonly RoutedEvent PreviewDragEnterEvent;
-               public static readonly RoutedEvent PreviewDragLeaveEvent;
-               public static readonly RoutedEvent PreviewDragOverEvent;
-               public static readonly RoutedEvent PreviewDropEvent;
-               public static readonly RoutedEvent PreviewGiveFeedbackEvent;
-               public static readonly RoutedEvent PreviewGotKeyboardFocusEvent;
-               public static readonly RoutedEvent PreviewKeyDownEvent;
-               public static readonly RoutedEvent PreviewKeyUpEvent;
-               public static readonly RoutedEvent 
PreviewLostKeyboardFocusEvent;
-               public static readonly RoutedEvent PreviewMouseDownEvent;
-               public static readonly RoutedEvent 
PreviewMouseLeftButtonDownEvent;
-               public static readonly RoutedEvent 
PreviewMouseLeftButtonUpEvent;
-               public static readonly RoutedEvent PreviewMouseMoveEvent;
-               public static readonly RoutedEvent 
PreviewMouseRightButtonDownEvent;
-               public static readonly RoutedEvent 
PreviewMouseRightButtonUpEvent;
-               public static readonly RoutedEvent PreviewMouseUpEvent;
-               public static readonly RoutedEvent PreviewMouseWheelEvent;
-               public static readonly RoutedEvent 
PreviewQueryContinueDragEvent;
-               public static readonly RoutedEvent PreviewStylusButtonDownEvent;
-               public static readonly RoutedEvent PreviewStylusButtonUpEvent;
-               public static readonly RoutedEvent PreviewStylusDownEvent;
-               public static readonly RoutedEvent PreviewStylusInAirMoveEvent;
-               public static readonly RoutedEvent PreviewStylusInRangeEvent;
-               public static readonly RoutedEvent PreviewStylusMoveEvent;
-               public static readonly RoutedEvent PreviewStylusOutOfRangeEvent;
-               public static readonly RoutedEvent 
PreviewStylusSystemGestureEvent;
-               public static readonly RoutedEvent PreviewStylusUpEvent;
-               public static readonly RoutedEvent PreviewTextInputEvent;
-               public static readonly RoutedEvent QueryContinueDragEvent;
-               public static readonly RoutedEvent QueryCursorEvent;
-               public static readonly RoutedEvent StylusButtonDownEvent;
-               public static readonly RoutedEvent StylusButtonUpEvent;
-               public static readonly RoutedEvent StylusDownEvent;
-               public static readonly RoutedEvent StylusEnterEvent;
-               public static readonly RoutedEvent StylusInAirMoveEvent;
-               public static readonly RoutedEvent StylusInRangeEvent;
-               public static readonly RoutedEvent StylusLeaveEvent;
-               public static readonly RoutedEvent StylusMoveEvent;
-               public static readonly RoutedEvent StylusOutOfRangeEvent;
-               public static readonly RoutedEvent StylusSystemGestureEvent;
-               public static readonly RoutedEvent StylusUpEvent;
-               public static readonly RoutedEvent TextInputEvent;
+               public static readonly RoutedEvent DragEnterEvent = 
DragDrop.DragEnterEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent DragLeaveEvent = 
DragDrop.DragLeaveEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent DragOverEvent = 
DragDrop.DragOverEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent DropEvent = 
DragDrop.DropEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent GiveFeedbackEvent = 
DragDrop.GiveFeedbackEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent GotFocusEvent = 
FocusManager.GotFocusEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent GotKeyboardFocusEvent = 
Keyboard.GotKeyboardFocusEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent GotMouseCaptureEvent = 
Mouse.GotMouseCaptureEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent GotStylusCaptureEvent; // XXX
+               public static readonly RoutedEvent KeyDownEvent = 
Keyboard.KeyDownEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent KeyUpEvent = 
Keyboard.KeyUpEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent LostFocusEvent = 
FocusManager.LostFocusEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent LostKeyboardFocusEvent = 
Keyboard.LostKeyboardFocusEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent LostMouseCaptureEvent = 
Mouse.LostMouseCaptureEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent LostStylusCaptureEvent; // 
XXX
+               public static readonly RoutedEvent MouseDownEvent = 
Mouse.MouseDownEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent MouseEnterEvent = 
Mouse.MouseEnterEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent MouseLeaveEvent = 
Mouse.MouseLeaveEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent MouseLeftButtonDownEvent = 
UIElement.MouseLeftButtonDownEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent MouseLeftButtonUpEvent = 
UIElement.MouseLeftButtonUpEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent MouseMoveEvent = 
Mouse.MouseMoveEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent MouseRightButtonDownEvent = 
UIElement.MouseRightButtonDownEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent MouseRightButtonUpEvent = 
UIElement.MouseRightButtonUpEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent MouseUpEvent = 
Mouse.MouseUpEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent MouseWheelEvent = 
Mouse.MouseWheelEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent PreviewDragEnterEvent =  
DragDrop.PreviewDragEnterEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent PreviewDragLeaveEvent = 
DragDrop.PreviewDragLeaveEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent PreviewDragOverEvent = 
DragDrop.PreviewDragOverEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent PreviewDropEvent = 
DragDrop.PreviewDropEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent PreviewGiveFeedbackEvent = 
DragDrop.PreviewGiveFeedbackEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent PreviewGotKeyboardFocusEvent 
= Keyboard.PreviewGotKeyboardFocusEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent PreviewKeyDownEvent = 
Keyboard.PreviewKeyDownEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent PreviewKeyUpEvent = 
Keyboard.PreviewKeyUpEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent 
PreviewLostKeyboardFocusEvent = Keyboard.PreviewLostKeyboardFocusEvent.AddOwner 
(typeof (UIElement));
+               public static readonly RoutedEvent PreviewMouseDownEvent = 
Mouse.PreviewMouseDownEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent 
PreviewMouseLeftButtonDownEvent = 
UIElement.PreviewMouseLeftButtonDownEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent 
PreviewMouseLeftButtonUpEvent = 
UIElement.PreviewMouseLeftButtonUpEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent PreviewMouseMoveEvent = 
Mouse.PreviewMouseMoveEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent 
PreviewMouseRightButtonDownEvent = 
UIElement.PreviewMouseRightButtonDownEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent 
PreviewMouseRightButtonUpEvent = 
UIElement.PreviewMouseRightButtonUpEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent PreviewMouseUpEvent = 
Mouse.PreviewMouseUpEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent PreviewMouseWheelEvent = 
Mouse.PreviewMouseWheelEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent 
PreviewQueryContinueDragEvent = DragDrop.PreviewQueryContinueDragEvent.AddOwner 
(typeof (UIElement));
+               public static readonly RoutedEvent 
PreviewStylusButtonDownEvent; // XXX
+               public static readonly RoutedEvent PreviewStylusButtonUpEvent; 
// XXX
+               public static readonly RoutedEvent PreviewStylusDownEvent; // 
XXX
+               public static readonly RoutedEvent PreviewStylusInAirMoveEvent; 
// XXX
+               public static readonly RoutedEvent PreviewStylusInRangeEvent; 
// XXX
+               public static readonly RoutedEvent PreviewStylusMoveEvent; // 
XXX
+               public static readonly RoutedEvent 
PreviewStylusOutOfRangeEvent; // XXX
+               public static readonly RoutedEvent 
PreviewStylusSystemGestureEvent; // XXX
+               public static readonly RoutedEvent PreviewStylusUpEvent; // XXX
+               public static readonly RoutedEvent PreviewTextInputEvent = 
TextCompositionManager.PreviewTextInputEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent QueryContinueDragEvent = 
DragDrop.QueryContinueDragEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent QueryCursorEvent = 
Mouse.QueryCursorEvent.AddOwner (typeof (UIElement));
+               public static readonly RoutedEvent StylusButtonDownEvent; // XXX
+               public static readonly RoutedEvent StylusButtonUpEvent; // XXX
+               public static readonly RoutedEvent StylusDownEvent; // XXX
+               public static readonly RoutedEvent StylusEnterEvent; // XXX
+               public static readonly RoutedEvent StylusInAirMoveEvent; // XXX
+               public static readonly RoutedEvent StylusInRangeEvent; // XXX
+               public static readonly RoutedEvent StylusLeaveEvent; // XXX
+               public static readonly RoutedEvent StylusMoveEvent; // XXX
+               public static readonly RoutedEvent StylusOutOfRangeEvent; // XXX
+               public static readonly RoutedEvent StylusSystemGestureEvent; // 
XXX
+               public static readonly RoutedEvent StylusUpEvent; // XXX
+               public static readonly RoutedEvent TextInputEvent = 
TextCompositionManager.TextInputEvent.AddOwner (typeof (UIElement));
 
                public UIElement ()
                {
@@ -128,6 +130,30 @@
 
                /* XXX tons of properties and Add*Handler/Remove*Handler calls 
*/
 
+               internal static void AddHandler (DependencyObject d, 
RoutedEvent routedEvent, Delegate handler)
+               {
+                       if (d is UIElement)
+                               ((UIElement)d).AddHandler (routedEvent, 
handler);
+                       else if (d is ContentElement)
+                               ((ContentElement)d).AddHandler (routedEvent, 
handler);
+                       else if (d is IInputElement)
+                               ((IInputElement)d).AddHandler (routedEvent, 
handler);
+                       else
+                               throw new ArgumentException (String.Format 
("type '{0}' is not subclass of UIElement or ContentElement, and doesn't 
implement the IInputElement interface, so you can't add RoutedEvent handlers to 
it.", d.GetType()));
+               }
+
+               internal static void RemoveHandler (DependencyObject d, 
RoutedEvent routedEvent, Delegate handler)
+               {
+                       if (d is UIElement)
+                               ((UIElement)d).RemoveHandler (routedEvent, 
handler);
+                       else if (d is ContentElement)
+                               ((ContentElement)d).RemoveHandler (routedEvent, 
handler);
+                       else if (d is IInputElement)
+                               ((IInputElement)d).RemoveHandler (routedEvent, 
handler);
+                       else
+                               throw new ArgumentException (String.Format 
("type '{0}' is not subclass of UIElement or ContentElement, and doesn't 
implement the IInputElement interface, so you can't add RoutedEvent handlers to 
it.", d.GetType()));
+               }
+
                public void AddHandler (RoutedEvent routedEvent, Delegate 
handler)
                {
                        throw new NotImplementedException ();

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to