Kanzi Graphics Engine
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
kzu_ui_scroll_view.h File Reference

Implements a scroll view user interface component. More...

Functions

kzsError kzuUiScrollViewCreate (const struct KzcMemoryManager *memoryManager, kzString name, struct KzuUIDomain *uiDomain, struct KzuUiScrollView **out_scrollView)
 Creates a scroll view with default settings. More...
 
kzsError kzuUiScrollViewRegisterToFactory (const struct KzuFactory *factory)
 Registers component type to factory. More...
 
kzsError kzuUiScrollViewSetAxisEnabledX (struct KzuUiScrollView *scrollView, kzBool state)
 Enable or disable X axis handling. More...
 
kzsError kzuUiScrollViewSetAxisEnabledY (struct KzuUiScrollView *scrollView, kzBool state)
 Enable or disable Y axis handling. More...
 
void kzuUiScrollViewSetLoopingX (const struct KzuUiScrollView *scrollView, kzBool state)
 Set scroll value to loop between bounds, in X axis. More...
 
void kzuUiScrollViewSetLoopingY (const struct KzuUiScrollView *scrollView, kzBool state)
 Set scroll value to loop between bounds, in Y axis. More...
 
void kzuUiScrollViewSetScrollBoundsX (const struct KzuUiScrollView *scrollView, kzFloat minimum, kzFloat maximum)
 Sets bounds for X axis for scroll. More...
 
void kzuUiScrollViewSetScrollBoundsY (const struct KzuUiScrollView *scrollView, kzFloat minimum, kzFloat maximum)
 Sets bounds for Y axis for scroll. More...
 
kzsError kzuUiScrollViewJumpToPosition (struct KzuUiScrollView *scrollView, const struct KzcVector2 *scrollPosition)
 Sets new scroll target value for the scroll view and jumps to it immediately. More...
 
kzsError kzuUiScrollViewScrollToPosition (struct KzuUiScrollView *scrollView, const struct KzcVector2 *scrollTarget)
 Sets new scroll target for the scroll view and start scrolling towards the target. More...
 
kzsError kzuUiScrollViewScrollToPositionLooping (struct KzuUiScrollView *scrollView, const struct KzcVector2 *scrollTarget)
 Sets new scroll target for the scroll view and start scrolling towards the target. More...
 
kzsError kzuUiScrollViewGetScroll (const struct KzuUiScrollView *scrollView, struct KzcVector2 *out_scrollPosition)
 Gets the current scroll value of the scroll view. More...
 
kzsError kzuUiScrollViewGetScrollTarget (const struct KzuUiScrollView *scrollView, struct KzcVector2 *out_scrollTarget)
 Gets the current scroll target of the scroll view. More...
 
kzsError kzuUiScrollViewGetScrollTargetLooping (const struct KzuUiScrollView *scrollView, struct KzcVector2 *out_scrollTarget)
 Gets the current scroll target of the scroll view. More...
 
kzsError kzuUiScrollViewRefreshScrollConfiguration (struct KzuUiScrollView *scrollView)
 Updates scrolling configuration. More...
 
kzsError kzuUiScrollViewRefreshThreshold (const struct KzuUiScrollView *scrollView)
 Updates recognition threshold. More...
 
struct KzuUiComponentNodekzuUiScrollViewToUiComponentNode (const struct KzuUiScrollView *scrollView)
 Casts to UiComponentNode. More...
 
struct KzuUiScrollViewkzuUiScrollViewFromUiComponentNode (const struct KzuUiComponentNode *component)
 Casts to UiScrollView. More...
 

Variables

const KzuObjectType KZU_OBJECT_TYPE_UI_SCROLL_VIEW
 Object type for scroll view. More...
 

Detailed Description

Implements a scroll view user interface component.

Scroll View Messages

KZU_MESSAGE_SCROLL_VIEW_SCROLLED message is sent periodically while the scroll view is scrolling. It has two KzcVector2 arguments, KZU_MESSAGE_ARGUMENT__SCROLL_VIEW__SCROLL_POSITION telling the current scroll position and KZU_MESSAGE_ARGUMENT__SCROLL_VIEW__SCROLL_SPEED telling the current scrolling speed, and two float arguments KZU_MESSAGE_ARGUMENT__SCROLL_VIEW__SCROLL_POSITION_X and KZU_MESSAGE_ARGUMENT__SCROLL_VIEW__SCROLL_POSITION_Y telling the same scroll position (notice that the float arguments could be removed in the future).

