manual nui merge 0.2.38
[platform/core/csapi/nui.git] / Tizen.NUI / src / public / BaseComponents / CustomView.cs
1 /*
2  * Copyright (c) 2016 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
18 namespace Tizen.NUI.BaseComponents
19 {
20     /// <summary>
21     /// CustomView provides some common functionality required by all views.
22     /// </summary>
23     public class CustomView : ViewWrapper
24     {
25         public CustomView(string typeName, CustomViewBehaviour behaviour) : base(typeName, new ViewWrapperImpl(behaviour))
26         {
27             // Registering CustomView virtual functions to viewWrapperImpl delegates.
28             viewWrapperImpl.OnStageConnection = new ViewWrapperImpl.OnStageConnectionDelegate(OnStageConnection);
29             viewWrapperImpl.OnStageDisconnection = new ViewWrapperImpl.OnStageDisconnectionDelegate(OnStageDisconnection);
30             viewWrapperImpl.OnChildAdd = new ViewWrapperImpl.OnChildAddDelegate(OnChildAdd);
31             viewWrapperImpl.OnChildRemove = new ViewWrapperImpl.OnChildRemoveDelegate(OnChildRemove);
32             viewWrapperImpl.OnPropertySet = new ViewWrapperImpl.OnPropertySetDelegate(OnPropertySet);
33             viewWrapperImpl.OnSizeSet = new ViewWrapperImpl.OnSizeSetDelegate(OnSizeSet);
34             viewWrapperImpl.OnSizeAnimation = new ViewWrapperImpl.OnSizeAnimationDelegate(OnSizeAnimation);
35             viewWrapperImpl.OnTouch = new ViewWrapperImpl.OnTouchDelegate(OnTouch);
36             viewWrapperImpl.OnHover = new ViewWrapperImpl.OnHoverDelegate(OnHover);
37             viewWrapperImpl.OnKey = new ViewWrapperImpl.OnKeyDelegate(OnKey);
38             viewWrapperImpl.OnWheel = new ViewWrapperImpl.OnWheelDelegate(OnWheel);
39             viewWrapperImpl.OnRelayout = new ViewWrapperImpl.OnRelayoutDelegate(OnRelayout);
40             viewWrapperImpl.OnSetResizePolicy = new ViewWrapperImpl.OnSetResizePolicyDelegate(OnSetResizePolicy);
41             viewWrapperImpl.GetNaturalSize = new ViewWrapperImpl.GetNaturalSizeDelegate(GetNaturalSize);
42             viewWrapperImpl.CalculateChildSize = new ViewWrapperImpl.CalculateChildSizeDelegate(CalculateChildSize);
43             viewWrapperImpl.GetHeightForWidth = new ViewWrapperImpl.GetHeightForWidthDelegate(GetHeightForWidth);
44             viewWrapperImpl.GetWidthForHeight = new ViewWrapperImpl.GetWidthForHeightDelegate(GetWidthForHeight);
45             viewWrapperImpl.RelayoutDependentOnChildrenDimension = new ViewWrapperImpl.RelayoutDependentOnChildrenDimensionDelegate(RelayoutDependentOnChildren);
46             viewWrapperImpl.RelayoutDependentOnChildren = new ViewWrapperImpl.RelayoutDependentOnChildrenDelegate(RelayoutDependentOnChildren);
47             viewWrapperImpl.OnCalculateRelayoutSize = new ViewWrapperImpl.OnCalculateRelayoutSizeDelegate(OnCalculateRelayoutSize);
48             viewWrapperImpl.OnLayoutNegotiated = new ViewWrapperImpl.OnLayoutNegotiatedDelegate(OnLayoutNegotiated);
49             viewWrapperImpl.OnControlChildAdd = new ViewWrapperImpl.OnControlChildAddDelegate(OnControlChildAdd);
50             viewWrapperImpl.OnControlChildRemove = new ViewWrapperImpl.OnControlChildRemoveDelegate(OnControlChildRemove);
51             viewWrapperImpl.OnStyleChange = new ViewWrapperImpl.OnStyleChangeDelegate(OnStyleChange);
52             viewWrapperImpl.OnAccessibilityActivated = new ViewWrapperImpl.OnAccessibilityActivatedDelegate(OnAccessibilityActivated);
53             viewWrapperImpl.OnAccessibilityPan = new ViewWrapperImpl.OnAccessibilityPanDelegate(OnAccessibilityPan);
54             viewWrapperImpl.OnAccessibilityTouch = new ViewWrapperImpl.OnAccessibilityTouchDelegate(OnAccessibilityTouch);
55             viewWrapperImpl.OnAccessibilityValueChange = new ViewWrapperImpl.OnAccessibilityValueChangeDelegate(OnAccessibilityValueChange);
56             viewWrapperImpl.OnAccessibilityZoom = new ViewWrapperImpl.OnAccessibilityZoomDelegate(OnAccessibilityZoom);
57             viewWrapperImpl.OnFocusGained = new ViewWrapperImpl.OnFocusGainedDelegate(OnFocusGained);
58             viewWrapperImpl.OnFocusLost = new ViewWrapperImpl.OnFocusLostDelegate(OnFocusLost);
59             viewWrapperImpl.GetNextFocusableView = new ViewWrapperImpl.GetNextFocusableViewDelegate(GetNextFocusableView);
60             viewWrapperImpl.OnFocusChangeCommitted = new ViewWrapperImpl.OnFocusChangeCommittedDelegate(OnFocusChangeCommitted);
61             viewWrapperImpl.OnKeyboardEnter = new ViewWrapperImpl.OnKeyboardEnterDelegate(OnKeyboardEnter);
62             viewWrapperImpl.OnPinch = new ViewWrapperImpl.OnPinchDelegate(OnPinch);
63             viewWrapperImpl.OnPan = new ViewWrapperImpl.OnPanDelegate(OnPan);
64             viewWrapperImpl.OnTap = new ViewWrapperImpl.OnTapDelegate(OnTap);
65             viewWrapperImpl.OnLongPress = new ViewWrapperImpl.OnLongPressDelegate(OnLongPress);
66
67             // By default, we do not want the position to use the anchor point
68             this.PositionUsesAnchorPoint = false;
69
70             // Make sure CustomView is initialized.
71             OnInitialize();
72
73             // Set the StyleName the name of the View
74             // We have to do this because the StyleManager on Native side can't workout it out
75             // This will also ensure that the style of views/visuals initialized above are applied by the style manager.
76             SetStyleName(this.GetType().Name);
77         }
78
79         /// <summary>
80         /// Set the background with a property map.
81         /// </summary>
82         /// <param name="map">The background property map</param>
83         public void SetBackground(Tizen.NUI.PropertyMap map)
84         {
85             viewWrapperImpl.SetBackground(map);
86         }
87
88         /// <summary>
89         /// Allows deriving classes to enable any of the gesture detectors that are available.<br>
90         /// Gesture detection can be enabled one at a time or in bitwise format.<br>
91         /// </summary>
92         /// <param name="type">The gesture type(s) to enable</param>
93         public void EnableGestureDetection(Gesture.GestureType type)
94         {
95             viewWrapperImpl.EnableGestureDetection(type);
96         }
97
98         /// <summary>
99         /// Allows deriving classes to disable any of the gesture detectors.<br>
100         /// Like EnableGestureDetection, this can also be called using bitwise or one at a time.<br>
101         /// </summary>
102         /// <param name="type">The gesture type(s) to disable</param>
103         internal void DisableGestureDetection(Gesture.GestureType type)
104         {
105             viewWrapperImpl.DisableGestureDetection(type);
106         }
107
108         /// <summary>
109         /// Sets whether this control supports two dimensional keyboard navigation
110         /// (i.e. whether it knows how to handle the keyboard focus movement between its child views).<br>
111         /// The control doesn't support it by default.<br>
112         /// </summary>
113         /// <param name="isSupported">Whether this control supports two dimensional keyboard navigation.</param>
114         public bool FocusNavigationSupport
115         {
116             get
117             {
118                 return IsKeyboardNavigationSupported();
119             }
120             set
121             {
122                 SetKeyboardNavigationSupport(value);
123             }
124         }
125
126         internal void SetKeyboardNavigationSupport(bool isSupported)
127         {
128             viewWrapperImpl.SetKeyboardNavigationSupport(isSupported);
129         }
130
131         /// <summary>
132         /// Gets whether this control supports two dimensional keyboard navigation.
133         /// </summary>
134         /// <returns>true if this control supports two dimensional keyboard navigation</returns>
135         internal bool IsKeyboardNavigationSupported()
136         {
137             return viewWrapperImpl.IsKeyboardNavigationSupported();
138         }
139
140
141         /// <summary>
142         /// Sets or Gets whether this control is a focus group for keyboard navigation.
143         /// </summary>
144         /// <returns>true if this control is set as a focus group for keyboard navigation</returns>
145         public bool FocusGroup
146         {
147             get
148             {
149                 return IsKeyboardFocusGroup();
150             }
151             set
152             {
153                 SetAsKeyboardFocusGroup(value);
154             }
155         }
156
157         /// <summary>
158         /// Sets whether this control is a focus group for keyboard navigation.
159         /// (i.e. the scope of keyboard focus movement can be limitied to its child views). The control is not a focus group by default.
160         /// </summary>
161         /// <param name="isFocusGroup">Whether this control is set as a focus group for keyboard navigation</param>
162         internal void SetAsKeyboardFocusGroup(bool isFocusGroup)
163         {
164             viewWrapperImpl.SetAsFocusGroup(isFocusGroup);
165         }
166
167         /// <summary>
168         /// Gets whether this control is a focus group for keyboard navigation.
169         /// </summary>
170         internal bool IsKeyboardFocusGroup()
171         {
172             return viewWrapperImpl.IsFocusGroup();
173         }
174
175         /// <summary>
176         /// Called by the AccessibilityManager to activate the Control.
177         /// </summary>
178         internal void AccessibilityActivate()
179         {
180             viewWrapperImpl.AccessibilityActivate();
181         }
182
183         /// <summary>
184         /// Called by the KeyboardFocusManager.
185         /// </summary>
186         internal void KeyboardEnter()
187         {
188             viewWrapperImpl.KeyboardEnter();
189         }
190
191         /// <summary>
192         /// Called by the KeyInputFocusManager to emit key event signals.
193         /// </summary>
194         /// <param name="key">The key event</param>
195         /// <returns>True if the event was consumed</returns>
196         internal bool EmitKeyEventSignal(Key key)
197         {
198             return viewWrapperImpl.EmitKeyEventSignal(key);
199         }
200
201         /// <summary>
202         /// Request a relayout, which means performing a size negotiation on this view, its parent and children (and potentially whole scene).<br>
203         /// This method can also be called from a derived class every time it needs a different size.<br>
204         /// At the end of event processing, the relayout process starts and all controls which requested Relayout will have their sizes (re)negotiated.<br>
205         /// 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>
206         /// <summary>
207         protected void RelayoutRequest()
208         {
209             viewWrapperImpl.RelayoutRequest();
210         }
211
212         /// <summary>
213         /// Provides the View implementation of GetHeightForWidth.
214         /// <summary>
215         /// <param name="width">Width to use</param>
216         /// <returns>The height based on the width</returns>
217         protected float GetHeightForWidthBase(float width)
218         {
219             return viewWrapperImpl.GetHeightForWidthBase(width);
220         }
221
222         /// <summary>
223         /// Provides the View implementation of GetWidthForHeight.
224         /// </summary>
225         /// <param name="height">Height to use</param>
226         /// <returns>The width based on the height</returns>
227         protected float GetWidthForHeightBase(float height)
228         {
229             return viewWrapperImpl.GetWidthForHeightBase(height);
230         }
231
232         /// <summary>
233         /// Calculate the size for a child using the base view object.
234         /// </summary>
235         /// <param name="child">The child view to calculate the size for</param>
236         /// <param name="dimension">The dimension to calculate the size for. E.g. width or height</param>
237         /// <returns>Return the calculated size for the given dimension. If more than one dimension is requested, just return the first one found</returns>
238         protected float CalculateChildSizeBase(View child, DimensionType dimension)
239         {
240             return viewWrapperImpl.CalculateChildSizeBase(child, dimension);
241         }
242
243         /// <summary>
244         /// Determine if this view is dependent on it's children for relayout from the base class.
245         /// </summary>
246         /// <param name="dimension">The dimension(s) to check for</param>
247         /// <returns>Return if the view is dependent on it's children</returns>
248         protected bool RelayoutDependentOnChildrenBase(DimensionType dimension)
249         {
250             return viewWrapperImpl.RelayoutDependentOnChildrenBase(dimension);
251         }
252
253         /// <summary>
254         /// Determine if this view is dependent on it's children for relayout from the base class.
255         /// </summary>
256         /// <returns>Return if the view is dependent on it's children</returns>
257         protected bool RelayoutDependentOnChildrenBase()
258         {
259             return viewWrapperImpl.RelayoutDependentOnChildrenBase();
260         }
261
262         /// <summary>
263         /// Register a visual by Property Index, linking an View to visual when required.<br>
264         /// In the case of the visual being an view or control deeming visual not required then visual should be an empty handle.<br>
265         /// No parenting is done during registration, this should be done by derived class.<br>
266         /// </summary>
267         /// <param name="index">The Property index of the visual, used to reference visual</param>
268         /// <param name="visual">The visual to register</param>
269         protected void RegisterVisual(int index, VisualBase visual)
270         {
271             viewWrapperImpl.RegisterVisual(index, visual);
272         }
273
274         /// <summary>
275         /// Register a visual by Property Index, linking an View to visual when required.<br>
276         /// In the case of the visual being an view or control deeming visual not required then visual should be an empty handle.<br>
277         /// If enabled is false then the visual is not set on stage until enabled by the derived class.<br>
278         /// </summary>
279         /// <param name="index">The Property index of the visual, used to reference visual</param>
280         /// <param name="visual">The visual to register</param>
281         /// <param name="enabled">false if derived class wants to control when visual is set on stage</param>
282         protected void RegisterVisual(int index, VisualBase visual, bool enabled)
283         {
284             viewWrapperImpl.RegisterVisual(index, visual, enabled);
285         }
286
287         /// <summary>
288         /// Erase the entry matching the given index from the list of registered visuals.
289         /// </summary>
290         /// <param name="index">The Property index of the visual, used to reference visual</param>
291         protected void UnregisterVisual(int index)
292         {
293             viewWrapperImpl.UnregisterVisual(index);
294         }
295
296         /// <summary>
297         /// Retrieve the visual associated with the given property index.<br>
298         /// For managing object life-cycle, do not store the returned visual as a member which increments its reference count.<br>
299         /// </summary>
300         /// <param name="index">The Property index of the visual, used to reference visual</param>
301         /// <returns>The registered visual if exist, otherwise empty handle</returns>
302         protected VisualBase GetVisual(int index)
303         {
304             return viewWrapperImpl.GetVisual(index);
305         }
306
307         /// <summary>
308         /// Sets the given visual to be displayed or not when parent staged.<br>
309         /// For managing object life-cycle, do not store the returned visual as a member which increments its reference count.<br>
310         /// </summary>
311         /// <param name="index">The Property index of the visual, used to reference visual</param>
312         /// <param name="enable">flag to set enabled or disabled</param>
313         protected void EnableVisual(int index, bool enable)
314         {
315             viewWrapperImpl.EnableVisual(index, enable);
316         }
317
318         /// <summary>
319         /// Queries if the given visual is to be displayed when parent staged.<br>
320         /// For managing object life-cycle, do not store the returned visual as a member which increments its reference count.<br>
321         /// </summary>
322         /// <param name="index">The Property index of the visual</param>
323         /// <returns>Whether visual is enabled or not</returns>
324         protected bool IsVisualEnabled(int index)
325         {
326             return viewWrapperImpl.IsVisualEnabled(index);
327         }
328
329         /// <summary>
330         /// Create a transition effect on the control.
331         /// </summary>
332         /// <param name="transitionData">transitionData The transition data describing the effect to create</param>
333         /// <returns>A handle to an animation defined with the given effect, or an empty handle if no properties match </returns>
334         protected Animation CreateTransition(TransitionData transitionData)
335         {
336             return viewWrapperImpl.CreateTransition(transitionData);
337         }
338
339         /// <summary>
340         /// Emits KeyInputFocusGained signal if true else emits KeyInputFocusLost signal.<br>
341         /// Should be called last by the control after it acts on the Input Focus change.<br>
342         /// </summary>
343         /// <param name="focusGained">focusGained True if gained, False if lost</param>
344         protected void EmitFocusSignal(bool focusGained)
345         {
346             viewWrapperImpl.EmitFocusSignal(focusGained);
347         }
348
349         /// <summary>
350         /// This method is called after the Control has been initialized.<br>
351         /// Derived classes should do any second phase initialization by overriding this method.<br>
352         /// </summary>
353         public virtual void OnInitialize()
354         {
355         }
356
357         /// <summary>
358         /// Called after the view has been connected to the stage.<br>
359         /// When an view is connected, it will be directly or indirectly parented to the root View.<br>
360         /// The root View is provided automatically by Tizen.NUI.Stage, and is always considered to be connected.<br>
361         /// When the parent of a set of views is connected to the stage, then all of the children will received this callback.<br>
362         /// </summary>
363         /// <param name="depth">The depth in the hierarchy for the view</param>
364         public virtual void OnStageConnection(int depth)
365         {
366         }
367
368         /// <summary>
369         /// Called after the view has been disconnected from Stage.<br>
370         /// If an view is disconnected it either has no parent, or is parented to a disconnected view.<br>
371         /// When the parent of a set of views is disconnected to the stage, then all of the children will received this callback, starting with the leaf views.<br>
372         /// </summary>
373         public virtual void OnStageDisconnection()
374         {
375         }
376
377         /// <summary>
378         /// Called after a child has been added to the owning view.
379         /// </summary>
380         /// <param name="view">The child which has been added</param>
381         public virtual void OnChildAdd(View view)
382         {
383         }
384
385         /// <summary>
386         /// Called after the owning view has attempted to remove a child( regardless of whether it succeeded or not ).
387         /// </summary>
388         /// <param name="view">The child being removed</param>
389         public virtual void OnChildRemove(View view)
390         {
391         }
392
393         /// <summary>
394         /// Called when the owning view property is set.
395         /// </summary>
396         /// <param name="index">The Property index that was set</param>
397         /// <param name="propertyValue">The value to set</param>
398         public virtual void OnPropertySet(int index, Tizen.NUI.PropertyValue propertyValue)
399         {
400         }
401
402         /// <summary>
403         /// Called when the owning view's size is set e.g. using View.SetSize().
404         /// </summary>
405         /// <param name="targetSize">The target size. Note that this target size may not match the size returned via View.GetTargetSize</param>
406         public virtual void OnSizeSet(Vector3 targetSize)
407         {
408         }
409
410         /// <summary>
411         /// Called when the owning view's size is animated e.g. using Animation::AnimateTo( Property( view, View::Property::SIZE ), ... ).
412         /// </summary>
413         /// <param name="animation">The object which is animating the owning view</param>
414         /// <param name="targetSize">The target size. Note that this target size may not match the size returned via @ref View.GetTargetSize</param>
415         public virtual void OnSizeAnimation(Animation animation, Vector3 targetSize)
416         {
417         }
418
419         /// <summary>
420         /// Called after a touch-event is received by the owning view.<br>
421         /// CustomViewBehaviour.REQUIRES_TOUCH_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).<br>
422         /// </summary>
423         /// <param name="touch">The touch event</param>
424         /// <returns>True if the event should be consumed</returns>
425         public virtual bool OnTouch(Touch touch)
426         {
427             return false; // Do not consume
428         }
429
430         /// <summary>
431         /// Called after a hover-event is received by the owning view.<br>
432         /// CustomViewBehaviour.REQUIRES_HOVER_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).<br>
433         /// </summary>
434         /// <param name="hover">The hover event</param>
435         /// <returns>True if the hover event should be consumed</returns>
436         public virtual bool OnHover(Hover hover)
437         {
438             return false; // Do not consume
439         }
440
441         /// <summary>
442         /// Called after a key-event is received by the view that has had its focus set.
443         /// </summary>
444         /// <param name="key">The key event</param>
445         /// <returns>True if the key event should be consumed</returns>
446         public virtual bool OnKey(Key key)
447         {
448             return false; // Do not consume
449         }
450
451         /// <summary>
452         /// Called after a wheel-event is received by the owning view.<br>
453         /// CustomViewBehaviour.REQUIRES_WHEEL_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).<br>
454         /// </summary>
455         /// <param name="wheel">The wheel event</param>
456         /// <returns>True if the wheel event should be consumed</returns>
457         public virtual bool OnWheel(Wheel wheel)
458         {
459             return false; // Do not consume
460         }
461
462         /// <summary>
463         /// Called after the size negotiation has been finished for this control.<br>
464         /// The control is expected to assign this given size to itself/its children.<br>
465         /// 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>
466         /// As this function is called from inside the size negotiation algorithm, you cannot call RequestRelayout (the call would just be ignored).<br>
467         /// </summary>
468         /// <param name="size">The allocated size</param>
469         /// <param name="container">The control should add views to this container that it is not able to allocate a size for</param>
470         public virtual void OnRelayout(Vector2 size, RelayoutContainer container)
471         {
472         }
473
474         /// <summary>
475         /// Notification for deriving classes.
476         /// </summary>
477         /// <param name="policy">policy The policy being set</param>
478         /// <param name="dimension">dimension The dimension the policy is being set for</param>
479         public virtual void OnSetResizePolicy(ResizePolicyType policy, DimensionType dimension)
480         {
481         }
482
483         /// <summary>
484         /// Return the natural size of the view.
485         /// </summary>
486         /// <returns>The view's natural size</returns>
487         public virtual Size GetNaturalSize()
488         {
489             return new Size(0.0f, 0.0f, 0.0f);
490         }
491
492         /// <summary>
493         /// Calculate the size for a child.
494         /// </summary>
495         /// <param name="child">The child view to calculate the size for</param>
496         /// <param name="dimension">The dimension to calculate the size for. E.g. width or height</param>
497         /// <returns>Return the calculated size for the given dimension. If more than one dimension is requested, just return the first one found.</returns>
498         public virtual float CalculateChildSize(View child, DimensionType dimension)
499         {
500             return viewWrapperImpl.CalculateChildSizeBase(child, dimension);
501         }
502
503         /// <summary>
504         /// This method is called during size negotiation when a height is required for a given width.<br>
505         /// Derived classes should override this if they wish to customize the height returned.<br>
506         /// </summary>
507         /// <param name="width">Width to use</param>
508         /// <returns>The height based on the width</returns>
509         public virtual float GetHeightForWidth(float width)
510         {
511             return viewWrapperImpl.GetHeightForWidthBase(width);
512         }
513
514         /// <summary>
515         /// This method is called during size negotiation when a width is required for a given height.<br>
516         /// Derived classes should override this if they wish to customize the width returned.<br>
517         /// </summary>
518         /// <param name="height">Height to use</param>
519         /// <returns>The width based on the width</returns>
520         public virtual float GetWidthForHeight(float height)
521         {
522             return viewWrapperImpl.GetWidthForHeightBase(height);
523         }
524
525         /// <summary>
526         /// Determine if this view is dependent on it's children for relayout.
527         /// </summary>
528         /// <param name="dimension">The dimension(s) to check for</param>
529         /// <returns>Return if the view is dependent on it's children</returns>
530         public virtual bool RelayoutDependentOnChildren(DimensionType dimension)
531         {
532             return viewWrapperImpl.RelayoutDependentOnChildrenBase(dimension);
533         }
534
535         /// <summary>
536         /// Determine if this view is dependent on it's children for relayout from the base class.
537         /// </summary>
538         /// <returns>Return true if the view is dependent on it's children</returns>
539         public virtual bool RelayoutDependentOnChildren()
540         {
541             return viewWrapperImpl.RelayoutDependentOnChildrenBase();
542         }
543
544         /// <summary>
545         /// Virtual method to notify deriving classes that relayout dependencies have been
546         /// met and the size for this object is about to be calculated for the given dimension.
547         /// </summary>
548         /// <param name="dimension">The dimension that is about to be calculated</param>
549         public virtual void OnCalculateRelayoutSize(DimensionType dimension)
550         {
551         }
552
553         /// <summary>
554         /// Virtual method to notify deriving classes that the size for a dimension has just been negotiated.
555         /// </summary>
556         /// <param name="size">The new size for the given dimension</param>
557         /// <param name="dimension">The dimension that was just negotiated</param>
558         public virtual void OnLayoutNegotiated(float size, DimensionType dimension)
559         {
560         }
561
562         /// <summary>
563         /// This method should be overridden by deriving classes requiring notifications when the style changes.
564         /// </summary>
565         /// <param name="styleManager">The StyleManager object</param>
566         /// <param name="change">Information denoting what has changed</param>
567         public virtual void OnStyleChange(StyleManager styleManager, StyleChangeType change)
568         {
569         }
570
571         /// <summary>
572         /// This method is called when the control is accessibility activated.<br>
573         /// Derived classes should override this to perform custom accessibility activation.<br>
574         /// </summary>
575         /// <returns>true if this control can perform accessibility activation</returns>
576         internal virtual bool OnAccessibilityActivated()
577         {
578             return false;
579         }
580
581         /// <summary>
582         /// This method should be overridden by deriving classes when they wish to respond the accessibility.
583         /// </summary>
584         /// <param name="gestures">The pan gesture</param>
585         /// <returns>true if the pan gesture has been consumed by this control</returns>
586         internal virtual bool OnAccessibilityPan(PanGesture gestures)
587         {
588             return false;
589         }
590
591         /// <summary>
592         /// This method should be overridden by deriving classes when they wish to respond the accessibility
593         /// </summary>
594         /// <param name="touch">The touch gesture</param>
595         /// <returns>true if the touch event has been consumed by this control</returns>
596         internal virtual bool OnAccessibilityTouch(Touch touch)
597         {
598             return false;
599         }
600
601         /// <summary>
602         /// 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).
603         /// </summary>
604         /// <param name="isIncrease">isIncrease Whether the value should be increased or decreased</param>
605         /// <returns>true if the value changed action has been consumed by this control</returns>
606         internal virtual bool OnAccessibilityValueChange(bool isIncrease)
607         {
608             return false;
609         }
610
611         /// <summary>
612         /// This method should be overridden by deriving classes when they wish to respond the accessibility zoom action.
613         /// </summary>
614         /// <returns>true if the zoom action has been consumed by this control</returns>
615         internal virtual bool OnAccessibilityZoom()
616         {
617             return false;
618         }
619
620         /// <summary>
621         /// Called when the control gain key input focus. Should be overridden by derived classes if they need to customize what happens when focus is gained.
622         /// </summary>
623         public virtual void OnFocusGained()
624         {
625         }
626
627         /// <summary>
628         /// Called when the control loses key input focus. Should be overridden by derived classes if they need to customize what happens when focus is lost.
629         /// </summary>
630         public virtual void OnFocusLost()
631         {
632         }
633
634         /// <summary>
635         /// Gets the next keyboard focusable view in this control towards the given direction.<br>
636         /// A control needs to override this function in order to support two dimensional keyboard navigation.<br>
637         /// </summary>
638         /// <param name="currentFocusedView">The current focused view</param>
639         /// <param name="direction">The direction to move the focus towards</param>
640         /// <param name="loopEnabled">Whether the focus movement should be looped within the control</param>
641         /// <returns>the next keyboard focusable view in this control or an empty handle if no view can be focused</returns>
642         public virtual View GetNextFocusableView(View currentFocusedView, View.FocusDirection direction, bool loopEnabled)
643         {
644             return new View();
645         }
646
647         /// <summary>
648         /// Informs this control that its chosen focusable view will be focused.<br>
649         /// This allows the application to preform any actions if wishes before the focus is actually moved to the chosen view.<br>
650         /// </summary>
651         /// <param name="commitedFocusableView">The commited focused view</param>
652         public virtual void OnFocusChangeCommitted(View commitedFocusableView)
653         {
654         }
655
656         /// <summary>
657         /// This method is called when the control has enter pressed on it.<br>
658         /// Derived classes should override this to perform custom actions.<br>
659         /// </summary>
660         /// <returns>true if this control supported this action</returns>
661         public virtual bool OnKeyboardEnter()
662         {
663             return false;
664         }
665
666         /// <summary>
667         /// Called whenever a pinch gesture is detected on this control.<br>
668         /// This can be overridden by deriving classes when pinch detection is enabled. The default behaviour is to scale the control by the pinch scale.<br>
669         /// If overridden, then the default behaviour will not occur.<br>
670         /// Pinch detection should be enabled via EnableGestureDetection().<br>
671         /// </summary>
672         /// <param name="pinch">pinch tap gesture</param>
673         internal virtual void OnPinch(PinchGesture pinch)
674         {
675         }
676
677         /// <summary>
678         /// Called whenever a pan gesture is detected on this control.<br>
679         /// This should be overridden by deriving classes when pan detection is enabled.<br>
680         /// There is no default behaviour with panning.<br>
681         /// Pan detection should be enabled via EnableGestureDetection().<br>
682         /// </summary>
683         /// <param name="pan">The pan gesture</param>
684         public virtual void OnPan(PanGesture pan)
685         {
686         }
687
688         /// <summary>
689         /// Called whenever a tap gesture is detected on this control.<br>
690         /// This should be overridden by deriving classes when tap detection is enabled.<br>
691         /// There is no default behaviour with a tap.<br>
692         /// Tap detection should be enabled via EnableGestureDetection().<br>
693         /// </summary>
694         /// <param name="tap">The tap gesture</param>
695         public virtual void OnTap(TapGesture tap)
696         {
697         }
698
699         /// <summary>
700         /// Called whenever a long press gesture is detected on this control.<br>
701         /// This should be overridden by deriving classes when long press detection is enabled.<br>
702         /// There is no default behaviour associated with a long press.<br>
703         /// Long press detection should be enabled via EnableGestureDetection().<br>
704         /// </summary>
705         /// <param name="longPress">The long press gesture</param>
706         internal virtual void OnLongPress(LongPressGesture longPress)
707         {
708         }
709
710         private void OnControlChildAdd(View child)
711         {
712         }
713
714         private void OnControlChildRemove(View child)
715         {
716         }
717     }
718 }