X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Fdevel-api%2Fvisual-factory%2Fvisual-base.h;h=49e8cf09d896a86ae9b79a8d721085133dd0bcf4;hp=74ca64090d8fbd291672945b2a2e5b2ebf44b682;hb=69c1b01cea4af86aa3e5ba0087485c9bd76942ca;hpb=c3f9162ab11786380e2ec9c55f217c2daf7722e8 diff --git a/dali-toolkit/devel-api/visual-factory/visual-base.h b/dali-toolkit/devel-api/visual-factory/visual-base.h index 74ca640..49e8cf0 100644 --- a/dali-toolkit/devel-api/visual-factory/visual-base.h +++ b/dali-toolkit/devel-api/visual-factory/visual-base.h @@ -38,11 +38,47 @@ class Base; namespace Visual { /** - * @brief Visual provides a renderer for rendering the controls. A control may have multiple visuals. + * @brief A Visual provides a renderer for drawing a control component. A control may have multiple visuals. * - * Visuals reuses geometry, shader etc. across controls and manages the renderer and texture sets to exist only when control is on-stage. - * It also responds to actor size and color change, and provides the clipping at the renderer level. + * Visuals reuse geometry, shader etc. across controls. They ensure that the renderer and texture sets exist only when control is on-stage. + * Each visual also responds to actor size and color change, and provides clipping at the renderer level. * Note: The visual responds to the the Actor::COLOR by blending it with the 'Multiply' operator. + * + * The following properties are optional, but can be supplied in the property map to Dali::Toolkit::VisualFactory::CreateVisual(). + * + * | %Property Name | Type | + * |-------------------------|------------------| + * | customShader | MAP | + * | transform | MAP | + * + * where \b customShader is a map with at least one of the following properties: + * | %Property Name | Type | Required | Default | Description | + * |-------------------------|------------------|----------|---------|-------------| + * | vertexShader | STRING | No | "" | Vertex shader code| + * | fragmentShader | STRING | No | "" | Fragment shader code| + * | subdivideGridX | INTEGER | No | 1 | How to subdivide the grid along X | + * | subdivideGridY | INTEGER | No | 1 | How to subdivide the grid along Y | + * | shaderHints | INTEGER or ARRAY of STRING | No | NONE | Bitmask of hints @sa Dali::Shader::Hint | + * + * and \b transform is a map with the following properties: + * | %Property Name | Type | Required | Default |Description | + * |-------------------------|------------------|----------|---------|------------| + * | offset | VECTOR2 | No | (0,0) | Offset of visual from origin | + * | size | VECTOR2 | No | (1,1) | size of visual | + * | origin | INTEGER or STRING | No | CENTER | origin of the visual @sa Dali::Toolkit::Align | + * | anchorPoint | INTEGER or STRING | No | CENTER | anchor point of the visual @sa Dali::Toolkit::Align | + * | offsetSizeMode | VECTOR4 | No | (0,0,0,0) | See below | + * + * + * offsetSizeMode describes whether the offset and the size are + * relative or absolute by using 0 or 1 respectively in the corresponding + * components (offsetSizeMode.xy for offset.xy; offsetSizeMode.zw for size.xy). + * + * Relative means that the component describes a factor of the parent control size; + * size.x = 1 means full width; size.y = 0.5 means half height. + * + * Absolute means that the component describes world units (equivalent to pixels) + * */ class DALI_IMPORT_API Base : public BaseHandle { @@ -76,6 +112,22 @@ public: Base& operator=( const Base& handle ); /** + * @brief Set the name of the visual + * + * Used by the styling system to animate properties + * @param[in] name The name to give the visual + */ + void SetName( const std::string& name ); + + /** + * @brief Get the name of the visual + * + * Used by the styling system to animate properties + * @return The name of the visual + */ + const std::string& GetName(); + + /** * @brief Set the size of the painting area. * * @param[in] size The size of the painting area. @@ -90,13 +142,22 @@ public: const Vector2& GetSize() const; /** + * @brief Returns the height for a given width. + * + * @param[in] width Width to use. + * + * @return The height based on the width. + */ + float GetHeightForWidth( float width ) const; + + /** * @brief Return the natural size of the visual. * * Deriving classes stipulate the natural size and by default a visual has a ZERO natural size. * * @param[out] naturalSize The visual's natural size */ - void GetNaturalSize( Vector2& naturalSize ) const; + void GetNaturalSize( Vector2& naturalSize ); /** * @brief Set the depth index of this visual. @@ -150,6 +211,23 @@ public: */ void CreatePropertyMap( Dali::Property::Map& map ) const; + /** + * @brief Sets the value of an existing property. + * + * @param [in] index The index of the property. + * @param [in] propertyValue The new value of the property. + */ + void SetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ); + + /** + * @brief Retrieves a property value. + * + * @param [in] index The index of the property. + * + * @return The property value. + */ + Dali::Property::Value GetProperty( Dali::Property::Index index ); + public: // Not intended for application developers explicit DALI_INTERNAL Base(Internal::Visual::Base *impl);