Class CustomView

Definition

Namespace:
Tizen.NUI.BaseComponents
Assembly:
Tizen.NUI.dll

CustomView provides some common functionality required by all views.

C#
Copy
public class CustomView : ViewWrapper, INotifyPropertyChanged, IDisposable
Inheritance
object
Tizen.NUI.Binding.BindableObject
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
string typeName

typename

CustomViewBehaviour behaviour

CustomView Behaviour

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
bool

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

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
bool

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
float

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

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
float

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

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.

View Source

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

True if gained, false if lost.

View Source

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

The gesture type(s) to enable.

View Source

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

View Source

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

View Source

GetHeightForWidthBase(float)

Provides the view implementation of GetHeightForWidth.

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

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

View Source

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

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 an empty handle if no view can be focused.

View Source

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

View Source

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

View Source

GetWidthForHeightBase(float)

Provides the view implementation of GetWidthForHeight.

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

View Source

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

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.

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.

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.

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.

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()
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()
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
bool

True if the hover event should be consumed.

View Source

OnInitialize()

This method is called after the control has been initialized.
Derived classes should do any second phase initialization by overriding this method.

Declaration
C#
Copy
public virtual void OnInitialize()
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
bool

True if the key event should be consumed.

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
bool

True if this control supported this action.

View Source

OnLayoutNegotiated(float, 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
float size

The new size for the given dimension.

DimensionType dimension

The dimension that was just negotiated.

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.

View Source

OnPropertySet(int, PropertyValue)

Called when the owning view property is set.

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

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.

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.

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.

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.

View Source

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

The depth in the hierarchy for the view.

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
public virtual void OnStageDisconnection()
View Source

OnStyleChange(StyleManager, StyleChangeType)

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

Declaration
C#
Copy
public virtual void OnStyleChange(StyleManager styleManager, StyleChangeType change)
Parameters
Type Name Description
StyleManager styleManager

The StyleManager object.

StyleChangeType change

Information denoting what has changed.

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.

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
bool

True if the event should be consumed.

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
bool

True if the wheel event should be consumed.

View Source

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

View Source

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

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
bool

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

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
bool

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

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
bool

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

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
bool

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

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()
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.

View Source

UnregisterVisual(int)

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
int index

The property index of the visual used to reference visual.

Implements

System.ComponentModel.INotifyPropertyChanged
System.IDisposable