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

User interface slider. More...

Enumerations

enum  KzuUiSliderDirection { KZU_UI_SLIDER_DIRECTION_X, KZU_UI_SLIDER_DIRECTION_Y, KZU_UI_SLIDER_DIRECTION_Z }
 Slider direction. More...
 
enum  KzuUiSliderExpandDirection {
  KZU_UI_SLIDER_EXPAND_DIRECTION_X, KZU_UI_SLIDER_EXPAND_DIRECTION_Y, KZU_UI_SLIDER_EXPAND_DIRECTION_Z, KZU_UI_SLIDER_EXPAND_DIRECTION_ONLY_SLIDER_DIRECTION,
  KZU_UI_SLIDER_EXPAND_DIRECTION_NONE
}
 Slider expand direction. More...
 

Functions

kzsError kzuUiSliderCreate (const struct KzcMemoryManager *memoryManager, kzString name, struct KzuUIDomain *uiDomain, struct KzuUiSlider **out_slider)
 Creates a slider with default settings. More...
 
kzsError kzuUiSliderRegisterToFactory (const struct KzuFactory *factory)
 Registers component type to factory. More...
 
struct KzuUiComponentNodekzuUiSliderToUiComponentNode (const struct KzuUiSlider *slider)
 Casts to UiComponentNode. More...
 
struct KzuUiSliderkzuUiSliderFromUiComponentNode (const struct KzuUiComponentNode *component)
 Casts to UiSlider. More...
 
kzsError kzuUiSliderSetValueExternal (const struct KzuUiSlider *slider, kzFloat value)
 Sets the slider value. More...
 
struct KzuObjectNodekzuUiSliderGetKnob (const struct KzuUiSlider *slider)
 Gets the empty object node under which the slider knob must be placed. More...
 
struct KzuObjectNodekzuUiSliderGetBar (const struct KzuUiSlider *slider)
 Gets the empty object node under which the slider rail must be placed. More...
 
kzFloat kzuUiSliderGetValue (const struct KzuUiSlider *slider)
 Gets slider value. More...
 
kzsError kzuUiSliderSetValue (const struct KzuUiSlider *slider, kzFloat value)
 Sets the slider value. More...
 
enum KzuUiSliderExpandDirection kzuUiSliderGetExpandOnDragDirection (const struct KzuUiSlider *slider)
 Gets slider expand direction on drag. More...
 
kzsError kzuUiSliderSetExpandOnDragDirection (const struct KzuUiSlider *slider, enum KzuUiSliderExpandDirection direction)
 Sets slider expand direction on drag. More...
 
enum KzuUiSliderDirection kzuUiSliderGetDirection (const struct KzuUiSlider *slider)
 Gets slider direction. More...
 
kzsError kzuUiSliderSetDirection (const struct KzuUiSlider *slider, enum KzuUiSliderDirection direction)
 Sets slider direction. More...
 

Variables

const KzuObjectType KZU_OBJECT_TYPE_UI_SLIDER
 Object type for Slider. More...
 

Detailed Description

User interface slider.

KzuUiSlider is a layout that works with two children, a rail and a knob, which are the first and second child respectively. Normally the Kanzi Studio creates these children automatically as empty nodes, and other objects can then be set as children of these empty nodes. The knob moves along a user-specified axis, it is the KzuUiSlider user's job to make it look like it moves along the rail.

Slider Messages

KZU_MESSAGE_SLIDER_VALUE_CHANGED message is sent whenever the slider's value changes. It has one float argument KZU_MESSAGE_ARGUMENT__SLIDER__VALUE telling the slider's current value.

KZU_MESSAGE_SLIDER_DRAG_STARTED message is sent when the user starts to drag the slider. It has one float argument KZU_MESSAGE_ARGUMENT__SLIDER__VALUE telling the slider's current value.

KZU_MESSAGE_SLIDER_DRAG_FINISHED message is sent when the user stops dragging the slider. It has one float argument KZU_MESSAGE_ARGUMENT__SLIDER__VALUE telling the slider's current value.

The slider handles KZU_MESSAGE_SLIDER_INCREASE_VALUE message with one float argument KZU_MESSAGE_ARGUMENT__SET_PROPERTY__FLOAT_VALUE that is added to the slider's current value.

The slider handles KZU_MESSAGE_SLIDER_DECREASE_VALUE message with one float argument KZU_MESSAGE_ARGUMENT__SET_PROPERTY__FLOAT_VALUE that is subtracted from the slider's current value.

The slider handles KZU_MESSAGE_SLIDER_SET_VALUE message with one float argument KZU_MESSAGE_ARGUMENT__SET_PROPERTY__FLOAT_VALUE that will be set as the slider's current value.

Slider Properties

KZU_PROPERTY_TYPE_SLIDER_DIRECTION integer property can be set to change the movement axis of the slider. The value should be one of the values in KzuUiSliderDirection. The default value is KZU_UI_SLIDER_DIRECTION_X.

KZU_PROPERTY_TYPE_SLIDER_EXPAND_DIRECTION integer property can be set to expand the input sensitive area of the slider. The value should be one of the values in KzuUiSliderExpandDirection. If the value specifies an axis, that axis' coordinate is assumed to always hit the slider in input events.

KZU_PROPERTY_TYPE_SLIDER_MINIMUM_VALUE float property specifies the minimum slider value. The default value is 0.

KZU_PROPERTY_TYPE_SLIDER_MAXIMUM_VALUE float property specifies the minimum slider value. The default value is 1.

KZU_PROPERTY_TYPE_SLIDER_VALUE float property specifies the slider's value. It should be between the values of KZU_PROPERTY_TYPE_SLIDER_MINIMUM_VALUE and KZU_PROPERTY_TYPE_SLIDER_MAXIMUM_VALUE properties. The default value is 0.5. The property is changed by the slider itself when the knob is dragged but it can also be changed by the user.

KZU_PROPERTY_TYPE_SLIDER_INVERT_DIRECTION Boolean property can be set to swap the slider's minimum and maximum ends. The default value is KZ_FALSE.

Copyright 2008-2019 by Rightware. All rights reserved.

Enumeration Type Documentation

Slider direction.

Enumerator
KZU_UI_SLIDER_DIRECTION_X 

Slider direction X.

KZU_UI_SLIDER_DIRECTION_Y 

Slider direction Y.

KZU_UI_SLIDER_DIRECTION_Z 

Slider direction Z.

Slider expand direction.

Enumerator
KZU_UI_SLIDER_EXPAND_DIRECTION_X 

Slider expand direction X.

KZU_UI_SLIDER_EXPAND_DIRECTION_Y 

Slider expand direction Y.

KZU_UI_SLIDER_EXPAND_DIRECTION_Z 

Slider expand direction Z.

KZU_UI_SLIDER_EXPAND_DIRECTION_ONLY_SLIDER_DIRECTION 

Slider expand only in direction of sliders movement.

KZU_UI_SLIDER_EXPAND_DIRECTION_NONE 

Slider does not expand on drag.

Function Documentation

kzsError kzuUiSliderCreate ( const struct KzcMemoryManager memoryManager,
kzString  name,
struct KzuUIDomain uiDomain,
struct KzuUiSlider **  out_slider 
)

Creates a slider with default settings.

kzsError kzuUiSliderRegisterToFactory ( const struct KzuFactory factory)

Registers component type to factory.

struct KzuUiComponentNode* kzuUiSliderToUiComponentNode ( const struct KzuUiSlider slider)

Casts to UiComponentNode.

struct KzuUiSlider* kzuUiSliderFromUiComponentNode ( const struct KzuUiComponentNode component)

Casts to UiSlider.

kzsError kzuUiSliderSetValueExternal ( const struct KzuUiSlider slider,
kzFloat  value 
)

Sets the slider value.

The given value should be in range [0.0, 1.0], i.e. the the slider bounds and direction are ignored. Also sends a slider value changed message.

struct KzuObjectNode* kzuUiSliderGetKnob ( const struct KzuUiSlider slider)

Gets the empty object node under which the slider knob must be placed.

struct KzuObjectNode* kzuUiSliderGetBar ( const struct KzuUiSlider slider)

Gets the empty object node under which the slider rail must be placed.

kzFloat kzuUiSliderGetValue ( const struct KzuUiSlider slider)

Gets slider value.

kzsError kzuUiSliderSetValue ( const struct KzuUiSlider slider,
kzFloat  value 
)

Sets the slider value.

The given value should be in range [Slider Minimum Value, Slider Maximum Value].

enum KzuUiSliderExpandDirection kzuUiSliderGetExpandOnDragDirection ( const struct KzuUiSlider slider)

Gets slider expand direction on drag.

This is the hidden axis where the objects collision box is expanded when user drags slider.

kzsError kzuUiSliderSetExpandOnDragDirection ( const struct KzuUiSlider slider,
enum KzuUiSliderExpandDirection  direction 
)

Sets slider expand direction on drag.

This is the hidden axis where the objects collision box is expanded when user drags slider.

enum KzuUiSliderDirection kzuUiSliderGetDirection ( const struct KzuUiSlider slider)

Gets slider direction.

kzsError kzuUiSliderSetDirection ( const struct KzuUiSlider slider,
enum KzuUiSliderDirection  direction 
)

Sets slider direction.

Variable Documentation

const KzuObjectType KZU_OBJECT_TYPE_UI_SLIDER

Object type for Slider.