Class CustomView

Definition

Namespace:
Tizen.NUI.BaseComponents
Assembly:
Tizen.NUI.dll
API Level:
3

CustomView provides some common functionality required by all views.

C#
Copy
public class CustomView : ViewWrapper, INotifyPropertyChanged, IDynamicResourceHandler, IElement, INameScope, IElementController, IDisposable, IResourcesProvider
Inheritance
System.Object
Tizen.NUI.Binding.Element
CustomView
Derived
Implements
System.ComponentModel.INotifyPropertyChanged
System.IDisposable

Constructors

View Source

CustomView(String, CustomViewBehaviour)

Create an instance of customView.

Declaration
C#
Copy
public CustomView(string typeName, CustomViewBehaviour behaviour)
Parameters
Type Name Description
System.String typeName

typename

CustomViewBehaviour behaviour

CustomView Behaviour

API Level: 3

Properties

View Source

FocusGroup

Sets or gets whether this control is a focus group for keyboard navigation.

Declaration
C#
Copy
public bool FocusGroup { get; set; }
Property Value
Type Description
Boolean

True if this control is set as a focus group for keyboard navigation.

API Level: 3
View Source

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
C#
Copy
public bool FocusNavigationSupport { get; set; }
Property Value
Type Description
Boolean
API Level: 3

Methods

View Source

CalculateChildSize(View, DimensionType)

Calculates the size for a child.

Declaration
C#
Copy
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
System.Single

Return the calculated size for the given dimension. If more than one dimension is requested, just return the first one found.

API Level: 3
View Source

CalculateChildSizeBase(View, DimensionType)

Calculates the size for a child using the base view object.

Declaration
C#
Copy
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
System.Single

Return the calculated size for the given dimension. If more than one dimension is requested, just return the first one found.

API Level: 3
View Source

CreateTransition(TransitionData)

Creates a transition effect on the control.

Declaration
C#
Copy
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.

API Level: 3
View Source

EmitFocusSignal(Boolean)

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
C#
Copy
protected void EmitFocusSignal(bool focusGained)
Parameters
Type Name Description
Boolean focusGained

True if gained, false if lost.

API Level: 3
View Source