KZU_MESSAGE_SCROLL_VIEW_SNAP_REQUEST message is sent after panning of the scroll view has ended. It has two KzcVector2 arguments: KZU_MESSAGE_ARGUMENT__SCROLL_VIEW__SNAP_POSITION which tells the end position of the pan and KZU_MESSAGE_ARGUMENT__SCROLL_VIEW__SNAP_DIRECTION which tells the direction to where the panning happened.

KZU_MESSAGE_SCROLL_VIEW_SCROLL_STARTED message is sent when the scroll view starts scrolling. It has the same arguments as the KZU_MESSAGE_SCROLL_VIEW_SCROLLED message.

KZU_MESSAGE_SCROLL_VIEW_SCROLL_FINISHED message is sent when the scroll view stopped scrolling. It has the same arguments as the KZU_MESSAGE_SCROLL_VIEW_SCROLLED message.

KZU_MESSAGE_SCROLL_VIEW_USER_SCROLL_STARTED message is sent when the user starts panning the scroll view. It has the same arguments as the KZU_MESSAGE_SCROLL_VIEW_SCROLLED message.

KZU_MESSAGE_SCROLL_VIEW_USER_SCROLL_FINISHED message is sent when the user stopped panning the scroll view. It has the same arguments as the KZU_MESSAGE_SCROLL_VIEW_SCROLLED message.

Scroll View Properties

KZU_PROPERTY_TYPE_SCROLL_VIEW_SCROLLING Boolean property is set by the scroll view to KZ_TRUE when the scroll view is scrolling (moving the content), otherwise KZ_FALSE.

KZU_PROPERTY_TYPE_SCROLL_VIEW_SCROLL_POSITION KzcVector2 property is set by the scroll view to indicate the current scroll position.

KZU_PROPERTY_TYPE_SCROLL_VIEW_SCROLL_SPEED KzcVector2 property is set by the scroll view to indicate the current scrolling speed.

KZU_PROPERTY_TYPE_SCROLL_VIEW_SCROLL_TARGET_POSITION KzcVector2 property is set by the scroll view to indicate the current scroll target (i.e. to where scrolling is happening).

KZU_PROPERTY_TYPE_SCROLL_VIEW_SCROLL_AXIS KzcVector2 property specifies what is the direction of the scroll view's X-axis. This has an effect on the coordinates sent out from the scroll view. The default value is {1.0, 0}.

KZU_PROPERTY_TYPE_SCROLL_VIEW_RECOGNITION_THRESHOLD float property specifies how much the pointing device has to move before the scrolling starts. The default value is 5.0.

KZU_PROPERTY_TYPE_SCROLL_VIEW_SENSITIVITY float property acts as a multiplier for the scrolling distance relative to the pointing device movement. The default value is 1.0.

KZU_PROPERTY_TYPE_SCROLL_VIEW_SLIDING_ACCELERATION_COEFFICIENT float property specifies how fast scrolling accelerates when sliding. The default value is 40.0.

KZU_PROPERTY_TYPE_SCROLL_VIEW_SLIDING_DRAG_COEFFICIENT float property specifies how much drag affects scrolling when sliding. The default value is 80.0.

KZU_PROPERTY_TYPE_SCROLL_VIEW_DRAGGING_ACCELERATION_COEFFICIENT float property specifies how fast scrolling accelerates when dragging. The value should be in the range [0, 500.0]. The default value is 80.0.

KZU_PROPERTY_TYPE_SCROLL_VIEW_DRAGGING_DRAG_COEFFICIENT float property specifies how much drag affects scrolling when dragging. The value should be in the range [0, 500.0]. The default value is 150.0.

KZU_PROPERTY_TYPE_SCROLL_VIEW_DRAGGING_IMPULSE_FACTOR float property specifies how much impulse is generated by the pointing device movement when dragging. The default value is 2.0.

KZU_PROPERTY_TYPE_SCROLL_VIEW_SWIPE_DISTANCE float property specifies how much a swipe affects the scrolling distance, relative to the speed of the swipe. The default value is 0.005.

