2 * Copyright (c) 2017 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 public CustomView(string typeName, CustomViewBehaviour behaviour) : base(typeName, new ViewWrapperImpl(behaviour))
68 // Registering CustomView virtual functions to viewWrapperImpl delegates.
69 viewWrapperImpl.OnStageConnection = new ViewWrapperImpl.OnStageConnectionDelegate(OnStageConnection);
70 viewWrapperImpl.OnStageDisconnection = new ViewWrapperImpl.OnStageDisconnectionDelegate(OnStageDisconnection);
71 viewWrapperImpl.OnChildAdd = new ViewWrapperImpl.OnChildAddDelegate(OnChildAdd);
72 viewWrapperImpl.OnChildRemove = new ViewWrapperImpl.OnChildRemoveDelegate(OnChildRemove);
73 viewWrapperImpl.OnPropertySet = new ViewWrapperImpl.OnPropertySetDelegate(OnPropertySet);
74 viewWrapperImpl.OnSizeSet = new ViewWrapperImpl.OnSizeSetDelegate(OnSizeSet);
75 viewWrapperImpl.OnSizeAnimation = new ViewWrapperImpl.OnSizeAnimationDelegate(OnSizeAnimation);
76 viewWrapperImpl.OnTouch = new ViewWrapperImpl.OnTouchDelegate(OnTouch);
77 viewWrapperImpl.OnHover = new ViewWrapperImpl.OnHoverDelegate(OnHover);
78 viewWrapperImpl.OnKey = new ViewWrapperImpl.OnKeyDelegate(OnKey);
79 viewWrapperImpl.OnWheel = new ViewWrapperImpl.OnWheelDelegate(OnWheel);
80 viewWrapperImpl.OnRelayout = new ViewWrapperImpl.OnRelayoutDelegate(OnRelayout);
81 viewWrapperImpl.OnSetResizePolicy = new ViewWrapperImpl.OnSetResizePolicyDelegate(OnSetResizePolicy);
82 viewWrapperImpl.GetNaturalSize = new ViewWrapperImpl.GetNaturalSizeDelegate(GetNaturalSize);
83 viewWrapperImpl.CalculateChildSize = new ViewWrapperImpl.CalculateChildSizeDelegate(CalculateChildSize);
84 viewWrapperImpl.GetHeightForWidth = new ViewWrapperImpl.GetHeightForWidthDelegate(GetHeightForWidth);
85 viewWrapperImpl.GetWidthForHeight = new ViewWrapperImpl.GetWidthForHeightDelegate(GetWidthForHeight);
86 viewWrapperImpl.RelayoutDependentOnChildrenDimension = new ViewWrapperImpl.RelayoutDependentOnChildrenDimensionDelegate(RelayoutDependentOnChildren);
87 viewWrapperImpl.RelayoutDependentOnChildren = new ViewWrapperImpl.RelayoutDependentOnChildrenDelegate(RelayoutDependentOnChildren);
88 viewWrapperImpl.OnCalculateRelayoutSize = new ViewWrapperImpl.OnCalculateRelayoutSizeDelegate(OnCalculateRelayoutSize);
89 viewWrapperImpl.OnLayoutNegotiated = new ViewWrapperImpl.OnLayoutNegotiatedDelegate(OnLayoutNegotiated);
90 viewWrapperImpl.OnControlChildAdd = new ViewWrapperImpl.OnControlChildAddDelegate(OnControlChildAdd);
91 viewWrapperImpl.OnControlChildRemove = new ViewWrapperImpl.OnControlChildRemoveDelegate(OnControlChildRemove);
92 viewWrapperImpl.OnStyleChange = new ViewWrapperImpl.OnStyleChangeDelegate(OnStyleChange);
93 viewWrapperImpl.OnAccessibilityActivated = new ViewWrapperImpl.OnAccessibilityActivatedDelegate(OnAccessibilityActivated);
94 viewWrapperImpl.OnAccessibilityPan = new ViewWrapperImpl.OnAccessibilityPanDelegate(OnAccessibilityPan);
95 viewWrapperImpl.OnAccessibilityTouch = new ViewWrapperImpl.OnAccessibilityTouchDelegate(OnAccessibilityTouch);
96 viewWrapperImpl.OnAccessibilityValueChange = new ViewWrapperImpl.OnAccessibilityValueChangeDelegate(OnAccessibilityValueChange);
97 viewWrapperImpl.OnAccessibilityZoom = new ViewWrapperImpl.OnAccessibilityZoomDelegate(OnAccessibilityZoom);
98 viewWrapperImpl.OnFocusGained = new ViewWrapperImpl.OnFocusGainedDelegate(OnFocusGained);
99 viewWrapperImpl.OnFocusLost = new ViewWrapperImpl.OnFocusLostDelegate(OnFocusLost);
100 viewWrapperImpl.GetNextFocusableView = new ViewWrapperImpl.GetNextFocusableViewDelegate(GetNextFocusableView);
101 viewWrapperImpl.OnFocusChangeCommitted = new ViewWrapperImpl.OnFocusChangeCommittedDelegate(OnFocusChangeCommitted);
102 viewWrapperImpl.OnKeyboardEnter = new ViewWrapperImpl.OnKeyboardEnterDelegate(OnKeyboardEnter);
103 viewWrapperImpl.OnPinch = new ViewWrapperImpl.OnPinchDelegate(OnPinch);
104 viewWrapperImpl.OnPan = new ViewWrapperImpl.OnPanDelegate(OnPan);
105 viewWrapperImpl.OnTap = new ViewWrapperImpl.OnTapDelegate(OnTap);
106 viewWrapperImpl.OnLongPress = new ViewWrapperImpl.OnLongPressDelegate(OnLongPress);
108 // Make sure CustomView is initialized.
111 // Set the StyleName the name of the View
112 // We have to do this because the StyleManager on Native side can't workout it out
113 // This will also ensure that the style of views/visuals initialized above are applied by the style manager.
114 SetStyleName(this.GetType().Name);
118 /// Sets whether this control supports two dimensional keyboard navigation
119 /// (i.e., whether it knows how to handle the keyboard focus movement between its child views).<br />
120 /// The control doesn't support it by default.<br />
122 /// <since_tizen> 3 </since_tizen>
123 public bool FocusNavigationSupport
127 return (bool)GetValue(FocusNavigationSupportProperty);
131 SetValue(FocusNavigationSupportProperty, value);
136 /// Sets or gets whether this control is a focus group for keyboard navigation.
138 /// <returns>True if this control is set as a focus group for keyboard navigation.</returns>
139 /// <since_tizen> 3 </since_tizen>
140 public bool FocusGroup
144 return (bool)GetValue(FocusGroupProperty);
148 SetValue(FocusGroupProperty, value);
153 /// Sets the background with a property map.
155 /// <param name="map">The background property map.</param>
156 /// <since_tizen> 3 </since_tizen>
157 public void SetBackground(Tizen.NUI.PropertyMap map)
159 viewWrapperImpl.SetBackground(map);
163 /// Allows deriving classes to enable any of the gesture detectors that are available.<br />
164 /// Gesture detection can be enabled one at a time or in a bitwise format.<br />
166 /// <param name="type">The gesture type(s) to enable.</param>
167 /// <since_tizen> 3 </since_tizen>
168 public void EnableGestureDetection(Gesture.GestureType type)
170 viewWrapperImpl.EnableGestureDetection(type);
174 /// This method is called after the control has been initialized.<br />
175 /// Derived classes should do any second phase initialization by overriding this method.<br />
177 /// <since_tizen> 3 </since_tizen>
178 public virtual void OnInitialize()
183 /// Called after the view has been connected to the stage.<br />
184 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
185 /// The root view is provided automatically by Tizen.NUI.Stage, and is always considered to be connected.<br />
186 /// When the parent of a set of views is connected to the stage, then all of the children will receive this callback.<br />
188 /// <param name="depth">The depth in the hierarchy for the view.</param>
189 /// <since_tizen> 3 </since_tizen>
190 public virtual void OnStageConnection(int depth)
195 /// Called after the view has been disconnected from the stage.<br />
196 /// If a view is disconnected, it either has no parent, or is parented to a disconnected view.<br />
197 /// 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 />
199 /// <since_tizen> 3 </since_tizen>
200 public virtual void OnStageDisconnection()
205 /// Called after a child has been added to the owning view.
207 /// <param name="view">The child which has been added.</param>
208 /// <since_tizen> 3 </since_tizen>
209 public virtual void OnChildAdd(View view)
214 /// Called after the owning view has attempted to remove a child( regardless of whether it succeeded or not ).
216 /// <param name="view">The child being removed.</param>
217 /// <since_tizen> 3 </since_tizen>
218 public virtual void OnChildRemove(View view)
223 /// Called when the owning view property is set.
225 /// <param name="index">The property index that was set.</param>
226 /// <param name="propertyValue">The value to set.</param>
227 /// <since_tizen> 3 </since_tizen>
228 public virtual void OnPropertySet(int index, Tizen.NUI.PropertyValue propertyValue)
233 /// Called when the owning view's size is set, for example, using View.SetSize().
235 /// <param name="targetSize">The target size.</param>
236 /// <since_tizen> 3 </since_tizen>
237 public virtual void OnSizeSet(Vector3 targetSize)
242 /// Called when the owning view's size is animated, for example, using Animation::AnimateTo( Property ( view, View::Property::SIZE ), ... ).
244 /// <param name="animation">The object which is animating the owning view.</param>
245 /// <param name="targetSize">The target size.</param>
246 /// <since_tizen> 3 </since_tizen>
247 public virtual void OnSizeAnimation(Animation animation, Vector3 targetSize)
252 /// Called after a touch event is received by the owning view.<br />
253 /// CustomViewBehaviour.REQUIRES_TOUCH_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).<br />
255 /// <param name="touch">The touch event.</param>
256 /// <returns>True if the event should be consumed.</returns>
257 /// <since_tizen> 3 </since_tizen>
258 public virtual bool OnTouch(Touch touch)
260 return false; // Do not consume
264 /// Called after a hover event is received by the owning view.<br />
265 /// CustomViewBehaviour.REQUIRES_HOVER_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).<br />
267 /// <param name="hover">The hover event.</param>
268 /// <returns>True if the hover event should be consumed.</returns>
269 /// <since_tizen> 3 </since_tizen>
270 public virtual bool OnHover(Hover hover)
272 return false; // Do not consume
276 /// Called after a key event is received by the view that has had its focus set.
278 /// <param name="key">The key event.</param>
279 /// <returns>True if the key event should be consumed.</returns>
280 /// <since_tizen> 3 </since_tizen>
281 public virtual bool OnKey(Key key)
283 return false; // Do not consume
287 /// Called after a wheel event is received by the owning view.<br />
288 /// CustomViewBehaviour.REQUIRES_WHEEL_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).<br />
290 /// <param name="wheel">The wheel event.</param>
291 /// <returns>True if the wheel event should be consumed.</returns>
292 /// <since_tizen> 3 </since_tizen>
293 public virtual bool OnWheel(Wheel wheel)
295 return false; // Do not consume
299 /// Called after the size negotiation has been finished for this control.<br />
300 /// The control is expected to assign this given size to itself or its children.<br />
301 /// 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 />
302 /// As this function is called from inside the size negotiation algorithm, you cannot call RequestRelayout (the call would just be ignored).<br />
304 /// <param name="size">The allocated size.</param>
305 /// <param name="container">The control should add views to this container that it is not able to allocate a size for.</param>
306 /// <since_tizen> 3 </since_tizen>
307 public virtual void OnRelayout(Vector2 size, RelayoutContainer container)
312 /// Notification for deriving classes.
314 /// <param name="policy">The policy being set.</param>
315 /// <param name="dimension">The policy is being set for.</param>
316 /// <since_tizen> 3 </since_tizen>
317 public virtual void OnSetResizePolicy(ResizePolicyType policy, DimensionType dimension)
322 /// Returns the natural size of the view.
324 /// <returns>The view's natural size</returns>
325 /// <since_tizen> 3 </since_tizen>
326 public new virtual Size2D GetNaturalSize()
328 return new Size2D(0, 0);
332 /// Calculates the size for a child.
334 /// <param name="child">The child view to calculate the size for.</param>
335 /// <param name="dimension">The dimension to calculate the size, for example, the width or the height.</param>
336 /// <returns>Return the calculated size for the given dimension. If more than one dimension is requested, just return the first one found.</returns>
337 /// <since_tizen> 3 </since_tizen>
338 public virtual float CalculateChildSize(View child, DimensionType dimension)
340 return viewWrapperImpl.CalculateChildSizeBase(child, dimension);
344 /// This method is called during size negotiation when a height is required for a given width.<br />
345 /// Derived classes should override this if they wish to customize the height returned.<br />
347 /// <param name="width">Width to use</param>
348 /// <returns>The height based on the width</returns>
349 /// <since_tizen> 3 </since_tizen>
350 public new virtual float GetHeightForWidth(float width)
352 return viewWrapperImpl.GetHeightForWidthBase(width);
356 /// This method is called during size negotiation when a width is required for a given height.<br />
357 /// Derived classes should override this if they wish to customize the width returned.<br />
359 /// <param name="height">Height to use</param>
360 /// <returns>The width based on the width</returns>
361 /// <since_tizen> 3 </since_tizen>
362 public new virtual float GetWidthForHeight(float height)
364 return viewWrapperImpl.GetWidthForHeightBase(height);
368 /// Determines if this view is dependent on it's children for relayout.
370 /// <param name="dimension">The dimension(s) to check for.</param>
371 /// <returns>Return if the view is dependent on it's children.</returns>
372 /// <since_tizen> 3 </since_tizen>
373 public virtual bool RelayoutDependentOnChildren(DimensionType dimension)
375 return viewWrapperImpl.RelayoutDependentOnChildrenBase(dimension);
379 /// Determines if this view is dependent on it's children for relayout from the base class.
381 /// <returns>Return true if the view is dependent on it's children.</returns>
382 /// <since_tizen> 3 </since_tizen>
383 public virtual bool RelayoutDependentOnChildren()
385 return viewWrapperImpl.RelayoutDependentOnChildrenBase();
389 /// The virtual method to notify deriving classes that relayout dependencies have been
390 /// met and the size for this object is about to be calculated for the given dimension.
392 /// <param name="dimension">The dimension that is about to be calculated.</param>
393 /// <since_tizen> 3 </since_tizen>
394 public virtual void OnCalculateRelayoutSize(DimensionType dimension)
399 /// The virtual method to notify deriving classes that the size for a dimension has just been negotiated.
401 /// <param name="size">The new size for the given dimension.</param>
402 /// <param name="dimension">The dimension that was just negotiated.</param>
403 /// <since_tizen> 3 </since_tizen>
404 public virtual void OnLayoutNegotiated(float size, DimensionType dimension)
409 /// This method should be overridden by deriving classes requiring notifications when the style changes.
411 /// <param name="styleManager">The StyleManager object.</param>
412 /// <param name="change">Information denoting what has changed.</param>
413 /// <since_tizen> 3 </since_tizen>
414 public virtual void OnStyleChange(StyleManager styleManager, StyleChangeType change)
419 /// 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.
421 /// <since_tizen> 3 </since_tizen>
422 public virtual void OnFocusGained()
427 /// 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.
429 /// <since_tizen> 3 </since_tizen>
430 public virtual void OnFocusLost()
435 /// Gets the next keyboard focusable view in this control towards the given direction.<br />
436 /// A control needs to override this function in order to support two dimensional keyboard navigation.<br />
438 /// <param name="currentFocusedView">The current focused view.</param>
439 /// <param name="direction">The direction to move the focus towards.</param>
440 /// <param name="loopEnabled">Whether the focus movement should be looped within the control.</param>
441 /// <returns>The next keyboard focusable view in this control or an empty handle if no view can be focused.</returns>
442 /// <since_tizen> 3 </since_tizen>
443 public virtual View GetNextFocusableView(View currentFocusedView, View.FocusDirection direction, bool loopEnabled)
449 /// Informs this control that its chosen focusable view will be focused.<br />
450 /// This allows the application to preform any actions it wishes before the focus is actually moved to the chosen view.<br />
452 /// <param name="commitedFocusableView">The commited focused view.</param>
453 /// <since_tizen> 3 </since_tizen>
454 public virtual void OnFocusChangeCommitted(View commitedFocusableView)
459 /// This method is called when the control has enter pressed on it.<br />
460 /// Derived classes should override this to perform custom actions.<br />
462 /// <returns>True if this control supported this action.</returns>
463 /// <since_tizen> 3 </since_tizen>
464 public virtual bool OnKeyboardEnter()
470 /// Called whenever a pan gesture is detected on this control.<br />
471 /// This should be overridden by deriving classes when pan detection is enabled.<br />
472 /// There is no default behavior with panning.<br />
473 /// Pan detection should be enabled via EnableGestureDetection().<br />
475 /// <param name="pan">The pan gesture.</param>
476 /// <since_tizen> 3 </since_tizen>
477 public virtual void OnPan(PanGesture pan)
482 /// Called whenever a tap gesture is detected on this control.<br />
483 /// This should be overridden by deriving classes when tap detection is enabled.<br />
484 /// There is no default behavior with a tap.<br />
485 /// Tap detection should be enabled via EnableGestureDetection().<br />
487 /// <param name="tap">The tap gesture.</param>
488 /// <since_tizen> 3 </since_tizen>
489 public virtual void OnTap(TapGesture tap)
494 /// This method is called when the control accessibility is activated.<br />
495 /// Derived classes should override this to perform custom accessibility activation.<br />
497 /// <returns>True if this control can perform accessibility activation.</returns>
498 internal virtual bool OnAccessibilityActivated()
504 /// This method should be overridden by deriving classes when they wish to respond the accessibility.
506 /// <param name="gestures">The pan gesture.</param>
507 /// <returns>True if the pan gesture has been consumed by this control.</returns>
508 internal virtual bool OnAccessibilityPan(PanGesture gestures)
514 /// This method should be overridden by deriving classes when they wish to respond the accessibility.
516 /// <param name="touch">The touch gesture.</param>
517 /// <returns>True if the touch event has been consumed by this control.</returns>
518 internal virtual bool OnAccessibilityTouch(Touch touch)
524 /// 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).
526 /// <param name="isIncrease">Whether the value should be increased or decreased.</param>
527 /// <returns>True if the value changed action has been consumed by this control.</returns>
528 internal virtual bool OnAccessibilityValueChange(bool isIncrease)
534 /// This method should be overridden by deriving classes when they wish to respond the accessibility zoom action.
536 /// <returns>True if the zoom action has been consumed by this control.</returns>
537 internal virtual bool OnAccessibilityZoom()
543 /// Allows deriving classes to disable any of the gesture detectors.<br />
544 /// Like EnableGestureDetection, this can also be called using bitwise or one at a time.<br />
546 /// <param name="type">The gesture type(s) to disable.</param>
547 internal void DisableGestureDetection(Gesture.GestureType type)
549 viewWrapperImpl.DisableGestureDetection(type);
552 internal void SetKeyboardNavigationSupport(bool isSupported)
554 viewWrapperImpl.SetKeyboardNavigationSupport(isSupported);
558 /// Gets whether this control supports two-dimensional keyboard navigation.
560 /// <returns>True if this control supports two-dimensional keyboard navigation.</returns>
561 internal bool IsKeyboardNavigationSupported()
563 return viewWrapperImpl.IsKeyboardNavigationSupported();
567 /// Sets whether this control is a focus group for keyboard navigation.
568 /// (i.e., the scope of keyboard focus movement can be limitied to its child views). The control is not a focus group by default.
570 /// <param name="isFocusGroup">Whether this control is set as a focus group for keyboard navigation.</param>
571 internal void SetAsKeyboardFocusGroup(bool isFocusGroup)
573 viewWrapperImpl.SetAsFocusGroup(isFocusGroup);
577 /// Gets whether this control is a focus group for keyboard navigation.
579 internal bool IsKeyboardFocusGroup()
581 return viewWrapperImpl.IsFocusGroup();
585 /// Called whenever a pinch gesture is detected on this control.<br />
586 /// 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 />
587 /// If overridden, then the default behavior will not occur.<br />
588 /// Pinch detection should be enabled via EnableGestureDetection().<br />
590 /// <param name="pinch">The pinch tap gesture.</param>
591 internal virtual void OnPinch(PinchGesture pinch)
596 /// Called whenever a long press gesture is detected on this control.<br />
597 /// This should be overridden by deriving classes when long press detection is enabled.<br />
598 /// There is no default behavior associated with a long press.<br />
599 /// Long press detection should be enabled via EnableGestureDetection().<br />
601 /// <param name="longPress">The long press gesture.</param>
602 internal virtual void OnLongPress(LongPressGesture longPress)
607 /// Requests a relayout, which means performing a size negotiation on this view, its parent, and children (and potentially whole scene).<br />
608 /// This method can also be called from a derived class every time it needs a different size.<br />
609 /// At the end of event processing, the relayout process starts and all controls which requested relayout will have their sizes (re)negotiated.<br />
610 /// 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 />
612 /// <since_tizen> 3 </since_tizen>
613 protected void RelayoutRequest()
615 viewWrapperImpl.RelayoutRequest();
619 /// Provides the view implementation of GetHeightForWidth.
621 /// <param name="width">The width to use.</param>
622 /// <returns>The height based on the width.</returns>
623 /// <since_tizen> 3 </since_tizen>
624 protected float GetHeightForWidthBase(float width)
626 return viewWrapperImpl.GetHeightForWidthBase(width);
630 /// Provides the view implementation of GetWidthForHeight.
632 /// <param name="height">The height to use.</param>
633 /// <returns>The width based on the height.</returns>
634 /// <since_tizen> 3 </since_tizen>
635 protected float GetWidthForHeightBase(float height)
637 return viewWrapperImpl.GetWidthForHeightBase(height);
641 /// Calculates the size for a child using the base view object.
643 /// <param name="child">The child view to calculate the size for.</param>
644 /// <param name="dimension">The dimension to calculate the size, for example, the width or the height.</param>
645 /// <returns>Return the calculated size for the given dimension. If more than one dimension is requested, just return the first one found.</returns>
646 /// <since_tizen> 3 </since_tizen>
647 protected float CalculateChildSizeBase(View child, DimensionType dimension)
649 return viewWrapperImpl.CalculateChildSizeBase(child, dimension);
653 /// Determines if this view is dependent on it's children for relayout from the base class.
655 /// <param name="dimension">The dimension(s) to check for.</param>
656 /// <returns>Return if the view is dependent on it's children.</returns>
657 /// <since_tizen> 3 </since_tizen>
658 protected bool RelayoutDependentOnChildrenBase(DimensionType dimension)
660 return viewWrapperImpl.RelayoutDependentOnChildrenBase(dimension);
664 /// Determines if this view is dependent on it's children for relayout from the base class.
666 /// <returns>Return if the view is dependent on it's children.</returns>
667 /// <since_tizen> 3 </since_tizen>
668 protected bool RelayoutDependentOnChildrenBase()
670 return viewWrapperImpl.RelayoutDependentOnChildrenBase();
674 /// Registers a visual by property index, linking a view to visual when required.<br />
675 /// In the case of the visual being a view or control deeming visual not required, then the visual should be an empty handle.<br />
676 /// No parenting is done during registration, this should be done by a derived class.<br />
678 /// <param name="index">The property index of the visual used to reference visual.</param>
679 /// <param name="visual">The visual to register.</param>
680 /// <since_tizen> 3 </since_tizen>
681 protected void RegisterVisual(int index, VisualBase visual)
683 viewWrapperImpl.RegisterVisual(index, visual);
687 /// Registers a visual by the property index, linking a view to visual when required.<br />
688 /// In the case of the visual being a view or control deeming visual not required, then the visual should be an empty handle.<br />
689 /// If enabled is false, then the visual is not set on the stage until enabled by the derived class.<br />
691 /// <param name="index">The property index of the visual used to reference visual.</param>
692 /// <param name="visual">The visual to register.</param>
693 /// <param name="enabled">False if derived class wants to control when the visual is set on the stage.</param>
694 /// <since_tizen> 3 </since_tizen>
695 protected void RegisterVisual(int index, VisualBase visual, bool enabled)
697 viewWrapperImpl.RegisterVisual(index, visual, enabled);
701 /// Erases the entry matching the given index from the list of registered visuals.
703 /// <param name="index">The property index of the visual used to reference visual.</param>
704 /// <since_tizen> 3 </since_tizen>
705 protected void UnregisterVisual(int index)
707 viewWrapperImpl.UnregisterVisual(index);
711 /// Retrieves the visual associated with the given property index.<br />
712 /// For managing the object lifecycle, do not store the returned visual as a member which increments its reference count.<br />
714 /// <param name="index">The property index of the visual used to reference visual.</param>
715 /// <returns>The registered visual if exists, otherwise an empty handle.</returns>
716 /// <since_tizen> 3 </since_tizen>
717 protected VisualBase GetVisual(int index)
719 return viewWrapperImpl.GetVisual(index);
723 /// Sets the given visual to be displayed or not when parent staged.<br />
724 /// For managing the object lifecycle, do not store the returned visual as a member which increments its reference count.<br />
726 /// <param name="index">The property index of the visual, used to reference visual.</param>
727 /// <param name="enable">Flag set to enabled or disabled.</param>
728 /// <since_tizen> 3 </since_tizen>
729 protected void EnableVisual(int index, bool enable)
731 viewWrapperImpl.EnableVisual(index, enable);
735 /// Queries if the given visual is to be displayed when parent staged.<br />
736 /// For managing the object lifecycle, do not store the returned visual as a member which increments its reference count.<br />
738 /// <param name="index">The property index of the visual.</param>
739 /// <returns>Whether visual is enabled or not.</returns>
740 /// <since_tizen> 3 </since_tizen>
741 protected bool IsVisualEnabled(int index)
743 return viewWrapperImpl.IsVisualEnabled(index);
747 /// Creates a transition effect on the control.
749 /// <param name="transitionData">The transition data describing the effect to create.</param>
750 /// <returns>A handle to an animation defined with the given effect, or an empty handle if no properties match.</returns>
751 /// <since_tizen> 3 </since_tizen>
752 protected Animation CreateTransition(TransitionData transitionData)
754 return viewWrapperImpl.CreateTransition(transitionData);
758 /// Emits the KeyInputFocusGained signal if true, else, emits the KeyInputFocusLost signal.<br />
759 /// Should be called last by the control after it acts on the input focus change.<br />
761 /// <param name="focusGained">True if gained, false if lost.</param>
762 /// <since_tizen> 3 </since_tizen>
763 protected void EmitFocusSignal(bool focusGained)
765 viewWrapperImpl.EmitFocusSignal(focusGained);
769 private void OnControlChildAdd(View child)
773 private void OnControlChildRemove(View child)