EnableGestureDetection(Gesture.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
C#
Copy
public void EnableGestureDetection(Gesture.GestureType type)
Parameters
Type Name Description
Gesture.GestureType type

The gesture type(s) to enable.

API Level: 3
View Source

EnableVisual(Int32, Boolean)

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
C#
Copy
protected void EnableVisual(int index, bool enable)
Parameters
Type Name Description
Int32 index

The property index of the visual, used to reference visual.

Boolean enable

Flag set to enabled or disabled.

API Level: 3
View Source

GetHeightForWidth(Single)

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
C#
Copy
[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
System.Single width

Width to use

Returns
Type Description
System.Single

The height based on the width

API Level: 3
View Source

GetHeightForWidthBase(Single)

Provides the view implementation of GetHeightForWidth.

Declaration
C#
Copy
protected float GetHeightForWidthBase(float width)
Parameters
Type Name Description
System.Single width

The width to use.

Returns
Type Description
System.Single

The height based on the width.

API Level: 3
View Source

GetNaturalSize()

Returns the natural size of the view.

Declaration
C#
Copy
public virtual Size2D GetNaturalSize()
Returns
Type Description
Size2D

The view's natural size

API Level: 3
View Source

GetNextFocusableView(View, View.FocusDirection, Boolean)

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
C#
Copy
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.

Boolean 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.

API Level: 3
View Source

GetVisual(Int32)

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
C#
Copy
protected VisualBase GetVisual(int index)
Parameters
Type Name Description
Int32 index

The property index of the visual used to reference visual.

Returns
Type Description
VisualBase

The registered visual if exists, otherwise an empty handle.

API Level: 3
View Source

GetWidthForHeight(Single)

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
C#
Copy
[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
System.Single height

Height to use

Returns
Type Description
System.Single

The width based on the width

API Level: 3
View Source

GetWidthForHeightBase(Single)

Provides the view implementation of GetWidthForHeight.

Declaration
C#
Copy
protected float GetWidthForHeightBase(float height)
Parameters
Type Name Description
System.Single height

The height to use.

Returns
Type Description
System.Single

The width based on the height.

API Level: 3
View Source

IsVisualEnabled(Int32)

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
C#
Copy
protected bool IsVisualEnabled(int index)
Parameters
Type Name Description
Int32 index

The property index of the visual.

Returns
Type Description
Boolean

Whether visual is enabled or not.

API Level: 3
View Source

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
C#
Copy
public virtual void OnCalculateRelayoutSize(DimensionType dimension)
Parameters
Type Name Description
DimensionType dimension

The dimension that is about to be calculated.

API Level: 3
View Source

OnChildAdd(View)

Called after a child has been added to the owning view.

Declaration
C#
Copy
public virtual void OnChildAdd(View view)
Parameters
Type Name Description
View view

The child which has been added.

API Level: 3
View Source

OnChildRemove(View)

Called after the owning view has attempted to remove a child( regardless of whether it succeeded or not ).

Declaration
C#
Copy
public virtual void OnChildRemove(View view)
Parameters
Type Name Description
View view

The child being removed.

API Level: 3
View Source

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
C#
Copy
public virtual void OnFocusChangeCommitted(View commitedFocusableView)
Parameters
Type Name Description
View commitedFocusableView

The commited focused view.

API Level: 3
View Source

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
C#
Copy
public virtual void OnFocusGained()
API Level: 3
View Source

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
C#
Copy
public virtual void OnFocusLost()
API Level: 3
View Source

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
C#
Copy
public virtual bool OnHover(Hover hover)
Parameters
Type Name Description
Hover hover

The hover event.

Returns
Type Description
Boolean

True if the hover event should be consumed.

API Level: 3
View Source

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
C#
Copy
public virtual void OnInitialize()
API Level: 3
View Source

OnKey(Key)

Called after a key event is received by the view that has had its focus set.

Declaration
C#
Copy
public virtual bool OnKey(Key key)
Parameters
Type Name Description
Key key

The key event.

Returns
Type Description
Boolean

True if the key event should be consumed.

API Level: 3
View Source

OnKeyboardEnter()

This method is called when the control has enter pressed on it.
Derived classes should override this to perform custom actions.

Declaration
C#
Copy
public virtual bool OnKeyboardEnter()
Returns
Type Description
Boolean

True if this control supported this action.

API Level: 3
View Source

OnLayoutNegotiated(Single, DimensionType)

The virtual method to notify deriving classes that the size for a dimension has just been negotiated.

Declaration
C#
Copy
public virtual void OnLayoutNegotiated(float size, DimensionType dimension)
Parameters
Type Name Description
System.Single size

The new size for the given dimension.

DimensionType dimension

The dimension that was just negotiated.

API Level: 3
View Source

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
C#
Copy
public virtual void OnPan(PanGesture pan)
Parameters
Type Name Description
PanGesture pan

The pan gesture.

API Level: 3
View Source

OnPropertySet(Int32, PropertyValue)

Called when the owning view property is set.

Declaration
C#
Copy
public virtual void OnPropertySet(int index, PropertyValue propertyValue)
Parameters
Type Name Description
Int32 index

The property index that was set.

PropertyValue propertyValue

The value to set.

API Level: 3
View Source

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
C#
Copy
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.

API Level: 3
View Source

OnSceneConnection(Int32)

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
C#
Copy
public virtual void OnSceneConnection(int depth)
Parameters
Type Name Description
Int32 depth

The depth in the hierarchy for the view.

API Level: 8
View Source

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
C#
Copy
public virtual void OnSceneDisconnection()
API Level: 8
View Source

OnSetResizePolicy(ResizePolicyType, DimensionType)

Notification for deriving classes.

Declaration
C#
Copy
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.

API Level: 3
View Source

OnSizeAnimation(Animation, Vector3)

Called when the owning view's size is animated, for example, using Animation::AnimateTo( Property ( view, View::Property::SIZE ), ... ).

Declaration
C#
Copy
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.

API Level: 3
View Source

OnSizeSet(Vector3)

Called when the owning view's size is set, for example, using View.SetSize().

Declaration
C#
Copy
public virtual void OnSizeSet(Vector3 targetSize)
Parameters
Type Name Description
Vector3 targetSize

The target size.

API Level: 3
View Source

OnStageConnection(Int32)

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
C#
Copy
[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
Int32 depth

The depth in the hierarchy for the view.

API Level: 3
View Source

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
C#
Copy
[Obsolete("This has been deprecated since API8 and will be removed in API10. Use OnSceneDisconnection instead.")] public virtual void OnStageDisconnection()
API Level: 3
View Source

OnStyleChange(StyleManager, StyleChangeType)

This method should be overridden by deriving classes requiring notifications when the style changes.

Declaration
C#
Copy
[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.

API Level: 3
View Source

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
C#
Copy
public virtual void OnTap(TapGesture tap)
Parameters
Type Name Description
TapGesture tap

The tap gesture.

API Level: 3
View Source

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
C#
Copy
public virtual bool OnTouch(Touch touch)
Parameters
Type Name Description
Touch touch

The touch event.

Returns
Type Description
Boolean

True if the event should be consumed.

API Level: 3
View Source

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
C#
Copy
public virtual bool OnWheel(Wheel wheel)
Parameters
Type Name Description
Wheel wheel

The wheel event.

Returns
Type Description
Boolean

True if the wheel event should be consumed.

API Level: 3
View Source

RegisterVisual(Int32, 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
C#
Copy
protected void RegisterVisual(int index, VisualBase visual)
Parameters
Type Name Description
Int32 index

The property index of the visual used to reference visual.

VisualBase visual

The visual to register.

API Level: 3
View Source

RegisterVisual(Int32, VisualBase, Boolean)

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
C#
Copy
protected void RegisterVisual(int index, VisualBase visual, bool enabled)
Parameters
Type Name Description
Int32 index

The property index of the visual used to reference visual.

VisualBase visual

The visual to register.

Boolean enabled

False if derived class wants to control when the visual is set on the stage.

API Level: 3
View Source

RelayoutDependentOnChildren()

Determines if this view is dependent on it's children for relayout from the base class.

Declaration
C#
Copy
public virtual bool RelayoutDependentOnChildren()
Returns
Type Description
Boolean

Return true if the view is dependent on it's children.

API Level: 3
View Source

RelayoutDependentOnChildren(DimensionType)

Determines if this view is dependent on it's children for relayout.

Declaration
C#
Copy
public virtual bool RelayoutDependentOnChildren(DimensionType dimension)
Parameters
Type Name Description
DimensionType dimension

The dimension(s) to check for.

Returns
Type Description
Boolean

Return if the view is dependent on it's children.

API Level: 3
View Source

RelayoutDependentOnChildrenBase()

Determines if this view is dependent on it's children for relayout from the base class.

Declaration
C#
Copy
protected bool RelayoutDependentOnChildrenBase()
Returns
Type Description
Boolean

Return if the view is dependent on it's children.

API Level: 3
View Source

RelayoutDependentOnChildrenBase(DimensionType)

Determines if this view is dependent on it's children for relayout from the base class.

Declaration
C#
Copy
protected bool RelayoutDependentOnChildrenBase(DimensionType dimension)
Parameters
Type Name Description
DimensionType dimension

The dimension(s) to check for.

Returns
Type Description
Boolean

Return if the view is dependent on it's children.

API Level: 3
View Source

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
C#
Copy
protected void RelayoutRequest()
API Level: 3
View Source

SetBackground(PropertyMap)

Sets the background with a property map.

Declaration
C#
Copy
public void SetBackground(PropertyMap map)
Parameters
Type Name Description
PropertyMap map

The background property map.

API Level: 3
View Source

UnregisterVisual(Int32)

Erases the entry matching the given index from the list of registered visuals.

Declaration
C#
Copy
protected void UnregisterVisual(int index)
Parameters
Type Name Description
Int32 index

The property index of the visual used to reference visual.

API Level: 3

Implements

System.ComponentModel.INotifyPropertyChanged
System.IDisposable