kanzi::Slider2D Class Reference

Examples

More...

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

Inheritance diagram for kanzi::Slider2D:
kanzi::Slider2DConceptImpl< TBaseClass, TPresenterClass, TDerivedClass > kanzi::SliderConcept

Public Types

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

Static Public Member Functions

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

Protected Member Functions

 Slider2D (Domain *domain, string_view name)
 Constructor. More...
 
- Protected Member Functions inherited from kanzi::Slider2DConceptImpl< TBaseClass, TPresenterClass, TDerivedClass >
virtual void onNodePropertyChanged (AbstractPropertyType propertyType, PropertyNotificationReason reason) KZ_OVERRIDE
 
void findLayout ()
 
virtual void onAttached () KZ_OVERRIDE
 
virtual Vector2 measureOverride (Vector2 availableSize) KZ_OVERRIDE
 Node2D::measureOverride() implementation. More...
 
virtual void arrangeOverride (Vector2 actualSize) KZ_OVERRIDE
 Node2D::arrangeOverride() implementation. More...
 

Additional Inherited Members

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

Detailed Description

Examples

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

// Create a Slider 2D node named Custom 2D slider.
Slider2DSharedPtr slider = Slider2D::create(domain, "Custom 2D slider");
// Set the size of the Slider 2D node to be 400 pixels wide and 200 pixels high.
slider->setSize(400.0f, 200.0f);
// Use the Trajectory Layout 2D node to define the rail along which the knob of the slider moves.
// Create a Trajectory Layout 2D node named Slider rail.
TrajectoryLayout2DSharedPtr trajectoryLayout = TrajectoryLayout2D::create(domain, "Slider rail");
// Use the Image node to define the look of the knob that moves on the slider rail.
// Create an Image node named Slider knob.
Image2DSharedPtr knob = Image2D::create(domain, "Slider knob");
// Set the Image node to be the child of the trajectoryLayout Trajectory Layout 2D node.
trajectoryLayout->addChild(knob);
// Create an alias pointing to the Trajectory Layout 2D node that defines the slider rail.
ResourceID alias("$layout");
string path("obj:///" + trajectoryLayout->getName());
// Add the alias to the resource dictionary of the Slider 2D node.
slider->addResource(alias, path);
// Add the layout as a child node of the Slider 2D node.
// You can place the Trajectory Layout 2D node that defines the rail anywhere
// in the scene graph and it does not have to be the direct child of the Slider 2D node.
slider->addChild(trajectoryLayout);
// Create the trajectory of the Trajectory Layout 2D node that is used as the rail of the Slider 2D node.
// Create a line trajectory on the x axis, that is 350 pixels long, and name it Line trajectory.
TrajectorySharedPtr trajectory = Trajectory::createLine(Vector3(), Vector3(1.0f, 0.0f, 0.0f), 350.0f, domain, "Line trajectory");
// Set the Trajectory Layout 2D node to use the line trajectory.
trajectoryLayout->setTrajectory(trajectory);
// Set the Trajectory Layout 2D node so that it sets its size
// based on the size of its parent node (in this case the Slider 2D node).
trajectoryLayout->setHorizontalAlignment(Node::HorizontalAlignmentStretch);
trajectoryLayout->setVerticalAlignment(Node::VerticalAlignmentStretch);
// The knob movement on the rail is based on modifying the TrajectoryLayout2D::StaticTrajectoryOffsetProperty
// which is set based on the Slider2D::ValueProperty.
// "../.." is the path from the knob (Image node) to the Slider 2D node.
// Add the Slider 2D node to the Viewport 2D node.
viewportNode->addChild(slider);
// Get the knob instance from the instance of the prefab template.
Node2DSharedPtr knobInstance = slider->getPresenter()->getLayout()->getChild(0);
// Add to the knob the binding that enables the knob to move on the rail.
knobInstance->addBinding(binding);

Member Typedef Documentation

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

Constructor & Destructor Documentation

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

Constructor.

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

Member Function Documentation

static Slider2DSharedPtr kanzi::Slider2D::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::Slider2D::makeEditorInfo ( )
static

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