2 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 using System.ComponentModel;
18 using Tizen.NUI.Binding;
20 namespace Tizen.NUI.BaseComponents
23 /// CustomView provides some common functionality required by all views.
25 /// <since_tizen> 3 </since_tizen>
26 public class CustomView : ViewWrapper
28 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
29 [EditorBrowsable(EditorBrowsableState.Never)]
30 public static readonly BindableProperty FocusNavigationSupportProperty = BindableProperty.Create("FocusNavigationSupport", typeof(bool), typeof(CustomView), false, propertyChanged: (bindable, oldValue, newValue) =>
32 var customView = (CustomView)bindable;
35 customView.SetKeyboardNavigationSupport((bool)newValue);
38 defaultValueCreator: (bindable) =>
40 var customView = (CustomView)bindable;
41 return customView.IsKeyboardNavigationSupported();
44 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
45 [EditorBrowsable(EditorBrowsableState.Never)]
46 public static readonly BindableProperty FocusGroupProperty = BindableProperty.Create("FocusGroup", typeof(bool), typeof(CustomView), false, propertyChanged: (bindable, oldValue, newValue) =>
48 var customView = (CustomView)bindable;
51 customView.SetAsKeyboardFocusGroup((bool)newValue);
54 defaultValueCreator: (bindable) =>
56 var customView = (CustomView)bindable;
57 return customView.IsKeyboardFocusGroup();
61 /// Create an instance of customView.
63 /// <param name="typeName">typename</param>
64 /// <param name="behaviour">CustomView Behaviour</param>
65 /// <since_tizen> 3 </since_tizen>
66 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
67 [EditorBrowsable(EditorBrowsableState.Never)]
68 public CustomView(string typeName, CustomViewBehaviour behaviour, ViewStyle viewStyle) : base(typeName, new ViewWrapperImpl(behaviour), viewStyle)
74 /// Create an instance of customView.
76 /// <param name="typeName">typename</param>
77 /// <param name="behaviour">CustomView Behaviour</param>
78 /// <since_tizen> 3 </since_tizen>
79 public CustomView(string typeName, CustomViewBehaviour behaviour) : base(typeName, new ViewWrapperImpl(behaviour))
85 /// Sets whether this control supports two dimensional keyboard navigation
86 /// (i.e., whether it knows how to handle the keyboard focus movement between its child views).<br />
87 /// The control doesn't support it by default.<br />
89 /// <since_tizen> 3 </since_tizen>
90 public bool FocusNavigationSupport
94 return (bool)GetValue(FocusNavigationSupportProperty);
98 SetValue(FocusNavigationSupportProperty, value);
103 /// Sets or gets whether this control is a focus group for keyboard navigation.
105 /// <returns>True if this control is set as a focus group for keyboard navigation.</returns>
106 /// <since_tizen> 3 </since_tizen>
107 public bool FocusGroup
111 return (bool)GetValue(FocusGroupProperty);
115 SetValue(FocusGroupProperty, value);
120 /// Sets the background with a property map.
122 /// <param name="map">The background property map.</param>
123 /// <since_tizen> 3 </since_tizen>
124 public void SetBackground(Tizen.NUI.PropertyMap map)
126 viewWrapperImpl.SetBackground(map);
130 /// Allows deriving classes to enable any of the gesture detectors that are available.<br />
131 /// Gesture detection can be enabled one at a time or in a bitwise format.<br />
133 /// <param name="type">The gesture type(s) to enable.</param>
134 /// <since_tizen> 3 </since_tizen>
135 public void EnableGestureDetection(Gesture.GestureType type)
137 viewWrapperImpl.EnableGestureDetection(type);
141 /// This method is called after the control has been initialized.<br />
142 /// Derived classes should do any second phase initialization by overriding this method.<br />
144 /// <since_tizen> 3 </since_tizen>
145 public virtual void OnInitialize()
150 /// Called after the view has been connected to the stage.<br />
151 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
152 /// The root view is provided automatically by Tizen.NUI.Stage, and is always considered to be connected.<br />
153 /// When the parent of a set of views is connected to the stage, then all of the children will receive this callback.<br />
155 /// <param name="depth">The depth in the hierarchy for the view.</param>
156 /// <since_tizen> 3 </since_tizen>
157 public virtual void OnStageConnection(int depth)
162 /// Called after the view has been disconnected from the stage.<br />
163 /// If a view is disconnected, it either has no parent, or is parented to a disconnected view.<br />
164 /// When the parent of a set of views is disconnected to the stage, then all of the children will receive this callback, starting with the leaf views.<br />
166 /// <since_tizen> 3 </since_tizen>
167 public virtual void OnStageDisconnection()
172 /// Called after a child has been added to the owning view.
174 /// <param name="view">The child which has been added.</param>
175 /// <since_tizen> 3 </since_tizen>
176 public virtual void OnChildAdd(View view)
181 /// Called after the owning view has attempted to remove a child( regardless of whether it succeeded or not ).
183 /// <param name="view">The child being removed.</param>
184 /// <since_tizen> 3 </since_tizen>
185 public virtual void OnChildRemove(View view)
190 /// Called when the owning view property is set.
192 /// <param name="index">The property index that was set.</param>
193 /// <param name="propertyValue">The value to set.</param>
194 /// <since_tizen> 3 </since_tizen>
195 public virtual void OnPropertySet(int index, Tizen.NUI.PropertyValue propertyValue)
200 /// Called when the owning view's size is set, for example, using View.SetSize().
202 /// <param name="targetSize">The target size.</param>
203 /// <since_tizen> 3 </since_tizen>
204 public virtual void OnSizeSet(Vector3 targetSize)
209 /// Called when the owning view's size is animated, for example, using Animation::AnimateTo( Property ( view, View::Property::SIZE ), ... ).
211 /// <param name="animation">The object which is animating the owning view.</param>
212 /// <param name="targetSize">The target size.</param>
213 /// <since_tizen> 3 </since_tizen>
214 public virtual void OnSizeAnimation(Animation animation, Vector3 targetSize)
219 /// Called after a touch event is received by the owning view.<br />
220 /// CustomViewBehaviour.REQUIRES_TOUCH_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).<br />
222 /// <param name="touch">The touch event.</param>
223 /// <returns>True if the event should be consumed.</returns>
224 /// <since_tizen> 3 </since_tizen>
225 public virtual bool OnTouch(Touch touch)
227 return false; // Do not consume
231 /// Called after a hover event is received by the owning view.<br />
232 /// CustomViewBehaviour.REQUIRES_HOVER_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).<br />
234 /// <param name="hover">The hover event.</param>
235 /// <returns>True if the hover event should be consumed.</returns>
236 /// <since_tizen> 3 </since_tizen>
237 public virtual bool OnHover(Hover hover)
239 return false; // Do not consume
243 /// Called after a key event is received by the view that has had its focus set.
245 /// <param name="key">The key event.</param>
246 /// <returns>True if the key event should be consumed.</returns>
247 /// <since_tizen> 3 </since_tizen>
248 public virtual bool OnKey(Key key)
250 return false; // Do not consume
254 /// Called after a wheel event is received by the owning view.<br />
255 /// CustomViewBehaviour.REQUIRES_WHEEL_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).<br />
257 /// <param name="wheel">The wheel event.</param>
258 /// <returns>True if the wheel event should be consumed.</returns>
259 /// <since_tizen> 3 </since_tizen>
260 public virtual bool OnWheel(Wheel wheel)
262 return false; // Do not consume
266 /// Called after the size negotiation has been finished for this control.<br />
267 /// The control is expected to assign this given size to itself or its children.<br />
268 /// Should be overridden by derived classes if they need to layout views differently after certain operations like add or remove views, resize, or after changing specific properties.<br />
269 /// As this function is called from inside the size negotiation algorithm, you cannot call RequestRelayout (the call would just be ignored).<br />
271 /// <param name="size">The allocated size.</param>
272 /// <param name="container">The control should add views to this container that it is not able to allocate a size for.</param>
273 /// <since_tizen> 3 </since_tizen>
274 public virtual void OnRelayout(Vector2 size, RelayoutContainer container)
279 /// Notification for deriving classes.
281 /// <param name="policy">The policy being set.</param>
282 /// <param name="dimension">The policy is being set for.</param>
283 /// <since_tizen> 3 </since_tizen>
284 public virtual void OnSetResizePolicy(ResizePolicyType policy, DimensionType dimension)
289 /// Returns the natural size of the view.
291 /// <returns>The view's natural size</returns>
292 /// <since_tizen> 3 </since_tizen>
293 public new virtual Size2D GetNaturalSize()
295 return sizeSetExplicitly; // Returns the size set explicitly on View unless Overridden.
299 /// Calculates the size for a child.
301 /// <param name="child">The child view to calculate the size for.</param>
302 /// <param name="dimension">The dimension to calculate the size, for example, the width or the height.</param>
303 /// <returns>Return the calculated size for the given dimension. If more than one dimension is requested, just return the first one found.</returns>
304 /// <since_tizen> 3 </since_tizen>
305 public virtual float CalculateChildSize(View child, DimensionType dimension)
307 return viewWrapperImpl.CalculateChildSizeBase(child, dimension);
311 /// This method is called during size negotiation when a height is required for a given width.<br />
312 /// Derived classes should override this if they wish to customize the height returned.<br />
314 /// <param name="width">Width to use</param>
315 /// <returns>The height based on the width</returns>
316 /// <since_tizen> 3 </since_tizen>
317 public new virtual float GetHeightForWidth(float width)
319 return viewWrapperImpl.GetHeightForWidthBase(width);
323 /// This method is called during size negotiation when a width is required for a given height.<br />
324 /// Derived classes should override this if they wish to customize the width returned.<br />
326 /// <param name="height">Height to use</param>
327 /// <returns>The width based on the width</returns>
328 /// <since_tizen> 3 </since_tizen>
329 public new virtual float GetWidthForHeight(float height)
331 return viewWrapperImpl.GetWidthForHeightBase(height);
335 /// Determines if this view is dependent on it's children for relayout.
337 /// <param name="dimension">The dimension(s) to check for.</param>
338 /// <returns>Return if the view is dependent on it's children.</returns>
339 /// <since_tizen> 3 </since_tizen>
340 public virtual bool RelayoutDependentOnChildren(DimensionType dimension)
342 return viewWrapperImpl.RelayoutDependentOnChildrenBase(dimension);
346 /// Determines if this view is dependent on it's children for relayout from the base class.
348 /// <returns>Return true if the view is dependent on it's children.</returns>
349 /// <since_tizen> 3 </since_tizen>
350 public virtual bool RelayoutDependentOnChildren()
352 return viewWrapperImpl.RelayoutDependentOnChildrenBase();
356 /// The virtual method to notify deriving classes that relayout dependencies have been
357 /// met and the size for this object is about to be calculated for the given dimension.
359 /// <param name="dimension">The dimension that is about to be calculated.</param>
360 /// <since_tizen> 3 </since_tizen>
361 public virtual void OnCalculateRelayoutSize(DimensionType dimension)
366 /// The virtual method to notify deriving classes that the size for a dimension has just been negotiated.
368 /// <param name="size">The new size for the given dimension.</param>
369 /// <param name="dimension">The dimension that was just negotiated.</param>
370 /// <since_tizen> 3 </since_tizen>
371 public virtual void OnLayoutNegotiated(float size, DimensionType dimension)
376 /// This method should be overridden by deriving classes requiring notifications when the style changes.
378 /// <param name="styleManager">The StyleManager object.</param>
379 /// <param name="change">Information denoting what has changed.</param>
380 /// <since_tizen> 3 </since_tizen>
381 public virtual void OnStyleChange(StyleManager styleManager, StyleChangeType change)
386 /// Called when the control gain key input focus. Should be overridden by derived classes if they need to customize what happens when the focus is gained.
388 /// <since_tizen> 3 </since_tizen>
389 public virtual void OnFocusGained()
394 /// Called when the control loses key input focus. Should be overridden by derived classes if they need to customize what happens when the focus is lost.
396 /// <since_tizen> 3 </since_tizen>
397 public virtual void OnFocusLost()
402 /// Gets the next keyboard focusable view in this control towards the given direction.<br />
403 /// A control needs to override this function in order to support two dimensional keyboard navigation.<br />
405 /// <param name="currentFocusedView">The current focused view.</param>
406 /// <param name="direction">The direction to move the focus towards.</param>
407 /// <param name="loopEnabled">Whether the focus movement should be looped within the control.</param>
408 /// <returns>The next keyboard focusable view in this control or an empty handle if no view can be focused.</returns>
409 /// <since_tizen> 3 </since_tizen>
410 public virtual View GetNextFocusableView(View currentFocusedView, View.FocusDirection direction, bool loopEnabled)
416 /// Informs this control that its chosen focusable view will be focused.<br />
417 /// This allows the application to preform any actions it wishes before the focus is actually moved to the chosen view.<br />
419 /// <param name="commitedFocusableView">The commited focused view.</param>
420 /// <since_tizen> 3 </since_tizen>
421 public virtual void OnFocusChangeCommitted(View commitedFocusableView)
426 /// This method is called when the control has enter pressed on it.<br />
427 /// Derived classes should override this to perform custom actions.<br />
429 /// <returns>True if this control supported this action.</returns>
430 /// <since_tizen> 3 </since_tizen>
431 public virtual bool OnKeyboardEnter()
437 /// Called whenever a pan gesture is detected on this control.<br />
438 /// This should be overridden by deriving classes when pan detection is enabled.<br />
439 /// There is no default behavior with panning.<br />
440 /// Pan detection should be enabled via EnableGestureDetection().<br />
442 /// <param name="pan">The pan gesture.</param>
443 /// <since_tizen> 3 </since_tizen>
444 public virtual void OnPan(PanGesture pan)
449 /// Called whenever a tap gesture is detected on this control.<br />
450 /// This should be overridden by deriving classes when tap detection is enabled.<br />
451 /// There is no default behavior with a tap.<br />
452 /// Tap detection should be enabled via EnableGestureDetection().<br />
454 /// <param name="tap">The tap gesture.</param>
455 /// <since_tizen> 3 </since_tizen>
456 public virtual void OnTap(TapGesture tap)
461 /// This method is called when the control accessibility is activated.<br />
462 /// Derived classes should override this to perform custom accessibility activation.<br />
464 /// <returns>True if this control can perform accessibility activation.</returns>
465 internal virtual bool OnAccessibilityActivated()
471 /// This method should be overridden by deriving classes when they wish to respond the accessibility.
473 /// <param name="gestures">The pan gesture.</param>
474 /// <returns>True if the pan gesture has been consumed by this control.</returns>
475 internal virtual bool OnAccessibilityPan(PanGesture gestures)
481 /// This method should be overridden by deriving classes when they wish to respond the accessibility.
483 /// <param name="touch">The touch gesture.</param>
484 /// <returns>True if the touch event has been consumed by this control.</returns>
485 internal virtual bool OnAccessibilityTouch(Touch touch)
491 /// This method should be overridden by deriving classes when they wish to respond the accessibility up and down action (i.e., value change of slider control).
493 /// <param name="isIncrease">Whether the value should be increased or decreased.</param>
494 /// <returns>True if the value changed action has been consumed by this control.</returns>
495 internal virtual bool OnAccessibilityValueChange(bool isIncrease)
501 /// This method should be overridden by deriving classes when they wish to respond the accessibility zoom action.
503 /// <returns>True if the zoom action has been consumed by this control.</returns>
504 internal virtual bool OnAccessibilityZoom()
510 /// Allows deriving classes to disable any of the gesture detectors.<br />
511 /// Like EnableGestureDetection, this can also be called using bitwise or one at a time.<br />
513 /// <param name="type">The gesture type(s) to disable.</param>
514 internal void DisableGestureDetection(Gesture.GestureType type)
516 viewWrapperImpl.DisableGestureDetection(type);
519 internal void SetKeyboardNavigationSupport(bool isSupported)
521 viewWrapperImpl.SetKeyboardNavigationSupport(isSupported);
525 /// Gets whether this control supports two-dimensional keyboard navigation.
527 /// <returns>True if this control supports two-dimensional keyboard navigation.</returns>
528 internal bool IsKeyboardNavigationSupported()
530 return viewWrapperImpl.IsKeyboardNavigationSupported();
534 /// Sets whether this control is a focus group for keyboard navigation.
535 /// (i.e., the scope of keyboard focus movement can be limitied to its child views). The control is not a focus group by default.
537 /// <param name="isFocusGroup">Whether this control is set as a focus group for keyboard navigation.</param>
538 internal void SetAsKeyboardFocusGroup(bool isFocusGroup)
540 viewWrapperImpl.SetAsFocusGroup(isFocusGroup);
544 /// Gets whether this control is a focus group for keyboard navigation.
546 internal bool IsKeyboardFocusGroup()
548 return viewWrapperImpl.IsFocusGroup();
552 /// Called whenever a pinch gesture is detected on this control.<br />
553 /// This can be overridden by deriving classes when pinch detection is enabled. The default behavior is to scale the control by the pinch scale.<br />
554 /// If overridden, then the default behavior will not occur.<br />
555 /// Pinch detection should be enabled via EnableGestureDetection().<br />
557 /// <param name="pinch">The pinch tap gesture.</param>
558 internal virtual void OnPinch(PinchGesture pinch)
563 /// Called whenever a long press gesture is detected on this control.<br />
564 /// This should be overridden by deriving classes when long press detection is enabled.<br />
565 /// There is no default behavior associated with a long press.<br />
566 /// Long press detection should be enabled via EnableGestureDetection().<br />
568 /// <param name="longPress">The long press gesture.</param>
569 internal virtual void OnLongPress(LongPressGesture longPress)
574 /// Requests a relayout, which means performing a size negotiation on this view, its parent, and children (and potentially whole scene).<br />
575 /// This method can also be called from a derived class every time it needs a different size.<br />
576 /// At the end of event processing, the relayout process starts and all controls which requested relayout will have their sizes (re)negotiated.<br />
577 /// It can be called multiple times; the size negotiation is still only performed once, i.e., there is no need to keep track of this in the calling side.<br />
579 /// <since_tizen> 3 </since_tizen>
580 protected void RelayoutRequest()
582 viewWrapperImpl.RelayoutRequest();
586 /// Provides the view implementation of GetHeightForWidth.
588 /// <param name="width">The width to use.</param>
589 /// <returns>The height based on the width.</returns>
590 /// <since_tizen> 3 </since_tizen>
591 protected float GetHeightForWidthBase(float width)
593 return viewWrapperImpl.GetHeightForWidthBase(width);
597 /// Provides the view implementation of GetWidthForHeight.
599 /// <param name="height">The height to use.</param>
600 /// <returns>The width based on the height.</returns>
601 /// <since_tizen> 3 </since_tizen>
602 protected float GetWidthForHeightBase(float height)
604 return viewWrapperImpl.GetWidthForHeightBase(height);
608 /// Calculates the size for a child using the base view object.
610 /// <param name="child">The child view to calculate the size for.</param>
611 /// <param name="dimension">The dimension to calculate the size, for example, the width or the height.</param>
612 /// <returns>Return the calculated size for the given dimension. If more than one dimension is requested, just return the first one found.</returns>
613 /// <since_tizen> 3 </since_tizen>
614 protected float CalculateChildSizeBase(View child, DimensionType dimension)
616 return viewWrapperImpl.CalculateChildSizeBase(child, dimension);
620 /// Determines if this view is dependent on it's children for relayout from the base class.
622 /// <param name="dimension">The dimension(s) to check for.</param>
623 /// <returns>Return if the view is dependent on it's children.</returns>
624 /// <since_tizen> 3 </since_tizen>
625 protected bool RelayoutDependentOnChildrenBase(DimensionType dimension)
627 return viewWrapperImpl.RelayoutDependentOnChildrenBase(dimension);
631 /// Determines if this view is dependent on it's children for relayout from the base class.
633 /// <returns>Return if the view is dependent on it's children.</returns>
634 /// <since_tizen> 3 </since_tizen>
635 protected bool RelayoutDependentOnChildrenBase()
637 return viewWrapperImpl.RelayoutDependentOnChildrenBase();
641 /// Registers a visual by property index, linking a view to visual when required.<br />
642 /// In the case of the visual being a view or control deeming visual not required, then the visual should be an empty handle.<br />
643 /// No parenting is done during registration, this should be done by a derived class.<br />
645 /// <param name="index">The property index of the visual used to reference visual.</param>
646 /// <param name="visual">The visual to register.</param>
647 /// <since_tizen> 3 </since_tizen>
648 protected void RegisterVisual(int index, VisualBase visual)
650 viewWrapperImpl.RegisterVisual(index, visual);
654 /// Registers a visual by the property index, linking a view to visual when required.<br />
655 /// In the case of the visual being a view or control deeming visual not required, then the visual should be an empty handle.<br />
656 /// If enabled is false, then the visual is not set on the stage until enabled by the derived class.<br />
658 /// <param name="index">The property index of the visual used to reference visual.</param>
659 /// <param name="visual">The visual to register.</param>
660 /// <param name="enabled">False if derived class wants to control when the visual is set on the stage.</param>
661 /// <since_tizen> 3 </since_tizen>
662 protected void RegisterVisual(int index, VisualBase visual, bool enabled)
664 viewWrapperImpl.RegisterVisual(index, visual, enabled);
668 /// Erases the entry matching the given index from the list of registered visuals.
670 /// <param name="index">The property index of the visual used to reference visual.</param>
671 /// <since_tizen> 3 </since_tizen>
672 protected void UnregisterVisual(int index)
674 viewWrapperImpl.UnregisterVisual(index);
678 /// Retrieves the visual associated with the given property index.<br />
679 /// For managing the object lifecycle, do not store the returned visual as a member which increments its reference count.<br />
681 /// <param name="index">The property index of the visual used to reference visual.</param>
682 /// <returns>The registered visual if exists, otherwise an empty handle.</returns>
683 /// <since_tizen> 3 </since_tizen>
684 protected VisualBase GetVisual(int index)
686 return viewWrapperImpl.GetVisual(index);
690 /// Sets the given visual to be displayed or not when parent staged.<br />
691 /// For managing the object lifecycle, do not store the returned visual as a member which increments its reference count.<br />
693 /// <param name="index">The property index of the visual, used to reference visual.</param>
694 /// <param name="enable">Flag set to enabled or disabled.</param>
695 /// <since_tizen> 3 </since_tizen>
696 protected void EnableVisual(int index, bool enable)
698 viewWrapperImpl.EnableVisual(index, enable);
702 /// Queries if the given visual is to be displayed when parent staged.<br />
703 /// For managing the object lifecycle, do not store the returned visual as a member which increments its reference count.<br />
705 /// <param name="index">The property index of the visual.</param>
706 /// <returns>Whether visual is enabled or not.</returns>
707 /// <since_tizen> 3 </since_tizen>
708 protected bool IsVisualEnabled(int index)
710 return viewWrapperImpl.IsVisualEnabled(index);
714 /// Creates a transition effect on the control.
716 /// <param name="transitionData">The transition data describing the effect to create.</param>
717 /// <returns>A handle to an animation defined with the given effect, or an empty handle if no properties match.</returns>
718 /// <since_tizen> 3 </since_tizen>
719 protected Animation CreateTransition(TransitionData transitionData)
721 return viewWrapperImpl.CreateTransition(transitionData);
725 /// Emits the KeyInputFocusGained signal if true, else, emits the KeyInputFocusLost signal.<br />
726 /// Should be called last by the control after it acts on the input focus change.<br />
728 /// <param name="focusGained">True if gained, false if lost.</param>
729 /// <since_tizen> 3 </since_tizen>
730 protected void EmitFocusSignal(bool focusGained)
732 viewWrapperImpl.EmitFocusSignal(focusGained);
736 private void OnControlChildAdd(View child)
740 private void OnControlChildRemove(View child)
744 private void Initialize()
746 // Registering CustomView virtual functions to viewWrapperImpl delegates.
747 viewWrapperImpl.OnStageConnection = new ViewWrapperImpl.OnStageConnectionDelegate(OnStageConnection);
748 viewWrapperImpl.OnStageDisconnection = new ViewWrapperImpl.OnStageDisconnectionDelegate(OnStageDisconnection);
749 viewWrapperImpl.OnChildAdd = new ViewWrapperImpl.OnChildAddDelegate(OnChildAdd);
750 viewWrapperImpl.OnChildRemove = new ViewWrapperImpl.OnChildRemoveDelegate(OnChildRemove);
751 viewWrapperImpl.OnPropertySet = new ViewWrapperImpl.OnPropertySetDelegate(OnPropertySet);
752 viewWrapperImpl.OnSizeSet = new ViewWrapperImpl.OnSizeSetDelegate(OnSizeSet);
753 viewWrapperImpl.OnSizeAnimation = new ViewWrapperImpl.OnSizeAnimationDelegate(OnSizeAnimation);
754 viewWrapperImpl.OnTouch = new ViewWrapperImpl.OnTouchDelegate(OnTouch);
755 viewWrapperImpl.OnHover = new ViewWrapperImpl.OnHoverDelegate(OnHover);
756 viewWrapperImpl.OnKey = new ViewWrapperImpl.OnKeyDelegate(OnKey);
757 viewWrapperImpl.OnWheel = new ViewWrapperImpl.OnWheelDelegate(OnWheel);
758 viewWrapperImpl.OnRelayout = new ViewWrapperImpl.OnRelayoutDelegate(OnRelayout);
759 viewWrapperImpl.OnSetResizePolicy = new ViewWrapperImpl.OnSetResizePolicyDelegate(OnSetResizePolicy);
760 viewWrapperImpl.GetNaturalSize = new ViewWrapperImpl.GetNaturalSizeDelegate(GetNaturalSize);
761 viewWrapperImpl.CalculateChildSize = new ViewWrapperImpl.CalculateChildSizeDelegate(CalculateChildSize);
762 viewWrapperImpl.GetHeightForWidth = new ViewWrapperImpl.GetHeightForWidthDelegate(GetHeightForWidth);
763 viewWrapperImpl.GetWidthForHeight = new ViewWrapperImpl.GetWidthForHeightDelegate(GetWidthForHeight);
764 viewWrapperImpl.RelayoutDependentOnChildrenDimension = new ViewWrapperImpl.RelayoutDependentOnChildrenDimensionDelegate(RelayoutDependentOnChildren);
765 viewWrapperImpl.RelayoutDependentOnChildren = new ViewWrapperImpl.RelayoutDependentOnChildrenDelegate(RelayoutDependentOnChildren);
766 viewWrapperImpl.OnCalculateRelayoutSize = new ViewWrapperImpl.OnCalculateRelayoutSizeDelegate(OnCalculateRelayoutSize);
767 viewWrapperImpl.OnLayoutNegotiated = new ViewWrapperImpl.OnLayoutNegotiatedDelegate(OnLayoutNegotiated);
768 viewWrapperImpl.OnControlChildAdd = new ViewWrapperImpl.OnControlChildAddDelegate(OnControlChildAdd);
769 viewWrapperImpl.OnControlChildRemove = new ViewWrapperImpl.OnControlChildRemoveDelegate(OnControlChildRemove);
770 viewWrapperImpl.OnStyleChange = new ViewWrapperImpl.OnStyleChangeDelegate(OnStyleChange);
771 viewWrapperImpl.OnAccessibilityActivated = new ViewWrapperImpl.OnAccessibilityActivatedDelegate(OnAccessibilityActivated);
772 viewWrapperImpl.OnAccessibilityPan = new ViewWrapperImpl.OnAccessibilityPanDelegate(OnAccessibilityPan);
773 viewWrapperImpl.OnAccessibilityTouch = new ViewWrapperImpl.OnAccessibilityTouchDelegate(OnAccessibilityTouch);
774 viewWrapperImpl.OnAccessibilityValueChange = new ViewWrapperImpl.OnAccessibilityValueChangeDelegate(OnAccessibilityValueChange);
775 viewWrapperImpl.OnAccessibilityZoom = new ViewWrapperImpl.OnAccessibilityZoomDelegate(OnAccessibilityZoom);
776 viewWrapperImpl.OnFocusGained = new ViewWrapperImpl.OnFocusGainedDelegate(OnFocusGained);
777 viewWrapperImpl.OnFocusLost = new ViewWrapperImpl.OnFocusLostDelegate(OnFocusLost);
778 viewWrapperImpl.GetNextFocusableView = new ViewWrapperImpl.GetNextFocusableViewDelegate(GetNextFocusableView);
779 viewWrapperImpl.OnFocusChangeCommitted = new ViewWrapperImpl.OnFocusChangeCommittedDelegate(OnFocusChangeCommitted);
780 viewWrapperImpl.OnKeyboardEnter = new ViewWrapperImpl.OnKeyboardEnterDelegate(OnKeyboardEnter);
781 viewWrapperImpl.OnPinch = new ViewWrapperImpl.OnPinchDelegate(OnPinch);
782 viewWrapperImpl.OnPan = new ViewWrapperImpl.OnPanDelegate(OnPan);
783 viewWrapperImpl.OnTap = new ViewWrapperImpl.OnTapDelegate(OnTap);
784 viewWrapperImpl.OnLongPress = new ViewWrapperImpl.OnLongPressDelegate(OnLongPress);
786 // Make sure CustomView is initialized.
789 // Set the StyleName the name of the View
790 // We have to do this because the StyleManager on Native side can't workout it out
791 // This will also ensure that the style of views/visuals initialized above are applied by the style manager.
792 SetStyleName(this.GetType().Name);