Kanzi  3.9.9
Kanzi Engine C++ API
kanzi::Slider3D Class Reference

Use the Slider 3D node as a building block for a 3D UI control that lets the application user change a numerical value using a visual indicator between a minimum and a maximum value. More...

#include <kanzi/ui/node/slider3d.hpp>

Inheritance diagram for kanzi::Slider3D:
[legend]

Public Types

typedef Slider3DConceptImplType ConceptClass
 Slider concept implementation, defining the base class (Component) and presenter (TrajectoryLayout3D). More...
 
typedef Slider3DPresenterType PresenterClass
 
- Public Types inherited from kanzi::Slider3DConceptImpl< TBaseClass, TPresenterClass, TDerivedClass >
typedef shared_ptr< TPresenterClass > PresenterSharedPtr
 

Static Public Member Functions

static Slider3DSharedPtr create (Domain *domain, string_view name)
 Creates a Slider3D node. More...
 
static PropertyTypeEditorInfoSharedPtr makeEditorInfo ()
 
- Static Public Member Functions inherited from kanzi::Slider3DConceptImpl< TBaseClass, TPresenterClass, TDerivedClass >
static PropertyTypeEditorInfoSharedPtr makeEditorInfo ()
 
- Static Public Member Functions inherited from kanzi::SliderConcept
static PropertyTypeEditorInfoSharedPtr makeEditorInfo ()
 

Protected Member Functions

 Slider3D (Domain *domain, string_view name)
 Constructor. More...
 
- Protected Member Functions inherited from kanzi::Slider3DConceptImpl< TBaseClass, TPresenterClass, TDerivedClass >
void arrangeOverride (Vector3 actualSize) override
 KzuUiComponent::arrangeOverride() implementation. More...
 
void findLayout ()
 
Vector3 measureOverride (Vector3 availableSize) override
 KzuUiComponent::measureOverride() implementation. More...
 
void onAttached () override
 

Additional Inherited Members

- Public Member Functions inherited from kanzi::Slider3DConceptImpl< TBaseClass, TPresenterClass, TDerivedClass >
float getMaxDistanceFromCurve () const
 Gets the value of MaxDistanceFromCurveProperty. More...
 
const PresenterSharedPtrgetPresenter () const
 
void hitPointChanged ()
 
void initialize ()
 
void setMaxDistanceFromCurve (float value)
 Sets the value of MaxDistanceFromCurveProperty. More...
 
 Slider3DConceptImpl (Domain *domain, string_view name)
 
 ~Slider3DConceptImpl () override
 
- Static Public Attributes inherited from kanzi::SliderConcept
static PropertyType< float > MaxDistanceFromCurveProperty
 MaxDistanceFromCurve property. More...
 

Detailed Description

Use the Slider 3D node as a building block for a 3D UI control that lets the application user change a numerical value using a visual indicator between a minimum and a maximum value.

To disable a Slider 3D node, set the Node::EnabledProperty to false. A disabled Slider 3D does not respond to input. To visually indicate the disabled state of a Slider 3D node, create a state manager and use the Node::EffectivelyEnabledProperty as its controller property. When Kanzi disables a Slider 3D node, it cancels current gestures and preserves the slider value.

Examples

To create a Slider 3D node with a custom appearance:

// Create a Slider 3D node named Custom 3D slider.
Slider3DSharedPtr slider3d = Slider3D::create(domain, "Custom 3D slider");
// Add the Slider 3D node to the Scene node.
scene->addChild(slider3d);
// Set the size of the Slider 3D node to be 4 device independent units wide,
// 2 device independent units high, and 1 device independent unit deep.
slider3d->setWidth(4.0f);
slider3d->setHeight(2.0f);
slider3d->setDepth(1.0f);
// Use the Trajectory Layout 3D node to define the rail along which the knob of the slider moves.
// Create a Trajectory Layout 3D node named Slider rail.
TrajectoryLayout3DSharedPtr trajectoryLayout = TrajectoryLayout3D::create(domain, "Slider rail");
// Use the Sphere node to define the look of the knob that moves on the slider rail.
// Create a blue Sphere node named Slider knob whose radius is 1 device independent unit.
Model3DSharedPtr sliderKnob = Model3D::createSphere(domain, "Slider knob", 1.0f, 20, 20, ThemeBlue);
// Set the Sphere node to be the child of the trajectoryLayout Trajectory Layout 3D node.
trajectoryLayout->addChild(sliderKnob);
// Add the layout as a child node of the Slider 3D node.
// You can place the Trajectory Layout 3D node that defines the rail anywhere
// in the node tree and it does not have to be the direct child of the Slider 3D node.
slider3d->addChild(trajectoryLayout);
// The knob movement on the rail is based on modifying the TrajectoryLayout3D::StaticTrajectoryOffsetProperty
// which is set based on the Slider3D::ValueProperty.
// "../.." is the path from the knob (Sphere node) to the Slider 3D node.
AbstractBindingSharedPtr binding = Binding::create("../..", Slider3D::ValueProperty, PropertyFieldWhole);
// Add to the knob the binding that enables the knob to move on the rail.
// Create an alias pointing to the Trajectory Layout 3D node that defines the slider rail.
ResourceID alias("$layout");
string path("obj:///" + trajectoryLayout->getName());
// Add the alias to the resource dictionary of the Slider 3D node.
slider3d->addResource(alias, path);
// Create the trajectory of the Trajectory Layout 3D node that is used as the rail of the Slider 3D node.
// Create a line trajectory on the x axis, that is 5 device independent units long, and name it Line trajectory.
TrajectorySharedPtr trajectory = Trajectory::createLine(Vector3(), Vector3(1.0f, 0.0f, 0.0f), 5.0f, domain, "Line trajectory");
// Set the Trajectory Layout 3D node to use the line trajectory.
trajectoryLayout->setTrajectory(trajectory);
// Set the Trajectory Layout 3D node so that it sets its size
// based on the size of its parent node (in this case the Slider 3D node).
trajectoryLayout->setHorizontalAlignment(Node::HorizontalAlignmentStretch);
trajectoryLayout->setVerticalAlignment(Node::VerticalAlignmentStretch);
trajectoryLayout->setDepthAlignment(Node::DepthAlignmentStretch);

Member Typedef Documentation

Slider concept implementation, defining the base class (Component) and presenter (TrajectoryLayout3D).

Constructor & Destructor Documentation

kanzi::Slider3D::Slider3D ( Domain domain,
string_view  name 
)
explicitprotected

Constructor.

Parameters
domainThe UI domain the new node belongs to.
nameThe name of the node.

Member Function Documentation

static Slider3DSharedPtr kanzi::Slider3D::create ( Domain domain,
string_view  name 
)
static

Creates a Slider3D node.

Parameters
domainThe UI domain the new node belongs to.
nameThe name of the stack layout.
static PropertyTypeEditorInfoSharedPtr kanzi::Slider3D::makeEditorInfo ( )
static

The documentation for this class was generated from the following file: