[NUI] Integreation from dalihub (#988)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / CustomView.cs
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17 using System.ComponentModel;
18 using Tizen.NUI.Binding;
19
20 namespace Tizen.NUI.BaseComponents
21 {
22     /// <summary>
23     /// CustomView provides some common functionality required by all views.
24     /// </summary>
25     /// <since_tizen> 3 </since_tizen>
26     public class CustomView : ViewWrapper
27     {
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) =>
31         {
32             var customView = (CustomView)bindable;
33             if (newValue != null)
34             {
35                 customView.SetKeyboardNavigationSupport((bool)newValue);
36             }
37         },
38         defaultValueCreator: (bindable) =>
39         {
40             var customView = (CustomView)bindable;
41             return customView.IsKeyboardNavigationSupported();
42         });
43
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) =>
47         {
48             var customView = (CustomView)bindable;
49             if (newValue != null)
50             {
51                 customView.SetAsKeyboardFocusGroup((bool)newValue);
52             }
53         },
54         defaultValueCreator: (bindable) =>
55         {
56             var customView = (CustomView)bindable;
57             return customView.IsKeyboardFocusGroup();
58         });
59
60         /// <summary>
61         /// Create an instance of customView.
62         /// </summary>
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))
67         {
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);
107
108             // Make sure CustomView is initialized.
109             OnInitialize();
110
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);
115         }
116
117         /// <summary>
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 />
121         /// </summary>
122         /// <since_tizen> 3 </since_tizen>
123         public bool FocusNavigationSupport
124         {
125             get
126             {
127                 return (bool)GetValue(FocusNavigationSupportProperty);
128             }
129             set
130             {
131                 SetValue(FocusNavigationSupportProperty, value);
132             }
133         }
134
135         /// <summary>
136         /// Sets or gets whether this control is a focus group for keyboard navigation.
137         /// </summary>
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
141         {
142             get
143             {
144                 return (bool)GetValue(FocusGroupProperty);
145             }
146             set
147             {
148                 SetValue(FocusGroupProperty, value);
149             }
150         }
151
152         /// <summary>
153         /// Sets the background with a property map.
154         /// </summary>
155         /// <param name="map">The background property map.</param>
156         /// <since_tizen> 3 </since_tizen>
157         public void SetBackground(Tizen.NUI.PropertyMap map)
158         {
159             viewWrapperImpl.SetBackground(map);
160         }
161
162         /// <summary>
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 />
165         /// </summary>
166         /// <param name="type">The gesture type(s) to enable.</param>
167         /// <since_tizen> 3 </since_tizen>
168         public void EnableGestureDetection(Gesture.GestureType type)
169         {
170             viewWrapperImpl.EnableGestureDetection(type);
171         }
172
173         /// <summary>
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 />
176         /// </summary>
177         /// <since_tizen> 3 </since_tizen>
178         public virtual void OnInitialize()
179         {
180         }
181
182         /// <summary>
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 />
187         /// </summary>
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)
191         {
192         }
193
194         /// <summary>
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 />
198         /// </summary>
199         /// <since_tizen> 3 </since_tizen>
200         public virtual void OnStageDisconnection()
201         {
202         }
203
204         /// <summary>
205         /// Called after a child has been added to the owning view.
206         /// </summary>
207         /// <param name="view">The child which has been added.</param>
208         /// <since_tizen> 3 </since_tizen>
209         public virtual void OnChildAdd(View view)
210         {
211         }
212
213         /// <summary>
214         /// Called after the owning view has attempted to remove a child( regardless of whether it succeeded or not ).
215         /// </summary>
216         /// <param name="view">The child being removed.</param>
217         /// <since_tizen> 3 </since_tizen>
218         public virtual void OnChildRemove(View view)
219         {
220         }
221
222         /// <summary>
223         /// Called when the owning view property is set.
224         /// </summary>
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)
229         {
230         }
231
232         /// <summary>
233         /// Called when the owning view's size is set, for example, using View.SetSize().
234         /// </summary>
235         /// <param name="targetSize">The target size.</param>
236         /// <since_tizen> 3 </since_tizen>
237         public virtual void OnSizeSet(Vector3 targetSize)
238         {
239         }
240
241         /// <summary>
242         /// Called when the owning view's size is animated, for example, using Animation::AnimateTo( Property ( view, View::Property::SIZE ), ... ).
243         /// </summary>
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)
248         {
249         }
250
251         /// <summary>
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 />
254         /// </summary>
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)
259         {
260             return false; // Do not consume
261         }
262
263         /// <summary>
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 />
266         /// </summary>
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)
271         {
272             return false; // Do not consume
273         }
274
275         /// <summary>
276         /// Called after a key event is received by the view that has had its focus set.
277         /// </summary>
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)
282         {
283             return false; // Do not consume
284         }
285
286         /// <summary>
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 />
289         /// </summary>
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)
294         {
295             return false; // Do not consume
296         }
297
298         /// <summary>
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 />
303         /// </summary>
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)
308         {
309         }
310
311         /// <summary>
312         /// Notification for deriving classes.
313         /// </summary>
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)
318         {
319         }
320
321         /// <summary>
322         /// Returns the natural size of the view.
323         /// </summary>
324         /// <returns>The view's natural size</returns>
325         /// <since_tizen> 3 </since_tizen>
326         public new virtual Size2D GetNaturalSize()
327         {
328             return new Size2D(0, 0);
329         }
330
331         /// <summary>
332         /// Calculates the size for a child.
333         /// </summary>
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)
339         {
340             return viewWrapperImpl.CalculateChildSizeBase(child, dimension);
341         }
342
343         /// <summary>
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 />
346         /// </summary>
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)
351         {
352             return viewWrapperImpl.GetHeightForWidthBase(width);
353         }
354
355         /// <summary>
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 />
358         /// </summary>
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)
363         {
364             return viewWrapperImpl.GetWidthForHeightBase(height);
365         }
366
367         /// <summary>
368         /// Determines if this view is dependent on it's children for relayout.
369         /// </summary>
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)
374         {
375             return viewWrapperImpl.RelayoutDependentOnChildrenBase(dimension);
376         }
377
378         /// <summary>
379         /// Determines if this view is dependent on it's children for relayout from the base class.
380         /// </summary>
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()
384         {
385             return viewWrapperImpl.RelayoutDependentOnChildrenBase();
386         }
387
388         /// <summary>
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.
391         /// </summary>
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)
395         {
396         }
397
398         /// <summary>
399         /// The virtual method to notify deriving classes that the size for a dimension has just been negotiated.
400         /// </summary>
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)
405         {
406         }
407
408         /// <summary>
409         /// This method should be overridden by deriving classes requiring notifications when the style changes.
410         /// </summary>
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)
415         {
416         }
417
418         /// <summary>
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.
420         /// </summary>
421         /// <since_tizen> 3 </since_tizen>
422         public virtual void OnFocusGained()
423         {
424         }
425
426         /// <summary>
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.
428         /// </summary>
429         /// <since_tizen> 3 </since_tizen>
430         public virtual void OnFocusLost()
431         {
432         }
433
434         /// <summary>
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 />
437         /// </summary>
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)
444         {
445             return new View();
446         }
447
448         /// <summary>
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 />
451         /// </summary>
452         /// <param name="commitedFocusableView">The commited focused view.</param>
453         /// <since_tizen> 3 </since_tizen>
454         public virtual void OnFocusChangeCommitted(View commitedFocusableView)
455         {
456         }
457
458         /// <summary>
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 />
461         /// </summary>
462         /// <returns>True if this control supported this action.</returns>
463         /// <since_tizen> 3 </since_tizen>
464         public virtual bool OnKeyboardEnter()
465         {
466             return false;
467         }
468
469         /// <summary>
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 />
474         /// </summary>
475         /// <param name="pan">The pan gesture.</param>
476         /// <since_tizen> 3 </since_tizen>
477         public virtual void OnPan(PanGesture pan)
478         {
479         }
480
481         /// <summary>
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 />
486         /// </summary>
487         /// <param name="tap">The tap gesture.</param>
488         /// <since_tizen> 3 </since_tizen>
489         public virtual void OnTap(TapGesture tap)
490         {
491         }
492
493         /// <summary>
494         /// This method is called when the control accessibility is activated.<br />
495         /// Derived classes should override this to perform custom accessibility activation.<br />
496         /// </summary>
497         /// <returns>True if this control can perform accessibility activation.</returns>
498         internal virtual bool OnAccessibilityActivated()
499         {
500             return false;
501         }
502
503         /// <summary>
504         /// This method should be overridden by deriving classes when they wish to respond the accessibility.
505         /// </summary>
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)
509         {
510             return false;
511         }
512
513         /// <summary>
514         /// This method should be overridden by deriving classes when they wish to respond the accessibility.
515         /// </summary>
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)
519         {
520             return false;
521         }
522
523         /// <summary>
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).
525         /// </summary>
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)
529         {
530             return false;
531         }
532
533         /// <summary>
534         /// This method should be overridden by deriving classes when they wish to respond the accessibility zoom action.
535         /// </summary>
536         /// <returns>True if the zoom action has been consumed by this control.</returns>
537         internal virtual bool OnAccessibilityZoom()
538         {
539             return false;
540         }
541
542         /// <summary>
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 />
545         /// </summary>
546         /// <param name="type">The gesture type(s) to disable.</param>
547         internal void DisableGestureDetection(Gesture.GestureType type)
548         {
549             viewWrapperImpl.DisableGestureDetection(type);
550         }
551
552         internal void SetKeyboardNavigationSupport(bool isSupported)
553         {
554             viewWrapperImpl.SetKeyboardNavigationSupport(isSupported);
555         }
556
557         /// <summary>
558         /// Gets whether this control supports two-dimensional keyboard navigation.
559         /// </summary>
560         /// <returns>True if this control supports two-dimensional keyboard navigation.</returns>
561         internal bool IsKeyboardNavigationSupported()
562         {
563             return viewWrapperImpl.IsKeyboardNavigationSupported();
564         }
565
566         /// <summary>
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.
569         /// </summary>
570         /// <param name="isFocusGroup">Whether this control is set as a focus group for keyboard navigation.</param>
571         internal void SetAsKeyboardFocusGroup(bool isFocusGroup)
572         {
573             viewWrapperImpl.SetAsFocusGroup(isFocusGroup);
574         }
575
576         /// <summary>
577         /// Gets whether this control is a focus group for keyboard navigation.
578         /// </summary>
579         internal bool IsKeyboardFocusGroup()
580         {
581             return viewWrapperImpl.IsFocusGroup();
582         }
583
584         /// <summary>
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 />
589         /// </summary>
590         /// <param name="pinch">The pinch tap gesture.</param>
591         internal virtual void OnPinch(PinchGesture pinch)
592         {
593         }
594
595         /// <summary>
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 />
600         /// </summary>
601         /// <param name="longPress">The long press gesture.</param>
602         internal virtual void OnLongPress(LongPressGesture longPress)
603         {
604         }
605
606         /// <summary>
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 />
611         /// </summary>
612         /// <since_tizen> 3 </since_tizen>
613         protected void RelayoutRequest()
614         {
615             viewWrapperImpl.RelayoutRequest();
616         }
617
618         /// <summary>
619         /// Provides the view implementation of GetHeightForWidth.
620         /// </summary>
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)
625         {
626             return viewWrapperImpl.GetHeightForWidthBase(width);
627         }
628
629         /// <summary>
630         /// Provides the view implementation of GetWidthForHeight.
631         /// </summary>
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)
636         {
637             return viewWrapperImpl.GetWidthForHeightBase(height);
638         }
639
640         /// <summary>
641         /// Calculates the size for a child using the base view object.
642         /// </summary>
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)
648         {
649             return viewWrapperImpl.CalculateChildSizeBase(child, dimension);
650         }
651
652         /// <summary>
653         /// Determines if this view is dependent on it's children for relayout from the base class.
654         /// </summary>
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)
659         {
660             return viewWrapperImpl.RelayoutDependentOnChildrenBase(dimension);
661         }
662
663         /// <summary>
664         /// Determines if this view is dependent on it's children for relayout from the base class.
665         /// </summary>
666         /// <returns>Return if the view is dependent on it's children.</returns>
667         /// <since_tizen> 3 </since_tizen>
668         protected bool RelayoutDependentOnChildrenBase()
669         {
670             return viewWrapperImpl.RelayoutDependentOnChildrenBase();
671         }
672
673         /// <summary>
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 />
677         /// </summary>
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)
682         {
683             viewWrapperImpl.RegisterVisual(index, visual);
684         }
685
686         /// <summary>
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 />
690         /// </summary>
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)
696         {
697             viewWrapperImpl.RegisterVisual(index, visual, enabled);
698         }
699
700         /// <summary>
701         /// Erases the entry matching the given index from the list of registered visuals.
702         /// </summary>
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)
706         {
707             viewWrapperImpl.UnregisterVisual(index);
708         }
709
710         /// <summary>
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 />
713         /// </summary>
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)
718         {
719             return viewWrapperImpl.GetVisual(index);
720         }
721
722         /// <summary>
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 />
725         /// </summary>
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)
730         {
731             viewWrapperImpl.EnableVisual(index, enable);
732         }
733
734         /// <summary>
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 />
737         /// </summary>
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)
742         {
743             return viewWrapperImpl.IsVisualEnabled(index);
744         }
745
746         /// <summary>
747         /// Creates a transition effect on the control.
748         /// </summary>
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)
753         {
754             return viewWrapperImpl.CreateTransition(transitionData);
755         }
756
757         /// <summary>
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 />
760         /// </summary>
761         /// <param name="focusGained">True if gained, false if lost.</param>
762         /// <since_tizen> 3 </since_tizen>
763         protected void EmitFocusSignal(bool focusGained)
764         {
765             viewWrapperImpl.EmitFocusSignal(focusGained);
766         }
767
768
769         private void OnControlChildAdd(View child)
770         {
771         }
772
773         private void OnControlChildRemove(View child)
774         {
775         }
776     }
777 }