Class CustomView
Definition
- Namespace:
- Tizen.NUI.BaseComponents
- Assembly:
- Tizen.NUI.dll
CustomView provides some common functionality required by all views.
public class CustomView : ViewWrapper, INotifyPropertyChanged, IDisposable
- Inheritance
-
objectTizen.NUI.Binding.ElementCustomView
- Derived
- Implements
-
System.ComponentModel.INotifyPropertyChangedSystem.IDisposable
Constructors
View SourceCustomView(string, CustomViewBehaviour)
Create an instance of customView.
Declaration
public CustomView(string typeName, CustomViewBehaviour behaviour)
Parameters
| Type | Name | Description |
|---|---|---|
| string | typeName | typename |
| CustomViewBehaviour | behaviour | CustomView Behaviour |
Properties
View SourceFocusGroup
Sets or gets whether this control is a focus group for keyboard navigation.
Declaration
public bool FocusGroup { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | True if this control is set as a focus group for keyboard navigation. |
FocusNavigationSupport
Sets whether this control supports two dimensional keyboard navigation
(i.e., whether it knows how to handle the keyboard focus movement between its child views).
The control doesn't support it by default.
Declaration
public bool FocusNavigationSupport { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
View SourceCalculateChildSize(View, DimensionType)
Calculates the size for a child.
Declaration
public virtual float CalculateChildSize(View child, DimensionType dimension)
Parameters
| Type | Name | Description |
|---|---|---|
| View | child | The child view to calculate the size for. |
| DimensionType | dimension | The dimension to calculate the size, for example, the width or the height. |
Returns
| Type | Description |
|---|---|
| float | Return the calculated size for the given dimension. If more than one dimension is requested, just return the first one found. |
CalculateChildSizeBase(View, DimensionType)
Calculates the size for a child using the base view object.
Declaration
protected float CalculateChildSizeBase(View child, DimensionType dimension)
Parameters
| Type | Name | Description |
|---|---|---|
| View | child | The child view to calculate the size for. |
| DimensionType | dimension | The dimension to calculate the size, for example, the width or the height. |
Returns
| Type | Description |
|---|---|
| float | Return the calculated size for the given dimension. If more than one dimension is requested, just return the first one found. |
CreateTransition(TransitionData)
Creates a transition effect on the control.
Declaration
protected Animation CreateTransition(TransitionData transitionData)
Parameters
| Type | Name | Description |
|---|---|---|
| TransitionData | transitionData | The transition data describing the effect to create. |
Returns
| Type | Description |
|---|---|
| Animation | A handle to an animation defined with the given effect, or an empty handle if no properties match. |
EmitFocusSignal(bool)
Emits the KeyInputFocusGained signal if true, else, emits the KeyInputFocusLost signal.
Should be called last by the control after it acts on the input focus change.
Declaration
protected void EmitFocusSignal(bool focusGained)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | focusGained | True if gained, false if lost. |
EnableGestureDetection(GestureType)
Allows deriving classes to enable any of the gesture detectors that are available.
Gesture detection can be enabled one at a time or in a bitwise format.
Declaration
public void EnableGestureDetection(Gesture.GestureType type)
Parameters
| Type | Name | Description |
|---|---|---|
| Gesture.GestureType | type | The gesture type(s) to enable. |
EnableVisual(int, bool)
Sets the given visual to be displayed or not when parent staged.
For managing the object lifecycle, do not store the returned visual as a member which increments its reference count.
Declaration
protected void EnableVisual(int index, bool enable)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The property index of the visual, used to reference visual. |
| bool | enable | Flag set to enabled or disabled. |
GetHeightForWidth(float)
This method is called during size negotiation when a height is required for a given width.
Derived classes should override this if they wish to customize the height returned.
Declaration
[Obsolete("This has been deprecated in API9 and will be removed in API11. Use HeightForWidth property instead.")]
public virtual float GetHeightForWidth(float width)
Parameters
| Type | Name | Description |
|---|---|---|
| float | width | Width to use |
Returns
| Type | Description |
|---|---|
| float | The height based on the width |
GetHeightForWidthBase(float)
Provides the view implementation of GetHeightForWidth.
Declaration
protected float GetHeightForWidthBase(float width)
Parameters
| Type | Name | Description |
|---|---|---|
| float | width | The width to use. |
Returns
| Type | Description |
|---|---|
| float | The height based on the width. |
GetNaturalSize()
Returns the natural size of the view.
Declaration
public virtual Size2D GetNaturalSize()
Returns
| Type | Description |
|---|---|
| Size2D | The view's natural size |
GetNextFocusableView(View, FocusDirection, bool)
Gets the next keyboard focusable view in this control towards the given direction.
A control needs to override this function in order to support two dimensional keyboard navigation.
Declaration
public virtual View GetNextFocusableView(View currentFocusedView, View.FocusDirection direction, bool loopEnabled)
Parameters
| Type | Name | Description |
|---|---|---|
| View | currentFocusedView | The current focused view. |
| View.FocusDirection | direction | The direction to move the focus towards. |
| bool | loopEnabled | Whether the focus movement should be looped within the control. |
Returns
| Type | Description |
|---|---|
| View | The next keyboard focusable view in this control or null if no view can be focused. |
GetVisual(int)
Retrieves the visual associated with the given property index.
For managing the object lifecycle, do not store the returned visual as a member which increments its reference count.
Declaration
protected VisualBase GetVisual(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The property index of the visual used to reference visual. |
Returns
| Type | Description |
|---|---|
| VisualBase | The registered visual if exists, otherwise an empty handle. |
GetWidthForHeight(float)
This method is called during size negotiation when a width is required for a given height.
Derived classes should override this if they wish to customize the width returned.
Declaration
[Obsolete("This has been deprecated since API9 and will be removed in API11. Use WidthForHeight property instead.")]
public virtual float GetWidthForHeight(float height)
Parameters
| Type | Name | Description |
|---|---|---|
| float | height | Height to use |
Returns
| Type | Description |
|---|---|
| float | The width based on the width |
GetWidthForHeightBase(float)
Provides the view implementation of GetWidthForHeight.
Declaration
protected float GetWidthForHeightBase(float height)
Parameters
| Type | Name | Description |
|---|---|---|
| float | height | The height to use. |
Returns
| Type | Description |
|---|---|
| float | The width based on the height. |
IsVisualEnabled(int)
Queries if the given visual is to be displayed when parent staged.
For managing the object lifecycle, do not store the returned visual as a member which increments its reference count.
Declaration
protected bool IsVisualEnabled(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The property index of the visual. |
Returns
| Type | Description |
|---|---|
| bool | Whether visual is enabled or not. |
OnCalculateRelayoutSize(DimensionType)
The virtual method to notify deriving classes that relayout dependencies have been met and the size for this object is about to be calculated for the given dimension.
Declaration
public virtual void OnCalculateRelayoutSize(DimensionType dimension)
Parameters
| Type | Name | Description |
|---|---|---|
| DimensionType | dimension | The dimension that is about to be calculated. |
OnChildAdd(View)
Called after a child has been added to the owning view.
Declaration
public virtual void OnChildAdd(View view)
Parameters
| Type | Name | Description |
|---|---|---|
| View | view | The child which has been added. |
OnChildRemove(View)
Called after the owning view has attempted to remove a child( regardless of whether it succeeded or not ).
Declaration
public virtual void OnChildRemove(View view)
Parameters
| Type | Name | Description |
|---|---|---|
| View | view | The child being removed. |
OnFocusChangeCommitted(View)
Informs this control that its chosen focusable view will be focused.
This allows the application to preform any actions it wishes before the focus is actually moved to the chosen view.
Declaration
public virtual void OnFocusChangeCommitted(View commitedFocusableView)
Parameters
| Type | Name | Description |
|---|---|---|
| View | commitedFocusableView | The commited focused view. |
OnFocusGained()
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.
Declaration
public virtual void OnFocusGained()
OnFocusLost()
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.
Declaration
public virtual void OnFocusLost()
OnHover(Hover)
Called after a hover event is received by the owning view.
CustomViewBehaviour.REQUIRES_HOVER_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).
Declaration
public virtual bool OnHover(Hover hover)
Parameters
| Type | Name | Description |
|---|---|---|
| Hover | hover | The hover event. |
Returns
| Type | Description |
|---|---|
| bool | True if the hover event should be consumed. |
OnInitialize()
This method is called after the CustomView has been initialized.
After OnInitialize, the view will apply the style if it exists in the theme or it was given from constructor.
Derived classes should do any second phase initialization by overriding this method.
Declaration
public virtual void OnInitialize()
OnKey(Key)
Called after a key event is received by the view that has had its focus set.
Declaration
public virtual bool OnKey(Key key)
Parameters
| Type | Name | Description |
|---|---|---|
| Key | key | The key event. |
Returns
| Type | Description |
|---|---|
| bool | True if the key event should be consumed. |
OnKeyboardEnter()
This method is called when the control has enter pressed on it.
Derived classes should override this to perform custom actions.
Declaration
public virtual bool OnKeyboardEnter()
Returns
| Type | Description |
|---|---|
| bool | True if this control supported this action. |
OnLayoutNegotiated(float, DimensionType)
The virtual method to notify deriving classes that the size for a dimension has just been negotiated.
Declaration
public virtual void OnLayoutNegotiated(float size, DimensionType dimension)
Parameters
| Type | Name | Description |
|---|---|---|
| float | size | The new size for the given dimension. |
| DimensionType | dimension | The dimension that was just negotiated. |
OnPan(PanGesture)
Called whenever a pan gesture is detected on this control.
This should be overridden by deriving classes when pan detection is enabled.
There is no default behavior with panning.
Pan detection should be enabled via EnableGestureDetection().
Declaration
public virtual void OnPan(PanGesture pan)
Parameters
| Type | Name | Description |
|---|---|---|
| PanGesture | pan | The pan gesture. |
OnPropertySet(int, PropertyValue)
Called when the owning view property is set.
Declaration
public virtual void OnPropertySet(int index, PropertyValue propertyValue)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The property index that was set. |
| PropertyValue | propertyValue | The value to set. |
OnRelayout(Vector2, RelayoutContainer)
Called after the size negotiation has been finished for this control.
The control is expected to assign this given size to itself or its children.
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.
As this function is called from inside the size negotiation algorithm, you cannot call RequestRelayout (the call would just be ignored).
Declaration
public virtual void OnRelayout(Vector2 size, RelayoutContainer container)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | size | The allocated size. |
| RelayoutContainer | container | The control should add views to this container that it is not able to allocate a size for. |
OnSceneConnection(int)
Called after the view has been connected to the scene.
When a view is connected, it will be directly or indirectly parented to the root view.
The root view is provided automatically by Tizen.NUI.Window, and is always considered to be connected.
When the parent of a set of views is connected to the scene, then all of the children will receive this callback.
Declaration
public virtual void OnSceneConnection(int depth)
Parameters
| Type | Name | Description |
|---|---|---|
| int | depth | The depth in the hierarchy for the view. |
OnSceneDisconnection()
Called after the view has been disconnected from the scene.
If a view is disconnected, it either has no parent, or is parented to a disconnected view.
When the parent of a set of views is disconnected to the scene, then all of the children will receive this callback, starting with the leaf views.
Declaration
public virtual void OnSceneDisconnection()
OnSetResizePolicy(ResizePolicyType, DimensionType)
Notification for deriving classes.
Declaration
public virtual void OnSetResizePolicy(ResizePolicyType policy, DimensionType dimension)
Parameters
| Type | Name | Description |
|---|---|---|
| ResizePolicyType | policy | The policy being set. |
| DimensionType | dimension | The policy is being set for. |
OnSizeAnimation(Animation, Vector3)
Called when the owning view's size is animated, for example, using Animation::AnimateTo( Property ( view, View::Property::SIZE ), ... ).
Declaration
public virtual void OnSizeAnimation(Animation animation, Vector3 targetSize)
Parameters
| Type | Name | Description |
|---|---|---|
| Animation | animation | The object which is animating the owning view. |
| Vector3 | targetSize | The target size. |
OnSizeSet(Vector3)
Called when the owning view's size is set, for example, using View.SetSize().
Declaration
public virtual void OnSizeSet(Vector3 targetSize)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | targetSize | The target size. |
OnStageConnection(int)
Called after the view has been connected to the stage.
When a view is connected, it will be directly or indirectly parented to the root view.
The root view is provided automatically by Tizen.NUI.Stage, and is always considered to be connected.
When the parent of a set of views is connected to the stage, then all of the children will receive this callback.
Declaration
[Obsolete("This has been deprecated since API8 and will be removed in API10. Use OnSceneConnection instead.")]
public virtual void OnStageConnection(int depth)
Parameters
| Type | Name | Description |
|---|---|---|
| int | depth | The depth in the hierarchy for the view. |
OnStageDisconnection()
Called after the view has been disconnected from the stage.
If a view is disconnected, it either has no parent, or is parented to a disconnected view.
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.
Declaration
[Obsolete("This has been deprecated since API8 and will be removed in API10. Use OnSceneDisconnection instead.")]
public virtual void OnStageDisconnection()
OnStyleChange(StyleManager, StyleChangeType)
This method should be overridden by deriving classes requiring notifications when the style changes.
Declaration
[Obsolete("Deprecated in API9, Will be removed in API11.")]
public virtual void OnStyleChange(StyleManager styleManager, StyleChangeType change)
Parameters
| Type | Name | Description |
|---|---|---|
| StyleManager | styleManager | The StyleManager object. |
| StyleChangeType | change | Information denoting what has changed. |
OnTap(TapGesture)
Called whenever a tap gesture is detected on this control.
This should be overridden by deriving classes when tap detection is enabled.
There is no default behavior with a tap.
Tap detection should be enabled via EnableGestureDetection().
Declaration
public virtual void OnTap(TapGesture tap)
Parameters
| Type | Name | Description |
|---|---|---|
| TapGesture | tap | The tap gesture. |
OnTouch(Touch)
Called after a touch event is received by the owning view.
CustomViewBehaviour.REQUIRES_TOUCH_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).
Declaration
public virtual bool OnTouch(Touch touch)
Parameters
| Type | Name | Description |
|---|---|---|
| Touch | touch | The touch event. |
Returns
| Type | Description |
|---|---|
| bool | True if the event should be consumed. |
OnWheel(Wheel)
Called after a wheel event is received by the owning view.
CustomViewBehaviour.REQUIRES_WHEEL_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).
Declaration
public virtual bool OnWheel(Wheel wheel)
Parameters
| Type | Name | Description |
|---|---|---|
| Wheel | wheel | The wheel event. |
Returns
| Type | Description |
|---|---|
| bool | True if the wheel event should be consumed. |
RegisterVisual(int, VisualBase, bool)
Registers a visual by the property index, linking a view to visual when required.
In the case of the visual being a view or control deeming visual not required, then the visual should be an empty handle.
If enabled is false, then the visual is not set on the stage until enabled by the derived class.
Declaration
protected void RegisterVisual(int index, VisualBase visual, bool enabled)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The property index of the visual used to reference visual. |
| VisualBase | visual | The visual to register. |
| bool | enabled | False if derived class wants to control when the visual is set on the stage. |
RegisterVisual(int, VisualBase)
Registers a visual by property index, linking a view to visual when required.
In the case of the visual being a view or control deeming visual not required, then the visual should be an empty handle.
No parenting is done during registration, this should be done by a derived class.
Declaration
protected void RegisterVisual(int index, VisualBase visual)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The property index of the visual used to reference visual. |
| VisualBase | visual | The visual to register. |
RelayoutDependentOnChildren()
Determines if this view is dependent on it's children for relayout from the base class.
Declaration
public virtual bool RelayoutDependentOnChildren()
Returns
| Type | Description |
|---|---|
| bool | Return true if the view is dependent on it's children. |
RelayoutDependentOnChildren(DimensionType)
Determines if this view is dependent on it's children for relayout.
Declaration
public virtual bool RelayoutDependentOnChildren(DimensionType dimension)
Parameters
| Type | Name | Description |
|---|---|---|
| DimensionType | dimension | The dimension(s) to check for. |
Returns
| Type | Description |
|---|---|
| bool | Return if the view is dependent on it's children. |
RelayoutDependentOnChildrenBase()
Determines if this view is dependent on it's children for relayout from the base class.
Declaration
protected bool RelayoutDependentOnChildrenBase()
Returns
| Type | Description |
|---|---|
| bool | Return if the view is dependent on it's children. |
RelayoutDependentOnChildrenBase(DimensionType)
Determines if this view is dependent on it's children for relayout from the base class.
Declaration
protected bool RelayoutDependentOnChildrenBase(DimensionType dimension)
Parameters
| Type | Name | Description |
|---|---|---|
| DimensionType | dimension | The dimension(s) to check for. |
Returns
| Type | Description |
|---|---|
| bool | Return if the view is dependent on it's children. |
RelayoutRequest()
Requests a relayout, which means performing a size negotiation on this view, its parent, and children (and potentially whole scene).
This method can also be called from a derived class every time it needs a different size.
At the end of event processing, the relayout process starts and all controls which requested relayout will have their sizes (re)negotiated.
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.
Declaration
protected void RelayoutRequest()
SetBackground(PropertyMap)
Sets the background with a property map.
Declaration
public void SetBackground(PropertyMap map)
Parameters
| Type | Name | Description |
|---|---|---|
| PropertyMap | map | The background property map. |
UnregisterVisual(int)
Erases the entry matching the given index from the list of registered visuals.
Declaration
protected void UnregisterVisual(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The property index of the visual used to reference visual. |