Copyright 2008-2019 by Rightware. All rights reserved.

Function Documentation

kzsError kzuUiScrollViewCreate ( const struct KzcMemoryManager memoryManager,
kzString  name,
struct KzuUIDomain uiDomain,
struct KzuUiScrollView **  out_scrollView 
)

Creates a scroll view with default settings.

kzsError kzuUiScrollViewRegisterToFactory ( const struct KzuFactory factory)

Registers component type to factory.

kzsError kzuUiScrollViewSetAxisEnabledX ( struct KzuUiScrollView scrollView,
kzBool  state 
)

Enable or disable X axis handling.

kzsError kzuUiScrollViewSetAxisEnabledY ( struct KzuUiScrollView scrollView,
kzBool  state 
)

Enable or disable Y axis handling.

void kzuUiScrollViewSetLoopingX ( const struct KzuUiScrollView scrollView,
kzBool  state 
)

Set scroll value to loop between bounds, in X axis.

void kzuUiScrollViewSetLoopingY ( const struct KzuUiScrollView scrollView,
kzBool  state 
)

Set scroll value to loop between bounds, in Y axis.

void kzuUiScrollViewSetScrollBoundsX ( const struct KzuUiScrollView scrollView,
kzFloat  minimum,
kzFloat  maximum 
)

Sets bounds for X axis for scroll.

The scroll value can be dragged past them temporarily if not looped.

void kzuUiScrollViewSetScrollBoundsY ( const struct KzuUiScrollView scrollView,
kzFloat  minimum,
kzFloat  maximum 
)

Sets bounds for Y axis for scroll.

The scroll value can be dragged past them temporarily if not looped.

kzsError kzuUiScrollViewJumpToPosition ( struct KzuUiScrollView scrollView,
const struct KzcVector2 scrollPosition 
)

Sets new scroll target value for the scroll view and jumps to it immediately.

kzsError kzuUiScrollViewScrollToPosition ( struct KzuUiScrollView scrollView,
const struct KzcVector2 scrollTarget 
)

Sets new scroll target for the scroll view and start scrolling towards the target.

If a scroll view's axis is looping in an interval, its corresponding coordinate may be out of the interval to indicate e.g. scrolling direction.

kzsError kzuUiScrollViewScrollToPositionLooping ( struct KzuUiScrollView scrollView,
const struct KzcVector2 scrollTarget 
)

Sets new scroll target for the scroll view and start scrolling towards the target.

If a scroll view's axis is looping in an interval, the shortest path to the target value is chosen.

kzsError kzuUiScrollViewGetScroll ( const struct KzuUiScrollView scrollView,
struct KzcVector2 out_scrollPosition 
)

Gets the current scroll value of the scroll view.

If a scroll view's axis is looping in an interval, its corresponding coordinate is normalized to be inside the interval.

kzsError kzuUiScrollViewGetScrollTarget ( const struct KzuUiScrollView scrollView,
struct KzcVector2 out_scrollTarget 
)

Gets the current scroll target of the scroll view.

If a scroll view's axis is looping in an interval, its corresponding coordinate may be out of the interval to indicate e.g. scrolling direction.

kzsError kzuUiScrollViewGetScrollTargetLooping ( const struct KzuUiScrollView scrollView,
struct KzcVector2 out_scrollTarget 
)

Gets the current scroll target of the scroll view.

If a scroll view's axis is looping in an interval, its corresponding coordinate is normalized to be inside the interval.

kzsError kzuUiScrollViewRefreshScrollConfiguration ( struct KzuUiScrollView scrollView)

Updates scrolling configuration.

kzsError kzuUiScrollViewRefreshThreshold ( const struct KzuUiScrollView scrollView)

Updates recognition threshold.

struct KzuUiComponentNode* kzuUiScrollViewToUiComponentNode ( const struct KzuUiScrollView scrollView)

Casts to UiComponentNode.

struct KzuUiScrollView* kzuUiScrollViewFromUiComponentNode ( const struct KzuUiComponentNode component)

Casts to UiScrollView.

Variable Documentation

const KzuObjectType KZU_OBJECT_TYPE_UI_SCROLL_VIEW

Object type for scroll view.