+ private IntPtr OnPreFocusChange(IntPtr current, IntPtr proposed, View.FocusDirection direction)
+ {
+ View view = null;
+ PreFocusChangeEventArgs e = new PreFocusChangeEventArgs();
+
+ if (current != global::System.IntPtr.Zero)
+ {
+ e.CurrentView = Registry.GetManagedBaseHandleFromNativePtr(current) as View;
+ }
+ if (proposed != global::System.IntPtr.Zero)
+ {
+ e.ProposedView = Registry.GetManagedBaseHandleFromNativePtr(proposed) as View;
+ }
+ e.Direction = direction;
+
+ if (_preFocusChangeEventHandler != null)
+ {
+ view = _preFocusChangeEventHandler(this, e);
+ }
+
+ if (view)
+ {
+ return view.GetPtrfromView();
+ }
+ else
+ {
+ if (e.ProposedView) return proposed;
+ else return current;
+ }
+ }
+
+ private void OnFocusChanged(IntPtr current, IntPtr next)
+ {
+ FocusChangedEventArgs e = new FocusChangedEventArgs();
+
+ e.CurrentView = Registry.GetManagedBaseHandleFromNativePtr(current) as View;
+ e.NextView = Registry.GetManagedBaseHandleFromNativePtr(next) as View;
+
+ if (_focusChangedEventHandler != null)
+ {
+ _focusChangedEventHandler(this, e);
+ }
+ }
+
+ private void OnFocusGroupChanged(IntPtr current, bool forwardDirection)
+ {
+ FocusGroupChangedEventArgs e = new FocusGroupChangedEventArgs();
+
+ e.CurrentView = Registry.GetManagedBaseHandleFromNativePtr(current) as View;
+ e.ForwardDirection = forwardDirection;
+
+ if (_focusGroupChangedEventHandler != null)
+ {
+ _focusGroupChangedEventHandler(this, e);
+ }
+ }
+
+ private void OnFocusedViewEnterKey(IntPtr view)
+ {
+ FocusedViewActivatedEventArgs e = new FocusedViewActivatedEventArgs();
+
+ e.View = Registry.GetManagedBaseHandleFromNativePtr(view) as View;
+
+ if (_focusedViewEnterKeyEventHandler != null)
+ {
+ _focusedViewEnterKeyEventHandler(this, e);
+ }
+ }