2 * Copyright (c) 2021 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.
18 using System.ComponentModel;
19 using Tizen.NUI.Binding;
21 namespace Tizen.NUI.BaseComponents
24 /// CustomView provides some common functionality required by all views.
26 /// <since_tizen> 3 </since_tizen>
27 public class CustomView : ViewWrapper
29 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
30 [EditorBrowsable(EditorBrowsableState.Never)]
31 public static readonly BindableProperty FocusNavigationSupportProperty = BindableProperty.Create(nameof(FocusNavigationSupport), typeof(bool), typeof(CustomView), false, propertyChanged: (bindable, oldValue, newValue) =>
33 var customView = (CustomView)bindable;
36 customView.SetKeyboardNavigationSupport((bool)newValue);
39 defaultValueCreator: (bindable) =>
41 var customView = (CustomView)bindable;
42 return customView.IsKeyboardNavigationSupported();
45 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
46 [EditorBrowsable(EditorBrowsableState.Never)]
47 public static readonly BindableProperty FocusGroupProperty = BindableProperty.Create(nameof(FocusGroup), typeof(bool), typeof(CustomView), false, propertyChanged: (bindable, oldValue, newValue) =>
49 var customView = (CustomView)bindable;
52 customView.SetAsKeyboardFocusGroup((bool)newValue);
55 defaultValueCreator: (bindable) =>
57 var customView = (CustomView)bindable;
58 return customView.IsKeyboardFocusGroup();
62 /// Create an instance of customView.
64 /// <param name="typeName">typename</param>
65 /// <param name="behaviour">CustomView Behaviour</param>
66 /// <param name="viewStyle">CustomView ViewStyle</param>
67 [EditorBrowsable(EditorBrowsableState.Never)]
68 public CustomView(string typeName, CustomViewBehaviour behaviour, ViewStyle viewStyle) : this(typeName, behaviour)
70 InitializeStyle(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 CustomView has been initialized.<br />
142 /// After OnInitialize, the view will apply the style if it exists in the theme or it was given from constructor.<br />
143 /// Derived classes should do any second phase initialization by overriding this method.<br />
145 /// <since_tizen> 3 </since_tizen>
146 public virtual void OnInitialize()
148 AccessibilityRole = Role.Unknown;
152 /// Called after the view has been connected to the stage.<br />
153 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
154 /// The root view is provided automatically by Tizen.NUI.Stage, and is always considered to be connected.<br />
155 /// When the parent of a set of views is connected to the stage, then all of the children will receive this callback.<br />
157 /// <param name="depth">The depth in the hierarchy for the view.</param>
158 /// <since_tizen> 3 </since_tizen>
159 [Obsolete("This has been deprecated since API8 and will be removed in API10. Use OnSceneConnection instead.")]
160 public virtual void OnStageConnection(int depth)
165 /// Called after the view has been disconnected from the stage.<br />
166 /// If a view is disconnected, it either has no parent, or is parented to a disconnected view.<br />
167 /// 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 />
169 /// <since_tizen> 3 </since_tizen>
170 [Obsolete("This has been deprecated since API8 and will be removed in API10. Use OnSceneDisconnection instead.")]
171 public virtual void OnStageDisconnection()
176 /// Called after the view has been connected to the scene.<br />
177 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
178 /// The root view is provided automatically by Tizen.NUI.Window, and is always considered to be connected.<br />
179 /// When the parent of a set of views is connected to the scene, then all of the children will receive this callback.<br />
181 /// <param name="depth">The depth in the hierarchy for the view.</param>
182 /// <since_tizen> 8 </since_tizen>
183 public virtual void OnSceneConnection(int depth)
188 /// Called after the view has been disconnected from the scene.<br />
189 /// If a view is disconnected, it either has no parent, or is parented to a disconnected view.<br />
190 /// When the parent of a set of views is disconnected to the scene, then all of the children will receive this callback, starting with the leaf views.<br />
192 /// <since_tizen> 8 </since_tizen>
193 public virtual void OnSceneDisconnection()
198 /// Called after a child has been added to the owning view.
200 /// <param name="view">The child which has been added.</param>
201 /// <since_tizen> 3 </since_tizen>
202 public virtual void OnChildAdd(View view)
207 /// Called after the owning view has attempted to remove a child( regardless of whether it succeeded or not ).
209 /// <param name="view">The child being removed.</param>
210 /// <since_tizen> 3 </since_tizen>
211 public virtual void OnChildRemove(View view)
216 /// Called when the owning view property is set.
218 /// <param name="index">The property index that was set.</param>
219 /// <param name="propertyValue">The value to set.</param>
220 /// <since_tizen> 3 </since_tizen>
221 public virtual void OnPropertySet(int index, Tizen.NUI.PropertyValue propertyValue)
226 /// Called when the owning view's size is set, for example, using View.SetSize().
228 /// <param name="targetSize">The target size.</param>
229 /// <since_tizen> 3 </since_tizen>
230 public virtual void OnSizeSet(Vector3 targetSize)
235 /// Called when the owning view's size is animated, for example, using Animation::AnimateTo( Property ( view, View::Property::SIZE ), ... ).
237 /// <param name="animation">The object which is animating the owning view.</param>
238 /// <param name="targetSize">The target size.</param>
239 /// <since_tizen> 3 </since_tizen>
240 public virtual void OnSizeAnimation(Animation animation, Vector3 targetSize)
245 /// Called after a touch event is received by the owning view.<br />
246 /// CustomViewBehaviour.REQUIRES_TOUCH_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).<br />
248 /// <param name="touch">The touch event.</param>
249 /// <returns>True if the event should be consumed.</returns>
250 /// <since_tizen> 3 </since_tizen>
251 public virtual bool OnTouch(Touch touch)
253 return false; // Do not consume
257 /// Called after a hover event is received by the owning view.<br />
258 /// CustomViewBehaviour.REQUIRES_HOVER_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).<br />
260 /// <param name="hover">The hover event.</param>
261 /// <returns>True if the hover event should be consumed.</returns>
262 /// <since_tizen> 3 </since_tizen>
263 public virtual bool OnHover(Hover hover)
265 return false; // Do not consume
269 /// Called after a key event is received by the view that has had its focus set.
271 /// <param name="key">The key event.</param>
272 /// <returns>True if the key event should be consumed.</returns>
273 /// <since_tizen> 3 </since_tizen>
274 public virtual bool OnKey(Key key)
276 return false; // Do not consume
280 /// Called after a wheel event is received by the owning view.<br />
281 /// CustomViewBehaviour.REQUIRES_WHEEL_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).<br />
283 /// <param name="wheel">The wheel event.</param>
284 /// <returns>True if the wheel event should be consumed.</returns>
285 /// <since_tizen> 3 </since_tizen>
286 public virtual bool OnWheel(Wheel wheel)
288 return false; // Do not consume
292 /// Called after the size negotiation has been finished for this control.<br />
293 /// The control is expected to assign this given size to itself or its children.<br />
294 /// 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 />
295 /// As this function is called from inside the size negotiation algorithm, you cannot call RequestRelayout (the call would just be ignored).<br />
297 /// <param name="size">The allocated size.</param>
298 /// <param name="container">The control should add views to this container that it is not able to allocate a size for.</param>
299 /// <since_tizen> 3 </since_tizen>
300 public virtual void OnRelayout(Vector2 size, RelayoutContainer container)
305 /// Notification for deriving classes.
307 /// <param name="policy">The policy being set.</param>
308 /// <param name="dimension">The policy is being set for.</param>
309 /// <since_tizen> 3 </since_tizen>
310 public virtual void OnSetResizePolicy(ResizePolicyType policy, DimensionType dimension)
315 /// Returns the natural size of the view.
317 /// <returns>The view's natural size</returns>
318 /// <since_tizen> 3 </since_tizen>
319 [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1721: Property names should not match get methods")]
320 public new virtual Size2D GetNaturalSize()
322 return GetUserSize2D();
326 /// Calculates the size for a child.
328 /// <param name="child">The child view to calculate the size for.</param>
329 /// <param name="dimension">The dimension to calculate the size, for example, the width or the height.</param>
330 /// <returns>Return the calculated size for the given dimension. If more than one dimension is requested, just return the first one found.</returns>
331 /// <since_tizen> 3 </since_tizen>
332 public virtual float CalculateChildSize(View child, DimensionType dimension)
334 return viewWrapperImpl.CalculateChildSizeBase(child, dimension);
338 /// This method is called during size negotiation when a height is required for a given width.<br />
339 /// Derived classes should override this if they wish to customize the height returned.<br />
341 /// <param name="width">Width to use</param>
342 /// <returns>The height based on the width</returns>
343 /// <since_tizen> 3 </since_tizen>
344 [Obsolete("This has been deprecated in API9 and will be removed in API11. Use HeightForWidth property instead.")]
345 public new virtual float GetHeightForWidth(float width)
347 return viewWrapperImpl.GetHeightForWidthBase(width);
351 /// This method is called during size negotiation when a width is required for a given height.<br />
352 /// Derived classes should override this if they wish to customize the width returned.<br />
354 /// <param name="height">Height to use</param>
355 /// <returns>The width based on the width</returns>
356 /// <since_tizen> 3 </since_tizen>
357 [Obsolete("This has been deprecated since API9 and will be removed in API11. Use WidthForHeight property instead.")]
358 public new virtual float GetWidthForHeight(float height)
360 return viewWrapperImpl.GetWidthForHeightBase(height);
364 /// Determines if this view is dependent on it's children for relayout.
366 /// <param name="dimension">The dimension(s) to check for.</param>
367 /// <returns>Return if the view is dependent on it's children.</returns>
368 /// <since_tizen> 3 </since_tizen>
369 public virtual bool RelayoutDependentOnChildren(DimensionType dimension)
371 return viewWrapperImpl.RelayoutDependentOnChildrenBase(dimension);
375 /// Determines if this view is dependent on it's children for relayout from the base class.
377 /// <returns>Return true if the view is dependent on it's children.</returns>
378 /// <since_tizen> 3 </since_tizen>
379 public virtual bool RelayoutDependentOnChildren()
381 return viewWrapperImpl.RelayoutDependentOnChildrenBase();
385 /// The virtual method to notify deriving classes that relayout dependencies have been
386 /// met and the size for this object is about to be calculated for the given dimension.
388 /// <param name="dimension">The dimension that is about to be calculated.</param>
389 /// <since_tizen> 3 </since_tizen>
390 public virtual void OnCalculateRelayoutSize(DimensionType dimension)
395 /// The virtual method to notify deriving classes that the size for a dimension has just been negotiated.
397 /// <param name="size">The new size for the given dimension.</param>
398 /// <param name="dimension">The dimension that was just negotiated.</param>
399 /// <since_tizen> 3 </since_tizen>
400 public virtual void OnLayoutNegotiated(float size, DimensionType dimension)
405 /// This method should be overridden by deriving classes requiring notifications when the style changes.
407 /// <param name="styleManager">The StyleManager object.</param>
408 /// <param name="change">Information denoting what has changed.</param>
409 /// <since_tizen> 3 </since_tizen>
410 [Obsolete("Deprecated in API9, Will be removed in API11.")]
411 public virtual void OnStyleChange(StyleManager styleManager, StyleChangeType change)
416 /// 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.
418 /// <since_tizen> 3 </since_tizen>
419 public virtual void OnFocusGained()
424 /// 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.
426 /// <since_tizen> 3 </since_tizen>
427 public virtual void OnFocusLost()
432 /// Gets the next keyboard focusable view in this control towards the given direction.<br />
433 /// A control needs to override this function in order to support two dimensional keyboard navigation.<br />
435 /// <param name="currentFocusedView">The current focused view.</param>
436 /// <param name="direction">The direction to move the focus towards.</param>
437 /// <param name="loopEnabled">Whether the focus movement should be looped within the control.</param>
438 /// <returns>The next keyboard focusable view in this control or null if no view can be focused.</returns>
439 /// <since_tizen> 3 </since_tizen>
440 public virtual View GetNextFocusableView(View currentFocusedView, View.FocusDirection direction, bool loopEnabled)
446 /// Informs this control that its chosen focusable view will be focused.<br />
447 /// This allows the application to preform any actions it wishes before the focus is actually moved to the chosen view.<br />
449 /// <param name="commitedFocusableView">The commited focused view.</param>
450 /// <since_tizen> 3 </since_tizen>
451 public virtual void OnFocusChangeCommitted(View commitedFocusableView)
456 /// This method is called when the control has enter pressed on it.<br />
457 /// Derived classes should override this to perform custom actions.<br />
459 /// <returns>True if this control supported this action.</returns>
460 /// <since_tizen> 3 </since_tizen>
461 public virtual bool OnKeyboardEnter()
463 using var key = new Key();
465 key.State = Key.StateType.Down;
466 key.KeyPressedName = "Return";
472 key.State = Key.StateType.Up;
477 /// Called whenever a pan gesture is detected on this control.<br />
478 /// This should be overridden by deriving classes when pan detection is enabled.<br />
479 /// There is no default behavior with panning.<br />
480 /// Pan detection should be enabled via EnableGestureDetection().<br />
482 /// <param name="pan">The pan gesture.</param>
483 /// <since_tizen> 3 </since_tizen>
484 public virtual void OnPan(PanGesture pan)
489 /// Called whenever a tap gesture is detected on this control.<br />
490 /// This should be overridden by deriving classes when tap detection is enabled.<br />
491 /// There is no default behavior with a tap.<br />
492 /// Tap detection should be enabled via EnableGestureDetection().<br />
494 /// <param name="tap">The tap gesture.</param>
495 /// <since_tizen> 3 </since_tizen>
496 public virtual void OnTap(TapGesture tap)
501 [EditorBrowsable(EditorBrowsableState.Never)]
502 protected override bool OnAccessibilityActivated()
504 if (!base.OnAccessibilityActivated())
509 return OnKeyboardEnter();
513 /// This method should be overridden by deriving classes when they wish to respond the accessibility.
515 /// <param name="gestures">The pan gesture.</param>
516 /// <returns>True if the pan gesture has been consumed by this control.</returns>
517 internal virtual bool OnAccessibilityPan(PanGesture gestures)
523 /// 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).
525 /// <param name="isIncrease">Whether the value should be increased or decreased.</param>
526 /// <returns>True if the value changed action has been consumed by this control.</returns>
527 internal virtual bool OnAccessibilityValueChange(bool isIncrease)
533 /// This method should be overridden by deriving classes when they wish to respond the accessibility zoom action.
535 /// <returns>True if the zoom action has been consumed by this control.</returns>
536 internal virtual bool OnAccessibilityZoom()
542 /// Allows deriving classes to disable any of the gesture detectors.<br />
543 /// Like EnableGestureDetection, this can also be called using bitwise or one at a time.<br />
545 /// <param name="type">The gesture type(s) to disable.</param>
546 internal void DisableGestureDetection(Gesture.GestureType type)
548 viewWrapperImpl.DisableGestureDetection(type);
551 internal void SetKeyboardNavigationSupport(bool isSupported)
553 viewWrapperImpl.SetKeyboardNavigationSupport(isSupported);
557 /// Gets whether this control supports two-dimensional keyboard navigation.
559 /// <returns>True if this control supports two-dimensional keyboard navigation.</returns>
560 internal bool IsKeyboardNavigationSupported()
562 return viewWrapperImpl.IsKeyboardNavigationSupported();
566 /// Sets whether this control is a focus group for keyboard navigation.
567 /// (i.e., the scope of keyboard focus movement can be limitied to its child views). The control is not a focus group by default.
569 /// <param name="isFocusGroup">Whether this control is set as a focus group for keyboard navigation.</param>
570 internal void SetAsKeyboardFocusGroup(bool isFocusGroup)
572 viewWrapperImpl.SetAsFocusGroup(isFocusGroup);
576 /// Gets whether this control is a focus group for keyboard navigation.
578 internal bool IsKeyboardFocusGroup()
580 return viewWrapperImpl.IsFocusGroup();
584 /// Called whenever a pinch gesture is detected on this control.<br />
585 /// 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 />
586 /// If overridden, then the default behavior will not occur.<br />
587 /// Pinch detection should be enabled via EnableGestureDetection().<br />
589 /// <param name="pinch">The pinch tap gesture.</param>
590 internal virtual void OnPinch(PinchGesture pinch)
595 /// Called whenever a long press gesture is detected on this control.<br />
596 /// This should be overridden by deriving classes when long press detection is enabled.<br />
597 /// There is no default behavior associated with a long press.<br />
598 /// Long press detection should be enabled via EnableGestureDetection().<br />
600 /// <param name="longPress">The long press gesture.</param>
601 internal virtual void OnLongPress(LongPressGesture longPress)
606 /// Requests a relayout, which means performing a size negotiation on this view, its parent, and children (and potentially whole scene).<br />
607 /// This method can also be called from a derived class every time it needs a different size.<br />
608 /// At the end of event processing, the relayout process starts and all controls which requested relayout will have their sizes (re)negotiated.<br />
609 /// 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 />
611 /// <since_tizen> 3 </since_tizen>
612 protected void RelayoutRequest()
614 viewWrapperImpl.RelayoutRequest();
618 /// Provides the view implementation of GetHeightForWidth.
620 /// <param name="width">The width to use.</param>
621 /// <returns>The height based on the width.</returns>
622 /// <since_tizen> 3 </since_tizen>
623 protected float GetHeightForWidthBase(float width)
625 return viewWrapperImpl.GetHeightForWidthBase(width);
629 /// Provides the view implementation of GetWidthForHeight.
631 /// <param name="height">The height to use.</param>
632 /// <returns>The width based on the height.</returns>
633 /// <since_tizen> 3 </since_tizen>
634 protected float GetWidthForHeightBase(float height)
636 return viewWrapperImpl.GetWidthForHeightBase(height);
640 /// Calculates the size for a child using the base view object.
642 /// <param name="child">The child view to calculate the size for.</param>
643 /// <param name="dimension">The dimension to calculate the size, for example, the width or the height.</param>
644 /// <returns>Return the calculated size for the given dimension. If more than one dimension is requested, just return the first one found.</returns>
645 /// <since_tizen> 3 </since_tizen>
646 protected float CalculateChildSizeBase(View child, DimensionType dimension)
648 return viewWrapperImpl.CalculateChildSizeBase(child, dimension);
652 /// Determines if this view is dependent on it's children for relayout from the base class.
654 /// <param name="dimension">The dimension(s) to check for.</param>
655 /// <returns>Return if the view is dependent on it's children.</returns>
656 /// <since_tizen> 3 </since_tizen>
657 protected bool RelayoutDependentOnChildrenBase(DimensionType dimension)
659 return viewWrapperImpl.RelayoutDependentOnChildrenBase(dimension);
663 /// Determines if this view is dependent on it's children for relayout from the base class.
665 /// <returns>Return if the view is dependent on it's children.</returns>
666 /// <since_tizen> 3 </since_tizen>
667 protected bool RelayoutDependentOnChildrenBase()
669 return viewWrapperImpl.RelayoutDependentOnChildrenBase();
673 /// Registers a visual by property index, linking a view to visual when required.<br />
674 /// In the case of the visual being a view or control deeming visual not required, then the visual should be an empty handle.<br />
675 /// No parenting is done during registration, this should be done by a derived class.<br />
677 /// <param name="index">The property index of the visual used to reference visual.</param>
678 /// <param name="visual">The visual to register.</param>
679 /// <since_tizen> 3 </since_tizen>
680 protected void RegisterVisual(int index, VisualBase visual)
682 viewWrapperImpl.RegisterVisual(index, visual);
686 /// Registers a visual by the property index, linking a view to visual when required.<br />
687 /// In the case of the visual being a view or control deeming visual not required, then the visual should be an empty handle.<br />
688 /// If enabled is false, then the visual is not set on the stage until enabled by the derived class.<br />
690 /// <param name="index">The property index of the visual used to reference visual.</param>
691 /// <param name="visual">The visual to register.</param>
692 /// <param name="enabled">False if derived class wants to control when the visual is set on the stage.</param>
693 /// <since_tizen> 3 </since_tizen>
694 protected void RegisterVisual(int index, VisualBase visual, bool enabled)
696 viewWrapperImpl.RegisterVisual(index, visual, enabled);
700 /// Erases the entry matching the given index from the list of registered visuals.
702 /// <param name="index">The property index of the visual used to reference visual.</param>
703 /// <since_tizen> 3 </since_tizen>
704 protected void UnregisterVisual(int index)
706 viewWrapperImpl.UnregisterVisual(index);
710 /// Retrieves the visual associated with the given property index.<br />
711 /// For managing the object lifecycle, do not store the returned visual as a member which increments its reference count.<br />
713 /// <param name="index">The property index of the visual used to reference visual.</param>
714 /// <returns>The registered visual if exists, otherwise an empty handle.</returns>
715 /// <since_tizen> 3 </since_tizen>
716 protected VisualBase GetVisual(int index)
718 return viewWrapperImpl.GetVisual(index);
722 /// Sets the given visual to be displayed or not when parent staged.<br />
723 /// For managing the object lifecycle, do not store the returned visual as a member which increments its reference count.<br />
725 /// <param name="index">The property index of the visual, used to reference visual.</param>
726 /// <param name="enable">Flag set to enabled or disabled.</param>
727 /// <since_tizen> 3 </since_tizen>
728 protected void EnableVisual(int index, bool enable)
730 viewWrapperImpl.EnableVisual(index, enable);
734 /// Queries if the given visual is to be displayed when parent staged.<br />
735 /// For managing the object lifecycle, do not store the returned visual as a member which increments its reference count.<br />
737 /// <param name="index">The property index of the visual.</param>
738 /// <returns>Whether visual is enabled or not.</returns>
739 /// <since_tizen> 3 </since_tizen>
740 protected bool IsVisualEnabled(int index)
742 return viewWrapperImpl.IsVisualEnabled(index);
746 /// Creates a transition effect on the control.
748 /// <param name="transitionData">The transition data describing the effect to create.</param>
749 /// <returns>A handle to an animation defined with the given effect, or an empty handle if no properties match.</returns>
750 /// <since_tizen> 3 </since_tizen>
751 protected Animation CreateTransition(TransitionData transitionData)
753 return viewWrapperImpl.CreateTransition(transitionData);
757 /// Emits the KeyInputFocusGained signal if true, else, emits the KeyInputFocusLost signal.<br />
758 /// Should be called last by the control after it acts on the input focus change.<br />
760 /// <param name="focusGained">True if gained, false if lost.</param>
761 /// <since_tizen> 3 </since_tizen>
762 protected void EmitFocusSignal(bool focusGained)
764 viewWrapperImpl.EmitFocusSignal(focusGained);
767 private void Initialize()
769 // Registering CustomView virtual functions to viewWrapperImpl delegates.
770 viewWrapperImpl.OnSceneConnection = new ViewWrapperImpl.OnSceneConnectionDelegate(OnSceneConnection);
771 viewWrapperImpl.OnSceneDisconnection = new ViewWrapperImpl.OnSceneDisconnectionDelegate(OnSceneDisconnection);
772 viewWrapperImpl.OnStageConnection = new ViewWrapperImpl.OnSceneConnectionDelegate(OnStageConnection);
773 viewWrapperImpl.OnStageDisconnection = new ViewWrapperImpl.OnSceneDisconnectionDelegate(OnStageDisconnection);
774 viewWrapperImpl.OnChildAdd = new ViewWrapperImpl.OnChildAddDelegate(OnChildAdd);
775 viewWrapperImpl.OnChildRemove = new ViewWrapperImpl.OnChildRemoveDelegate(OnChildRemove);
776 viewWrapperImpl.OnPropertySet = new ViewWrapperImpl.OnPropertySetDelegate(OnPropertySet);
777 viewWrapperImpl.OnSizeSet = new ViewWrapperImpl.OnSizeSetDelegate(OnSizeSet);
778 viewWrapperImpl.OnSizeAnimation = new ViewWrapperImpl.OnSizeAnimationDelegate(OnSizeAnimation);
779 viewWrapperImpl.OnTouch = new ViewWrapperImpl.OnTouchDelegate(OnTouch);
780 viewWrapperImpl.OnHover = new ViewWrapperImpl.OnHoverDelegate(OnHover);
781 viewWrapperImpl.OnKey = new ViewWrapperImpl.OnKeyDelegate(OnKey);
782 viewWrapperImpl.OnWheel = new ViewWrapperImpl.OnWheelDelegate(OnWheel);
783 viewWrapperImpl.OnRelayout = new ViewWrapperImpl.OnRelayoutDelegate(OnRelayout);
784 viewWrapperImpl.OnSetResizePolicy = new ViewWrapperImpl.OnSetResizePolicyDelegate(OnSetResizePolicy);
785 viewWrapperImpl.GetNaturalSize = new ViewWrapperImpl.GetNaturalSizeDelegate(GetNaturalSize);
786 viewWrapperImpl.CalculateChildSize = new ViewWrapperImpl.CalculateChildSizeDelegate(CalculateChildSize);
787 viewWrapperImpl.GetHeightForWidth = new ViewWrapperImpl.GetHeightForWidthDelegate(GetHeightForWidth);
788 viewWrapperImpl.GetWidthForHeight = new ViewWrapperImpl.GetWidthForHeightDelegate(GetWidthForHeight);
789 viewWrapperImpl.RelayoutDependentOnChildrenDimension = new ViewWrapperImpl.RelayoutDependentOnChildrenDimensionDelegate(RelayoutDependentOnChildren);
790 viewWrapperImpl.RelayoutDependentOnChildren = new ViewWrapperImpl.RelayoutDependentOnChildrenDelegate(RelayoutDependentOnChildren);
791 viewWrapperImpl.OnCalculateRelayoutSize = new ViewWrapperImpl.OnCalculateRelayoutSizeDelegate(OnCalculateRelayoutSize);
792 viewWrapperImpl.OnLayoutNegotiated = new ViewWrapperImpl.OnLayoutNegotiatedDelegate(OnLayoutNegotiated);
793 viewWrapperImpl.OnStyleChange = new ViewWrapperImpl.OnStyleChangeDelegate(OnStyleChange);
794 viewWrapperImpl.OnAccessibilityActivated = new ViewWrapperImpl.OnAccessibilityActivatedDelegate(OnAccessibilityActivated);
795 viewWrapperImpl.OnAccessibilityPan = new ViewWrapperImpl.OnAccessibilityPanDelegate(OnAccessibilityPan);
796 viewWrapperImpl.OnAccessibilityValueChange = new ViewWrapperImpl.OnAccessibilityValueChangeDelegate(OnAccessibilityValueChange);
797 viewWrapperImpl.OnAccessibilityZoom = new ViewWrapperImpl.OnAccessibilityZoomDelegate(OnAccessibilityZoom);
798 viewWrapperImpl.OnFocusGained = new ViewWrapperImpl.OnFocusGainedDelegate(OnFocusGained);
799 viewWrapperImpl.OnFocusLost = new ViewWrapperImpl.OnFocusLostDelegate(OnFocusLost);
800 viewWrapperImpl.GetNextFocusableView = new ViewWrapperImpl.GetNextFocusableViewDelegate(GetNextFocusableView);
801 viewWrapperImpl.OnFocusChangeCommitted = new ViewWrapperImpl.OnFocusChangeCommittedDelegate(OnFocusChangeCommitted);
802 viewWrapperImpl.OnKeyboardEnter = new ViewWrapperImpl.OnKeyboardEnterDelegate(OnKeyboardEnter);
803 viewWrapperImpl.OnPinch = new ViewWrapperImpl.OnPinchDelegate(OnPinch);
804 viewWrapperImpl.OnPan = new ViewWrapperImpl.OnPanDelegate(OnPan);
805 viewWrapperImpl.OnTap = new ViewWrapperImpl.OnTapDelegate(OnTap);
806 viewWrapperImpl.OnLongPress = new ViewWrapperImpl.OnLongPressDelegate(OnLongPress);
808 // Set the StyleName the name of the View
809 // We have to do this because the StyleManager on Native side can't workout it out
810 // This will also ensure that the style of views/visuals initialized above are applied by the style manager.
811 SetStyleName(this.GetType().Name);