#ifndef DALI_SCENE_LOADER_GLTF2_ASSET_H_
#define DALI_SCENE_LOADER_GLTF2_ASSET_H_
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/index.h"
#include "dali-scene-loader/internal/json-reader.h"
+#include "dali-scene-loader/public-api/index.h"
// EXTERNAL INCLUDES
-#include "dali/public-api/math/vector4.h"
-#include "dali/public-api/math/quaternion.h"
-#include "dali/public-api/common/vector-wrapper.h"
-#include "dali/devel-api/common/map-wrapper.h"
#include <cstdint>
#include <memory>
+#include "dali/devel-api/common/map-wrapper.h"
+#include "dali/public-api/common/vector-wrapper.h"
+#include "dali/public-api/math/quaternion.h"
+#include "dali/public-api/math/vector4.h"
namespace gltf2
{
-
using Index = Dali::SceneLoader::Index;
-template <typename T>
+template<typename T>
class Ref
{
public:
Ref(std::vector<T>& v, Index i)
: mVector(&v),
mIndex(i)
- {}
+ {
+ }
/**
* @return The index of the object into the vector.
* @note It is client code responsibility to ensure that the vector is unambiguous. It should be in
* a glTF document, since there's one vector for each type.
*/
- Index GetIndex() const { return mIndex; }
+ Index GetIndex() const
+ {
+ return mIndex;
+ }
/**
* @brief There may be scenarios in which the object, whose vector we're populating, changes, e.g.
mVector = &v;
}
- operator bool() const { return mVector != nullptr; }
- T* operator->() const { return &(*mVector)[mIndex]; }
- T& operator*() const { return (*mVector)[mIndex]; }
+ operator bool() const
+ {
+ return mVector != nullptr;
+ }
+ T* operator->() const
+ {
+ return &(*mVector)[mIndex];
+ }
+ T& operator*() const
+ {
+ return (*mVector)[mIndex];
+ }
bool operator==(const Ref<T>& other) const
{
private:
std::vector<T>* mVector = nullptr;
- Index mIndex = Dali::SceneLoader::INVALID_INDEX;
+ Index mIndex = Dali::SceneLoader::INVALID_INDEX;
};
struct Asset
{
enum Type
{
- BYTE = 5120,
- UNSIGNED_BYTE = 5121,
- SHORT = 5122,
+ BYTE = 5120,
+ UNSIGNED_BYTE = 5121,
+ SHORT = 5122,
UNSIGNED_SHORT = 5123,
- UNSIGNED_INT = 5125,
- FLOAT = 5126,
- INVALID = -1
+ UNSIGNED_INT = 5125,
+ FLOAT = 5126,
+ INVALID = -1
};
- static bool IsUnsigned(Type t);
+ static bool IsUnsigned(Type t);
static uint32_t Size(Type t);
Component() = delete;
struct Buffer
{
- uint32_t mByteLength;
+ uint32_t mByteLength;
std::string_view mUri;
//TODO: extensions
//TODO: extras
enum Type
{
NONE,
- ARRAY_BUFFER = 34962,
+ ARRAY_BUFFER = 34962,
ELEMENT_ARRAY_BUFFER = 34963
};
};
Ref<Buffer> mBuffer;
- uint32_t mByteOffset = 0;
- uint32_t mByteLength;
- uint32_t mByteStride = 0; // if 0 after reading, it needs to be calculated
- uint32_t mTarget;
+ uint32_t mByteOffset = 0;
+ uint32_t mByteLength;
+ uint32_t mByteStride = 0; // if 0 after reading, it needs to be calculated
+ uint32_t mTarget;
//TODO: extensions
//TODO: extras
};
struct BufferViewClient
{
Ref<BufferView> mBufferView;
- uint32_t mByteOffset = 0;
+ uint32_t mByteOffset = 0;
};
struct ComponentTypedBufferViewClient : BufferViewClient
{
struct Sparse
{
- uint32_t mCount;
+ uint32_t mCount;
ComponentTypedBufferViewClient mIndices;
- BufferViewClient mValues;
+ BufferViewClient mValues;
//TODO: extensions
//TODO: extras
};
- uint32_t mCount;
- bool mNormalized = false;
- AccessorType::Type mType = AccessorType::INVALID;
- std::vector<float> mMin;
- std::vector<float> mMax;
+ uint32_t mCount;
+ bool mNormalized = false;
+ AccessorType::Type mType = AccessorType::INVALID;
+ std::vector<float> mMin;
+ std::vector<float> mMax;
std::unique_ptr<Sparse> mSparse;
//TODO: extensions
//TODO: extras
}
};
-struct Image: Named
+struct Image : Named
{
std::string_view mUri;
std::string_view mMimeType;
- Ref<BufferView> mBufferView;
+ Ref<BufferView> mBufferView;
//TODO: extensions
//TODO: extras
};
{
enum Type
{
- NEAREST = 9728,
- LINEAR = 9729,
+ NEAREST = 9728,
+ LINEAR = 9729,
NEAREST_MIPMAP_NEAREST = 9984,
- NEAREST_MIPMAP_LINEAR = 9985,
- LINEAR_MIPMAP_NEAREST = 9986,
- LINEAR_MIPMAP_LINEAR = 9987,
+ NEAREST_MIPMAP_LINEAR = 9985,
+ LINEAR_MIPMAP_NEAREST = 9986,
+ LINEAR_MIPMAP_LINEAR = 9987,
};
Filter() = delete;
{
enum Type
{
- REPEAT = 10497,
- CLAMP_TO_EDGE = 33071,
+ REPEAT = 10497,
+ CLAMP_TO_EDGE = 33071,
MIRRORED_REPEAT = 33648,
};
{
Filter::Type mMinFilter = Filter::LINEAR;
Filter::Type mMagFilter = Filter::LINEAR;
- Wrap::Type mWrapS = Wrap::CLAMP_TO_EDGE;
- Wrap::Type mWrapT = Wrap::CLAMP_TO_EDGE;
+ Wrap::Type mWrapS = Wrap::CLAMP_TO_EDGE;
+ Wrap::Type mWrapT = Wrap::CLAMP_TO_EDGE;
//TODO: extensions
//TODO: extras
};
struct Texture
{
- Ref<Image> mSource;
+ Ref<Image> mSource;
Ref<Sampler> mSampler;
};
struct TextureInfo
{
Ref<gltf2::Texture> mTexture;
- uint32_t mTexCoord = 0;
- float mScale = 1.f;
+ uint32_t mTexCoord = 0;
+ float mScale = 1.f;
operator bool() const
{
}
};
-struct Material: Named
+struct Material : Named
{
- struct Pbr//MetallicRoughness
+ struct Pbr //MetallicRoughness
{
Dali::Vector4 mBaseColorFactor = Dali::Vector4::ONE;
- TextureInfo mBaseColorTexture;
- float mMetallicFactor = 1.f;
- float mRoughnessFactor = 1.f;
- TextureInfo mMetallicRoughnessTexture;
+ TextureInfo mBaseColorTexture;
+ float mMetallicFactor = 1.f;
+ float mRoughnessFactor = 1.f;
+ TextureInfo mMetallicRoughnessTexture;
//TODO: extensions
//TODO: extras
};
- Pbr mPbrMetallicRoughness;
- TextureInfo mNormalTexture;
- TextureInfo mOcclusionTexture;
- TextureInfo mEmissiveTexture;
- Dali::Vector3 mEmissiveFactor;
- AlphaMode::Type mAlphaMode = AlphaMode::OPAQUE;
- float mAlphaCutoff = .5f;
- bool mDoubleSided = false;
+ Pbr mPbrMetallicRoughness;
+ TextureInfo mNormalTexture;
+ TextureInfo mOcclusionTexture;
+ TextureInfo mEmissiveTexture;
+ Dali::Vector3 mEmissiveFactor;
+ AlphaMode::Type mAlphaMode = AlphaMode::OPAQUE;
+ float mAlphaCutoff = .5f;
+ bool mDoubleSided = false;
//TODO: extensions
//TODO: extras
};
-struct Mesh: Named
+struct Mesh : Named
{
struct Primitive
{
INVALID
};
- std::map<Attribute::Type, Ref<Accessor>> mAttributes;
+ std::map<Attribute::Type, Ref<Accessor>> mAttributes;
std::vector<std::map<Attribute::Type, Ref<Accessor>>> mTargets;
- Ref<Accessor> mIndices;
- Ref<Material> mMaterial;
- Mode mMode = TRIANGLES;
+ Ref<Accessor> mIndices;
+ Ref<Material> mMaterial;
+ Mode mMode = TRIANGLES;
//TODO: [morph] targets
//TODO: extras
};
std::vector<Primitive> mPrimitives;
- std::vector<float> mWeights;
+ std::vector<float> mWeights;
//TODO: extras
//TODO: extensions
};
struct Skin : Named
{
- Ref<Accessor> mInverseBindMatrices;
- Ref<Node> mSkeleton;
+ Ref<Accessor> mInverseBindMatrices;
+ Ref<Node> mSkeleton;
std::vector<Ref<Node>> mJoints;
//TODO: extras
//TODO: extensions
};
-struct Camera: Named
+struct Camera : Named
{
struct Perspective
{
};
std::string_view mType;
- Perspective mPerspective;
- Orthographic mOrthographic;
+ Perspective mPerspective;
+ Orthographic mOrthographic;
//TODO: extras
//TODO: extensions
};
-struct Node: Named
+struct Node : Named
{
- Dali::Vector3 mTranslation = Dali::Vector3::ZERO;
- Dali::Quaternion mRotation = Dali::Quaternion::IDENTITY;
- Dali::Vector3 mScale = Dali::Vector3::ONE;
+ Dali::Vector3 mTranslation = Dali::Vector3::ZERO;
+ Dali::Quaternion mRotation = Dali::Quaternion::IDENTITY;
+ Dali::Vector3 mScale = Dali::Vector3::ONE;
- Ref<Camera> mCamera;
+ Ref<Camera> mCamera;
std::vector<Ref<Node>> mChildren;
- Ref<Mesh> mMesh;
+ Ref<Mesh> mMesh;
Ref<Skin> mSkin;
//TODO: [morph] weights
static Type FromString(const char* s, size_t len);
};
- Ref<Accessor> mInput;
- Ref<Accessor> mOutput;
+ Ref<Accessor> mInput;
+ Ref<Accessor> mOutput;
Interpolation::Type mInterpolation;
//TODO: extras
static Type FromString(const char* s, size_t len);
Ref<Node> mNode;
- Type mPath;
+ Type mPath;
};
Ref<Sampler> mSampler;
- Target mTarget;
+ Target mTarget;
//TODO: extras
//TODO: extensions
};
std::vector<Channel> mChannels;
};
-struct Scene: Named
+struct Scene : Named
{
std::vector<Ref<Node>> mNodes;
};
{
Asset mAsset;
- std::vector<Buffer> mBuffers;
+ std::vector<Buffer> mBuffers;
std::vector<BufferView> mBufferViews;
- std::vector<Accessor> mAccessors;
+ std::vector<Accessor> mAccessors;
- std::vector<Image> mImages;
- std::vector<Sampler> mSamplers;
- std::vector<Texture> mTextures;
+ std::vector<Image> mImages;
+ std::vector<Sampler> mSamplers;
+ std::vector<Texture> mTextures;
std::vector<Material> mMaterials;
std::vector<Mesh> mMeshes;
std::vector<Skin> mSkins;
std::vector<Camera> mCameras;
- std::vector<Node> mNodes;
+ std::vector<Node> mNodes;
std::vector<Animation> mAnimations;
std::vector<Scene> mScenes;
- Ref<Scene> mScene;
+ Ref<Scene> mScene;
- Document() = default;
+ Document() = default;
Document(const Document&) = delete;
- Document(Document&&) = default;
+ Document(Document&&) = default;
Document& operator=(const Document&) = delete;
Document& operator=(Document&&) = default;
* @brief Provides a json::Property<T>::ReadFn for interpreting unsigned integers
* as a Ref<U> into a std::vector<U> data member of a type T.
*/
-template <typename T>
+template<typename T>
struct RefReader
{
static T* sObject;
- template <typename U, std::vector<U> T::* V>
+ template<typename U, std::vector<U> T::*V>
static Ref<U> Read(const json_value_s& j)
{
uint32_t index = json::Read::Number<uint32_t>(j);
}
};
-template <typename T>
+template<typename T>
T* RefReader<T>::sObject = nullptr;
/**
* @brief Convenience method to set the object for RefReader.
*/
-template <typename T>
+template<typename T>
void SetRefReaderObject(T& object)
{
RefReader<T>::sObject = &object;
* @note The enum must: 1, be called Type, nested to T, 2, provide a FromString static method taking a const char*
* (string data) and a size_t (string length) and returning T::Type.
*/
-template <typename T> // T must have a nested enum called Type and a static Type FromString(const char*) method.
+template<typename T> // T must have a nested enum called Type and a static Type FromString(const char*) method.
typename T::Type ReadStringEnum(const json_value_s& j)
{
auto str = json::Read::StringView(j);
* @note T must provide an AsFloat() member method returning the non-const array of its
* float components.
*/
-template <typename T>
-inline
-T ReadDaliVector(const json_value_s& j)
+template<typename T>
+inline T ReadDaliVector(const json_value_s& j)
{
std::vector<float> floats = json::Read::Array<float, json::Read::Number<float>>(j);
- T result;
+ T result;
std::copy(floats.begin(), std::min(floats.end(), floats.begin() + sizeof(T) / sizeof(float)), result.AsFloat());
return result;
}
*/
Dali::Quaternion ReadQuaternion(const json_value_s& j);
-}
+} // namespace gltf2
#endif //DALI_SCENE_LOADER_GLTF2_ASSET_H_
#ifndef DALI_SCENE_LOADER_HASH_H_
#define DALI_SCENE_LOADER_HASH_H_
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
-#include <string>
-#include <cstring>
#include <cstdint>
+#include <cstring>
+#include <string>
namespace Dali
{
namespace SceneLoader
{
-
/**
* @brief Rudimentary hash generator that follows a builder pattern.
*/
* @brief Applies the bytes of an object @a value, to the hash.
* @return Its updated self.
*/
- template <typename T>
+ template<typename T>
Hash& AddObjectBytes(const T& value);
operator uint64_t() const;
uint64_t Concatenate(uint64_t value);
};
-
template<typename T>
-Hash& Hash::AddObjectBytes(const T & value)
+Hash& Hash::AddObjectBytes(const T& value)
{
auto i0 = reinterpret_cast<const uint8_t*>(&value);
auto i1 = i0 + sizeof(T);
- while (i0 != i1)
+ while(i0 != i1)
{
mValue = Concatenate(*i0);
++i0;
return *this;
}
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif // DALI_SCENE_LOADER_HASH_H_
#ifndef DALI_SCENE_LOADER_JSON_READER_H_
#define DALI_SCENE_LOADER_JSON_READER_H_
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "dali-scene-loader/third-party/json.h"
// EXTERNAL INCLUDES
-#include "dali/public-api/common/vector-wrapper.h"
#include <algorithm>
-#include <map>
-#include <string_view>
-#include <sstream>
#include <cstring>
+#include <map>
#include <memory>
+#include <sstream>
+#include <string_view>
+#include "dali/public-api/common/vector-wrapper.h"
namespace json
{
-
/**
* @brief Helper for freeing the memory allocated by json_parse()
*/
* @brief Convenience function to compare json_string_s and other supported string type,
* in swapped order.
*/
-template <typename String>
-inline
-int StrCmp(String& s, const json_string_s& js)
+template<typename String>
+inline int StrCmp(String& s, const json_string_s& js)
{
return -StrCmp(js, s);
}
/**
* @brief Compile-time type-enum mapping.
*/
-template <typename T>
+template<typename T>
struct Type2Enum
-{};
-
-#define TYPE2ENUM(x) template<> struct Type2Enum<json_## x ##_s>\
-{\
- enum { VALUE = json_type_## x };\
+{
};
+#define TYPE2ENUM(x) \
+ template<> \
+ struct Type2Enum<json_##x##_s> \
+ { \
+ enum \
+ { \
+ VALUE = json_type_##x \
+ }; \
+ };
+
TYPE2ENUM(object)
TYPE2ENUM(array)
TYPE2ENUM(string)
TYPE2ENUM(number)
#undef TYPE2ENUM
-}
+} // namespace detail
/**
* @brief Casts the payload of a json_value_s to the given type.
*/
-template <typename Out>
-inline
-const Out& Cast(const json_value_s& j)
+template<typename Out>
+inline const Out& Cast(const json_value_s& j)
{
Validate(j, static_cast<json_type_e>(detail::Type2Enum<typename std::decay<Out>::type>::VALUE));
return *static_cast<const Out*>(j.payload);
* @brief Casts the payload of a json_value_s to the given type.
* @note std::runtime_error is thrown if the value is not the given type.
*/
-template <typename Out>
-inline
-Out& Cast(json_value_s& j)
+template<typename Out>
+inline Out& Cast(json_value_s& j)
{
Validate(j, static_cast<json_type_e>(detail::Type2Enum<typename std::decay<Out>::type>::VALUE));
return *static_cast<Out*>(j.payload);
{
static bool Boolean(const json_value_s& j)
{
- if (j.type == json_type_true)
+ if(j.type == json_type_true)
{
return true;
}
- else if (j.type == json_type_false)
+ else if(j.type == json_type_false)
{
return false;
}
}
}
- template <typename T>
+ template<typename T>
static T Number(const json_value_s& j)
{
- auto& jn = Cast<const json_number_s>(j);
+ auto& jn = Cast<const json_number_s>(j);
std::stringstream ss;
- for (auto i0 = jn.number, i1 = i0 + jn.number_size; i0 != i1; ++i0)
+ for(auto i0 = jn.number, i1 = i0 + jn.number_size; i0 != i1; ++i0)
{
ss.put(*i0);
}
T result;
- if (ss >> result)
+ if(ss >> result)
{
return result;
}
throw std::runtime_error("Failed to convert value to number");
}
- template <typename E>
+ template<typename E>
static E Enum(const json_value_s& j)
{
size_t number = Number<size_t>(j);
return std::string(js.string, js.string_size);
}
- template <typename T, T(*readElement)(const json_value_s&)>
+ template<typename T, T (*readElement)(const json_value_s&)>
static std::vector<T> Array(const json_value_s& j)
{
- auto& ja = Cast<const json_array_s>(j);
+ auto& ja = Cast<const json_array_s>(j);
std::vector<T> result;
result.reserve(ja.length);
auto i = ja.start;
- while (i)
+ while(i)
{
result.push_back(std::move(readElement(*i->value)));
i = i->next;
protected:
explicit PropertyCore(const std::string& key)
: mKey(key)
- {}
+ {
+ }
- const std::string& GetKey() const { return mKey; }
+ const std::string& GetKey() const
+ {
+ return mKey;
+ }
private:
std::string mKey;
/**
* @brief Base class for the properties of a type T.
*/
-template <typename T>
+template<typename T>
struct PropertyBase : PropertyCore
{
using PropertyCore::GetKey;
explicit PropertyBase(const std::string& key)
: PropertyCore(key)
- {}
+ {
+ }
virtual ~PropertyBase()
- {}
+ {
+ }
virtual void Read(const json_value_s& j, T& obj) = 0;
};
/**
* @brief Concrete property of an object to read into from JSON with a given function.
*/
-template <class T, typename U>
+template<class T, typename U>
struct Property : PropertyBase<T>
{
- using ReadFn = U(*)(const json_value_s&);
- using MemberPtr = U T::*;
+ using ReadFn = U (*)(const json_value_s&);
+ using MemberPtr = U T::*;
using SetterArgType = typename std::conditional<sizeof(U) <= sizeof(uintptr_t), U, const U&>::type;
- using Setter = void (T::*)(SetterArgType);
+ using Setter = void (T::*)(SetterArgType);
Property(const std::string& key, ReadFn read, MemberPtr ptr)
: PropertyBase<T>(key),
mRead(read),
mAccessor(new DirectAccessor(ptr))
- {}
+ {
+ }
Property(const std::string& key, ReadFn read, Setter setter)
: PropertyBase<T>(key),
mRead(read),
mAccessor(new SetterAccessor(setter))
- {}
+ {
+ }
~Property()
- {}
+ {
+ }
void Read(const json_value_s& j, T& obj) override
{
struct AccessorBase
{
virtual ~AccessorBase()
- {}
+ {
+ }
virtual void Set(U value, T& obj) const = 0;
};
{
DirectAccessor(MemberPtr ptr)
: mPointer(ptr)
- {}
+ {
+ }
void Set(U value, T& obj) const override
{
{
SetterAccessor(Setter setter)
: mSetter(setter)
- {}
+ {
+ }
void Set(U value, T& obj) const override
{
Setter mSetter;
};
- ReadFn mRead;
+ ReadFn mRead;
std::unique_ptr<AccessorBase> mAccessor;
};
/**
* @brief Helper function to make a Property for a member of type U, of object of type T.
*/
-template <class T, typename U>
-Property<T, U>* MakeProperty(const std::string& key, typename Property<T, U>::ReadFn readFn,
- U T::* ptr)
+template<class T, typename U>
+Property<T, U>* MakeProperty(const std::string& key, typename Property<T, U>::ReadFn readFn, U T::*ptr)
{
return new Property<T, U>(key, readFn, ptr);
}
* @brief Object Reader template for reading into an object of a given type,
* with properties registered for the various members.
*/
-template <typename T>
+template<typename T>
class Reader : protected ReaderCore
{
public:
~Reader()
{
- for (auto& p : mProperties)
+ for(auto& p : mProperties)
{
delete Cast(p);
}
Reader<T>& Register(PropertyBase<T>& prop)
{
- auto iInsert = std::lower_bound(mProperties.begin(), mProperties.end(), &prop,
- SortPredicate);
- if (iInsert == mProperties.end() || Cast(*iInsert)->GetKey() != prop.GetKey())
+ auto iInsert = std::lower_bound(mProperties.begin(), mProperties.end(), &prop, SortPredicate);
+ if(iInsert == mProperties.end() || Cast(*iInsert)->GetKey() != prop.GetKey())
{
mProperties.insert(iInsert, &prop);
}
void Read(const json_object_s& jo, T& obj) const
{
auto i = jo.start;
- while (i)
+ while(i)
{
- auto iFind = std::lower_bound(mProperties.begin(), mProperties.end(),
- *i->name, FindPredicate);
- if (iFind != mProperties.end())
+ auto iFind = std::lower_bound(mProperties.begin(), mProperties.end(), *i->name, FindPredicate);
+ if(iFind != mProperties.end())
{
auto prop = Cast(*iFind);
- if (0 == StrCmp(*i->name, prop->GetKey()))
+ if(0 == StrCmp(*i->name, prop->GetKey()))
{
prop->Read(*i->value, obj);
}
* @brief Wraps a Reader<T> in a function usable as a Property<T>::ReadFn, i.e. to facilitate
* deserializing structures of nested objects.
*/
-template <typename T>
+template<typename T>
struct ObjectReader
{
static const Reader<T>* sReader;
static T Read(const json_value_s& j)
{
- T result;
+ T result;
auto& jo = Cast<json_object_s>(j);
sReader->Read(jo, result);
return result;
}
};
-template <typename T>
+template<typename T>
const Reader<T>* ObjectReader<T>::sReader = nullptr;
-template <typename T>
+template<typename T>
void SetObjectReader(const Reader<T>& r)
{
ObjectReader<T>::sReader = &r;
}
-} // json
+} // namespace json
#endif //DALI_SCENE_LOADER_JSON_READER_H_
#ifndef DALI_SCENE_LOADER_JSON_UTIL_H_
#define DALI_SCENE_LOADER_JSON_UTIL_H_
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "dali-scene-loader/public-api/index.h"
// EXTERNAL INCLUDES
-#include "dali/public-api/common/vector-wrapper.h"
+#include "dali-toolkit/devel-api/builder/tree-node.h"
#include "dali/public-api/animation/time-period.h"
-#include "dali/public-api/object/property.h"
+#include "dali/public-api/common/vector-wrapper.h"
#include "dali/public-api/math/vector4.h"
-#include "dali-toolkit/devel-api/builder/tree-node.h"
+#include "dali/public-api/object/property.h"
namespace Dali
{
namespace SceneLoader
{
-
bool ReadBool(const Toolkit::TreeNode* node, bool& num);
bool ReadInt(const Toolkit::TreeNode* node, int& num);
*/
Property::Value ReadPropertyValue(const Toolkit::TreeNode& tn);
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_JSON_UTIL_H_
#ifndef DALI_SCENE_LOADER_ALPHA_FUNCTION_HELPER_H_
#define DALI_SCENE_LOADER_ALPHA_FUNCTION_HELPER_H_
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "dali-scene-loader/public-api/api.h"
-#include "dali/public-api/animation/alpha-function.h"
#include <string>
+#include "dali/public-api/animation/alpha-function.h"
namespace Dali
{
namespace SceneLoader
{
-
/**
* @return Given a name, provide a AlphaFunction; if the name was not
* recognised, get the default one.
*/
void DALI_SCENE_LOADER_API RegisterAlphaFunction(const std::string& name, AlphaFunction alphaFn) noexcept(false);
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_ALPHA_FUNCTION_HELPER_H_
#ifndef DALI_SCENE_LOADER_ANIMATED_PROPERTY_H
#define DALI_SCENE_LOADER_ANIMATED_PROPERTY_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "dali-scene-loader/public-api/api.h"
// EXTERNAL INCLUDES
+#include <functional>
+#include <memory>
#include "dali/public-api/actors/actor.h"
#include "dali/public-api/animation/animation.h"
#include "dali/public-api/object/property.h"
-#include <memory>
-#include <functional>
namespace Dali
{
namespace SceneLoader
{
-
/**
* @brief Intermediate representation for a property that's given to
* a Animation to animate. Since there is no getting an
struct Value
{
Property::Value mValue;
- bool mIsRelative;
+ bool mIsRelative;
};
std::string mNodeName;
std::string mPropertyName;
- KeyFrames mKeyFrames;
+ KeyFrames mKeyFrames;
std::unique_ptr<Value> mValue;
AlphaFunction mAlphaFunction = AlphaFunction::DEFAULT;
- TimePeriod mTimePeriod = TimePeriod(0.f);
+ TimePeriod mTimePeriod = TimePeriod(0.f);
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_ANIMATED_PROPERTY_H
#ifndef DALI_SCENE_LOADER_ANIMATION_DEFINITION_H
#define DALI_SCENE_LOADER_ANIMATION_DEFINITION_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
-#include "dali-scene-loader/public-api/api.h"
#include "dali-scene-loader/public-api/animated-property.h"
+#include "dali-scene-loader/public-api/api.h"
#include "dali/public-api/common/vector-wrapper.h"
namespace Dali
{
namespace SceneLoader
{
-
/**
* @brief Animation handle + name + definition of properties.
*/
public: // DATA
std::string mName;
- float mDuration = DEFAULT_DURATION_SECONDS;
- int mLoopCount = 1;
+ float mDuration = DEFAULT_DURATION_SECONDS;
+ int mLoopCount = 1;
Animation::EndAction mDisconnectAction = Animation::BAKE_FINAL;
- Animation::EndAction mEndAction = Animation::BAKE;
- float mSpeedFactor = 1.f;
- Vector2 mPlayRange = Vector2{ 0.f, 1.f };
+ Animation::EndAction mEndAction = Animation::BAKE;
+ float mSpeedFactor = 1.f;
+ Vector2 mPlayRange = Vector2{0.f, 1.f};
std::vector<AnimatedProperty> mProperties;
};
struct AnimationGroupDefinition
{
- std::string mName;
+ std::string mName;
std::vector<std::string> mAnimations;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_ANIMATION_DEFINITION_H
#ifndef DALI_SCENE_LOADER_API_H
#define DALI_SCENE_LOADER_API_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#elif defined(WIN32)
#ifdef BUILDING_DALI_SCENE_LOADER
-#define DALI_SCENE_LOADER_API __declspec(dllexport)
+#define DALI_SCENE_LOADER_API __declspec(dllexport)
#else
-#define DALI_SCENE_LOADER_API __declspec(dllimport)
-#endif // BUILDING_DALI_SCENE_LOADER
+#define DALI_SCENE_LOADER_API __declspec(dllimport)
+#endif // BUILDING_DALI_SCENE_LOADER
#endif
#ifndef DALI_SCENE_LOADER_BLEND_SHAPE_DETAILS_H
#define DALI_SCENE_LOADER_BLEND_SHAPE_DETAILS_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "dali-scene-loader/public-api/api.h"
// EXTERNAL INCLUDES
-#include "dali/public-api/rendering/shader.h"
-#include "dali/public-api/actors/actor.h"
#include <string>
+#include "dali/public-api/actors/actor.h"
+#include "dali/public-api/rendering/shader.h"
namespace Dali
{
namespace SceneLoader
{
-
struct MeshDefinition;
struct MeshGeometry;
enum
{
POSITIONS = 0x1,
- NORMALS = 0x2,
- TANGENTS = 0x4
+ NORMALS = 0x2,
+ TANGENTS = 0x4
};
};
// shader properties - animatable (uniforms)
- static const std::string NUMBER_OF_BLEND_SHAPES; ///< Integer number of blend shapes loaded.
- static const std::string UNNORMALIZE_FACTOR; ///< Scalar(s) for position components of blend shapes; Version 1.0: float array (1 per blend shape); Version 2.0: single float.
- static const std::string COMPONENT_SIZE; ///< Integer offset from one component (positions / normals / tangents) of a blend shape to the next.
+ static const std::string NUMBER_OF_BLEND_SHAPES; ///< Integer number of blend shapes loaded.
+ static const std::string UNNORMALIZE_FACTOR; ///< Scalar(s) for position components of blend shapes; Version 1.0: float array (1 per blend shape); Version 2.0: single float.
+ static const std::string COMPONENT_SIZE; ///< Integer offset from one component (positions / normals / tangents) of a blend shape to the next.
// shader properties - read-only (not available as uniforms)
- static const std::string COMPONENTS; ///< Integer bitmask of the blend shape components that the shader uses; refer to the Components enum.
+ static const std::string COMPONENTS; ///< Integer bitmask of the blend shape components that the shader uses; refer to the Components enum.
// actor property (instance) - animatable (uniforms)
- static const std::string WEIGHTS_UNIFORM; ///< The weight of each blend shape in a float array
+ static const std::string WEIGHTS_UNIFORM; ///< The weight of each blend shape in a float array
/**
* @brief Registers properties based on the mesh definition (and geometry) and identified by the above string constants,
BlendShapes() = delete;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif // DALI_SCENE_LOADER_BLEND_SHAPE_DETAILS_H
#ifndef DALI_SCENE_LOADER_CAMERA_PARAMETERS_H
#define DALI_SCENE_LOADER_CAMERA_PARAMETERS_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
- // INTERNAL INCLUDES
+// INTERNAL INCLUDES
#include "dali-scene-loader/public-api/api.h"
#include "dali-scene-loader/public-api/view-projection.h"
namespace Dali
{
-
class CameraActor;
namespace SceneLoader
{
-
struct DALI_SCENE_LOADER_API CameraParameters
{
- Matrix matrix = Matrix::IDENTITY;
- Vector4 orthographicSize = Vector4{ -1.f, 1.f, 1.f, -1.f };
- float yFov = 60.f;
- float zNear = 0.1f;
- float zFar = 1000.f;
- bool isPerspective = true;
+ Matrix matrix = Matrix::IDENTITY;
+ Vector4 orthographicSize = Vector4{-1.f, 1.f, 1.f, -1.f};
+ float yFov = 60.f;
+ float zNear = 0.1f;
+ float zFar = 1000.f;
+ bool isPerspective = true;
/**
* @return The view-projection matrix of the camera.
void ConfigureCamera(CameraActor& camera) const;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif // DALI_SCENE_LOADER_CAMERA_PARAMETERS_H
#ifndef DALI_SCENE_LOADER_CUSTOMIZATION_STATE_H_
#define DALI_SCENE_LOADER_CUSTOMIZATION_STATE_H_
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
- // INTERNAL INCLUDES
+// INTERNAL INCLUDES
#include "dali-scene-loader/public-api/api.h"
// EXTERNAL INCLUDES
-#include "dali/public-api/common/vector-wrapper.h"
-#include <string>
#include <memory>
+#include <string>
+#include "dali/public-api/common/vector-wrapper.h"
namespace Dali
{
namespace SceneLoader
{
-
/**
* @brief Offers a description of an aspect of the scene that can be customized:
* the number of options, and the name of the nodes that are registered
*/
struct DALI_SCENE_LOADER_API Customization
{
- using Tag = std::string;
+ using Tag = std::string;
using OptionType = uint32_t;
/**
static const OptionType NONE = OptionType(-1);
- OptionType numOptions = 0;
- std::vector<std::string> nodes; // to apply option to.
+ OptionType numOptions = 0;
+ std::vector<std::string> nodes; // to apply option to.
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_CUSTOMIZATION_STATE_H_
#ifndef DALI_SCENE_LOADER_DLI_LOADER_H
#define DALI_SCENE_LOADER_DLI_LOADER_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
- // INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/api.h"
+// INTERNAL INCLUDES
#include "dali-scene-loader/public-api/animation-definition.h"
+#include "dali-scene-loader/public-api/api.h"
#include "dali-scene-loader/public-api/customization.h"
-#include "dali-scene-loader/public-api/string-callback.h"
#include "dali-scene-loader/public-api/index.h"
+#include "dali-scene-loader/public-api/string-callback.h"
// EXTERNAL INCLUDES
#include "dali/public-api/common/vector-wrapper.h"
class DALI_SCENE_LOADER_API DliLoader
{
public:
- using ConvertFontCode = void(*)(const std::string& code, std::string& fontFamily, std::string& slant, std::string& weight, float& size);
- using ConvertColorCode = Vector4(*)(const std::string& code);
+ using ConvertFontCode = void (*)(const std::string& code, std::string& fontFamily, std::string& slant, std::string& weight, float& size);
+ using ConvertColorCode = Vector4 (*)(const std::string& code);
- using CategoryProcessor = std::function<void(Property::Array&& categoryData, StringCallback onError)>;
+ using CategoryProcessor = std::function<void(Property::Array&& categoryData, StringCallback onError)>;
using CategoryProcessorVector = std::vector<std::pair<std::string /*name*/, CategoryProcessor>>;
using NodeProcessor = std::function<void(const NodeDefinition& nodeDef,
- Property::Map&& nodeData, StringCallback onError)>;
+ Property::Map&& nodeData,
+ StringCallback onError)>;
using AnimationProcessor = std::function<void(const AnimationDefinition& animDef,
- Property::Map&& animData, StringCallback onError)>;
+ Property::Map&& animData,
+ StringCallback onError)>;
struct InputParams
{
struct LoadParams
{
InputParams const& input;
- LoadResult& output;
+ LoadResult& output;
};
DliLoader();
const std::unique_ptr<Impl> mImpl;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif // DALI_SCENE_LOADER_DLI_LOADER_H
#ifndef DALI_SCENE_LOADER_ENVIRONMENT_DEFINITION_H
#define DALI_SCENE_LOADER_ENVIRONMENT_DEFINITION_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
- // INTERNAL INCLUDES
+// INTERNAL INCLUDES
#include "dali-scene-loader/public-api/api.h"
#include "dali-scene-loader/public-api/ktx-loader.h"
// EXTERNAL INCLUDES
-#include "dali/public-api/rendering/texture.h"
#include "dali/public-api/math/quaternion.h"
+#include "dali/public-api/rendering/texture.h"
namespace Dali
{
namespace SceneLoader
{
-
/**
* @brief Defines an environment map with either or both of radiance
* and irradiance maps.
struct Textures
{
Texture mDiffuse; // irradiance
- Texture mSpecular; // radiance
+ Texture mSpecular; // radiance
bool IsLoaded() const
{
};
using EnvironmentData = std::pair<EnvironmentDefinition, Textures>;
- using Vector = std::vector<EnvironmentData>;
+ using Vector = std::vector<EnvironmentData>;
EnvironmentDefinition() = default;
public: // DATA
std::string mDiffuseMapPath;
std::string mSpecularMapPath;
- Quaternion mCubeOrientation = Quaternion::IDENTITY;
- float mIblIntensity = 1.0f;
+ Quaternion mCubeOrientation = Quaternion::IDENTITY;
+ float mIblIntensity = 1.0f;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_ENVIRONMENT_DEFINITION_H
#ifndef DALI_SCENE_LOADER_GLTF2_LOADER_H
#define DALI_SCENE_LOADER_GLTF2_LOADER_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
- // INTERNAL INCLUDES
+// INTERNAL INCLUDES
#include "dali-scene-loader/public-api/api.h"
// EXTERNAL INCLUDES
*/
DALI_SCENE_LOADER_API void LoadGltfScene(const std::string& url, ShaderDefinitionFactory& shaderFactory, LoadResult& params);
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_GLTF2_LOADER_H
#ifndef DALI_SCENE_LOADER_INDEX_H_
#define DALI_SCENE_LOADER_INDEX_H_
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
{
namespace SceneLoader
{
-
using Index = uint32_t;
constexpr Index INVALID_INDEX = static_cast<Index>(-1);
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_INDEX_H_
#ifndef DALI_SCENE_LOADER_KTX_LOADER_H
#define DALI_SCENE_LOADER_KTX_LOADER_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
{
namespace SceneLoader
{
-
/**
* @brief Stores the pixel data objects for each face of the cube texture and their mipmaps.
*/
struct DALI_SCENE_LOADER_API CubeData
{
- std::vector< std::vector<PixelData> > data;
+ std::vector<std::vector<PixelData> > data;
Texture CreateTexture() const;
};
*/
DALI_SCENE_LOADER_API bool LoadCubeMapData(const std::string& path, CubeData& cubedata);
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif // DALI_SCENE_LOADER_KTX_LOADER_H
#ifndef DALI_SCENE_LOADER_LIGHT_PARAMETERS_H
#define DALI_SCENE_LOADER_LIGHT_PARAMETERS_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "dali-scene-loader/public-api/api.h"
// EXTERNAL INCLUDES
+#include <stdint.h>
#include "dali/public-api/math/matrix.h"
#include "dali/public-api/math/vector3.h"
-#include <stdint.h>
namespace Dali
{
namespace SceneLoader
{
-
struct DALI_SCENE_LOADER_API LightParameters
{
Matrix transform;
- Vector3 color;
- float intensity;
- float shadowIntensity;
+ Vector3 color;
+ float intensity;
+ float shadowIntensity;
uint32_t shadowMapSize;
- float orthographicSize;
+ float orthographicSize;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif // DALI_SCENE_LOADER_LIGHT_PARAMETERS_H
#ifndef DALI_SCENE_LOADER_OUTPUT_H
#define DALI_SCENE_LOADER_OUTPUT_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/api.h"
#include "dali-scene-loader/public-api/animation-definition.h"
-#include "dali-scene-loader/public-api/light-parameters.h"
+#include "dali-scene-loader/public-api/api.h"
#include "dali-scene-loader/public-api/camera-parameters.h"
+#include "dali-scene-loader/public-api/light-parameters.h"
namespace Dali
{
namespace SceneLoader
{
-
class ResourceBundle;
class SceneDefinition;
std::vector<LightParameters>& mLightParameters;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_OUTPUT_H
#ifndef DALI_SCENE_LOADER_MATERIAL_DEFINITION_H
#define DALI_SCENE_LOADER_MATERIAL_DEFINITION_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "dali-scene-loader/public-api/utils.h"
// EXTERNAL INCLUDES
-#include "dali/public-api/math/vector4.h"
-#include "dali/public-api/common/vector-wrapper.h"
#include <cmath>
+#include "dali/public-api/common/vector-wrapper.h"
+#include "dali/public-api/math/vector4.h"
namespace Dali
{
namespace SceneLoader
{
-
/**
* @brief Helper enum for encoding and decoding sampler states.
*/
enum Values : Type
{
// Filter - 3 bits
- FILTER_NEAREST = 0,
- FILTER_LINEAR = NthBit(0),
+ FILTER_NEAREST = 0,
+ FILTER_LINEAR = NthBit(0),
FILTER_MIPMAP_NEAREST = NthBit(1),
- FILTER_MIPMAP_LINEAR = NthBit(2),
+ FILTER_MIPMAP_LINEAR = NthBit(2),
// Wrap - 2 bits
WRAP_REPEAT = 0,
- WRAP_CLAMP = NthBit(0),
+ WRAP_CLAMP = NthBit(0),
WRAP_MIRROR = NthBit(1),
// Layout - apply shift, then mask
FILTER_MIN_BITS = 3,
FILTER_MIN_MASK = NthBit(FILTER_MIN_BITS) - 1,
- FILTER_MAG_BITS = 1,
+ FILTER_MAG_BITS = 1,
FILTER_MAG_SHIFT = FILTER_MIN_BITS,
- FILTER_MAG_MASK = NthBit(FILTER_MAG_BITS) - 1,
+ FILTER_MAG_MASK = NthBit(FILTER_MAG_BITS) - 1,
- WRAP_S_BITS = 2,
+ WRAP_S_BITS = 2,
WRAP_S_SHIFT = FILTER_MAG_SHIFT + FILTER_MAG_BITS,
- WRAP_S_MASK = NthBit(WRAP_S_BITS) - 1,
+ WRAP_S_MASK = NthBit(WRAP_S_BITS) - 1,
- WRAP_T_BITS = 2,
+ WRAP_T_BITS = 2,
WRAP_T_SHIFT = WRAP_S_SHIFT + WRAP_S_BITS,
- WRAP_T_MASK = NthBit(WRAP_T_BITS) - 1,
+ WRAP_T_MASK = NthBit(WRAP_T_BITS) - 1,
// Diagnostics
MIPMAP_MASK = FILTER_MIPMAP_LINEAR | FILTER_MIPMAP_NEAREST,
// Default
- DEFAULT = FILTER_LINEAR | (FILTER_LINEAR << FILTER_MAG_SHIFT) | (WRAP_REPEAT << WRAP_S_SHIFT) | (WRAP_REPEAT << WRAP_T_SHIFT), // LINEAR filters, REPEAT wraps
+ DEFAULT = FILTER_LINEAR | (FILTER_LINEAR << FILTER_MAG_SHIFT) | (WRAP_REPEAT << WRAP_S_SHIFT) | (WRAP_REPEAT << WRAP_T_SHIFT), // LINEAR filters, REPEAT wraps
};
/**
* @return SamplerFlags bit pattern calculated from the given Dali Sampler settings.
*/
- static Type Encode(FilterMode::Type minFilter, FilterMode::Type magFilter,
- WrapMode::Type wrapS, WrapMode::Type wrapT);
+ static Type Encode(FilterMode::Type minFilter, FilterMode::Type magFilter, WrapMode::Type wrapS, WrapMode::Type wrapT);
/**
* @brief Decodes the minification filter patter of @a flags into the corresponding FilterMode.
*/
- static FilterMode::Type GetMinFilter(Type flags);
+ static FilterMode::Type GetMinFilter(Type flags);
/**
* @brief Decodes the magnification filter patter of @a flags into the corresponding FilterMode.
*/
- static FilterMode::Type GetMagFilter(Type flags);
+ static FilterMode::Type GetMagFilter(Type flags);
/**
* @brief Decodes the horizontal wrap pattern of @a flags into the corresponding WrapMode.
*/
struct DALI_SCENE_LOADER_API TextureDefinition
{
- std::string mImageUri;
+ std::string mImageUri;
SamplerFlags::Type mSamplerFlags;
TextureDefinition(const std::string& imageUri = "", SamplerFlags::Type samplerFlags = SamplerFlags::DEFAULT);
enum Flags : uint32_t
{
// Texture semantics
- ALBEDO = NthBit(0),
- METALLIC = NthBit(1),
- ROUGHNESS = NthBit(2),
- NORMAL = NthBit(3),
- EMISSIVE = NthBit(4), // TODO: support
- OCCLUSION = NthBit(5), // TODO: support
- SUBSURFACE = NthBit(6), // Note: dli-only
+ ALBEDO = NthBit(0),
+ METALLIC = NthBit(1),
+ ROUGHNESS = NthBit(2),
+ NORMAL = NthBit(3),
+ EMISSIVE = NthBit(4), // TODO: support
+ OCCLUSION = NthBit(5), // TODO: support
+ SUBSURFACE = NthBit(6), // Note: dli-only
// Other binary options
- TRANSPARENCY = NthBit(20),
- GLTF_CHANNELS = NthBit(21), // https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#pbrmetallicroughnessmetallicroughnesstexture
+ TRANSPARENCY = NthBit(20),
+ GLTF_CHANNELS = NthBit(21), // https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#pbrmetallicroughnessmetallicroughnesstexture
// Alpha cutoff - reserved from the 24th bit
- ALPHA_CUTOFF_BITS = 8,
+ ALPHA_CUTOFF_BITS = 8,
ALPHA_CUTOFF_SHIFT = sizeof(uint32_t) * 8 - ALPHA_CUTOFF_BITS,
- ALPHA_CUTOFF_MASK = (1 << ALPHA_CUTOFF_BITS) - 1,
+ ALPHA_CUTOFF_MASK = (1 << ALPHA_CUTOFF_BITS) - 1,
};
/**
*/
struct TextureStage
{
- uint32_t mSemantic;
+ uint32_t mSemantic;
TextureDefinition mTexture;
};
{
struct TextureData
{
- PixelData mPixels;
+ PixelData mPixels;
SamplerFlags::Type mSamplerFlags;
};
public: // DATA
uint32_t mFlags = 0x0;
- Index mEnvironmentIdx = 0;
- Vector4 mColor = Color::WHITE;
- float mMetallic = 1.f;
- float mRoughness = 1.f;
+ Index mEnvironmentIdx = 0;
+ Vector4 mColor = Color::WHITE;
+ float mMetallic = 1.f;
+ float mRoughness = 1.f;
std::vector<TextureStage> mTextureStages;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_MATERIAL_DEFINITION_H
#ifndef DALI_SCENE_LOADER_MATRIX_STACK_H_
#define DALI_SCENE_LOADER_MATRIX_STACK_H_
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "dali-scene-loader/public-api/api.h"
// EXTERNAL INCLUDES
-#include "dali/public-api/math/matrix.h"
#include "dali/public-api/common/vector-wrapper.h"
+#include "dali/public-api/math/matrix.h"
namespace Dali
{
namespace SceneLoader
{
-
/**
* @brief A stack of matrices whereby each newly pushed matrix is stored
* after being multiplied by the previous one (if any).
public:
MatrixStack();
- bool IsEmpty() const;
- void Push(const Matrix& model);
+ bool IsEmpty() const;
+ void Push(const Matrix& model);
const Matrix& Top() const;
- void Pop();
- void PopAll(); // clears the stack, but retains the storage.
+ void Pop();
+ void PopAll(); // clears the stack, but retains the storage.
private:
std::vector<Matrix> mStack;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_MATRIX_STACK_H_
#ifndef DALI_SCENE_LOADER_MESH_DEFINITION_H
#define DALI_SCENE_LOADER_MESH_DEFINITION_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// INTERNAL INCLUDES
#include "dali-scene-loader/public-api/api.h"
-#include "dali-scene-loader/public-api/mesh-geometry.h"
#include "dali-scene-loader/public-api/blend-shape-details.h"
-#include "dali-scene-loader/public-api/utils.h"
#include "dali-scene-loader/public-api/index.h"
+#include "dali-scene-loader/public-api/mesh-geometry.h"
+#include "dali-scene-loader/public-api/utils.h"
// EXTERNAL INCLUDES
-#include "dali/public-api/common/vector-wrapper.h"
#include <memory>
+#include "dali/public-api/common/vector-wrapper.h"
namespace Dali
{
namespace SceneLoader
{
-
/**
* @brief Defines a mesh with its attributes, the primitive type to render it as,
* and the file to load it from with the offset and length information for the
{
using Vector = std::vector<std::pair<MeshDefinition, MeshGeometry>>;
- enum : uint32_t { INVALID = std::numeric_limits<uint32_t>::max() };
+ enum : uint32_t
+ {
+ INVALID = std::numeric_limits<uint32_t>::max()
+ };
enum Flags : uint16_t
{
FLIP_UVS_VERTICAL = NthBit(0),
- U32_INDICES = NthBit(1), // default is unsigned short
- U16_JOINT_IDS = NthBit(2), // default is floats
+ U32_INDICES = NthBit(1), // default is unsigned short
+ U16_JOINT_IDS = NthBit(2), // default is floats
};
enum Attributes
{
- INDICES = NthBit(0),
- POSITIONS = NthBit(1),
- NORMALS = NthBit(2),
- TEX_COORDS = NthBit(3),
- TANGENTS = NthBit(4),
- LEGACY_BITANGENTS = NthBit(5), // these are ignored; we're calculating them in the (PBR) shader.
- JOINTS_0 = NthBit(6),
- WEIGHTS_0 = NthBit(7),
+ INDICES = NthBit(0),
+ POSITIONS = NthBit(1),
+ NORMALS = NthBit(2),
+ TEX_COORDS = NthBit(3),
+ TANGENTS = NthBit(4),
+ LEGACY_BITANGENTS = NthBit(5), // these are ignored; we're calculating them in the (PBR) shader.
+ JOINTS_0 = NthBit(6),
+ WEIGHTS_0 = NthBit(7),
};
/**
*/
struct Blob
{
- uint32_t mOffset = INVALID; // the default means that the blob is undefined.
- uint32_t mLength = 0; // if the blob is undefined, its data may still be generated. This is enabled by setting length to some non-0 value. Refer to MeshDefinition for details.
- uint16_t mStride = 0; // ignore if 0
- uint16_t mElementSizeHint = 0; // ignore if 0 or stride == 0
+ uint32_t mOffset = INVALID; // the default means that the blob is undefined.
+ uint32_t mLength = 0; // if the blob is undefined, its data may still be generated. This is enabled by setting length to some non-0 value. Refer to MeshDefinition for details.
+ uint16_t mStride = 0; // ignore if 0
+ uint16_t mElementSizeHint = 0; // ignore if 0 or stride == 0
std::vector<float> mMin;
std::vector<float> mMax;
Blob() = default;
- Blob(uint32_t offset, uint32_t length, uint16_t stride = 0, uint16_t elementSizeHint = 0,
- const std::vector<float>& min = {}, const std::vector<float>& max = {});
+ Blob(uint32_t offset, uint32_t length, uint16_t stride = 0, uint16_t elementSizeHint = 0, const std::vector<float>& min = {}, const std::vector<float>& max = {});
/**
* @brief Calculates the size of a tightly-packed buffer for the elements from the blob.
SparseBlob(const Blob& indices, const Blob& values, uint32_t count);
- Blob mIndices;
- Blob mValues;
+ Blob mIndices;
+ Blob mValues;
uint32_t mCount = 0u;
};
struct Accessor
{
- Blob mBlob;
+ Blob mBlob;
std::unique_ptr<SparseBlob> mSparse;
Accessor() = default;
Accessor(Accessor&&) = default;
Accessor& operator=(Accessor&&) = default;
- Accessor(const MeshDefinition::Blob& blob,
- const MeshDefinition::SparseBlob& sparse);
+ Accessor(const MeshDefinition::Blob& blob,
+ const MeshDefinition::SparseBlob& sparse);
bool IsDefined() const
{
struct BlendShape
{
std::string name;
- Accessor deltas;
- Accessor normals;
- Accessor tangents;
- float weight = 0.f;
+ Accessor deltas;
+ Accessor normals;
+ Accessor tangents;
+ float weight = 0.f;
};
struct RawData
{
struct Attrib
{
- std::string mName;
- Property::Type mType;
- uint32_t mNumElements;
+ std::string mName;
+ Property::Type mType;
+ uint32_t mNumElements;
std::vector<uint8_t> mData;
void AttachBuffer(Geometry& g) const;
};
std::vector<uint16_t> mIndices;
- std::vector<Attrib> mAttribs;
+ std::vector<Attrib> mAttribs;
- unsigned int mBlendShapeBufferOffset;
+ unsigned int mBlendShapeBufferOffset;
Dali::Vector<float> mBlendShapeUnnormalizeFactor;
- PixelData mBlendShapeData;
+ PixelData mBlendShapeData;
};
MeshDefinition() = default;
MeshGeometry Load(RawData&& raw) const;
public: // DATA
- uint32_t mFlags = 0x0;
+ uint32_t mFlags = 0x0;
Geometry::Type mPrimitiveType = Geometry::TRIANGLES;
- std::string mUri;
- Accessor mIndices;
- Accessor mPositions;
- Accessor mNormals; // data can be generated based on positions
- Accessor mTexCoords;
- Accessor mTangents; // data can be generated based on normals and texCoords (the latter isn't mandatory; the results will be better if available)
- Accessor mJoints0;
- Accessor mWeights0;
-
- Blob mBlendShapeHeader;
+ std::string mUri;
+ Accessor mIndices;
+ Accessor mPositions;
+ Accessor mNormals; // data can be generated based on positions
+ Accessor mTexCoords;
+ Accessor mTangents; // data can be generated based on normals and texCoords (the latter isn't mandatory; the results will be better if available)
+ Accessor mJoints0;
+ Accessor mWeights0;
+
+ Blob mBlendShapeHeader;
std::vector<BlendShape> mBlendShapes;
- BlendShapes::Version mBlendShapeVersion = BlendShapes::Version::INVALID;
+ BlendShapes::Version mBlendShapeVersion = BlendShapes::Version::INVALID;
Index mSkeletonIdx = INVALID_INDEX;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_MESH_DEFINITION_H
#ifndef DALI_SCENE_LOADER_MESH_GEOMETRY_H
#define DALI_SCENE_LOADER_MESH_GEOMETRY_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
{
namespace SceneLoader
{
-
struct DALI_SCENE_LOADER_API MeshGeometry
{
- Geometry geometry; ///< The array of vertices.
- Texture blendShapeGeometry; ///< The array of vertices of the different blend shapes encoded inside a texture with power of two dimensions.
+ Geometry geometry; ///< The array of vertices.
+ Texture blendShapeGeometry; ///< The array of vertices of the different blend shapes encoded inside a texture with power of two dimensions.
Vector<float> blendShapeUnnormalizeFactor; ///< Factor used to unnormalize the geometry of the blend shape.
- unsigned int blendShapeBufferOffset; ///< Offset used to calculate the start of each blend shape.
+ unsigned int blendShapeBufferOffset; ///< Offset used to calculate the start of each blend shape.
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif // DALI_SCENE_LOADER_MESH_GEOMETRY_H
#ifndef DALI_SCENE_LOADER_NODE_DEFINITION_H_
#define DALI_SCENE_LOADER_NODE_DEFINITION_H_
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "dali-scene-loader/public-api/resource-bundle.h"
// EXTERNAL INCLUDES
-#include "dali/public-api/math/quaternion.h"
+#include <functional>
+#include <memory>
+#include <string>
+#include "dali/public-api/actors/actor.h"
#include "dali/public-api/math/matrix.h"
+#include "dali/public-api/math/quaternion.h"
#include "dali/public-api/math/vector4.h"
-#include "dali/public-api/actors/actor.h"
-#include <string>
-#include <memory>
-#include <functional>
namespace Dali
{
namespace SceneLoader
{
-
class ViewProjection;
/**
struct DALI_SCENE_LOADER_API ConstraintDefinition
{
std::string mProperty; ///< name of the property to constrain.
- Index mSourceIdx; ///< index of the node to serve as the source of the constraint.
+ Index mSourceIdx; ///< index of the node to serve as the source of the constraint.
bool operator<(const ConstraintDefinition& other) const
{
struct DALI_SCENE_LOADER_API Transforms
{
- MatrixStack modelStack;
+ MatrixStack modelStack;
const ViewProjection& viewProjection;
};
*/
struct DALI_SCENE_LOADER_API SkinningShaderConfigurationRequest
{
- Index mSkeletonIdx;
+ Index mSkeletonIdx;
Shader mShader;
bool operator<(const SkinningShaderConfigurationRequest& other) const
struct DALI_SCENE_LOADER_API BlendshapeShaderConfigurationRequest
{
std::string mNodeName;
- Index mMeshIdx;
- Shader mShader;
+ Index mMeshIdx;
+ Shader mShader;
bool operator<(const BlendshapeShaderConfigurationRequest& other) const
{
*/
struct DALI_SCENE_LOADER_API ConstraintRequest
{
- const ConstraintDefinition* const mConstraint; ///< Definition of the constraint to create.
- Actor mTarget; ///< Target of the constraint.
+ const ConstraintDefinition* const mConstraint; ///< Definition of the constraint to create.
+ Actor mTarget; ///< Target of the constraint.
};
/**
*/
struct DALI_SCENE_LOADER_API NodeDefinition
{
-public: // TYPES
+public: // TYPES
using Vector = std::vector<NodeDefinition>;
struct CreateParams
{
public: // input
const ResourceBundle& mResources;
- Transforms& mXforms;
+ Transforms& mXforms;
public: // output
- std::vector<ConstraintRequest> mConstrainables;
- std::vector<SkinningShaderConfigurationRequest> mSkinnables;
+ std::vector<ConstraintRequest> mConstrainables;
+ std::vector<SkinningShaderConfigurationRequest> mSkinnables;
std::vector<BlendshapeShaderConfigurationRequest> mBlendshapeRequests;
};
{
auto choice = choices.Get(mTag);
return std::min(choice != Customization::NONE ? choice : 0,
- static_cast<Index>(node.mChildren.size() - 1));
+ static_cast<Index>(node.mChildren.size() - 1));
}
};
class IVisitor
{
public:
- virtual void Start(NodeDefinition& n) = 0;
+ virtual void Start(NodeDefinition& n) = 0;
virtual void Finish(NodeDefinition& n) = 0;
protected:
class IConstVisitor
{
public:
- virtual void Start(const NodeDefinition& n) = 0;
+ virtual void Start(const NodeDefinition& n) = 0;
virtual void Finish(const NodeDefinition& n) = 0;
protected:
struct Extra
{
- std::string mKey;
+ std::string mKey;
Property::Value mValue;
bool operator<(const Extra& other) const
}
};
-public: // METHODS
+public: // METHODS
/**
* @brief Creates a DALi Actor from this definition only.
* @note Not recursive.
std::string mName;
- Vector3 mPosition = Vector3::ZERO;
+ Vector3 mPosition = Vector3::ZERO;
Quaternion mOrientation = Quaternion::IDENTITY;
- Vector3 mScale = Vector3::ONE;
- Vector3 mSize = Vector3::ONE;
+ Vector3 mScale = Vector3::ONE;
+ Vector3 mSize = Vector3::ONE;
bool mIsVisible = true;
- std::unique_ptr<Renderable> mRenderable;
+ std::unique_ptr<Renderable> mRenderable;
std::unique_ptr<CustomizationDefinition> mCustomization;
- std::vector<Extra> mExtras;
- std::vector<ConstraintDefinition> mConstraints;
+ std::vector<Extra> mExtras;
+ std::vector<ConstraintDefinition> mConstraints;
std::vector<Index> mChildren;
- Index mParentIdx = INVALID_INDEX;
+ Index mParentIdx = INVALID_INDEX;
};
class DALI_SCENE_LOADER_API ModelNode : public NodeDefinition::Renderable
{
public: // DATA
- Vector4 mColor = Color::WHITE;
- Index mMeshIdx = INVALID_INDEX;
- Index mMaterialIdx = INVALID_INDEX;
+ Vector4 mColor = Color::WHITE;
+ Index mMeshIdx = INVALID_INDEX;
+ Index mMaterialIdx = INVALID_INDEX;
public: // METHODS
void RegisterResources(IResourceReceiver& receiver) const override;
class DALI_SCENE_LOADER_API ArcNode : public ModelNode
{
public: // DATA
- bool mAntiAliasing = true;
- int mArcCaps = 0;
+ bool mAntiAliasing = true;
+ int mArcCaps = 0;
float mStartAngleDegrees = .0f;
- float mEndAngleDegrees = .0f;
- float mRadius = .0f;
+ float mEndAngleDegrees = .0f;
+ float mRadius = .0f;
public: // METHODS
static void GetEndVectorWithDiffAngle(float startAngle, float endAngle, Vector2& endVector);
void OnCreate(const NodeDefinition& node, NodeDefinition::CreateParams& params, Actor& actor) const override;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_NODE_DEFINITION_H_
#ifndef DALI_SCENE_LOADER_INTERPRET_RENDERER_STATE_H
#define DALI_SCENE_LOADER_INTERPRET_RENDERER_STATE_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
{
namespace RendererState
{
-
/*
* @brief Attempts to interpret a string for renderer states, which can be a combination of the following
* (using '|' as a delimiter, if multiple specified):<br/>
*/
DALI_SCENE_LOADER_API Type Parse(const char* string, size_t length = 0, StringCallback onError = DefaultErrorCallback);
-}
-}
-}
+} // namespace RendererState
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_INTERPRET_RENDERER_STATE_H
#ifndef DALI_SCENE_LOADER_RENDERER_STATE_H
#define DALI_SCENE_LOADER_RENDERER_STATE_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
{
namespace SceneLoader
{
-
/*
* @brief Contains values for comparison functions used in depth and stencil testing.
* @note Relative order of members must match DepthFunction::Type and StencilFunction::Type.
{
enum Type
{
- OMIT, // not specified; will not be set.
+ OMIT, // not specified; will not be set.
NEVER,
ALWAYS,
LESS,
{
enum Type
{
- OMIT, // not specified - will not be updated
+ OMIT, // not specified - will not be updated
ZERO,
- ONE, // default for source alpha
+ ONE, // default for source alpha
SRC_COLOR,
ONE_MINUS_SRC_COLOR,
- SRC_ALPHA, // default for source RGB
- ONE_MINUS_SRC_ALPHA, // default for destination RGB and destination alpha
+ SRC_ALPHA, // default for source RGB
+ ONE_MINUS_SRC_ALPHA, // default for destination RGB and destination alpha
DST_ALPHA,
ONE_MINUS_DST_ALPHA,
DST_COLOR,
{
enum Type
{
- OMIT, ///< not specified - will not be updated
- NONE, ///< Don’t write to either color or stencil buffer (But will potentially render to depth buffer).
- AUTO, ///< Writes are managed by the Actor Clipping API. This is DALi's default.
- COLOR, ///< Ignore stencil properties. Write to the color buffer.
- STENCIL, ///< Use the stencil properties. Do not write to the color buffer.
- COLOR_STENCIL ///< Use the stencil properties AND Write to the color buffer.
+ OMIT, ///< not specified - will not be updated
+ NONE, ///< Don’t write to either color or stencil buffer (But will potentially render to depth buffer).
+ AUTO, ///< Writes are managed by the Actor Clipping API. This is DALi's default.
+ COLOR, ///< Ignore stencil properties. Write to the color buffer.
+ STENCIL, ///< Use the stencil properties. Do not write to the color buffer.
+ COLOR_STENCIL ///< Use the stencil properties AND Write to the color buffer.
};
BufferMode() = delete;
*/
namespace RendererState
{
-
-using Type = uint32_t; // 8 bits reserved for flags, 4 * 4 bit for blend factors, 4 bits for depth function
+using Type = uint32_t; // 8 bits reserved for flags, 4 * 4 bit for blend factors, 4 bits for depth function
enum DALI_SCENE_LOADER_API Value : Type
{
NONE = 0x0,
DEPTH_WRITE = 0x01,
- DEPTH_TEST = 0x02,
+ DEPTH_TEST = 0x02,
CULL_FRONT = 0x04,
- CULL_BACK = 0x08,
+ CULL_BACK = 0x08,
ALPHA_BLEND = 0x10,
DEPTH_FUNCTION_SHIFT = 6,
- DEPTH_FUNCTION_BITS = 4,
- DEPTH_FUNCTION_MASK = ((1 << DEPTH_FUNCTION_BITS) - 1) << DEPTH_FUNCTION_SHIFT,
+ DEPTH_FUNCTION_BITS = 4,
+ DEPTH_FUNCTION_MASK = ((1 << DEPTH_FUNCTION_BITS) - 1) << DEPTH_FUNCTION_SHIFT,
BLEND_FACTOR_BASE_SHIFT = DEPTH_FUNCTION_SHIFT + DEPTH_FUNCTION_BITS,
- BLEND_FACTOR_ITEM_BITS = 4,
- BLEND_FACTOR_ITEMS = 4,
- BLEND_FACTOR_BITS = BLEND_FACTOR_ITEM_BITS * BLEND_FACTOR_ITEMS,
- BLEND_FACTOR_MASK = ((1 << BLEND_FACTOR_BITS) - 1) << BLEND_FACTOR_BASE_SHIFT,
- BLEND_FACTOR_ITEM_MASK = (1 << BLEND_FACTOR_ITEM_BITS) - 1, // after rshifting by BLEND_FACTOR_BASE_SHIFT
+ BLEND_FACTOR_ITEM_BITS = 4,
+ BLEND_FACTOR_ITEMS = 4,
+ BLEND_FACTOR_BITS = BLEND_FACTOR_ITEM_BITS * BLEND_FACTOR_ITEMS,
+ BLEND_FACTOR_MASK = ((1 << BLEND_FACTOR_BITS) - 1) << BLEND_FACTOR_BASE_SHIFT,
+ BLEND_FACTOR_ITEM_MASK = (1 << BLEND_FACTOR_ITEM_BITS) - 1, // after rshifting by BLEND_FACTOR_BASE_SHIFT
// Buffer mode is DALi's RenderMode, just to avoid too much conflation.
- BUFFER_MODE_BITS = 3u,
- BUFFER_MODE_SHIFT = 32u - BUFFER_MODE_BITS, // from end
- BUFFER_MODE_MASK = ((1u << BUFFER_MODE_BITS) - 1u) << BUFFER_MODE_SHIFT,
+ BUFFER_MODE_BITS = 3u,
+ BUFFER_MODE_SHIFT = 32u - BUFFER_MODE_BITS, // from end
+ BUFFER_MODE_MASK = ((1u << BUFFER_MODE_BITS) - 1u) << BUFFER_MODE_SHIFT,
DEFAULT = DEPTH_WRITE | DEPTH_TEST | CULL_BACK | (Comparison::LESS_EQUAL << DEPTH_FUNCTION_SHIFT),
};
* @brief Encodes the given blend factors into a RenderMode value, maskable into other options,
* passable into ApplyRenderMode().
*/
-inline
-DALI_SCENE_LOADER_API constexpr uint32_t FromBlendFactors(BlendFactor::Type srcRgb, BlendFactor::Type destRgb,
- BlendFactor::Type srcAlpha, BlendFactor::Type destAlpha)
+inline DALI_SCENE_LOADER_API constexpr uint32_t FromBlendFactors(BlendFactor::Type srcRgb, BlendFactor::Type destRgb, BlendFactor::Type srcAlpha, BlendFactor::Type destAlpha)
{
return (srcRgb | (destRgb << BLEND_FACTOR_ITEM_BITS) | (srcAlpha << (BLEND_FACTOR_ITEM_BITS * 2)) |
- (destAlpha << (BLEND_FACTOR_ITEM_BITS * 3))) << BLEND_FACTOR_BASE_SHIFT;
+ (destAlpha << (BLEND_FACTOR_ITEM_BITS * 3)))
+ << BLEND_FACTOR_BASE_SHIFT;
}
/*
*/
DALI_SCENE_LOADER_API void Apply(Type rendererState, Renderer& renderer);
-} // RendererState
+} // namespace RendererState
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_RENDERER_STATE_H
#ifndef DALI_SCENE_LOADER_RESOURCE_BUNDLE_H_
#define DALI_SCENE_LOADER_RESOURCE_BUNDLE_H_
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// INTERNAL
-#include "dali-scene-loader/public-api/mesh-definition.h"
-#include "dali-scene-loader/public-api/material-definition.h"
#include "dali-scene-loader/public-api/environment-definition.h"
+#include "dali-scene-loader/public-api/material-definition.h"
+#include "dali-scene-loader/public-api/mesh-definition.h"
#include "dali-scene-loader/public-api/shader-definition.h"
#include "dali-scene-loader/public-api/skeleton-definition.h"
// EXTERNAL
+#include <functional>
+#include <memory>
#include "dali/public-api/common/vector-wrapper.h"
#include "dali/public-api/rendering/shader.h"
#include "dali/public-api/rendering/texture-set.h"
-#include <memory>
-#include <functional>
namespace Dali
{
namespace SceneLoader
{
-
/*
* @brief The types of resources that .dli may define.
*/
enum Value : Type
{
- None = 0,
- ForceReload = NthBit(0), ///< Load resources [again] even if they were already loaded.
- KeepUnused = NthBit(1) ///<s Don't reset handles to resources that had a 0 reference count.
+ None = 0,
+ ForceReload = NthBit(0), ///< Load resources [again] even if they were already loaded.
+ KeepUnused = NthBit(1) ///<s Don't reset handles to resources that had a 0 reference count.
};
};
* UNLESS the KeepUnused option was specified.
*/
void LoadResources(const ResourceRefCounts& refCounts,
- PathProvider pathProvider,
- Options::Type options = Options::None);
+ PathProvider pathProvider,
+ Options::Type options = Options::None);
public: // DATA
EnvironmentDefinition::Vector mEnvironmentMaps;
- ShaderDefinition::Vector mShaders;
- MeshDefinition::Vector mMeshes;
- MaterialDefinition::Vector mMaterials;
+ ShaderDefinition::Vector mShaders;
+ MeshDefinition::Vector mMeshes;
+ MaterialDefinition::Vector mMaterials;
SkeletonDefinition::Vector mSkeletons;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_RESOURCE_BUNDLE_H_
#ifndef DALI_SCENE_LOADER_SCENE_DEFINITION_H_
#define DALI_SCENE_LOADER_SCENE_DEFINITION_H_
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// INTERNAL INCLUDES
#include "dali-scene-loader/public-api/customization.h"
-#include "dali-scene-loader/public-api/utils.h"
#include "dali-scene-loader/public-api/node-definition.h"
#include "dali-scene-loader/public-api/string-callback.h"
+#include "dali-scene-loader/public-api/utils.h"
// EXTERNAL INCLUDES
-#include "dali/public-api/math/quaternion.h"
+#include <memory>
+#include <string>
+#include "dali/public-api/actors/actor.h"
#include "dali/public-api/math/matrix.h"
+#include "dali/public-api/math/quaternion.h"
#include "dali/public-api/math/vector4.h"
-#include "dali/public-api/actors/actor.h"
-#include <string>
-#include <memory>
namespace Dali
{
namespace SceneLoader
{
-
class MatrixStack;
/*
*/
class DALI_SCENE_LOADER_API SceneDefinition
{
-public: // TYPES
- using NodePredicate = std::function<bool(const NodeDefinition&)>;
- using NodeConsumer = std::function<void(NodeDefinition&)>;
+public: // TYPES
+ using NodePredicate = std::function<bool(const NodeDefinition&)>;
+ using NodeConsumer = std::function<void(NodeDefinition&)>;
using ConstNodeConsumer = std::function<void(const NodeDefinition&)>;
public: // METHODS
* from node definitions.
* @return Handle to the root actor.
*/
- Actor CreateNodes(Index iNode, const Customization::Choices& choices,
- NodeDefinition::CreateParams& params) const;
+ Actor CreateNodes(Index iNode, const Customization::Choices& choices, NodeDefinition::CreateParams& params) const;
/*
* @brief Creates / update a registry of mappings from customization tags to
* choice of 0.
*/
void GetCustomizationOptions(const Customization::Choices& choices,
- Customization::Map& outCustomizationOptions,
- Customization::Choices* outMissingChoices) const;
+ Customization::Map& outCustomizationOptions,
+ Customization::Choices* outMissingChoices) const;
/*
* @brief Attempts to add @a nodeDef to the end of nodes, and its index to the end of
/*
* @brief Applies constraints from the given requests.
*/
- void ApplyConstraints(Actor& root,
- std::vector<ConstraintRequest>&& constrainables,
- StringCallback onError = DefaultErrorCallback) const;
+ void ApplyConstraints(Actor& root,
+ std::vector<ConstraintRequest>&& constrainables,
+ StringCallback onError = DefaultErrorCallback) const;
/*
* @brief Sets up joint matrix properties and constraints on actors that are involved in skeletal
* of separate instances need to be declared in the .dli to avoid clashing uniform
* definitions and constraints.
*/
- void ConfigureSkinningShaders(const ResourceBundle& resources,
- Actor root, std::vector<SkinningShaderConfigurationRequest>&& requests) const;
+ void ConfigureSkinningShaders(const ResourceBundle& resources,
+ Actor root,
+ std::vector<SkinningShaderConfigurationRequest>&& requests) const;
/*
* @brief Ensures there is no two meshes with blend shapes sharing the same shader.
* @param[in] resources The resources bundle. Meshes need to be accessed to configure the blend shapes.
* @param[in] onError The error callback.
*/
- bool ConfigureBlendshapeShaders(const ResourceBundle& resources,
- Actor root, std::vector<BlendshapeShaderConfigurationRequest>&& requests,
- StringCallback onError = DefaultErrorCallback) const;
+ bool ConfigureBlendshapeShaders(const ResourceBundle& resources,
+ Actor root,
+ std::vector<BlendshapeShaderConfigurationRequest>&& requests,
+ StringCallback onError = DefaultErrorCallback) const;
SceneDefinition& operator=(SceneDefinition&& other);
private: // METHODS
bool FindNode(const std::string& name, std::unique_ptr<NodeDefinition>** result);
-private: // DATA
- std::vector<std::unique_ptr<NodeDefinition>> mNodes; // size unknown up front (may discard nodes).
- std::vector<Index> mRootNodeIds;
+private: // DATA
+ std::vector<std::unique_ptr<NodeDefinition>> mNodes; // size unknown up front (may discard nodes).
+ std::vector<Index> mRootNodeIds;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_SCENE_DEFINITION_H_
#ifndef DALI_SCENE_LOADER_SHADER_DEFINITION_FACTORY_H_
#define DALI_SCENE_LOADER_SHADER_DEFINITION_FACTORY_H_
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/index.h"
#include "dali-scene-loader/public-api/api.h"
+#include "dali-scene-loader/public-api/index.h"
// EXTERNAL INCLUDER
#include <memory>
{
namespace SceneLoader
{
-
struct NodeDefinition;
class ResourceBundle;
const std::unique_ptr<Impl> mImpl;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_SHADER_DEFINITION_FACTORY_H_
#ifndef DALI_SCENE_LOADER_SHADER_DEFINITION_H
#define DALI_SCENE_LOADER_SHADER_DEFINITION_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "dali-scene-loader/public-api/renderer-state.h"
// EXTERNAL INCLUDES
+#include <memory>
#include "dali/public-api/common/vector-wrapper.h"
#include "dali/public-api/rendering/shader.h"
-#include <memory>
namespace Dali
{
namespace SceneLoader
{
-
/*
* @brief Defines a shader with paths to the files which define its
* vertex and fragment components, and a mapping of uniform names (which are
public: // DATA
RendererState::Type mRendererState = RendererState::NONE;
- std::string mVertexShaderPath;
- std::string mFragmentShaderPath;
+ std::string mVertexShaderPath;
+ std::string mFragmentShaderPath;
std::vector<std::string> mDefines;
std::vector<std::string> mHints;
Property::Map mUniforms;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_SHADER_DEFINITION_H
#ifndef DALI_SCENE_LOADER_SKELETON_H
#define DALI_SCENE_LOADER_SKELETON_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
{
namespace SceneLoader
{
-
/*
* @brief A set of joints (stored as node indices), and an optional root node index.
* @note The list of joints must not be empty and must not contain INVALID_INDEX.
{
struct Joint
{
- Index mNodeIdx;
+ Index mNodeIdx;
Matrix mInverseBindMatrix;
};
using Vector = std::vector<SkeletonDefinition>;
- Index mRootNodeIdx = INVALID_INDEX;
+ Index mRootNodeIdx = INVALID_INDEX;
std::vector<Joint> mJoints;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_SKELETON_H
#ifndef DALI_SCENE_LOADER_SKINNING_DETAILS_H_
#define DALI_SCENE_LOADER_SKINNING_DETAILS_H_
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "dali-scene-loader/public-api/api.h"
// EXTERNAL INCLUDES
-#include "dali/public-api/rendering/shader.h"
#include <string>
+#include "dali/public-api/rendering/shader.h"
namespace Dali
{
Skinning() = delete;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif // DALI_SCENE_LOADER_SKINNING_DETAILS_H_
#ifndef DALI_SCENE_LOADER_STRING_CALLBACK_H
#define DALI_SCENE_LOADER_STRING_CALLBACK_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
{
namespace SceneLoader
{
-
/*
* @brief A callback to post strings to.
*/
*/
DALI_SCENE_LOADER_API void DefaultErrorCallback(const std::string& message);
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_STRING_CALLBACK_H
#ifndef DALI_SCENE_LOADER_UTILS_H_
#define DALI_SCENE_LOADER_UTILS_H_
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "dali-scene-loader/public-api/api.h"
// EXTERNAL INCLUDES
+#include <cctype>
+#include <sstream>
#include "dali/public-api/actors/actor.h"
-#include "dali/public-api/rendering/renderer.h"
#include "dali/public-api/common/dali-common.h"
-#include <sstream>
-#include <cctype>
+#include "dali/public-api/rendering/renderer.h"
namespace Dali
{
namespace SceneLoader
{
-
/*
* @brief Fixed size backing buffer to use with std::ostreams where control over
* allocations (which this does not make), is required.
class DALI_SCENE_LOADER_API ExceptionFlinger
{
public:
- enum { MESSAGE_BUFFER_SIZE = 512 };
+ enum
+ {
+ MESSAGE_BUFFER_SIZE = 512
+ };
ExceptionFlinger(const char* location) noexcept(true);
- [[noreturn]]
- ~ExceptionFlinger() noexcept(false);
+ [[noreturn]] ~ExceptionFlinger() noexcept(false);
- template <typename T>
+ template<typename T>
ExceptionFlinger& operator<<(const T& rhs) noexcept(true)
{
mStream << rhs;
{
const char* mLocation;
- [[noreturn]]
- ~Impl() noexcept(false);
+ [[noreturn]] ~Impl() noexcept(false);
};
static char* GetMessageBuffer() noexcept(true);
- Impl mImpl;
+ Impl mImpl;
StreamBuffer mStreamBuffer;
std::ostream mStream;
};
/*
* @return The @n th bit in a bitmask.
*/
-DALI_SCENE_LOADER_API constexpr size_t NthBit(size_t n) { return 1 << n; }
+DALI_SCENE_LOADER_API constexpr size_t NthBit(size_t n)
+{
+ return 1 << n;
+}
/*
* @return Whether all of @a mask 's bits are set on @a value.
*/
-inline
-DALI_SCENE_LOADER_API bool MaskMatch(uint32_t value, uint32_t mask)
+inline DALI_SCENE_LOADER_API bool MaskMatch(uint32_t value, uint32_t mask)
{
return (value & mask) == mask;
}
/*
* @brief Convert a four-letter(, null-terminated) string literal into a uint32_t.
*/
-inline
-DALI_SCENE_LOADER_API constexpr uint32_t FourCC(const char(&fourCC)[5])
+inline DALI_SCENE_LOADER_API constexpr uint32_t FourCC(const char (&fourCC)[5])
{
return (fourCC[3] << 24) | (fourCC[2] << 16) | (fourCC[1] << 8) | fourCC[0];
}
* @param[in] b, compare string
* @return true if strings are equal
*/
-inline
-DALI_SCENE_LOADER_API bool CaseInsensitiveCharacterCompare( unsigned char a, unsigned char b )
+inline DALI_SCENE_LOADER_API bool CaseInsensitiveCharacterCompare(unsigned char a, unsigned char b)
{
// Converts to lower case in the current locale.
- return std::tolower( a ) == std::tolower( b );
+ return std::tolower(a) == std::tolower(b);
}
/*
* @param[in] a, compare string
* @param[in] b, compare string
*/
-inline
-DALI_SCENE_LOADER_API bool CaseInsensitiveStringCompare( const std::string& a, const std::string& b )
+inline DALI_SCENE_LOADER_API bool CaseInsensitiveStringCompare(const std::string& a, const std::string& b)
{
bool result = false;
- if( a.length() == b.length() )
+ if(a.length() == b.length())
{
- result = std::equal( a.begin(), a.end(), b.begin(), &CaseInsensitiveCharacterCompare );
+ result = std::equal(a.begin(), a.end(), b.begin(), &CaseInsensitiveCharacterCompare);
}
return result;
}
* @note Use of a @a fn that is itself recursing in @a is also discouraged
* for performance and stability reasons.
*/
-template <typename Func>
-inline
-DALI_SCENE_LOADER_API void VisitActor(Actor a, Func fn)
+template<typename Func>
+inline DALI_SCENE_LOADER_API void VisitActor(Actor a, Func fn)
{
fn(a);
* @brief Convenience function to set the given actor @a 's anchor point
* and parent origin to center.
*/
-inline
-DALI_SCENE_LOADER_API void SetActorCentered(Actor a)
+inline DALI_SCENE_LOADER_API void SetActorCentered(Actor a)
{
a.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
a.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
enum DALI_SCENE_LOADER_API Values : Type
{
- NONE = 0x00,
+ NONE = 0x00,
FLIP_VERTICAL = 0x01,
};
-}
+} // namespace TexturedQuadOptions
/*
* @brief Makes... geometry for a textured quad.
* @brief Fixes the path of a file. Replaces the '\\' separator by the '/' one.
* @param[in,out] path The path to be fixed.
*/
-DALI_SCENE_LOADER_API void ToUnixFileSeparators( std::string& path );
+DALI_SCENE_LOADER_API void ToUnixFileSeparators(std::string& path);
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif /* DALI_SCENE_LOADER_UTILS_H_ */
#ifndef DALI_SCENE_LOADER_VIEW_PROJECTION_H_
#define DALI_SCENE_LOADER_VIEW_PROJECTION_H_
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
{
namespace SceneLoader
{
-
/**
* @brief Contains view and projection matrices, also caching the view-projection
* and inverse projection matrices.
class ViewProjection
{
public:
- Matrix& GetView() { return mView; }
- Matrix& GetProjection() { return mProjection; }
+ Matrix& GetView()
+ {
+ return mView;
+ }
+ Matrix& GetProjection()
+ {
+ return mProjection;
+ }
/*
* @brief Updates the cached view projection and inverse projection matrices.
*/
void Update();
- const Matrix& GetView() const { return mView; }
- const Matrix& GetProjection() const { return mProjection; }
- const Matrix& GetInverseProjection() const { return mInvProjection; }
- const Matrix& GetViewProjection() const { return mViewProjection; }
+ const Matrix& GetView() const
+ {
+ return mView;
+ }
+ const Matrix& GetProjection() const
+ {
+ return mProjection;
+ }
+ const Matrix& GetInverseProjection() const
+ {
+ return mInvProjection;
+ }
+ const Matrix& GetViewProjection() const
+ {
+ return mViewProjection;
+ }
private:
Matrix mView;
Matrix mViewProjection;
};
-}
-}
+} // namespace SceneLoader
+} // namespace Dali
#endif //DALI_SCENE_LOADER_VIEW_PROJECTION_H_
--- /dev/null
+---
+Language: Cpp
+DisableFormat: true
+SortIncludes: false
+...
#define DALI_TOOLKIT_CONTROL_DEVEL_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace DevelControl
{
/// @brief AccessibilityActivate signal type.
-typedef Signal< void ( ) > AccessibilityActivateSignalType;
+typedef Signal<void()> AccessibilityActivateSignalType;
/// @brief AccessibilityReadingSkipped signal type.
-typedef Signal< void ( ) > AccessibilityReadingSkippedSignalType;
+typedef Signal<void()> AccessibilityReadingSkippedSignalType;
/// @brief AccessibilityReadingPaused signal type.
-typedef Signal< void ( ) > AccessibilityReadingPausedSignalType;
+typedef Signal<void()> AccessibilityReadingPausedSignalType;
/// @brief AccessibilityReadingResumed signal type.
-typedef Signal< void ( ) > AccessibilityReadingResumedSignalType;
+typedef Signal<void()> AccessibilityReadingResumedSignalType;
/// @brief AccessibilityReadingCancelled signal type.
-typedef Signal< void ( ) > AccessibilityReadingCancelledSignalType;
+typedef Signal<void()> AccessibilityReadingCancelledSignalType;
/// @brief AccessibilityReadingStopped signal type.
-typedef Signal< void ( ) > AccessibilityReadingStoppedSignalType;
+typedef Signal<void()> AccessibilityReadingStoppedSignalType;
/// @brief AccessibilityGetName signal type.
-typedef Signal< void ( std::string& ) > AccessibilityGetNameSignalType;
+typedef Signal<void(std::string&)> AccessibilityGetNameSignalType;
/// @brief AccessibilityGetDescription signal type.
-typedef Signal< void ( std::string& ) > AccessibilityGetDescriptionSignalType;
+typedef Signal<void(std::string&)> AccessibilityGetDescriptionSignalType;
/// @brief AccessibilityDoGesture signal type.
-typedef Signal< void ( std::pair<Dali::Accessibility::GestureInfo, bool>& ) > AccessibilityDoGestureSignalType;
+typedef Signal<void(std::pair<Dali::Accessibility::GestureInfo, bool>&)> AccessibilityDoGestureSignalType;
enum State
{
* @brief The signal is emmited as a succession of "activate" signal send by accessibility client.
* @return The signal to connect to
*/
-DALI_TOOLKIT_API AccessibilityActivateSignalType &AccessibilityActivateSignal( Toolkit::Control control );
+DALI_TOOLKIT_API AccessibilityActivateSignalType& AccessibilityActivateSignal(Toolkit::Control control);
/**
* @brief The signal is emmited when text send via Dali::Accessibility::Bridge::Say
*
* @return The signal to connect to
*/
-DALI_TOOLKIT_API AccessibilityReadingSkippedSignalType &AccessibilityReadingSkippedSignal( Toolkit::Control control );
+DALI_TOOLKIT_API AccessibilityReadingSkippedSignalType& AccessibilityReadingSkippedSignal(Toolkit::Control control);
/**
* @brief
*
* @return The signal to connect to
*/
-DALI_TOOLKIT_API AccessibilityReadingPausedSignalType &AccessibilityReadingPausedSignal( Toolkit::Control control );
+DALI_TOOLKIT_API AccessibilityReadingPausedSignalType& AccessibilityReadingPausedSignal(Toolkit::Control control);
/**
* @brief
*
* @return The signal to connect to
*/
-DALI_TOOLKIT_API AccessibilityReadingResumedSignalType &AccessibilityReadingResumedSignal( Toolkit::Control control );
+DALI_TOOLKIT_API AccessibilityReadingResumedSignalType& AccessibilityReadingResumedSignal(Toolkit::Control control);
/**
* @brief The signal is emmited when text send via Dali::Accessibility::Bridge::Say
*
* @return The signal to connect to
*/
-DALI_TOOLKIT_API AccessibilityReadingCancelledSignalType &AccessibilityReadingCancelledSignal( Toolkit::Control control );
+DALI_TOOLKIT_API AccessibilityReadingCancelledSignalType& AccessibilityReadingCancelledSignal(Toolkit::Control control);
/**
* @brief The signal is emmited when text send via Dali::Accessibility::Bridge::Say
*
* @return The signal to connect to
*/
-DALI_TOOLKIT_API AccessibilityReadingStoppedSignalType &AccessibilityReadingStoppedSignal( Toolkit::Control control );
+DALI_TOOLKIT_API AccessibilityReadingStoppedSignalType& AccessibilityReadingStoppedSignal(Toolkit::Control control);
/**
* @brief The signal is emmited when accessibility client asks for object's name.
* Priority is as above. If none is used, default implementation is provided.
* @return [description]
*/
-DALI_TOOLKIT_API AccessibilityGetNameSignalType &AccessibilityGetNameSignal( Toolkit::Control control );
+DALI_TOOLKIT_API AccessibilityGetNameSignalType& AccessibilityGetNameSignal(Toolkit::Control control);
/**
* @brief The signal is emmited when accessibility client asks for object's description.
* Priority is as above. If none is used, default implementation is provided.
* @return signal handler
*/
-DALI_TOOLKIT_API AccessibilityGetDescriptionSignalType &AccessibilityGetDescriptionSignal( Toolkit::Control control );
+DALI_TOOLKIT_API AccessibilityGetDescriptionSignalType& AccessibilityGetDescriptionSignal(Toolkit::Control control);
/**
* @brief The signal is emitted when accessibility client call "DoGesture" method via IPC mechanism.
* This signal allows developers to serve incoming gesture in specific way.
* @return signal handler
*/
-DALI_TOOLKIT_API AccessibilityDoGestureSignalType &AccessibilityDoGestureSignal( Toolkit::Control control );
+DALI_TOOLKIT_API AccessibilityDoGestureSignalType& AccessibilityDoGestureSignal(Toolkit::Control control);
/**
* @brief The method allows connection with other actor with usage of concrete accessibility relation type.
* @param destination Actor object
* @param relation enumerated value describing relation
*/
-DALI_TOOLKIT_API void AppendAccessibilityRelation( Dali::Actor control, Actor destination, Dali::Accessibility::RelationType relation );
+DALI_TOOLKIT_API void AppendAccessibilityRelation(Dali::Actor control, Actor destination, Dali::Accessibility::RelationType relation);
/**
* @brief The method allows removing relation
* @param destination Actor object
* @param relation enumerated value describing relation
*/
-DALI_TOOLKIT_API void RemoveAccessibilityRelation( Dali::Actor control, Actor destination, Dali::Accessibility::RelationType relation );
+DALI_TOOLKIT_API void RemoveAccessibilityRelation(Dali::Actor control, Actor destination, Dali::Accessibility::RelationType relation);
/**
* @brief The method returns collection accessibility addresses representing objects connected with current object
* @param control object to append attribute to
* @return std::vector, where index is casted value of Accessibility::RelationType and value is std::vector of type Accessibility::Address
*/
-DALI_TOOLKIT_API std::vector<std::vector<Accessibility::Address>> GetAccessibilityRelations( Dali::Actor control );
+DALI_TOOLKIT_API std::vector<std::vector<Accessibility::Address>> GetAccessibilityRelations(Dali::Actor control);
/**
* @brief The method removes all previously appended relations
*
* @param control object to append attribute to
*/
-DALI_TOOLKIT_API void ClearAccessibilityRelations( Dali::Actor control );
+DALI_TOOLKIT_API void ClearAccessibilityRelations(Dali::Actor control);
/**
* @brief The method allows to add or modify value matched with given key.
* @param key std::string value
* @param value std::string value
*/
-DALI_TOOLKIT_API void AppendAccessibilityAttribute( Dali::Actor control, const std::string& key, const std::string value );
+DALI_TOOLKIT_API void AppendAccessibilityAttribute(Dali::Actor control, const std::string& key, const std::string value);
/**
* @brief The method erases key with its value from accessibility attributes
* @param control object to append attribute to
* @param key std::string value
*/
-DALI_TOOLKIT_API void RemoveAccessibilityAttribute( Dali::Actor control, const std::string& key );
+DALI_TOOLKIT_API void RemoveAccessibilityAttribute(Dali::Actor control, const std::string& key);
/**
* @brief The method clears accessibility attributes
*
* @param control object to append attribute to
*/
-DALI_TOOLKIT_API void ClearAccessibilityAttributes( Dali::Actor control );
+DALI_TOOLKIT_API void ClearAccessibilityAttributes(Dali::Actor control);
/**
* @brief The method inserts reading information of an accessible object into attributes
* @param control object to append attribute to
* @param types Reading information types
*/
-DALI_TOOLKIT_API void SetAccessibilityReadingInfoType( Dali::Actor control, const Dali::Accessibility::ReadingInfoTypes types );
+DALI_TOOLKIT_API void SetAccessibilityReadingInfoType(Dali::Actor control, const Dali::Accessibility::ReadingInfoTypes types);
/**
* @brief The method returns reading information of an accessible object
* @param control object to append attribute to
* @return Reading information types
*/
-DALI_TOOLKIT_API Dali::Accessibility::ReadingInfoTypes GetAccessibilityReadingInfoType( Dali::Actor control );
+DALI_TOOLKIT_API Dali::Accessibility::ReadingInfoTypes GetAccessibilityReadingInfoType(Dali::Actor control);
/**
* @brief The method erases highlight.
* @param control object to append attribute to
* @return bool value, false when it is not possible or something went wrong, at the other way true.
*/
-DALI_TOOLKIT_API bool ClearAccessibilityHighlight( Dali::Actor control );
+DALI_TOOLKIT_API bool ClearAccessibilityHighlight(Dali::Actor control);
/**
* @brief The method grabs highlight.
* @param control object to append attribute to
* @return bool value, false when it is not possible or something went wrong, at the other way true.
*/
-DALI_TOOLKIT_API bool GrabAccessibilityHighlight( Dali::Actor control );
+DALI_TOOLKIT_API bool GrabAccessibilityHighlight(Dali::Actor control);
/**
* @brief The metod presents bitset of control's states.
* @param control object to append attribute to
* @return Dali::Accessibility::States is vector of enumerated State.
*/
-DALI_TOOLKIT_API Dali::Accessibility::States GetAccessibilityStates( Dali::Actor control );
+DALI_TOOLKIT_API Dali::Accessibility::States GetAccessibilityStates(Dali::Actor control);
/**
* @brief The method force sending notifications about current states to accessibility clients
* @param states mask with states expected to broadcast
* @param doRecursive flag pointing if notifications of children's state would be sent
*/
-DALI_TOOLKIT_API void NotifyAccessibilityStateChange( Dali::Actor control, Dali::Accessibility::States states, bool doRecursive );
+DALI_TOOLKIT_API void NotifyAccessibilityStateChange(Dali::Actor control, Dali::Accessibility::States states, bool doRecursive);
/**
* The method allows to set specific constructor for creating accessibility structure
*
* param constructor callback creating Accessible object
*/
-DALI_TOOLKIT_API void SetAccessibilityConstructor( Dali::Actor control, std::function<std::unique_ptr<Dali::Accessibility::Accessible>(Dali::Actor)> constructor);
+DALI_TOOLKIT_API void SetAccessibilityConstructor(Dali::Actor control, std::function<std::unique_ptr<Dali::Accessibility::Accessible>(Dali::Actor)> constructor);
/**
* Returns accessibility object bound to actor, if any
*
* This method won't bound new accessibility object. Use Dali::Accessibility::Accessible::Get in that case.
*/
-DALI_TOOLKIT_API Dali::Accessibility::Accessible *GetBoundAccessibilityObject( Dali::Actor control );
+DALI_TOOLKIT_API Dali::Accessibility::Accessible* GetBoundAccessibilityObject(Dali::Actor control);
} // namespace DevelControl
namespace Dali
{
-
class WebEngineBackForwardListItem;
namespace Toolkit
{
-
/**
* @addtogroup dali_toolkit_controls_web_view
* @{
/**
* @brief Creates a WebBackForwardListItem.
*/
- WebBackForwardListItem( const Dali::WebEngineBackForwardListItem* item );
+ WebBackForwardListItem(const Dali::WebEngineBackForwardListItem* item);
/**
* @brief Destructor.
std::string GetOriginalUrl() const;
private:
-
const Dali::WebEngineBackForwardListItem* mWebEngineBackForwardListItem;
};
#define DALI_TOOLKIT_WEB_BACK_FORWARD_LIST_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
class WebEngineBackForwardList;
namespace Toolkit
/**
* @brief Creates a WebBackForwardList.
*/
- WebBackForwardList( const Dali::WebEngineBackForwardList& list );
+ WebBackForwardList(const Dali::WebEngineBackForwardList& list);
/**
* @brief Destructor.
uint32_t GetItemCount() const;
private:
- const Dali::WebEngineBackForwardList& mWebEngineBackForwardList;
+ const Dali::WebEngineBackForwardList& mWebEngineBackForwardList;
Dali::Toolkit::WebBackForwardListItem mWebBackForwardListItem;
-
};
/**
#define DALI_TOOLKIT_WEB_CONTEXT_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <string>
#include <dali/devel-api/adaptor-framework/web-engine-context.h>
+#include <string>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/dali-toolkit-common.h>
namespace Dali
{
-
namespace Toolkit
{
-
/**
* @addtogroup dali_toolkit_controls_web_view
* @{
class DALI_TOOLKIT_API WebContext
{
public:
-
/**
* @brief Creates a WebContext.
*
* @param[in] context The context of web engine.
*/
- WebContext( Dali::WebEngineContext& context );
+ WebContext(Dali::WebEngineContext& context);
/**
* @brief Destructor.
*
* @param[in] cacheModel The cache model
*/
- void SetCacheModel(Dali::WebEngineContext::CacheModel cacheModel );
+ void SetCacheModel(Dali::WebEngineContext::CacheModel cacheModel);
/**
* @brief Sets the given proxy URI to network backend of specific context.
*
* @param[in] uri The proxy URI to set
*/
- void SetProxyUri( const std::string& uri );
+ void SetProxyUri(const std::string& uri);
/**
* Adds CA certificates to persistent NSS certificate database
*
* @param[in] certificatePath path to a CA certificate file(s), see above for details
*/
- void SetCertificateFilePath( const std::string& certificatePath );
+ void SetCertificateFilePath(const std::string& certificatePath);
/**
* Toggles the cache to be enabled or disabled
*
* @param[in] cacheDisabled enable or disable cache
*/
- void DisableCache( bool cacheDisabled );
+ void DisableCache(bool cacheDisabled);
/**
* @brief Sets a proxy auth credential to network backend of specific context.
* @param[in] username username to set
* @param[in] password password to set
*/
- void SetDefaultProxyAuth( const std::string& username, const std::string& password );
+ void SetDefaultProxyAuth(const std::string& username, const std::string& password);
/**
* Requests for deleting all web databases.
void ClearCache();
private:
-
- Dali::WebEngineContext& mWebEngineContext;
+ Dali::WebEngineContext& mWebEngineContext;
};
/**
#define DALI_TOOLKIT_WEB_COOKIE_MANAGER_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <string>
#include <dali/devel-api/adaptor-framework/web-engine-cookie-manager.h>
+#include <string>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/dali-toolkit-common.h>
namespace Toolkit
{
-
/**
* @addtogroup dali_toolkit_controls_web_view
* @{
class DALI_TOOLKIT_API WebCookieManager
{
public:
-
/**
* @brief Creates a WebCookieManager.
* @param[in] manager A #Dali::WebEngineCookieManager
*/
- WebCookieManager( Dali::WebEngineCookieManager& manager );
+ WebCookieManager(Dali::WebEngineCookieManager& manager);
/**
* @brief Destructor.
*
* @param[in] policy A #Dali::WebEngineCookieManager::CookieAcceptPolicy
*/
- void SetCookieAcceptPolicy(Dali::WebEngineCookieManager::CookieAcceptPolicy policy );
+ void SetCookieAcceptPolicy(Dali::WebEngineCookieManager::CookieAcceptPolicy policy);
/**
* @brief Gets the cookie acceptance policy. The default is Toolkit::WebCookieManager::CookieAcceptPolicy::NO_THIRD_PARTY.
* @param[in] path The path where to read/write Cookies
* @param[in] storage The type of storage
*/
- void SetPersistentStorage( const std::string& path, Dali::WebEngineCookieManager::CookiePersistentStorage storage );
+ void SetPersistentStorage(const std::string& path, Dali::WebEngineCookieManager::CookiePersistentStorage storage);
private:
-
- Dali::WebEngineCookieManager& mWebEngineCookieManager;
+ Dali::WebEngineCookieManager& mWebEngineCookieManager;
};
/**
#define DALI_TOOLKIT_WEB_SETTINGS_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Toolkit
{
-
/**
* @addtogroup dali_toolkit_controls_web_view
* @{
*
* @param[in] settings A settings of web engine.
*/
- WebSettings( Dali::WebEngineSettings& settings );
+ WebSettings(Dali::WebEngineSettings& settings);
/**
* @brief Destructor.
* @param[in] allowed if true, allow to run mixed contents,
* otherwise not allow
*/
- void AllowMixedContents( bool allowed );
+ void AllowMixedContents(bool allowed);
/**
* @brief Enable the spatial navigation or not.
* @param[in] enabled if true, use spatial navigation,
* otherwise to disable
*/
- void EnableSpatialNavigation( bool enabled );
+ void EnableSpatialNavigation(bool enabled);
/**
* @brief Returns the default font size in pixel. The default value is 16.
*
* @param[in] defaultFontSize A new default font size to set
*/
- void SetDefaultFontSize( int defaultFontSize );
+ void SetDefaultFontSize(int defaultFontSize);
/**
* @brief Enables/disables web security.
* @param[in] enabled if true, to enable the web security
* otherwise to disable
*/
- void EnableWebSecurity( bool enabled );
+ void EnableWebSecurity(bool enabled);
/**
* @brief Allow/Disallow file access from external url
* @param[in] allowed if true, to allow file access from external url
* otherwise to disallow
*/
- void AllowFileAccessFromExternalUrl( bool allowed );
+ void AllowFileAccessFromExternalUrl(bool allowed);
/**
* @brief Returns whether JavaScript can be executable. The default is true.
*
* @param[in] enabled True if JavaScript executing is enabled, false otherwise
*/
- void EnableJavaScript( bool enabled );
+ void EnableJavaScript(bool enabled);
/**
* @brief Allow if the scripts can open new windows.
* @param[in] allowed if true, the scripts can open new windows,
* otherwise not
*/
- void AllowScriptsOpenWindows( bool allowed );
+ void AllowScriptsOpenWindows(bool allowed);
/**
* @brief Returns whether images can be loaded automatically. The default is true.
*
* @param[in] automatic True if images are loaded automatically, false otherwise
*/
- void AllowImagesLoadAutomatically( bool automatic );
+ void AllowImagesLoadAutomatically(bool automatic);
/**
* @brief Gets the default text encoding name (e.g. UTF-8).
*
* @param[in] defaultTextEncodingName The default text encoding name
*/
- void SetDefaultTextEncodingName( const std::string& defaultTextEncodingName );
+ void SetDefaultTextEncodingName(const std::string& defaultTextEncodingName);
private:
Dali::WebEngineSettings& mWebEngineSettings;
#define DALI_TOOLKIT_WEB_VIEW_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <functional>
// INTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/web-engine-plugin.h>
#include <dali-toolkit/public-api/controls/control.h>
+#include <dali/devel-api/adaptor-framework/web-engine-plugin.h>
namespace Dali
{
class DALI_TOOLKIT_API WebView : public Control
{
public:
-
/**
* @brief Enumeration for the start and end property ranges for this control.
*/
*/
enum class LoadErrorCode
{
- UNKNOWN = 0, ///< Unknown.
- CANCELED, ///< User canceled.
- CANT_SUPPORT_MIMETYPE, ///< Can't show the page for this MIME type.
- FAILED_FILE_IO, ///< File IO error.
- CANT_CONNECT, ///< Cannot connect to the network.
- CANT_LOOKUP_HOST, ///< Fail to look up host from the DNS.
- FAILED_TLS_HANDSHAKE, ///< Fail to SSL/TLS handshake.
- INVALID_CERTIFICATE, ///< Received certificate is invalid.
- REQUEST_TIMEOUT, ///< Connection timeout.
- TOO_MANY_REDIRECTS, ///< Too many redirects.
- TOO_MANY_REQUESTS, ///< Too many requests during this load.
- BAD_URL, ///< Malformed URL.
- UNSUPPORTED_SCHEME, ///< Unsupported scheme.
- AUTHENTICATION, ///< User authentication failed on the server.
- INTERNAL_SERVER ///< Web server has an internal server error.
+ UNKNOWN = 0, ///< Unknown.
+ CANCELED, ///< User canceled.
+ CANT_SUPPORT_MIMETYPE, ///< Can't show the page for this MIME type.
+ FAILED_FILE_IO, ///< File IO error.
+ CANT_CONNECT, ///< Cannot connect to the network.
+ CANT_LOOKUP_HOST, ///< Fail to look up host from the DNS.
+ FAILED_TLS_HANDSHAKE, ///< Fail to SSL/TLS handshake.
+ INVALID_CERTIFICATE, ///< Received certificate is invalid.
+ REQUEST_TIMEOUT, ///< Connection timeout.
+ TOO_MANY_REDIRECTS, ///< Too many redirects.
+ TOO_MANY_REQUESTS, ///< Too many requests during this load.
+ BAD_URL, ///< Malformed URL.
+ UNSUPPORTED_SCHEME, ///< Unsupported scheme.
+ AUTHENTICATION, ///< User authentication failed on the server.
+ INTERNAL_SERVER ///< Web server has an internal server error.
};
/**
* @brief WebView signal type related with page loading.
*/
- using WebViewPageLoadSignalType = Signal< void( WebView, const std::string& ) >;
+ using WebViewPageLoadSignalType = Signal<void(WebView, const std::string&)>;
/**
* @brief WebView signal type related with page loading error.
*/
- using WebViewPageLoadErrorSignalType = Signal< void( WebView, const std::string&, LoadErrorCode ) >;
+ using WebViewPageLoadErrorSignalType = Signal<void(WebView, const std::string&, LoadErrorCode)>;
/**
* @brief WebView signal type related with scroll edge reached.
*/
- using WebViewScrollEdgeReachedSignalType = Signal< void( WebView, Dali::WebEnginePlugin::ScrollEdge ) >;
+ using WebViewScrollEdgeReachedSignalType = Signal<void(WebView, Dali::WebEnginePlugin::ScrollEdge)>;
public:
/**
* @param [in] argc The count of arguments of Applications
* @param [in] argv The string array of arguments of Applications
*/
- static WebView New( int argc, char** argv );
+ static WebView New(int argc, char** argv);
/**
* @brief Creates an uninitialized WebView.
* @param[in] deltaX The delta x of scroll
* @param[in] deltaY The delta y of scroll
*/
- void ScrollBy( int deltaX, int deltaY );
+ void ScrollBy(int deltaX, int deltaY);
/**
* @brief Returns whether forward is possible.
#define DALI_TOOLKIT_LAYOUTING_FLEX_NODE_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* @note int, height measure specification mode
* @note SizeTuple, return value
*/
-using MeasureCallback = void (*)(Dali::Actor, float , int , float , int, SizeTuple *);
+using MeasureCallback = void (*)(Dali::Actor, float, int, float, int, SizeTuple*);
/**
* This class provides the API for calling into the Flex layout implementation.
*/
// EXTERNAL INCLUDES
-#include <string.h>
#include <dali/public-api/actors/actor.h>
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/object/property-map.h>
+#include <string.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/dali-toolkit-common.h>
* @param[in] displacement The direction of the central line
* @param[in] initialProgress The normalised initial progress of the shader
*/
-DALI_TOOLKIT_API void DissolveEffectSetCentralLine( Actor& actor, const Vector2& position, const Vector2& displacement, float initialProgress );
+DALI_TOOLKIT_API void DissolveEffectSetCentralLine(Actor& actor, const Vector2& position, const Vector2& displacement, float initialProgress);
/**
* @brief Create a new Dissolve effect
* @return The newly created Property::Map with the dissolve effect
*/
-DALI_TOOLKIT_API Property::Map CreateDissolveEffect( bool useHighPrecision = true);
+DALI_TOOLKIT_API Property::Map CreateDissolveEffect(bool useHighPrecision = true);
} // namespace Toolkit
* @param[in] actor The actor that registers the uniform properties
* @param[in] numBlurSamples Number of samples used by the shader
*/
-DALI_TOOLKIT_API void SetMotionBlurProperties( Actor& actor, unsigned int numBlurSamples = 8 );
+DALI_TOOLKIT_API void SetMotionBlurProperties(Actor& actor, unsigned int numBlurSamples = 8);
/**
* @brief Create a new MotionBlurEffect
/**
* @brief Set the properties for the motion stretch
*/
-DALI_TOOLKIT_API void SetMotionStretchProperties( Actor& actor );
+DALI_TOOLKIT_API void SetMotionStretchProperties(Actor& actor);
/**
* @brief Creates a new MotionStretchEffect
#define DALI_TOOLKIT_TEXT_UTILS_DEVEL_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
//
float minLineSize; ///< The line's minimum size (in points).
- Extents padding; ///< The padding of the boundaries where the text is going to be laid-out.
+ Extents padding; ///< The padding of the boundaries where the text is going to be laid-out.
};
/**
#define DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_MANAGER_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
+#include <dali/public-api/object/base-object.h>
#include <string>
#include <vector>
-#include <dali/public-api/object/base-object.h>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/accessibility-manager/accessibility-manager.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class AccessibilityManager;
/**
class AccessibilityManager : public Dali::BaseObject, public Dali::ConnectionTracker
{
public:
-
typedef Dali::Toolkit::AccessibilityManager::AccessibilityActionSignalType AccessibilityActionSignalType;
typedef Dali::Toolkit::AccessibilityManager::AccessibilityActionScrollSignalType AccessibilityActionScrollSignalType;
Actor GetFocusIndicatorActor();
public:
-
/**
* @copydoc Toolkit::AccessibilityManager::FocusChangedSignal()
*/
*/
Toolkit::AccessibilityManager::FocusedActorActivatedSignalType& FocusedActorActivatedSignal();
-public: // Signals
-
+public: // Signals
/**
* @copydoc Dali::Toolkit::AccessibilityManager::StatusChangedSignal
*/
}
protected:
-
/**
* Destructor
*/
virtual ~AccessibilityManager();
private:
-
// Undefined
AccessibilityManager(const AccessibilityManager&);
AccessibilityManager& operator=(const AccessibilityManager& rhs);
private:
-
std::vector<Actor> mFocusOrder;
- Toolkit::AccessibilityManager::FocusChangedSignalType mFocusChangedSignal; ///< The signal to notify the focus change
- Toolkit::AccessibilityManager::FocusOvershotSignalType mFocusOvershotSignal; ///< The signal to notify the focus overshooted
+ Toolkit::AccessibilityManager::FocusChangedSignalType mFocusChangedSignal; ///< The signal to notify the focus change
+ Toolkit::AccessibilityManager::FocusOvershotSignalType mFocusOvershotSignal; ///< The signal to notify the focus overshooted
Toolkit::AccessibilityManager::FocusedActorActivatedSignalType mFocusedActorActivatedSignal; ///< The signal to notify the activation of focused actor
// Action signals.
#define DALI_TOOLKIT_BUILDER_DECLARATIONS_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// EXTERNAL INCLUDES
#include <dali/public-api/common/extents.h>
+#include <dali/public-api/math/matrix.h>
+#include <dali/public-api/math/matrix3.h>
#include <dali/public-api/math/rect.h>
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/math/vector3.h>
#include <dali/public-api/math/vector4.h>
-#include <dali/public-api/math/matrix.h>
-#include <dali/public-api/math/matrix3.h>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/builder/tree-node.h>
typedef Dali::Toolkit::TreeNode TreeNode;
typedef TreeNode::ConstIterator TreeConstIter;
-typedef OptionalValue<const TreeNode&> OptionalChild;
-typedef OptionalValue<std::string> OptionalString;
-typedef OptionalValue<float> OptionalFloat;
-typedef OptionalValue<int> OptionalInteger;
-typedef OptionalValue<unsigned int> OptionalUnsignedInt;
-typedef OptionalValue<bool> OptionalBoolean;
-typedef OptionalValue<Dali::Vector2> OptionalVector2;
-typedef OptionalValue<Dali::Vector3> OptionalVector3;
-typedef OptionalValue<Dali::Vector4> OptionalVector4;
-typedef OptionalValue<std::string> OptionalString;
-typedef OptionalValue<Dali::Matrix> OptionalMatrix;
-typedef OptionalValue<Dali::Matrix3> OptionalMatrix3;
+typedef OptionalValue<const TreeNode&> OptionalChild;
+typedef OptionalValue<std::string> OptionalString;
+typedef OptionalValue<float> OptionalFloat;
+typedef OptionalValue<int> OptionalInteger;
+typedef OptionalValue<unsigned int> OptionalUnsignedInt;
+typedef OptionalValue<bool> OptionalBoolean;
+typedef OptionalValue<Dali::Vector2> OptionalVector2;
+typedef OptionalValue<Dali::Vector3> OptionalVector3;
+typedef OptionalValue<Dali::Vector4> OptionalVector4;
+typedef OptionalValue<std::string> OptionalString;
+typedef OptionalValue<Dali::Matrix> OptionalMatrix;
+typedef OptionalValue<Dali::Matrix3> OptionalMatrix3;
typedef OptionalValue<Dali::Rect<int> > OptionalRect;
-typedef OptionalValue<Dali::Extents> OptionalExtents;
+typedef OptionalValue<Dali::Extents> OptionalExtents;
#endif // DALI_TOOLKIT_BUILDER_DECLARATIONS_H
#define DALI_TOOLKIT_INTERNAL_BUILDER_FILESYSTEM_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <string>
#include <fstream>
#include <sstream>
+#include <string>
#include <stdio.h>
#include <dali/devel-api/adaptor-framework/file-loader.h>
-inline std::string GetFileContents(const std::string &fn)
+inline std::string GetFileContents(const std::string& fn)
{
- std::streampos bufferSize = 0;
+ std::streampos bufferSize = 0;
Dali::Vector<char> fileBuffer;
- if( !Dali::FileLoader::ReadFile( fn, bufferSize, fileBuffer, Dali::FileLoader::FileType::BINARY ) )
+ if(!Dali::FileLoader::ReadFile(fn, bufferSize, fileBuffer, Dali::FileLoader::FileType::BINARY))
{
- return std::string();
+ return std::string();
}
- return std::string( &fileBuffer[0], bufferSize );
+ return std::string(&fileBuffer[0], bufferSize);
}
#endif // DALI_TOOLKIT_INTERNAL_BUILDER_FILESYSTEM_H
#define DALI_TOOLKIT_INTERNAL_BUILDER_GET_IS_INL
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
inline OptionalChild IsChild(const TreeNode* node, const std::string& childName)
{
- if( node )
+ if(node)
{
const TreeNode* c = node->GetChild(childName);
- if( NULL != c )
+ if(NULL != c)
{
- return OptionalChild( *c );
+ return OptionalChild(*c);
}
else
{
inline OptionalChild IsChildIgnoreCase(const TreeNode* node, const std::string& childName)
{
- if( node )
+ if(node)
{
const TreeNode* c = node->GetChildIgnoreCase(childName);
- if( NULL != c )
+ if(NULL != c)
{
- return OptionalChild( *c );
+ return OptionalChild(*c);
}
else
{
inline OptionalString IsString(const OptionalChild& node)
{
- if( node && (*node).GetType() == TreeNode::STRING )
+ if(node && (*node).GetType() == TreeNode::STRING)
{
return OptionalString((*node).GetString());
}
{
OptionalFloat ret;
- if( node )
+ if(node)
{
- if( (*node).GetType() == TreeNode::FLOAT )
+ if((*node).GetType() == TreeNode::FLOAT)
{
ret = (*node).GetFloat();
}
- else if( (*node).GetType() == TreeNode::INTEGER )
+ else if((*node).GetType() == TreeNode::INTEGER)
{
// JSON has number not float/int but JsonParser discriminates.
// Here we don't care so we allow coercion
- ret = static_cast<float>( (*node).GetInteger() );
+ ret = static_cast<float>((*node).GetInteger());
}
}
return ret;
}
-inline OptionalInteger IsInteger(const OptionalChild &node)
+inline OptionalInteger IsInteger(const OptionalChild& node)
{
OptionalInteger ret;
- if( node )
+ if(node)
{
- if( (*node).GetType() == TreeNode::INTEGER )
+ if((*node).GetType() == TreeNode::INTEGER)
{
ret = (*node).GetInteger();
}
- else if( (*node).GetType() == TreeNode::FLOAT )
+ else if((*node).GetType() == TreeNode::FLOAT)
{
- ret = static_cast<int>( (*node).GetFloat() );
+ ret = static_cast<int>((*node).GetFloat());
}
}
inline OptionalBoolean IsBoolean(const OptionalChild& node)
{
- if( node && (*node).GetType() == TreeNode::BOOLEAN )
+ if(node && (*node).GetType() == TreeNode::BOOLEAN)
{
return OptionalBoolean(1 == (*node).GetInteger());
}
}
}
-
// copy N Numbers
-template <typename T>
+template<typename T>
inline bool CopyNumbers(TreeNode::ConstIterator iter, int N, T& vector)
{
for(int i = 0; i < N; ++i)
{
- if( (*iter).second.GetType() == TreeNode::FLOAT)
+ if((*iter).second.GetType() == TreeNode::FLOAT)
{
vector[i] = (*iter).second.GetFloat();
}
- else if( (*iter).second.GetType() == TreeNode::INTEGER )
+ else if((*iter).second.GetType() == TreeNode::INTEGER)
{
vector[i] = static_cast<float>((*iter).second.GetInteger());
}
{
OptionalVector4 ret;
- if( node && (TreeNode::ARRAY == (*node).GetType()) && (*node).Size() >= 4 )
+ if(node && (TreeNode::ARRAY == (*node).GetType()) && (*node).Size() >= 4)
{
Dali::Vector4 v;
- if( CopyNumbers((*node).CBegin(), 4, v) )
+ if(CopyNumbers((*node).CBegin(), 4, v))
{
ret = OptionalVector4(v);
}
{
OptionalVector3 ret;
- if( node && (TreeNode::ARRAY == (*node).GetType()) && (*node).Size() >= 3 )
+ if(node && (TreeNode::ARRAY == (*node).GetType()) && (*node).Size() >= 3)
{
Dali::Vector3 v;
- if( CopyNumbers((*node).CBegin(), 3, v) )
+ if(CopyNumbers((*node).CBegin(), 3, v))
{
ret = OptionalVector3(v);
}
{
OptionalVector2 ret;
- if( node && (TreeNode::ARRAY == (*node).GetType()) && (*node).Size() >= 2 )
+ if(node && (TreeNode::ARRAY == (*node).GetType()) && (*node).Size() >= 2)
{
Dali::Vector2 v;
- if( CopyNumbers((*node).CBegin(), 2, v) )
+ if(CopyNumbers((*node).CBegin(), 2, v))
{
ret = OptionalVector2(v);
}
return ret;
}
-inline OptionalMatrix IsMatrix(const OptionalChild &node)
+inline OptionalMatrix IsMatrix(const OptionalChild& node)
{
OptionalMatrix ret;
- if( node && (TreeNode::ARRAY == (*node).GetType()) && (*node).Size() >= 16 )
+ if(node && (TreeNode::ARRAY == (*node).GetType()) && (*node).Size() >= 16)
{
float v[16];
- if( CopyNumbers((*node).CBegin(), 16, v) )
+ if(CopyNumbers((*node).CBegin(), 16, v))
{
ret = OptionalMatrix(Dali::Matrix(v));
}
{
OptionalMatrix3 ret;
- if( node && (TreeNode::ARRAY == (*node).GetType()) && (*node).Size() >= 9 )
+ if(node && (TreeNode::ARRAY == (*node).GetType()) && (*node).Size() >= 9)
{
float v[9];
- if( CopyNumbers((*node).CBegin(), 9, v) )
+ if(CopyNumbers((*node).CBegin(), 9, v))
{
- ret = OptionalMatrix3(Dali::Matrix3(v[0], v[1], v[2],
- v[3], v[4], v[5],
- v[6], v[7], v[8] ));
+ ret = OptionalMatrix3(Dali::Matrix3(v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[8]));
}
}
if((*node).Size() >= 4)
{
TreeNode::ConstIterator iter((*node).CBegin());
- int v[4];
- if( CopyNumbers((*node).CBegin(), 4, v) )
+ int v[4];
+ if(CopyNumbers((*node).CBegin(), 4, v))
{
ret = OptionalRect(Dali::Rect<int>(v[0], v[1], v[2], v[3]));
}
if((*node).Size() >= 4)
{
TreeNode::ConstIterator iter((*node).CBegin());
- int v[4];
- if( CopyNumbers((*node).CBegin(), 4, v) )
+ int v[4];
+ if(CopyNumbers((*node).CBegin(), 4, v))
{
extents = OptionalExtents(Dali::Extents(v[0], v[1], v[2], v[3]));
}
//
//
//
-inline OptionalString IsString( const TreeNode& parent, const std::string& childName)
+inline OptionalString IsString(const TreeNode& parent, const std::string& childName)
{
- return IsString( IsChild(&parent, childName) );
+ return IsString(IsChild(&parent, childName));
}
-inline OptionalFloat IsFloat( const TreeNode& parent, const std::string& childName)
+inline OptionalFloat IsFloat(const TreeNode& parent, const std::string& childName)
{
- return IsFloat( IsChild(&parent, childName) );
+ return IsFloat(IsChild(&parent, childName));
}
-inline OptionalInteger IsInteger( const TreeNode& parent, const std::string& childName)
+inline OptionalInteger IsInteger(const TreeNode& parent, const std::string& childName)
{
- return IsInteger( IsChild(&parent, childName) );
+ return IsInteger(IsChild(&parent, childName));
}
-inline OptionalBoolean IsBoolean( const TreeNode& parent, const std::string& childName)
+inline OptionalBoolean IsBoolean(const TreeNode& parent, const std::string& childName)
{
- return IsBoolean( IsChild(parent, childName) );
+ return IsBoolean(IsChild(parent, childName));
}
-inline OptionalVector4 IsVector4(const TreeNode &parent, const std::string& childName)
+inline OptionalVector4 IsVector4(const TreeNode& parent, const std::string& childName)
{
- return IsVector4( IsChild(parent, childName) );
+ return IsVector4(IsChild(parent, childName));
}
-inline OptionalVector3 IsVector3(const TreeNode &parent, const std::string& childName)
+inline OptionalVector3 IsVector3(const TreeNode& parent, const std::string& childName)
{
- return IsVector3( IsChild(parent, childName) );
+ return IsVector3(IsChild(parent, childName));
}
-inline OptionalVector2 IsVector2(const TreeNode &parent, const std::string& childName)
+inline OptionalVector2 IsVector2(const TreeNode& parent, const std::string& childName)
{
- return IsVector2( IsChild(parent, childName) );
+ return IsVector2(IsChild(parent, childName));
}
-inline OptionalMatrix IsMatrix(const TreeNode &parent, const std::string& childName)
+inline OptionalMatrix IsMatrix(const TreeNode& parent, const std::string& childName)
{
- return IsMatrix( IsChild(parent, childName) );
+ return IsMatrix(IsChild(parent, childName));
}
-inline OptionalMatrix3 IsMatrix3(const TreeNode &parent, const std::string& childName)
+inline OptionalMatrix3 IsMatrix3(const TreeNode& parent, const std::string& childName)
{
- return IsMatrix3( IsChild(&parent, childName) );
+ return IsMatrix3(IsChild(&parent, childName));
}
-inline OptionalRect IsRect(const TreeNode &parent, const std::string& childName)
+inline OptionalRect IsRect(const TreeNode& parent, const std::string& childName)
{
- return IsRect( IsChild(&parent, childName) );
+ return IsRect(IsChild(&parent, childName));
}
-inline OptionalExtents IsExtents(const TreeNode &parent, const std::string& childName)
+inline OptionalExtents IsExtents(const TreeNode& parent, const std::string& childName)
{
- return IsExtents( IsChild(&parent, childName) );
+ return IsExtents(IsChild(&parent, childName));
}
//
//
//
-inline OptionalString IsString( const TreeNode& node )
+inline OptionalString IsString(const TreeNode& node)
{
- return IsString( OptionalChild( node ) );
+ return IsString(OptionalChild(node));
}
-inline OptionalFloat IsFloat( const TreeNode& node )
+inline OptionalFloat IsFloat(const TreeNode& node)
{
- return IsFloat( OptionalChild( node ) );
+ return IsFloat(OptionalChild(node));
}
-inline OptionalInteger IsInteger( const TreeNode& node )
+inline OptionalInteger IsInteger(const TreeNode& node)
{
- return IsInteger( OptionalChild( node ) );
+ return IsInteger(OptionalChild(node));
}
-inline OptionalBoolean IsBoolean( const TreeNode& node )
+inline OptionalBoolean IsBoolean(const TreeNode& node)
{
- return IsBoolean( OptionalChild( node ) );
+ return IsBoolean(OptionalChild(node));
}
-inline OptionalVector4 IsVector4(const TreeNode &node )
+inline OptionalVector4 IsVector4(const TreeNode& node)
{
- return IsVector4( OptionalChild( node ) );
+ return IsVector4(OptionalChild(node));
}
-inline OptionalVector3 IsVector3(const TreeNode &node )
+inline OptionalVector3 IsVector3(const TreeNode& node)
{
- return IsVector3( OptionalChild( node ) );
+ return IsVector3(OptionalChild(node));
}
-inline OptionalVector2 IsVector2(const TreeNode &node )
+inline OptionalVector2 IsVector2(const TreeNode& node)
{
- return IsVector2( OptionalChild( node ) );
+ return IsVector2(OptionalChild(node));
}
-inline OptionalMatrix IsMatrix(const TreeNode &node )
+inline OptionalMatrix IsMatrix(const TreeNode& node)
{
- return IsMatrix( OptionalChild( node ) );
+ return IsMatrix(OptionalChild(node));
}
-inline OptionalMatrix3 IsMatrix3(const TreeNode &node )
+inline OptionalMatrix3 IsMatrix3(const TreeNode& node)
{
- return IsMatrix3( OptionalChild( node ) );
+ return IsMatrix3(OptionalChild(node));
}
-inline OptionalRect IsRect(const TreeNode &node )
+inline OptionalRect IsRect(const TreeNode& node)
{
- return IsRect( OptionalChild( node ) );
+ return IsRect(OptionalChild(node));
}
-inline OptionalExtents IsExtents(const TreeNode &node )
+inline OptionalExtents IsExtents(const TreeNode& node)
{
- return IsExtents( OptionalChild( node ) );
+ return IsExtents(OptionalChild(node));
}
//
//
//
-inline Dali::Vector4 GetVector4(const TreeNode &child)
+inline Dali::Vector4 GetVector4(const TreeNode& child)
{
- OptionalVector4 v( IsVector4( OptionalChild( child ) ) );
+ OptionalVector4 v(IsVector4(OptionalChild(child)));
DALI_ASSERT_ALWAYS(v);
return *v;
}
-inline Dali::Vector3 GetVector3(const TreeNode &child)
+inline Dali::Vector3 GetVector3(const TreeNode& child)
{
- OptionalVector3 v( IsVector3( OptionalChild( child ) ) );
+ OptionalVector3 v(IsVector3(OptionalChild(child)));
DALI_ASSERT_ALWAYS(v);
return *v;
}
-inline Dali::Vector2 GetVector2(const TreeNode &child)
+inline Dali::Vector2 GetVector2(const TreeNode& child)
{
- OptionalVector2 v( IsVector2( OptionalChild( child ) ) );
+ OptionalVector2 v(IsVector2(OptionalChild(child)));
DALI_ASSERT_ALWAYS(v);
return *v;
}
-inline float GetFloat(const TreeNode &child)
+inline float GetFloat(const TreeNode& child)
{
- OptionalFloat v( IsFloat( OptionalChild( child ) ) );
+ OptionalFloat v(IsFloat(OptionalChild(child)));
DALI_ASSERT_ALWAYS(v);
return *v;
}
-inline bool GetBoolean(const TreeNode &child)
+inline bool GetBoolean(const TreeNode& child)
{
- OptionalBoolean v( IsBoolean( OptionalChild( child ) ) );
+ OptionalBoolean v(IsBoolean(OptionalChild(child)));
DALI_ASSERT_ALWAYS(v);
return *v;
}
-inline int GetInteger(const TreeNode &child)
+inline int GetInteger(const TreeNode& child)
{
- OptionalInteger v( IsInteger( OptionalChild( child ) ) );
+ OptionalInteger v(IsInteger(OptionalChild(child)));
DALI_ASSERT_ALWAYS(v);
return *v;
}
-
-
#endif // DALI_TOOLKIT_INTERNAL_BUILDER_GET_IS_INL
#define DALI_TOOLKIT_INTERNAL_BUILDER_IMPL_DEBUG_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
-#include <dali/integration-api/debug.h>
#include <dali-toolkit/devel-api/builder/json-parser.h>
+#include <dali/integration-api/debug.h>
-#if defined( DEBUG_ENABLED )
+#if defined(DEBUG_ENABLED)
namespace Dali
{
{
namespace Internal
{
-
-#define DUMP_PARSE_TREE(parser) LogTree(parser)
-#define DUMP_TEST_MAPPINGS(parser) \
- OptionalChild mappings = IsChild( parser.GetRoot(), KEYNAME_MAPPINGS ); \
- if( mappings ) \
- { \
- std::ostringstream oss; \
- oss << "Mappings: {" << std::endl; \
- for( TreeNode::ConstIterator iter = (*mappings).CBegin(); iter != (*mappings).CEnd(); ++iter ) \
- { \
- Property::Value value; \
- bool converted = GetPropertyMap(*mappings, (*iter).first, Property::NONE, value ); \
- if( converted ) \
- { \
- oss << " " << (*iter).first << ":" << value << std::endl; \
- } \
- } \
- oss << "}" << std::endl; \
- DALI_LOG_INFO( gFilterScript, Debug::Verbose, oss.str().c_str() ); \
+#define DUMP_PARSE_TREE(parser) LogTree(parser)
+#define DUMP_TEST_MAPPINGS(parser) \
+ OptionalChild mappings = IsChild(parser.GetRoot(), KEYNAME_MAPPINGS); \
+ if(mappings) \
+ { \
+ std::ostringstream oss; \
+ oss << "Mappings: {" << std::endl; \
+ for(TreeNode::ConstIterator iter = (*mappings).CBegin(); iter != (*mappings).CEnd(); ++iter) \
+ { \
+ Property::Value value; \
+ bool converted = GetPropertyMap(*mappings, (*iter).first, Property::NONE, value); \
+ if(converted) \
+ { \
+ oss << " " << (*iter).first << ":" << value << std::endl; \
+ } \
+ } \
+ oss << "}" << std::endl; \
+ DALI_LOG_INFO(gFilterScript, Debug::Verbose, oss.str().c_str()); \
}
+void LogTree(const Toolkit::JsonParser& mParser);
-void LogTree( const Toolkit::JsonParser& mParser );
-
-std::string PropertyValueToString( const Property::Value& value );
-
+std::string PropertyValueToString(const Property::Value& value);
-} // Internal
-} // Toolkit
-} // Dali
+} // namespace Internal
+} // namespace Toolkit
+} // namespace Dali
#else
#define DALI_TOOLKIT_INTERNAL_BUILDER_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <string>
-#include <list>
-#include <map>
-#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/integration-api/debug.h>
#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/object/base-object.h>
#include <dali/public-api/object/property-map.h>
#include <dali/public-api/render-tasks/render-task.h>
-#include <dali/integration-api/debug.h>
+#include <list>
+#include <map>
+#include <string>
// INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/builder/json-parser.h>
#include <dali-toolkit/devel-api/builder/builder.h>
+#include <dali-toolkit/devel-api/builder/json-parser.h>
#include <dali-toolkit/internal/builder/builder-declarations.h>
#include <dali-toolkit/internal/builder/style.h>
// Warning messages usually displayed
#define DALI_SCRIPT_WARNING(format, ...) \
- DALI_LOG_WARNING("Script:" format, ## __VA_ARGS__)
+ DALI_LOG_WARNING("Script:" format, ##__VA_ARGS__)
// Info messages are usually debug build
#define DALI_SCRIPT_INFO(format, ...) \
- DALI_LOG_INFO(Dali::Toolkit::Internal::gFilterScript, Debug::General, "Script:" format, ## __VA_ARGS__)
+ DALI_LOG_INFO(Dali::Toolkit::Internal::gFilterScript, Debug::General, "Script:" format, ##__VA_ARGS__)
// Info Verbose need to be swiched on in gFilterScript filter constructor (by default set to General)
#define DALI_SCRIPT_VERBOSE(format, ...) \
- DALI_LOG_INFO(Dali::Toolkit::Internal::gFilterScript, Debug::Verbose, "Script:" format, ## __VA_ARGS__)
+ DALI_LOG_INFO(Dali::Toolkit::Internal::gFilterScript, Debug::Verbose, "Script:" format, ##__VA_ARGS__)
namespace Dali
{
-
namespace Toolkit
{
- class TreeNode;
+class TreeNode;
}
namespace Toolkit
{
-
namespace Internal
{
-
#if defined(DEBUG_ENABLED)
extern Dali::Integration::Log::Filter* gFilterScript;
#endif
class Builder : public Dali::BaseObject
{
public:
-
Builder();
/**
* @copydoc Toolkit::Builder::LoadFromString
*/
- void LoadFromString( const std::string &data,
- Dali::Toolkit::Builder::UIFormat rep = Dali::Toolkit::Builder::JSON );
+ void LoadFromString(const std::string& data,
+ Dali::Toolkit::Builder::UIFormat rep = Dali::Toolkit::Builder::JSON);
/**
* @copydoc Toolkit::Builder::AddConstants
*/
- void AddConstants( const Property::Map& map );
+ void AddConstants(const Property::Map& map);
/**
* @copydoc Toolkit::Builder::AddConstant
*/
- void AddConstant( const std::string& key, const Property::Value& value );
+ void AddConstant(const std::string& key, const Property::Value& value);
/**
* @copydoc Toolkit::Builder::GetConfigurations
/**
* @copydoc Toolkit::Builder::GetConstant
*/
- const Property::Value& GetConstant( const std::string& key ) const;
+ const Property::Value& GetConstant(const std::string& key) const;
/**
* @copydoc Toolkit::Builder::CreateAnimation( const std::string& animationName );
*/
- Animation CreateAnimation( const std::string& animationName );
+ Animation CreateAnimation(const std::string& animationName);
/**
* @copydoc Toolkit::Builder::CreateAnimation( const std::string& animationName, const Property::Map& map );
*/
- Animation CreateAnimation( const std::string& animationName, const Property::Map& map );
+ Animation CreateAnimation(const std::string& animationName, const Property::Map& map);
/**
* @copydoc Toolkit::Builder::CreateAnimation( const std::string&,Dali::Actor);
*/
- Animation CreateAnimation( const std::string& animationName, Dali::Actor sourceActor );
+ Animation CreateAnimation(const std::string& animationName, Dali::Actor sourceActor);
/**
* @copydoc Toolkit::Builder::CreateAnimation( const std::string&,const Property::Map&, Dali::Actor);
*/
- Animation CreateAnimation( const std::string& animationName, const Property::Map& map, Dali::Actor sourceActor );
+ Animation CreateAnimation(const std::string& animationName, const Property::Map& map, Dali::Actor sourceActor);
/**
* @copydoc Toolkit::Builder::Create( const std::string& templateName );
*/
- BaseHandle Create( const std::string& templateName );
+ BaseHandle Create(const std::string& templateName);
/**
* @copydoc Toolkit::Builder::Create( const std::string& templateName, const Property::Map& map );
*/
- BaseHandle Create( const std::string& templateName, const Property::Map& map );
+ BaseHandle Create(const std::string& templateName, const Property::Map& map);
/**
* @copydoc Toolkit::Builder::CreateFromJson( const std::string& json );
*/
- BaseHandle CreateFromJson( const std::string& json );
+ BaseHandle CreateFromJson(const std::string& json);
/**
* @copydoc Toolkit::Builder::ApplyFromJson( Handle& handle, const std::string& json );
*/
- bool ApplyFromJson( Handle& handle, const std::string& json );
+ bool ApplyFromJson(Handle& handle, const std::string& json);
/**
* @copydoc Toolkit::Builder::ApplyStyle
*/
- bool ApplyStyle( const std::string& styleName, Handle& handle );
+ bool ApplyStyle(const std::string& styleName, Handle& handle);
/**
* Lookup the stylename in builder. If it's found in the parse tree,
* @param[in] styleName The style name to search for
* @return true if the stylename exists
*/
- bool LookupStyleName( const std::string& styleName );
+ bool LookupStyleName(const std::string& styleName);
/**
* Lookup the stylename in the recorded Styles - if it exists,
* @param[in] styleName The stylename to search for
* @return A const pointer to the style object
*/
- const StylePtr GetStyle( const std::string& styleName );
+ const StylePtr GetStyle(const std::string& styleName);
/**
* @copydoc Toolkit::Builder::AddActors
*/
- void AddActors( Actor toActor );
+ void AddActors(Actor toActor);
/**
* @copydoc Toolkit::Builder::AddActors
*/
- void AddActors( const std::string §ionName, Actor toActor );
+ void AddActors(const std::string& sectionName, Actor toActor);
/**
* @copydoc Toolkit::Builder::CreateRenderTask
*/
- void CreateRenderTask( const std::string &name );
+ void CreateRenderTask(const std::string& name);
/**
* @copydoc Toolkit::Builder::GetPath
*/
- Path GetPath( const std::string &name );
+ Path GetPath(const std::string& name);
/**
* @copydoc Toolkit::Builder::GetPathConstrainer
*/
- Dali::PathConstrainer GetPathConstrainer( const std::string& name );
+ Dali::PathConstrainer GetPathConstrainer(const std::string& name);
/*
* Check if a given constrainer is of type PathConstrainer
* @return True if constainer is of type PathConstrainer, False otherwise
*
*/
- bool IsPathConstrainer( const std::string& name );
+ bool IsPathConstrainer(const std::string& name);
/**
* @copydoc Toolkit::Builder::GetLinearConstrainer
*/
- Dali::LinearConstrainer GetLinearConstrainer( const std::string& name );
+ Dali::LinearConstrainer GetLinearConstrainer(const std::string& name);
/*
* Check if a given constrainer is of type LinearConstrainer
* @return True if constainer is of type LinearConstrainer, False otherwise
*
*/
- bool IsLinearConstrainer( const std::string& name );
+ bool IsLinearConstrainer(const std::string& name);
/**
* @copydoc Toolkit::Builder::QuitSignal
*/
void EmitQuitSignal();
-
protected:
-
~Builder() override;
private:
- typedef std::vector<const char*> KeyStack;
- typedef std::vector< TreeNode::KeyNodePair > MappingsLut;
- typedef struct{ std::string name; Dali::LinearConstrainer linearConstrainer; } LinearConstrainerEntry;
+ typedef std::vector<const char*> KeyStack;
+ typedef std::vector<TreeNode::KeyNodePair> MappingsLut;
+ typedef struct
+ {
+ std::string name;
+ Dali::LinearConstrainer linearConstrainer;
+ } LinearConstrainerEntry;
typedef std::vector<LinearConstrainerEntry> LinearConstrainerLut;
- typedef struct{ std::string name; Dali::PathConstrainer pathConstrainer; } PathConstrainerEntry;
+ typedef struct
+ {
+ std::string name;
+ Dali::PathConstrainer pathConstrainer;
+ } PathConstrainerEntry;
typedef std::vector<PathConstrainerEntry> PathConstrainerLut;
typedef std::map<const std::string, Path> PathLut;
// Undefined
Builder& operator=(const Builder& rhs);
- void LoadConstants( const TreeNode& root, Property::Map& intoMap );
-
- void LoadConfiguration( const TreeNode& root, Property::Map& intoMap );
+ void LoadConstants(const TreeNode& root, Property::Map& intoMap);
- Animation CreateAnimation( const std::string& animationName,
- const Replacement& replacement,
- Dali::Actor sourceActor );
+ void LoadConfiguration(const TreeNode& root, Property::Map& intoMap);
- BaseHandle Create( const std::string& templateName,
- const Replacement& constant );
+ Animation CreateAnimation(const std::string& animationName,
+ const Replacement& replacement,
+ Dali::Actor sourceActor);
- BaseHandle DoCreate( const TreeNode& root,
- const TreeNode& node,
- Actor parent,
- const Replacement& replacements );
+ BaseHandle Create(const std::string& templateName,
+ const Replacement& constant);
- void SetupTask( RenderTask& task,
- const Toolkit::TreeNode& node,
- const Replacement& replacement );
+ BaseHandle DoCreate(const TreeNode& root,
+ const TreeNode& node,
+ Actor parent,
+ const Replacement& replacements);
- bool ApplyStyle( const std::string& styleName,
- Handle& handle,
- const Replacement& replacement);
+ void SetupTask(RenderTask& task,
+ const Toolkit::TreeNode& node,
+ const Replacement& replacement);
- void ApplyAllStyleProperties( const TreeNode& root,
- const TreeNode& node,
- Dali::Handle& handle,
- const Replacement& constant );
+ bool ApplyStyle(const std::string& styleName,
+ Handle& handle,
+ const Replacement& replacement);
- void RecordStyles( const char* styleName,
- const TreeNode& node,
- Dali::Handle& handle,
- const Replacement& replacements );
+ void ApplyAllStyleProperties(const TreeNode& root,
+ const TreeNode& node,
+ Dali::Handle& handle,
+ const Replacement& constant);
- void RecordStyle( StylePtr style,
+ void RecordStyles(const char* styleName,
const TreeNode& node,
Dali::Handle& handle,
- const Replacement& replacements );
+ const Replacement& replacements);
- void RecordTransitions( const TreeNode::KeyNodePair& keyValue,
- Property::Array& transitions,
- const Replacement& replacements );
+ void RecordStyle(StylePtr style,
+ const TreeNode& node,
+ Dali::Handle& handle,
+ const Replacement& replacements);
- void RecordTransitionData( const TreeNode::KeyNodePair& keyNode,
- Toolkit::TransitionData& transitionData,
- const Replacement& replacements );
+ void RecordTransitions(const TreeNode::KeyNodePair& keyValue,
+ Property::Array& transitions,
+ const Replacement& replacements);
- void ApplyProperties( const TreeNode& root,
- const TreeNode& node,
- Dali::Handle& handle,
- const Replacement& constant );
+ void RecordTransitionData(const TreeNode::KeyNodePair& keyNode,
+ Toolkit::TransitionData& transitionData,
+ const Replacement& replacements);
- void ApplySignals( const TreeNode& root,
- const TreeNode& node,
- Dali::Handle& handle );
+ void ApplyProperties(const TreeNode& root,
+ const TreeNode& node,
+ Dali::Handle& handle,
+ const Replacement& constant);
- void ApplyStylesByActor( const TreeNode& root,
- const TreeNode& node,
- Dali::Handle& handle,
- const Replacement& constant );
+ void ApplySignals(const TreeNode& root,
+ const TreeNode& node,
+ Dali::Handle& handle);
- void SetProperties( const TreeNode& node,
- Handle& handle,
- const Replacement& constant );
+ void ApplyStylesByActor(const TreeNode& root,
+ const TreeNode& node,
+ Dali::Handle& handle,
+ const Replacement& constant);
- bool MapToTargetProperty( Handle& propertyObject,
- const std::string& key,
- const TreeNode& node,
- const Replacement& constant,
- Property::Index& index,
- Property::Value& value );
+ void SetProperties(const TreeNode& node,
+ Handle& handle,
+ const Replacement& constant);
+
+ bool MapToTargetProperty(Handle& propertyObject,
+ const std::string& key,
+ const TreeNode& node,
+ const Replacement& constant,
+ Property::Index& index,
+ Property::Value& value);
/**
* Find the key in the mapping table, if it's present, then generate
* @param[in] propertyType The property type if known, or NONE
* @param[in,out] value The string value to test and write back to.
*/
- bool GetPropertyMap( const TreeNode& mappingRoot,
- const char* theKey,
- Property::Type propertyType,
- Property::Value& value );
+ bool GetPropertyMap(const TreeNode& mappingRoot,
+ const char* theKey,
+ Property::Type propertyType,
+ Property::Value& value);
- void SetCustomProperties( const TreeNode& node,
- Handle& handle,
- const Replacement& constant,
- const std::string& childName,
- Property::AccessMode accessMode );
+ void SetCustomProperties(const TreeNode& node,
+ Handle& handle,
+ const Replacement& constant,
+ const std::string& childName,
+ Property::AccessMode accessMode);
/**
* Find the key in the mapping table, if it's present, then generate
* @param[in] propertyType The property type if known, or NONE
* @param[in,out] value The string value to test and write back to.
*/
- bool RecursePropertyMap( const TreeNode& mappingRoot,
- KeyStack& keyStack,
- const char* theKey,
- Property::Type propertyType,
- Property::Value& value );
-
+ bool RecursePropertyMap(const TreeNode& mappingRoot,
+ KeyStack& keyStack,
+ const char* theKey,
+ Property::Type propertyType,
+ Property::Value& value);
/**
* Tests if the value is a string delimited by <>. If it is, then it attempts to
* @param[in,out] value The string value to test and write back to.
* @return true if the value was converted, false otherwise.
*/
- bool ConvertChildValue( const TreeNode& mappingRoot,
- KeyStack& keyStack,
- Property::Value& value );
+ bool ConvertChildValue(const TreeNode& mappingRoot,
+ KeyStack& keyStack,
+ Property::Value& value);
private:
Toolkit::JsonParser mParser;
#define DALI_TOOLKIT_INTERNAL_BUILDER_SET_PROPERTY_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
{
namespace Internal
{
-
/**
* Set a property value from a tree node.
* This function determines the type of the property from the format of the string in the node.
* @param node The node string to convert from
* @param value The property value to set
*/
-void DeterminePropertyFromNode( const TreeNode& node,
- Property::Value& value );
+void DeterminePropertyFromNode(const TreeNode& node,
+ Property::Value& value);
/**
* Set a property value from a tree node as DeterminePropertyFromNode() above
* @param value The property value to set
* @param replacement The overriding replacement map (if any)
*/
-void DeterminePropertyFromNode( const TreeNode& node,
- Property::Value& value,
- const Replacement& replacement );
+void DeterminePropertyFromNode(const TreeNode& node,
+ Property::Value& value,
+ const Replacement& replacement);
/**
* Set a property value as the given type from a tree node.
* @param value The property value to set
* @return true if the string could be converted to the correct type.
*/
-bool DeterminePropertyFromNode( const TreeNode& node,
- Property::Type type,
- Property::Value& value );
+bool DeterminePropertyFromNode(const TreeNode& node,
+ Property::Type type,
+ Property::Value& value);
/**
* Set a property value as the given type from a tree node as DeterminePropertyFromNode() above
* @param replacement The overriding replacement map (if any)
* @return true if the string could be converted to the correct type.
*/
-bool DeterminePropertyFromNode( const TreeNode& node,
- Property::Type type,
- Property::Value& value,
- const Replacement& replacement );
-
+bool DeterminePropertyFromNode(const TreeNode& node,
+ Property::Type type,
+ Property::Value& value,
+ const Replacement& replacement);
-} // Internal namespace
-} // Toolkit namespace
-} // Dali namespace
+} // namespace Internal
+} // namespace Toolkit
+} // namespace Dali
#endif //DALI_TOOLKIT_INTERNAL_BUILDER_SET_PROPERTY_H
#define DALI_TOOLKIT_INTERNAL_BUILDER_DICTIONARY_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
{
namespace Internal
{
-
/**
* The Dictionary template class enables a means of storing key-value
* pairs where the keys are strings and the value can be a complex
using DictionaryKeys = std::vector<std::string>;
-inline void Merge( DictionaryKeys& toDict, const DictionaryKeys& fromDict )
+inline void Merge(DictionaryKeys& toDict, const DictionaryKeys& fromDict)
{
for(const auto& element : fromDict)
{
}
}
-
template<typename EntryType>
class Dictionary
{
struct Element
{
std::string key;
- EntryType entry;
+ EntryType entry;
Element(std::string name, EntryType entry)
: key(std::move(name)),
entry(std::move(entry))
auto FindElement(std::string_view key)
{
- return std::find_if(container.begin(), container.end(), [key](auto& e){
- return bool(key == e.key);
- });
+ return std::find_if(container.begin(), container.end(), [key](auto& e) {
+ return bool(key == e.key);
+ });
}
public:
if(iter != End())
{
- container.erase( iter );
+ container.erase(iter);
}
}
}
- void Merge( const Dictionary<EntryType>& dictionary )
+ void Merge(const Dictionary<EntryType>& dictionary)
{
for(const auto& element : dictionary.container)
{
*/
const EntryType* FindConst(std::string_view key) const
{
- if( ! key.empty() )
+ if(!key.empty())
{
auto iter = FindElementCaseInsensitive(key);
*/
EntryType* Find(std::string_view key) const
{
- if( ! key.empty() )
+ if(!key.empty())
{
auto iter = FindElementCaseInsensitive(key);
return container.cend();
}
- void GetKeys( DictionaryKeys& keys ) const
+ void GetKeys(DictionaryKeys& keys) const
{
keys.clear();
for(const auto& element : container)
}
};
-
-
-}//Internal
-}//Toolkit
-}//Dali
+} // namespace Internal
+} // namespace Toolkit
+} // namespace Dali
#endif // DALI_TOOLKIT_INTERNAL_BUILDER_DICTIONARY_H
#define DALI_JSON_PARSER_IMPL_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <string>
-#include <list>
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/object/base-object.h>
+#include <list>
+#include <string>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/builder/json-parser.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/*
* Parses JSON
*/
void Write(std::ostream& output, int indent) const;
private:
- typedef std::vector<char> VectorChar;
+ typedef std::vector<char> VectorChar;
typedef VectorChar::iterator VectorCharIter;
- typedef std::list<VectorChar> SourceContainer;
+ typedef std::list<VectorChar> SourceContainer;
typedef std::list<VectorChar>::iterator SourceContainerIter;
- JsonParser(JsonParser &);
+ JsonParser(JsonParser&);
JsonParser& operator=(const JsonParser&);
- SourceContainer mSources; ///< List of strings from Parse() merge operations
-
- TreeNode* mRoot; ///< Tree root
+ SourceContainer mSources; ///< List of strings from Parse() merge operations
- const char *mErrorDescription; ///< Last parse error description
- int mErrorPosition; ///< Last parse error position
- int mErrorLine; ///< Last parse error line
- int mErrorColumn; ///< Last parse error column
+ TreeNode* mRoot; ///< Tree root
- int mNumberOfChars; ///< The size of string data for all nodes
- int mNumberOfNodes; ///< Node count
+ const char* mErrorDescription; ///< Last parse error description
+ int mErrorPosition; ///< Last parse error position
+ int mErrorLine; ///< Last parse error line
+ int mErrorColumn; ///< Last parse error column
+ int mNumberOfChars; ///< The size of string data for all nodes
+ int mNumberOfNodes; ///< Node count
};
} // namespace Internal
-
inline const Internal::JsonParser& GetImplementation(const Toolkit::JsonParser& parser)
{
- DALI_ASSERT_ALWAYS( parser && "JsonParser handle is empty" );
+ DALI_ASSERT_ALWAYS(parser && "JsonParser handle is empty");
const BaseObject& handle = parser.GetBaseObject();
return static_cast<const Internal::JsonParser&>(handle);
}
-
inline Internal::JsonParser& GetImplementation(Toolkit::JsonParser& parser)
{
- DALI_ASSERT_ALWAYS( parser && "JsonParser handle is empty" );
+ DALI_ASSERT_ALWAYS(parser && "JsonParser handle is empty");
BaseObject& handle = parser.GetBaseObject();
} // namespace Dali
-
#endif // DALI_JSON_PARSER_IMPL_H
#define DALI_JSON_PARSE_STATE_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/**
* A safer std::advance()
*/
-template <typename IteratorType,typename EndIteratorType>
+template<typename IteratorType, typename EndIteratorType>
inline int AdvanceIter(IteratorType& iter, EndIteratorType& end, int n)
{
- for(int i =0; i < n; ++i)
+ for(int i = 0; i < n; ++i)
{
if(iter == end)
{
* Get the error description of the last parse
* @return The error description or NULL if no error
*/
- const char* GetErrorDescription() { return mErrorDescription; }
+ const char* GetErrorDescription()
+ {
+ return mErrorDescription;
+ }
/**
* Get the error line number
* @return The line number of the error
*/
- int GetErrorLineNumber() { return mErrorNewLine; }
+ int GetErrorLineNumber()
+ {
+ return mErrorNewLine;
+ }
/**
* Get the error column
* @return The error column
*/
- int GetErrorColumn() { return mErrorColumn; }
+ int GetErrorColumn()
+ {
+ return mErrorColumn;
+ }
/**
* Get the error position
* @return The error position
*/
- int GetErrorPosition() { return mErrorPosition; }
+ int GetErrorPosition()
+ {
+ return mErrorPosition;
+ }
/**
* Get the size of the string data that has been parsed
* @return The size of string data
*/
- int GetParsedStringSize() { return mNumberOfParsedChars; };
+ int GetParsedStringSize()
+ {
+ return mNumberOfParsedChars;
+ };
/**
* Get the number of nodes created
* @return The number of nodes
*/
- int GetCreatedNodeCount() { return mNumberOfCreatedNodes; };
+ int GetCreatedNodeCount()
+ {
+ return mNumberOfCreatedNodes;
+ };
private:
- VectorCharIter mIter; ///< Current position
- VectorCharIter mStart; ///< Start position
- VectorCharIter mEnd; ///< End of buffer being parsed
- TreeNode* mRoot; ///< Root node created
- TreeNodeManipulator mCurrent; ///< The Current modifiable node
- const char* mErrorDescription; ///< The error description if set
- int mErrorNewLine; ///< The error line number
- int mErrorColumn; ///< The error column
- int mErrorPosition; ///< The error position
- int mNumberOfParsedChars; ///< The size of string data
- int mNumberOfCreatedNodes; ///< The number of nodes created
- bool mFirstParse; ///< Flag if first parse
+ VectorCharIter mIter; ///< Current position
+ VectorCharIter mStart; ///< Start position
+ VectorCharIter mEnd; ///< End of buffer being parsed
+ TreeNode* mRoot; ///< Root node created
+ TreeNodeManipulator mCurrent; ///< The Current modifiable node
+ const char* mErrorDescription; ///< The error description if set
+ int mErrorNewLine; ///< The error line number
+ int mErrorColumn; ///< The error column
+ int mErrorPosition; ///< The error position
+ int mNumberOfParsedChars; ///< The size of string data
+ int mNumberOfCreatedNodes; ///< The number of nodes created
+ bool mFirstParse; ///< Flag if first parse
/**
* The current parse state
{
return Error("Attempt to walk up above root");
}
- mCurrent = TreeNodeManipulator( mCurrent.GetParent() );
+ mCurrent = TreeNodeManipulator(mCurrent.GetParent());
return true;
}
{
int c = AdvanceIter(mIter, mEnd, n);
mErrorPosition += c;
- mErrorColumn += c;
+ mErrorColumn += c;
}
/**
{
int c = AdvanceIter(mIter, mEnd, n);
mErrorPosition += c;
- mErrorColumn += c;
+ mErrorColumn += c;
return mEnd == mIter;
}
{
int c = AdvanceIter(mIter, mEnd, n);
mErrorPosition += c;
- mErrorColumn += c;
- static_cast<void>( ParseWhiteSpace() );
+ mErrorColumn += c;
+ static_cast<void>(ParseWhiteSpace());
}
/**
bool HandleCharacterComma(const char* name);
};
-
} // namespace Internal
} // namespace Toolkit
#define DALI_TOOLKIT_INTERNAL_BUILDER_OPTIONAL_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
-template <typename T>
+template<typename T>
struct OptionalTypes
{
- typedef T ValueType;
- typedef const T& ReturnType;
- static ReturnType Get(const ValueType& v) { return v; }
- static ValueType Set(const ReturnType v) { return v; }
- static bool Ok(const ValueType& v) { return true; }
+ typedef T ValueType;
+ typedef const T& ReturnType;
+ static ReturnType Get(const ValueType& v)
+ {
+ return v;
+ }
+ static ValueType Set(const ReturnType v)
+ {
+ return v;
+ }
+ static bool Ok(const ValueType& v)
+ {
+ return true;
+ }
};
-template <typename T>
+template<typename T>
struct OptionalTypes<T*>
{
- typedef T* ValueType;
- typedef const T* ReturnType;
- static ReturnType Get(const ValueType v) { return v; }
- static ValueType Set(const ReturnType v) { return v; }
- static bool Ok(const ReturnType v) { return NULL != v; }
+ typedef T* ValueType;
+ typedef const T* ReturnType;
+ static ReturnType Get(const ValueType v)
+ {
+ return v;
+ }
+ static ValueType Set(const ReturnType v)
+ {
+ return v;
+ }
+ static bool Ok(const ReturnType v)
+ {
+ return NULL != v;
+ }
};
-template <typename T>
+template<typename T>
struct OptionalTypes<T&>
{
- typedef T* ValueType;
- typedef const T& ReturnType;
- static ReturnType Get(const ValueType v) { return *v; }
- static ValueType Set(const ReturnType v) { return &v; }
- static bool Ok(const ReturnType v) { return true; }
+ typedef T* ValueType;
+ typedef const T& ReturnType;
+ static ReturnType Get(const ValueType v)
+ {
+ return *v;
+ }
+ static ValueType Set(const ReturnType v)
+ {
+ return &v;
+ }
+ static bool Ok(const ReturnType v)
+ {
+ return true;
+ }
};
-template <typename T>
+template<typename T>
class OptionalValue
{
public:
- typedef void ( OptionalValue::*bool_type )() const;
+ typedef void (OptionalValue::*bool_type)() const;
typedef typename OptionalTypes<T>::ReturnType ReturnType;
- typedef typename OptionalTypes<T>::ValueType ValueType;
+ typedef typename OptionalTypes<T>::ValueType ValueType;
- OptionalValue(): mOk(false), mValue() {}
- OptionalValue( T value ): mOk(OptionalTypes<T>::Ok(value)), mValue(OptionalTypes<T>::Set(value)) {}
- OptionalValue( bool b, T value ): mOk(b), mValue(OptionalTypes<T>::Set(value)) {}
+ OptionalValue()
+ : mOk(false),
+ mValue()
+ {
+ }
+ OptionalValue(T value)
+ : mOk(OptionalTypes<T>::Ok(value)),
+ mValue(OptionalTypes<T>::Set(value))
+ {
+ }
+ OptionalValue(bool b, T value)
+ : mOk(b),
+ mValue(OptionalTypes<T>::Set(value))
+ {
+ }
- ReturnType operator *() const { return OptionalTypes<T>::Get(mValue); }
+ ReturnType operator*() const
+ {
+ return OptionalTypes<T>::Get(mValue);
+ }
// safe bool idiom
- operator bool_type() const {
+ operator bool_type() const
+ {
return mOk == true ? &OptionalValue::this_type_does_not_support_comparisons : 0;
}
private:
- bool mOk;
+ bool mOk;
ValueType mValue;
- void this_type_does_not_support_comparisons() const {}
+ void this_type_does_not_support_comparisons() const
+ {
+ }
};
-template <typename T, typename U>
-bool operator==( const OptionalValue<T>& lhs, const OptionalValue<U>& rhs )
+template<typename T, typename U>
+bool operator==(const OptionalValue<T>& lhs, const OptionalValue<U>& rhs)
{
lhs.this_type_does_not_support_comparisons();
return false;
}
-template <typename T, typename U>
-bool operator!=( const OptionalValue<T>& lhs, const OptionalValue<U>& rhs )
+template<typename T, typename U>
+bool operator!=(const OptionalValue<T>& lhs, const OptionalValue<U>& rhs)
{
lhs.this_type_does_not_support_comparisons();
return false;
#define DALI_TOOLKIT_INTERNAL_BUILDER_REPLACEMENT_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
- class TreeNode;
+class TreeNode;
}
namespace Toolkit
{
-
namespace Internal
{
-
/*
* Supports template replacement functionality
*
class Replacement
{
public:
-
/*
* Constructor
*/
* @param overrideMap The user overriding map
* @param defaultMap The default map to use
*/
- Replacement( const Property::Map& overrideMap, const Property::Map& defaultMap );
+ Replacement(const Property::Map& overrideMap, const Property::Map& defaultMap);
/*
* Constructor with default map
* Make a deep copy of the tree.
* @param overrideMap The user overriding map
*/
- Replacement( const Property::Map& defaultMap );
+ Replacement(const Property::Map& defaultMap);
/* @brief Check node for a type
*
* @param node The TreeNode to check
* @return Optional value
*/
- OptionalString IsString( const TreeNode& node ) const;
+ OptionalString IsString(const TreeNode& node) const;
/* @brief Check node for a type
*
* @param node The TreeNode to check
* @return Optional value
*/
- OptionalBoolean IsBoolean( const TreeNode & node ) const;
+ OptionalBoolean IsBoolean(const TreeNode& node) const;
/* @brief Check node for a type
*
* @param node The TreeNode to check
* @return Optional value
*/
- OptionalFloat IsFloat( const TreeNode & node ) const;
+ OptionalFloat IsFloat(const TreeNode& node) const;
/* @brief Check node for a type
*
* @param node The TreeNode to check
* @return Optional value
*/
- OptionalInteger IsInteger( const TreeNode & node ) const;
+ OptionalInteger IsInteger(const TreeNode& node) const;
/* @brief Check node for a type
*
* @param node The TreeNode to check
* @return Optional value
*/
- OptionalVector2 IsVector2( const TreeNode & node ) const;
+ OptionalVector2 IsVector2(const TreeNode& node) const;
/* @brief Check node for a type
*
* @param node The TreeNode to check
* @return Optional value
*/
- OptionalVector3 IsVector3( const TreeNode & node ) const;
+ OptionalVector3 IsVector3(const TreeNode& node) const;
/* @brief Check node for a type
*
* @param node The TreeNode to check
* @return Optional value
*/
- OptionalVector4 IsVector4( const TreeNode & node ) const;
+ OptionalVector4 IsVector4(const TreeNode& node) const;
/* @brief Check node for a type
*
* @param node The TreeNode to check
* @return Optional value
*/
- OptionalMatrix IsMatrix( const TreeNode & node ) const;
+ OptionalMatrix IsMatrix(const TreeNode& node) const;
/* @brief Check node for a type
*
* @param node The TreeNode to check
* @return Optional value
*/
- OptionalMatrix3 IsMatrix3( const TreeNode & node ) const;
+ OptionalMatrix3 IsMatrix3(const TreeNode& node) const;
/* @brief Check node for a type
*
* @param node The TreeNode to check
* @return Optional value
*/
- OptionalRect IsRect( const TreeNode & node ) const;
+ OptionalRect IsRect(const TreeNode& node) const;
/* @brief Check node for a type
*
* @param node The TreeNode to check
* @return Optional value
*/
- OptionalExtents IsExtents( const TreeNode & node ) const;
+ OptionalExtents IsExtents(const TreeNode& node) const;
/* @brief Check node for a type
*
* @param child The optional child TreeNode
* @return Optional value
*/
- OptionalString IsString( OptionalChild child ) const;
+ OptionalString IsString(OptionalChild child) const;
/* @brief Check node for a type
*
* @param child The optional child TreeNode
* @return Optional value
*/
- OptionalFloat IsFloat( OptionalChild child ) const;
+ OptionalFloat IsFloat(OptionalChild child) const;
/* @brief Check node for a type
*
* @param child The optional child TreeNode
* @return Optional value
*/
- OptionalBoolean IsBoolean( OptionalChild child ) const;
+ OptionalBoolean IsBoolean(OptionalChild child) const;
/* @brief Check node for a type
*
* @param child The optional child TreeNode
* @return Optional value
*/
- OptionalInteger IsInteger( OptionalChild child ) const;
+ OptionalInteger IsInteger(OptionalChild child) const;
/* @brief Check node for a type
*
* @param child The optional child TreeNode
* @return Optional value
*/
- OptionalVector2 IsVector2( OptionalChild child ) const;
+ OptionalVector2 IsVector2(OptionalChild child) const;
/* @brief Check node for a type
*
* @param child The optional child TreeNode
* @return Optional value
*/
- OptionalVector3 IsVector3( OptionalChild child ) const;
+ OptionalVector3 IsVector3(OptionalChild child) const;
/* @brief Check node for a type
*
* @param child The optional child TreeNode
* @return Optional value
*/
- OptionalVector4 IsVector4( OptionalChild child ) const;
+ OptionalVector4 IsVector4(OptionalChild child) const;
/* @brief Check node for a type
*
* @param child The optional child TreeNode
* @return Optional value
*/
- OptionalMatrix IsMatrix( OptionalChild child ) const;
+ OptionalMatrix IsMatrix(OptionalChild child) const;
/* @brief Check node for a type
*
* @param child The optional child TreeNode
* @return Optional value
*/
- OptionalMatrix3 IsMatrix3( OptionalChild child ) const;
+ OptionalMatrix3 IsMatrix3(OptionalChild child) const;
/* @brief Check node for a type
*
* @param child The optional child TreeNode
* @return Optional value
*/
- OptionalRect IsRect( OptionalChild child ) const;
+ OptionalRect IsRect(OptionalChild child) const;
/* @brief Check node for a type
*
* @param child The optional child TreeNode
* @return Optional value
*/
- bool IsMap( OptionalChild child, Property::Value& out ) const;
+ bool IsMap(OptionalChild child, Property::Value& out) const;
/* @brief Check node for a type
*
* @param child The optional child TreeNode
* @return Optional value
*/
- bool IsArray( OptionalChild child, Property::Value& out ) const;
+ bool IsArray(OptionalChild child, Property::Value& out) const;
/* @brief Check node for a type
*
* @param child The optional child TreeNode
* @return Optional value
*/
- OptionalExtents IsExtents( OptionalChild child ) const;
+ OptionalExtents IsExtents(OptionalChild child) const;
private:
// Overriding map (overrides the default map). The map is not owned.
// Replacement( const Replacement& copy );
// Returns the string if the node has a full replacement ie IMAGES if node is "{IMAGES}"
- OptionalString HasFullReplacement( const TreeNode & node ) const;
+ OptionalString HasFullReplacement(const TreeNode& node) const;
// Returns the property value for a full replacement from the maps
- Property::Value GetFullReplacement( const std::string& replacementString ) const;
-
+ Property::Value GetFullReplacement(const std::string& replacementString) const;
};
} // namespace Internal
#define DALI_TOOLKIT_INTERNAL_BUILDER_STYLE_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
-#include <dali/public-api/object/ref-object.h>
#include <dali-toolkit/devel-api/visual-factory/transition-data.h>
#include <dali-toolkit/internal/builder/dictionary.h>
+#include <dali/public-api/object/ref-object.h>
namespace Dali
{
{
namespace Internal
{
-
class Style;
typedef IntrusivePtr<Style> StylePtr;
* @param[in] handle The handle to apply the visuals to
* @param[in] instancedProperties The maps from which to get instanced properties
*/
- void ApplyVisualsAndPropertiesRecursively( Handle handle,
- const Dictionary<Property::Map>& instancedProperties ) const;
+ void ApplyVisualsAndPropertiesRecursively(Handle handle,
+ const Dictionary<Property::Map>& instancedProperties) const;
/**
* Apply the visuals of the style to the control pointed at by
* @param[in] handle The handle to apply the visuals to
* @param[in] instancedProperties The maps from which to get instanced properties
*/
- void ApplyVisuals( Handle handle,
- const Dictionary<Property::Map>& instancedProperties ) const;
+ void ApplyVisuals(Handle handle,
+ const Dictionary<Property::Map>& instancedProperties) const;
/**
* Apply the properties from the visualMaps and the instancedProperties
* @param[in] visualMaps The visual maps from which to get the styled properties
* @param[in] instancedProperties The maps from which to get instanced properties
*/
- static void ApplyVisuals( Handle handle,
- const Dictionary<Property::Map>& visualMaps,
- const Dictionary<Property::Map>& instancedProperties );
+ static void ApplyVisuals(Handle handle,
+ const Dictionary<Property::Map>& visualMaps,
+ const Dictionary<Property::Map>& instancedProperties);
/**
* Apply the properties from the visualMap and optional instancedProperties
* to the control pointed at by handle.
*/
- static void ApplyVisual( Handle handle,
- const std::string& visualName,
- const Property::Map& visualMap,
- const Property::Map* instancedProperties );
+ static void ApplyVisual(Handle handle,
+ const std::string& visualName,
+ const Property::Map& visualMap,
+ const Property::Map* instancedProperties);
/**
* Apply the properties of the style to the control pointed at by
*
* @param[in] handle The handle to apply the properties to
*/
- void ApplyProperties( Handle handle ) const;
+ void ApplyProperties(Handle handle) const;
protected:
/**
private:
// Not implemented
- DALI_INTERNAL Style( const Style& rhs );
+ DALI_INTERNAL Style(const Style& rhs);
// Not implemented
DALI_INTERNAL Style& operator=(const Style& rhs);
public:
// Everything must be shallow-copiable.
- Dictionary<StylePtr> subStates; // Each named style maps to a state.
+ Dictionary<StylePtr> subStates; // Each named style maps to a state.
Dictionary<Property::Map> visuals;
- Property::Map properties;
- Property::Array transitions;
- Toolkit::TransitionData entryTransition;
- Toolkit::TransitionData exitTransition;
+ Property::Map properties;
+ Property::Array transitions;
+ Toolkit::TransitionData entryTransition;
+ Toolkit::TransitionData exitTransition;
};
-} // Internal
-} // Toolkit
-} // Dali
-
+} // namespace Internal
+} // namespace Toolkit
+} // namespace Dali
#endif //DALI_TOOLKIT_INTERNAL_BUILDER_STYLE_H
#define DALI_SCRIPT_TREE_NODE_MANIPULATOR_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <utility> // pair
-#include <iterator>
#include <cstring>
+#include <iterator>
+#include <utility> // pair
#include <dali-toolkit/public-api/dali-toolkit-common.h>
#include <dali/public-api/common/vector-wrapper.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-typedef std::vector<char> VectorChar;
+typedef std::vector<char> VectorChar;
typedef VectorChar::iterator VectorCharIter;
/*
* @param child The child to add
* @return the added child
*/
- TreeNode *AddChild(TreeNode *child);
+ TreeNode* AddChild(TreeNode* child);
/*
* Change the type of the Node
* the children are removed
* @param type The new type
*/
- void SetType( TreeNode::NodeType type);
+ void SetType(TreeNode::NodeType type);
/*
* Set the name of the node
* @param name The name to set
*/
- void SetName( const char* name );
+ void SetName(const char* name);
/*
* Set the substituion flag
* in the tree.
* @param on The state
*/
- void SetSubstitution( bool on );
+ void SetSubstitution(bool on);
/*
* Get the nodes type
* Set the node as a string value
* @param string The string value
*/
- void SetString( const char* string );
+ void SetString(const char* string);
/*
* Set the node as an integer value
* @param i The integer
*/
- void SetInteger( int i );
+ void SetInteger(int i);
/*
* Set the node as an float value
* @param f The float
*/
- void SetFloat( float f );
+ void SetFloat(float f);
/*
* Set the node as an boolean value
* @param b The boolean
*/
- void SetBoolean( bool b );
+ void SetBoolean(bool b);
/*
* Get the nodes parent
void Write(std::ostream& output, int indent) const;
private:
- TreeNode *mNode;
+ TreeNode* mNode;
/*
* Move the nodes strings to the buffer
/*
* Do write to string stream
*/
- void DoWrite(const TreeNode *value, std::ostream& output, int level, int ident, bool groupChildren) const;
-
+ void DoWrite(const TreeNode* value, std::ostream& output, int level, int ident, bool groupChildren) const;
};
/*
*/
struct CollectNodes
{
- CollectNodes() {};
+ CollectNodes(){};
/*
* Call operator to add nodes to the list
}
typedef std::vector<const TreeNode*> VectorNodes;
- typedef VectorNodes::iterator iterator;
+ typedef VectorNodes::iterator iterator;
VectorNodes nodes; ///< List of collected nodes
};
/*
* Depth first walk of nodes applying given operation (unary_function)
*/
-template <typename Operation>
-void DepthFirst( TreeNode* node, Operation& operation)
+template<typename Operation>
+void DepthFirst(TreeNode* node, Operation& operation)
{
DALI_ASSERT_DEBUG(node && "Operation on NULL JSON node");
for(TreeNode::ConstIterator iter = node->CBegin(); iter != node->CEnd(); ++iter)
{
// iterator access is const for external api but were modifying
- DepthFirst( const_cast<TreeNode*>(&((*iter).second)), operation);
+ DepthFirst(const_cast<TreeNode*>(&((*iter).second)), operation);
}
operation(node);
-
}
/*
* @param sentinel The buffer sentinel
* @return The start of the given buffer
*/
-char *CopyString( const char *fromString, VectorCharIter& iter, const VectorCharIter& sentinel);
-
+char* CopyString(const char* fromString, VectorCharIter& iter, const VectorCharIter& sentinel);
} // namespace Internal
#define DALI_TOOLKIT_INTERNAL_ALIGNMENT_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/devel-api/controls/alignment/alignment.h>
#include <dali-toolkit/internal/controls/control/control-data-impl.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
namespace Dali
{
-
namespace Toolkit
{
-
class Alignment;
namespace Internal
{
-
/**
* Alignment is a control to position and resize actors inside other container actors.
* @see Dali::Toolkit::Alignment for more details.
class Alignment : public Control
{
public:
-
/**
* Create an initialized Alignment.
* @param type Type of alignment.
* @return A handle to a newly allocated Dali resource.
*/
- static Toolkit::Alignment New( Toolkit::Alignment::Type horizontal, Toolkit::Alignment::Type vertical );
+ static Toolkit::Alignment New(Toolkit::Alignment::Type horizontal, Toolkit::Alignment::Type vertical);
/**
* @copydoc Dali::Toolkit::Alignment::SetAlignmentType()
*/
- void SetAlignmentType( Toolkit::Alignment::Type type );
+ void SetAlignmentType(Toolkit::Alignment::Type type);
/**
* @copydoc Dali::Toolkit::Alignment::GetAlignmentType()
/**
* @copydoc Dali::Toolkit::Alignment::SetScaling()
*/
- void SetScaling( Toolkit::Alignment::Scaling scaling );
+ void SetScaling(Toolkit::Alignment::Scaling scaling);
/**
* @copydoc Dali::Toolkit::Alignment::GetScaling()
/**
* @copydoc Dali::Toolkit::Alignment::SetPadding()
*/
- void SetPadding( const Toolkit::Alignment::Padding& padding );
+ void SetPadding(const Toolkit::Alignment::Padding& padding);
/**
* @copydoc Dali::Toolkit::Alignment::GetPadding()
*/
const Toolkit::Alignment::Padding& GetPadding() const;
-
private: // From Control
-
/**
* @copydoc Control::OnInitialize()
*/
/**
* @copydoc Control::OnRelayout()
*/
- void OnRelayout( const Vector2& size, RelayoutContainer& container ) override;
+ void OnRelayout(const Vector2& size, RelayoutContainer& container) override;
private:
-
/**
* Constructor.
* It initializes Alignment members.
*/
- Alignment( Toolkit::Alignment::Type horizontal, Toolkit::Alignment::Type vertical );
+ Alignment(Toolkit::Alignment::Type horizontal, Toolkit::Alignment::Type vertical);
/**
* A reference counted object may only be deleted by calling Unreference()
virtual ~Alignment();
private:
-
// Undefined
Alignment(const Alignment&);
Alignment& operator=(const Alignment&);
} // namespace Internal
-
// Helpers for public-api forwarding methods
-inline Toolkit::Internal::Alignment& GetImpl( Toolkit::Alignment& alignment )
+inline Toolkit::Internal::Alignment& GetImpl(Toolkit::Alignment& alignment)
{
- DALI_ASSERT_ALWAYS( alignment );
+ DALI_ASSERT_ALWAYS(alignment);
Dali::RefObject& handle = alignment.GetImplementation();
- return static_cast<Toolkit::Internal::Alignment&>( handle );
+ return static_cast<Toolkit::Internal::Alignment&>(handle);
}
-inline const Toolkit::Internal::Alignment& GetImpl( const Toolkit::Alignment& alignment )
+inline const Toolkit::Internal::Alignment& GetImpl(const Toolkit::Alignment& alignment)
{
- DALI_ASSERT_ALWAYS( alignment );
+ DALI_ASSERT_ALWAYS(alignment);
const Dali::RefObject& handle = alignment.GetImplementation();
- return static_cast<const Toolkit::Internal::Alignment&>( handle );
+ return static_cast<const Toolkit::Internal::Alignment&>(handle);
}
} // namespace Toolkit
#define DALI_TOOLKIT_INTERNAL_BLOOM_VIEW_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <sstream>
-#include <cmath>
#include <dali/public-api/actors/camera-actor.h>
#include <dali/public-api/render-tasks/render-task.h>
#include <dali/public-api/rendering/frame-buffer.h>
+#include <cmath>
+#include <sstream>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali-toolkit/devel-api/controls/bloom-view/bloom-view.h>
#include <dali-toolkit/devel-api/controls/gaussian-blur-view/gaussian-blur-view.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
-#include <dali-toolkit/devel-api/controls/bloom-view/bloom-view.h>
namespace Dali
{
-
namespace Toolkit
{
-
class BloomView;
namespace Internal
{
-
/**
* BloomEffect implementation class
*/
/**
* @copydoc Dali::Toolkit::BloomView::BloomView
*/
- BloomView(const unsigned int numSamples, const float blurBellCurveWidth, const Pixel::Format renderTargetPixelFormat,
- const float downsampleWidthScale, const float downsampleHeightScale);
+ BloomView(const unsigned int numSamples, const float blurBellCurveWidth, const Pixel::Format renderTargetPixelFormat, const float downsampleWidthScale, const float downsampleHeightScale);
/**
* @copydoc Dali::Toolkit::BloomView::~BloomView
* @copydoc Dali::Toolkit::BloomView::New
*/
static Dali::Toolkit::BloomView New();
- static Dali::Toolkit::BloomView New( const unsigned int numSamples, const float blurBellCurveWidth, const Pixel::Format renderTargetPixelFormat,
- const float downsampleWidthScale, const float downsampleHeightScale);
- void Activate();
- void Deactivate();
-
- Property::Index GetBloomThresholdPropertyIndex() const {return mBloomThresholdPropertyIndex;}
- Property::Index GetBlurStrengthPropertyIndex() const {return mBlurStrengthPropertyIndex;}
- Property::Index GetBloomIntensityPropertyIndex() const {return mBloomIntensityPropertyIndex;}
- Property::Index GetBloomSaturationPropertyIndex() const {return mBloomSaturationPropertyIndex;}
- Property::Index GetImageIntensityPropertyIndex() const {return mImageIntensityPropertyIndex;}
- Property::Index GetImageSaturationPropertyIndex() const {return mImageSaturationPropertyIndex;}
+ static Dali::Toolkit::BloomView New(const unsigned int numSamples, const float blurBellCurveWidth, const Pixel::Format renderTargetPixelFormat, const float downsampleWidthScale, const float downsampleHeightScale);
+ void Activate();
+ void Deactivate();
+
+ Property::Index GetBloomThresholdPropertyIndex() const
+ {
+ return mBloomThresholdPropertyIndex;
+ }
+ Property::Index GetBlurStrengthPropertyIndex() const
+ {
+ return mBlurStrengthPropertyIndex;
+ }
+ Property::Index GetBloomIntensityPropertyIndex() const
+ {
+ return mBloomIntensityPropertyIndex;
+ }
+ Property::Index GetBloomSaturationPropertyIndex() const
+ {
+ return mBloomSaturationPropertyIndex;
+ }
+ Property::Index GetImageIntensityPropertyIndex() const
+ {
+ return mImageIntensityPropertyIndex;
+ }
+ Property::Index GetImageSaturationPropertyIndex() const
+ {
+ return mImageSaturationPropertyIndex;
+ }
private:
-
void OnInitialize() override;
void OnSizeSet(const Vector3& targetSize) override;
/**
* @copydoc Control::OnChildAdd()
*/
- void OnChildAdd( Actor& child ) override;
+ void OnChildAdd(Actor& child) override;
/**
* @copydoc Control::OnChildRemove()
*/
- void OnChildRemove( Actor& child ) override;
+ void OnChildRemove(Actor& child) override;
void AllocateResources();
void CreateRenderTasks();
void SetupProperties();
-
/////////////////////////////////////////////////////////////
- unsigned int mBlurNumSamples; // number of blur samples in each of horiz/vert directions
- float mBlurBellCurveWidth; // constant used when calculating the gaussian weights
- Pixel::Format mPixelFormat; // pixel format used by render targets
+ unsigned int mBlurNumSamples; // number of blur samples in each of horiz/vert directions
+ float mBlurBellCurveWidth; // constant used when calculating the gaussian weights
+ Pixel::Format mPixelFormat; // pixel format used by render targets
/////////////////////////////////////////////////////////////
// downsampling is used for the separated blur passes to get increased blur with the same number of samples and also to make rendering quicker
float mDownsampledWidth;
float mDownsampledHeight;
-
/////////////////////////////////////////////////////////////
// for checking if we need to reallocate render targets
Vector2 mTargetSize;
/////////////////////////////////////////////////////////////
// for rendering all user added children to offscreen target
FrameBuffer mRenderTargetForRenderingChildren;
- RenderTask mRenderChildrenTask;
+ RenderTask mRenderChildrenTask;
/////////////////////////////////////////////////////////////
// for extracting bright parts of image to an offscreen target
FrameBuffer mBloomExtractTarget; // for rendering bright parts of image into separate texture, also used as target for gaussian blur
- RenderTask mBloomExtractTask;
- Actor mBloomExtractActor;
+ RenderTask mBloomExtractTask;
+ Actor mBloomExtractActor;
/////////////////////////////////////////////////////////////
// for blurring extracted bloom
/////////////////////////////////////////////////////////////
// for holding blurred result
FrameBuffer mOutputRenderTarget;
- Actor mTargetActor;
+ Actor mTargetActor;
/////////////////////////////////////////////////////////////
// Properties for setting by user, e.g. by animations
Property::Index mImageIntensityPropertyIndex;
Property::Index mImageSaturationPropertyIndex;
- bool mActivated:1;
+ bool mActivated : 1;
private:
-
// Undefined copy constructor.
- BloomView( const BloomView& );
+ BloomView(const BloomView&);
// Undefined assignment operator.
- BloomView& operator=( const BloomView& );
+ BloomView& operator=(const BloomView&);
};
} // namespace Internal
// Helpers for public-api forwarding methods
-inline Toolkit::Internal::BloomView& GetImpl( Toolkit::BloomView& obj )
+inline Toolkit::Internal::BloomView& GetImpl(Toolkit::BloomView& obj)
{
DALI_ASSERT_ALWAYS(obj);
Dali::RefObject& handle = obj.GetImplementation();
return static_cast<Toolkit::Internal::BloomView&>(handle);
}
-inline const Toolkit::Internal::BloomView& GetImpl( const Toolkit::BloomView& obj )
+inline const Toolkit::Internal::BloomView& GetImpl(const Toolkit::BloomView& obj)
{
DALI_ASSERT_ALWAYS(obj);
const Dali::RefObject& handle = obj.GetImplementation();
#define DALI_TOOLKIT_INTERNAL_BUBBLE_EFFECT_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <sstream>
-#include <dali/public-api/rendering/shader.h>
#include <dali-toolkit/internal/graphics/builtin-shader-extern-gen.h>
+#include <dali/public-api/rendering/shader.h>
+#include <sstream>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/**
* Create the shader to be used by the renderer
* @param[in] numberOfBubble How many groups of uniforms are used to control the bubble movement.
* @return A handle to the newly created shader.
*/
-inline Shader CreateBubbleShader( unsigned int numBubble )
+inline Shader CreateBubbleShader(unsigned int numBubble)
{
std::ostringstream vertexShaderStringStream;
- vertexShaderStringStream << "#define NUMBER_OF_BUBBLE "<< numBubble << "\n"
+ vertexShaderStringStream << "#define NUMBER_OF_BUBBLE " << numBubble << "\n"
<< SHADER_BUBBLE_EFFECT_VERT;
- Shader shader = Shader::New( vertexShaderStringStream.str(), SHADER_BUBBLE_EFFECT_FRAG );
+ Shader shader = Shader::New(vertexShaderStringStream.str(), SHADER_BUBBLE_EFFECT_FRAG);
return shader;
}
#define DALI_TOOLKIT_INTERNAL_BUBBLE_EMITTER_IMPL_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/actors/camera-actor.h>
#include <dali/devel-api/common/stage.h>
-#include <dali/public-api/rendering/frame-buffer.h>
+#include <dali/public-api/actors/camera-actor.h>
#include <dali/public-api/render-tasks/render-task.h>
+#include <dali/public-api/rendering/frame-buffer.h>
#include <dali/public-api/rendering/geometry.h>
#include <dali/public-api/rendering/renderer.h>
#include <dali/public-api/rendering/sampler.h>
#include <dali/public-api/rendering/vertex-buffer.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/devel-api/controls/bubble-effect/bubble-emitter.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class BubbleRenderer;
/**
class BubbleEmitter : public Control
{
public:
-
/**
* Destructor
*/
/**
* @copydoc Toolkit::BubbleEmitter::New
*/
- static Toolkit::BubbleEmitter New( const Vector2& winSize,
- Texture shapeTexture,
- unsigned int maximumNumberOfBubble,
- const Vector2& bubbleSizeRange );
+ static Toolkit::BubbleEmitter New(const Vector2& winSize,
+ Texture shapeTexture,
+ unsigned int maximumNumberOfBubble,
+ const Vector2& bubbleSizeRange);
/**
* @copydoc Toolkit::BubbleEmitter::GetRootActor
/**
* @copydoc Toolkit::BubbleEmitter::SetBackground
*/
- void SetBackground( Texture bgTexture, const Vector3& hsvDelta );
+ void SetBackground(Texture bgTexture, const Vector3& hsvDelta);
/**
* @copydoc Toolkit::BubbleEmitter::SetShape
*/
- void SetBubbleShape( Texture shapeTexture );
+ void SetBubbleShape(Texture shapeTexture);
/**
* @copydoc Toolkit::BubbleEmiter::SetBubbleScale
*/
- void SetBubbleScale( float scale );
+ void SetBubbleScale(float scale);
/**
* @copydoc Toolkit::BubbleEmitter::SetBubbleDensity
*/
- void SetBubbleDensity( unsigned int density );
+ void SetBubbleDensity(unsigned int density);
/**
* @copydoc Toolkit::BubbleEmitter::EmitBubble
*/
- void EmitBubble( Animation& animation, const Vector2& emitPosition, const Vector2& direction, const Vector2& displacement );
+ void EmitBubble(Animation& animation, const Vector2& emitPosition, const Vector2& direction, const Vector2& displacement);
/**
* @copydoc Toolkit::BubbleEmitter::Restore
void Restore();
private:
-
/**
* Construct a new BubbleEmitter object.
* @param[in] movementArea The size of the bubble moving area
* @param[in] maximumNumberOfBubble The maximum number of bubble needed.
* @param[in] bubbleSizeRange The size range of the bubbles; x component is the minimal size, and y component is the maximum size.
*/
- BubbleEmitter( const Vector2& movementArea,
- Texture shapeTexture,
- unsigned int maximumNumberOfBubble,
- const Vector2& bubbleSizeRange );
+ BubbleEmitter(const Vector2& movementArea,
+ Texture shapeTexture,
+ unsigned int maximumNumberOfBubble,
+ const Vector2& bubbleSizeRange);
/**
* This method is called after the CubeTransitionEffect has been initialized.
* @param[in] numOfPatch The triangle number in the mesh is 2*numOfPatch; two triangles for each bubble.
* @return The mesh geometry.
*/
- Geometry CreateGeometry( unsigned int numOfPatch );
+ Geometry CreateGeometry(unsigned int numOfPatch);
/**
* Callback function of the finished signal of off-screen render task.
* @param[in] direction The direction used to constrain the bubble to move in an adjacent direction around it.
* @param[in] displacement The displacement used to bound the moving distance of the bubble.
*/
- void SetBubbleParameter( BubbleRenderer& bubbleRenderer, unsigned int curUniform,
- const Vector2& emitPosition, const Vector2& direction, const Vector2& displacement );
+ void SetBubbleParameter(BubbleRenderer& bubbleRenderer, unsigned int curUniform, const Vector2& emitPosition, const Vector2& direction, const Vector2& displacement);
private:
-
- Actor mBubbleRoot; ///<The bubble root actor. Need to add it to stage to get the bubbles rendered.
- Texture mShapeTexture; ///< The alpha channnel of this texture defines the bubble shape.
- Texture mBackgroundTexture; ///< The original background texture
- Texture mEffectTexture; ///< Texture which stores the adjusted color of the background image.The bubbles pick color from this image.
- FrameBuffer mFrameBuffer; ///< FrameBuffer used for offscreen rendering
- CameraActor mCameraActor; ///< The render task views the scene from the perspective of this actor.
-
- Geometry mMeshGeometry; ///< The mesh geometry which contains the vertices and indices data
- TextureSet mTextureSet; ///< The texture set which controls the bubble display
- std::vector<BubbleRenderer> mBubbleRenderers; ///< The BubbleRenderer vector, its size is mNumShader.
-
- Vector2 mMovementArea; ///< The size of the bubble moving area, usually the same size as the background.
- Vector2 mBubbleSizeRange; ///< The size range of the bubbles; x component is the low bound, and y component is the up bound.
- Vector3 mHSVDelta; ///< The HSV difference used to adjust the background image color.
-
- unsigned int mNumBubblePerRenderer; ///< How many bubbles for each BubbleRenderer.
- unsigned int mNumRenderer; ///< How many BubbleRenderers are used.
- unsigned int mDensity; ///< How many bubbles will emit at each time, they are controlled by same uniforms in the shader.
- unsigned int mTotalNumOfBubble; ///< mNumBubblePerShader*mNumShader.
- unsigned int mCurrentBubble; ///< Keep track of the index for the newly emitted bubble
- unsigned int mRandomSeed; ///< Seed to generate random number.
-
- bool mRenderTaskRunning; ///< If the background render task is currently running
-
+ Actor mBubbleRoot; ///<The bubble root actor. Need to add it to stage to get the bubbles rendered.
+ Texture mShapeTexture; ///< The alpha channnel of this texture defines the bubble shape.
+ Texture mBackgroundTexture; ///< The original background texture
+ Texture mEffectTexture; ///< Texture which stores the adjusted color of the background image.The bubbles pick color from this image.
+ FrameBuffer mFrameBuffer; ///< FrameBuffer used for offscreen rendering
+ CameraActor mCameraActor; ///< The render task views the scene from the perspective of this actor.
+
+ Geometry mMeshGeometry; ///< The mesh geometry which contains the vertices and indices data
+ TextureSet mTextureSet; ///< The texture set which controls the bubble display
+ std::vector<BubbleRenderer> mBubbleRenderers; ///< The BubbleRenderer vector, its size is mNumShader.
+
+ Vector2 mMovementArea; ///< The size of the bubble moving area, usually the same size as the background.
+ Vector2 mBubbleSizeRange; ///< The size range of the bubbles; x component is the low bound, and y component is the up bound.
+ Vector3 mHSVDelta; ///< The HSV difference used to adjust the background image color.
+
+ unsigned int mNumBubblePerRenderer; ///< How many bubbles for each BubbleRenderer.
+ unsigned int mNumRenderer; ///< How many BubbleRenderers are used.
+ unsigned int mDensity; ///< How many bubbles will emit at each time, they are controlled by same uniforms in the shader.
+ unsigned int mTotalNumOfBubble; ///< mNumBubblePerShader*mNumShader.
+ unsigned int mCurrentBubble; ///< Keep track of the index for the newly emitted bubble
+ unsigned int mRandomSeed; ///< Seed to generate random number.
+
+ bool mRenderTaskRunning; ///< If the background render task is currently running
};
} // namespace Internal
#define DALI_TOOLKIT_INTERNAL_BUBBLE_RENDERER_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/**
* BubbleRenderer renders a group of bubbles.Each bubble can be moved separately.
* Its custom shader achieves similar effect of particle system by applying on a specially created mesh
class BubbleRenderer
{
public:
-
/**
* Constructor *
* @return A newly allocated object.
/**
* @brief Destructor
*/
- ~BubbleRenderer(){}
+ ~BubbleRenderer()
+ {
+ }
/**
* Prepare for the rendering: create the renderer, and register properties
* @param[in] textureSet The texture set to be used by the renderer
* @param[in] shader The shader set to be used by the renderer
*/
- void Initialize( unsigned int numberOfBubble, const Vector2& movementArea, Geometry geometry, TextureSet textureSet, Shader shader );
+ void Initialize(unsigned int numberOfBubble, const Vector2& movementArea, Geometry geometry, TextureSet textureSet, Shader shader);
/**
* Return the mesh actor which is used to display the bubbles
* Sets the geometry to be used by the renderer
* @param[in] geometry The geometry to be used by the renderer
*/
- void SetGeometry( Geometry geometry );
+ void SetGeometry(Geometry geometry);
/**
* Set the start and end positions of the index-th bubble's movement.
* @param[in] index Indicate which bubble these properties are applied on.
* @param[in] startAndEndPosition The start and the end position of movement.
*/
- void SetStartAndEndPosition( unsigned int index, const Vector4& startAndEndPosition );
+ void SetStartAndEndPosition(unsigned int index, const Vector4& startAndEndPosition);
/**
* Set the movement completed percentage of the index-th bubble.
* @param[in] index Indicate which bubble this property is applied on.
* @param[in] percentage Set the percentage property value ( between zero and one ).
*/
- void SetPercentage( unsigned int index, float percentage );
+ void SetPercentage(unsigned int index, float percentage);
/**
* Set the gravity applied to the y direction, which makes the bubbles no longer moving on a straight line.
* @param[in] gravity The gravity on the y direction.
*/
- void SetGravity( float gravity );
+ void SetGravity(float gravity);
/**
* Set the scale factor applied to the bubbles
* @param[in] scale The scale factor applied on all bubbles.
*/
- void SetDynamicScale( float scale );
+ void SetDynamicScale(float scale);
/**
* Get the idx-th percentage property.
* @param[in] idx The percentage property index.
* @return the idx-th percentage property.
*/
- Property GetPercentageProperty( unsigned int idx );
+ Property GetPercentageProperty(unsigned int idx);
/**
* Reset the uniform values to default.
void ResetProperties();
private:
-
- Renderer mRenderer;
+ Renderer mRenderer;
//properties mapped as uniforms
std::vector<Property::Index> mIndicesOffset; ///< Indices of the properties mapping to uniform array 'uOffset'
#define DALI_TOOLKIT_INTERNAL_COLOR_ADJUSTER_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/object/property-map.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
#include <dali-toolkit/internal/graphics/builtin-shader-extern-gen.h>
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
-inline void SetColorAdjusterProperties( Actor& actor, const Vector3& hsvDelta, bool ignoreAlpha = false )
+inline void SetColorAdjusterProperties(Actor& actor, const Vector3& hsvDelta, bool ignoreAlpha = false)
{
- actor.RegisterProperty( "uHSVDelta", hsvDelta );
- actor.RegisterProperty( "uIgnoreAlpha", ignoreAlpha ? 1.f : 0.f );
+ actor.RegisterProperty("uHSVDelta", hsvDelta);
+ actor.RegisterProperty("uIgnoreAlpha", ignoreAlpha ? 1.f : 0.f);
}
/**
inline Property::Map CreateColorAdjuster()
{
Property::Map customShader;
- customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = SHADER_BUBBLE_EFFECT_COLOR_ADJUSTER_FRAG.data();
+ customShader[Toolkit::Visual::Shader::Property::FRAGMENT_SHADER] = SHADER_BUBBLE_EFFECT_COLOR_ADJUSTER_FRAG.data();
Property::Map map;
- map[ Toolkit::Visual::Property::SHADER ] = customShader;
+ map[Toolkit::Visual::Property::SHADER] = customShader;
return map;
}
#define DALI_TOOLKIT_INTERNAL_BUTTON_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/animation/animation.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/visual-factory/visual-base.h>
#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
-#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali-toolkit/devel-api/visual-factory/visual-base.h>
#include <dali-toolkit/internal/controls/control/control-data-impl.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
namespace Dali
{
-
namespace Toolkit
{
-
class Button;
namespace Internal
{
-
/**
* @copydoc Toolkit::Button
*
*/
class Button : public Control
{
-
public:
-
/**
* Enum describing the position the text label can be in relation to the control (and foreground/icon)
*/
enum Align
{
- BEGIN, // At the start of the control before the foreground/icon
- END, // At the end of the control after the foreground/icon
- TOP, // At the top of the control above the foreground/icon
- BOTTOM // At the bottom of the control below the foreground/icon
+ BEGIN, // At the start of the control before the foreground/icon
+ END, // At the end of the control after the foreground/icon
+ TOP, // At the top of the control above the foreground/icon
+ BOTTOM // At the bottom of the control below the foreground/icon
};
public:
-
/**
* @brief Sets the button as \e disabled.
* @param[in] disabled Disabled property
*/
- void SetDisabled( bool disabled );
+ void SetDisabled(bool disabled);
/**
* @brief Returns if the button is disabled.
* @brief Sets the \e autorepeating property.
* @param[in] autoRepeating \e autorepeating property
*/
- void SetAutoRepeating( bool autoRepeating );
+ void SetAutoRepeating(bool autoRepeating);
/**
* @brief Sets the initial autorepeating delay.
* @param[in] initialAutoRepeatingDelay in seconds
*/
- void SetInitialAutoRepeatingDelay( float initialAutoRepeatingDelay );
+ void SetInitialAutoRepeatingDelay(float initialAutoRepeatingDelay);
/**
* @brief Sets the next autorepeating delay.
* @param[in] nextAutoRepeatingDelay in seconds
*/
- void SetNextAutoRepeatingDelay( float nextAutoRepeatingDelay );
+ void SetNextAutoRepeatingDelay(float nextAutoRepeatingDelay);
/**
* @brief Sets the \e togglable property.
* @param[in] togglable Togglable property
*/
- void SetTogglableButton( bool togglable );
+ void SetTogglableButton(bool togglable);
/**
* @brief Sets the button as selected or unselected.
* @param[in] selected Selected property
*/
- void SetSelected( bool selected );
+ void SetSelected(bool selected);
/**
* @brief Returns if the selected property is set and the button is togglable.
* @param[in] properties A Property::Map of key-value pairs of properties to set.
* @param[out] properties A Property::Map of text visual properties to set after merging inMap with existing maps
*/
- void MergeWithExistingLabelProperties( const Property::Map& inMap, Property::Map& outMap );
+ void MergeWithExistingLabelProperties(const Property::Map& inMap, Property::Map& outMap);
/**
* Performs actions as requested using the action name.
* @param[in] attributes The attributes with which to perfrom this action.
* @return true if action has been accepted by this control
*/
- static bool DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes );
+ static bool DoAction(BaseObject* object, const std::string& actionName, const Property::Map& attributes);
public:
-
/**
* Button's state
*/
enum State
{
- UNSELECTED_STATE, ///< The button is unselected.
- SELECTED_STATE, ///< The button is selected.
- DISABLED_UNSELECTED_STATE, ///< The button is disabled and unselected.
- DISABLED_SELECTED_STATE, ///< The button is disabled and selected.
- STATE_COUNT, ///< Number of States
+ UNSELECTED_STATE, ///< The button is unselected.
+ SELECTED_STATE, ///< The button is selected.
+ DISABLED_UNSELECTED_STATE, ///< The button is disabled and unselected.
+ DISABLED_SELECTED_STATE, ///< The button is disabled and selected.
+ STATE_COUNT, ///< Number of States
};
/**
};
protected:
-
/**
* Button press state which is not the same as the actual button's state.
* For example An UNSELECTED button can be DEPRESSED, but until released, the actual button state doesn't change to SELECTED
*/
enum PressState
{
- DEPRESSED, ///< The button is up.
- UNPRESSED, ///< The button is down.
- TOGGLE_DEPRESSED, ///< The button has been pressed down and will stay depressed when released.
+ DEPRESSED, ///< The button is up.
+ UNPRESSED, ///< The button is down.
+ TOGGLE_DEPRESSED, ///< The button has been pressed down and will stay depressed when released.
};
/**
Actor GetSelectedImage();
private:
-
/**
* Perform the click action to click the button.
* @param[in] attributes The attributes to perfrom this action.
* @return true if this control can perform action.
*/
- bool DoClickAction( const Property::Map& attributes );
+ bool DoClickAction(const Property::Map& attributes);
/**
* This method is called when the button is a Toggle button and released
/**
* This method is called when the \e selected property is changed.
*/
- virtual void OnStateChange( State newState ){}
+ virtual void OnStateChange(State newState)
+ {
+ }
/**
* This method is called when the \e disabled property is changed.
*/
- virtual void OnDisabled() {}
+ virtual void OnDisabled()
+ {
+ }
/**
* This method is called when the button is pressed.
*/
- virtual void OnPressed() {}
+ virtual void OnPressed()
+ {
+ }
/**
* This method is called when the button is released.
*/
- virtual void OnReleased() {}
+ virtual void OnReleased()
+ {
+ }
public:
-
/**
* @copydoc Dali::Toolkit::PushButton::PressedSignal()
*/
* @return True if the signal was connected.
* @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
*/
- static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
+ static bool DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
// Properties
* @param[in] index The property index.
* @param[in] value The new property value.
*/
- static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
+ static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value);
/**
* Called to retrieve a property of an object of this type.
* @param[in] index The property index.
* @return The current value of the property.
*/
- static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex );
+ static Property::Value GetProperty(BaseObject* object, Property::Index propertyIndex);
protected: // From Control
-
/**
* @copydoc Toolkit::Control::OnInitialize()
* @note If overridden by deriving button classes, then an up-call to Button::OnInitialize MUST be made at the start.
/**
* @copydoc Toolkit::Control::OnSceneConnection()
*/
- void OnSceneConnection( int depth ) override;
+ void OnSceneConnection(int depth) override;
/**
* @copydoc Toolkit::Control::GetNaturalSize
/**
* @copydoc Toolkit::Control::OnSetResizePolicy
*/
- void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension ) override;
+ void OnSetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension) override;
/**
* @copydoc Toolkit::Control::OnRelayout
*/
- void OnRelayout( const Vector2& size, RelayoutContainer& container ) override;
+ void OnRelayout(const Vector2& size, RelayoutContainer& container) override;
private:
-
/**
* @brief Handler for touch data
* @param[in] actor The touched actor.
* @param[in] touch The touch info.
* @return true, if consumed, false otherwise.
*/
- bool OnTouch( Actor actor, const TouchEvent& touch );
+ bool OnTouch(Actor actor, const TouchEvent& touch);
/**
* Handler for tap events.
* Sets up the autorepeating timer.
* @param[in] delay The delay time in seconds.
*/
- void SetUpTimer( float delay );
+ void SetUpTimer(float delay);
/**
* Button has been pressed
* @param[in] requestedState check if can transition to this state
* @return bool true if state change valid
*/
- bool ValidateState( State requestedState );
+ bool ValidateState(State requestedState);
/**
* Changes the button state when an action occurs on it
* @param[in] requestedState the state to change to
*/
- void ChangeState( State requestedState );
+ void ChangeState(State requestedState);
/**
* This method is called when the button is released.
void Released();
protected:
-
/**
* Set Text Label Padding
* @param[in] padding BEGIN END BOTTOM TOP
*/
- void SetLabelPadding( const Padding& padding );
+ void SetLabelPadding(const Padding& padding);
/**
* Get Text Label padding
* Set Foreground/icon Padding
* @param[in] padding BEGIN END BOTTOM TOP
*/
- void SetForegroundPadding( const Padding& padding);
+ void SetForegroundPadding(const Padding& padding);
/**
* Get Foreground padding
* @param[in] value the value to set on the component
* @param[in] visualDepth the depth of the visual if overlapping another
*/
- void CreateVisualsForComponent( Property::Index index, const Property::Value& value, const int visualDepth );
+ void CreateVisualsForComponent(Property::Index index, const Property::Value& value, const int visualDepth);
/**
* @brief Get the Property map for the given Visual
* @param[out] retreivedMap the property map used to construct the required visual
* @return bool success flag, true if visual found
*/
- bool GetPropertyMapForVisual( Property::Index visualIndex, Property::Map& retreivedMap ) const;
+ bool GetPropertyMapForVisual(Property::Index visualIndex, Property::Map& retreivedMap) const;
/**
* Returns the animation to be used for transition, creating the animation if needed.
* @return The initialised transition animation.
* @brief Set the position of the label relative to foreground/icon, if both present
* @param[in] labelAlignment given alignment setting
*/
- void SetLabelAlignment( Align labelAlignment);
+ void SetLabelAlignment(Align labelAlignment);
/**
* @brief Get set alignment of label in relation to foreground/icon
* define the required behaviour.
* Can decide to only remove specified visuals via index
*/
- virtual void OnButtonVisualRemoval( Property::Index visualIndex );
-
+ virtual void OnButtonVisualRemoval(Property::Index visualIndex);
private:
-
/**
* Removes the visual from the button and prepares it to be transitioned out
* @param[in] visualIndex the visual to remove
*/
- void RemoveVisual( Property::Index visualIndex );
+ void RemoveVisual(Property::Index visualIndex);
/**
* Adds the required visual to the button.
* @param[in] visualIndex The Property index of the visual required
*/
- void SelectRequiredVisual( Property::Index visualIndex );
+ void SelectRequiredVisual(Property::Index visualIndex);
// Undefined
- Button( const Button& );
+ Button(const Button&);
// Undefined
- Button& operator = ( const Button& );
+ Button& operator=(const Button&);
private:
-
// Signals
- Toolkit::Button::ButtonSignalType mPressedSignal; ///< Signal emitted when the button is pressed.
- Toolkit::Button::ButtonSignalType mReleasedSignal; ///< Signal emitted when the button is released.
- Toolkit::Button::ButtonSignalType mClickedSignal; ///< Signal emitted when the button is clicked.
- Toolkit::Button::ButtonSignalType mStateChangedSignal; ///< Signal emitted when the button's state is changed.
+ Toolkit::Button::ButtonSignalType mPressedSignal; ///< Signal emitted when the button is pressed.
+ Toolkit::Button::ButtonSignalType mReleasedSignal; ///< Signal emitted when the button is released.
+ Toolkit::Button::ButtonSignalType mClickedSignal; ///< Signal emitted when the button is clicked.
+ Toolkit::Button::ButtonSignalType mStateChangedSignal; ///< Signal emitted when the button's state is changed.
- Timer mAutoRepeatingTimer;
+ Timer mAutoRepeatingTimer;
- Actor mLabel; ///< Stores the button text label.
- Padding mLabelPadding; ///< The padding around the label (if present).
- Padding mForegroundPadding; ///< The padding around the foreground/icon visual (if present).
+ Actor mLabel; ///< Stores the button text label.
+ Padding mLabelPadding; ///< The padding around the label (if present).
+ Padding mForegroundPadding; ///< The padding around the foreground/icon visual (if present).
- Align mTextLabelAlignment; ///< Position of text label in relation to foreground/icon when both are present.
+ Align mTextLabelAlignment; ///< Position of text label in relation to foreground/icon when both are present.
TapGestureDetector mTapDetector;
- bool mAutoRepeating; ///< Stores the autorepeating property.
- bool mTogglableButton; ///< Stores the togglable property as a flag.
- bool mTextStringSetFlag; ///< Stores if text has been set. Required in relayout but don't want to calculate there.
+ bool mAutoRepeating; ///< Stores the autorepeating property.
+ bool mTogglableButton; ///< Stores the togglable property as a flag.
+ bool mTextStringSetFlag; ///< Stores if text has been set. Required in relayout but don't want to calculate there.
- float mInitialAutoRepeatingDelay; ///< Stores the initial autorepeating delay in seconds.
- float mNextAutoRepeatingDelay; ///< Stores the next autorepeating delay in seconds.
+ float mInitialAutoRepeatingDelay; ///< Stores the initial autorepeating delay in seconds.
+ float mNextAutoRepeatingDelay; ///< Stores the next autorepeating delay in seconds.
- float mAnimationTime;
+ float mAnimationTime;
- PressState mButtonPressedState; ///< In relation to the button being pressed/released
- State mButtonState;
- State mPreviousButtonState; ///< During a transition between two states, this stores the previous state so Visuals can be removed.
+ PressState mButtonPressedState; ///< In relation to the button being pressed/released
+ State mButtonState;
+ State mPreviousButtonState; ///< During a transition between two states, this stores the previous state so Visuals can be removed.
// Actions
- bool mClickActionPerforming; ///< Used to manage signal emissions during action
+ bool mClickActionPerforming; ///< Used to manage signal emissions during action
protected:
struct AccessibleImpl : public Control::Impl::AccessibleImpl
using Control::Impl::AccessibleImpl::AccessibleImpl;
Dali::Accessibility::States CalculateStates() override;
- std::string GetNameRaw() override;
- Property::Index GetNamePropertyIndex() override;
+ std::string GetNameRaw() override;
+ Property::Index GetNamePropertyIndex() override;
};
};
// Helpers for public-api forwarding methods
-inline Toolkit::Internal::Button& GetImplementation( Toolkit::Button& button )
+inline Toolkit::Internal::Button& GetImplementation(Toolkit::Button& button)
{
- DALI_ASSERT_ALWAYS( button );
+ DALI_ASSERT_ALWAYS(button);
Dali::RefObject& handle = button.GetImplementation();
- return static_cast<Toolkit::Internal::Button&>( handle );
+ return static_cast<Toolkit::Internal::Button&>(handle);
}
-inline const Toolkit::Internal::Button& GetImplementation( const Toolkit::Button& button )
+inline const Toolkit::Internal::Button& GetImplementation(const Toolkit::Button& button)
{
- DALI_ASSERT_ALWAYS( button );
+ DALI_ASSERT_ALWAYS(button);
const Dali::RefObject& handle = button.GetImplementation();
- return static_cast<const Toolkit::Internal::Button&>( handle );
+ return static_cast<const Toolkit::Internal::Button&>(handle);
}
} // namespace Toolkit
#define DALI_TOOLKIT_INTERNAL_CHECK_BOX_BUTTON_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/**
* CheckBoxButton implementation class.
*
class CheckBoxButton : public Button
{
public:
-
/**
* Create a new CheckBoxButton.
* @return A smart-pointer to the newly allocated CheckBoxButton.
static Dali::Toolkit::CheckBoxButton New();
private:
-
/**
* Construct a new CheckBoxButton.
*/
virtual ~CheckBoxButton();
private: // From Button
-
-
/**
* @copydoc Toolkit::Internal::Button::OnInitialize
*/
void OnInitialize() override;
private:
-
// Undefined
- CheckBoxButton( const CheckBoxButton& );
+ CheckBoxButton(const CheckBoxButton&);
// Undefined
- CheckBoxButton& operator=( const CheckBoxButton& );
+ CheckBoxButton& operator=(const CheckBoxButton&);
+
protected:
struct AccessibleImpl : public Button::AccessibleImpl
{
Dali::Accessibility::States CalculateStates() override;
};
- void OnStateChange( State newState ) override;
+ void OnStateChange(State newState) override;
};
} // namespace Internal
// Helpers for public-api forwarding methods
-inline Toolkit::Internal::CheckBoxButton& GetImplementation( Toolkit::CheckBoxButton& button )
+inline Toolkit::Internal::CheckBoxButton& GetImplementation(Toolkit::CheckBoxButton& button)
{
- DALI_ASSERT_ALWAYS( button );
+ DALI_ASSERT_ALWAYS(button);
Dali::RefObject& handle = button.GetImplementation();
- return static_cast<Toolkit::Internal::CheckBoxButton&>( handle );
+ return static_cast<Toolkit::Internal::CheckBoxButton&>(handle);
}
-inline const Toolkit::Internal::CheckBoxButton& GetImplementation( const Toolkit::CheckBoxButton& button )
+inline const Toolkit::Internal::CheckBoxButton& GetImplementation(const Toolkit::CheckBoxButton& button)
{
- DALI_ASSERT_ALWAYS( button );
+ DALI_ASSERT_ALWAYS(button);
const Dali::RefObject& handle = button.GetImplementation();
- return static_cast<const Toolkit::Internal::CheckBoxButton&>( handle );
+ return static_cast<const Toolkit::Internal::CheckBoxButton&>(handle);
}
} // namespace Toolkit
#define DALI_TOOLKIT_INTERNAL_PUSH_BUTTON_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/**
* PushButton implementation class.
*
class PushButton : public Button
{
public:
-
/**
* Create a new PushButton.
* @return A smart-pointer to the newly allocated PushButton.
static Dali::Toolkit::PushButton New();
protected:
-
/**
* Construct a new PushButton.
*/
virtual ~PushButton();
public:
-
// Properties
/**
* @param[in] index The property index.
* @param[in] value The new property value.
*/
- static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
+ static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value);
/**
* Called to retrieve a property of an object of this type.
* @param[in] index The property index.
* @return The current value of the property.
*/
- static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex );
+ static Property::Value GetProperty(BaseObject* object, Property::Index propertyIndex);
private: // From Button
-
/**
* @copydoc Toolkit::Internal::Button::OnInitialize
*/
void OnInitialize() override;
private:
-
/**
* @brief Sets the alignment mode to use to align the icon to the label.
*
* @param[in] iconAlignment The alignment mode to use
*/
- void SetIconAlignment( const PushButton::IconAlignment iconAlignment );
+ void SetIconAlignment(const PushButton::IconAlignment iconAlignment);
/**
* @brief Gets the alignment mode used to align the icon to the label.
const PushButton::IconAlignment GetIconAlignment() const;
private:
-
// Undefined
- PushButton( const PushButton& );
+ PushButton(const PushButton&);
// Undefined
- PushButton& operator=( const PushButton& );
+ PushButton& operator=(const PushButton&);
private:
-
- IconAlignment mIconAlignment; ///< The alignment of the icon against the label.
+ IconAlignment mIconAlignment; ///< The alignment of the icon against the label.
protected:
struct AccessibleImpl : public Button::AccessibleImpl
Dali::Accessibility::States CalculateStates() override;
};
- void OnStateChange( State newState ) override;
+ void OnStateChange(State newState) override;
};
} // namespace Internal
// Helpers for public-api forwarding methods
-inline Toolkit::Internal::PushButton& GetImplementation( Toolkit::PushButton& button )
+inline Toolkit::Internal::PushButton& GetImplementation(Toolkit::PushButton& button)
{
- DALI_ASSERT_ALWAYS( button );
+ DALI_ASSERT_ALWAYS(button);
Dali::RefObject& handle = button.GetImplementation();
- return static_cast<Toolkit::Internal::PushButton&>( handle );
+ return static_cast<Toolkit::Internal::PushButton&>(handle);
}
-inline const Toolkit::Internal::PushButton& GetImplementation( const Toolkit::PushButton& button )
+inline const Toolkit::Internal::PushButton& GetImplementation(const Toolkit::PushButton& button)
{
- DALI_ASSERT_ALWAYS( button );
+ DALI_ASSERT_ALWAYS(button);
const Dali::RefObject& handle = button.GetImplementation();
- return static_cast<const Toolkit::Internal::PushButton&>( handle );
+ return static_cast<const Toolkit::Internal::PushButton&>(handle);
}
} // namespace Toolkit
#define DALI_TOOLKIT_INTERNAL_RADIO_BUTTON_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/common/dali-vector.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/buttons/radio-button.h>
#include <dali-toolkit/devel-api/controls/table-view/table-view.h>
+#include <dali-toolkit/public-api/controls/buttons/radio-button.h>
#include "button-impl.h"
namespace Dali
{
namespace Internal
{
-
/**
* RadioButton implementation class.
*
* \sa Dali::Toolkit::RadioButton
*/
-class RadioButton: public Button
+class RadioButton : public Button
{
public:
-
/**
* Create a new RadioButton.
*
static Dali::Toolkit::RadioButton New();
private:
-
/**
* Construct a new RadioButton.
*/
virtual ~RadioButton();
private: // From Button
-
/**
* @copydoc Toolkit::Internal::Button::OnInitialize
*/
/**
* @copydoc Toolkit::Internal::Button::OnStateChange
*/
- void OnStateChange( State newState ) override;
+ void OnStateChange(State newState) override;
/**
* @copydoc Toolkit::Internal::Button::OnToggleReleased
bool OnToggleReleased() override;
private:
-
// Undefined
- RadioButton( const RadioButton& origin );
+ RadioButton(const RadioButton& origin);
// Undefined
- RadioButton& operator=( const RadioButton& origin );
+ RadioButton& operator=(const RadioButton& origin);
protected:
struct AccessibleImpl : public Button::AccessibleImpl
Dali::RefObject& handle = button.GetImplementation();
- return static_cast<Toolkit::Internal::RadioButton&> (handle);
+ return static_cast<Toolkit::Internal::RadioButton&>(handle);
}
inline const Toolkit::Internal::RadioButton& GetImplementation(const Toolkit::RadioButton& button)
const Dali::RefObject& handle = button.GetImplementation();
- return static_cast<const Toolkit::Internal::RadioButton&> (handle);
+ return static_cast<const Toolkit::Internal::RadioButton&>(handle);
}
} // namespace Toolkit
#define DALI_TOOLKIT_INTERNAL_TOGGLE_BUTTON_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// EXTERNAL INCLUDES
#include <dali/public-api/common/vector-wrapper.h>
-#include <dali/public-api/object/property-value.h>
#include <dali/public-api/object/property-array.h>
-
+#include <dali/public-api/object/property-value.h>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/controls/buttons/toggle-button.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/**
* ToggleButton implementation class.
*
class ToggleButton : public Button
{
public:
-
/**
* Create a new ToggleButton.
* @return A smart-pointer to the newly allocated ToggleButton.
static Dali::Toolkit::ToggleButton New();
protected:
-
/**
* Construct a new ToggleButton.
*/
virtual ~ToggleButton();
public:
-
/**
* Called when a property of an object of this type is set.
* @param[in] object The object whose property is set.
* @param[in] index The property index.
* @param[in] value The new property value.
*/
- static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
+ static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value);
/**
* Called to retrieve a property of an object of this type.
* @param[in] index The property index.
* @return The current value of the property.
*/
- static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex );
+ static Property::Value GetProperty(BaseObject* object, Property::Index propertyIndex);
private:
-
/**
* Called to create all toggle visuals and save them to mToggleVisuals.
* @param[in] states The array store toggle states.
* @param[out] visuals The created state visual vector.
*/
- void CreateVisualsForAllStates( const Property::Array& states, std::vector<Toolkit::Visual::Base>& visuals );
+ void CreateVisualsForAllStates(const Property::Array& states, std::vector<Toolkit::Visual::Base>& visuals);
/**
* Called to set toggle states when TOGGLE_STATES is set in SetProperty function.
* @param[in] states The array store toggle states.
*/
- void SetToggleStates( const Property::Array& states );
+ void SetToggleStates(const Property::Array& states);
/**
* Called to retrieve toggle states.
* Called to set toggle tooltips when TOGGLE_TIPS is set in SetProperty function.
* @param[in] tips The array store toggle tips.
*/
- void SetToggleTooltips( std::vector<std::string>& tips );
+ void SetToggleTooltips(std::vector<std::string>& tips);
/**
* Called to retrieve toggle tips.
* @param[in] index The index of visual to relayout.
* @param[in] size The size of control.
*/
- void RelayoutVisual( Property::Index index, const Vector2& size );
+ void RelayoutVisual(Property::Index index, const Vector2& size);
private: // From Button
-
/**
* @copydoc Toolkit::Internal::Button::OnInitialize
*/
/**
* @copydoc Toolkit::Internal::Button::OnRelayout
*/
- void OnRelayout( const Vector2& size, RelayoutContainer& container ) override;
+ void OnRelayout(const Vector2& size, RelayoutContainer& container) override;
/**
* This method is called when the button is pressed.
void OnPressed() override;
private:
-
// Undefined
- ToggleButton( const ToggleButton& );
+ ToggleButton(const ToggleButton&);
// Undefined
- ToggleButton& operator=( const ToggleButton& );
+ ToggleButton& operator=(const ToggleButton&);
private:
-
- Property::Array mToggleStates; ///< Toggle states, string or map.
- std::vector<Toolkit::Visual::Base> mToggleVisuals; ///< Save all unselected visuals.
- std::vector<Toolkit::Visual::Base> mToggleSelectedVisuals; ///< Save all selected visuals.
- std::vector<Toolkit::Visual::Base> mToggleDisabledVisuals; ///< Save all disabled unselected visuals.
- std::vector<Toolkit::Visual::Base> mToggleDisabledSelectedVisuals; ///< Save all disabled selected visuals.
- std::vector<std::string> mToggleTooltips; ///< Toggle tooltips.
- unsigned int mCurrentToggleIndex; ///< The index of state.
+ Property::Array mToggleStates; ///< Toggle states, string or map.
+ std::vector<Toolkit::Visual::Base> mToggleVisuals; ///< Save all unselected visuals.
+ std::vector<Toolkit::Visual::Base> mToggleSelectedVisuals; ///< Save all selected visuals.
+ std::vector<Toolkit::Visual::Base> mToggleDisabledVisuals; ///< Save all disabled unselected visuals.
+ std::vector<Toolkit::Visual::Base> mToggleDisabledSelectedVisuals; ///< Save all disabled selected visuals.
+ std::vector<std::string> mToggleTooltips; ///< Toggle tooltips.
+ unsigned int mCurrentToggleIndex; ///< The index of state.
protected:
struct AccessibleImpl : public Button::AccessibleImpl
{
using Button::AccessibleImpl::AccessibleImpl;
Dali::Accessibility::States CalculateStates() override;
- std::string GetDescriptionRaw() override;
- Property::Index GetDescriptionPropertyIndex() override;
+ std::string GetDescriptionRaw() override;
+ Property::Index GetDescriptionPropertyIndex() override;
};
- void OnStateChange( State newState ) override;
+ void OnStateChange(State newState) override;
};
} // namespace Internal
// Helpers for public-api forwarding methods
-inline Toolkit::Internal::ToggleButton& GetImplementation( Toolkit::ToggleButton& button )
+inline Toolkit::Internal::ToggleButton& GetImplementation(Toolkit::ToggleButton& button)
{
- DALI_ASSERT_ALWAYS( button );
+ DALI_ASSERT_ALWAYS(button);
Dali::RefObject& handle = button.GetImplementation();
- return static_cast<Toolkit::Internal::ToggleButton&>( handle );
+ return static_cast<Toolkit::Internal::ToggleButton&>(handle);
}
-inline const Toolkit::Internal::ToggleButton& GetImplementation( const Toolkit::ToggleButton& button )
+inline const Toolkit::Internal::ToggleButton& GetImplementation(const Toolkit::ToggleButton& button)
{
- DALI_ASSERT_ALWAYS( button );
+ DALI_ASSERT_ALWAYS(button);
const Dali::RefObject& handle = button.GetImplementation();
- return static_cast<const Toolkit::Internal::ToggleButton&>( handle );
+ return static_cast<const Toolkit::Internal::ToggleButton&>(handle);
}
} // namespace Toolkit
#define DALI_TOOLKIT_CONTROL_DATA_IMPL_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/object/type-registry.h>
-#include <dali/public-api/object/property-notification.h>
#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali/devel-api/adaptor-framework/accessibility.h>
+#include <dali/public-api/object/property-notification.h>
+#include <dali/public-api/object/type-registry.h>
#include <string>
// INTERNAL INCLUDES
-#include <dali-toolkit/internal/visuals/visual-event-observer.h>
-#include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali/devel-api/common/owner-container.h>
#include <dali-toolkit/devel-api/visual-factory/visual-base.h>
#include <dali-toolkit/internal/builder/dictionary.h>
#include <dali-toolkit/internal/builder/style.h>
#include <dali-toolkit/internal/controls/tooltip/tooltip.h>
+#include <dali-toolkit/internal/visuals/visual-event-observer.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/visuals/visual-properties.h>
#include <dali/devel-api/common/owner-container.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
- /**
+/**
* Struct used to store Visual within the control, index is a unique key for each visual.
*/
struct RegisteredVisual
{
- Property::Index index;
+ Property::Index index;
Toolkit::Visual::Base visual;
- bool enabled : 1;
- bool pending : 1;
-
- RegisteredVisual( Property::Index aIndex, Toolkit::Visual::Base &aVisual, bool aEnabled, bool aPendingReplacement )
- : index(aIndex), visual(aVisual), enabled(aEnabled), pending( aPendingReplacement )
+ bool enabled : 1;
+ bool pending : 1;
+
+ RegisteredVisual(Property::Index aIndex, Toolkit::Visual::Base& aVisual, bool aEnabled, bool aPendingReplacement)
+ : index(aIndex),
+ visual(aVisual),
+ enabled(aEnabled),
+ pending(aPendingReplacement)
{
}
};
-typedef Dali::OwnerContainer< RegisteredVisual* > RegisteredVisualContainer;
-
+typedef Dali::OwnerContainer<RegisteredVisual*> RegisteredVisualContainer;
/**
* @brief Holds the Implementation for the internal control class
*/
class Control::Impl : public ConnectionTracker, public Visual::EventObserver
{
-
public:
-
/**
* @brief Retrieves the implementation of the internal control class.
* @param[in] internalControl A ref to the control whose internal implementation is required
* @return The internal implementation
*/
- static Control::Impl& Get( Internal::Control& internalControl );
+ static Control::Impl& Get(Internal::Control& internalControl);
/**
* @copydoc Get( Internal::Control& )
*/
- static const Control::Impl& Get( const Internal::Control& internalControl );
+ static const Control::Impl& Get(const Internal::Control& internalControl);
/**
* @brief Constructor.
* @param[in] controlImpl The control which owns this implementation
*/
- Impl( Control& controlImpl );
+ Impl(Control& controlImpl);
/**
* @brief Destructor.
* @param[in] object The visual whose resources are ready
* @note Overriding method in Visual::EventObserver.
*/
- void ResourceReady( Visual::Base& object ) override;
+ void ResourceReady(Visual::Base& object) override;
/**
* @brief Called when an event occurs.
* @param[in] signalId The signal to emit. See Visual to find supported signals
* @note Overriding method in Visual::EventObserver.
*/
- void NotifyVisualEvent( Visual::Base& object, Property::Index signalId ) override;
+ void NotifyVisualEvent(Visual::Base& object, Property::Index signalId) override;
/**
* @copydoc Dali::Toolkit::DevelControl::RegisterVisual()
*/
- void RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual );
+ void RegisterVisual(Property::Index index, Toolkit::Visual::Base& visual);
/**
* @copydoc Dali::Toolkit::DevelControl::RegisterVisual()
*/
- void RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, int depthIndex );
+ void RegisterVisual(Property::Index index, Toolkit::Visual::Base& visual, int depthIndex);
/**
* @copydoc Dali::Toolkit::DevelControl::RegisterVisual()
*/
- void RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled );
+ void RegisterVisual(Property::Index index, Toolkit::Visual::Base& visual, bool enabled);
/**
* @copydoc Dali::Toolkit::DevelControl::RegisterVisual()
*/
- void RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled, int depthIndex );
+ void RegisterVisual(Property::Index index, Toolkit::Visual::Base& visual, bool enabled, int depthIndex);
/**
* @copydoc Dali::Toolkit::DevelControl::UnregisterVisual()
*/
- void UnregisterVisual( Property::Index index );
+ void UnregisterVisual(Property::Index index);
/**
* @copydoc Dali::Toolkit::DevelControl::GetVisual()
*/
- Toolkit::Visual::Base GetVisual( Property::Index index ) const;
+ Toolkit::Visual::Base GetVisual(Property::Index index) const;
/**
* @copydoc Dali::Toolkit::DevelControl::EnableVisual()
*/
- void EnableVisual( Property::Index index, bool enable );
+ void EnableVisual(Property::Index index, bool enable);
/**
* @copydoc Dali::Toolkit::DevelControl::IsVisualEnabled()
*/
- bool IsVisualEnabled( Property::Index index ) const;
+ bool IsVisualEnabled(Property::Index index) const;
/**
* @brief Stops observing the given visual.
* @param[in] visual The visual to stop observing
*/
- void StopObservingVisual( Toolkit::Visual::Base& visual );
+ void StopObservingVisual(Toolkit::Visual::Base& visual);
/**
* @brief Starts observing the given visual.
* @param[in] visual The visual to start observing
*/
- void StartObservingVisual( Toolkit::Visual::Base& visual);
+ void StartObservingVisual(Toolkit::Visual::Base& visual);
/**
* @copydoc Dali::Toolkit::DevelControl::GetVisualResourceStatus()
*/
- Toolkit::Visual::ResourceStatus GetVisualResourceStatus( Property::Index index ) const;
+ Toolkit::Visual::ResourceStatus GetVisualResourceStatus(Property::Index index) const;
/**
* @param[in,out] animation Handle to existing animation, or an empty handle that
* @param[in] transitionData The transition data describing the animation
* @param[in] createAnimation True if the animation should be created
*/
- void AddTransitions( Dali::Animation& animation,
- const Toolkit::TransitionData& transitionData,
- bool createAnimation = false );
+ void AddTransitions(Dali::Animation& animation,
+ const Toolkit::TransitionData& transitionData,
+ bool createAnimation = false);
/**
* @copydoc Dali::Toolkit::DevelControl::CreateTransition()
*/
- Dali::Animation CreateTransition( const Toolkit::TransitionData& transitionData );
+ Dali::Animation CreateTransition(const Toolkit::TransitionData& transitionData);
/**
* @copydoc Dali::Toolkit::DevelControl::DoAction()
*/
- void DoAction( Dali::Property::Index visualIndex, Dali::Property::Index actionId, const Dali::Property::Value attributes );
+ void DoAction(Dali::Property::Index visualIndex, Dali::Property::Index actionId, const Dali::Property::Value attributes);
/**
* @brief Function used to set control properties.
* @param[in] index The index of the property to set
* @param[in] value The value of the property to set
*/
- static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
+ static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value);
/**
* @brief Function used to retrieve the value of control properties.
* @param[in] index The index of the property to get
* @return The value of the property
*/
- static Property::Value GetProperty( BaseObject* object, Property::Index index );
+ static Property::Value GetProperty(BaseObject* object, Property::Index index);
/**
* @brief Sets the state of the control.
* @param[in] newState The state to set
* @param[in] withTransitions Whether to show a transition when changing to the new state
*/
- void SetState( DevelControl::State newState, bool withTransitions=true );
+ void SetState(DevelControl::State newState, bool withTransitions = true);
/**
* @brief Sets the sub-state of the control.
* @param[in] newState The sub-state to set
* @param[in] withTransitions Whether to show a transition when changing to the new sub-state
*/
- void SetSubState( const std::string& subStateName, bool withTransitions=true );
+ void SetSubState(const std::string& subStateName, bool withTransitions = true);
/**
* @brief Replaces visuals and properties from the old state to the new state.
* @param[in] newState The new state
* @param[in] subState The current sub state
*/
- void ReplaceStateVisualsAndProperties( const StylePtr oldState, const StylePtr newState, const std::string& subState );
+ void ReplaceStateVisualsAndProperties(const StylePtr oldState, const StylePtr newState, const std::string& subState);
/**
* @brief Removes a visual from the control's container.
* @param[in] visuals The container of visuals
* @param[in] visualName The name of the visual to remove
*/
- void RemoveVisual( RegisteredVisualContainer& visuals, const std::string& visualName );
+ void RemoveVisual(RegisteredVisualContainer& visuals, const std::string& visualName);
/**
* @brief Removes several visuals from the control's container.
* @param[in] visuals The container of visuals
* @param[in] removeVisuals The visuals to remove
*/
- void RemoveVisuals( RegisteredVisualContainer& visuals, DictionaryKeys& removeVisuals );
+ void RemoveVisuals(RegisteredVisualContainer& visuals, DictionaryKeys& removeVisuals);
/**
* @brief Copies the visual properties that are specific to the control instance into the instancedProperties container.
* @param[in] visuals The control's visual container
* @param[out] instancedProperties The instanced properties are added to this container
*/
- void CopyInstancedProperties( RegisteredVisualContainer& visuals, Dictionary<Property::Map>& instancedProperties );
+ void CopyInstancedProperties(RegisteredVisualContainer& visuals, Dictionary<Property::Map>& instancedProperties);
/**
* @brief On state change, ensures visuals are moved or created appropriately.
* @param[in] stateVisualsToChange The visuals to change
* @param[in] instancedProperties The instanced properties @see CopyInstancedProperties
*/
- void RecreateChangedVisuals( Dictionary<Property::Map>& stateVisualsToChange, Dictionary<Property::Map>& instancedProperties );
+ void RecreateChangedVisuals(Dictionary<Property::Map>& stateVisualsToChange, Dictionary<Property::Map>& instancedProperties);
/**
* @brief Whether the resource is ready
* @brief Sets the margin.
* @param[in] margin Margin is a collections of extent ( start, end, top, bottom )
*/
- void SetMargin( Extents margin );
+ void SetMargin(Extents margin);
/**
* @brief Returns the value of margin
* @brief Sets the padding.
* @param[in] padding Padding is a collections of extent ( start, end, top, bottom ).
*/
- void SetPadding( Extents padding );
+ void SetPadding(Extents padding);
/**
* @brief Returns the value of padding
* @brief Set the input method context.
* @param[in] inputMethodContext The input method context.
*/
- void SetInputMethodContext( InputMethodContext& inputMethodContext );
+ void SetInputMethodContext(InputMethodContext& inputMethodContext);
/**
* @brief Filter an key event.
* @param[in] event The key to be filtered.
* @return True if the key handled, otherwise false.
*/
- bool FilterKeyEvent( const KeyEvent& event );
+ bool FilterKeyEvent(const KeyEvent& event);
/**
* @brief Adds accessibility attribute
* Attribute is added if not existed previously or updated
* if existed.
*/
- void AppendAccessibilityAttribute( const std::string& key,
- const std::string value );
+ void AppendAccessibilityAttribute(const std::string& key,
+ const std::string value);
/**
* @brief Removes accessibility attribute
*
* Function does nothing if attribute doesn't exist.
*/
- void RemoveAccessibilityAttribute( const std::string& key );
+ void RemoveAccessibilityAttribute(const std::string& key);
/**
* @brief Removes all accessibility attributes
* This function sets, which part of object will be read out
* by screen-reader.
*/
- void SetAccessibilityReadingInfoType( const Dali::Accessibility::ReadingInfoTypes types );
+ void SetAccessibilityReadingInfoType(const Dali::Accessibility::ReadingInfoTypes types);
/**
* @brief Gets currently active reading info type attributes
Dali::Property GetVisualProperty(Dali::Property::Index index, Dali::Property::Key visualPropertyKey);
private:
-
/**
* Used as an alternative to boolean so that it is obvious whether a visual is enabled/disabled.
*/
enum Type
{
DISABLED = 0, ///< Visual disabled.
- ENABLED = 1 ///< Visual enabled.
+ ENABLED = 1 ///< Visual enabled.
};
};
enum Type
{
NOT_SET = 0, ///< Visual depth value not set by caller.
- SET = 1 ///< Visual depth value set by caller.
+ SET = 1 ///< Visual depth value set by caller.
};
};
* @note Registering a visual with an index that already has a registered visual will replace it. The replacement will
* occur once the replacement visual is ready (loaded).
*/
- void RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, VisualState::Type enabled, DepthIndexValue::Type depthIndexValueSet, int depthIndex = 0 );
+ void RegisterVisual(Property::Index index, Toolkit::Visual::Base& visual, VisualState::Type enabled, DepthIndexValue::Type depthIndexValueSet, int depthIndex = 0);
/**
* @brief Emits the resource ready signal.
void OnIdleCallback();
public:
-
- Control& mControlImpl;
+ Control& mControlImpl;
DevelControl::State mState;
- std::string mSubStateName;
- Property::Map mAccessibilityAttributes;
-
- int mLeftFocusableActorId; ///< Actor ID of Left focusable control.
- int mRightFocusableActorId; ///< Actor ID of Right focusable control.
- int mUpFocusableActorId; ///< Actor ID of Up focusable control.
- int mDownFocusableActorId; ///< Actor ID of Down focusable control.
-
- RegisteredVisualContainer mVisuals; ///< Stores visuals needed by the control, non trivial type so std::vector used.
- std::string mStyleName;
- Vector4 mBackgroundColor; ///< The color of the background visual
- Vector3* mStartingPinchScale; ///< The scale when a pinch gesture starts, TODO: consider removing this
- Extents mMargin; ///< The margin values
- Extents mPadding; ///< The padding values
- Toolkit::Control::KeyEventSignalType mKeyEventSignal;
- Toolkit::Control::KeyInputFocusSignalType mKeyInputFocusGainedSignal;
- Toolkit::Control::KeyInputFocusSignalType mKeyInputFocusLostSignal;
- Toolkit::Control::ResourceReadySignalType mResourceReadySignal;
- DevelControl::VisualEventSignalType mVisualEventSignal;
- Toolkit::DevelControl::AccessibilityActivateSignalType mAccessibilityActivateSignal;
- Toolkit::DevelControl::AccessibilityReadingSkippedSignalType mAccessibilityReadingSkippedSignal;
- Toolkit::DevelControl::AccessibilityReadingPausedSignalType mAccessibilityReadingPausedSignal;
- Toolkit::DevelControl::AccessibilityReadingResumedSignalType mAccessibilityReadingResumedSignal;
+ std::string mSubStateName;
+ Property::Map mAccessibilityAttributes;
+
+ int mLeftFocusableActorId; ///< Actor ID of Left focusable control.
+ int mRightFocusableActorId; ///< Actor ID of Right focusable control.
+ int mUpFocusableActorId; ///< Actor ID of Up focusable control.
+ int mDownFocusableActorId; ///< Actor ID of Down focusable control.
+
+ RegisteredVisualContainer mVisuals; ///< Stores visuals needed by the control, non trivial type so std::vector used.
+ std::string mStyleName;
+ Vector4 mBackgroundColor; ///< The color of the background visual
+ Vector3* mStartingPinchScale; ///< The scale when a pinch gesture starts, TODO: consider removing this
+ Extents mMargin; ///< The margin values
+ Extents mPadding; ///< The padding values
+ Toolkit::Control::KeyEventSignalType mKeyEventSignal;
+ Toolkit::Control::KeyInputFocusSignalType mKeyInputFocusGainedSignal;
+ Toolkit::Control::KeyInputFocusSignalType mKeyInputFocusLostSignal;
+ Toolkit::Control::ResourceReadySignalType mResourceReadySignal;
+ DevelControl::VisualEventSignalType mVisualEventSignal;
+ Toolkit::DevelControl::AccessibilityActivateSignalType mAccessibilityActivateSignal;
+ Toolkit::DevelControl::AccessibilityReadingSkippedSignalType mAccessibilityReadingSkippedSignal;
+ Toolkit::DevelControl::AccessibilityReadingPausedSignalType mAccessibilityReadingPausedSignal;
+ Toolkit::DevelControl::AccessibilityReadingResumedSignalType mAccessibilityReadingResumedSignal;
Toolkit::DevelControl::AccessibilityReadingCancelledSignalType mAccessibilityReadingCancelledSignal;
- Toolkit::DevelControl::AccessibilityReadingStoppedSignalType mAccessibilityReadingStoppedSignal;
+ Toolkit::DevelControl::AccessibilityReadingStoppedSignalType mAccessibilityReadingStoppedSignal;
- Toolkit::DevelControl::AccessibilityGetNameSignalType mAccessibilityGetNameSignal;
+ Toolkit::DevelControl::AccessibilityGetNameSignalType mAccessibilityGetNameSignal;
Toolkit::DevelControl::AccessibilityGetDescriptionSignalType mAccessibilityGetDescriptionSignal;
- Toolkit::DevelControl::AccessibilityDoGestureSignalType mAccessibilityDoGestureSignal;
+ Toolkit::DevelControl::AccessibilityDoGestureSignalType mAccessibilityDoGestureSignal;
std::string mAccessibilityName;
- bool mAccessibilityNameSet = false;
+ bool mAccessibilityNameSet = false;
std::string mAccessibilityDescription;
- bool mAccessibilityDescriptionSet = false;
+ bool mAccessibilityDescriptionSet = false;
std::string mAccessibilityTranslationDomain;
- bool mAccessibilityTranslationDomainSet = false;
+ bool mAccessibilityTranslationDomainSet = false;
- bool mAccessibilityHighlightable = false;
+ bool mAccessibilityHighlightable = false;
bool mAccessibilityHighlightableSet = false;
Dali::Accessibility::Role mAccessibilityRole = Dali::Accessibility::Role::UNKNOWN;
std::vector<std::vector<Accessibility::Address>> mAccessibilityRelations;
- bool mAccessibilityAnimated = false;
+ bool mAccessibilityAnimated = false;
// Gesture Detection
- PinchGestureDetector mPinchGestureDetector;
- PanGestureDetector mPanGestureDetector;
- TapGestureDetector mTapGestureDetector;
+ PinchGestureDetector mPinchGestureDetector;
+ PanGestureDetector mPanGestureDetector;
+ TapGestureDetector mTapGestureDetector;
LongPressGestureDetector mLongPressGestureDetector;
// Tooltip
TooltipPtr mTooltip;
InputMethodContext mInputMethodContext;
- CallbackBase* mIdleCallback; ///< The idle callback to emit the resource ready signal.
+ CallbackBase* mIdleCallback; ///< The idle callback to emit the resource ready signal.
- ControlBehaviour mFlags : CONTROL_BEHAVIOUR_FLAG_COUNT; ///< Flags passed in from constructor.
- bool mIsKeyboardNavigationSupported :1; ///< Stores whether keyboard navigation is supported by the control.
- bool mIsKeyboardFocusGroup :1; ///< Stores whether the control is a focus group.
- bool mIsEmittingResourceReadySignal :1; ///< True during ResourceReady().
- bool mNeedToEmitResourceReady :1; ///< True if need to emit the resource ready signal again.
-
- RegisteredVisualContainer mRemoveVisuals; ///< List of visuals that are being replaced by another visual once ready
+ ControlBehaviour mFlags : CONTROL_BEHAVIOUR_FLAG_COUNT; ///< Flags passed in from constructor.
+ bool mIsKeyboardNavigationSupported : 1; ///< Stores whether keyboard navigation is supported by the control.
+ bool mIsKeyboardFocusGroup : 1; ///< Stores whether the control is a focus group.
+ bool mIsEmittingResourceReadySignal : 1; ///< True during ResourceReady().
+ bool mNeedToEmitResourceReady : 1; ///< True if need to emit the resource ready signal again.
+ RegisteredVisualContainer mRemoveVisuals; ///< List of visuals that are being replaced by another visual once ready
// Properties - these need to be members of Internal::Control::Impl as they access private methods/data of Internal::Control and Internal::Control::Impl.
static const PropertyRegistration PROPERTY_1;
* @param actor Actor object
* @return handle to Accessible object
*/
- static Dali::Accessibility::Accessible *GetAccessibilityObject(Dali::Actor actor);
- Dali::Accessibility::Accessible *GetAccessibilityObject();
+ static Dali::Accessibility::Accessible* GetAccessibilityObject(Dali::Actor actor);
+ Dali::Accessibility::Accessible* GetAccessibilityObject();
void AccessibilityRegister();
void AccessibilityDeregister();
public virtual Dali::Accessibility::Action
{
Dali::Actor self;
- bool modal = false, root = false;
+ bool modal = false, root = false;
AccessibleImpl(Dali::Actor self, Dali::Accessibility::Role role, bool modal = false);
- std::string GetName() override;
- virtual std::string GetNameRaw();
- std::string GetDescription() override;
- virtual std::string GetDescriptionRaw();
- Dali::Accessibility::Accessible* GetParent() override;
- size_t GetChildCount() override;
- Dali::Accessibility::Accessible* GetChildAtIndex( size_t index ) override;
- size_t GetIndexInParent() override;
- Dali::Accessibility::Role GetRole() override;
- Dali::Accessibility::States GetStates() override;
- Dali::Accessibility::Attributes GetAttributes() override;
- Dali::Rect<> GetExtents( Dali::Accessibility::CoordType ctype ) override;
+ std::string GetName() override;
+ virtual std::string GetNameRaw();
+ std::string GetDescription() override;
+ virtual std::string GetDescriptionRaw();
+ Dali::Accessibility::Accessible* GetParent() override;
+ size_t GetChildCount() override;
+ Dali::Accessibility::Accessible* GetChildAtIndex(size_t index) override;
+ size_t GetIndexInParent() override;
+ Dali::Accessibility::Role GetRole() override;
+ Dali::Accessibility::States GetStates() override;
+ Dali::Accessibility::Attributes GetAttributes() override;
+ Dali::Rect<> GetExtents(Dali::Accessibility::CoordType ctype) override;
Dali::Accessibility::ComponentLayer GetLayer() override;
- int16_t GetMdiZOrder() override;
- bool GrabFocus() override;
- double GetAlpha() override;
- bool GrabHighlight() override;
- bool ClearHighlight() override;
-
- std::string GetActionName( size_t index ) override;
- std::string GetLocalizedActionName( size_t index ) override;
- std::string GetActionDescription( size_t index ) override;
- size_t GetActionCount() override;
- std::string GetActionKeyBinding(size_t index) override;
- bool DoAction(size_t index) override;
- bool DoAction(const std::string& name) override;
- bool DoGesture(const Dali::Accessibility::GestureInfo &gestureInfo) override;
+ int16_t GetMdiZOrder() override;
+ bool GrabFocus() override;
+ double GetAlpha() override;
+ bool GrabHighlight() override;
+ bool ClearHighlight() override;
+
+ std::string GetActionName(size_t index) override;
+ std::string GetLocalizedActionName(size_t index) override;
+ std::string GetActionDescription(size_t index) override;
+ size_t GetActionCount() override;
+ std::string GetActionKeyBinding(size_t index) override;
+ bool DoAction(size_t index) override;
+ bool DoAction(const std::string& name) override;
+ bool DoGesture(const Dali::Accessibility::GestureInfo& gestureInfo) override;
std::vector<Dali::Accessibility::Relation> GetRelationSet() override;
virtual Dali::Accessibility::States CalculateStates();
- virtual void EnsureChildVisible(Actor child);
- virtual void EnsureSelfVisible();
- virtual Property::Index GetNamePropertyIndex();
- virtual Property::Index GetDescriptionPropertyIndex();
+ virtual void EnsureChildVisible(Actor child);
+ virtual void EnsureSelfVisible();
+ virtual Property::Index GetNamePropertyIndex();
+ virtual Property::Index GetDescriptionPropertyIndex();
};
- std::function< std::unique_ptr< Dali::Accessibility::Accessible >( Actor ) > accessibilityConstructor;
- std::unique_ptr< Dali::Accessibility::Accessible > accessibilityObject;
- Dali::PropertyNotification accessibilityNotificationPosition, accessibilityNotificationSize, accessibilityNotificationCulled;
- bool accessibilityNotificationSet = false;
- static void PositionOrSizeChangedCallback( PropertyNotification& );
- static void CulledChangedCallback( PropertyNotification& );
+ std::function<std::unique_ptr<Dali::Accessibility::Accessible>(Actor)> accessibilityConstructor;
+ std::unique_ptr<Dali::Accessibility::Accessible> accessibilityObject;
+ Dali::PropertyNotification accessibilityNotificationPosition, accessibilityNotificationSize, accessibilityNotificationCulled;
+ bool accessibilityNotificationSet = false;
+ static void PositionOrSizeChangedCallback(PropertyNotification&);
+ static void CulledChangedCallback(PropertyNotification&);
};
-
} // namespace Internal
} // namespace Toolkit
#ifndef DALI_TOOLKIT_INTERNAL_CONTROL_DEBUG_H
#define DALI_TOOLKIT_INTERNAL_CONTROL_DEBUG_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#if defined(DEBUG_ENABLED)
-#include <dali/public-api/object/handle.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali/public-api/object/handle.h>
#include <iostream>
#include <string>
{
namespace Internal
{
-
/**
* Convert properties of handle into JSON output, separated into 'normal' and 'child' properties.
* @param[in] ouputStream the output stream to write to
* @param[in] handle The handle of the object from which to retrieve properties
* @return The output stream
*/
-std::ostream& DumpProperties( std::ostream& outputStream, Handle handle );
+std::ostream& DumpProperties(std::ostream& outputStream, Handle handle);
/**
* Dumps control internals, visuals and properties to a string in JSON format
*/
-std::string DumpControl( const Internal::Control& control );
+std::string DumpControl(const Internal::Control& control);
/**
* Dumps actor internals and properties to a string in JSON format
*/
-std::string DumpActor( Actor actor );
+std::string DumpActor(Actor actor);
/**
* Dumps actor hierarchy from a given root, but expands Control output to encompass Control internals.
* @param[in] ouputStream the output stream to write to
* @param[in] root The root actor
*/
-void DumpControlHierarchy( std::ostream& outputStream, Actor rootActor );
+void DumpControlHierarchy(std::ostream& outputStream, Actor rootActor);
} // namespace Internal
#define DALI_TOOLKIT_INTERNAL_CONTROL_RENDERERS_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
-#include <dali/dali.h>
#include <dali-toolkit/internal/graphics/builtin-shader-extern-gen.h>
+#include <dali/dali.h>
namespace Dali
{
{
namespace Internal
{
-
#define BASIC_VERTEX_SOURCE SHADER_CONTROL_RENDERERS_VERT
#define BASIC_FRAGMENT_SOURCE SHADER_CONTROL_RENDERERS_FRAG
* @param[in] fragmentSrc The custom fragment shader.
* @return A newly created renderer.
*/
-Dali::Renderer CreateRenderer( std::string_view vertexSrc, std::string_view fragmentSrc );
+Dali::Renderer CreateRenderer(std::string_view vertexSrc, std::string_view fragmentSrc);
/**
* Helper method for rendering an image with custom shader.
* @param[in] gridSize The number of grid sub-divisions required.
* @return A newly created renderer.
*/
-Dali::Renderer CreateRenderer( std::string_view vertexSrc, std::string_view fragmentSrc, Dali::Shader::Hint::Value hints, Dali::Uint16Pair gridSize );
+Dali::Renderer CreateRenderer(std::string_view vertexSrc, std::string_view fragmentSrc, Dali::Shader::Hint::Value hints, Dali::Uint16Pair gridSize);
/**
* Helper method for setting the first texture passed to a renderer.
* @param[in] renderer The renderer using the texture.
* @param[in] texture The texture to set.
*/
-void SetRendererTexture( Dali::Renderer renderer, Dali::Texture texture );
+void SetRendererTexture(Dali::Renderer renderer, Dali::Texture texture);
/**
* Helper method for setting the first texture passed to a renderer.
* @param[in] renderer The renderer using the texture.
* @param[in] framebuffer A frame buffer color texture attached.
*/
-void SetRendererTexture( Dali::Renderer renderer, Dali::FrameBuffer frameBuffer );
+void SetRendererTexture(Dali::Renderer renderer, Dali::FrameBuffer frameBuffer);
} // namespace Internal
} // namespace Toolkit
#define DALI_TOOLKIT_INTERNAL_EFFECTS_VIEW_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class GaussianBlurView;
class ImageFilter;
virtual ~EffectsView();
public:
-
/// @copydoc Dali::Toolkit::EffectsView::SetType
- void SetType( Toolkit::EffectsView::EffectType type );
+ void SetType(Toolkit::EffectsView::EffectType type);
/// @copydoc Dali::Toolkit::EffectsView::GetType
Toolkit::EffectsView::EffectType GetType() const;
void Refresh();
/// @copydoc Dali::Toolkit::EffectsView::SetRefreshOnDemand
- void SetRefreshOnDemand( bool onDemand );
+ void SetRefreshOnDemand(bool onDemand);
/// @copydoc Dali::Toolkit::EffectsView::SetPixelFormat
- void SetPixelFormat( Pixel::Format pixelFormat );
+ void SetPixelFormat(Pixel::Format pixelFormat);
/// @copydoc Dali::Toolkit::EffectsView::SetBackgroundColor(const Vector4&)
- void SetBackgroundColor( const Vector4& color );
+ void SetBackgroundColor(const Vector4& color);
/// @copydoc Dali::Toolkit::GaussianBlurView::GetBackgroundColor
Vector4 GetBackgroundColor() const;
* Set the effect size which decides the size of filter kernel.
* @param[in] effectSize The effect size.
*/
- void SetEffectSize( int effectSize );
+ void SetEffectSize(int effectSize);
/**
* Get the effect size.
* @param[in] index The property index.
* @param[in] value The new property value.
*/
- static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
-
+ static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value);
/**
* Called to retrieve a property of an object of this type.
* @param[in] index The property index.
* @return The current value of the property.
*/
- static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex );
+ static Property::Value GetProperty(BaseObject* object, Property::Index propertyIndex);
private: // From Control
-
/**
* @copydoc Toolkit::Internal::Control::OnInitialize()
*/
/**
* @copydoc CustomActorImpl::OnSizeSet( const Vector3& targetSize )
*/
- void OnSizeSet( const Vector3& targetSize ) override;
+ void OnSizeSet(const Vector3& targetSize) override;
/**
* @copydoc Toolkit::Internal::Control::OnSceneConnection
*/
- void OnSceneConnection( int depth ) override;
+ void OnSceneConnection(int depth) override;
/**
* @copydoc Toolkit::Internal::Control::OnSceneDisconnection
/**
* @copydoc Toolkit::Internal::Control::OnChildAdd
*/
- void OnChildAdd( Actor& child ) override;
+ void OnChildAdd(Actor& child) override;
/**
* @copydoc Toolkit::Internal::Control::OnChildRemove
*/
- void OnChildRemove( Actor& child ) override;
+ void OnChildRemove(Actor& child) override;
private:
-
/**
* Enable the effect when the control is set on stage
*/
void RemoveFilters();
private:
-
// Undefined
- EffectsView( const EffectsView& );
+ EffectsView(const EffectsView&);
// Undefined
- EffectsView& operator = ( const EffectsView& );
+ EffectsView& operator=(const EffectsView&);
private: // attributes/properties
-
/////////////////////////////////////////////////////////////
// for rendering all user added children to offscreen target
- FrameBuffer mFrameBufferForChildren;
- Renderer mRendererForChildren;
- RenderTask mRenderTaskForChildren;
- CameraActor mCameraForChildren;
- Actor mChildrenRoot; // for creating a subtree for all user added child actors
+ FrameBuffer mFrameBufferForChildren;
+ Renderer mRendererForChildren;
+ RenderTask mRenderTaskForChildren;
+ CameraActor mCameraForChildren;
+ Actor mChildrenRoot; // for creating a subtree for all user added child actors
/////////////////////////////////////////////////////////////
// background fill color
Vector2 mLastSize;
/////////////////////////////////////////////////////////////
// post blur image
- FrameBuffer mFrameBufferPostFilter;
- Renderer mRendererPostFilter;
+ FrameBuffer mFrameBufferPostFilter;
+ Renderer mRendererPostFilter;
Vector<ImageFilter*> mFilters;
/////////////////////////////////////////////////////////////
Toolkit::EffectsView::EffectType mEffectType;
- Pixel::Format mPixelFormat; ///< pixel format used by render targets
+ Pixel::Format mPixelFormat; ///< pixel format used by render targets
- bool mEnabled:1;
- bool mRefreshOnDemand:1;
+ bool mEnabled : 1;
+ bool mRefreshOnDemand : 1;
}; // class EffectsView
} // namespace Internal
-
// Helpers for public-api forwarding methods
-inline Toolkit::Internal::EffectsView& GetImpl( Toolkit::EffectsView& effectsView )
+inline Toolkit::Internal::EffectsView& GetImpl(Toolkit::EffectsView& effectsView)
{
- DALI_ASSERT_ALWAYS( effectsView );
+ DALI_ASSERT_ALWAYS(effectsView);
Dali::RefObject& handle = effectsView.GetImplementation();
- return static_cast<Toolkit::Internal::EffectsView&>( handle );
+ return static_cast<Toolkit::Internal::EffectsView&>(handle);
}
-inline const Toolkit::Internal::EffectsView& GetImpl( const Toolkit::EffectsView& effectsView )
+inline const Toolkit::Internal::EffectsView& GetImpl(const Toolkit::EffectsView& effectsView)
{
- DALI_ASSERT_ALWAYS( effectsView );
+ DALI_ASSERT_ALWAYS(effectsView);
const Dali::RefObject& handle = effectsView.GetImplementation();
- return static_cast<const Toolkit::Internal::EffectsView&>( handle );
+ return static_cast<const Toolkit::Internal::EffectsView&>(handle);
}
} // namespace Toolkit
#define DALI_TOOLKIT_INTERNAL_FLEX_CONTAINER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/**
* FlexContainer is a custom control for laying out actors in a Flexbox layout
* @see Dali::Toolkit:FlexContainer for more details
class FlexContainer : public Control
{
public:
-
/**
* The structure to store the style properties and layout information of flex item
*/
struct FlexItemNode
{
- WeakHandle< Dali::Actor > actor; ///< Actor handle of the flex item
- YGNodeRef node; ///< The style properties and layout information
+ WeakHandle<Dali::Actor> actor; ///< Actor handle of the flex item
+ YGNodeRef node; ///< The style properties and layout information
};
- typedef std::vector< FlexItemNode > FlexItemNodeContainer;
+ typedef std::vector<FlexItemNode> FlexItemNodeContainer;
public:
-
/**
* Construct a new FlexContainer.
*/
* @param[in] index The property index.
* @param[in] value The new property value.
*/
- static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
+ static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value);
/**
* Called to retrieve a property of an object of this type.
* @param[in] index The property index.
* @return The current value of the property.
*/
- static Property::Value GetProperty( BaseObject* object, Property::Index index );
+ static Property::Value GetProperty(BaseObject* object, Property::Index index);
private: // From Control
-
/**
* @copydoc Control::OnInitialize()
*/
/**
* @copydoc Control::OnChildAdd(Actor& child)
*/
- void OnChildAdd( Actor& child ) override;
+ void OnChildAdd(Actor& child) override;
/**
* @copydoc Control::OnChildRemove(Actor& child)
*/
- void OnChildRemove( Actor& child ) override;
+ void OnChildRemove(Actor& child) override;
/**
* @copydoc Control::OnRelayout
*/
- void OnRelayout( const Vector2& size, RelayoutContainer& container ) override;
+ void OnRelayout(const Vector2& size, RelayoutContainer& container) override;
/**
* @copydoc Control::RelayoutDependentOnChildren()
*/
- bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) override;
+ bool RelayoutDependentOnChildren(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) override;
/**
* @copydoc Control::GetNextKeyboardFocusableActor
*/
- Actor GetNextKeyboardFocusableActor( Actor currentFocusedActor, Toolkit::Control::KeyboardFocus::Direction direction, bool loopEnabled ) override;
+ Actor GetNextKeyboardFocusableActor(Actor currentFocusedActor, Toolkit::Control::KeyboardFocus::Direction direction, bool loopEnabled) override;
/**
* @copydoc CustomActorImpl::OnSizeSet( const Vector3& size )
*/
- void OnSizeSet( const Vector3& size ) override;
+ void OnSizeSet(const Vector3& size) override;
/**
* @copydoc OnLayoutDirectionChanged( Dali::Actor actor, Dali::LayoutDirection::Type type )
* @param[in] actor The actor whose layoutDirection is changed.
* @param[in] type The layoutDirection.
*/
- void OnLayoutDirectionChanged( Dali::Actor actor, Dali::LayoutDirection::Type type );
+ void OnLayoutDirectionChanged(Dali::Actor actor, Dali::LayoutDirection::Type type);
private: // Implementation
-
/**
* Calculate the layout properties of all the children
*/
virtual ~FlexContainer();
private:
-
// Undefined copy constructor and assignment operators
FlexContainer(const FlexContainer&);
FlexContainer& operator=(const FlexContainer& rhs);
-private: // Data
-
- FlexItemNode mRootNode; ///< Style properties and layout information of flex container
- FlexItemNodeContainer mChildrenNodes; ///< Style properties and layout information of flex items in the container
+private: // Data
+ FlexItemNode mRootNode; ///< Style properties and layout information of flex container
+ FlexItemNodeContainer mChildrenNodes; ///< Style properties and layout information of flex items in the container
- Toolkit::FlexContainer::ContentDirection mContentDirection; ///< The content direction of the container
- Toolkit::FlexContainer::FlexDirection mFlexDirection; ///< The flex direction of the container
- Toolkit::FlexContainer::WrapType mFlexWrap; ///< The wrap type of the container
- Toolkit::FlexContainer::Justification mJustifyContent; ///< The alignment of flex items in the container on the main-axis
- Toolkit::FlexContainer::Alignment mAlignItems; ///< The alignment of flex items in the container on the cross-axis
- Toolkit::FlexContainer::Alignment mAlignContent; ///< The alignment of flex lines in the container on the cross-axis
+ Toolkit::FlexContainer::ContentDirection mContentDirection; ///< The content direction of the container
+ Toolkit::FlexContainer::FlexDirection mFlexDirection; ///< The flex direction of the container
+ Toolkit::FlexContainer::WrapType mFlexWrap; ///< The wrap type of the container
+ Toolkit::FlexContainer::Justification mJustifyContent; ///< The alignment of flex items in the container on the main-axis
+ Toolkit::FlexContainer::Alignment mAlignItems; ///< The alignment of flex items in the container on the cross-axis
+ Toolkit::FlexContainer::Alignment mAlignContent; ///< The alignment of flex lines in the container on the cross-axis
};
} // namespace Internal
// Helpers for public-api forwarding methods
-inline Toolkit::Internal::FlexContainer& GetImpl( Toolkit::FlexContainer& flexContainer )
+inline Toolkit::Internal::FlexContainer& GetImpl(Toolkit::FlexContainer& flexContainer)
{
DALI_ASSERT_ALWAYS(flexContainer);
return static_cast<Toolkit::Internal::FlexContainer&>(handle);
}
-inline const Toolkit::Internal::FlexContainer& GetImpl( const Toolkit::FlexContainer& flexContainer )
+inline const Toolkit::Internal::FlexContainer& GetImpl(const Toolkit::FlexContainer& flexContainer)
{
DALI_ASSERT_ALWAYS(flexContainer);
#define DALI_TOOLKIT_INTERNAL_GAUSSIAN_BLUR_EFFECT_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <sstream>
-#include <cmath>
#include <dali/public-api/object/property-map.h>
+#include <cmath>
+#include <sstream>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/devel-api/controls/gaussian-blur-view/gaussian-blur-view.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
namespace Dali
{
-
namespace Toolkit
{
-
class GaussianBlurView;
namespace Internal
{
-
/**
* GaussianBlurView implementation class
*/
class GaussianBlurView : public Control
{
public:
-
/**
* @copydoc Dali::Toolkit::GaussianBlurView::GaussianBlurView
*/
/**
* @copydoc Dali::Toolkit::GaussianBlurView::GaussianBlurView
*/
- GaussianBlurView(const unsigned int numSamples, const float blurBellCurveWidth, const Pixel::Format renderTargetPixelFormat,
- const float downsampleWidthScale, const float downsampleHeightScale,
- bool blurUserImage);
+ GaussianBlurView(const unsigned int numSamples, const float blurBellCurveWidth, const Pixel::Format renderTargetPixelFormat, const float downsampleWidthScale, const float downsampleHeightScale, bool blurUserImage);
/**
* @copydoc Dali::Toolkit::GaussianBlurView::~GaussianBlurView
* @copydoc Dali::Toolkit::GaussianBlurView::New
*/
static Dali::Toolkit::GaussianBlurView New();
- static Dali::Toolkit::GaussianBlurView New( const unsigned int numSamples, const float blurBellCurveWidth, const Pixel::Format renderTargetPixelFormat,
- const float downsampleWidthScale, const float downsampleHeightScale,
- bool blurUserImage);
+ static Dali::Toolkit::GaussianBlurView New(const unsigned int numSamples, const float blurBellCurveWidth, const Pixel::Format renderTargetPixelFormat, const float downsampleWidthScale, const float downsampleHeightScale, bool blurUserImage);
void Activate();
void ActivateOnce();
void SetUserImageAndOutputRenderTarget(Texture inputImage, FrameBuffer outputRenderTarget);
- Property::Index GetBlurStrengthPropertyIndex() const {return mBlurStrengthPropertyIndex;}
+ Property::Index GetBlurStrengthPropertyIndex() const
+ {
+ return mBlurStrengthPropertyIndex;
+ }
FrameBuffer GetBlurredRenderTarget() const;
/// @copydoc Dali::Toolkit::GaussianBlurView::SetBackgroundColor(const Vector4&)
- void SetBackgroundColor( const Vector4& color );
+ void SetBackgroundColor(const Vector4& color);
/// @copydoc Dali::Toolkit::GaussianBlurView::GetBackgroundColor
Vector4 GetBackgroundColor() const;
- void AllocateResources();
- void CreateRenderTasks();
- void RemoveRenderTasks();
+ void AllocateResources();
+ void CreateRenderTasks();
+ void RemoveRenderTasks();
Dali::Toolkit::GaussianBlurView::GaussianBlurViewSignal& FinishedSignal();
private:
-
void OnInitialize() override;
void OnSizeSet(const Vector3& targetSize) override;
/**
* @copydoc Control::OnChildAdd()
*/
- void OnChildAdd( Actor& child ) override;
+ void OnChildAdd(Actor& child) override;
/**
* @copydoc Control::OnChildRemove()
*/
- void OnChildRemove( Actor& child ) override;
+ void OnChildRemove(Actor& child) override;
- void SetBlurBellCurveWidth(float blurBellCurveWidth);
- float CalcGaussianWeight(float x);
- void SetShaderConstants();
- std::string GetSampleOffsetsPropertyName( unsigned int index ) const;
- std::string GetSampleWeightsPropertyName( unsigned int index ) const;
+ void SetBlurBellCurveWidth(float blurBellCurveWidth);
+ float CalcGaussianWeight(float x);
+ void SetShaderConstants();
+ std::string GetSampleOffsetsPropertyName(unsigned int index) const;
+ std::string GetSampleWeightsPropertyName(unsigned int index) const;
void OnRenderTaskFinished(Dali::RenderTask& renderTask);
/////////////////////////////////////////////////////////////
- unsigned int mNumSamples; // number of blur samples in each of horiz/vert directions
- float mBlurBellCurveWidth; // constant used when calculating the gaussian weights
- Pixel::Format mPixelFormat; // pixel format used by render targets
+ unsigned int mNumSamples; // number of blur samples in each of horiz/vert directions
+ float mBlurBellCurveWidth; // constant used when calculating the gaussian weights
+ Pixel::Format mPixelFormat; // pixel format used by render targets
/////////////////////////////////////////////////////////////
// downsampling is used for the separated blur passes to get increased blur with the same number of samples and also to make rendering quicker
/////////////////////////////////////////////////////////////
// if this is set to true, we blur a user supplied image rather than rendering and blurring children
- bool mBlurUserImage:1;
+ bool mBlurUserImage : 1;
/////////////////////////////////////////////////////////////
// if this is set to true, set the render tasks to refresh once
- bool mRenderOnce:1;
+ bool mRenderOnce : 1;
/////////////////////////////////////////////////////////////
// background fill color
/////////////////////////////////////////////////////////////
// for rendering all user added children to offscreen target
FrameBuffer mRenderTargetForRenderingChildren;
- RenderTask mRenderChildrenTask;
+ RenderTask mRenderChildrenTask;
/////////////////////////////////////////////////////////////
// for rendering separated blur passes to offscreen targets
/////////////////////////////////////////////////////////////
// for compositing blur and children renders to offscreen target
- Actor mCompositingActor;
+ Actor mCompositingActor;
RenderTask mCompositeTask;
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
// User can specify image to blur and output target, so we can use GaussianBlurView for arbitrary blur processes
- Texture mUserInputImage;
+ Texture mUserInputImage;
FrameBuffer mUserOutputRenderTarget;
Dali::Toolkit::GaussianBlurView::GaussianBlurViewSignal mFinishedSignal; ///< Signal emitted when blur has completed.
- bool mActivated:1;
-private:
+ bool mActivated : 1;
+private:
// Undefined copy constructor.
- GaussianBlurView( const GaussianBlurView& );
+ GaussianBlurView(const GaussianBlurView&);
// Undefined assignment operator.
- GaussianBlurView& operator=( const GaussianBlurView& );
+ GaussianBlurView& operator=(const GaussianBlurView&);
};
} // namespace Internal
-
// Helpers for public-api forwarding methods
-inline Toolkit::Internal::GaussianBlurView& GetImpl( Toolkit::GaussianBlurView& obj )
+inline Toolkit::Internal::GaussianBlurView& GetImpl(Toolkit::GaussianBlurView& obj)
{
DALI_ASSERT_ALWAYS(obj);
Dali::RefObject& handle = obj.GetImplementation();
return static_cast<Toolkit::Internal::GaussianBlurView&>(handle);
}
-inline const Toolkit::Internal::GaussianBlurView& GetImpl( const Toolkit::GaussianBlurView& obj )
+inline const Toolkit::Internal::GaussianBlurView& GetImpl(const Toolkit::GaussianBlurView& obj)
{
DALI_ASSERT_ALWAYS(obj);
const Dali::RefObject& handle = obj.GetImplementation();
return static_cast<const Toolkit::Internal::GaussianBlurView&>(handle);
}
-
} // namespace Toolkit
} // namespace Dali
#define DALI_TOOLKIT_INTERNAL_IMAGE_VIEW_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
class ImageView;
namespace Internal
class ImageView : public Control
{
protected:
-
/**
* Construct a new ImageView.
*/
* If the handle is empty, ImageView will display nothing
* @param[in] map The Dali::Property::Map to use for to display.
*/
- void SetImage( const Dali::Property::Map& map );
+ void SetImage(const Dali::Property::Map& map);
/**
* @copydoc Dali::Toolkit::SetImage
*/
- void SetImage( const std::string& imageUrl, ImageDimensions size );
+ void SetImage(const std::string& imageUrl, ImageDimensions size);
/**
* @brief Set whether the Pre-multiplied Alpha Blending is required
*
* @param[in] preMultipled whether alpha is pre-multiplied.
*/
- void EnablePreMultipliedAlpha( bool preMultipled );
+ void EnablePreMultipliedAlpha(bool preMultipled);
/**
* @brief Query whether alpha is pre-multiplied.
* @param[in] index The property index.
* @param[in] value The new property value.
*/
- static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
+ static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value);
/**
* Called to retrieve a property of an object of this type.
* @param[in] index The property index.
* @return The current value of the property.
*/
- static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex );
+ static Property::Value GetProperty(BaseObject* object, Property::Index propertyIndex);
/**
* @brief Set the depth index of this image renderer
*
* @param[in] depthIndex The depth index of this renderer
*/
- void SetDepthIndex( int depthIndex );
+ void SetDepthIndex(int depthIndex);
private: // From Control
-
/**
* @copydoc Toolkit::Control::OnInitialize
*/
/**
* @copydoc Toolkit::Control::GetHeightForWidth()
*/
- float GetHeightForWidth( float width ) override;
+ float GetHeightForWidth(float width) override;
/**
* @copydoc Toolkit::Control::GetWidthForHeight()
*/
- float GetWidthForHeight( float height ) override;
+ float GetWidthForHeight(float height) override;
/**
* @copydoc Toolkit::Control::OnRelayout()
*/
- void OnRelayout( const Vector2& size, RelayoutContainer& container ) override;
+ void OnRelayout(const Vector2& size, RelayoutContainer& container) override;
private:
-
/**
* @brief Callback for ResourceReadySignal
* param[in] control signal prototype
*/
- void OnResourceReady( Toolkit::Control control );
+ void OnResourceReady(Toolkit::Control control);
/**
* @brief Set TransformMap for fittingMode
* param[in] fittingMode The mode for fitting image
* param[in] transformMap The map for fitting image
*/
- void SetTransformMapForFittingMode ( Vector2 finalSize, Vector2 textureSize, Vector2 offset, Visual::FittingMode fittingMode, Property::Map& transformMap );
+ void SetTransformMapForFittingMode(Vector2 finalSize, Vector2 textureSize, Vector2 offset, Visual::FittingMode fittingMode, Property::Map& transformMap);
/**
* @brief Apply fittingMode
* param[in] zeroPadding whether padding is zero
* param[in] transformMap The map for fitting image
*/
- void ApplyFittingMode( Vector2 finalSize, Vector2 textureSize, Vector2 offset, bool zeroPadding , Property::Map& transformMap);
+ void ApplyFittingMode(Vector2 finalSize, Vector2 textureSize, Vector2 offset, bool zeroPadding, Property::Map& transformMap);
private:
// Undefined
- ImageView( const ImageView& );
- ImageView& operator=( const ImageView& );
+ ImageView(const ImageView&);
+ ImageView& operator=(const ImageView&);
private:
- Toolkit::Visual::Base mVisual;
+ Toolkit::Visual::Base mVisual;
- std::string mUrl; ///< the url for the image if the image came from a URL, empty otherwise
- Property::Map mPropertyMap; ///< the Property::Map if the image came from a Property::Map, empty otherwise
- Property::Map mShaderMap; ///< the Property::Map if the custom shader is set, empty otherwise
- ImageDimensions mImageSize; ///< the image size
+ std::string mUrl; ///< the url for the image if the image came from a URL, empty otherwise
+ Property::Map mPropertyMap; ///< the Property::Map if the image came from a Property::Map, empty otherwise
+ Property::Map mShaderMap; ///< the Property::Map if the custom shader is set, empty otherwise
+ ImageDimensions mImageSize; ///< the image size
- bool mImageVisualPaddingSetByTransform :1; //< Flag to indicate Padding was set using a transform.
- bool mImageViewPixelAreaSetByFittingMode:1; //< Flag to indicate pixel area was set by fitting Mode
+ bool mImageVisualPaddingSetByTransform : 1; //< Flag to indicate Padding was set using a transform.
+ bool mImageViewPixelAreaSetByFittingMode : 1; //< Flag to indicate pixel area was set by fitting Mode
};
} // namespace Internal
// Helpers for public-api forwarding methods
-inline Toolkit::Internal::ImageView& GetImpl( Toolkit::ImageView& obj )
+inline Toolkit::Internal::ImageView& GetImpl(Toolkit::ImageView& obj)
{
DALI_ASSERT_ALWAYS(obj);
Dali::RefObject& handle = obj.GetImplementation();
return static_cast<Toolkit::Internal::ImageView&>(handle);
}
-inline const Toolkit::Internal::ImageView& GetImpl( const Toolkit::ImageView& obj )
+inline const Toolkit::Internal::ImageView& GetImpl(const Toolkit::ImageView& obj)
{
DALI_ASSERT_ALWAYS(obj);
const Dali::RefObject& handle = obj.GetImplementation();
#define DALI_TOOLKIT_INTERNAL_MAGNIFIER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/render-tasks/render-task.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/devel-api/controls/magnifier/magnifier.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class Magnifier;
-typedef IntrusivePtr<Magnifier> MagnifierPtr;
+typedef IntrusivePtr<Magnifier> MagnifierPtr;
/**
* @copydoc Toolkit::Magnifier
class Magnifier : public Control
{
public:
-
/**
* Create a new Magnifier.
* @return A public handle to the newly allocated Magnifier.
static Dali::Toolkit::Magnifier New();
public:
-
/**
* @copydoc Toolkit::ImageView::SetSourceActor
*/
* @param[in] index The property index.
* @param[in] value The new property value.
*/
- static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
+ static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value);
/**
* Called to retrieve a property of an object of this type.
* @param[in] index The property index.
* @return The current value of the property.
*/
- static Property::Value GetProperty( BaseObject* object, Property::Index index );
+ static Property::Value GetProperty(BaseObject* object, Property::Index index);
protected:
-
/**
* Construct a new Magnifier.
*/
virtual ~Magnifier();
private:
-
/**
* Initializes the render task required to render contents.
*/
void InitializeRenderTask();
private:
-
void OnSizeSet(const Vector3& targetSize) override;
private:
-
// Undefined
Magnifier(const Magnifier&);
Magnifier& operator=(const Magnifier& rhs);
private:
-
- RenderTask mTask; ///< Render Task to render the source actor contents.
- CameraActor mCameraActor; ///< CameraActor attached to RenderTask
- Actor mFrame; ///< The Magnifier Frame
- Actor mSourceActor; ///< Source Delegate Actor represents the source position to read.
- float mDefaultCameraDistance; ///< Default RenderTask's camera distance from target.
- Vector3 mActorSize; ///< The Actor size
- float mMagnificationFactor; ///< Magnification factor 1.0f is default. same as content.
+ RenderTask mTask; ///< Render Task to render the source actor contents.
+ CameraActor mCameraActor; ///< CameraActor attached to RenderTask
+ Actor mFrame; ///< The Magnifier Frame
+ Actor mSourceActor; ///< Source Delegate Actor represents the source position to read.
+ float mDefaultCameraDistance; ///< Default RenderTask's camera distance from target.
+ Vector3 mActorSize; ///< The Actor size
+ float mMagnificationFactor; ///< Magnification factor 1.0f is default. same as content.
};
} // namespace Internal
#define DALI_TOOLKIT_INTERNAL_MODEL3D_VIEW_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/rendering/renderer.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/internal/controls/model3d-view/obj-loader.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/controls/model3d-view/model3d-view.h>
-#include <dali-toolkit/internal/controls/model3d-view/obj-loader.h>
namespace Dali
{
-
namespace Toolkit
{
-
class Model3dView;
namespace Internal
class Model3dView : public Control
{
public:
-
/**
* @brief Create a new Model3dView.
*
* @param[in] index The property index.
* @param[in] value The new property value.
*/
- static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
+ static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value);
/**
* @brief Called to retrieve a property of an object of this type.
* @param[in] index The property index.
* @return The current value of the property.
*/
- static Property::Value GetProperty( BaseObject* object, Property::Index index );
+ static Property::Value GetProperty(BaseObject* object, Property::Index index);
/**
* @copydoc Control::OnRelayout
*/
- void OnRelayout( const Vector2& size, RelayoutContainer& container ) override;
+ void OnRelayout(const Vector2& size, RelayoutContainer& container) override;
/**
* @brief Called to load both geometry (.obj) and material (.mtl) files
void Load();
protected:
-
/**
* @brief Construct a new Model3dView.
*/
virtual ~Model3dView();
private:
-
/**
* @copydoc Toolkit::Control::OnInitialize()
*/
/**
* @copydoc CustomActorImpl::OnSceneConnection()
*/
- void OnSceneConnection( int depth ) override;
+ void OnSceneConnection(int depth) override;
private:
-
/**
* @brief Load geometry (.obj) from file
*/
*/
void UpdateShaderUniforms();
-
/*
* @brief Given a specific shader type, find out which properties are necessary for it.
*
* @param[in] illuminationType The type of shader we intend to use.
* @return A bitmask of the properties we require to be loaded to use the given shader.
*/
- int GetShaderProperties( Toolkit::Model3dView::IlluminationType illuminationType );
-
+ int GetShaderProperties(Toolkit::Model3dView::IlluminationType illuminationType);
ObjLoader mObjLoader;
//Properties
- std::string mObjUrl;
- std::string mTextureSetUrl;
- std::string mImagesUrl;
- std::string mTexture0Url;
- std::string mTexture1Url;
- std::string mTexture2Url;
- Vector3 mLightPosition;
- float mCameraFOV;
+ std::string mObjUrl;
+ std::string mTextureSetUrl;
+ std::string mImagesUrl;
+ std::string mTexture0Url;
+ std::string mTexture1Url;
+ std::string mTexture2Url;
+ Vector3 mLightPosition;
+ float mCameraFOV;
Toolkit::Model3dView::IlluminationType mIlluminationType;
//Size
Vector3 mSceneSize;
//Render members
- Shader mShader;
+ Shader mShader;
TextureSet mTextureSet;
- Geometry mMesh;
- Renderer mRenderer;
+ Geometry mMesh;
+ Renderer mRenderer;
};
} // namespace Internal
// Helpers for public-api forwarding methods
-inline Toolkit::Internal::Model3dView& GetImpl( Toolkit::Model3dView& obj )
+inline Toolkit::Internal::Model3dView& GetImpl(Toolkit::Model3dView& obj)
{
DALI_ASSERT_ALWAYS(obj);
Dali::RefObject& handle = obj.GetImplementation();
return static_cast<Toolkit::Internal::Model3dView&>(handle);
}
-inline const Toolkit::Internal::Model3dView& GetImpl( const Toolkit::Model3dView& obj )
+inline const Toolkit::Internal::Model3dView& GetImpl(const Toolkit::Model3dView& obj)
{
DALI_ASSERT_ALWAYS(obj);
const Dali::RefObject& handle = obj.GetImplementation();
#define DALI_TOOLKIT_INTERNAL_OBJ_LOADER_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
class ObjLoader;
namespace Internal
class ObjLoader
{
public:
-
struct TriIndex
{
int pointIndex[3];
struct Vertex
{
Vertex()
- {}
+ {
+ }
- Vertex( const Vector3& position, const Vector3& normal, const Vector2& textureCoord )
- : position( position ), normal( normal )
- {}
+ Vertex(const Vector3& position, const Vector3& normal, const Vector2& textureCoord)
+ : position(position),
+ normal(normal)
+ {
+ }
Vector3 position;
Vector3 normal;
struct VertexExt
{
VertexExt()
- {}
+ {
+ }
- VertexExt( const Vector3& tangent, const Vector3& binormal )
- : tangent( tangent), bitangent( binormal )
- {}
+ VertexExt(const Vector3& tangent, const Vector3& binormal)
+ : tangent(tangent),
+ bitangent(binormal)
+ {
+ }
Vector3 tangent;
Vector3 bitangent;
{
void Init()
{
- pointMin = Vector3( std::numeric_limits<float>::max(), std::numeric_limits<float>::max(), std::numeric_limits<float>::max() );
- pointMax = Vector3( std::numeric_limits<float>::min(), std::numeric_limits<float>::min(), std::numeric_limits<float>::min() );
+ pointMin = Vector3(std::numeric_limits<float>::max(), std::numeric_limits<float>::max(), std::numeric_limits<float>::max());
+ pointMax = Vector3(std::numeric_limits<float>::min(), std::numeric_limits<float>::min(), std::numeric_limits<float>::min());
}
- void ConsiderNewPointInVolume( const Vector3& position )
+ void ConsiderNewPointInVolume(const Vector3& position)
{
- pointMin.x = std::min( position.x, pointMin.x );
- pointMin.y = std::min( position.y, pointMin.y );
- pointMin.z = std::min( position.z, pointMin.z );
+ pointMin.x = std::min(position.x, pointMin.x);
+ pointMin.y = std::min(position.y, pointMin.y);
+ pointMin.z = std::min(position.z, pointMin.z);
- pointMax.x = std::max( position.x, pointMax.x );
- pointMax.y = std::max( position.y, pointMax.y );
- pointMax.z = std::max( position.z, pointMax.z );
+ pointMax.x = std::max(position.x, pointMax.x);
+ pointMax.y = std::max(position.y, pointMax.y);
+ pointMax.z = std::max(position.z, pointMax.z);
}
Vector3 pointMin;
enum ObjectProperties
{
TEXTURE_COORDINATES = 1 << 0,
- TANGENTS = 1 << 1,
- BINORMALS = 1 << 2
+ TANGENTS = 1 << 1,
+ BINORMALS = 1 << 2
};
ObjLoader();
virtual ~ObjLoader();
- bool IsSceneLoaded();
- bool IsMaterialLoaded();
+ bool IsSceneLoaded();
+ bool IsMaterialLoaded();
- bool LoadObject( char* objBuffer, std::streampos fileSize );
+ bool LoadObject(char* objBuffer, std::streampos fileSize);
- void LoadMaterial( char* objBuffer, std::streampos fileSize, std::string& diffuseTextureUrl,
- std::string& normalTextureUrl, std::string& glossTextureUrl );
+ void LoadMaterial(char* objBuffer, std::streampos fileSize, std::string& diffuseTextureUrl, std::string& normalTextureUrl, std::string& glossTextureUrl);
- Geometry CreateGeometry( int objectProperties, bool useSoftNormals );
+ Geometry CreateGeometry(int objectProperties, bool useSoftNormals);
- Vector3 GetCenter();
- Vector3 GetSize();
+ Vector3 GetCenter();
+ Vector3 GetSize();
- void ClearArrays();
+ void ClearArrays();
- bool IsTexturePresent();
- bool IsDiffuseMapPresent();
- bool IsNormalMapPresent();
- bool IsSpecularMapPresent();
+ bool IsTexturePresent();
+ bool IsDiffuseMapPresent();
+ bool IsNormalMapPresent();
+ bool IsSpecularMapPresent();
private:
-
BoundingVolume mSceneAABB;
bool mSceneLoaded;
* @param[in, out] triangles The triangles that form the faces. The normals of each triangle will be updated.
* @param[in, out] normals The normals to be calculated.
*/
- void CalculateHardFaceNormals( const Dali::Vector<Vector3>& vertices,
- Dali::Vector<TriIndex>& triangles,
- Dali::Vector<Vector3>& normals );
+ void CalculateHardFaceNormals(const Dali::Vector<Vector3>& vertices,
+ Dali::Vector<TriIndex>& triangles,
+ Dali::Vector<Vector3>& normals);
/**
* @brief Calculates smoothed normals for each point.
* @param[in, out] triangles The triangles that form the faces. The normals of each triangle will be updated.
* @param[in, out] normals The normals to be calculated.
*/
- void CalculateSoftFaceNormals( const Dali::Vector<Vector3>& vertices,
- Dali::Vector<TriIndex>& triangles,
- Dali::Vector<Vector3>& normals );
+ void CalculateSoftFaceNormals(const Dali::Vector<Vector3>& vertices,
+ Dali::Vector<TriIndex>& triangles,
+ Dali::Vector<Vector3>& normals);
/**
* @brief Calculates tangents and bitangents for each point of the object.
*/
void CalculateTangentFrame();
- void CenterAndScale( bool center, Dali::Vector<Vector3>& points );
+ void CenterAndScale(bool center, Dali::Vector<Vector3>& points);
/**
* @brief Using the data loaded from the file, create arrays of data to be used in creating the geometry.
* @param[in] indices Indices of corresponding values to match triangles to their respective data.
* @param[in] useSoftNormals Indicates whether we should average the normals at each point to smooth the surface or not.
*/
- void CreateGeometryArray( Dali::Vector<Vertex> & vertices,
- Dali::Vector<Vector2> & textures,
- Dali::Vector<VertexExt> & verticesExt,
- Dali::Vector<unsigned short> & indices,
- bool useSoftNormals );
-
+ void CreateGeometryArray(Dali::Vector<Vertex>& vertices,
+ Dali::Vector<Vector2>& textures,
+ Dali::Vector<VertexExt>& verticesExt,
+ Dali::Vector<unsigned short>& indices,
+ bool useSoftNormals);
};
-
-
} // namespace Internal
} // namespace Toolkit
} // namespace Dali
-
-
-
#endif // DALI_TOOLKIT_INTERNAL_OBJ_LOADER_H
#define DALI_TOOLKIT_INTERNAL_NAVIGATION_CONTROL_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <list>
#include <dali/public-api/actors/layer.h>
+#include <list>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/devel-api/controls/navigation-view/navigation-view.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
namespace Dali
{
-
namespace Toolkit
{
-
class NavigationView;
namespace Internal
{
-
class NavigationBar;
/**
class NavigationView : public Control
{
public:
-
/**
* Create an initialized NavigationView.
* @return A handle to a newly allocated Dali resource
/**
* @copydoc Dali::Toolkit::NavigationView::Push()
*/
- void Push( Actor& actor );
+ void Push(Actor& actor);
/**
* @copydoc Dali::Toolkit::NavigationView::Pop()
*/
//static bool DoAction( BaseObject* object, const std::string& actionName, const Property::Map& properties );
-
private: // override functions from Control
-
/**
* @copydoc Constrol::OnInitialize
*/
/**
* @copydoc Control::OnSceneConnection( int depth )
*/
- void OnSceneConnection( int depth ) override;
+ void OnSceneConnection(int depth) override;
/**
* @copydoc Control::OnRelayout()
//virtual void OnRelayout( const Vector2& size, RelayoutContainer& container );
protected:
-
/**
* Constructor.
* It initializes the NavigationView members
virtual ~NavigationView();
private:
-
// Undefined
NavigationView(const NavigationView&);
NavigationView& operator=(const NavigationView& rhs);
private:
-
- std::vector< Actor > mContentStack;
+ std::vector<Actor> mContentStack;
};
} // namespace Internal
// Helpers for public-api forwarding methods
-inline Toolkit::Internal::NavigationView& GetImpl( Toolkit::NavigationView& navigationView )
+inline Toolkit::Internal::NavigationView& GetImpl(Toolkit::NavigationView& navigationView)
{
- DALI_ASSERT_ALWAYS( navigationView );
+ DALI_ASSERT_ALWAYS(navigationView);
Dali::RefObject& handle = navigationView.GetImplementation();
- return static_cast<Toolkit::Internal::NavigationView&>( handle );
+ return static_cast<Toolkit::Internal::NavigationView&>(handle);
}
-inline const Toolkit::Internal::NavigationView& GetImpl( const Toolkit::NavigationView& navigationView )
+inline const Toolkit::Internal::NavigationView& GetImpl(const Toolkit::NavigationView& navigationView)
{
- DALI_ASSERT_ALWAYS( navigationView );
+ DALI_ASSERT_ALWAYS(navigationView);
const Dali::RefObject& handle = navigationView.GetImplementation();
- return static_cast<const Toolkit::Internal::NavigationView&>( handle );
+ return static_cast<const Toolkit::Internal::NavigationView&>(handle);
}
} // namespace Toolkit
#define DALI_PAGE_TURN_BOOK_SPINE_EFFECT_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
#include <dali-toolkit/internal/graphics/builtin-shader-extern-gen.h>
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/**
* @brief Creates a new PageTurnBookSpineEffect
* This is an assisting effect of PageTurnEffect to display a book spine on _static_ pages, and also to flip the image horizontally when needed.
Property::Map customShader;
- customShader[ Toolkit::Visual::Shader::Property::VERTEX_SHADER ] = SHADER_PAGE_TURN_BOOK_SPINE_EFFECT_VERT.data();
- customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = SHADER_PAGE_TURN_BOOK_SPINE_EFFECT_FRAG.data();
+ customShader[Toolkit::Visual::Shader::Property::VERTEX_SHADER] = SHADER_PAGE_TURN_BOOK_SPINE_EFFECT_VERT.data();
+ customShader[Toolkit::Visual::Shader::Property::FRAGMENT_SHADER] = SHADER_PAGE_TURN_BOOK_SPINE_EFFECT_FRAG.data();
- map[ Toolkit::Visual::Property::SHADER ] = customShader;
+ map[Toolkit::Visual::Property::SHADER] = customShader;
return map;
}
#define DALI_PAGE_TURN_EFFECT_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
-
/**
* @brief Re-applies PageTurnEffect internal constraints
* The internal constraint uses the OriginalCenter property and the CURRENT_CENTER Property
* @param[in] actor The page turn actor to which internal constraints should be re-applied
* @param[in] pageHeight The page height.
*/
-void PageTurnApplyInternalConstraint( Actor& actor, float pageHeight );
+void PageTurnApplyInternalConstraint(Actor& actor, float pageHeight);
/**
* @brief Create a new PageTurnEffect
#define DALI_TOOLKIT_INTERNAL_PAGE_TURN_LANDSCAPE_VIEW_IMPL_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class PageTurnLandscapeView : public PageTurnView
{
public:
-
/**
* @copydoc Toolkit::PageTurnLandscapeView::New( PageFactory&, const Vector2& )
*/
- static Toolkit::PageTurnLandscapeView New( PageFactory& pageFactory, const Vector2& viewPageSize );
+ static Toolkit::PageTurnLandscapeView New(PageFactory& pageFactory, const Vector2& viewPageSize);
protected:
/**
* @param[in] pageFactory The factory which provides image to PageTurnView as the page content.
* @param[in] viewPageSize The size of the page
*/
- PageTurnLandscapeView( PageFactory& pageFactory, const Vector2& viewPageSize );
+ PageTurnLandscapeView(PageFactory& pageFactory, const Vector2& viewPageSize);
/**
* A reference counted object may only be deleted by calling Unreference()
virtual ~PageTurnLandscapeView();
protected: // From PageTurnView
-
/**
* @copydoc PageTurnView::OnPageTurnViewInitialize
*/
/**
* @copydoc PageTurnView::OnAddPage
*/
- void OnAddPage( Actor newPage, bool isLeftSide ) override;
+ void OnAddPage(Actor newPage, bool isLeftSide) override;
/**
* @copydoc PageTurnView::SetPanPosition
*/
- Vector2 SetPanPosition( const Vector2& gesturePosition ) override;
+ Vector2 SetPanPosition(const Vector2& gesturePosition) override;
/**
* @copydoc PageTurnView::SetPanActor
*/
- void SetPanActor( const Vector2& panPosition ) override;
+ void SetPanActor(const Vector2& panPosition) override;
private:
-
//Undefined
- PageTurnLandscapeView( const PageTurnLandscapeView& );
+ PageTurnLandscapeView(const PageTurnLandscapeView&);
//undefined
PageTurnLandscapeView& operator=(const PageTurnLandscapeView& rhs);
-
};
} // namespace Internal
#define DALI_TOOLKIT_INTERNAL_PAGE_TURN_PORTRAIT_VIEW_IMPL_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/**
* Implementation class of the PageTurnView in portrait mode
*/
class PageTurnPortraitView : public PageTurnView
{
public:
-
/**
* @copydoc Toolkit::PageTurnPortraitView::New( PageFactory&, const Vector2& )
*/
- static Toolkit::PageTurnPortraitView New( PageFactory& pageFactory, const Vector2& viewPageSize );
+ static Toolkit::PageTurnPortraitView New(PageFactory& pageFactory, const Vector2& viewPageSize);
protected:
-
/**
* Constructor.
* It initializes the PageTurnPortraitView members
* @param[in] pageFactory The factory which provides image to PageTurnView as the page content.
* @param[in] viewPageSize The size of the page
*/
- PageTurnPortraitView( PageFactory& pageFactory, const Vector2& viewPageSize );
+ PageTurnPortraitView(PageFactory& pageFactory, const Vector2& viewPageSize);
/**
* A reference counted object may only be deleted by calling Unreference()
virtual ~PageTurnPortraitView();
protected: // From PageTurnView
-
/**
* @copydoc PageTurnView::OnPageTurnViewInitialize
*/
/**
* @copydoc PageTurnView::SetPanPosition
*/
- Vector2 SetPanPosition( const Vector2& gesturePosition ) override;
+ Vector2 SetPanPosition(const Vector2& gesturePosition) override;
/**
* @copydoc PageTurnView::SetPanActor
*/
- void SetPanActor( const Vector2& panPosition ) override;
+ void SetPanActor(const Vector2& panPosition) override;
/**
* @copydoc PageTurnView::OnPossibleOutwardsFlick
*/
- void OnPossibleOutwardsFlick( const Vector2& panPosition, float gestureSpeed ) override;
+ void OnPossibleOutwardsFlick(const Vector2& panPosition, float gestureSpeed) override;
/**
* @copydoc PageTurnView::OnTurnedOver
*/
- void OnTurnedOver( Actor actor, bool isLeftSide ) override;
+ void OnTurnedOver(Actor actor, bool isLeftSide) override;
private:
-
/**
* @copydoc PageTurnView::TurnedOver
*/
- void TurnedOverBackwards( Animation& animation );
+ void TurnedOverBackwards(Animation& animation);
private:
-
//Undefined
- PageTurnPortraitView( const PageTurnPortraitView& );
+ PageTurnPortraitView(const PageTurnPortraitView&);
//undefined
PageTurnPortraitView& operator=(const PageTurnPortraitView& rhs);
-
};
} // namespace Internal
#define DALI_TOOLKIT_INTERNAL_PAGE_TURN_VIEW_IMPL_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/rendering/renderer.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-view.h>
#include <dali-toolkit/devel-api/controls/page-turn-view/page-factory.h>
+#include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-view.h>
#include <dali-toolkit/devel-api/controls/shadow-view/shadow-view.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class PageTurnView : public Control
{
protected:
-
/**
* The book page class
*/
* Set the page texture content
* @param[in] texture The content of the page.
*/
- void SetTexture( Texture texture );
+ void SetTexture(Texture texture);
/**
* Apply an effect onto the page actor.
* Set the pan center property
* @param[in] value The property value
*/
- void SetPanCenter( const Vector2& value );
+ void SetPanCenter(const Vector2& value);
/**
* Set the original center property to be used by shader
* @param[in] value The property value
*/
- void SetOriginalCenter( const Vector2& value );
+ void SetOriginalCenter(const Vector2& value);
/**
* Set the current center property to be used by shader
* @param[in] value The property value
*/
- void SetCurrentCenter( const Vector2& value );
-
- Actor actor; ///< The page actor
- Shader shader; ///< The shader used by the actor
- TextureSet textureSet; ///< The set of textures used by the actor
- Renderer renderer; ///< The renderer of the actor
- bool isTurnBack; ///< The turning direction
- Property::Index propertyPanDisplacement; ///< The horizontal displacement of the pan
- Property::Index propertyPanCenter; ///< The current pan position
- Property::Index propertyOriginalCenter; ///< The original center to be used by the shader
- Property::Index propertyCurrentCenter; ///< The current center to be used by the shader
- Property::Index propertyTurnDirection; ///< The turning direction property
+ void SetCurrentCenter(const Vector2& value);
+
+ Actor actor; ///< The page actor
+ Shader shader; ///< The shader used by the actor
+ TextureSet textureSet; ///< The set of textures used by the actor
+ Renderer renderer; ///< The renderer of the actor
+ bool isTurnBack; ///< The turning direction
+ Property::Index propertyPanDisplacement; ///< The horizontal displacement of the pan
+ Property::Index propertyPanCenter; ///< The current pan position
+ Property::Index propertyOriginalCenter; ///< The original center to be used by the shader
+ Property::Index propertyCurrentCenter; ///< The current center to be used by the shader
+ Property::Index propertyTurnDirection; ///< The turning direction property
};
-
protected:
-
/**
* Constructor.
* It initializes the PageTurnView members
*/
- PageTurnView( PageFactory& pageFactory, const Vector2& viewPageSize );
+ PageTurnView(PageFactory& pageFactory, const Vector2& viewPageSize);
/**
* A reference counted object may only be deleted by calling Unreference()
virtual ~PageTurnView();
public:
-
/**
* Set the page size
* @param[in] viewPageSize The size of pages
*/
- void SetPageSize( const Vector2& viewPageSize );
+ void SetPageSize(const Vector2& viewPageSize);
/**
* Retrieve the page size.
* The top-left quarter of this ellipse is used to calculate spine normal for simulating shadow.
* @param [in] spineShadowParameter The major&minor ellipse radius for the simulated spine shadow.
*/
- void SetSpineShadowParameter( const Vector2& spineShadowParameter );
+ void SetSpineShadowParameter(const Vector2& spineShadowParameter);
/**
* Retrieve the spine shadow parameter of the shader effects.
* Jump to a given page.
* @param[in] pageId The new current page id.
*/
- void GoToPage( unsigned int pageId );
+ void GoToPage(unsigned int pageId);
/**
* Retrieve the id of the current Page.
unsigned int GetCurrentPage();
protected:
-
/**
* This method gets a page from the factory and add to the control
* to keep NUMBER_OF_CACHED_PAGES_EACH_SIDE pages available in each side
* @param[in] pageIndex The index of the page to be added
*/
- void AddPage( int pageIndex );
+ void AddPage(int pageIndex);
/**
* This method removes a page from the control
* to keep only NUMBER_OF_CACHED_PAGES_EACH_SIDE pages available in each side
* @param[in] pageIndex The index of the page to be removed
*/
- void RemovePage( int pageIndex );
+ void RemovePage(int pageIndex);
/**
* This method updates the actor and animation states after one page is turned over
* This method is a callback, connected when receiving the finished signal of a page turning over animation.
* @param [in] the page turning over animation handle
*/
- void TurnedOver( Animation& animation );
+ void TurnedOver(Animation& animation);
/**
* This method organize the depth of the pages on stage
void OrganizePageDepth();
private:
-
/**
* Create shader from a property map.
* @param[in] shaderMap The shader property map;
* @return The created shader.
*/
- Shader CreateShader( const Property::Map& shaderMap );
+ Shader CreateShader(const Property::Map& shaderMap);
- /**
+ /**
* Set up the shadow view control to cast shadow
*/
void SetupShadowView();
* This method defines the processes when the pan started, gets called by OnPan( .. )
* @param[in] gesturePosition The current touch position in local page actor coordinates.
*/
- void PanStarted( const Vector2& gesturePosition );
+ void PanStarted(const Vector2& gesturePosition);
/**
* This method defines the processes when the pan continuing, gets called by OnPan( .. )
* @param[in] gesturePosition The current touch position in local page actor coordinates.
*/
- void PanContinuing( const Vector2& gesturePosition );
+ void PanContinuing(const Vector2& gesturePosition);
/**
* This method defines the processes when the pan finished, gets called by OnPanGesture( .. )
* @param[in] gesturePosition The current touch position in local page actor coordinates.
* @param[in] gestureSpeed The speed of the pan ( in pixels per millisecond )
*/
- void PanFinished( const Vector2& gesturePosition, float gestureSpeed );
+ void PanFinished(const Vector2& gesturePosition, float gestureSpeed);
/**
* This method updates the actor and the animation states after one page is slidden back instead of turned over
* This method is a callback, connected when receiving the finished signal of a page sliding back animation.
* @param [in] the page sliding back animation handle
*/
- void SliddenBack( Animation& animation );
+ void SliddenBack(Animation& animation);
/**
* Stop the page turning animation and contraint.
void StopTurning();
private: // from Control
-
/**
* @copydoc Toolkit::Control::OnPan
*/
- void OnPan( const PanGesture& gesture ) override;
+ void OnPan(const PanGesture& gesture) override;
/**
* @copydoc Toolkit::Control::OnInitialize
/**
* @copydoc CustomActorImpl::OnSceneConnection()
*/
- void OnSceneConnection( int depth ) override;
+ void OnSceneConnection(int depth) override;
/**
* @copydoc CustomActorImpl::OnSceneDisconnection()
void OnSceneDisconnection() override;
private: // implemented differently by PageTurnLandscapeView and PageTurnPortraitView
-
/**
* This method is called after the pageTurnView initialization.
* To set the size of the control size and the parent origin of turning page layer
* @param[in] newPage The added page actor
* @param[in] isLeftSide Which side the new page is added to
*/
- virtual void OnAddPage( Actor newPage, bool isLeftSide ) { }
+ virtual void OnAddPage(Actor newPage, bool isLeftSide)
+ {
+ }
/**
* This method is called when pan started or continuing
* @param[in] gesturePosition The pan position in the control coordinate
* @return The pan position in the page actor local coordinate
*/
- virtual Vector2 SetPanPosition( const Vector2& gesturePosition ) = 0;
+ virtual Vector2 SetPanPosition(const Vector2& gesturePosition) = 0;
/**
* This method is called when pan started to determined which page is panned given the pan position in control coordinate
* Implemented in subclasses to provide specific behaviour.
* @param[in] gesturePosition The pan position in the control coordinate
*/
- virtual void SetPanActor( const Vector2& panPosition ) = 0;
+ virtual void SetPanActor(const Vector2& panPosition) = 0;
/**
* This method is called when pan finished to detect outwards flick
* @param[in] panPosition The pan position in the page actor local coordinate
* @param[in] gestureSpeed The speed of the pan gesture( in pixels per millisecond )
*/
- virtual void OnPossibleOutwardsFlick( const Vector2& panPosition, float gestureSpeed ) { }
+ virtual void OnPossibleOutwardsFlick(const Vector2& panPosition, float gestureSpeed)
+ {
+ }
/**
* This method is called when page is turned over
* @param[in] actor The page actor
* @param[in] isLeftSide Which side the page is turned to
*/
- virtual void OnTurnedOver( Actor actor, bool isLeftSide ) { }
+ virtual void OnTurnedOver(Actor actor, bool isLeftSide)
+ {
+ }
public: //signal and property
-
/**
* @copydoc Toolkit::PageTurnView::PageTurnStartedSignal()
*/
* @return True if the signal was connected.
* @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
*/
- static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
+ static bool DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
- // Properties
+ // Properties
/**
* Called when a property of an object of this type is set.
* @param[in] index The property index.
* @param[in] value The new property value.
*/
- static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
+ static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value);
/**
* Called to retrieve a property of an object of this type.
* @param[in] index The property index.
* @return The current value of the property.
*/
- static Property::Value GetProperty( BaseObject* object, Property::Index index );
+ static Property::Value GetProperty(BaseObject* object, Property::Index index);
private:
-
//Undefined
- PageTurnView( const PageTurnView& );
+ PageTurnView(const PageTurnView&);
//undefined
PageTurnView& operator=(const PageTurnView& rhs);
protected:
-
- Layer mTurningPageLayer; ///< The layer for the turning page, to avoid possible depth conflict
- Toolkit::ShadowView mShadowView; ///< The shadow view control for shadow casting
- Actor mShadowPlaneBackground; ///< The plane for the shadow to cast on
- Actor mPointLight; ///< The point light used for shadow casting
-
- PageFactory* const mPageFactory; ///< The factory which provides the page actors
- Shader mTurnEffectShader; ///< The group of PageTurnEffects
- Shader mSpineEffectShader; ///< The book spine shader effect
- Geometry mGeometry; ///< The grid geometry for pages
-
- std::vector<Page> mPages; ///< The vector of pages on stage
- std::map<Animation,int> mAnimationPageIdPair; ///< The map to keep track which page actor is the animation act on
-
- Vector2 mPageSize; ///< The page size
- Vector2 mControlSize; ///< The size of the control, it is decided by the page size, the SetSize from application can not change it
- Vector2 mSpineShadowParameter; ///< The spine shadow parameter for all the above shader effects
- Vector2 mOriginalCenter; ///< The original center set to the PageTurnEffect
- Vector2 mCurrentCenter; ///< The current center set to the PageTurnEffect
- Vector2 mPressDownPosition; ///< The first press down position of the pan gesture
-
- float mDistanceUpCorner; ///< The distance between the original center of PageTurnEffect and the top-left corner of the page
- float mDistanceBottomCorner; ///< The distance between the original center of PageTurnEffect and the bottom-left corner of the page
- float mPanDisplacement; ///< The displacement of the pan after the constrains are applied
-
- int mTotalPageCount; ///< The total number of pages provided by the page factory
- int mCurrentPageIndex; ///< The index of the current page, between 0 ~ mTotalPageCount-1
- int mTurningPageIndex; ///< The index of the turning page
- int mIndex; ///< The index to keep track which PanDisplacementProperty, CurrentCenterProperty is used for the current panning page
- int mSlidingCount; ///< The boolean vector to keep track whether there are animating pages sliding back
- int mAnimatingCount; ///< The boolean vector to keep track which PageTurnEffect, PanDisplacementProperty, CurrentCenterProperty is available for using
-
- bool mConstraints; ///< The boolean to keep track the constrains are applied or not
- bool mPress; ///< The boolean to keep track the state of the pageTurnEffect is activated or not
- bool mPageUpdated; ///< The boolean to keep track whether is page is updated after any turning activity
-
- Toolkit::PageTurnView::PageTurnSignal mPageTurnStartedSignal; ///< The signal to notify that a page has started turning
- Toolkit::PageTurnView::PageTurnSignal mPageTurnFinishedSignal; ///< The signal to notify that a page has finished turning
- Toolkit::PageTurnView::PagePanSignal mPagePanStartedSignal; ///< The signal to notify that a page has started panning
- Toolkit::PageTurnView::PagePanSignal mPagePanFinishedSignal; ///< The signal to notify that a page has finished panning
-
- static const char * const PROPERTY_TEXTURE_WIDTH; ///< The uniform name of texture width
- static const char * const PROPERTY_ORIGINAL_CENTER; ///< The property name of original center, which is used to constrain the uniforms
- static const char * const PROPERTY_CURRENT_CENTER; ///< The property name of current center, which is used to constrain the uniforms
-
- static const int MAXIMUM_TURNING_NUM; ///< How many pages are allowed to animating in the same time
- static const int NUMBER_OF_CACHED_PAGES_EACH_SIDE; ///< The maximum number of pages kept, (MAXIMUM_ANIMATION_NUM+1) pages for each side
- static const int NUMBER_OF_CACHED_PAGES; ///< The maximum number of pages kept, (MAXIMUM_ANIMATION_NUM+1)*2 pages in total
- static const float STATIC_PAGE_INTERVAL_DISTANCE; ///< The depth interval between stacked pages (static pages)
+ Layer mTurningPageLayer; ///< The layer for the turning page, to avoid possible depth conflict
+ Toolkit::ShadowView mShadowView; ///< The shadow view control for shadow casting
+ Actor mShadowPlaneBackground; ///< The plane for the shadow to cast on
+ Actor mPointLight; ///< The point light used for shadow casting
+
+ PageFactory* const mPageFactory; ///< The factory which provides the page actors
+ Shader mTurnEffectShader; ///< The group of PageTurnEffects
+ Shader mSpineEffectShader; ///< The book spine shader effect
+ Geometry mGeometry; ///< The grid geometry for pages
+
+ std::vector<Page> mPages; ///< The vector of pages on stage
+ std::map<Animation, int> mAnimationPageIdPair; ///< The map to keep track which page actor is the animation act on
+
+ Vector2 mPageSize; ///< The page size
+ Vector2 mControlSize; ///< The size of the control, it is decided by the page size, the SetSize from application can not change it
+ Vector2 mSpineShadowParameter; ///< The spine shadow parameter for all the above shader effects
+ Vector2 mOriginalCenter; ///< The original center set to the PageTurnEffect
+ Vector2 mCurrentCenter; ///< The current center set to the PageTurnEffect
+ Vector2 mPressDownPosition; ///< The first press down position of the pan gesture
+
+ float mDistanceUpCorner; ///< The distance between the original center of PageTurnEffect and the top-left corner of the page
+ float mDistanceBottomCorner; ///< The distance between the original center of PageTurnEffect and the bottom-left corner of the page
+ float mPanDisplacement; ///< The displacement of the pan after the constrains are applied
+
+ int mTotalPageCount; ///< The total number of pages provided by the page factory
+ int mCurrentPageIndex; ///< The index of the current page, between 0 ~ mTotalPageCount-1
+ int mTurningPageIndex; ///< The index of the turning page
+ int mIndex; ///< The index to keep track which PanDisplacementProperty, CurrentCenterProperty is used for the current panning page
+ int mSlidingCount; ///< The boolean vector to keep track whether there are animating pages sliding back
+ int mAnimatingCount; ///< The boolean vector to keep track which PageTurnEffect, PanDisplacementProperty, CurrentCenterProperty is available for using
+
+ bool mConstraints; ///< The boolean to keep track the constrains are applied or not
+ bool mPress; ///< The boolean to keep track the state of the pageTurnEffect is activated or not
+ bool mPageUpdated; ///< The boolean to keep track whether is page is updated after any turning activity
+
+ Toolkit::PageTurnView::PageTurnSignal mPageTurnStartedSignal; ///< The signal to notify that a page has started turning
+ Toolkit::PageTurnView::PageTurnSignal mPageTurnFinishedSignal; ///< The signal to notify that a page has finished turning
+ Toolkit::PageTurnView::PagePanSignal mPagePanStartedSignal; ///< The signal to notify that a page has started panning
+ Toolkit::PageTurnView::PagePanSignal mPagePanFinishedSignal; ///< The signal to notify that a page has finished panning
+
+ static const char* const PROPERTY_TEXTURE_WIDTH; ///< The uniform name of texture width
+ static const char* const PROPERTY_ORIGINAL_CENTER; ///< The property name of original center, which is used to constrain the uniforms
+ static const char* const PROPERTY_CURRENT_CENTER; ///< The property name of current center, which is used to constrain the uniforms
+
+ static const int MAXIMUM_TURNING_NUM; ///< How many pages are allowed to animating in the same time
+ static const int NUMBER_OF_CACHED_PAGES_EACH_SIDE; ///< The maximum number of pages kept, (MAXIMUM_ANIMATION_NUM+1) pages for each side
+ static const int NUMBER_OF_CACHED_PAGES; ///< The maximum number of pages kept, (MAXIMUM_ANIMATION_NUM+1)*2 pages in total
+ static const float STATIC_PAGE_INTERVAL_DISTANCE; ///< The depth interval between stacked pages (static pages)
};
} // namespace Internal
-
// Helpers for public-api forwarding methods
inline Toolkit::Internal::PageTurnView& GetImplementation(Toolkit::PageTurnView& pub)
#define DALI_TOOLKIT_INTERNAL_CONFIRMATION_POPUP_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
+#include <dali/devel-api/signals/signal-delegate.h>
#include <dali/public-api/animation/animation.h>
#include <dali/public-api/common/dali-vector.h>
-#include <dali/devel-api/signals/signal-delegate.h>
// INTERNAL INCLUDES
-#include "popup-impl.h"
#include <dali-toolkit/devel-api/controls/popup/confirmation-popup.h>
+#include "popup-impl.h"
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
#define MAXIMUM_NUMBER_OF_CONTROLS 2
/**
class ConfirmationPopup : public Dali::Toolkit::Internal::Popup
{
public:
-
/**
* Create a new ConfirmationPopup.
* @return A smart-pointer to the newly allocated ConfirmationPopup.
static Dali::Toolkit::ConfirmationPopup New();
protected:
-
/**
* Construct a new ConfirmationPopup.
*/
virtual ~ConfirmationPopup();
public:
-
/**
* Called when a property of an object of this type is set.
* @param[in] object The object whose property is set.
* @param[in] propertyIndex The property index.
* @param[in] value The new property value.
*/
- static void SetProperty( BaseObject* object, Property::Index propertyIndex, const Property::Value& value );
+ static void SetProperty(BaseObject* object, Property::Index propertyIndex, const Property::Value& value);
/**
* Called to retrieve a property of an object of this type.
* @param[in] propertyIndex The property index.
* @return The current value of the property.
*/
- static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex );
+ static Property::Value GetProperty(BaseObject* object, Property::Index propertyIndex);
/**
* Connects a callback function with the object's signals.
* @return True if the signal was connected.
* @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
*/
- static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
+ static bool DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
private:
-
/**
* This type houses a list of dynamically created signals.
*/
- typedef std::vector< std::pair< std::string, SignalDelegate* > > SignalContainerType;
+ typedef std::vector<std::pair<std::string, SignalDelegate*> > SignalContainerType;
private:
-
/**
* Sets the name of the signal to connect to within the specified actor.
*
* @param[in] controlNumber The index of the control.
* @param[in] signalName The name of the signal to connect to.
*/
- void SetControlSignalName( const unsigned int controlNumber, const std::string& signalName );
+ void SetControlSignalName(const unsigned int controlNumber, const std::string& signalName);
/**
* Gets the name of the signal to connect to within the specified actor.
* @param[in] controlNumber The index of the control.
* @return The name of the signal to connect to.
*/
- std::string GetControlSignalName( unsigned int controlNumber ) const;
+ std::string GetControlSignalName(unsigned int controlNumber) const;
/**
* @copydoc Control::GetControlSignal()
*/
- SignalDelegate* GetControlSignal( const std::string& signalName );
+ SignalDelegate* GetControlSignal(const std::string& signalName);
private:
-
// Undefined
- ConfirmationPopup( const ConfirmationPopup& );
+ ConfirmationPopup(const ConfirmationPopup&);
// Undefined
- ConfirmationPopup& operator=( const ConfirmationPopup& );
+ ConfirmationPopup& operator=(const ConfirmationPopup&);
private:
-
// Properties:
- std::string mControlSignalNames[ MAXIMUM_NUMBER_OF_CONTROLS ]; ///< Stores the names of the signals to connect to per control.
+ std::string mControlSignalNames[MAXIMUM_NUMBER_OF_CONTROLS]; ///< Stores the names of the signals to connect to per control.
// Internal variables:
- SignalContainerType mControlSignals; ///< Stores the dynamically created signals.
-
+ SignalContainerType mControlSignals; ///< Stores the dynamically created signals.
};
} // namespace Internal
-
// Helpers for public-api forwarding methods
-inline Toolkit::Internal::ConfirmationPopup& GetDerivedImplementation( Toolkit::ConfirmationPopup& popup )
+inline Toolkit::Internal::ConfirmationPopup& GetDerivedImplementation(Toolkit::ConfirmationPopup& popup)
{
- DALI_ASSERT_ALWAYS( popup );
+ DALI_ASSERT_ALWAYS(popup);
Dali::RefObject& handle = popup.GetImplementation();
- return static_cast<Toolkit::Internal::ConfirmationPopup&>( handle );
+ return static_cast<Toolkit::Internal::ConfirmationPopup&>(handle);
}
-inline const Toolkit::Internal::ConfirmationPopup& GetDerivedImplementation( const Toolkit::ConfirmationPopup& popup )
+inline const Toolkit::Internal::ConfirmationPopup& GetDerivedImplementation(const Toolkit::ConfirmationPopup& popup)
{
- DALI_ASSERT_ALWAYS( popup );
+ DALI_ASSERT_ALWAYS(popup);
const Dali::RefObject& handle = popup.GetImplementation();
- return static_cast<const Toolkit::Internal::ConfirmationPopup&>( handle );
+ return static_cast<const Toolkit::Internal::ConfirmationPopup&>(handle);
}
-
} // namespace Toolkit
} // namespace Dali
#define DALI_TOOLKIT_INTERNAL_POPUP_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
+#include <dali/devel-api/animation/animation-data.h>
#include <dali/public-api/actors/layer.h>
#include <dali/public-api/adaptor-framework/timer.h>
#include <dali/public-api/animation/animation.h>
-#include <dali/devel-api/animation/animation-data.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali-toolkit/devel-api/controls/table-view/table-view.h>
#include <dali-toolkit/devel-api/controls/popup/popup.h>
+#include <dali-toolkit/devel-api/controls/table-view/table-view.h>
#include <dali-toolkit/internal/controls/control/control-data-impl.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class Popup;
-typedef IntrusivePtr< Popup > PopupPtr;
+typedef IntrusivePtr<Popup> PopupPtr;
/**
* @copydoc Toolkit::Popup
class Popup : public Control
{
public:
-
/**
* Create a new Popup.
* @return A public handle to the newly allocated Popup.
static Dali::Toolkit::Popup New();
public:
-
/**
* @copydoc Toolkit::Popup::SetPopupBackgroundImage
*/
- void SetPopupBackgroundImage( Actor image );
+ void SetPopupBackgroundImage(Actor image);
/**
* @copydoc Toolkit::Popup::GetPopupBackgroundImage
/**
* @copydoc Toolkit::Popup::SetTitle( Actor titleActor )
*/
- void SetTitle( Actor titleActor );
+ void SetTitle(Actor titleActor);
/**
* @copydoc Toolkit::Popup::GetTitle
/**
* @copydoc Toolkit::Popup::SetContent
*/
- void SetContent( Actor content );
+ void SetContent(Actor content);
/**
* @copydoc Toolkit::Popup::GetContent
/**
* @copydoc Toolkit::Popup::SetFooter
*/
- void SetFooter( Actor control );
+ void SetFooter(Actor control);
/**
* @copydoc Toolkit::Popup::GetFooter
/**
* @copydoc Toolkit::Popup::SetDisplayState
*/
- void SetDisplayState( Toolkit::Popup::DisplayState displayState );
+ void SetDisplayState(Toolkit::Popup::DisplayState displayState);
/**
* @copydoc Toolkit::Popup::GetDisplayState
/**
* @copydoc Toolkit::Popup::SetTailVisibility
*/
- void SetTailVisibility( bool visible );
+ void SetTailVisibility(bool visible);
/**
* @copydoc Toolkit::Popup::IsTailVisible
/**
* @copydoc Toolkit::Popup::SetTailPosition
*/
- void SetTailPosition( Vector3 position );
+ void SetTailPosition(Vector3 position);
/**
* @copydoc Toolkit::Popup::GetTailPosition
/**
* @copydoc Toolkit::Popup::SetContextualMode
*/
- void SetContextualMode( Toolkit::Popup::ContextualMode mode );
+ void SetContextualMode(Toolkit::Popup::ContextualMode mode);
/**
* @copydoc Toolkit::Popup::GetContextualMode
/**
* @copydoc Toolkit::Popup::SetAnimationDuration
*/
- void SetAnimationDuration( float duration );
+ void SetAnimationDuration(float duration);
/**
* @copydoc Toolkit::Popup::GetAnimationDuration
/**
* @copydoc Toolkit::Popup::SetAnimationMode
*/
- void SetAnimationMode( Toolkit::Popup::AnimationMode animationMode );
+ void SetAnimationMode(Toolkit::Popup::AnimationMode animationMode);
/**
* @copydoc Toolkit::Popup::GetAnimationMode
/**
* @copydoc Toolkit::Popup::SetAutoHideDelay
*/
- void SetAutoHideDelay( int delay );
+ void SetAutoHideDelay(int delay);
/**
* @copydoc Toolkit::Popup::GetAutoHideDelay
/**
* @copydoc Toolkit::Popup::SetBackingEnabled
*/
- void SetBackingEnabled( bool enabled );
+ void SetBackingEnabled(bool enabled);
/**
* @copydoc Toolkit::Popup::IsBackingEnabled
/**
* @copydoc Toolkit::Popup::SetBackingColor
*/
- void SetBackingColor( Vector4 color );
+ void SetBackingColor(Vector4 color);
/**
* @copydoc Toolkit::Popup::GetBackingColor
/**
* @copydoc Toolkit::Popup::SetTailUpImage
*/
- void SetTailUpImage( std::string image );
+ void SetTailUpImage(std::string image);
/**
* @copydoc Toolkit::Popup::GetTailUpImage
/**
* @copydoc Toolkit::Popup::SetTailDownImage
*/
- void SetTailDownImage( std::string image );
+ void SetTailDownImage(std::string image);
/**
* @copydoc Toolkit::Popup::GetTailDownImage
/**
* @copydoc Toolkit::Popup::SetTailLeftImage
*/
- void SetTailLeftImage( std::string image );
+ void SetTailLeftImage(std::string image);
/**
* @copydoc Toolkit::Popup::GetTailLeftImage
/**
* @copydoc Toolkit::Popup::SetTailRightImage
*/
- void SetTailRightImage( std::string image );
+ void SetTailRightImage(std::string image);
/**
* @copydoc Toolkit::Popup::GetTailRightImage
* @param[in] propertyIndex The property index.
* @param[in] value The new property value.
*/
- static void SetProperty( BaseObject* object, Property::Index propertyIndex, const Property::Value& value );
+ static void SetProperty(BaseObject* object, Property::Index propertyIndex, const Property::Value& value);
/**
* Called to retrieve a property of an object of this type.
* @param[in] propertyIndex The property index.
* @return The current value of the property.
*/
- static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex );
+ static Property::Value GetProperty(BaseObject* object, Property::Index propertyIndex);
protected:
struct AccessibleImpl : public Control::Impl::AccessibleImpl
{
using Control::Impl::AccessibleImpl::AccessibleImpl;
- std::string GetNameRaw() override;
+ std::string GetNameRaw() override;
Dali::Accessibility::States CalculateStates() override;
};
virtual ~Popup();
private:
-
/**
* @brief Creates the layout of the popup, to be done just before showing for the first time.
* Also calls OnLayoutSetup() to allow derived classes to perform layout at this stage.
* If contextual mode is not enabled, this method has no effect.
* @param[in] size The Popups current size (can be accessed from within the OnRelayout() method).
*/
- void LayoutContext( const Vector2& size );
+ void LayoutContext(const Vector2& size);
/**
* @brief All transition-in animation setup and layout is done here.
* @param[in] transitionIn True to perform a transition-in, false for transition out.
* @param[in] instantaneous Optional - If set to true will override the duration to provide an instant animation.
*/
- void StartTransitionAnimation( bool transitionIn, bool instantaneous = false );
+ void StartTransitionAnimation(bool transitionIn, bool instantaneous = false);
/**
* @brief Invoked once a display state change has completed.
*
* @param[in] enabled Set to true to make the popup touch-transparent.
*/
- void SetTouchTransparent( bool enabled );
+ void SetTouchTransparent(bool enabled);
/**
* @brief Returns if the popup allows touch events to pass through or not.
*
* @param[in] map A Property::Map containing a description of an animation
*/
- void SetEntryAnimationData( const Property::Map& map );
+ void SetEntryAnimationData(const Property::Map& map);
/**
* @brief Allows the popup exit animation to be setup from a Property::Map that could
*
* @param[in] map A Property::Map containing a description of an animation
*/
- void SetExitAnimationData( const Property::Map& map );
+ void SetExitAnimationData(const Property::Map& map);
/**
* @briefs Updates the popup background's position and size.
void UpdateBackgroundPositionAndSize();
public: // Signals
-
/**
* @copydoc Dali::Toolkit::Popup::OutsideTouchedSignal()
*/
* @return True if the signal was connected.
* @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
*/
- static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
+ static bool DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
private:
-
/**
* Signal occurs when the State animation (transition from hide <-> show) finishes.
* @param[in] source The animation that just finished.
*/
- void OnDisplayChangeAnimationFinished( Animation& source );
+ void OnDisplayChangeAnimationFinished(Animation& source);
/**
* Signal occurs when the dimmed backing for the Popup is touched.
* @param[in] touch The Touch Data.
* @return Whether to consume event or not.
*/
- bool OnDialogTouched( Actor actor, const TouchEvent& touch );
+ bool OnDialogTouched(Actor actor, const TouchEvent& touch);
/**
* @copydoc Toolkit::Control::OnInitialize()
* Normally due to a change in contents.
* Note: This is only done when the popup is shown.
*/
- virtual void OnLayoutSetup() {}
+ virtual void OnLayoutSetup()
+ {
+ }
/**
* Called when the popup is directly or indirectly parented to the stage.
*/
- void OnSceneConnection( int depth ) override;
+ void OnSceneConnection(int depth) override;
/**
* From Control; called after a child has been added to the owning actor.
* @param[in] child The child which has been added.
*/
- void OnChildAdd( Actor& child ) override;
+ void OnChildAdd(Actor& child) override;
/**
* @copydoc Control::OnRelayOut()
*/
- void OnRelayout( const Vector2& size, RelayoutContainer& container ) override;
+ void OnRelayout(const Vector2& size, RelayoutContainer& container) override;
/**
* @copydoc Control::OnSetResizePolicy()
*/
- void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension ) override;
+ void OnSetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension) override;
/**
* @copydoc Control::GetNaturalSize()
/**
* @copydoc Control::GetHeightForWidth()
*/
- float GetHeightForWidth( float width ) override;
+ float GetHeightForWidth(float width) override;
/**
* @copydoc Control::GetWidthForHeight()
*/
- float GetWidthForHeight( float height ) override;
+ float GetWidthForHeight(float height) override;
/**
* @copydoc Control::OnKeyEvent()
*/
- bool OnKeyEvent( const KeyEvent& event ) override;
+ bool OnKeyEvent(const KeyEvent& event) override;
/**
* @copydoc Control::GetNextKeyboardFocusableActor()
*/
- Actor GetNextKeyboardFocusableActor( Actor currentFocusedActor, Toolkit::Control::KeyboardFocus::Direction direction, bool loopEnabled );
+ Actor GetNextKeyboardFocusableActor(Actor currentFocusedActor, Toolkit::Control::KeyboardFocus::Direction direction, bool loopEnabled);
private:
-
/**
* Recursively add any focusable actors or layout containers to the provided vector.
* Include the top level actor if it is a layout container.
* @param[in] parent The actor to start from
* @param[in/out] focusableActors The vector to add focusable actors to
*/
- void AddFocusableChildren( Actor parent, std::vector< Actor >& focusableActors );
+ void AddFocusableChildren(Actor parent, std::vector<Actor>& focusableActors);
/**
* Recursively add any focusable actors or layout containers to the provided vector.
* @param[in] parent The actor to start from
* @param[in/out] focusableActors The vector to add focusable actors to
*/
- void AddFocusableChildrenRecursive( Actor parent, std::vector< Actor >& focusableActors );
+ void AddFocusableChildrenRecursive(Actor parent, std::vector<Actor>& focusableActors);
/**
* Sets up the touch signals connections as required.
void SetupTouch();
private:
-
// Undefined.
Popup(const Popup&);
Popup& operator=(const Popup& rhs);
private:
-
Toolkit::Popup::TouchedOutsideSignalType mTouchedOutsideSignal;
Toolkit::Popup::DisplayStateChangeSignalType mShowingSignal;
Toolkit::Popup::DisplayStateChangeSignalType mShownSignal;
Toolkit::Popup::DisplayStateChangeSignalType mHidingSignal;
Toolkit::Popup::DisplayStateChangeSignalType mHiddenSignal;
- Layer mLayer; ///< Popup Layer (i.e. Dim backing and PopupBg reside in this).
- Toolkit::TableView mPopupLayout; ///< Popup Background (i.e. dialog reside in this).
- Toolkit::Control mBacking; ///< Backing actor (dim effect).
- Actor mPreviousFocusedActor; ///< Store the previous focused actor to restore the focus when popup hide.
- Actor mTailImage; ///< Stores the tail image.
- Actor mPopupContainer; ///< This actor is used to house the background image and the main popup layout.
- Animation mAnimation; ///< The current animation in use used to manage display state changing.
- bool mAlterAddedChild; ///< Flag used to control whether children are reparented or not.
- bool mLayoutDirty; ///< Set to true whenever any property that would require a layout update is modified.
- Timer mAutoHideTimer; ///< Used to perform an auto-hide of the popup if desired.
- bool mTouchTransparent; ///< Allows all events to pass through the popup.
+ Layer mLayer; ///< Popup Layer (i.e. Dim backing and PopupBg reside in this).
+ Toolkit::TableView mPopupLayout; ///< Popup Background (i.e. dialog reside in this).
+ Toolkit::Control mBacking; ///< Backing actor (dim effect).
+ Actor mPreviousFocusedActor; ///< Store the previous focused actor to restore the focus when popup hide.
+ Actor mTailImage; ///< Stores the tail image.
+ Actor mPopupContainer; ///< This actor is used to house the background image and the main popup layout.
+ Animation mAnimation; ///< The current animation in use used to manage display state changing.
+ bool mAlterAddedChild; ///< Flag used to control whether children are reparented or not.
+ bool mLayoutDirty; ///< Set to true whenever any property that would require a layout update is modified.
+ Timer mAutoHideTimer; ///< Used to perform an auto-hide of the popup if desired.
+ bool mTouchTransparent; ///< Allows all events to pass through the popup.
// Main Content related properties:
- Actor mTitle; ///< Stores the text title.
- Actor mContent; ///< Stores the unselected content.
- Actor mFooter; ///< Stores the footer content (typically controls).
+ Actor mTitle; ///< Stores the text title.
+ Actor mContent; ///< Stores the unselected content.
+ Actor mFooter; ///< Stores the footer content (typically controls).
// Display related properties.
- Toolkit::Popup::DisplayState mDisplayState; ///< The current display state of the popup.
- bool mTailVisible; ///< True if the popup tail should be visible.
- Vector3 mTailPosition; ///< The position of the tail.
- Toolkit::Popup::ContextualMode mContextualMode; ///< Allows the popup to be layed out adjacent to its parent in different directions.
- float mAnimationDuration; ///< The duration of the transition in and out animations.
- Toolkit::Popup::AnimationMode mAnimationMode; ///< The animation to use to transition in and out.
- Dali::AnimationData mEntryAnimationData; ///< Stores description data that can be used for generating a custom entry animation.
- Dali::AnimationData mExitAnimationData; ///< Stores description data that can be used for generating a custom exit animation.
- unsigned int mAutoHideDelay; ///< If set, will auto-hide the popup after a specified amount of time.
+ Toolkit::Popup::DisplayState mDisplayState; ///< The current display state of the popup.
+ bool mTailVisible; ///< True if the popup tail should be visible.
+ Vector3 mTailPosition; ///< The position of the tail.
+ Toolkit::Popup::ContextualMode mContextualMode; ///< Allows the popup to be layed out adjacent to its parent in different directions.
+ float mAnimationDuration; ///< The duration of the transition in and out animations.
+ Toolkit::Popup::AnimationMode mAnimationMode; ///< The animation to use to transition in and out.
+ Dali::AnimationData mEntryAnimationData; ///< Stores description data that can be used for generating a custom entry animation.
+ Dali::AnimationData mExitAnimationData; ///< Stores description data that can be used for generating a custom exit animation.
+ unsigned int mAutoHideDelay; ///< If set, will auto-hide the popup after a specified amount of time.
// Style related properties:
- bool mBackingEnabled; ///< True if a dimmed backing will be used.
- Vector4 mBackingColor; ///< The color of the backing.
- Actor mPopupBackgroundImage; ///< Stores the background image.
- Rect<int> mBackgroundBorder; ///< Background border.
- float mMargin; ///< Internal margin for popup contents.
- std::string mTailUpImage; ///< Image used for the tail for the up direction.
- std::string mTailDownImage; ///< Image used for the tail for the down direction.
- std::string mTailLeftImage; ///< Image used for the tail for the left direction.
- std::string mTailRightImage; ///< Image used for the tail for the right direction.
+ bool mBackingEnabled; ///< True if a dimmed backing will be used.
+ Vector4 mBackingColor; ///< The color of the backing.
+ Actor mPopupBackgroundImage; ///< Stores the background image.
+ Rect<int> mBackgroundBorder; ///< Background border.
+ float mMargin; ///< Internal margin for popup contents.
+ std::string mTailUpImage; ///< Image used for the tail for the up direction.
+ std::string mTailDownImage; ///< Image used for the tail for the down direction.
+ std::string mTailLeftImage; ///< Image used for the tail for the left direction.
+ std::string mTailRightImage; ///< Image used for the tail for the right direction.
};
} // namespace Internal
// Helpers for public-api forwarding methods
-inline Toolkit::Internal::Popup& GetImpl( Toolkit::Popup& publicObject )
+inline Toolkit::Internal::Popup& GetImpl(Toolkit::Popup& publicObject)
{
- DALI_ASSERT_ALWAYS( publicObject );
+ DALI_ASSERT_ALWAYS(publicObject);
Dali::RefObject& handle = publicObject.GetImplementation();
- return static_cast<Toolkit::Internal::Popup&>( handle );
+ return static_cast<Toolkit::Internal::Popup&>(handle);
}
-inline const Toolkit::Internal::Popup& GetImpl( const Toolkit::Popup& publicObject )
+inline const Toolkit::Internal::Popup& GetImpl(const Toolkit::Popup& publicObject)
{
- DALI_ASSERT_ALWAYS( publicObject );
+ DALI_ASSERT_ALWAYS(publicObject);
const Dali::RefObject& handle = publicObject.GetImplementation();
- return static_cast<const Toolkit::Internal::Popup&>( handle );
+ return static_cast<const Toolkit::Internal::Popup&>(handle);
}
} // namespace Toolkit
#define DALI_TOOLKIT_INTERNAL_PROGRESS_BAR_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali/public-api/animation/animation.h>
-#include <dali-toolkit/public-api/controls/progress-bar/progress-bar.h>
#include <dali-toolkit/devel-api/controls/progress-bar/progress-bar-devel.h>
#include <dali-toolkit/devel-api/visual-factory/transition-data.h>
#include <dali-toolkit/internal/controls/control/control-data-impl.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali-toolkit/public-api/controls/progress-bar/progress-bar.h>
+#include <dali/public-api/animation/animation.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class ProgressBar;
-typedef Dali::IntrusivePtr< ProgressBar > ProgressBarPtr;
+typedef Dali::IntrusivePtr<ProgressBar> ProgressBarPtr;
/**
* @copydoc Toolkit::ProgressBar
class ProgressBar : public Control
{
public:
-
/**
* Create a new ProgressBar with predefined style.
* @param[in] progressBarStyle A style value that determines the shape of the progress bar.
* @return A public handle to the newly allocated ProgressBar.
*/
- static Dali::Toolkit::ProgressBar New( DevelProgressBar::Style progressBarStyle = DevelProgressBar::Style::LINEAR );
+ static Dali::Toolkit::ProgressBar New(DevelProgressBar::Style progressBarStyle = DevelProgressBar::Style::LINEAR);
public:
-
// Properties
/**
*
* @param[in] value The value to set. Will be clamped to [lowerBound .. upperBound]
*/
- void SetProgressValue( float value );
+ void SetProgressValue(float value);
/**
* Get the value of the ProgressBar
*
* @param[in] value The secondary progress value to set. Will be clamped to [lowerBound .. upperBound]
*/
- void SetSecondaryProgressValue( float value );
+ void SetSecondaryProgressValue(float value);
/**
* Get the secondary progress value of the ProgressBar
*
* @param[in] value The value to set.
*/
- void SetIndeterminate( bool value );
+ void SetIndeterminate(bool value);
/**
* Get the indeterminate state value of the ProgressBar
*
* @param[in] Transition data map to set.
*/
- void SetIndeterminateVisualTransition( Property::Map transtion );
+ void SetIndeterminateVisualTransition(Property::Map transtion);
/**
* Get the indeterminate visual transition data map of the ProgressBar
*/
Toolkit::ProgressBar::ValueChangedSignalType& ValueChangedSignal();
-
/**
* Connects a callback function with the object's signals.
* @param[in] object The object providing the signal.
* @return True if the signal was connected.
* @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
*/
- static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName,
- FunctorDelegate* functor );
+ static bool DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
// Properties
* @param[in] index The property index.
* @param[in] value The new property value.
*/
- static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
+ static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value);
/**
* Called to retrieve a property of an object of this type.
* @param[in] index The property index.
* @return The current value of the property.
*/
- static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex );
+ static Property::Value GetProperty(BaseObject* object, Property::Index propertyIndex);
protected:
-
/**
* Construct a new ProgressBar.
*/
/**
* @copydoc CustomActorImpl::OnRelayout()
*/
- void OnRelayout( const Vector2& size, RelayoutContainer& container ) override;
+ void OnRelayout(const Vector2& size, RelayoutContainer& container) override;
/**
* @copydoc CustomActorImpl::GetNaturalSize()
Vector3 GetNaturalSize() override;
private:
-
/**
* Domain is a from/to pair
*/
Domain()
{
}
- Domain( Vector2 fromVal, Vector2 toVal )
- : from( fromVal ), to( toVal )
+ Domain(Vector2 fromVal, Vector2 toVal)
+ : from(fromVal),
+ to(toVal)
{
}
};
private:
-
/**
* @copydoc Toolkit::Control::OnInitialize()
*/
* @param[in] currentSize The current size of the ProgressBar
* @return The range as a domain pair
*/
- Domain CalcDomain( const Vector2& currentSize );
+ Domain CalcDomain(const Vector2& currentSize);
/**
* Set indeterminate visual transition animation
*/
- void SetIndeterminateVisualTransition( Toolkit::TransitionData transtion );
+ void SetIndeterminateVisualTransition(Toolkit::TransitionData transtion);
/**
* Convert value to transition data
*/
- Toolkit::TransitionData ConvertPropertyToTransition( const Property::Value& value );
+ Toolkit::TransitionData ConvertPropertyToTransition(const Property::Value& value);
/**
* Update progress bar label when progress value is changed
*/
- void CreateVisualsForComponent( Property::Index index, const Property::Value& value, const int visualDepth );
+ void CreateVisualsForComponent(Property::Index index, const Property::Value& value, const int visualDepth);
/**
* Update progress bar label when progress value is changed
*/
- bool GetPropertyMapForVisual( Property::Index visualIndex, Property::Map& retreivedMap ) const;
+ bool GetPropertyMapForVisual(Property::Index visualIndex, Property::Map& retreivedMap) const;
/**
* Apply progress value to visual
*/
- void ApplyProgressToVisual( float progress, Property::Index index, int depth );
+ void ApplyProgressToVisual(float progress, Property::Index index, int depth);
/**
* Apply progress value to visual transform
*/
- void ApplyProgressToVisualTransform( float progress, Vector2 trackSize, Property::Index index );
+ void ApplyProgressToVisualTransform(float progress, Vector2 trackSize, Property::Index index);
/**
* Check if we should start animating
*/
- void OnSceneConnection( int depth ) override;
+ void OnSceneConnection(int depth) override;
private:
-
// Undefined
- ProgressBar( const ProgressBar& );
+ ProgressBar(const ProgressBar&);
// Undefined
- ProgressBar& operator=( const ProgressBar& rhs );
+ ProgressBar& operator=(const ProgressBar& rhs);
private:
+ Domain mDomain; ///< Current domain of the handle
- Domain mDomain; ///< Current domain of the handle
-
- Animation mIndeterminateVisualAni; ///< Animation for indetrminate visual. Transition animation.
- Toolkit::ProgressBar::ValueChangedSignalType mValueChangedSignal; ///< Signal emitted when the value is changed
+ Animation mIndeterminateVisualAni; ///< Animation for indetrminate visual. Transition animation.
+ Toolkit::ProgressBar::ValueChangedSignalType mValueChangedSignal; ///< Signal emitted when the value is changed
- Toolkit::TransitionData mIndeterminateVisualTransition; ///< Transition data map for mIndeterminateVisualAni
- float mProgressValue; ///< Current value of ProgressBar
- float mSecondaryProgressValue; ///< Current loading value of ProgressBar
- bool mIndeterminate; ///< Whether the progress state is determined or not
- Property::Map mTrackVisualMap; ///< To backup visual properties when switching determinate/indeterminate.
- Property::Map mProgressVisualMap; ///< To backup visual properties when switching determinate/indeterminate.
- Property::Map mSecondaryProgressVisualMap; ///< To backup visual properties when switching determinate/indeterminate.
+ Toolkit::TransitionData mIndeterminateVisualTransition; ///< Transition data map for mIndeterminateVisualAni
+ float mProgressValue; ///< Current value of ProgressBar
+ float mSecondaryProgressValue; ///< Current loading value of ProgressBar
+ bool mIndeterminate; ///< Whether the progress state is determined or not
+ Property::Map mTrackVisualMap; ///< To backup visual properties when switching determinate/indeterminate.
+ Property::Map mProgressVisualMap; ///< To backup visual properties when switching determinate/indeterminate.
+ Property::Map mSecondaryProgressVisualMap; ///< To backup visual properties when switching determinate/indeterminate.
protected:
struct AccessibleImpl : public Control::Impl::AccessibleImpl,
double GetMinimum() override;
double GetCurrent() override;
double GetMaximum() override;
- bool SetCurrent( double ) override;
+ bool SetCurrent(double) override;
double GetMinimumIncrement() override;
};
};
// Helpers for public-api forwarding methods
-inline Toolkit::Internal::ProgressBar& GetImpl( Toolkit::ProgressBar& pub )
+inline Toolkit::Internal::ProgressBar& GetImpl(Toolkit::ProgressBar& pub)
{
- DALI_ASSERT_ALWAYS( pub );
+ DALI_ASSERT_ALWAYS(pub);
Dali::RefObject& handle = pub.GetImplementation();
- return static_cast< Toolkit::Internal::ProgressBar& >( handle );
+ return static_cast<Toolkit::Internal::ProgressBar&>(handle);
}
-inline const Toolkit::Internal::ProgressBar& GetImpl( const Toolkit::ProgressBar& pub )
+inline const Toolkit::Internal::ProgressBar& GetImpl(const Toolkit::ProgressBar& pub)
{
- DALI_ASSERT_ALWAYS( pub );
+ DALI_ASSERT_ALWAYS(pub);
const Dali::RefObject& handle = pub.GetImplementation();
- return static_cast< const Toolkit::Internal::ProgressBar& >( handle );
+ return static_cast<const Toolkit::Internal::ProgressBar&>(handle);
}
} // namespace Toolkit
#define DALI_TOOLKIT_INTERNAL_GLTF_LOADER_H\r
\r
/*\r
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.\r
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
*\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
\r
// EXTERNAL INCLUDES\r
#include <dali/public-api/actors/layer.h>\r
+#include <dali/public-api/animation/animation.h>\r
#include <dali/public-api/rendering/renderer.h>\r
#include <dali/public-api/rendering/shader.h>\r
-#include <dali/public-api/animation/animation.h>\r
\r
// INTERNAL INCLUDES\r
#include <dali-toolkit/devel-api/builder/json-parser.h>\r
\r
namespace Dali\r
{\r
-\r
namespace Toolkit\r
{\r
-\r
namespace Internal\r
{\r
-\r
namespace Gltf\r
{\r
-\r
enum ShaderType\r
{\r
NO_TEXTURE_SHADER,\r
struct BufferInfo\r
{\r
BufferInfo()\r
- : byteLength( -1 ),\r
- uri( "" ),\r
- name( "" )\r
+ : byteLength(-1),\r
+ uri(""),\r
+ name("")\r
{\r
}\r
\r
{\r
}\r
\r
- int32_t byteLength;\r
+ int32_t byteLength;\r
std::string uri;\r
std::string name;\r
};\r
struct BufferViewInfo\r
{\r
BufferViewInfo()\r
- : buffer( -1 ),\r
- byteOffset( 0 ),\r
- byteLength( 0 ),\r
- byteStride( 0 ),\r
- target( 0 ),\r
- name( "" )\r
+ : buffer(-1),\r
+ byteOffset(0),\r
+ byteLength(0),\r
+ byteStride(0),\r
+ target(0),\r
+ name("")\r
{\r
}\r
\r
{\r
}\r
\r
- int32_t buffer;\r
- int32_t byteOffset;\r
- int32_t byteLength;\r
- int32_t byteStride;\r
- int32_t target;\r
+ int32_t buffer;\r
+ int32_t byteOffset;\r
+ int32_t byteLength;\r
+ int32_t byteStride;\r
+ int32_t target;\r
std::string name;\r
};\r
\r
struct TextureInfo\r
{\r
TextureInfo()\r
- : sourceIdx( -1 ),\r
- samplerIdx( -1 )\r
+ : sourceIdx(-1),\r
+ samplerIdx(-1)\r
{\r
}\r
\r
struct PbrTextureInfo\r
{\r
PbrTextureInfo()\r
- : index( -1 ),\r
- texCoord( 0 ),\r
- value( 0.0 )\r
+ : index(-1),\r
+ texCoord(0),\r
+ value(0.0)\r
{\r
}\r
~PbrTextureInfo()\r
\r
int32_t index;\r
int32_t texCoord;\r
- float value;\r
+ float value;\r
};\r
\r
struct MaterialInfo\r
{\r
MaterialInfo()\r
- : baseColorFactor( 1, 1, 1, 1 ),\r
- metallicFactor( 1.0 ),\r
- roughnessFactor( 1.0 ),\r
- emissiveFactor( 0.0, 0.0, 0.0 ),\r
- alphaMode( "OPAQUE" ),\r
- alphaCutoff( 0.5 ),\r
- doubleSided( false ),\r
- name( "" )\r
+ : baseColorFactor(1, 1, 1, 1),\r
+ metallicFactor(1.0),\r
+ roughnessFactor(1.0),\r
+ emissiveFactor(0.0, 0.0, 0.0),\r
+ alphaMode("OPAQUE"),\r
+ alphaCutoff(0.5),\r
+ doubleSided(false),\r
+ name("")\r
{\r
}\r
\r
{\r
}\r
\r
- Vector4 baseColorFactor;\r
- float metallicFactor;\r
- float roughnessFactor;\r
- Vector3 emissiveFactor;\r
+ Vector4 baseColorFactor;\r
+ float metallicFactor;\r
+ float roughnessFactor;\r
+ Vector3 emissiveFactor;\r
std::string alphaMode;\r
- float alphaCutoff;\r
- bool doubleSided;\r
+ float alphaCutoff;\r
+ bool doubleSided;\r
\r
PbrTextureInfo baseColorTexture;\r
PbrTextureInfo metallicRoughnessTexture;\r
struct AccessorInfo\r
{\r
AccessorInfo()\r
- : bufferView( -1 ),\r
- byteOffset( 0 ),\r
- componentType( -1 ),\r
- normalized( false ),\r
- count( 0 ),\r
- type( "" ),\r
- max( 0 ),\r
- min( 0 ),\r
- name( "" )\r
+ : bufferView(-1),\r
+ byteOffset(0),\r
+ componentType(-1),\r
+ normalized(false),\r
+ count(0),\r
+ type(""),\r
+ max(0),\r
+ min(0),\r
+ name("")\r
{\r
}\r
\r
{\r
}\r
\r
- int32_t bufferView;\r
- int32_t byteOffset;\r
- int32_t componentType;\r
- bool normalized;\r
- int32_t count;\r
+ int32_t bufferView;\r
+ int32_t byteOffset;\r
+ int32_t componentType;\r
+ bool normalized;\r
+ int32_t count;\r
std::string type;\r
- int32_t max;\r
- int32_t min;\r
+ int32_t max;\r
+ int32_t min;\r
std::string name;\r
//need to add max, min\r
};\r
struct Attribute\r
{\r
Attribute()\r
- : POSITION( -1 ),\r
- NORMAL( -1 ),\r
- TANGENT( -1 )\r
+ : POSITION(-1),\r
+ NORMAL(-1),\r
+ TANGENT(-1)\r
{\r
}\r
\r
struct MeshInfo\r
{\r
MeshInfo()\r
- : indicesIdx( -1 ),\r
- materialsIdx( -1 ),\r
- mode( 4 )\r
+ : indicesIdx(-1),\r
+ materialsIdx(-1),\r
+ mode(4)\r
{\r
}\r
\r
~MeshInfo()\r
{\r
}\r
- Geometry geometry;\r
+ Geometry geometry;\r
std::string name;\r
\r
int32_t indicesIdx;\r
struct AnimationChannelInfo\r
{\r
AnimationChannelInfo()\r
- : sampler( -1 ),\r
- targetNode( -1 ),\r
- path( "" )\r
+ : sampler(-1),\r
+ targetNode(-1),\r
+ path("")\r
{\r
}\r
\r
{\r
}\r
\r
- int32_t sampler;\r
- int32_t targetNode;\r
+ int32_t sampler;\r
+ int32_t targetNode;\r
std::string path;\r
-\r
};\r
\r
struct AnimationSamplerInfo\r
{\r
AnimationSamplerInfo()\r
- : input( -1 ),\r
- output( -1 ),\r
- interpolation( "" )\r
+ : input(-1),\r
+ output(-1),\r
+ interpolation("")\r
{\r
}\r
\r
{\r
}\r
\r
- int32_t input;\r
- int32_t output;\r
+ int32_t input;\r
+ int32_t output;\r
std::string interpolation;\r
};\r
\r
struct AnimationInfo\r
{\r
AnimationInfo()\r
- : name( "" )\r
+ : name("")\r
{\r
}\r
\r
{\r
}\r
\r
- std::string name;\r
+ std::string name;\r
std::vector<AnimationChannelInfo> channelArray;\r
std::vector<AnimationSamplerInfo> samplerArray;\r
};\r
struct OrthographicInfo\r
{\r
OrthographicInfo()\r
- : xmag( 0.0f ),\r
- ymag( 0.0f ),\r
- zfar( 0.0f ),\r
- znear( 0.0f )\r
+ : xmag(0.0f),\r
+ ymag(0.0f),\r
+ zfar(0.0f),\r
+ znear(0.0f)\r
{\r
}\r
\r
struct PerspectiveInfo\r
{\r
PerspectiveInfo()\r
- : aspectRatio( 0.0f ),\r
- yfov( 0.0f ),\r
- zfar( 0.0f ),\r
- znear( 0.0f )\r
+ : aspectRatio(0.0f),\r
+ yfov(0.0f),\r
+ zfar(0.0f),\r
+ znear(0.0f)\r
{\r
}\r
\r
struct CameraInfo\r
{\r
CameraInfo()\r
- : name( "" ),\r
- type( "" )\r
+ : name(""),\r
+ type("")\r
{\r
}\r
\r
{\r
}\r
\r
- std::string name;\r
- std::string type;\r
+ std::string name;\r
+ std::string type;\r
OrthographicInfo orthographic;\r
- PerspectiveInfo perspective;\r
+ PerspectiveInfo perspective;\r
};\r
\r
/**\r
class Loader\r
{\r
public:\r
-\r
/**\r
* @brief Create an uninitialized Loader.\r
*/\r
* @param[in] scene3dView Scene3dView data loaded from file.\r
* @return true if scene is successfully loaded\r
*/\r
- bool LoadScene( const std::string& filePath, Internal::Scene3dView& scene3dView );\r
+ bool LoadScene(const std::string& filePath, Internal::Scene3dView& scene3dView);\r
\r
private:\r
- bool ParseGltf( const std::string& filePath );\r
+ bool ParseGltf(const std::string& filePath);\r
bool LoadAssets();\r
\r
- bool CreateScene( Internal::Scene3dView& scene3dView );\r
+ bool CreateScene(Internal::Scene3dView& scene3dView);\r
\r
- void LoadCamera( Scene3dView& scene3dView );\r
- bool LoadOrthoGraphic( const TreeNode& camera, CameraInfo& cameraInfo );\r
- bool LoadPerspective( const TreeNode& camera, CameraInfo& cameraInfo );\r
+ void LoadCamera(Scene3dView& scene3dView);\r
+ bool LoadOrthoGraphic(const TreeNode& camera, CameraInfo& cameraInfo);\r
+ bool LoadPerspective(const TreeNode& camera, CameraInfo& cameraInfo);\r
\r
- bool LoadSceneNodes( Scene3dView& scene3dView );\r
- Actor AddNode( Scene3dView& scene3dView, uint32_t index );\r
- void SetActorCache( Actor& actor, uint32_t index );\r
- bool SetTextureAndSampler( TextureSet& textureSet, int32_t textureIdx, std::string& toShader, std::string shader, int32_t& addIdx );\r
+ bool LoadSceneNodes(Scene3dView& scene3dView);\r
+ Actor AddNode(Scene3dView& scene3dView, uint32_t index);\r
+ void SetActorCache(Actor& actor, uint32_t index);\r
+ bool SetTextureAndSampler(TextureSet& textureSet, int32_t textureIdx, std::string& toShader, std::string shader, int32_t& addIdx);\r
\r
- bool LoadAnimation( Scene3dView& scene3dView );\r
- bool LoadAnimationChannels( const TreeNode& animation, AnimationInfo& animationInfo );\r
- bool LoadAnimationSamplers( const TreeNode& animation, AnimationInfo& animationInfo );\r
+ bool LoadAnimation(Scene3dView& scene3dView);\r
+ bool LoadAnimationChannels(const TreeNode& animation, AnimationInfo& animationInfo);\r
+ bool LoadAnimationSamplers(const TreeNode& animation, AnimationInfo& animationInfo);\r
\r
private:\r
Dali::Toolkit::JsonParser mParser;\r
- const TreeNode* mNodes;\r
- const TreeNode* mRoot;\r
+ const TreeNode* mNodes;\r
+ const TreeNode* mRoot;\r
\r
std::string mPath;\r
\r
std::vector<Actor> mActorCache;\r
- Shader mShaderCache[ShaderType::SHADER_TYPE_MAX + 1];\r
+ Shader mShaderCache[ShaderType::SHADER_TYPE_MAX + 1];\r
\r
- std::vector<BufferInfo> mBufferArray;\r
+ std::vector<BufferInfo> mBufferArray;\r
std::vector<BufferViewInfo> mBufferViewArray;\r
- std::vector<AccessorInfo> mAccessorArray;\r
+ std::vector<AccessorInfo> mAccessorArray;\r
\r
- std::vector<MeshInfo> mMeshArray;\r
+ std::vector<MeshInfo> mMeshArray;\r
std::vector<MaterialInfo> mMaterialArray;\r
- std::vector<TextureInfo> mTextureArray;\r
+ std::vector<TextureInfo> mTextureArray;\r
\r
std::vector<Texture> mSourceArray;\r
std::vector<Sampler> mSamplerArray;\r
};\r
\r
-}//namespace Gltf\r
+} //namespace Gltf\r
\r
-}//namespace Internal\r
+} //namespace Internal\r
\r
-}//namespace Toolkit\r
+} //namespace Toolkit\r
\r
-}//namespace Dali\r
+} //namespace Dali\r
\r
#endif // DALI_TOOLKIT_INTERNAL_GLTF_LOADER_H\r
#define DALI_TOOLKIT_INTERNAL_SCENE3D_VIEW_H\r
\r
/*\r
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.\r
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
*\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
*/\r
\r
// EXTERNAL INCLUDES\r
-#include <cstring>\r
+#include <dali/devel-api/adaptor-framework/file-loader.h>\r
+#include <dali/devel-api/adaptor-framework/image-loading.h>\r
#include <dali/public-api/object/base-object.h>\r
#include <dali/public-api/rendering/shader.h>\r
-#include <dali/devel-api/adaptor-framework/image-loading.h>\r
-#include <dali/devel-api/adaptor-framework/file-loader.h>\r
+#include <cstring>\r
\r
// INTERNAL INCLUDES\r
-#include <dali-toolkit/public-api/controls/control-impl.h>\r
#include <dali-toolkit/devel-api/controls/scene3d-view/scene3d-view.h>\r
#include <dali-toolkit/internal/controls/scene3d-view/gltf-loader.h>\r
+#include <dali-toolkit/public-api/controls/control-impl.h>\r
\r
namespace Dali\r
{\r
-\r
namespace Toolkit\r
{\r
-\r
class Scene3dView;\r
\r
namespace Internal\r
{\r
-\r
namespace Gltf\r
{\r
-\r
class Loader;\r
\r
}\r
class Scene3dView : public Control\r
{\r
public:\r
-\r
enum CubeType\r
{\r
- CROSS_HORIZONTAL = 0, // Cross horizontal style cube map\r
- ARRAY_HORIZONTAL, // array horizontal style cube map\r
+ CROSS_HORIZONTAL = 0, // Cross horizontal style cube map\r
+ ARRAY_HORIZONTAL, // array horizontal style cube map\r
NONE\r
};\r
\r
-\r
/**\r
* @copydoc Dali::Toolkit::Scene3dView::Scene3dView\r
*/\r
/**\r
* @copydoc Dali::Toolkit::Scene3dView::New( const std::string& filePath )\r
*/\r
- static Dali::Toolkit::Scene3dView New( const std::string& filePath );\r
+ static Dali::Toolkit::Scene3dView New(const std::string& filePath);\r
\r
/**\r
* @copydoc Dali::Toolkit::Scene3dView::New( const std::string& filePath, const std::string& diffuseTexturePath, const std::string& specularTexturePath, Vector4 scaleFactor )\r
*/\r
- static Dali::Toolkit::Scene3dView New( const std::string& filePath, const std::string& diffuseTexturePath, const std::string& specularTexturePath, Vector4 scaleFactor );\r
+ static Dali::Toolkit::Scene3dView New(const std::string& filePath, const std::string& diffuseTexturePath, const std::string& specularTexturePath, Vector4 scaleFactor);\r
\r
/**\r
* @copydoc Dali::Toolkit::Scene3dView::CreateScene()\r
/**\r
* @copydoc Dali::Toolkit::Scene3dView::PlayAnimation()\r
*/\r
- bool PlayAnimation( uint32_t index );\r
+ bool PlayAnimation(uint32_t index);\r
\r
/**\r
* @copydoc Dali::Toolkit::Scene3dView::PlayAnimations()\r
/**\r
* @copydoc Dali::Toolkit::Scene3dView::SetLight( Toolkit::Scene3dView::LightType type, Vector3 lightVector, Vector3 lightColor )\r
*/\r
- bool SetLight( Toolkit::Scene3dView::LightType type, Vector3 lightVector, Vector3 lightColor );\r
+ bool SetLight(Toolkit::Scene3dView::LightType type, Vector3 lightVector, Vector3 lightColor);\r
\r
/**\r
* @brief Set default CameraActor specified in the each scene format specification.\r
* near clipping plane = 0.1,\r
* and camera position = Vector3( 0.0, 0.0, 0.0 ).\r
*/\r
- bool SetDefaultCamera( const Dali::Camera::Type type = Dali::Camera::LOOK_AT_TARGET, const float nearPlane = 0.1, const Vector3 cameraPosition = Vector3( 0.0, 0.0, 0.0 ) );\r
+ bool SetDefaultCamera(const Dali::Camera::Type type = Dali::Camera::LOOK_AT_TARGET, const float nearPlane = 0.1, const Vector3 cameraPosition = Vector3(0.0, 0.0, 0.0));\r
\r
/**\r
* @brief Add CameraActor loaded from scene format file.\r
*/\r
- void AddCamera( CameraActor cameraActor );\r
+ void AddCamera(CameraActor cameraActor);\r
\r
/**\r
* @brief Add Animation loaded from scene format file.\r
*/\r
- void AddAnimation( Animation animation );\r
+ void AddAnimation(Animation animation);\r
\r
/**\r
* @brief Add new Shader.\r
* Actors can share same Shader if they use same properties.\r
* If a property changes in a shader, then the property of all actors that use the shader change.\r
*/\r
- void AddShader( Shader shader );\r
+ void AddShader(Shader shader);\r
\r
/**\r
* @brief Get Root Actor.\r
/**\r
* @copydoc Dali::Toolkit::Scene3dView::GetCamera( uint32_t cameraIndex )\r
*/\r
- CameraActor GetCamera( uint32_t cameraIndex );\r
+ CameraActor GetCamera(uint32_t cameraIndex);\r
\r
/**\r
* @brief Get light type.\r
* @brief Get Cropped image buffer.\r
* For each direction, Offset + faceSize must be width or height or less then them.\r
*/\r
- uint8_t* GetCroppedBuffer( uint8_t* sourceBuffer, uint32_t bytesPerPixel, uint32_t width, uint32_t height, uint32_t xOffset, uint32_t yOffset, uint32_t xFaceSize, uint32_t yFaceSize );\r
+ uint8_t* GetCroppedBuffer(uint8_t* sourceBuffer, uint32_t bytesPerPixel, uint32_t width, uint32_t height, uint32_t xOffset, uint32_t yOffset, uint32_t xFaceSize, uint32_t yFaceSize);\r
\r
/**\r
* @brief Upload cube map texture.\r
*/\r
- void UploadTextureFace( Texture& texture, Devel::PixelBuffer pixelBuffer, uint32_t faceIndex );\r
+ void UploadTextureFace(Texture& texture, Devel::PixelBuffer pixelBuffer, uint32_t faceIndex);\r
\r
/**\r
* @brief Set diffuse and specular cube map textures.\r
*/\r
- void SetCubeMap( const std::string& diffuseTexturePath, const std::string& specularTexturePath, Vector4 scaleFactor = Vector4( 1.0, 1.0, 1.0, 1.0 ) );\r
+ void SetCubeMap(const std::string& diffuseTexturePath, const std::string& specularTexturePath, Vector4 scaleFactor = Vector4(1.0, 1.0, 1.0, 1.0));\r
\r
virtual void OnInitialize();\r
\r
-\r
/**\r
* @brief Load 2D texture.\r
* @param[in] imageUrl Image URL of the texture.\r
* @param[in] generateMipmaps If generateMipmaps is true, then generate mipmap of this texture.\r
* @return Texture loaded from imageUrl.\r
*/\r
- Texture LoadTexture( const char *imageUrl, bool generateMipmaps );\r
+ Texture LoadTexture(const char* imageUrl, bool generateMipmaps);\r
\r
private:\r
- Actor mRoot; // Root actor that contains scene graph\r
+ Actor mRoot; // Root actor that contains scene graph\r
std::string mFilePath; // Full file path of scene file\r
\r
std::vector<Shader> mShaderArray; // Shader Array to change properties of scene such as lighting.\r
\r
std::vector<CameraActor> mCameraActorArray; // CameraActer array loaded from scene format file.\r
- CameraActor mDefaultCamera; // Default CameraActor for the empty mCameraActorArray.\r
+ CameraActor mDefaultCamera; // Default CameraActor for the empty mCameraActorArray.\r
\r
std::vector<Animation> mAnimationArray; // Animation array loaded from scene format file.\r
\r
- Toolkit::Scene3dView::LightType mLightType; // Light type\r
- Vector3 mLightVector; // Light position when mLightType is LightType::POINT_LIGHT\r
- // Light direction when mLightType is LightType::DIRECTIONAL_LIGHT\r
- Vector3 mLightColor; // Light color\r
+ Toolkit::Scene3dView::LightType mLightType; // Light type\r
+ Vector3 mLightVector; // Light position when mLightType is LightType::POINT_LIGHT\r
+ // Light direction when mLightType is LightType::DIRECTIONAL_LIGHT\r
+ Vector3 mLightColor; // Light color\r
\r
- Vector4 mIBLScaleFactor; // IBL scaling factor for the IBL rendering\r
- Texture mBRDFTexture; // BRDF texture for the PBR rendering\r
+ Vector4 mIBLScaleFactor; // IBL scaling factor for the IBL rendering\r
+ Texture mBRDFTexture; // BRDF texture for the PBR rendering\r
Texture mSpecularTexture; // Specular cube map texture\r
- Texture mDiffuseTexture; // Diffuse cube map texture\r
+ Texture mDiffuseTexture; // Diffuse cube map texture\r
\r
private:\r
-\r
// Undefined copy constructor.\r
- Scene3dView( const Scene3dView& );\r
+ Scene3dView(const Scene3dView&);\r
\r
// Undefined assignment operator.\r
- Scene3dView& operator=( const Scene3dView& );\r
+ Scene3dView& operator=(const Scene3dView&);\r
};\r
\r
} // namespace Internal\r
\r
- // Helpers for public-api forwarding methods\r
-inline const Internal::Scene3dView& GetImpl( const Toolkit::Scene3dView& scene3dView )\r
+// Helpers for public-api forwarding methods\r
+inline const Internal::Scene3dView& GetImpl(const Toolkit::Scene3dView& scene3dView)\r
{\r
- DALI_ASSERT_ALWAYS( scene3dView && "Scene3dView handle is empty" );\r
+ DALI_ASSERT_ALWAYS(scene3dView && "Scene3dView handle is empty");\r
const Dali::RefObject& handle = scene3dView.GetImplementation();\r
\r
- return static_cast<const Toolkit::Internal::Scene3dView&>( handle );\r
+ return static_cast<const Toolkit::Internal::Scene3dView&>(handle);\r
}\r
\r
-inline Internal::Scene3dView& GetImpl( Toolkit::Scene3dView& scene3dView )\r
+inline Internal::Scene3dView& GetImpl(Toolkit::Scene3dView& scene3dView)\r
{\r
- DALI_ASSERT_ALWAYS( scene3dView && "Scene3dView handle is empty" );\r
+ DALI_ASSERT_ALWAYS(scene3dView && "Scene3dView handle is empty");\r
\r
Dali::RefObject& handle = scene3dView.GetImplementation();\r
\r
- return static_cast<Toolkit::Internal::Scene3dView&>( handle );\r
+ return static_cast<Toolkit::Internal::Scene3dView&>(handle);\r
}\r
\r
-}//namespace Toolkit\r
+} //namespace Toolkit\r
\r
-}//namespace Dali\r
+} //namespace Dali\r
\r
#endif // DALI_TOOLKIT_INTERNAL_SCENE3D_VIEW_H\r
#define DALI_TOOLKIT_INTERNAL_SCROLL_BAR_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// EXTERNAL INCLUDES
#include <dali/public-api/adaptor-framework/timer.h>
-#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/animation/animation.h>
+#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/object/property-notification.h>
#include <dali/public-api/object/weak-handle.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/devel-api/controls/scroll-bar/scroll-bar.h>
#include <dali-toolkit/internal/controls/control/control-data-impl.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class ScrollBar;
typedef IntrusivePtr<ScrollBar> ScrollBarPtr;
*/
class ScrollBar : public Control
{
-
public:
-
// Signals
- typedef Toolkit::ScrollBar::PanFinishedSignalType PanFinishedSignalType;
+ typedef Toolkit::ScrollBar::PanFinishedSignalType PanFinishedSignalType;
typedef Toolkit::ScrollBar::ScrollPositionIntervalReachedSignalType ScrollPositionIntervalReachedSignalType;
public:
-
/**
* @copydoc Toolkit::ScrollBar::New()
*/
/**
* @copydoc Toolkit::ScrollBar::SetScrollPropertySource()
*/
- void SetScrollPropertySource( Handle handle, Property::Index propertyScrollPosition, Property::Index propertyMinScrollPosition, Property::Index propertyMaxScrollPosition, Property::Index propertyScrollContentSize );
+ void SetScrollPropertySource(Handle handle, Property::Index propertyScrollPosition, Property::Index propertyMinScrollPosition, Property::Index propertyMaxScrollPosition, Property::Index propertyScrollContentSize);
/**
* @copydoc Toolkit::ScrollBar::SetScrollIndicator()
*/
- void SetScrollIndicator( Actor indicator );
+ void SetScrollIndicator(Actor indicator);
/**
* @copydoc Toolkit::ScrollBar::GetScrollIndicator()
/**
* @copydoc Toolkit::ScrollBar::SetScrollPositionIntervals()
*/
- void SetScrollPositionIntervals( const Dali::Vector<float>& positions );
+ void SetScrollPositionIntervals(const Dali::Vector<float>& positions);
/**
* @copydoc Toolkit::ScrollBar::GetScrollPositionIntervals()
/**
* @copydoc Toolkit::ScrollBar::SetScrollDirection()
*/
- void SetScrollDirection( Toolkit::ScrollBar::Direction direction );
+ void SetScrollDirection(Toolkit::ScrollBar::Direction direction);
/**
* @copydoc Toolkit::ScrollBar::GetScrollDirection()
/**
* @copydoc Toolkit::ScrollBar::SetIndicatorHeightPolicy()
*/
- void SetIndicatorHeightPolicy( Toolkit::ScrollBar::IndicatorHeightPolicy policy );
+ void SetIndicatorHeightPolicy(Toolkit::ScrollBar::IndicatorHeightPolicy policy);
/**
* @copydoc Toolkit::ScrollBar::GetIndicatorHeightPolicy()
/**
* @copydoc Toolkit::ScrollBar::SetIndicatorFixedHeight()
*/
- void SetIndicatorFixedHeight( float height );
+ void SetIndicatorFixedHeight(float height);
/**
* @copydoc Toolkit::ScrollBar::GetIndicatorFixedHeight()
/**
* @copydoc Toolkit::ScrollBar::SetIndicatorShowDuration()
*/
- void SetIndicatorShowDuration( float durationSeconds );
+ void SetIndicatorShowDuration(float durationSeconds);
/**
* @copydoc Toolkit::ScrollBar::GetIndicatorShowDuration()
/**
* @copydoc Toolkit::ScrollBar::SetIndicatorHideDuration()
*/
- void SetIndicatorHideDuration( float durationSeconds );
+ void SetIndicatorHideDuration(float durationSeconds);
/**
* @copydoc Toolkit::ScrollBar::GetIndicatorHideDuration()
*/
void ShowTransientIndicator();
- /**
+ /**
* @copydoc Toolkit::ScrollBar::PanFinishedSignal()
*/
- PanFinishedSignalType& PanFinishedSignal()
- {
- return mPanFinishedSignal;
- }
+ PanFinishedSignalType& PanFinishedSignal()
+ {
+ return mPanFinishedSignal;
+ }
- /**
+ /**
* @copydoc Toolkit::ScrollBar::ScrollPositionIntervalReachedSignal()
*/
- ScrollPositionIntervalReachedSignalType& ScrollPositionIntervalReachedSignal()
- {
- return mScrollPositionIntervalReachedSignal;
- }
+ ScrollPositionIntervalReachedSignalType& ScrollPositionIntervalReachedSignal()
+ {
+ return mScrollPositionIntervalReachedSignal;
+ }
- /**
+ /**
* Connects a callback function with the object's signals.
* @param[in] object The object providing the signal.
* @param[in] tracker Used to disconnect the signal.
* @return True if the signal was connected.
* @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
*/
- static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
+ static bool DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
- // Properties
+ // Properties
- /**
+ /**
* Called when a property of an object of this type is set.
* @param[in] object The object whose property is set.
* @param[in] index The property index.
* @param[in] value The new property value.
*/
- static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
+ static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value);
- /**
+ /**
* Called to retrieve a property of an object of this type.
* @param[in] object The object whose property is to be retrieved.
* @param[in] index The property index.
* @return The current value of the property.
*/
- static Property::Value GetProperty( BaseObject* object, Property::Index index );
+ static Property::Value GetProperty(BaseObject* object, Property::Index index);
- /**
+ /**
* Performs actions as requested using the action name.
* @param[in] object The object on which to perform the action.
* @param[in] actionName The action to perform.
* @param[in] attributes The attributes with which to perfrom this action.
* @return true if action has been accepted by this control
*/
- static bool DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes );
+ static bool DoAction(BaseObject* object, const std::string& actionName, const Property::Map& attributes);
private: // from Control
-
/**
* @copydoc Toolkit::Control::OnInitialize
*/
/**
* @copydoc Toolkit::Control::OnPan
*/
- void OnPan( const PanGesture& gesture ) override;
+ void OnPan(const PanGesture& gesture) override;
/**
* @copydoc CustomActorImpl::OnSizeSet( const Vector3& size )
*/
- void OnSizeSet( const Vector3& size ) override;
+ void OnSizeSet(const Vector3& size) override;
private:
-
/**
* Create the default indicator actor.
*/
void OnIndicatorHeightPolicyPropertySet(Property::Value propertyValue);
private:
-
/**
* Constructor.
* It initializes ScrollBar members.
*/
- ScrollBar( Toolkit::ScrollBar::Direction direction );
+ ScrollBar(Toolkit::ScrollBar::Direction direction);
/**
* A reference counted object may only be deleted by calling Unreference()
virtual ~ScrollBar();
private:
+ Actor mIndicator; ///< Image of scroll indicator.
+ float mIndicatorShowAlpha; ///< The alpha value when the indicator is fully shown
+ Animation mAnimation; ///< Scroll indicator Show/Hide Animation.
- Actor mIndicator; ///< Image of scroll indicator.
- float mIndicatorShowAlpha; ///< The alpha value when the indicator is fully shown
- Animation mAnimation; ///< Scroll indicator Show/Hide Animation.
-
- Toolkit::ScrollBar::Direction mDirection; ///< The direction of scroll bar (vertical or horizontal)
+ Toolkit::ScrollBar::Direction mDirection; ///< The direction of scroll bar (vertical or horizontal)
- WeakHandle<Handle> mScrollableObject; ///< Object to be scrolled
+ WeakHandle<Handle> mScrollableObject; ///< Object to be scrolled
- Property::Index mPropertyScrollPosition = 0; ///< Index of scroll position property owned by the object to be scrolled
- Property::Index mPropertyMinScrollPosition = 0; ///< Index of minimum scroll position property owned by the object to be scrolled
- Property::Index mPropertyMaxScrollPosition = 1; ///< Index of maximum scroll position property owned by the object to be scrolled
- Property::Index mPropertyScrollContentSize; ///< Index of scroll content size property owned by the object to be scrolled
+ Property::Index mPropertyScrollPosition = 0; ///< Index of scroll position property owned by the object to be scrolled
+ Property::Index mPropertyMinScrollPosition = 0; ///< Index of minimum scroll position property owned by the object to be scrolled
+ Property::Index mPropertyMaxScrollPosition = 1; ///< Index of maximum scroll position property owned by the object to be scrolled
+ Property::Index mPropertyScrollContentSize; ///< Index of scroll content size property owned by the object to be scrolled
- float mIndicatorShowDuration; ///< The duration of scroll indicator show animation
- float mIndicatorHideDuration; ///< The duration of scroll indicator hide animation
- float mTransientIndicatorDuration; ///< The duration before hiding transient indicator
+ float mIndicatorShowDuration; ///< The duration of scroll indicator show animation
+ float mIndicatorHideDuration; ///< The duration of scroll indicator hide animation
+ float mTransientIndicatorDuration; ///< The duration before hiding transient indicator
- float mScrollStart; ///< Scroll Start position (start of drag)
- Vector2 mGestureDisplacement; ///< Gesture Displacement.
+ float mScrollStart; ///< Scroll Start position (start of drag)
+ Vector2 mGestureDisplacement; ///< Gesture Displacement.
- float mCurrentScrollPosition; ///< The current scroll position updated by the pan gesture
+ float mCurrentScrollPosition; ///< The current scroll position updated by the pan gesture
Toolkit::ScrollBar::IndicatorHeightPolicy mIndicatorHeightPolicy; ///< The height policy of scroll indicator (variable or fixed)
- float mIndicatorFixedHeight; ///< The fixed height of scroll indicator
- float mIndicatorMinimumHeight; ///< The minimum height for a variable size indicator
- float mIndicatorStartPadding; ///< The padding at the start of the indicator
- float mIndicatorEndPadding; ///< The padding at the end of the indicator
+ float mIndicatorFixedHeight; ///< The fixed height of scroll indicator
+ float mIndicatorMinimumHeight; ///< The minimum height for a variable size indicator
+ float mIndicatorStartPadding; ///< The padding at the start of the indicator
+ float mIndicatorEndPadding; ///< The padding at the end of the indicator
- Timer mContractDelayTimer; ///< Timer guarantee contract delay time.
- Timer mPanProcessTimer; ///< The timer to process the pan gesture after the gesture is started.
+ Timer mContractDelayTimer; ///< Timer guarantee contract delay time.
+ Timer mPanProcessTimer; ///< The timer to process the pan gesture after the gesture is started.
- Dali::Vector<float> mScrollPositionIntervals; ///< List of values to receive notification for when the current scroll position goes above or below them
- PropertyNotification mPositionNotification; ///< Stores the property notification used for scroll position changes
+ Dali::Vector<float> mScrollPositionIntervals; ///< List of values to receive notification for when the current scroll position goes above or below them
+ PropertyNotification mPositionNotification; ///< Stores the property notification used for scroll position changes
- PanFinishedSignalType mPanFinishedSignal;
+ PanFinishedSignalType mPanFinishedSignal;
ScrollPositionIntervalReachedSignalType mScrollPositionIntervalReachedSignal;
Constraint mIndicatorPositionConstraint;
Constraint mIndicatorSizeConstraint;
- bool mIsPanning : 1; ///< Whether the scroll bar is being panned.
- bool mIndicatorFirstShow : 1; ///< True if the indicator has never been shown
+ bool mIsPanning : 1; ///< Whether the scroll bar is being panned.
+ bool mIndicatorFirstShow : 1; ///< True if the indicator has never been shown
protected:
struct AccessibleImpl : public Control::Impl::AccessibleImpl,
double GetMinimum() override;
double GetCurrent() override;
double GetMaximum() override;
- bool SetCurrent( double ) override;
+ bool SetCurrent(double) override;
double GetMinimumIncrement() override;
};
};
#define DALI_TOOLKIT_INTERNAL_BOUNCING_EFFECT_ACTOR_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/**
* @brief Creates a Dali::Actor to display the bouncing effect for overshoot
*
* @param[out] bouncePropertyIndex The property index which controls the bouncing
* @return The actor which displays the bouncing effect
*/
-Actor CreateBouncingEffectActor( Property::Index& bouncePropertyIndex);
+Actor CreateBouncingEffectActor(Property::Index& bouncePropertyIndex);
} // namespace Internal
} // namespace Dali
-
#endif // DALI_TOOLKIT_INTERNAL_BOUNCING_EFFECT_ACTOR_H
#define DALI_TOOLKIT_DEPTH_LAYOUT_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
-
-
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class DepthLayout;
typedef IntrusivePtr<DepthLayout> DepthLayoutPtr;
class DepthLayout : public ItemLayout
{
public:
-
/**
* Create a new spiral layout
*/
int GetNextFocusItemID(int itemID, int maxItems, Dali::Toolkit::Control::KeyboardFocus::Direction direction, bool loopEnabled) override;
private:
-
/**
* @copydoc ItemLayout::GetMinimumLayoutPosition()
*/
/**
* @copydoc ItemLayout::GetDefaultItemSize()
*/
- void GetDefaultItemSize( unsigned int itemId, const Vector3& layoutSize, Vector3& itemSize ) const override;
+ void GetDefaultItemSize(unsigned int itemId, const Vector3& layoutSize, Vector3& itemSize) const override;
/**
* @copydoc ItemLayout::GetScrollDirection()
/**
* @copydoc ItemLayout::ApplyConstraints()
*/
- void ApplyConstraints( Actor& actor, const int itemId, const Vector3& layoutSize, const Actor& itemViewActor ) override;
+ void ApplyConstraints(Actor& actor, const int itemId, const Vector3& layoutSize, const Actor& itemViewActor) override;
/**
* @copydoc ItemLayout::GetItemPosition()
*/
- Vector3 GetItemPosition( int itemID, float currentLayoutPosition, const Vector3& layoutSize ) const override;
+ Vector3 GetItemPosition(int itemID, float currentLayoutPosition, const Vector3& layoutSize) const override;
protected:
-
/**
* Protected constructor; see also DepthLayout::New()
*/
DepthLayout();
private:
-
// Undefined
- DepthLayout( const DepthLayout& depthLayout );
+ DepthLayout(const DepthLayout& depthLayout);
// Undefined
- DepthLayout& operator=( const DepthLayout& depthLayout );
+ DepthLayout& operator=(const DepthLayout& depthLayout);
private:
-
struct Impl;
Impl* mImpl;
};
#define DALI_TOOLKIT_GRID_LAYOUT_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali-toolkit/public-api/dali-toolkit-common.h>
-
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class GridLayout;
typedef IntrusivePtr<GridLayout> GridLayoutPtr; ///< Pointer to a Dali::Toolkit::GridLayout object
class GridLayout : public ItemLayout
{
public:
-
/**
* @brief Create a new grid layout.
*/
int GetNextFocusItemID(int itemID, int maxItems, Dali::Toolkit::Control::KeyboardFocus::Direction direction, bool loopEnabled) override;
private:
-
/**
* @copydoc ItemLayout::GetMinimumLayoutPosition()
*/
/**
* @copydoc ItemLayout::GetDefaultItemSize()
*/
- void GetDefaultItemSize( unsigned int itemId, const Vector3& layoutSize, Vector3& itemSize ) const override;
+ void GetDefaultItemSize(unsigned int itemId, const Vector3& layoutSize, Vector3& itemSize) const override;
/**
* @copydoc ItemLayout::GetScrollDirection()
/**
* @copydoc ItemLayout::ApplyConstraints()
*/
- void ApplyConstraints( Actor& actor, const int itemId, const Vector3& layoutSize, const Actor& itemViewActor ) override;
+ void ApplyConstraints(Actor& actor, const int itemId, const Vector3& layoutSize, const Actor& itemViewActor) override;
/**
* @copydoc ItemLayout::GetItemPosition()
*/
- Vector3 GetItemPosition( int itemID, float currentLayoutPosition, const Vector3& layoutSize ) const override;
+ Vector3 GetItemPosition(int itemID, float currentLayoutPosition, const Vector3& layoutSize) const override;
protected:
-
/**
* @brief Protected constructor; see also GridLayout::New().
*/
GridLayout();
private:
-
// Undefined
- GridLayout( const GridLayout& itemLayout );
+ GridLayout(const GridLayout& itemLayout);
// Undefined
- GridLayout& operator=( const GridLayout& rhs );
+ GridLayout& operator=(const GridLayout& rhs);
private:
-
struct Impl;
Impl* mImpl;
};
#define DALI_TOOLKIT_INTERNAL_ITEM_VIEW_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// EXTERNAL INCLUDES
#include <dali/public-api/adaptor-framework/timer.h>
#include <dali/public-api/animation/animation.h>
-#include <dali/public-api/object/property-notification.h>
-#include <dali/public-api/object/property-map.h>
#include <dali/public-api/object/property-array.h>
+#include <dali/public-api/object/property-map.h>
+#include <dali/public-api/object/property-notification.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/internal/controls/scrollable/scrollable-impl.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali-toolkit/public-api/controls/scrollable/item-view/item-view.h>
-#include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
-#include <dali-toolkit/internal/controls/scrollable/scrollable-impl.h>
+#include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
+#include <dali-toolkit/public-api/controls/scrollable/item-view/item-view.h>
#include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class ItemView;
typedef IntrusivePtr<ItemView> ItemViewPtr;
class ItemView : public Scrollable
{
public:
-
// Signals
typedef Toolkit::ItemView::LayoutActivatedSignalType LayoutActivatedSignalType;
public:
-
/**
* Create a new ItemView.
* @param[in] factory The factory which provides ItemView with items.
/**
* @copydoc Toolkit::Internal::Scrollable::SetOvershootSize
*/
- void SetOvershootSize( const Vector2& size );
+ void SetOvershootSize(const Vector2& size);
/**
* @copydoc Toolkit::Internal::Scrollable::SetOvershootEffectColor
*/
- void SetOvershootEffectColor( const Vector4& color );
+ void SetOvershootEffectColor(const Vector4& color);
/**
* @brief Set whether to enable automatic refresh or not. When refresh is disabled,
/**
* @copydoc Toolkit::ItemView::SetItemsParentOrigin
*/
- void SetItemsParentOrigin( const Vector3& parentOrigin );
+ void SetItemsParentOrigin(const Vector3& parentOrigin);
/**
* @copydoc Toolkit::ItemView::GetItemsParentOrigin
/**
* @copydoc Toolkit::ItemView::SetItemsAnchorPoint
*/
- void SetItemsAnchorPoint( const Vector3& anchorPoint );
+ void SetItemsAnchorPoint(const Vector3& anchorPoint);
/**
* @copydoc Toolkit::ItemView::GetItemsAnchorPoint
* @return True if the signal was connected.
* @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
*/
- static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
+ static bool DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
//properties
* @param[in] index The property index.
* @param[in] value The new property value.
*/
- static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
+ static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value);
/**
* Called to retrieve a property of an object of this type.
* @param[in] index The property index.
* @return The current value of the property.
*/
- static Property::Value GetProperty( BaseObject* object, Property::Index index );
+ static Property::Value GetProperty(BaseObject* object, Property::Index index);
/**
* Performs actions as requested using the action name.
* @param[in] attributes The attributes with which to perfrom this action.
* @return true if action has been accepted by this control
*/
- static bool DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes );
+ static bool DoAction(BaseObject* object, const std::string& actionName, const Property::Map& attributes);
/**
* Helper for DoAction( ACTION_STOP_SCROLLING ).
* Helper for DoAction( ACTION_ENABLE/DISABLE_REFRESH_NOTIFICATIONS ).
* @param[in] enabled Whether to disable refresh notifications or not.
*/
- void SetRefreshNotificationEnabled( bool enabled );
+ void SetRefreshNotificationEnabled(bool enabled);
private:
-
/**
* Get all the layouts used in the ItemView.
* @return The layout array
* Set all the layouts. that will be used in the ItemView.
* @param[in] layouts The layouts used in the itemView.
*/
- void SetLayoutArray( const Property::Array& layouts );
+ void SetLayoutArray(const Property::Array& layouts);
/**
* Remove an Actor if found in the ItemPool.
* @param[in] itemId The item to remove.
* @return True if the remaining actors were reordered.
*/
- bool RemoveActor( unsigned int itemId );
+ bool RemoveActor(unsigned int itemId);
/**
* Remove any Actors outside a given range.
* @param[in] @param[in] range The range of required items.
*/
- void RemoveActorsOutsideRange( ItemRange range );
+ void RemoveActorsOutsideRange(ItemRange range);
/**
* Add a range of Actors, if they are not already in the ItemPool.
* @param[in] range The range of Item IDs to associate with the new actors.
* @param[in] layoutSize The layout-size.
*/
- void AddActorsWithinRange( ItemRange range, const Vector3& layoutSize );
+ void AddActorsWithinRange(ItemRange range, const Vector3& layoutSize);
/**
* Add a new Actor, if not already in the ItemPool.
* @param[in] item The ID for the new item.
* @param[in] layoutSize The layout-size.
*/
- void AddNewActor( ItemId item, const Vector3& layoutSize );
+ void AddNewActor(ItemId item, const Vector3& layoutSize);
/**
* Apply the constraints etc. that are required for ItemView children.
* @param[in] item The item to setup.
* @param[in] layoutSize The layout-size.
*/
- void SetupActor( Item item, const Vector3& layoutSize );
+ void SetupActor(Item item, const Vector3& layoutSize);
/**
* Remove the Actor from the ItemPool and notify the ItemFactory the actor has been released by ItemView.
* @param[in] item The ID for the item to be released.
* @param[in] actor The actor to be removed from ItemView.
*/
- void ReleaseActor( ItemId item, Actor actor );
+ void ReleaseActor(ItemId item, Actor actor);
private: // From CustomActorImpl
-
/**
* From CustomActorImpl; called after a child has been added to the owning actor.
* @param[in] child The child which has been added.
bool OnWheelEvent(Actor actor, const WheelEvent& event);
private: // From Control
-
/**
* @copydoc Toolkit::Control::OnInitialize()
*/
virtual ~ItemView();
private:
-
// Undefined
ItemView(const ItemView&);
* @param[in] touch The touch information.
* @return True if the event should be consumed.
*/
- bool OnTouch( Actor actor, const TouchEvent& touch );
+ bool OnTouch(Actor actor, const TouchEvent& touch);
/**
* Called upon pan gesture event.
*
* @param[in] gesture The gesture event.
*/
- void OnPan( const PanGesture& pan );
+ void OnPan(const PanGesture& pan);
/**
* Helper to handle anchoring animations.
/**
* @copydoc Toolkit::Internal::Scrollable::EnableScrollOvershoot
*/
- void EnableScrollOvershoot( bool enable ) override;
+ void EnableScrollOvershoot(bool enable) override;
/**
* Helper to calculate the scroll overshoot according to the pan gesture displacement.
void OnRefreshNotification(PropertyNotification& source);
private:
-
Property::Array mlayoutArray;
- ItemContainer mItemPool;
- ItemFactory& mItemFactory;
- std::vector< ItemLayoutPtr > mLayouts; ///< Container of Dali::Toolkit::ItemLayout objects
- Actor mOvershootOverlay; ///< The overlay actor for overshoot effect
- Animation mResizeAnimation;
- Animation mScrollAnimation;
- Animation mScrollOvershootAnimation;
- Timer mWheelEventFinishedTimer; ///< The timer to determine whether there is no wheel event received for a certain period of time.
- PropertyNotification mRefreshNotification; ///< Stores the property notification used for item view refresh
- LayoutActivatedSignalType mLayoutActivatedSignal;
- Vector3 mActiveLayoutTargetSize;
- Vector3 mItemsParentOrigin;
- Vector3 mItemsAnchorPoint;
- Vector2 mTotalPanDisplacement;
- ItemLayout* mActiveLayout;
+ ItemContainer mItemPool;
+ ItemFactory& mItemFactory;
+ std::vector<ItemLayoutPtr> mLayouts; ///< Container of Dali::Toolkit::ItemLayout objects
+ Actor mOvershootOverlay; ///< The overlay actor for overshoot effect
+ Animation mResizeAnimation;
+ Animation mScrollAnimation;
+ Animation mScrollOvershootAnimation;
+ Timer mWheelEventFinishedTimer; ///< The timer to determine whether there is no wheel event received for a certain period of time.
+ PropertyNotification mRefreshNotification; ///< Stores the property notification used for item view refresh
+ LayoutActivatedSignalType mLayoutActivatedSignal;
+ Vector3 mActiveLayoutTargetSize;
+ Vector3 mItemsParentOrigin;
+ Vector3 mItemsAnchorPoint;
+ Vector2 mTotalPanDisplacement;
+ ItemLayout* mActiveLayout;
float mAnchoringDuration;
- float mRefreshIntervalLayoutPositions; ///< Refresh item view when the layout position changes by this interval in both positive and negative directions.
+ float mRefreshIntervalLayoutPositions; ///< Refresh item view when the layout position changes by this interval in both positive and negative directions.
float mMinimumSwipeSpeed;
float mMinimumSwipeDistance;
- float mWheelScrollDistanceStep; ///< The step of scroll distance in actor coordinates for each wheel event received.
+ float mWheelScrollDistanceStep; ///< The step of scroll distance in actor coordinates for each wheel event received.
float mScrollDistance;
float mScrollSpeed;
float mScrollOvershoot;
- GestureState mGestureState : 8;
- bool mAnimatingOvershootOn : 1; ///< Whether we are currently animating overshoot to 1.0f/-1.0f (on) or to 0.0f (off)
- bool mAnimateOvershootOff : 1; ///< Whether we are currently animating overshoot to 1.0f/-1.0f (on) or to 0.0f (off)
- bool mAnchoringEnabled : 1;
- bool mRefreshOrderHint : 1; ///< True if scrolling towards the last item
- bool mIsFlicking : 1;
- bool mAddingItems : 1;
- bool mRefreshEnabled : 1; ///< Whether to refresh the cache automatically
- bool mRefreshNotificationEnabled : 1; ///< Whether to disable refresh notifications or not.
- bool mInAnimation : 1; ///< Keeps track of whether an animation is controlling the overshoot property.
+ GestureState mGestureState : 8;
+ bool mAnimatingOvershootOn : 1; ///< Whether we are currently animating overshoot to 1.0f/-1.0f (on) or to 0.0f (off)
+ bool mAnimateOvershootOff : 1; ///< Whether we are currently animating overshoot to 1.0f/-1.0f (on) or to 0.0f (off)
+ bool mAnchoringEnabled : 1;
+ bool mRefreshOrderHint : 1; ///< True if scrolling towards the last item
+ bool mIsFlicking : 1;
+ bool mAddingItems : 1;
+ bool mRefreshEnabled : 1; ///< Whether to refresh the cache automatically
+ bool mRefreshNotificationEnabled : 1; ///< Whether to disable refresh notifications or not.
+ bool mInAnimation : 1; ///< Keeps track of whether an animation is controlling the overshoot property.
};
} // namespace Internal
#define DALI_TOOLKIT_SPIRAL_LAYOUT_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
-
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class SpiralLayout;
typedef IntrusivePtr<SpiralLayout> SpiralLayoutPtr;
class SpiralLayout : public ItemLayout
{
public:
-
/**
* Create a new spiral layout
*/
float GetClosestOnScreenLayoutPosition(int itemID, float currentLayoutPosition, const Vector3& layoutSize) override;
private:
-
/**
* @copydoc ItemLayout::GetMinimumLayoutPosition()
*/
/**
* @copydoc ItemLayout::GetDefaultItemSize()
*/
- void GetDefaultItemSize( unsigned int itemId, const Vector3& layoutSize, Vector3& itemSize ) const override;
+ void GetDefaultItemSize(unsigned int itemId, const Vector3& layoutSize, Vector3& itemSize) const override;
/**
* @copydoc ItemLayout::GetScrollDirection()
/**
* @copydoc ItemLayout::ApplyConstraints()
*/
- void ApplyConstraints( Actor& actor, const int itemId, const Vector3& layoutSize, const Actor& itemViewActor ) override;
+ void ApplyConstraints(Actor& actor, const int itemId, const Vector3& layoutSize, const Actor& itemViewActor) override;
/**
* @copydoc ItemLayout::GetItemPosition()
*/
- Vector3 GetItemPosition( int itemID, float currentLayoutPosition, const Vector3& layoutSize ) const override;
+ Vector3 GetItemPosition(int itemID, float currentLayoutPosition, const Vector3& layoutSize) const override;
protected:
-
/**
* Protected constructor; see also SpiralLayout::New()
*/
SpiralLayout();
private:
-
// Undefined
- SpiralLayout( const SpiralLayout& spiralLayout );
+ SpiralLayout(const SpiralLayout& spiralLayout);
// Undefined
- SpiralLayout& operator=( const SpiralLayout& spiralLayout );
+ SpiralLayout& operator=(const SpiralLayout& spiralLayout);
private:
-
struct Impl;
Impl* mImpl;
};
#define DALI_TOOLKIT_INTERNAL_SCROLL_BASE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// EXTERNAL INCLUDES
// TODO - Replace list with dali-vector.h
-#include <list>
#include <dali/public-api/animation/constraint.h>
+#include <list>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
#include <dali-toolkit/internal/controls/scrollable/scrollable-impl.h>
+#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class ScrollBase;
-typedef IntrusivePtr<Actor> ActorPtr;
-typedef std::list<Constraint> ConstraintStack;
+typedef IntrusivePtr<Actor> ActorPtr;
+typedef std::list<Constraint> ConstraintStack;
/**
* ScrollBase represents a set of properties (time, position
class ScrollBase : public Scrollable
{
public:
-
struct ActorInfo : public Dali::RefObject
{
/**
*/
void ApplyConstraint(Constraint constraint)
{
- Constraint clone = constraint.Clone( mActor );
+ Constraint clone = constraint.Clone(mActor);
clone.Apply();
- mConstraints.push_back( clone );
+ mConstraints.push_back(clone);
}
/**
*/
void RemoveConstraints()
{
- std::vector<Constraint>::iterator it = mConstraints.begin();
+ std::vector<Constraint>::iterator it = mConstraints.begin();
std::vector<Constraint>::iterator end = mConstraints.end();
- for(;it!=end;++it)
+ for(; it != end; ++it)
{
it->Remove();
}
mConstraints.clear();
}
- Actor mActor; ///< The Actor that this ActorInfo represents.
- std::vector<Constraint> mConstraints; ///< A list keeping track of constraints applied to the actor via this delegate.
+ Actor mActor; ///< The Actor that this ActorInfo represents.
+ std::vector<Constraint> mConstraints; ///< A list keeping track of constraints applied to the actor via this delegate.
};
- typedef IntrusivePtr<ActorInfo> ActorInfoPtr;
- typedef std::vector<ActorInfoPtr> ActorInfoContainer;
- typedef ActorInfoContainer::iterator ActorInfoIter;
+ typedef IntrusivePtr<ActorInfo> ActorInfoPtr;
+ typedef std::vector<ActorInfoPtr> ActorInfoContainer;
+ typedef ActorInfoContainer::iterator ActorInfoIter;
typedef ActorInfoContainer::const_iterator ActorInfoConstIter;
public:
-
/**
* Sets the delay in seconds.
* This delay affects the animation timing for all
}
public:
-
/**
* Sets ScrollBase Parent
*
* @param[in] parent The parent that this ScrollBase belongs to.
*/
- void SetParent(ScrollBase *parent);
+ void SetParent(ScrollBase* parent);
/**
* Bind Actor to this scroll view/group.
void RemoveConstraintsFromBoundActors();
protected:
-
static const char* const SCROLL_DOMAIN_OFFSET_PROPERTY_NAME;
protected:
-
/**
* Removed default costructor.
*/
*
* @param[in] behaviourFlags Flags to enable
*/
- ScrollBase( ControlBehaviour behaviourFlags );
+ ScrollBase(ControlBehaviour behaviourFlags);
protected:
-
- ScrollBase *mParent; ///< Pointer to ScrollBase parent, if exists.
+ ScrollBase* mParent; ///< Pointer to ScrollBase parent, if exists.
private:
-
- float mDelay; ///< delay in seconds.
- ConstraintStack mConstraintStack; ///< The list of constraints to apply to any actors
- ActorInfoContainer mBoundActors; ///< The list of actors that have been bound to this ScrollBase.
-
+ float mDelay; ///< delay in seconds.
+ ConstraintStack mConstraintStack; ///< The list of constraints to apply to any actors
+ ActorInfoContainer mBoundActors; ///< The list of actors that have been bound to this ScrollBase.
};
} // namespace Internal
#define DALI_TOOLKIT_INTERNAL_SCROLL_OVERSHOOT_INDICATOR_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
class Scrollable;
class ScrollOvershootEffect;
class ScrollOvershootEffectGradient;
class ScrollOvershootEffectRipple;
-typedef IntrusivePtr<ScrollOvershootEffect> ScrollOvershootEffectPtr;
+typedef IntrusivePtr<ScrollOvershootEffect> ScrollOvershootEffectPtr;
typedef IntrusivePtr<ScrollOvershootEffectGradient> ScrollOvershootEffectGradientPtr;
-typedef IntrusivePtr<ScrollOvershootEffectRipple> ScrollOvershootEffectRipplePtr;
+typedef IntrusivePtr<ScrollOvershootEffectRipple> ScrollOvershootEffectRipplePtr;
struct ScrollOvershootIndicator : public Dali::RefObject
{
public:
-
/**
* ScrollOvershootIndicator constructor.
*/
* Set the color of the overshoot effect.
* @parm[in] color The color of the overshoot effect
*/
- void SetOvershootEffectColor( const Vector4& color );
+ void SetOvershootEffectColor(const Vector4& color);
private:
- ScrollOvershootEffectPtr mEffectX; ///< effect used for x-axis/horizontal display
- ScrollOvershootEffectPtr mEffectY; ///< effect used for y-axis/vertical display
+ ScrollOvershootEffectPtr mEffectX; ///< effect used for x-axis/horizontal display
+ ScrollOvershootEffectPtr mEffectY; ///< effect used for y-axis/vertical display
};
/**
*
* @param[in] vertical whether this effect is a vertical or horizontal one
*/
- ScrollOvershootEffect( bool vertical );
+ ScrollOvershootEffect(bool vertical);
/**
* Virtual destructor
*/
- virtual ~ScrollOvershootEffect() {}
+ virtual ~ScrollOvershootEffect()
+ {
+ }
/**
* Returns if this is a vertical or horizontal overhoot effect
*
* @param[in] scrollable the scrollable object to remove this effect from
*/
- virtual void Remove( Scrollable& scrollable ) = 0;
+ virtual void Remove(Scrollable& scrollable) = 0;
/**
* Resets this overshoot effect
/**
* Sets up property notifications for overshoot values
*/
- virtual void UpdatePropertyNotifications() {}
+ virtual void UpdatePropertyNotifications()
+ {
+ }
/**
* @copydoc ScrollOvershootIndicator::SetOvershootEffectColor()
*/
- virtual void SetOvershootEffectColor( const Vector4& color ) = 0;
+ virtual void SetOvershootEffectColor(const Vector4& color) = 0;
/**
* Sets shader overshoot value, either immediately of by animating over time
virtual void SetOvershoot(float amount, bool animate = true) = 0;
private:
- bool mVertical; ///< whether this is a vertical/horizontal effect
+ bool mVertical; ///< whether this is a vertical/horizontal effect
};
/**
{
enum AnimationState
{
- AnimatingIn = 0x01, ///< animating overshoot to 0
- AnimatingOut = 0x02, ///< animating overshoot to negative (overshoot image displays in +ve area of screen)
- AnimateBack = 0x04, ///< indicates that we need to animate overshoot back to zero immediately after it has finished animating in
+ AnimatingIn = 0x01, ///< animating overshoot to 0
+ AnimatingOut = 0x02, ///< animating overshoot to negative (overshoot image displays in +ve area of screen)
+ AnimateBack = 0x04, ///< indicates that we need to animate overshoot back to zero immediately after it has finished animating in
};
public:
-
/**
* Create a new gradient overshoot effect, passing in whether it is vertical or horizontal
*
* @param[in] vertical Whether this indicator is vertical or horizontal
*/
- ScrollOvershootEffectRipple( bool vertical, Scrollable& scrollable );
+ ScrollOvershootEffectRipple(bool vertical, Scrollable& scrollable);
/**
* @copydoc ScrollOvershootEffect::Apply
/**
* @copydoc ScrollOvershootEffect::Remove
*/
- void Remove( Scrollable& scrollable ) override;
+ void Remove(Scrollable& scrollable) override;
/**
* @copydoc ScrollOvershootEffect::Reset
/**
* @copydoc ScrollOvershootEffect::SetOvershootEffectColor()
*/
- void SetOvershootEffectColor( const Vector4& color );
+ void SetOvershootEffectColor(const Vector4& color);
/**
* Updates the vibility of the overshoot image as well as updating its size, position and rotation
*
* @param[in] visible Whether to set the image visible or not
*/
- void UpdateVisibility( bool visible );
+ void UpdateVisibility(bool visible);
/**
* Informs overshoot effect to update image position and to animate effect overshoot value for a
* @param[in] vertical whether to create a vertical(true) or horizontal effect
* @return a pointer to the new effect
*/
- static ScrollOvershootEffectRipplePtr New( bool vertical, Scrollable& scrollable );
+ static ScrollOvershootEffectRipplePtr New(bool vertical, Scrollable& scrollable);
private:
- Actor mOvershootOverlay; ///< the actor which displays the overshoot effect
- Scrollable& mAttachedScrollView; ///< the actor that this indicator has been attached to
- Animation mScrollOvershootAnimation; ///< overshoot animation
- PropertyNotification mOvershootIncreaseNotification;///< notification used to inform as overshoot increases
- PropertyNotification mOvershootDecreaseNotification;///< notification used to inform as overshoot decreases
- Property::Index mOvershootProperty; ///< index of the overshoot property in the scrollable actor
- Property::Index mEffectOvershootProperty; ///< index of the effect's overshoot property
- float mOvershoot; ///< last overshoot value as detected by notifications
- Vector2 mOvershootSize; ///< The size of the overshoot effect
- unsigned short mAnimationStateFlags; ///< contains flags indicating the current state of the overshoot animation
+ Actor mOvershootOverlay; ///< the actor which displays the overshoot effect
+ Scrollable& mAttachedScrollView; ///< the actor that this indicator has been attached to
+ Animation mScrollOvershootAnimation; ///< overshoot animation
+ PropertyNotification mOvershootIncreaseNotification; ///< notification used to inform as overshoot increases
+ PropertyNotification mOvershootDecreaseNotification; ///< notification used to inform as overshoot decreases
+ Property::Index mOvershootProperty; ///< index of the overshoot property in the scrollable actor
+ Property::Index mEffectOvershootProperty; ///< index of the effect's overshoot property
+ float mOvershoot; ///< last overshoot value as detected by notifications
+ Vector2 mOvershootSize; ///< The size of the overshoot effect
+ unsigned short mAnimationStateFlags; ///< contains flags indicating the current state of the overshoot animation
};
} // namespace Internal
#define DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_EFFECT_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/signals/connection-tracker.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
+#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
namespace Dali
{
-
class Animation;
namespace Toolkit
{
-
class ScrollView;
namespace Internal
{
-
class ScrollViewEffect;
/**
*/
class ScrollViewEffect : public Dali::BaseObject, public ConnectionTracker
{
-
public:
-
ScrollViewEffect();
/**
void Detach(Toolkit::ScrollView& scrollView);
public:
-
/**
* Called upon Attaching of effect to a scrollView instance.
*
virtual void OnDetach(Toolkit::ScrollView& scrollView) = 0;
protected:
-
/**
* Returns the ScrollView handle that this effect is
* attached to.
Toolkit::ScrollView GetScrollView();
protected:
-
/**
* A reference counted object may only be deleted by calling Unreference()
*/
virtual ~ScrollViewEffect();
private:
-
- Toolkit::Internal::ScrollView *mScrollViewImpl; ///< Attached ScrollView instance (pointer to implementation)
-
+ Toolkit::Internal::ScrollView* mScrollViewImpl; ///< Attached ScrollView instance (pointer to implementation)
};
} // namespace Internal
#define DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/object/weak-handle.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/devel-api/controls/scroll-bar/scroll-bar.h>
#include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.h>
-#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
+#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class ScrollView;
-typedef IntrusivePtr<ScrollView> ScrollViewPtr;
+typedef IntrusivePtr<ScrollView> ScrollViewPtr;
class ScrollInternalConstraints;
-typedef IntrusivePtr<ScrollInternalConstraints> ScrollInternalConstraintsPtr;
+typedef IntrusivePtr<ScrollInternalConstraints> ScrollInternalConstraintsPtr;
class ScrollOvershootIndicator;
typedef IntrusivePtr<ScrollOvershootIndicator> ScrollOvershootIndicatorPtr;
class ScrollView : public ScrollBase
{
public:
-
/**
* FindDirection specifies how searching is conducted within the Find... routines.
*/
enum FindDirection
{
- None = -3, ///< Includes none within the search query.
- All = -2, ///< Includes all within the search query.
- Left = -1, ///< Includes only those not right !(>)
- Right = 1, ///< Includes only those right (>)
- Up = -1, ///< Includes only those not below !(>)
- Down = 1, ///< Includes only those below (>)
- Out = -1, ///< Includes only those not infront !(>)
- In = 1 ///< Includes only those infront (>)
+ None = -3, ///< Includes none within the search query.
+ All = -2, ///< Includes all within the search query.
+ Left = -1, ///< Includes only those not right !(>)
+ Right = 1, ///< Includes only those right (>)
+ Up = -1, ///< Includes only those not below !(>)
+ Down = 1, ///< Includes only those below (>)
+ Out = -1, ///< Includes only those not infront !(>)
+ In = 1 ///< Includes only those infront (>)
};
enum LockAxis
SnappingInternalY = 0x08, ///< snapping mPropertyY back to mPropertyPreScroll y value to remove y overshoot over time
};
- static const unsigned int SCROLL_X_STATE_MASK = AnimatingInternalX | SnappingInternalX;
- static const unsigned int SCROLL_Y_STATE_MASK = AnimatingInternalY | SnappingInternalY;
+ static const unsigned int SCROLL_X_STATE_MASK = AnimatingInternalX | SnappingInternalX;
+ static const unsigned int SCROLL_Y_STATE_MASK = AnimatingInternalY | SnappingInternalY;
static const unsigned int SCROLL_ANIMATION_FLAGS = AnimatingInternalX | AnimatingInternalY;
- static const unsigned int SNAP_ANIMATION_FLAGS = SnappingInternalX | SnappingInternalY;
+ static const unsigned int SNAP_ANIMATION_FLAGS = SnappingInternalX | SnappingInternalY;
private:
-
typedef std::vector<Dali::Toolkit::ScrollViewEffect> ScrollViewEffectContainer; ///< Container of Dali::Toolkit::ScrollViewEffect
- typedef ScrollViewEffectContainer::iterator ScrollViewEffectIter; ///< Iterator for Dali::Toolkit::ScrollViewEffectContainer
+ typedef ScrollViewEffectContainer::iterator ScrollViewEffectIter; ///< Iterator for Dali::Toolkit::ScrollViewEffectContainer
public:
-
/**
* Create a new ScrollView.
* @return A public handle to the newly allocated ScrollView.
static Dali::Toolkit::ScrollView New();
public:
-
/**
* @copydoc Toolkit::ScrollView::GetScrollSnapAlphaFunction
*/
/**
* @copydoc Toolkit::ScrollView::SetMinimumDistanceForFlick
*/
- void SetMinimumDistanceForFlick( const Vector2& distance );
+ void SetMinimumDistanceForFlick(const Vector2& distance);
/**
* @copydoc Toolkit::ScrollView::GetMinimumSpeedForFlick
/**
* @copydoc Toolkit::ScrollView::SetMinimumSpeedForFlick
*/
- void SetMinimumSpeedForFlick( float speed );
+ void SetMinimumSpeedForFlick(float speed);
/**
* @copydoc Toolkit::ScrollView::GetMaxFlickSpeed
* @copydoc ScrollTo(const Vector2&)
*/
void TransformTo(const Vector2& position,
- DirectionBias horizontalBias = DIRECTION_BIAS_NONE, DirectionBias verticalBias = DIRECTION_BIAS_NONE);
+ DirectionBias horizontalBias = DIRECTION_BIAS_NONE,
+ DirectionBias verticalBias = DIRECTION_BIAS_NONE);
/**
* @copydoc ScrollTo(const Vector2&, float, AlhpaFunction, DirectionBias, DirectionBias)
*/
- void TransformTo(const Vector2& position, float duration, AlphaFunction alpha,
- DirectionBias horizontalBias = DIRECTION_BIAS_NONE, DirectionBias verticalBias = DIRECTION_BIAS_NONE);
+ void TransformTo(const Vector2& position, float duration, AlphaFunction alpha, DirectionBias horizontalBias = DIRECTION_BIAS_NONE, DirectionBias verticalBias = DIRECTION_BIAS_NONE);
/**
* @copydoc Toolkit::ScrollView::ScrollTo(const Vector2 &position)
*/
- void ScrollTo(const Vector2 &position);
+ void ScrollTo(const Vector2& position);
/**
* @copydoc Toolkit::Scrollable::ScrollTo(const Vector2& position, float duration)
/**
* @copydoc Toolkit::ScrollView::ScrollTo(const Vector2 &position, float duration, DirectionBias horizontalBias, DirectionBias verticalBias)
*/
- void ScrollTo(const Vector2& position, float duration,
- DirectionBias horizontalBias, DirectionBias verticalBias);
+ void ScrollTo(const Vector2& position, float duration, DirectionBias horizontalBias, DirectionBias verticalBias);
/**
* @copydoc Toolkit::ScrollView::ScrollTo(const Vector2 &position, float duration, AlphaFunction alpha, DirectionBias horizontalBias, DirectionBias verticalBias)
*/
- void ScrollTo(const Vector2& position, float duration, AlphaFunction alpha,
- DirectionBias horizontalBias, DirectionBias verticalBias);
+ void ScrollTo(const Vector2& position, float duration, AlphaFunction alpha, DirectionBias horizontalBias, DirectionBias verticalBias);
/**
* @copydoc Toolkit::ScrollView::ScrollTo(unsigned int page)
/**
* @copydoc Toolkit::ScrollView::ScrollTo(Actor& actor)
*/
- void ScrollTo(Actor &actor);
+ void ScrollTo(Actor& actor);
/**
* @copydoc Toolkit::ScrollView::ScrollTo(Actor& actor, float duration)
*/
- void ScrollTo(Actor &actor, float duration);
+ void ScrollTo(Actor& actor, float duration);
/**
* @copydoc Toolkit::ScrollView::SetScrollingDirection()
*/
- void SetScrollingDirection( Radian direction, Radian threshold );
+ void SetScrollingDirection(Radian direction, Radian threshold);
/**
* @copydoc Toolkit::ScrollView::RemoveScrollingDirection()
*/
- void RemoveScrollingDirection( Radian angle );
+ void RemoveScrollingDirection(Radian angle);
/**
* Finds the closest Actor to the current center of the ScrollView.
*
* @return A handle to the actor if found, or an empty handle if not.
*/
- Actor FindClosestActor();
+ Actor FindClosestActor();
/**
* Finds the closest Actor to position in ScrollView
* @param[in] verticalBias (optional) Whether to bias animation to top or bottom (or no biasing)
* @return True if animation necessary and taking place to reach desired transform.
*/
- bool AnimateTo(const Vector2& position, const Vector2& positionDuration,
- AlphaFunction alpha, bool findShortcuts = true,
- DirectionBias horizontalBias = DIRECTION_BIAS_NONE, DirectionBias verticalBias = DIRECTION_BIAS_NONE,
- SnapType snapType = SNAP);
+ bool AnimateTo(const Vector2& position, const Vector2& positionDuration, AlphaFunction alpha, bool findShortcuts = true, DirectionBias horizontalBias = DIRECTION_BIAS_NONE, DirectionBias verticalBias = DIRECTION_BIAS_NONE, SnapType snapType = SNAP);
/**
* @copydoc Toolkit::Scrollable::AddOverlay()
/**
* @copydoc Toolkit::Internal::Scrollable::SetOvershootSize
*/
- void SetOvershootSize( const Vector2& size );
+ void SetOvershootSize(const Vector2& size);
/**
* @copydoc Toolkit::Internal::Scrollable::SetOvershootEffectColor
*/
- void SetOvershootEffectColor( const Vector4& color );
+ void SetOvershootEffectColor(const Vector4& color);
//properties
* @param[in] index The property index.
* @param[in] value The new property value.
*/
- static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
+ static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value);
/**
* Called to retrieve a property of an object of this type.
* @param[in] index The property index.
* @return The current value of the property.
*/
- static Property::Value GetProperty( BaseObject* object, Property::Index index );
+ static Property::Value GetProperty(BaseObject* object, Property::Index index);
public: //Signals
-
/**
* @copydoc Dali::Toolkit::ScrollView::SnapStartedSignal()
*/
* @return True if the signal was connected.
* @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
*/
- static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
+ static bool DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
private: // private overridden functions from CustomActorImpl and Controls
-
/**
* @copydoc Dali::CustomActorImpl::OnSizeAnimation(Animation&, const Vector3&)
*/
/**
* @copydoc CustomActorImpl::OnSizeSet(const Vector3&)
*/
- void OnSizeSet( const Vector3& size ) override;
+ void OnSizeSet(const Vector3& size) override;
/**
* From CustomActorImpl; called after a child has been added to the owning actor.
/**
* @copydoc CustomActorImpl::OnSceneConnection()
*/
- void OnSceneConnection( int depth ) override;
+ void OnSceneConnection(int depth) override;
/**
* @copydoc CustomActorImpl::OnSceneDisconnection()
void EnableScrollOvershoot(bool enable) override;
private:
-
/**
* Called after a touchSignal is received by the owning actor.
*
* @param[in] touch The touch information.
* @return True if the event should be consumed.
*/
- bool OnTouch( Actor actor, const TouchEvent& touch );
+ bool OnTouch(Actor actor, const TouchEvent& touch);
/**
* Start a timer which calls OnTouchDownTimeout()
* @param[in] duration The time in seconds for animation
* @param[in] alpha The alpha function to use for animating
*/
- void AnimateInternalXTo( float position, float duration, AlphaFunction alpha );
+ void AnimateInternalXTo(float position, float duration, AlphaFunction alpha);
/**
* Animates the internal y property to the given value
* @param[in] duration The time in seconds for animation
* @param[in] alpha The alpha function to use for animating
*/
- void AnimateInternalYTo( float position, float duration, AlphaFunction alpha );
+ void AnimateInternalYTo(float position, float duration, AlphaFunction alpha);
/**
* Called whenever a snap animation on the x-axis has completed
* @param[in] source the Animation instance that has completed.
*/
- void OnScrollAnimationFinished( Animation& source );
+ void OnScrollAnimationFinished(Animation& source);
/**
* Called when either the X or Y internal scroll positions have finished snapping back to SCROLL_PRE_POSITION
*
* @param[in] source the Animation instance that has completed.
*/
- void OnSnapInternalPositionFinished( Animation& source );
+ void OnSnapInternalPositionFinished(Animation& source);
/**
* Called whenever a snap animation on the x-axis has completed and we need to snap pre scroll
* position to our clamped position
* @param[in] position The x position to snap pre scroll property to
*/
- void SnapInternalXTo( float position );
+ void SnapInternalXTo(float position);
/**
* Called whenever a snap animation on the y-axis has completed and we need to snap pre scroll
* position to our clamped position
* @param[in] position The y position to snap pre scroll property to
*/
- void SnapInternalYTo( float position );
+ void SnapInternalYTo(float position);
/**
* This is called internally whenever the Scroll Rulers are
*
* @param[in] gesture The gesture event.
*/
- void OnPan( const PanGesture& pan);
+ void OnPan(const PanGesture& pan);
/**
* Extension of the above gestures.
* @param[in,out] position The position you wish to clamp
* @param[out] clamped The results of the clamping.
*/
- void ClampPosition(Vector2& position, ClampState2D &clamped) const;
+ void ClampPosition(Vector2& position, ClampState2D& clamped) const;
/**
* Wraps position within the domain set up by X/Y Rulers
virtual ~ScrollView();
private:
-
/**
* Searches this ScrollView, and attempts to Unbind
* systematically this Actor from the ScrollView attached.
/**
* Checks if the property notifications are active and adds them if not
*/
- void SetScrollUpdateNotification( bool enabled );
+ void SetScrollUpdateNotification(bool enabled);
/**
* Refresh the ScrollView (used when animating to update application developer of changes)
* @param[in] scrollModeMap A map defining the characteristics of X and Y scrolling
* using either FixedRuler or DefaultRuler.
*/
- void SetScrollMode( const Property::Map& scrollModeMap );
+ void SetScrollMode(const Property::Map& scrollModeMap);
private:
-
// Undefined
ScrollView(const ScrollView&);
ScrollView& operator=(const ScrollView& rhs);
private:
+ unsigned long mTouchDownTime; ///< The touch down time
- unsigned long mTouchDownTime; ///< The touch down time
+ int mGestureStackDepth; ///< How many gestures are currently occuring.
+ Vector2 mPanStartPosition; ///< Where the pan gesture's touch down occured
+ Vector2 mPanDelta; ///< Amount currently panned.
- int mGestureStackDepth; ///< How many gestures are currently occuring.
- Vector2 mPanStartPosition; ///< Where the pan gesture's touch down occured
- Vector2 mPanDelta; ///< Amount currently panned.
-
- unsigned int mScrollStateFlags; ///< flags indicating current state of scrolling
+ unsigned int mScrollStateFlags; ///< flags indicating current state of scrolling
// Scroll delegate pre and post position properties...
- Vector2 mScrollPrePosition; ///< Wrapped scroll position, but not clamped
- Vector2 mScrollPostPosition; ///< Wrapped and clamped, this is the final scroll position used
- Vector2 mScrollTargetPosition; ///< Final target position for an animated scroll
- Vector2 mDomainOffset; ///< Domain offset (this keeps track of the domain boundaries that scroll positions traverses)
+ Vector2 mScrollPrePosition; ///< Wrapped scroll position, but not clamped
+ Vector2 mScrollPostPosition; ///< Wrapped and clamped, this is the final scroll position used
+ Vector2 mScrollTargetPosition; ///< Final target position for an animated scroll
+ Vector2 mDomainOffset; ///< Domain offset (this keeps track of the domain boundaries that scroll positions traverses)
// Rulers for each axes...
RulerPtr mRulerX;
Vector2 mMinScroll;
Vector2 mMaxScroll;
- Animation mInternalXAnimation; ///< Animates mPropertyX to a snap position or application requested scroll position
- Animation mInternalYAnimation; ///< Animates mPropertyY to a snap position or application requested scroll position
-
+ Animation mInternalXAnimation; ///< Animates mPropertyX to a snap position or application requested scroll position
+ Animation mInternalYAnimation; ///< Animates mPropertyY to a snap position or application requested scroll position
- Vector2 mLastVelocity; ///< Record the last velocity from PanGesture (Finish event doesn't have correct velocity)
+ Vector2 mLastVelocity; ///< Record the last velocity from PanGesture (Finish event doesn't have correct velocity)
LockAxis mLockAxis;
- Timer mTouchDownTimer; ///< Used to interrupt snap-animation. This cannot be done in OnTouch without breaking fast flick behavior.
+ Timer mTouchDownTimer; ///< Used to interrupt snap-animation. This cannot be done in OnTouch without breaking fast flick behavior.
- float mScrollUpdateDistance; ///< Distance for scrolling to travel for the scroll update notifications
+ float mScrollUpdateDistance; ///< Distance for scrolling to travel for the scroll update notifications
Dali::PropertyNotification mScrollXUpdateNotification; ///< scroll x position update notification
Dali::PropertyNotification mScrollYUpdateNotification; ///< scroll y position update notification
- Actor mInternalActor; ///< Internal actor (we keep internal actors in here e.g. scrollbars, so we can ignore it in searches)
+ Actor mInternalActor; ///< Internal actor (we keep internal actors in here e.g. scrollbars, so we can ignore it in searches)
- ScrollViewEffectContainer mEffects; ///< Container keeping track of all the applied effects.
+ ScrollViewEffectContainer mEffects; ///< Container keeping track of all the applied effects.
- Vector2 mMaxOvershoot; ///< Number of scrollable pixels that will take overshoot from 0.0f to 1.0f
- Vector2 mUserMaxOvershoot; ///< Set by user, allows overriding of default max overshoot for the scroll indicator
- float mSnapOvershootDuration; ///< Duration for overshoot snapping back to Vector2::ZERO
- AlphaFunction mSnapOvershootAlphaFunction; ///< AlphaFunction to be used for this overshoot.
+ Vector2 mMaxOvershoot; ///< Number of scrollable pixels that will take overshoot from 0.0f to 1.0f
+ Vector2 mUserMaxOvershoot; ///< Set by user, allows overriding of default max overshoot for the scroll indicator
+ float mSnapOvershootDuration; ///< Duration for overshoot snapping back to Vector2::ZERO
+ AlphaFunction mSnapOvershootAlphaFunction; ///< AlphaFunction to be used for this overshoot.
- float mSnapDuration; ///< Time for the snap animation to take (in seconds).
- AlphaFunction mSnapAlphaFunction; ///< AlphaFunction to be used for the Snap Animation.
+ float mSnapDuration; ///< Time for the snap animation to take (in seconds).
+ AlphaFunction mSnapAlphaFunction; ///< AlphaFunction to be used for the Snap Animation.
- Vector2 mMinFlickDistance; ///< Minimum pan distance required for a flick
- float mFlickSpeedThreshold; ///< Minimum pan speed required for a flick in pixels/ms
- float mFlickDuration; ///< Time for the flick animation to take (in seconds).
- AlphaFunction mFlickAlphaFunction; ///< AlphaFunction to be used for the Flick Animation.
+ Vector2 mMinFlickDistance; ///< Minimum pan distance required for a flick
+ float mFlickSpeedThreshold; ///< Minimum pan speed required for a flick in pixels/ms
+ float mFlickDuration; ///< Time for the flick animation to take (in seconds).
+ AlphaFunction mFlickAlphaFunction; ///< AlphaFunction to be used for the Flick Animation.
- float mAxisAutoLockGradient; ///< Axis Auto-lock gradient threshold. Above this gradient and it will lock scrolling to closest axis.
- float mFrictionCoefficient; ///< Friction coefficient. Amount of friction to apply to free panning flick animation. in stage.lengths/sec
- float mFlickSpeedCoefficient; ///< Flick velocity coefficient. Input touch velocity is multiplied by this.
- float mMaxFlickSpeed; ///< Maximum flick speed. Maximum speed of flick in stage.lengths/sec.
+ float mAxisAutoLockGradient; ///< Axis Auto-lock gradient threshold. Above this gradient and it will lock scrolling to closest axis.
+ float mFrictionCoefficient; ///< Friction coefficient. Amount of friction to apply to free panning flick animation. in stage.lengths/sec
+ float mFlickSpeedCoefficient; ///< Flick velocity coefficient. Input touch velocity is multiplied by this.
+ float mMaxFlickSpeed; ///< Maximum flick speed. Maximum speed of flick in stage.lengths/sec.
- Vector2 mWheelScrollDistanceStep; ///< The step of scroll distance in actor coordinates in X and Y axes for each wheel event received.
+ Vector2 mWheelScrollDistanceStep; ///< The step of scroll distance in actor coordinates in X and Y axes for each wheel event received.
//ScrollInternalConstraintsPtr mScrollInternalConstraints;
Constraint mScrollMainInternalPrePositionConstraint;
Constraint mScrollMainInternalDomainConstraint;
Constraint mScrollMainInternalPrePositionMaxConstraint;
- ScrollOvershootIndicatorPtr mOvershootIndicator;
+ ScrollOvershootIndicatorPtr mOvershootIndicator;
WeakHandle<Toolkit::ScrollBar> mScrollBar;
Toolkit::ScrollView::SnapStartedSignalType mSnapStartedSignal;
- bool mInAccessibilityPan:1; ///< With AccessibilityPan its easier to move between snap positions
- bool mScrolling:1; ///< Flag indicating whether the scroll view is being scrolled (by user or animation)
- bool mScrollInterrupted:1; ///< Flag set for when a down event interrupts a scroll
- bool mPanning:1; ///< Whether scroll view is currently panning or not
- bool mSensitive:1; ///< Scroll Sensitivity Flag.
- bool mTouchDownTimeoutReached:1; ///< Indicates when down event timeout occured without corresponding up event (touch still down)
- bool mActorAutoSnapEnabled:1; ///< Whether to automatically snap to closest actor.
- bool mAutoResizeContainerEnabled:1; ///< Whether to automatically resize container (affects RulerDomain's on X/Y axes)
- bool mWrapMode:1; ///< Whether to wrap contents based on container size.
- bool mAxisAutoLock:1; ///< Whether to automatically lock axis when panning.
- bool mAlterChild:1; ///< Internal flag to control behavior of OnChildAdd/OnChildRemove when Adding internal Actors.
- bool mDefaultMaxOvershoot:1; ///< Whether to use default max overshoot or application defined one
- bool mCanScrollHorizontal:1; ///< Local value of our property to check against
- bool mCanScrollVertical:1; ///< Local value of our property to check against
- bool mTransientScrollBar:1; ///< True if scroll-bar should be automatically show/hidden during/after panning
+ bool mInAccessibilityPan : 1; ///< With AccessibilityPan its easier to move between snap positions
+ bool mScrolling : 1; ///< Flag indicating whether the scroll view is being scrolled (by user or animation)
+ bool mScrollInterrupted : 1; ///< Flag set for when a down event interrupts a scroll
+ bool mPanning : 1; ///< Whether scroll view is currently panning or not
+ bool mSensitive : 1; ///< Scroll Sensitivity Flag.
+ bool mTouchDownTimeoutReached : 1; ///< Indicates when down event timeout occured without corresponding up event (touch still down)
+ bool mActorAutoSnapEnabled : 1; ///< Whether to automatically snap to closest actor.
+ bool mAutoResizeContainerEnabled : 1; ///< Whether to automatically resize container (affects RulerDomain's on X/Y axes)
+ bool mWrapMode : 1; ///< Whether to wrap contents based on container size.
+ bool mAxisAutoLock : 1; ///< Whether to automatically lock axis when panning.
+ bool mAlterChild : 1; ///< Internal flag to control behavior of OnChildAdd/OnChildRemove when Adding internal Actors.
+ bool mDefaultMaxOvershoot : 1; ///< Whether to use default max overshoot or application defined one
+ bool mCanScrollHorizontal : 1; ///< Local value of our property to check against
+ bool mCanScrollVertical : 1; ///< Local value of our property to check against
+ bool mTransientScrollBar : 1; ///< True if scroll-bar should be automatically show/hidden during/after panning
};
} // namespace Internal
#define DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_PAGE_PATH_EFFECT_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/animation/linear-constrainer.h>
#include <dali/devel-api/animation/path-constrainer.h>
+#include <dali/public-api/animation/linear-constrainer.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-effect-impl.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/**
* @copydoc Toolkit::ScrollViewPagePathEffect
*/
class ScrollViewPagePathEffect : public ScrollViewEffect
{
-
public:
-
/**
* Constructor
* @param[in] path Pages will follow this path
* @param[in] viewPageSize size of a page in the scrollview
* @param[in] pageCount total number of pages in the scrollview
*/
- ScrollViewPagePathEffect(Path path, const Vector3& forward, Dali::Property::Index inputPropertyIndex, const Vector3& viewPageSize, unsigned int pageCount );
+ ScrollViewPagePathEffect(Path path, const Vector3& forward, Dali::Property::Index inputPropertyIndex, const Vector3& viewPageSize, unsigned int pageCount);
public:
-
/**
* @copydoc ScrollViewEffect::ApplyToActor
*/
- void ApplyToPage( Actor child, unsigned int pageOrder );
+ void ApplyToPage(Actor child, unsigned int pageOrder);
public:
-
/**
* @copydoc ScrollViewEffect::OnAttach
*/
- void OnAttach( Toolkit::ScrollView& scrollView ) override;
+ void OnAttach(Toolkit::ScrollView& scrollView) override;
/**
* @copydoc ScrollViewEffect::OnDetach
*/
- void OnDetach( Toolkit::ScrollView& scrollView ) override;
+ void OnDetach(Toolkit::ScrollView& scrollView) override;
protected:
-
/**
* A reference counted object may only be deleted by calling Unreference()
*/
virtual ~ScrollViewPagePathEffect();
private:
-
- Vector3 mPageSize; ///< The logical page size for the 3D effect.
- PathConstrainer mPathConstrainer; ///< PathConstrainer used to constraint position and orientation
- LinearConstrainer mLinearConstrainer; ///< LinearConstrainer used to constraint opacity
- Dali::Property::Index mInputPropertyIndex; ///< Index of the property in the scrollview used as the parameter for the path
- unsigned int mPageCount; ///< Total number of pages (Needed for wrapping)
+ Vector3 mPageSize; ///< The logical page size for the 3D effect.
+ PathConstrainer mPathConstrainer; ///< PathConstrainer used to constraint position and orientation
+ LinearConstrainer mLinearConstrainer; ///< LinearConstrainer used to constraint opacity
+ Dali::Property::Index mInputPropertyIndex; ///< Index of the property in the scrollview used as the parameter for the path
+ unsigned int mPageCount; ///< Total number of pages (Needed for wrapping)
};
} // namespace Internal
#define DALI_TOOLKIT_INTERNAL_SCROLLABLE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/animation/alpha-function.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/internal/controls/control/control-data-impl.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/controls/scrollable/scrollable.h>
-#include <dali-toolkit/internal/controls/control/control-data-impl.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class Scrollable;
typedef IntrusivePtr<Scrollable> ScrollablePtr;
class Scrollable : public Control
{
public:
-
/**
* @copydoc Dali::Toolkit::Scrollable::IsOvershootEnabled
*/
* @param[in] position The position to scroll to.
* @param[in] duration The duration of the animation in seconds
*/
- virtual void ScrollTo(const Vector2 &position, float duration) = 0;
+ virtual void ScrollTo(const Vector2& position, float duration) = 0;
/**
* Set the color of the overshoot effect.
* @parm[in] color The color of the overshoot effect
*/
- virtual void SetOvershootEffectColor( const Vector4& color ) = 0;
+ virtual void SetOvershootEffectColor(const Vector4& color) = 0;
/**
* Retrieve the color of the overshoot effect.
/**
* @copydoc Dali::Toolkit::Scrollable::SetOvershootAnimationSpeed(float pixelsPerSecond)
*/
- void SetOvershootAnimationSpeed( float pixelsPerSecond );
+ void SetOvershootAnimationSpeed(float pixelsPerSecond);
/**
* @copydoc Dali::Toolkit::Scrollable::GetOvershootAnimationSpeed()
* Set the size of the overshoot effect.
* @parm[in] size The size of the overshoot effect
*/
- virtual void SetOvershootSize( const Vector2& size ) = 0;
+ virtual void SetOvershootSize(const Vector2& size) = 0;
protected: // From Control
struct AccessibleImpl : public Control::Impl::AccessibleImpl
virtual void OnInitialize() override;
private:
-
/**
* Temporary function to override EnableScrollOvershoot functionality for overshoot
* Only ScrollView needs to override this as HQ has not requested disable functionality in ItemView
* @param[in] enable true to enable, false to disable overshoot indicator
*/
- virtual void EnableScrollOvershoot(bool enable) {}
+ virtual void EnableScrollOvershoot(bool enable)
+ {
+ }
public: //Signals
-
/**
* @copydoc Dali::Toolkit::Scrollable::ScrollStartedSignal()
*/
* @return True if the signal was connected.
* @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
*/
- static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
+ static bool DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
//properties
* @param[in] index The property index.
* @param[in] value The new property value.
*/
- static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
+ static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value);
/**
* Called to retrieve a property of an object of this type.
* @param[in] index The property index.
* @return The current value of the property.
*/
- static Property::Value GetProperty( BaseObject* object, Property::Index index );
+ static Property::Value GetProperty(BaseObject* object, Property::Index index);
protected:
-
/**
* Removed default constructor.
*/
*
* @param[in] behaviourFlags Flags to enable
*/
- Scrollable( ControlBehaviour behaviourFlags );
+ Scrollable(ControlBehaviour behaviourFlags);
/**
* A reference counted object may only be deleted by calling Unreference()
virtual ~Scrollable();
private:
-
/**
* Gets position property.
*
Vector2 GetPropertyPosition() const;
private:
-
// Undefined
Scrollable(const Scrollable&);
Scrollable& operator=(const Scrollable& rhs);
protected:
-
- Vector4 mOvershootEffectColor; ///<The color of the overshoot bouncing effect
- float mOvershootAnimationSpeed; ///<The speed of the overshoot animation (pixels per second)
- Vector2 mOvershootSize; ///<The size of the overshoot effect
+ Vector4 mOvershootEffectColor; ///<The color of the overshoot bouncing effect
+ float mOvershootAnimationSpeed; ///<The speed of the overshoot animation (pixels per second)
+ Vector2 mOvershootSize; ///<The size of the overshoot effect
Dali::AlphaFunction::BuiltinFunction mScrollToAlphaFunction; ///< The ScrollTo() animations use this
- Toolkit::Scrollable::ScrollStartedSignalType mScrollStartedSignal;
- Toolkit::Scrollable::ScrollUpdatedSignalType mScrollUpdatedSignal;
+ Toolkit::Scrollable::ScrollStartedSignalType mScrollStartedSignal;
+ Toolkit::Scrollable::ScrollUpdatedSignalType mScrollUpdatedSignal;
Toolkit::Scrollable::ScrollCompletedSignalType mScrollCompletedSignal;
private:
-
- bool mOvershootEnabled:1;
+ bool mOvershootEnabled : 1;
};
} // namespace Internal
#define DALI_TOOLKIT_INTERNAL_SHADOW_VIEW_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <sstream>
-#include <cmath>
#include <dali/public-api/actors/camera-actor.h>
#include <dali/public-api/animation/constraints.h>
-#include <dali/public-api/render-tasks/render-task.h>
#include <dali/public-api/object/property-map.h>
+#include <dali/public-api/render-tasks/render-task.h>
+#include <cmath>
+#include <sstream>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/controls/shadow-view/shadow-view.h>
-#include <dali-toolkit/public-api/controls/image-view/image-view.h>
-#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/internal/filters/blur-two-pass-filter.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
namespace Dali
{
-
namespace Toolkit
{
-
class ShadowView;
namespace Internal
{
-
/**
* ShadowView implementation class
*/
class ShadowView : public Control
{
public:
-
/**
* @copydoc Dali::Toolkit::ShadowView::ShadowView
*/
/**
* @copydoc Dali::Toolkit::ShadowView::GetBlurStrengthPropertyIndex()
*/
- Property::Index GetBlurStrengthPropertyIndex() const {return mBlurStrengthPropertyIndex;}
+ Property::Index GetBlurStrengthPropertyIndex() const
+ {
+ return mBlurStrengthPropertyIndex;
+ }
/**
* @copydoc Dali::Toolkit::ShadowView::GetShadowColorPropertyIndex()
*/
- Property::Index GetShadowColorPropertyIndex() const {return mShadowColorPropertyIndex;}
+ Property::Index GetShadowColorPropertyIndex() const
+ {
+ return mShadowColorPropertyIndex;
+ }
void SetShaderConstants();
private:
-
void OnInitialize() override;
/**
* @copydoc Control::OnChildAdd()
*/
- void OnChildAdd( Actor& child ) override;
+ void OnChildAdd(Actor& child) override;
/**
* @copydoc Control::OnChildRemove()
*/
- void OnChildRemove( Actor& child ) override;
+ void OnChildRemove(Actor& child) override;
/**
* Constrain the camera actor to the position of the point light, pointing
void CreateBlurFilter();
private:
- Actor mShadowPlane; // Shadow renders into this actor
+ Actor mShadowPlane; // Shadow renders into this actor
Actor mShadowPlaneBg; // mShadowPlane renders directly in front of this actor
- Actor mPointLight; // Shadow is cast from this point light
+ Actor mPointLight; // Shadow is cast from this point light
/////////////////////////////////////////////////////////////
- FrameBuffer mSceneFromLightRenderTarget; // for rendering normal scene seen from light to texture instead of the screen
+ FrameBuffer mSceneFromLightRenderTarget; // for rendering normal scene seen from light to texture instead of the screen
FrameBuffer mOutputFrameBuffer;
- Actor mChildrenRoot; // Subtree for all user added child actors that should be rendered normally
- Actor mBlurRootActor; // Root actor for blur filter processing
+ Actor mChildrenRoot; // Subtree for all user added child actors that should be rendered normally
+ Actor mBlurRootActor; // Root actor for blur filter processing
RenderTask mRenderSceneTask;
CameraActor mCameraActor; // Constrained to same position as mPointLight and pointing at mShadowPlane
- Property::Map mShadowVisualMap;
+ Property::Map mShadowVisualMap;
BlurTwoPassFilter mBlurFilter;
- Vector4 mCachedShadowColor; ///< Cached Shadow color.
- Vector4 mCachedBackgroundColor; ///< Cached Shadow background color (same as shadow color but with alpha at 0.0)
+ Vector4 mCachedShadowColor; ///< Cached Shadow color.
+ Vector4 mCachedBackgroundColor; ///< Cached Shadow background color (same as shadow color but with alpha at 0.0)
/////////////////////////////////////////////////////////////
// Properties that can be animated
Property::Index mBlurStrengthPropertyIndex;
Property::Index mShadowColorPropertyIndex;
- float mDownsampleWidthScale;
- float mDownsampleHeightScale;
+ float mDownsampleWidthScale;
+ float mDownsampleHeightScale;
private:
-
// Undefined copy constructor.
- ShadowView( const ShadowView& );
+ ShadowView(const ShadowView&);
// Undefined assignment operator.
- ShadowView& operator=( const ShadowView& );
+ ShadowView& operator=(const ShadowView&);
};
} // namespace Internal
-
// Helpers for public-api forwarding methods
-inline Toolkit::Internal::ShadowView& GetImpl( Toolkit::ShadowView& obj )
+inline Toolkit::Internal::ShadowView& GetImpl(Toolkit::ShadowView& obj)
{
DALI_ASSERT_ALWAYS(obj);
Dali::RefObject& handle = obj.GetImplementation();
return static_cast<Toolkit::Internal::ShadowView&>(handle);
}
-inline const Toolkit::Internal::ShadowView& GetImpl( const Toolkit::ShadowView& obj )
+inline const Toolkit::Internal::ShadowView& GetImpl(const Toolkit::ShadowView& obj)
{
DALI_ASSERT_ALWAYS(obj);
const Dali::RefObject& handle = obj.GetImplementation();
return static_cast<const Toolkit::Internal::ShadowView&>(handle);
}
-
} // namespace Toolkit
} // namespace Dali
#define DALI_TOOLKIT_INTERNAL_SLIDER_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/object/property-map.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/internal/controls/control/control-data-impl.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
#include <dali-toolkit/public-api/controls/slider/slider.h>
#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
-#include <dali-toolkit/public-api/controls/image-view/image-view.h>
-#include <dali-toolkit/internal/controls/control/control-data-impl.h>
namespace Dali
{
-
namespace Toolkit
{
-
class Button;
namespace Internal
{
-
class Slider;
-typedef Dali::IntrusivePtr< Slider > SliderPtr;
+typedef Dali::IntrusivePtr<Slider> SliderPtr;
/**
* @copydoc Toolkit::Slider
class Slider : public Control
{
public:
-
typedef Property::Array MarkList;
/**
static Dali::Toolkit::Slider New();
public:
-
// Properties
/**
*
* @param[in] marks The list of marks to set
*/
- void SetMarks( const MarkList& marks );
+ void SetMarks(const MarkList& marks);
/**
* Get the list of marks
*
* @param[in] snap Flag to snap to marks or not
*/
- void SetSnapToMarks( bool snap );
+ void SetSnapToMarks(bool snap);
/**
* Return if snap to marks is set or not
*
* @param[in] value The value to set. Will be clamped to [lowerBound .. upperBound]
*/
- void SetValue( float value );
+ void SetValue(float value);
/**
* Get the value of the slider
*
* @param[in] region The hit region
*/
- void SetHitRegion( const Vector2& region );
+ void SetHitRegion(const Vector2& region);
/**
* Get hit region
*
* @param[in] region The track region
*/
- void SetTrackRegion( const Vector2& region );
+ void SetTrackRegion(const Vector2& region);
/**
* Get the track region
*
* @param[in] color The disabled color.
*/
- void SetDisabledColor( const Vector4& color );
+ void SetDisabledColor(const Vector4& color);
/**
* @brief Get disabled color
*
* @param[in] precision The number of decimal places to use for printing numbers
*/
- void SetValuePrecision( int precision );
+ void SetValuePrecision(int precision);
/**
* Get value precision
*
* @param[in] showPopup The show popup flag
*/
- void SetShowPopup( bool showPopup );
+ void SetShowPopup(bool showPopup);
/**
* Get show value in popup
*
* @param[in] showValue The show value flag
*/
- void SetShowValue( bool showValue );
+ void SetShowValue(bool showValue);
/**
* Get show value on handle
*
* param[in] enabled Set the enabled flag
*/
- void SetEnabled( bool enabled );
+ void SetEnabled(bool enabled);
/**
* Return if enabled or not
*
* @param[in] tolerance The percentage of width for which to snap
*/
- void SetMarkTolerance( float tolerance );
+ void SetMarkTolerance(float tolerance);
/**
* Return the mark tolerance
* @return True if the signal was connected.
* @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
*/
- static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName,
- FunctorDelegate* functor );
+ static bool DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
// Properties
* @param[in] index The property index.
* @param[in] value The new property value.
*/
- static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
+ static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value);
/**
* Called to retrieve a property of an object of this type.
* @param[in] index The property index.
* @return The current value of the property.
*/
- static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex );
+ static Property::Value GetProperty(BaseObject* object, Property::Index propertyIndex);
protected:
-
/**
* Construct a new Slider.
*/
/**
* @copydoc CustomActorImpl::OnRelayout
*/
- void OnRelayout( const Vector2& size, RelayoutContainer& container ) override;
-
+ void OnRelayout(const Vector2& size, RelayoutContainer& container) override;
private:
-
/**
* Domain is a from/to pair
*/
Domain()
{
}
- Domain( Vector2 fromVal, Vector2 toVal )
- : from( fromVal ), to( toVal )
+ Domain(Vector2 fromVal, Vector2 toVal)
+ : from(fromVal),
+ to(toVal)
{
}
};
};
private:
-
/**
* @copydoc Toolkit::Control::OnInitialize()
*/
* @param[in] touch The touch info
* @return If touch is handled or not
*/
- bool OnTouch( Actor actor, const TouchEvent& touch );
+ bool OnTouch(Actor actor, const TouchEvent& touch);
/**
* Pan gesture event
* @param[in] actor The actor the event is raised for
* @param[in] gesture The pan event info
*/
- void OnPan( Actor actor, const PanGesture& gesture );
+ void OnPan(Actor actor, const PanGesture& gesture);
/**
* Map a position onto a domain and return the result as a percentage
* @param[in] point The point to map onto the domain
* @return The result as a percentage [0..1]
*/
- float MapPercentage( const Vector2& point );
+ float MapPercentage(const Vector2& point);
/**
* Map a value in the range to a percentage
* @param[in] point The value in range [lowerBound..upperBound]
* @return The result as a percentage [0..1]
*/
- float MapValuePercentage( float value );
+ float MapValuePercentage(float value);
/**
* Convert a point in local hit space into domain space
* @param[in] x The x position to convert
* @return The x position in domain space
*/
- float HitSpaceToDomain( float x );
+ float HitSpaceToDomain(float x);
/**
* Map a percentage onto the slider's bounds
* @param[in] upperBound The upper bound to map onto
* @return The value of percent mapped from lowerBound to upperBound
*/
- float MapBounds( float percent, float lowerBound, float upperBound );
+ float MapBounds(float percent, float lowerBound, float upperBound);
/**
* Get the range of the valid values the slider handle can move between
* @param[in] currentSize The current size of the slider
* @return The range as a domain pair
*/
- Domain CalcDomain( const Vector2& currentSize );
+ Domain CalcDomain(const Vector2& currentSize);
/**
* Create the hit region
*
* @param[in] value The value to display in the popup
*/
- void DisplayPopup( float value );
+ void DisplayPopup(float value);
/**
* If there are marks present, filter the incoming percent based on snapping to any nearby marks
* @param[in] value The incoming value on the slider to filter
* @return The filtered percentage snapped to any nearby marks
*/
- float MarkFilter( float value );
+ float MarkFilter(float value);
/**
* If there are marks present, snap the incoming percent to the nearest mark
* @param[in] value The incoming value on the slider to snap
* @return The filtered percentage snapped to the nearest mark
*/
- float SnapToMark( float value );
+ float SnapToMark(float value);
/**
* Search for if a mark has been reached
* @param[out] outIndex The index of the mark if found
* @return If a mark has been found to match percent
*/
- bool MarkReached( float value, int& outIndex );
+ bool MarkReached(float value, int& outIndex);
/**
* Handler for when the value view needs to be hidden
* @paramp[in] value The value to set
* @param[in] raiseSignals Configure signals to be raised or not.
*/
- void DisplayValue( float value, bool raiseSignals );
+ void DisplayValue(float value, bool raiseSignals);
/**
* Create the image for the track
*
* @param[in] filename The track image
*/
- void SetTrackVisual( const std::string& filename );
+ void SetTrackVisual(const std::string& filename);
/**
* @brief Set the track visual from an Dali::Property::Map
*
* @param[in] map The Dali::Property::Map to use for to display
*/
- void SetTrackVisual( Dali::Property::Map map );
+ void SetTrackVisual(Dali::Property::Map map);
/**
* @brief Return the track image.
*
* @param[in] filename The progress bar image
*/
- void SetProgressVisual( const std::string& filename );
+ void SetProgressVisual(const std::string& filename);
/**
* @brief Set the progress visual from an Dali::Property::Map
*
* @param[in] map The Dali::Property::Map to use for to display
*/
- void SetProgressVisual( Dali::Property::Map map );
+ void SetProgressVisual(Dali::Property::Map map);
/**
* @brief Return the progress bar image.
*
* @param[in] filename The popup image
*/
- void CreatePopupImage( const std::string& filename );
+ void CreatePopupImage(const std::string& filename);
/**
* @brief Set the popup image
*
* @param[in] filename The popup image to set
*/
- void SetPopupVisual( const std::string& filename );
+ void SetPopupVisual(const std::string& filename);
/**
* @brief Set the popup from an Dali::Property::Map
*
* @param[in] map The Dali::Property::Map to use for to display
*/
- void SetPopupVisual( Dali::Property::Map map );
+ void SetPopupVisual(Dali::Property::Map map);
/**
* @brief Return the popup image.
*
* @param[in] filename The popup arrow image to set
*/
- void SetPopupArrowVisual( const std::string& filename );
+ void SetPopupArrowVisual(const std::string& filename);
/**
* @brief Set the popup arrow from an Dali::Property::Map
*
* @param[in] map The Dali::Property::Map to use for to display
*/
- void SetPopupArrowVisual( Dali::Property::Map map );
+ void SetPopupArrowVisual(Dali::Property::Map map);
/**
* @brief Return the popup arrow image.
*
* @param[in] filename The popup arrow image to load and set
*/
- void CreatePopupArrowImage( const std::string& filename );
+ void CreatePopupArrowImage(const std::string& filename);
/**
* Set the size of the progress bar region
*
* @param[in] region The size of the region to set
*/
- void ResizeProgressRegion( const Vector2& region );
+ void ResizeProgressRegion(const Vector2& region);
/**
* Create the image for the handle
*
* @param[in] filename The handle image
*/
- void SetHandleVisual( const std::string& filename );
+ void SetHandleVisual(const std::string& filename);
/**
* @brief Set the handle visual from an Dali::Property::Map
*
* @param[in] map The Dali::Property::Map to use for to display
*/
- void SetHandleVisual( Property::Map map );
+ void SetHandleVisual(Property::Map map);
/**
* @brief Return the handle image.
*
* @param[in] size The size of the handle to set
*/
- void ResizeHandleSize( const Vector2& size );
+ void ResizeHandleSize(const Vector2& size);
/**
* Create and display the value on the handle
*
* @param[in] size The handle size
*/
- void SetHandleSize( const Vector2& size );
+ void SetHandleSize(const Vector2& size);
/**
* Get the size of the handle
*
* @param[in] bound The value to set for the lower bound
*/
- void SetLowerBound( float bound );
+ void SetLowerBound(float bound);
/**
* Get the lower bound of the slider's value
*
* @param[in] bound The value to set for the upper bound
*/
- void SetUpperBound( float bound );
+ void SetUpperBound(float bound);
/**
* Get the upper bound of the slider's value
float GetUpperBound() const;
private:
-
// Undefined
- Slider( const Slider& );
+ Slider(const Slider&);
// Undefined
- Slider& operator=( const Slider& rhs );
+ Slider& operator=(const Slider& rhs);
private:
+ Domain mDomain; ///< Current domain of the handle
- Domain mDomain; ///< Current domain of the handle
-
- Actor mHitArea; ///< The input handler
- Actor mValueDisplay; ///< Display of the value
- Toolkit::ImageView mTrack; ///< Track image
- Toolkit::ImageView mHandle; ///< Slider handle
- Toolkit::ImageView mProgress; ///< Progress bar
- Toolkit::ImageView mPopup; ///< Popup backing
- Toolkit::ImageView mPopupArrow; ///< Popup arrow backing
+ Actor mHitArea; ///< The input handler
+ Actor mValueDisplay; ///< Display of the value
+ Toolkit::ImageView mTrack; ///< Track image
+ Toolkit::ImageView mHandle; ///< Slider handle
+ Toolkit::ImageView mProgress; ///< Progress bar
+ Toolkit::ImageView mPopup; ///< Popup backing
+ Toolkit::ImageView mPopupArrow; ///< Popup arrow backing
Toolkit::TextLabel mValueTextLabel; //< The text value in popup
Toolkit::TextLabel mHandleValueTextLabel; ///< The text value on handle
- Vector2 mHandleLastTouchPoint; ///< The last touch point for the handle
- Timer mValueTimer; ///< Timer used to hide value view
+ Vector2 mHandleLastTouchPoint; ///< The last touch point for the handle
+ Timer mValueTimer; ///< Timer used to hide value view
- Toolkit::Slider::ValueChangedSignalType mValueChangedSignal; ///< Signal emitted when the value is changed
- Toolkit::Slider::ValueChangedSignalType mSlidingFinishedSignal; ///< Signal emitted when a sliding is finished
- Toolkit::Slider::MarkReachedSignalType mMarkReachedSignal; ///< Signal emitted when a mark is reached
+ Toolkit::Slider::ValueChangedSignalType mValueChangedSignal; ///< Signal emitted when the value is changed
+ Toolkit::Slider::ValueChangedSignalType mSlidingFinishedSignal; ///< Signal emitted when a sliding is finished
+ Toolkit::Slider::MarkReachedSignalType mMarkReachedSignal; ///< Signal emitted when a mark is reached
- SliderState mState; ///< The state of the slider
+ SliderState mState; ///< The state of the slider
- PanGestureDetector mPanDetector; ///< Hit region pan detector
+ PanGestureDetector mPanDetector; ///< Hit region pan detector
- MarkList mMarks; ///< List of discreet marks
+ MarkList mMarks; ///< List of discreet marks
- std::string mPopupVisual; ///< Image for popup image
- std::string mPopupArrowVisual; ///< Image for popup arrow image
- std::string mTrackVisual; ///< Image for track image
- std::string mHandleVisual; ///< Image for handle image
- std::string mProgressVisual; ///< Image for progress bar image
+ std::string mPopupVisual; ///< Image for popup image
+ std::string mPopupArrowVisual; ///< Image for popup arrow image
+ std::string mTrackVisual; ///< Image for track image
+ std::string mHandleVisual; ///< Image for handle image
+ std::string mProgressVisual; ///< Image for progress bar image
- Property::Map mPopupMap; ///< the Property::Map if the image came from a Property::Map, empty otherwise
- Property::Map mTrackMap; ///< the Property::Map if the image came from a Property::Map, empty otherwise
- Property::Map mHandleMap; ///< the Property::Map if the image came from a Property::Map, empty otherwise
- Property::Map mProgressMap; ///< the Property::Map if the image came from a Property::Map, empty otherwise
- Property::Map mPopupArrowMap; ///< the Property::Map if the image came from a Property::Map, empty otherwise
+ Property::Map mPopupMap; ///< the Property::Map if the image came from a Property::Map, empty otherwise
+ Property::Map mTrackMap; ///< the Property::Map if the image came from a Property::Map, empty otherwise
+ Property::Map mHandleMap; ///< the Property::Map if the image came from a Property::Map, empty otherwise
+ Property::Map mProgressMap; ///< the Property::Map if the image came from a Property::Map, empty otherwise
+ Property::Map mPopupArrowMap; ///< the Property::Map if the image came from a Property::Map, empty otherwise
- Vector4 mDisabledColor; ///< The color to tint the slider when disabled
+ Vector4 mDisabledColor; ///< The color to tint the slider when disabled
- Vector2 mHitRegion; ///< Size of hit region
- Vector2 mTrackRegion; ///< Size of track region
- Vector2 mHandleSize; ///< Size of the handle
+ Vector2 mHitRegion; ///< Size of hit region
+ Vector2 mTrackRegion; ///< Size of track region
+ Vector2 mHandleSize; ///< Size of the handle
- float mLowerBound = 0.0f; ///< Lower bound on value
- float mUpperBound = 1.0f; ///< Upper bound on value
- float mValue = 0.0f; ///< Current value of slider
+ float mLowerBound = 0.0f; ///< Lower bound on value
+ float mUpperBound = 1.0f; ///< Upper bound on value
+ float mValue = 0.0f; ///< Current value of slider
- float mMarkTolerance = 0.05f; ///< Tolerance in percentage of slider width for which to snap to marks
+ float mMarkTolerance = 0.05f; ///< Tolerance in percentage of slider width for which to snap to marks
- int mValuePrecision; ///< The precision to use for outputting the value
+ int mValuePrecision; ///< The precision to use for outputting the value
- bool mShowPopup : 1, ///< Show the popup or not
- mShowValue : 1, ///< Whether to display the value number or not on the handle
- mSnapToMarks : 1; ///< Turn on or off snapping to marks
+ bool mShowPopup : 1, ///< Show the popup or not
+ mShowValue : 1, ///< Whether to display the value number or not on the handle
+ mSnapToMarks : 1; ///< Turn on or off snapping to marks
protected:
struct AccessibleImpl : public Control::Impl::AccessibleImpl,
double GetMinimum() override;
double GetCurrent() override;
double GetMaximum() override;
- bool SetCurrent( double ) override;
+ bool SetCurrent(double) override;
double GetMinimumIncrement() override;
};
};
// Helpers for public-api forwarding methods
-inline Toolkit::Internal::Slider& GetImpl( Toolkit::Slider& pub )
+inline Toolkit::Internal::Slider& GetImpl(Toolkit::Slider& pub)
{
- DALI_ASSERT_ALWAYS( pub );
+ DALI_ASSERT_ALWAYS(pub);
Dali::RefObject& handle = pub.GetImplementation();
- return static_cast< Toolkit::Internal::Slider& >( handle );
+ return static_cast<Toolkit::Internal::Slider&>(handle);
}
-inline const Toolkit::Internal::Slider& GetImpl( const Toolkit::Slider& pub )
+inline const Toolkit::Internal::Slider& GetImpl(const Toolkit::Slider& pub)
{
- DALI_ASSERT_ALWAYS( pub );
+ DALI_ASSERT_ALWAYS(pub);
const Dali::RefObject& handle = pub.GetImplementation();
- return static_cast< const Toolkit::Internal::Slider& >( handle );
+ return static_cast<const Toolkit::Internal::Slider&>(handle);
}
} // namespace Toolkit
#define DALI_TOOLKIT_INTERNAL_SUPER_BLUR_VIEW_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/rendering/renderer.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali-toolkit/devel-api/controls/super-blur-view/super-blur-view.h>
#include <dali-toolkit/devel-api/controls/gaussian-blur-view/gaussian-blur-view.h>
+#include <dali-toolkit/devel-api/controls/super-blur-view/super-blur-view.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
namespace Dali
{
-
namespace Toolkit
{
-
class SuperBlurView;
namespace Internal
{
-
/**
* SuperBlurView implementation class
*/
class SuperBlurView : public Control
{
-
public:
-
/**
* @copydoc Dali::Toolkit::SuperBlurView::New
*/
- static Toolkit::SuperBlurView New( unsigned int blurLevels );
+ static Toolkit::SuperBlurView New(unsigned int blurLevels);
/**
* @copydoc Dali::Toolkit::SuperBlurView::SetImage
*/
- void SetTexture( Texture texture );
+ void SetTexture(Texture texture);
/**
* @copydoc Dali::Toolkit::SuperBlurView::GetBlurStrengthPropertyIndex
/**
* @copydoc Dali::Toolkit::SuperBlurView::SetBlurStrength
*/
- void SetBlurStrength( float blurStrength );
+ void SetBlurStrength(float blurStrength);
/**
* @copydoc Dali::Toolkit::SuperBlurView::GetCurrentBlurStrength
/**
* @copydoc Dali::Toolkit::SuperBlurView::GetBlurredTexture
*/
- Texture GetBlurredTexture( unsigned int level );
+ Texture GetBlurredTexture(unsigned int level);
// Properties
* @param[in] index The property index.
* @param[in] value The new property value.
*/
- static void SetProperty( BaseObject* object, Property::Index propertyIndex, const Property::Value& value );
+ static void SetProperty(BaseObject* object, Property::Index propertyIndex, const Property::Value& value);
/**
* Called to retrieve a property of an object of this type.
* @param[in] index The property index.
* @return The current value of the property.
*/
- static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex );
+ static Property::Value GetProperty(BaseObject* object, Property::Index propertyIndex);
protected:
-
/**
* Constructor. It initializes the SuperBlurView members
*/
- SuperBlurView( unsigned int blurLevels );
+ SuperBlurView(unsigned int blurLevels);
/**
* A reference counted object may only be deleted by calling Unreference()
virtual ~SuperBlurView();
private: // from Control
-
/**
* @copydoc Toolkit::Control::OnInitialize
*/
/**
* @copydoc CustomActorImpl::OnSceneConnection()
*/
- void OnSceneConnection( int depth ) override;
+ void OnSceneConnection(int depth) override;
/**
* @copydoc CustomActorImpl::OnSceneDisconnection()
Vector3 GetNaturalSize() override;
private:
-
/**
* Carry out the idx-th pass of blurring
* @param[in] idx The blur pass index
* @param[in] texture The input texture for the current blurring, it is either the original image or the blurred texture from the previous pass
*/
- void BlurTexture( unsigned int idx, Texture texture );
+ void BlurTexture(unsigned int idx, Texture texture);
/**
* Signal handler to tell when the last blur view completes
* @param[in] blurView The blur view that just completed
*/
- void OnBlurViewFinished( Toolkit::GaussianBlurView blurView );
+ void OnBlurViewFinished(Toolkit::GaussianBlurView blurView);
/**
* Clear the resources used to create the blurred image
Toolkit::SuperBlurView::SuperBlurViewSignal mBlurFinishedSignal; ///< Signal emitted when blur has completed.
- std::string mUrl;
- Property::Index mBlurStrengthPropertyIndex;
- unsigned int mBlurLevels;
- bool mResourcesCleared;
+ std::string mUrl;
+ Property::Index mBlurStrengthPropertyIndex;
+ unsigned int mBlurLevels;
+ bool mResourcesCleared;
};
-}
+} // namespace Internal
// Helpers for public-api forwarding methods
-inline Toolkit::Internal::SuperBlurView& GetImpl( Toolkit::SuperBlurView& obj )
+inline Toolkit::Internal::SuperBlurView& GetImpl(Toolkit::SuperBlurView& obj)
{
DALI_ASSERT_ALWAYS(obj);
Dali::RefObject& handle = obj.GetImplementation();
return static_cast<Toolkit::Internal::SuperBlurView&>(handle);
}
-inline const Toolkit::Internal::SuperBlurView& GetImpl( const Toolkit::SuperBlurView& obj )
+inline const Toolkit::Internal::SuperBlurView& GetImpl(const Toolkit::SuperBlurView& obj)
{
DALI_ASSERT_ALWAYS(obj);
const Dali::RefObject& handle = obj.GetImplementation();
return static_cast<const Toolkit::Internal::SuperBlurView&>(handle);
}
-}
+} // namespace Toolkit
-}
+} // namespace Dali
#endif // DALI_TOOLKIT_INTERNAL_SUPER_BLUR_VIEW_H
#define DALI_ARRAY2D_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
/**
* Helper wrapper for two dimensional array using std::vector
* Usage:
* intArray.Resize( 4, 4 );
* </code>
*/
-template< typename T >
+template<typename T>
class Array2d
{
public:
-
/**
* Default constructor. Creates a 0x0 array
*/
Array2d()
- : mArray( 0, std::vector< T >( 0 ) )
- { }
+ : mArray(0, std::vector<T>(0))
+ {
+ }
/**
* Constructs an array with given dimensions
* @param [in] rows for array
* @param [in] columns for array
*/
- Array2d( unsigned int rows, unsigned int columns )
- : mArray( rows, std::vector< T >( columns ) )
- { }
+ Array2d(unsigned int rows, unsigned int columns)
+ : mArray(rows, std::vector<T>(columns))
+ {
+ }
/**
* Destructor
*/
~Array2d()
- { } // Nothing to do, vector cleans up itself
+ {
+ } // Nothing to do, vector cleans up itself
/**
* Copy constructor
* @param array to copy from
*/
- Array2d( const Array2d& array )
+ Array2d(const Array2d& array)
{
- if( this != &array )
+ if(this != &array)
{
mArray = array.mArray;
}
* @param array to copy from
* @return reference to self for chaining
*/
- Array2d& operator=( const Array2d& array )
+ Array2d& operator=(const Array2d& array)
{
- if( this != &array )
+ if(this != &array)
{
mArray = array.mArray;
}
- return *this;
+ return *this;
}
/**
*/
unsigned int GetColumns()
{
- if( mArray.size() > 0 )
+ if(mArray.size() > 0)
{
// all columns are equal length
- return mArray[ 0 ].size();
+ return mArray[0].size();
}
return 0;
}
* @param [in] index of the row
* @return reference to the row vector for given index
*/
- std::vector< T >& operator[]( unsigned int index )
+ std::vector<T>& operator[](unsigned int index)
{
- return mArray[ index ];
+ return mArray[index];
}
/**
* @param [in] index of the row
* @return const reference to the row vector for given index
*/
- const std::vector< T >& operator[]( unsigned int index ) const
+ const std::vector<T>& operator[](unsigned int index) const
{
- return mArray[ index ];
+ return mArray[index];
}
/**
* Insert a new row to given index
* @param [in] rowIndex of the new row
*/
- void InsertRow( unsigned int rowIndex )
+ void InsertRow(unsigned int rowIndex)
{
// insert default initialized row of elements
- mArray.insert( mArray.begin() + rowIndex, std::vector< T >( GetColumns() ) );
+ mArray.insert(mArray.begin() + rowIndex, std::vector<T>(GetColumns()));
}
/**
* Removed elements are deleted
* @param [in] rowIndex of the row to delete
*/
- void DeleteRow( unsigned int rowIndex )
+ void DeleteRow(unsigned int rowIndex)
{
// erase the row
- mArray.erase( mArray.begin() + rowIndex );
+ mArray.erase(mArray.begin() + rowIndex);
}
/**
* @param [in] rowIndex of the row to delete
* @param [out] removed elements
*/
- void DeleteRow( unsigned int rowIndex, std::vector< T >& removed )
+ void DeleteRow(unsigned int rowIndex, std::vector<T>& removed)
{
// copy the row elements
- removed.insert( removed.end(), mArray[ rowIndex ].begin(), mArray[ rowIndex ].end() );
+ removed.insert(removed.end(), mArray[rowIndex].begin(), mArray[rowIndex].end());
// erase the row
- mArray.erase( mArray.begin() + rowIndex );
+ mArray.erase(mArray.begin() + rowIndex);
}
/**
* Insert a new column to given index
* @param [in] columnIndex of the new column
*/
- void InsertColumn( unsigned int columnIndex )
+ void InsertColumn(unsigned int columnIndex)
{
// go through all rows
const unsigned int rows = GetRows();
- for( unsigned int i = 0; i < rows; ++i )
+ for(unsigned int i = 0; i < rows; ++i)
{
// insert default initialized element
- mArray[ i ].insert( mArray[ i ].begin() + columnIndex, T() );
+ mArray[i].insert(mArray[i].begin() + columnIndex, T());
}
}
* Removed elements are deleted
* @param [in] columnIndex of the column to delete
*/
- void DeleteColumn( unsigned int columnIndex )
+ void DeleteColumn(unsigned int columnIndex)
{
// go through all rows
const unsigned int rows = GetRows();
- for( unsigned int i = 0; i < rows; ++i )
+ for(unsigned int i = 0; i < rows; ++i)
{
// erase the column
- mArray[ i ].erase( mArray[ i ].begin() + columnIndex );
+ mArray[i].erase(mArray[i].begin() + columnIndex);
}
}
* @param [in] columnIndex of the column to delete
* @param [out] removed elements
*/
- void DeleteColumn( unsigned int columnIndex, std::vector< T >& removed )
+ void DeleteColumn(unsigned int columnIndex, std::vector<T>& removed)
{
// go through all rows
const unsigned int rows = GetRows();
- for( unsigned int i = 0; i < rows; ++i )
+ for(unsigned int i = 0; i < rows; ++i)
{
// copy the column element of this row
- removed.push_back( mArray[ i ][ columnIndex ] );
+ removed.push_back(mArray[i][columnIndex]);
// erase the column
- mArray[ i ].erase( mArray[ i ].begin() + columnIndex );
+ mArray[i].erase(mArray[i].begin() + columnIndex);
}
}
* @param [in] rows for array
* @param [in] columns for array
*/
- void Resize( unsigned int rows, unsigned int columns )
+ void Resize(unsigned int rows, unsigned int columns)
{
// resize rows first, may increase or decrease size
- mArray.resize( rows );
- for( unsigned int i = 0; i < rows; ++i )
+ mArray.resize(rows);
+ for(unsigned int i = 0; i < rows; ++i)
{
// resize each column, may increase or decrease size
- mArray[ i ].resize( columns );
+ mArray[i].resize(columns);
}
}
* @param [in] columns for array
* @param [out] removed elements in case array is smaller in either dimension
*/
- void Resize( unsigned int rows, unsigned int columns, std::vector< T >& removed )
+ void Resize(unsigned int rows, unsigned int columns, std::vector<T>& removed)
{
// remember old counts
- const unsigned int oldRows = GetRows();
+ const unsigned int oldRows = GetRows();
const unsigned int oldColumns = GetColumns();
// are rows being removed ?
- if( rows < oldRows )
+ if(rows < oldRows)
{
// gather the elements of removed rows
- for( unsigned int i = rows; i < oldRows; ++i )
+ for(unsigned int i = rows; i < oldRows; ++i)
{
// copy the row elements, the whole row is gone
- removed.insert( removed.end(), mArray[ i ].begin(), mArray[ i ].end() );
+ removed.insert(removed.end(), mArray[i].begin(), mArray[i].end());
}
}
// resize the rows, may increase or decrease size
- mArray.resize( rows );
+ mArray.resize(rows);
// process columns, need to do all rows as also columns for new row need resizing
- for( unsigned int i = 0; i < rows; ++i )
+ for(unsigned int i = 0; i < rows; ++i)
{
// if this is an old row and columns are being removed
- if( ( i < oldRows )&&( columns < oldColumns ) )
+ if((i < oldRows) && (columns < oldColumns))
{
// copy the columns, the end of row from columns is gone
- removed.insert( removed.end(), mArray[ i ].begin() + columns, mArray[ i ].end() );
+ removed.insert(removed.end(), mArray[i].begin() + columns, mArray[i].end());
}
// resize the column, may increase of decrease size
- mArray[ i ].resize( columns );
+ mArray[i].resize(columns);
}
}
private:
-
- std::vector< std::vector< T > > mArray;
-
+ std::vector<std::vector<T> > mArray;
};
} // namespace Dali
#define DALI_TOOLKIT_INTERNAL_TABLE_VIEW_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/object/weak-handle.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/devel-api/controls/table-view/table-view.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
#include "array-2d.h"
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/**
* TableView is a custom control for laying out actors in a table layout
* @see Dali::Toolkit:TableView for more details
class TableView : public Control
{
public:
-
/**
* Create a new TableView.
* @return A smart-pointer to the newly allocated TableView.
*/
- static Toolkit::TableView New( unsigned int initialRows, unsigned int initialColumns );
+ static Toolkit::TableView New(unsigned int initialRows, unsigned int initialColumns);
/**
* @copydoc Toolkit::TableView::AddChild
*/
- bool AddChild( Actor& child, const Toolkit::TableView::CellPosition& position );
+ bool AddChild(Actor& child, const Toolkit::TableView::CellPosition& position);
/**
* @copydoc Toolkit::TableView::GetChildAt
*/
- Actor GetChildAt( const Toolkit::TableView::CellPosition& position );
+ Actor GetChildAt(const Toolkit::TableView::CellPosition& position);
/**
* @copydoc Toolkit::TableView::RemoveChildAt
*/
- Actor RemoveChildAt( const Toolkit::TableView::CellPosition& position );
+ Actor RemoveChildAt(const Toolkit::TableView::CellPosition& position);
/**
* @copydoc Toolkit::TableView::FindChildPosition
*/
- bool FindChildPosition( const Actor& child, Toolkit::TableView::CellPosition& positionOut );
+ bool FindChildPosition(const Actor& child, Toolkit::TableView::CellPosition& positionOut);
/**
* @copydoc Toolkit::TableView::InsertRow
*/
- void InsertRow( unsigned int rowIndex );
+ void InsertRow(unsigned int rowIndex);
/**
* @copydoc Toolkit::TableView::DeleteRow( unsigned int rowIndex )
*/
- void DeleteRow( unsigned int rowIndex );
+ void DeleteRow(unsigned int rowIndex);
/**
* @copydoc Toolkit::TableView::DeleteRow( unsigned int rowIndex, std::vector<Actor>& removed )
*/
- void DeleteRow( unsigned int rowIndex, std::vector<Actor>& removed );
+ void DeleteRow(unsigned int rowIndex, std::vector<Actor>& removed);
/**
* @copydoc Toolkit::TableView::InsertColumn
*/
- void InsertColumn( unsigned int columnIndex );
+ void InsertColumn(unsigned int columnIndex);
/**
* @copydoc Toolkit::TableView::DeleteColumn( unsigned int columnIndex )
*/
- void DeleteColumn( unsigned int columnIndex );
+ void DeleteColumn(unsigned int columnIndex);
/**
* @copydoc Toolkit::TableView::DeleteColumn( unsigned int columnIndex, std::vector<Actor>& removed )
*/
- void DeleteColumn( unsigned int columnIndex, std::vector<Actor>& removed );
+ void DeleteColumn(unsigned int columnIndex, std::vector<Actor>& removed);
/**
* @copydoc Toolkit::TableView::Resize( unsigned int rows, unsigned int columns )
*/
- void Resize( unsigned int rows, unsigned int columns );
+ void Resize(unsigned int rows, unsigned int columns);
/**
* @copydoc Toolkit::TableView::Resize( unsigned int rows, unsigned int columns, std::vector<Actor>& removed )
*/
- void Resize( unsigned int rows, unsigned int columns, std::vector<Actor>& removed );
+ void Resize(unsigned int rows, unsigned int columns, std::vector<Actor>& removed);
/**
* @copydoc Toolkit::TableView::SetCellPadding
*/
- void SetCellPadding( Size padding );
+ void SetCellPadding(Size padding);
/**
* @copydoc Toolkit::TableView::GetCellPadding
/**
* @copydoc Toolkit::TableView::SetFitHeight
*/
- void SetFitHeight( unsigned int rowIndex );
+ void SetFitHeight(unsigned int rowIndex);
/**
* @copydoc Toolkit::TableView::IsFitHeight
*/
- bool IsFitHeight( unsigned int rowIndex ) const;
+ bool IsFitHeight(unsigned int rowIndex) const;
/**
* @copydoc Toolkit::TableView::SetFitWidth
*/
- void SetFitWidth( unsigned int columnIndex );
+ void SetFitWidth(unsigned int columnIndex);
/**
* @copydoc Toolkit::TableView::IsFitWidth
*/
- bool IsFitWidth( unsigned int columnIndex ) const;
+ bool IsFitWidth(unsigned int columnIndex) const;
/**
* @copydoc Toolkit::TableView::SetFixedWidth
*/
- void SetFixedWidth( unsigned int columnIndex, float width );
+ void SetFixedWidth(unsigned int columnIndex, float width);
/**
* @copydoc Toolkit::TableView::GetFixedWidth
*/
- float GetFixedWidth( unsigned int columnIndex ) const;
+ float GetFixedWidth(unsigned int columnIndex) const;
/**
* @copydoc Toolkit::TableView::SetFixedHeight
*/
- void SetFixedHeight( unsigned int rowIndex, float height );
+ void SetFixedHeight(unsigned int rowIndex, float height);
/**
* @copydoc Toolkit::TableView::GetFixedHeight
*/
- float GetFixedHeight( unsigned int rowIndex ) const;
+ float GetFixedHeight(unsigned int rowIndex) const;
/**
* @copydoc Toolkit::TableView::SetRelativeHeight
*/
- void SetRelativeHeight( unsigned int rowIndex, float heightPercentage );
+ void SetRelativeHeight(unsigned int rowIndex, float heightPercentage);
/**
* @copydoc Toolkit::TableView::GetRelativeHeight
*/
- float GetRelativeHeight( unsigned int rowIndex ) const;
+ float GetRelativeHeight(unsigned int rowIndex) const;
/**
* @copydoc Toolkit::TableView::SetRelativeWidth
*/
- void SetRelativeWidth( unsigned int columnIndex, float widthPercentage );
+ void SetRelativeWidth(unsigned int columnIndex, float widthPercentage);
/**
* @copydoc Toolkit::TableView::GetRelativeWidth
*/
- float GetRelativeWidth( unsigned int columnIndex ) const;
+ float GetRelativeWidth(unsigned int columnIndex) const;
/**
* @copydoc Toolkit::TableView::GetRows
/**
* @copydoc Toolkit::TableView::SetCellAlignment
*/
- void SetCellAlignment( Toolkit::TableView::CellPosition position, HorizontalAlignment::Type horizontal, VerticalAlignment::Type vertical );
+ void SetCellAlignment(Toolkit::TableView::CellPosition position, HorizontalAlignment::Type horizontal, VerticalAlignment::Type vertical);
// Properties
* @param[in] index The property index.
* @param[in] value The new property value.
*/
- static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
+ static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value);
/**
* Called to retrieve a property of an object of this type.
* @param[in] index The property index.
* @return The current value of the property.
*/
- static Property::Value GetProperty( BaseObject* object, Property::Index index );
+ static Property::Value GetProperty(BaseObject* object, Property::Index index);
private: // From Control
-
/**
* @copydoc Control::OnChildAdd(Actor& child)
*/
- void OnChildAdd( Actor& child ) override;
+ void OnChildAdd(Actor& child) override;
/**
* @copydoc Control::OnChildRemove(Actor& child)
*/
- void OnChildRemove( Actor& child ) override;
+ void OnChildRemove(Actor& child) override;
/**
* @copydoc Control::OnRelayout
*/
- void OnRelayout( const Vector2& size, RelayoutContainer& container ) override;
+ void OnRelayout(const Vector2& size, RelayoutContainer& container) override;
/**
* @copydoc Control::CalculateChildSize
*/
- float CalculateChildSize( const Actor& child, Dimension::Type dimension ) override;
+ float CalculateChildSize(const Actor& child, Dimension::Type dimension) override;
/**
* @copydoc Control::OnInitialize()
/**
* @copydoc Control::GetNextKeyboardFocusableActor
*/
- Actor GetNextKeyboardFocusableActor( Actor currentFocusedActor, Toolkit::Control::KeyboardFocus::Direction direction, bool loopEnabled ) override;
+ Actor GetNextKeyboardFocusableActor(Actor currentFocusedActor, Toolkit::Control::KeyboardFocus::Direction direction, bool loopEnabled) override;
/**
* @copydoc Control::GetNaturalSize()
/**
* @copydoc Control::RelayoutDependentOnChildren()
*/
- bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) override;
+ bool RelayoutDependentOnChildren(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) override;
/**
* @copydoc Control::OnCalculateRelayoutSize
*/
- void OnCalculateRelayoutSize( Dimension::Type dimension ) override;
+ void OnCalculateRelayoutSize(Dimension::Type dimension) override;
/**
* @copydoc Control::OnLayoutNegotiated
*/
- void OnLayoutNegotiated( float size, Dimension::Type dimension ) override;
+ void OnLayoutNegotiated(float size, Dimension::Type dimension) override;
/**
* @copydoc CustomActorImpl::OnSizeSet( const Vector3& size )
*/
- void OnSizeSet( const Vector3& size ) override;
+ void OnSizeSet(const Vector3& size) override;
private: // Implementation
-
/**
* Struct to hold data for rows and columns
*
* Default constructor
*/
RowColumnData()
- : size( 0.0f ),
- fillRatio( 0.0f ),
- position( 0.0f ),
- sizePolicy( Toolkit::TableView::FILL )
+ : size(0.0f),
+ fillRatio(0.0f),
+ position(0.0f),
+ sizePolicy(Toolkit::TableView::FILL)
{
}
* @param[in] newSize The size to set for this data
* @param[in] newSizePolicy The policy used to interpret the size value
*/
- RowColumnData( float newSize, float newFillRatio, Toolkit::TableView::LayoutPolicy newSizePolicy )
- : size( newSize ),
- fillRatio( newFillRatio ),
- position( 0.0f ),
- sizePolicy( newSizePolicy )
+ RowColumnData(float newSize, float newFillRatio, Toolkit::TableView::LayoutPolicy newSizePolicy)
+ : size(newSize),
+ fillRatio(newFillRatio),
+ position(0.0f),
+ sizePolicy(newSizePolicy)
{
}
- float size; ///< Set or calculated size
- float fillRatio; ///< Ratio to fill remaining space, only valid with RELATIVE or FILL policy
- float position; ///< Position of the row/column, this value is updated during every Relayout round
+ float size; ///< Set or calculated size
+ float fillRatio; ///< Ratio to fill remaining space, only valid with RELATIVE or FILL policy
+ float position; ///< Position of the row/column, this value is updated during every Relayout round
Toolkit::TableView::LayoutPolicy sizePolicy; ///< The size policy used to interpret the size value
};
typedef Dali::Vector<RowColumnData> RowColumnArray;
public:
-
/**
* Structure for the layout data
*/
struct CellData
{
CellData()
- : horizontalAlignment( HorizontalAlignment::LEFT ),
- verticalAlignment( VerticalAlignment::TOP )
+ : horizontalAlignment(HorizontalAlignment::LEFT),
+ verticalAlignment(VerticalAlignment::TOP)
{
}
// data members
- Dali::Actor actor;
+ Dali::Actor actor;
Toolkit::TableView::CellPosition position;
- HorizontalAlignment::Type horizontalAlignment;
- VerticalAlignment::Type verticalAlignment;
+ HorizontalAlignment::Type horizontalAlignment;
+ VerticalAlignment::Type verticalAlignment;
};
private:
-
/**
* Construct a new TableView.
*/
- TableView( unsigned int initialRows, unsigned int initialColumns );
+ TableView(unsigned int initialRows, unsigned int initialColumns);
/**
* Resizes the data containers to match the new size
* @param [in] rows in the table
* @param [in] columns in the table
*/
- void ResizeContainers( unsigned int rows, unsigned int columns );
+ void ResizeContainers(unsigned int rows, unsigned int columns);
/**
* Resizes the data containers to match the new size
* @param [in] columns in the table
* @param [out] removed celldata
*/
- void ResizeContainers( unsigned int rows, unsigned int columns, std::vector<CellData>& removed );
+ void ResizeContainers(unsigned int rows, unsigned int columns, std::vector<CellData>& removed);
/**
* Helper to get the list of lost actors in the case when table looses cells.
* @param rowsRemoved from table
* @param columnsRemoved from table
*/
- void RemoveAndGetLostActors( const std::vector<CellData>& lost, std::vector<Actor>& removed,
- unsigned int rowsRemoved, unsigned int columnsRemoved );
+ void RemoveAndGetLostActors(const std::vector<CellData>& lost, std::vector<Actor>& removed, unsigned int rowsRemoved, unsigned int columnsRemoved);
/**
* Helper to remove all instances of the actor
* @param child actor to remove
* @return true if the actor was found
*/
- bool RemoveAllInstances( const Actor& child );
+ bool RemoveAllInstances(const Actor& child);
/**
* @brief Calculate the ratio of FILL rows/columns
*
* @param[in] data The RowColumn data to compute the relative sizes for
*/
- void CalculateFillSizes( RowColumnArray& data );
+ void CalculateFillSizes(RowColumnArray& data);
/**
* @brief Calculate the total fixed sizes for a row or column
*
* @param[in] data The row or column data to process
*/
- float CalculateTotalFixedSize( const RowColumnArray& data );
+ float CalculateTotalFixedSize(const RowColumnArray& data);
/**
* @brief Calculate the sizes of FIT rows/columns
* @param[in] data The row or column data to process
* @param[in] dimension The dimension being calculated: row == Dimension::HEIGHT, column == Dimension::WIDTH
*/
- void CalculateFitSizes( RowColumnArray& data, Dimension::Type dimension );
+ void CalculateFitSizes(RowColumnArray& data, Dimension::Type dimension);
/**
* @brief Search for a FIT cell in the array
* @param[in] data The row or column data to process
* @return Return if a FIT cell was found or not
*/
- bool FindFit( const RowColumnArray& data );
+ bool FindFit(const RowColumnArray& data);
/**
* @brief Return the cell padding for a given dimension
* @param[in] dimension The dimension to return the padding for
* @return Return the padding (x = low, y = high)
*/
- Vector2 GetCellPadding( Dimension::Type dimension );
+ Vector2 GetCellPadding(Dimension::Type dimension);
/**
* A reference counted object may only be deleted by calling Unreference()
virtual ~TableView();
private: // scripting support
-
/**
* Called to set the heights/widths property.
* @param[in] tableViewImpl The object whose property is set.
* @param[in] funcFit The set function to call, it can be SetFitHeight or SetFiltWidth.
* @param[in] value The new property value.
*/
- static void SetHeightOrWidthProperty( TableView& tableViewImpl,
- void(TableView::*funcFixed)(unsigned int, float),
- void(TableView::*funcRelative)(unsigned int, float),
- void(TableView::*funcFit)(unsigned int),
- const Property::Value& map );
+ static void SetHeightOrWidthProperty(TableView& tableViewImpl,
+ void (TableView::*funcFixed)(unsigned int, float),
+ void (TableView::*funcRelative)(unsigned int, float),
+ void (TableView::*funcFit)(unsigned int),
+ const Property::Value& map);
/**
* Called to retrieve the property value of row heights.
* @param[in] data The array of row or column data
* @param[out] map The property value.
*/
- void GetMapPropertyValue( const RowColumnArray& data, Property::Map& map );
-
+ void GetMapPropertyValue(const RowColumnArray& data, Property::Map& map);
/**
* Helper class to prevent child adds and removes from causing relayout
class RelayoutingLock
{
public: // API
-
/**
* Constructor, sets the lock boolean
*/
- RelayoutingLock( TableView& parent )
- : mLock( parent.mLayoutingChild )
+ RelayoutingLock(TableView& parent)
+ : mLock(parent.mLayoutingChild)
{
mLock = true;
}
};
private:
-
// Undefined copy constructor and assignment operators
TableView(const TableView&);
TableView& operator=(const TableView& rhs);
-private: // Data
-
- Array2d<CellData> mCellData; ///< Data for each cell: Actor, alignment settings etc
+private: // Data
+ Array2d<CellData> mCellData; ///< Data for each cell: Actor, alignment settings etc
- RowColumnArray mRowData; ///< Data for each row
- RowColumnArray mColumnData; ///< Data for each column
- Size mFixedTotals; ///< Accumulated totals for fixed width and height
+ RowColumnArray mRowData; ///< Data for each row
+ RowColumnArray mColumnData; ///< Data for each column
+ Size mFixedTotals; ///< Accumulated totals for fixed width and height
- Size mPadding; ///< Padding to apply to each cell
+ Size mPadding; ///< Padding to apply to each cell
WeakHandle<Actor> mPreviousFocusedActor; ///< Perviously focused actor
- bool mLayoutingChild; ///< Can't be a bitfield due to Relayouting lock
- bool mRowDirty : 1; ///< Flag to indicate the row data is dirty
- bool mColumnDirty : 1; ///< Flag to indicate the column data is dirty
+ bool mLayoutingChild; ///< Can't be a bitfield due to Relayouting lock
+ bool mRowDirty : 1; ///< Flag to indicate the row data is dirty
+ bool mColumnDirty : 1; ///< Flag to indicate the column data is dirty
};
} // namespace Internal
// Helpers for public-api forwarding methods
-inline Toolkit::Internal::TableView& GetImpl( Toolkit::TableView& tableView )
+inline Toolkit::Internal::TableView& GetImpl(Toolkit::TableView& tableView)
{
DALI_ASSERT_ALWAYS(tableView);
return static_cast<Toolkit::Internal::TableView&>(handle);
}
-inline const Toolkit::Internal::TableView& GetImpl( const Toolkit::TableView& tableView )
+inline const Toolkit::Internal::TableView& GetImpl(const Toolkit::TableView& tableView)
{
DALI_ASSERT_ALWAYS(tableView);
#define DALI_TOOLKIT_INTERNAL_TEXT_EDITOR_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/accessibility.h>
#include <dali/devel-api/adaptor-framework/clipboard-event-notifier.h>
#include <dali/devel-api/adaptor-framework/input-method-context.h>
-#include <dali/devel-api/adaptor-framework/accessibility.h>
#include <dali/public-api/animation/animation.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/devel-api/controls/scroll-bar/scroll-bar.h>
-#include <dali-toolkit/public-api/controls/text-controls/text-editor.h>
#include <dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h>
+#include <dali-toolkit/internal/controls/control/control-data-impl.h>
#include <dali-toolkit/internal/text/decorator/text-decorator.h>
+#include <dali-toolkit/internal/text/rendering/text-renderer.h>
#include <dali-toolkit/internal/text/text-control-interface.h>
+#include <dali-toolkit/internal/text/text-controller.h>
#include <dali-toolkit/internal/text/text-editable-control-interface.h>
#include <dali-toolkit/internal/text/text-selectable-control-interface.h>
-#include <dali-toolkit/internal/text/text-controller.h>
#include <dali-toolkit/internal/text/text-vertical-scroller.h>
-#include <dali-toolkit/internal/text/rendering/text-renderer.h>
-#include <dali-toolkit/internal/controls/control/control-data-impl.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali-toolkit/public-api/controls/text-controls/text-editor.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
/**
class TextEditor : public Control, public Text::ControlInterface, public Text::EditableControlInterface, public Text::SelectableControlInterface
{
public:
-
/**
* @copydoc Dali::Toollkit::TextEditor::New()
*/
* @param[in] index The property index.
* @param[in] value The new property value.
*/
- static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
+ static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value);
/**
* @brief Called to retrieve a property of an object of this type.
* @param[in] index The property index.
* @return The current value of the property.
*/
- static Property::Value GetProperty( BaseObject* object, Property::Index index );
+ static Property::Value GetProperty(BaseObject* object, Property::Index index);
/**
* @copydoc Dali::Toollkit::TextEditor::GetInputMethodContext()
/**
* @copydoc Dali::Toollkit::TextEditor::MaxLengthReachedSignal()
*/
- DevelTextEditor::MaxLengthReachedSignalType& MaxLengthReachedSignal();
+ DevelTextEditor::MaxLengthReachedSignalType& MaxLengthReachedSignal();
/**
* Connects a callback function with the object's signals.
* @return True if the signal was connected.
* @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
*/
- static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
+ static bool DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
/**
* @copydoc TextEditor::TextChangedSignal()
*/
- Toolkit::TextEditor::TextChangedSignalType& TextChangedSignal();
+ Toolkit::TextEditor::TextChangedSignalType& TextChangedSignal();
/**
* @copydoc TextEditor::TextChangedSignal()
Toolkit::TextEditor::ScrollStateChangedSignalType& ScrollStateChangedSignal();
private: // From Control
-
/**
* @copydoc Control::OnInitialize()
*/
/**
* @copydoc Control::OnStyleChange()
*/
- void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change ) override;
+ void OnStyleChange(Toolkit::StyleManager styleManager, StyleChange::Type change) override;
/**
* @copydoc Control::GetNaturalSize()
/**
* @copydoc Control::GetHeightForWidth()
*/
- float GetHeightForWidth( float width ) override;
+ float GetHeightForWidth(float width) override;
/**
* @copydoc Control::OnInitialize()
*/
- void OnRelayout( const Vector2& size, RelayoutContainer& container ) override;
+ void OnRelayout(const Vector2& size, RelayoutContainer& container) override;
/**
* @copydoc Control::OnKeyInputFocusGained()
/**
* @copydoc Control::OnTap()
*/
- void OnTap( const TapGesture& tap ) override;
+ void OnTap(const TapGesture& tap) override;
/**
* @copydoc Control::OnPan()
*/
- void OnPan( const PanGesture& gesture ) override;
+ void OnPan(const PanGesture& gesture) override;
/**
* @copydoc Control::OnLongPress()
*/
- void OnLongPress( const LongPressGesture& gesture ) override;
+ void OnLongPress(const LongPressGesture& gesture) override;
/**
* @copydoc Control::OnSceneConnection()
*/
- void OnSceneConnection( int depth ) override;
+ void OnSceneConnection(int depth) override;
/**
* @copydoc Dali::CustomActorImpl::OnKeyEvent(const KeyEvent&)
*/
bool OnKeyEvent(const KeyEvent& event) override;
-// From ControlInterface
+ // From ControlInterface
/**
* @copydoc Text::ControlInterface::RequestTextRelayout()
*/
void RequestTextRelayout() override;
-// From EditableControlInterface
+ // From EditableControlInterface
/**
* @copydoc Text::EditableControlInterface::TextChanged()
*/
- void TextInserted( unsigned int position, unsigned int length, const std::string &content ) override;
+ void TextInserted(unsigned int position, unsigned int length, const std::string& content) override;
/**
* @copydoc Text::EditableControlInterface::TextDeleted()
*/
- void TextDeleted( unsigned int position, unsigned int length, const std::string &content ) override;
+ void TextDeleted(unsigned int position, unsigned int length, const std::string& content) override;
/**
* @copydoc Text::EditableControlInterface::CaretMoved()
*/
- void CaretMoved( unsigned int position ) override;
+ void CaretMoved(unsigned int position) override;
/**
* @copydoc Text::EditableControlInterface::TextChanged()
/**
* @copydoc Text::EditableControlInterface::InputStyleChanged()
*/
- void InputStyleChanged( Text::InputStyle::Mask inputStyleMask ) override;
+ void InputStyleChanged(Text::InputStyle::Mask inputStyleMask) override;
/**
* @copydoc Text::EditableControlInterface::AddDecoration()
*/
- void AddDecoration( Actor& actor, bool needsClipping ) override;
+ void AddDecoration(Actor& actor, bool needsClipping) override;
-// From SelectableControlInterface
+ // From SelectableControlInterface
public:
/**
* @copydoc Text::SelectableControlInterface::SetTextSelectionRange()
*/
- void SetTextSelectionRange(const uint32_t *start, const uint32_t *end) override;
+ void SetTextSelectionRange(const uint32_t* start, const uint32_t* end) override;
/**
* @copydoc Text::SelectableControlInterface::GetTextSelectionRange()
/**
* @copydoc Text::EditableControlInterface::SetEditable()
*/
- void SetEditable( bool editable ) override;
+ void SetEditable(bool editable) override;
Text::ControllerPtr getController();
private: // Implementation
-
/**
* @copydoc Dali::Toolkit::Text::Controller::(InputMethodContext& inputMethodContext, const InputMethodContext::EventData& inputMethodContextEvent)
*/
- InputMethodContext::CallbackData OnInputMethodContextEvent( InputMethodContext& inputMethodContext, const InputMethodContext::EventData& inputMethodContextEvent );
+ InputMethodContext::CallbackData OnInputMethodContextEvent(InputMethodContext& inputMethodContext, const InputMethodContext::EventData& inputMethodContextEvent);
/**
* @brief Callback when Clipboard signals an item should be pasted
* @param[in] clipboard handle to Clipboard Event Notifier
*/
- void OnClipboardTextSelected( ClipboardEventNotifier& clipboard );
+ void OnClipboardTextSelected(ClipboardEventNotifier& clipboard);
/**
* @brief Get a Property Map for the image used for the required Handle Image
* @param[in] handleType the type of handle
* @param[in] handleImageType the type of image for the given handleType
*/
- void GetHandleImagePropertyValue( Property::Value& value, Text::HandleType handleType, Text::HandleImageType handleImageType );
+ void GetHandleImagePropertyValue(Property::Value& value, Text::HandleType handleType, Text::HandleImageType handleImageType);
/**
* @brief Callback when keyboard is shown/hidden.
*
* @param[in] keyboardShown True if keyboard is shown.
*/
- void KeyboardStatusChanged( bool keyboardShown );
+ void KeyboardStatusChanged(bool keyboardShown);
/**
* @brief update scroll bar position
* @param[in] actor TextEditor touched
* @param[in] touch Touch information
*/
- bool OnTouched( Actor actor, const TouchEvent& touch );
+ bool OnTouched(Actor actor, const TouchEvent& touch);
/**
* @brief Callbacks called on idle.
*
* Emit ScrollBarStateChanged Signal and toggle mScrollStarted flag to false
*/
- void OnScrollIndicatorAnimationFinished( Animation& animation );
+ void OnScrollIndicatorAnimationFinished(Animation& animation);
/**
* Construct a new TextEditor.
/**
* @brief Render view, create and attach actor(s) to this text editor.
*/
- void RenderText( Text::Controller::UpdateTextType updateTextType );
+ void RenderText(Text::Controller::UpdateTextType updateTextType);
// Connection needed to re-render text, when a text editor returns to the scene.
- void OnSceneConnect( Dali::Actor actor );
+ void OnSceneConnect(Dali::Actor actor);
private: // Data
// Signals
- Toolkit::TextEditor::TextChangedSignalType mTextChangedSignal;
- Toolkit::TextEditor::InputStyleChangedSignalType mInputStyleChangedSignal;
- Toolkit::TextEditor::ScrollStateChangedSignalType mScrollStateChangedSignal;
+ Toolkit::TextEditor::TextChangedSignalType mTextChangedSignal;
+ Toolkit::TextEditor::InputStyleChangedSignalType mInputStyleChangedSignal;
+ Toolkit::TextEditor::ScrollStateChangedSignalType mScrollStateChangedSignal;
Toolkit::DevelTextEditor::MaxLengthReachedSignalType mMaxLengthReachedSignal;
- InputMethodContext mInputMethodContext;
- Text::ControllerPtr mController;
- Text::RendererPtr mRenderer;
- Text::DecoratorPtr mDecorator;
+ InputMethodContext mInputMethodContext;
+ Text::ControllerPtr mController;
+ Text::RendererPtr mRenderer;
+ Text::DecoratorPtr mDecorator;
Text::TextVerticalScrollerPtr mTextVerticalScroller;
- Toolkit::Control mStencil;
- Toolkit::ScrollBar mScrollBar;
- Dali::Animation mAnimation; ///< Scroll indicator Show/Hide Animation.
- Dali::TimePeriod mAnimationPeriod;
- std::vector<Actor> mClippingDecorationActors; ///< Decoration actors which need clipping.
-
- Actor mRenderableActor;
- Actor mActiveLayer;
+ Toolkit::Control mStencil;
+ Toolkit::ScrollBar mScrollBar;
+ Dali::Animation mAnimation; ///< Scroll indicator Show/Hide Animation.
+ Dali::TimePeriod mAnimationPeriod;
+ std::vector<Actor> mClippingDecorationActors; ///< Decoration actors which need clipping.
+
+ Actor mRenderableActor;
+ Actor mActiveLayer;
CallbackBase* mIdleCallback;
float mAlignmentOffset;
float mScrollAnimationDuration;
float mLineSpacing;
- int mRenderingBackend;
- bool mHasBeenStaged:1;
- bool mScrollAnimationEnabled:1;
- bool mScrollBarEnabled:1;
- bool mScrollStarted:1;
+ int mRenderingBackend;
+ bool mHasBeenStaged : 1;
+ bool mScrollAnimationEnabled : 1;
+ bool mScrollBarEnabled : 1;
+ bool mScrollStarted : 1;
struct AccessibleImpl : public Control::Impl::AccessibleImpl,
public virtual Dali::Accessibility::Text,
{
using Control::Impl::AccessibleImpl::AccessibleImpl;
- std::string GetName() override;
- std::string GetText( size_t startOffset, size_t endOffset ) override;
- size_t GetCharacterCount() override;
- size_t GetCaretOffset() override;
- bool SetCaretOffset(size_t offset) override;
- Dali::Accessibility::Range
- GetTextAtOffset( size_t offset,
- Dali::Accessibility::TextBoundary boundary ) override;
- Dali::Accessibility::Range GetSelection( size_t selectionNum ) override;
- bool RemoveSelection( size_t selectionNum ) override;
- bool SetSelection( size_t selectionNum, size_t startOffset,
- size_t endOffset ) override;
- bool CopyText( size_t startPosition, size_t endPosition ) override;
- bool CutText( size_t startPosition, size_t endPosition ) override;
- Dali::Accessibility::States CalculateStates() override;
+ std::string GetName() override;
+ std::string GetText(size_t startOffset, size_t endOffset) override;
+ size_t GetCharacterCount() override;
+ size_t GetCaretOffset() override;
+ bool SetCaretOffset(size_t offset) override;
+ Accessibility::Range GetTextAtOffset(size_t offset, Accessibility::TextBoundary boundary) override;
+ Accessibility::Range GetSelection(size_t selectionNum) override;
+ bool RemoveSelection(size_t selectionNum) override;
+ bool SetSelection(size_t selectionNum, size_t startOffset, size_t endOffset) override;
+ bool CopyText(size_t startPosition, size_t endPosition) override;
+ bool CutText(size_t startPosition, size_t endPosition) override;
+ Accessibility::States CalculateStates() override;
};
};
// Helpers for public-api forwarding methods
-inline Toolkit::Internal::TextEditor& GetImpl( Toolkit::TextEditor& textEditor )
+inline Toolkit::Internal::TextEditor& GetImpl(Toolkit::TextEditor& textEditor)
{
DALI_ASSERT_ALWAYS(textEditor);
return static_cast<Toolkit::Internal::TextEditor&>(handle);
}
-inline const Toolkit::Internal::TextEditor& GetImpl( const Toolkit::TextEditor& textEditor )
+inline const Toolkit::Internal::TextEditor& GetImpl(const Toolkit::TextEditor& textEditor)
{
DALI_ASSERT_ALWAYS(textEditor);
#define DALI_TOOLKIT_INTERNAL_TEXT_FIELD_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/devel-api/adaptor-framework/input-method-context.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali-toolkit/public-api/controls/text-controls/text-field.h>
+#include <dali-toolkit/internal/controls/control/control-data-impl.h>
#include <dali-toolkit/internal/text/decorator/text-decorator.h>
+#include <dali-toolkit/internal/text/rendering/text-renderer.h>
#include <dali-toolkit/internal/text/text-control-interface.h>
+#include <dali-toolkit/internal/text/text-controller.h>
#include <dali-toolkit/internal/text/text-editable-control-interface.h>
#include <dali-toolkit/internal/text/text-selectable-control-interface.h>
-#include <dali-toolkit/internal/text/text-controller.h>
-#include <dali-toolkit/internal/text/rendering/text-renderer.h>
-#include <dali-toolkit/internal/controls/control/control-data-impl.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali-toolkit/public-api/controls/text-controls/text-field.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
/**
class TextField : public Control, public Text::ControlInterface, public Text::EditableControlInterface, public Text::SelectableControlInterface
{
public:
-
/**
* @copydoc Dali::Toollkit::TextField::New()
*/
* @param[in] index The property index.
* @param[in] value The new property value.
*/
- static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
+ static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value);
/**
* @brief Called to retrieve a property of an object of this type.
* @param[in] index The property index.
* @return The current value of the property.
*/
- static Property::Value GetProperty( BaseObject* object, Property::Index index );
+ static Property::Value GetProperty(BaseObject* object, Property::Index index);
/**
* @copydoc Dali::Toollkit::TextField::GetInputMethodContext()
* @return True if the signal was connected.
* @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
*/
- static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
+ static bool DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
/**
* @copydoc TextField::TextChangedSignal()
*/
- Toolkit::TextField::TextChangedSignalType& TextChangedSignal();
+ Toolkit::TextField::TextChangedSignalType& TextChangedSignal();
/**
* @copydoc TextField::MaxLengthReachedSignal()
*/
- Toolkit::TextField::MaxLengthReachedSignalType& MaxLengthReachedSignal();
+ Toolkit::TextField::MaxLengthReachedSignalType& MaxLengthReachedSignal();
/**
* @copydoc TextField::TextChangedSignal()
Text::ControllerPtr getController();
private: // From Control
-
/**
* @copydoc Control::OnInitialize()
*/
/**
* @copydoc Control::OnStyleChange()
*/
- void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change ) override;
+ void OnStyleChange(Toolkit::StyleManager styleManager, StyleChange::Type change) override;
/**
* @copydoc Control::GetNaturalSize()
/**
* @copydoc Control::GetHeightForWidth()
*/
- float GetHeightForWidth( float width ) override;
+ float GetHeightForWidth(float width) override;
/**
* @copydoc Control::OnInitialize()
*/
- void OnRelayout( const Vector2& size, RelayoutContainer& container ) override;
+ void OnRelayout(const Vector2& size, RelayoutContainer& container) override;
/**
* @copydoc Control::OnKeyInputFocusGained()
/**
* @copydoc Control::OnTap()
*/
- void OnTap( const TapGesture& tap ) override;
+ void OnTap(const TapGesture& tap) override;
/**
* @copydoc Control::OnPan()
*/
- void OnPan( const PanGesture& gesture ) override;
+ void OnPan(const PanGesture& gesture) override;
/**
* @copydoc Control::OnLongPress()
*/
- void OnLongPress( const LongPressGesture& gesture ) override;
+ void OnLongPress(const LongPressGesture& gesture) override;
/**
* @copydoc Control::OnSceneConnection()
*/
- void OnSceneConnection( int depth ) override;
+ void OnSceneConnection(int depth) override;
/**
* @copydoc Dali::CustomActorImpl::OnKeyEvent(const KeyEvent&)
*/
bool OnKeyEvent(const KeyEvent& event) override;
-// From ControlInterface
+ // From ControlInterface
/**
* @copydoc Text::ControlInterface::RequestTextRelayout()
*/
void RequestTextRelayout() override;
-// From EditableControlInterface
+ // From EditableControlInterface
/**
* @copydoc Text::EditableControlInterface::TextChanged()
*/
- void TextInserted( unsigned int position, unsigned int length, const std::string &content ) override;
+ void TextInserted(unsigned int position, unsigned int length, const std::string& content) override;
/**
* @copydoc Text::EditableControlInterface::TextDeleted()
*/
- void TextDeleted( unsigned int position, unsigned int length, const std::string &content ) override;
+ void TextDeleted(unsigned int position, unsigned int length, const std::string& content) override;
/**
* @copydoc Text::EditableControlInterface::CaretMoved()
*/
- void CaretMoved( unsigned int position ) override;
+ void CaretMoved(unsigned int position) override;
/**
* @copydoc Text::EditableControlInterface::TextChanged()
/**
* @copydoc Text::EditableControlInterface::InputStyleChanged()
*/
- void InputStyleChanged( Text::InputStyle::Mask inputStyleMask ) override;
+ void InputStyleChanged(Text::InputStyle::Mask inputStyleMask) override;
/**
* @copydoc Text::EditableControlInterface::AddDecoration()
*/
- void AddDecoration( Actor& actor, bool needsClipping ) override;
+ void AddDecoration(Actor& actor, bool needsClipping) override;
-// From SelectableControlInterface
+ // From SelectableControlInterface
public:
/**
* @copydoc Text::SelectableControlInterface::SetTextSelectionRange()
*/
- void SetTextSelectionRange(const uint32_t *start, const uint32_t *end) override;
+ void SetTextSelectionRange(const uint32_t* start, const uint32_t* end) override;
/**
* @copydoc Text::SelectableControlInterface::GetTextSelectionRange()
/**
* @copydoc Text::EditableControlInterface::SetEditable()
*/
- void SetEditable( bool editable ) override;
+ void SetEditable(bool editable) override;
private: // Implementation
-
/**
* @copydoc Dali::Toolkit::Text::Controller::(InputMethodContext& inputMethodContext, const InputMethodContext::EventData& inputMethodContextEvent)
*/
- InputMethodContext::CallbackData OnInputMethodContextEvent( InputMethodContext& inputMethodContext, const InputMethodContext::EventData& inputMethodContextEvent );
+ InputMethodContext::CallbackData OnInputMethodContextEvent(InputMethodContext& inputMethodContext, const InputMethodContext::EventData& inputMethodContextEvent);
/**
* @brief Callback when Clipboard signals an item should be pasted
* @param[in] clipboard handle to Clipboard Event Notifier
*/
- void OnClipboardTextSelected( ClipboardEventNotifier& clipboard );
+ void OnClipboardTextSelected(ClipboardEventNotifier& clipboard);
/**
* @brief Get a Property Map for the image used for the required Handle Image
* @param[in] handleType the type of handle
* @param[in] handleImageType the type of image for the given handleType
*/
- void GetHandleImagePropertyValue( Property::Value& value, Text::HandleType handleType, Text::HandleImageType handleImageType );
+ void GetHandleImagePropertyValue(Property::Value& value, Text::HandleType handleType, Text::HandleImageType handleImageType);
/**
* @brief Enable or disable clipping.
*
* @param[in] keyboardShown True if keyboard is shown.
*/
- void KeyboardStatusChanged( bool keyboardShown );
+ void KeyboardStatusChanged(bool keyboardShown);
/**
* @brief Callback when TextField is touched
* @param[in] actor TextField touched
* @param[in] touch Touch information
*/
- bool OnTouched( Actor actor, const TouchEvent& touch );
+ bool OnTouched(Actor actor, const TouchEvent& touch);
/**
* @brief Callbacks called on idle.
/**
* @brief Render view, create and attach actor(s) to this Text Field.
*/
- void RenderText( Text::Controller::UpdateTextType updateTextType );
+ void RenderText(Text::Controller::UpdateTextType updateTextType);
// Connection needed to re-render text, when a Text Field returns to the scene.
- void OnSceneConnect( Dali::Actor actor );
+ void OnSceneConnect(Dali::Actor actor);
public: // For UTC only
-
- Text::ControllerPtr GetTextController() { return mController; }
+ Text::ControllerPtr GetTextController()
+ {
+ return mController;
+ }
private: // Data
-
// Signals
- Toolkit::TextField::TextChangedSignalType mTextChangedSignal;
- Toolkit::TextField::MaxLengthReachedSignalType mMaxLengthReachedSignal;
+ Toolkit::TextField::TextChangedSignalType mTextChangedSignal;
+ Toolkit::TextField::MaxLengthReachedSignalType mMaxLengthReachedSignal;
Toolkit::TextField::InputStyleChangedSignalType mInputStyleChangedSignal;
- InputMethodContext mInputMethodContext;
- Text::ControllerPtr mController;
- Text::RendererPtr mRenderer;
- Text::DecoratorPtr mDecorator;
- Toolkit::Control mStencil; ///< For EXCEED_POLICY_CLIP
- std::vector<Actor> mClippingDecorationActors; ///< Decoration actors which need clipping.
+ InputMethodContext mInputMethodContext;
+ Text::ControllerPtr mController;
+ Text::RendererPtr mRenderer;
+ Text::DecoratorPtr mDecorator;
+ Toolkit::Control mStencil; ///< For EXCEED_POLICY_CLIP
+ std::vector<Actor> mClippingDecorationActors; ///< Decoration actors which need clipping.
Dali::InputMethodOptions mInputMethodOptions;
- Actor mRenderableActor;
- Actor mActiveLayer;
- Actor mBackgroundActor;
+ Actor mRenderableActor;
+ Actor mActiveLayer;
+ Actor mBackgroundActor;
CallbackBase* mIdleCallback;
float mAlignmentOffset;
- int mRenderingBackend;
- int mExceedPolicy;
- bool mHasBeenStaged:1;
+ int mRenderingBackend;
+ int mExceedPolicy;
+ bool mHasBeenStaged : 1;
protected:
struct AccessibleImpl : public Control::Impl::AccessibleImpl,
{
using Control::Impl::AccessibleImpl::AccessibleImpl;
- std::string GetName() override;
- std::string GetText( size_t startOffset, size_t endOffset ) override;
- size_t GetCharacterCount() override;
- size_t GetCaretOffset() override;
- bool SetCaretOffset(size_t offset) override;
- Dali::Accessibility::Range
- GetTextAtOffset( size_t offset,
- Dali::Accessibility::TextBoundary boundary ) override;
- Dali::Accessibility::Range GetSelection( size_t selectionNum ) override;
- bool RemoveSelection( size_t selectionNum ) override;
- bool SetSelection( size_t selectionNum, size_t startOffset,
- size_t endOffset ) override;
- bool CopyText( size_t startPosition, size_t endPosition ) override;
- bool CutText( size_t startPosition, size_t endPosition ) override;
- Dali::Accessibility::States CalculateStates() override;
+ std::string GetName() override;
+ std::string GetText(size_t startOffset, size_t endOffset) override;
+ size_t GetCharacterCount() override;
+ size_t GetCaretOffset() override;
+ bool SetCaretOffset(size_t offset) override;
+ Accessibility::Range GetTextAtOffset(size_t offset, Accessibility::TextBoundary boundary) override;
+ Accessibility::Range GetSelection(size_t selectionNum) override;
+ bool RemoveSelection(size_t selectionNum) override;
+ bool SetSelection(size_t selectionNum, size_t startOffset, size_t endOffset) override;
+ bool CopyText(size_t startPosition, size_t endPosition) override;
+ bool CutText(size_t startPosition, size_t endPosition) override;
+ Accessibility::States CalculateStates() override;
};
};
// Helpers for public-api forwarding methods
-inline Toolkit::Internal::TextField& GetImpl( Toolkit::TextField& textField )
+inline Toolkit::Internal::TextField& GetImpl(Toolkit::TextField& textField)
{
DALI_ASSERT_ALWAYS(textField);
return static_cast<Toolkit::Internal::TextField&>(handle);
}
-inline const Toolkit::Internal::TextField& GetImpl( const Toolkit::TextField& textField )
+inline const Toolkit::Internal::TextField& GetImpl(const Toolkit::TextField& textField)
{
DALI_ASSERT_ALWAYS(textField);
#define DALI_TOOLKIT_INTERNAL_TEXT_LABEL_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/object/property-map.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
+#include <dali-toolkit/internal/controls/control/control-data-impl.h>
+#include <dali-toolkit/internal/text/rendering/text-renderer.h>
#include <dali-toolkit/internal/text/text-control-interface.h>
#include <dali-toolkit/internal/text/text-controller.h>
#include <dali-toolkit/internal/text/text-scroller-interface.h>
-#include <dali-toolkit/internal/text/rendering/text-renderer.h>
#include <dali-toolkit/internal/text/text-scroller.h>
#include <dali-toolkit/internal/visuals/text/text-visual.h>
-#include <dali-toolkit/internal/controls/control/control-data-impl.h>
-
+#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/**
* @brief A control which renders a short text string.
*/
class TextLabel : public Control, public Text::ControlInterface, public Text::ScrollerInterface
{
public:
-
/**
* @copydoc Dali::Toollkit::TextLabel::New()
*/
* @param[in] index The property index.
* @param[in] value The new property value.
*/
- static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
+ static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value);
/**
* @brief Called to retrieve a property of an object of this type.
* @param[in] index The property index.
* @return The current value of the property.
*/
- static Property::Value GetProperty( BaseObject* object, Property::Index index );
+ static Property::Value GetProperty(BaseObject* object, Property::Index index);
Text::ControllerPtr getController();
private: // From Control
-
/**
* @copydoc Control::OnInitialize()
*/
/**
* @copydoc Control::OnStyleChange()
*/
- void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change ) override;
+ void OnStyleChange(Toolkit::StyleManager styleManager, StyleChange::Type change) override;
/**
* @copydoc Control::OnRelayout()
*/
- void OnRelayout( const Vector2& size, RelayoutContainer& container ) override;
+ void OnRelayout(const Vector2& size, RelayoutContainer& container) override;
/**
* @copydoc Control::GetNaturalSize()
/**
* @copydoc Control::GetHeightForWidth()
*/
- float GetHeightForWidth( float width ) override;
+ float GetHeightForWidth(float width) override;
/**
* @copydoc Control::OnPropertySet()
*/
- void OnPropertySet( Property::Index index, const Property::Value& propertyValue ) override ;
+ void OnPropertySet(Property::Index index, const Property::Value& propertyValue) override;
// From ControlInterface
void RequestTextRelayout() override;
private: // from TextScroller
-
/**
* @copydoc Text::ScrollerInterface::ScrollingFinished()
*/
void ScrollingFinished() override;
private: // Implementation
-
/**
* Construct a new TextLabel.
*/
virtual ~TextLabel();
private:
-
// Undefined copy constructor and assignment operators
TextLabel(const TextLabel&);
TextLabel& operator=(const TextLabel& rhs);
*/
Text::TextScrollerPtr GetTextScroller()
{
- if( !mTextScroller )
+ if(!mTextScroller)
{
- mTextScroller = Text::TextScroller::New( *this );
+ mTextScroller = Text::TextScroller::New(*this);
}
return mTextScroller;
}
private: // Data
-
- Text::ControllerPtr mController;
+ Text::ControllerPtr mController;
Text::TextScrollerPtr mTextScroller;
Toolkit::Visual::Base mVisual;
- int mRenderingBackend;
- bool mTextUpdateNeeded:1;
+ int mRenderingBackend;
+ bool mTextUpdateNeeded : 1;
protected:
struct AccessibleImpl : public Control::Impl::AccessibleImpl,
{
using Control::Impl::AccessibleImpl::AccessibleImpl;
- std::string GetText( size_t startOffset, size_t endOffset ) override;
- size_t GetCharacterCount() override;
- size_t GetCaretOffset() override;
- bool SetCaretOffset(size_t offset) override;
- Dali::Accessibility::Range
- GetTextAtOffset( size_t offset,
- Dali::Accessibility::TextBoundary boundary ) override;
- Dali::Accessibility::Range GetSelection( size_t selectionNum ) override;
- bool RemoveSelection( size_t selectionNum ) override;
- bool SetSelection( size_t selectionNum, size_t startOffset,
- size_t endOffset ) override;
- std::string GetNameRaw() override;
- Property::Index GetNamePropertyIndex() override;
+ std::string GetText(size_t startOffset, size_t endOffset) override;
+ size_t GetCharacterCount() override;
+ size_t GetCaretOffset() override;
+ bool SetCaretOffset(size_t offset) override;
+ Accessibility::Range GetTextAtOffset(size_t offset, Accessibility::TextBoundary boundary) override;
+ Accessibility::Range GetSelection(size_t selectionNum) override;
+ bool RemoveSelection(size_t selectionNum) override;
+ bool SetSelection(size_t selectionNum, size_t startOffset, size_t endOffset) override;
+ std::string GetNameRaw() override;
+ Property::Index GetNamePropertyIndex() override;
};
};
// Helpers for public-api forwarding methods
-inline Toolkit::Internal::TextLabel& GetImpl( Toolkit::TextLabel& textLabel )
+inline Toolkit::Internal::TextLabel& GetImpl(Toolkit::TextLabel& textLabel)
{
DALI_ASSERT_ALWAYS(textLabel);
return static_cast<Toolkit::Internal::TextLabel&>(handle);
}
-inline const Toolkit::Internal::TextLabel& GetImpl( const Toolkit::TextLabel& textLabel )
+inline const Toolkit::Internal::TextLabel& GetImpl(const Toolkit::TextLabel& textLabel)
{
DALI_ASSERT_ALWAYS(textLabel);
#define DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_POPUP_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <string>
#include <dali/public-api/actors/layer.h>
#include <dali/public-api/object/property-map.h>
+#include <string>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali-toolkit/public-api/controls/buttons/push-button.h>
-#include <dali-toolkit/public-api/controls/image-view/image-view.h>
#include <dali-toolkit/devel-api/controls/table-view/table-view.h>
#include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h>
#include <dali-toolkit/devel-api/controls/text-controls/text-selection-toolbar.h>
+#include <dali-toolkit/public-api/controls/buttons/push-button.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
enum PopupCustomisations
{
POPUP_MAXIMUM_SIZE,
class TextSelectionPopup : public Control
{
public:
-
struct ButtonRequirement
{
ButtonRequirement()
- : id( Toolkit::TextSelectionPopup::NONE ),
- priority( 0u ),
+ : id(Toolkit::TextSelectionPopup::NONE),
+ priority(0u),
name(),
caption(),
- enabled( false )
- {}
-
- ButtonRequirement( Toolkit::TextSelectionPopup::Buttons buttonId,
- std::size_t buttonPriority,
- const std::string& buttonName,
- const std::string& buttonCaption,
- bool buttonEnabled )
- : id( buttonId ),
- priority( buttonPriority ),
- name( buttonName ),
- caption( buttonCaption ),
- enabled( buttonEnabled )
- {}
+ enabled(false)
+ {
+ }
+
+ ButtonRequirement(Toolkit::TextSelectionPopup::Buttons buttonId,
+ std::size_t buttonPriority,
+ const std::string& buttonName,
+ const std::string& buttonCaption,
+ bool buttonEnabled)
+ : id(buttonId),
+ priority(buttonPriority),
+ name(buttonName),
+ caption(buttonCaption),
+ enabled(buttonEnabled)
+ {
+ }
Toolkit::TextSelectionPopup::Buttons id;
- std::size_t priority;
- std::string name;
- std::string caption;
- bool enabled;
+ std::size_t priority;
+ std::string name;
+ std::string caption;
+ bool enabled;
};
struct ButtonPriorityCompare
{
- bool operator()( const ButtonRequirement& lhs, const ButtonRequirement& rhs ) const {
- return lhs.priority < rhs.priority;
- }
+ bool operator()(const ButtonRequirement& lhs, const ButtonRequirement& rhs) const
+ {
+ return lhs.priority < rhs.priority;
+ }
};
/**
* @param[in] callbackInterface The text popup callback interface which receives the button click callbacks.
* @return A handle to the TextSelectionPopup control.
*/
- static Toolkit::TextSelectionPopup New( TextSelectionPopupCallbackInterface* callbackInterface );
+ static Toolkit::TextSelectionPopup New(TextSelectionPopupCallbackInterface* callbackInterface);
// Properties
* @param[in] index The property index.
* @param[in] value The new property value.
*/
- static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
+ static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value);
/**
* @brief Called to retrieve a property of an object of this type.
* @param[in] index The property index.
* @return The current value of the property.
*/
- static Property::Value GetProperty( BaseObject* object, Property::Index index );
+ static Property::Value GetProperty(BaseObject* object, Property::Index index);
/**
* @copydoc Toolkit::EnableButtons
*/
- void EnableButtons( Toolkit::TextSelectionPopup::Buttons buttonsToEnable );
+ void EnableButtons(Toolkit::TextSelectionPopup::Buttons buttonsToEnable);
/**
* @copydoc Toolkit::TextSelectionPopup::RaiseAbove()
*/
- void RaiseAbove( Actor target );
+ void RaiseAbove(Actor target);
/**
* @copydoc Toolkit::TextSelectionPopup::ShowPopup()
void HidePopup();
private: // From Control
-
/**
* @copydoc Control::OnInitialize()
*/
void OnInitialize() override;
private: // Implementation
-
- void HideAnimationFinished( Animation& animation );
+ void HideAnimationFinished(Animation& animation);
/**
* @brief When the cut button is pressed.
* @param[in] button the button pressed
* @return @e true to consume the event.
*/
- bool OnCutButtonPressed( Toolkit::Button button );
+ bool OnCutButtonPressed(Toolkit::Button button);
/**
* @brief When the copy button is pressed.
* @param[in] button the button pressed
* @return @e true to consume the event.
*/
- bool OnCopyButtonPressed( Toolkit::Button button );
+ bool OnCopyButtonPressed(Toolkit::Button button);
/**
* @brief When the paste button is pressed.
* @param[in] button the button pressed
* @return @e true to consume the event.
*/
- bool OnPasteButtonPressed( Toolkit::Button button );
+ bool OnPasteButtonPressed(Toolkit::Button button);
/**
* @brief When the select button is pressed.
* @param[in] button the button pressed
* @return @e true to consume the event.
*/
- bool OnSelectButtonPressed( Toolkit::Button button );
+ bool OnSelectButtonPressed(Toolkit::Button button);
/**
* @brief When the select all button is pressed.
* @param[in] button the button pressed
* @return @e true to consume the event.
*/
- bool OnSelectAllButtonPressed( Toolkit::Button button );
+ bool OnSelectAllButtonPressed(Toolkit::Button button);
/**
* @brief When the clipboard button is pressed.
* @param[in] button the button pressed
* @return @e true to consume the event.
*/
- bool OnClipboardButtonPressed( Toolkit::Button button );
+ bool OnClipboardButtonPressed(Toolkit::Button button);
/**
* @brief Method to set the dimension or dimension constraint on certain aspects of the Popup.
* @param[in] settingToCustomise The setting for the PopupCustomisations enum that can be customised
* @param[in] dimension The size to customise with
*/
- void SetDimensionToCustomise( const PopupCustomisations& settingToCustomise, const Size& dimension );
+ void SetDimensionToCustomise(const PopupCustomisations& settingToCustomise, const Size& dimension);
/**
* @brief Method to get the dimension or dimension constraint on certain aspects of the Popup that was previously customised
*
* @param[in] setting The setting from the PopupCustomisations enum
*/
- Size GetDimensionToCustomise( const PopupCustomisations& setting ) const;
+ Size GetDimensionToCustomise(const PopupCustomisations& setting) const;
/**
* @brief Sets the image for the given button of the Popup.
* @param[in] button The button the image should be used for from the Buttons Enum.
* @param[in] image The image to use.
*/
- void SetButtonImage( Toolkit::TextSelectionPopup::Buttons button, const std::string& image );
+ void SetButtonImage(Toolkit::TextSelectionPopup::Buttons button, const std::string& image);
/**
* @brief Retrieves the image of the given button used by the popup
* @param[in] button The button to get the image from
* @return The image used for that button.
*/
- const std::string& GetButtonImage( Toolkit::TextSelectionPopup::Buttons button ) const;
+ const std::string& GetButtonImage(Toolkit::TextSelectionPopup::Buttons button) const;
/**
* @brief Sets the image for the pressed state of a popup option.
*
* @param[in] filename The image filename to use.
*/
- void SetPressedImage( const std::string& filename);
+ void SetPressedImage(const std::string& filename);
/**
* @brief Gets the image used for the pressed state of a popup option.
void CreateOrderedListOfPopupOptions();
- void AddOption( const ButtonRequirement& button, bool showDivider, bool showIcons, bool showCaption );
+ void AddOption(const ButtonRequirement& button, bool showDivider, bool showIcons, bool showCaption);
std::size_t GetNumberOfEnabledOptions() const;
- void AddPopupOptionsToToolbar( bool showIcons, bool showCaptions );
+ void AddPopupOptionsToToolbar(bool showIcons, bool showCaptions);
/**
* Creates the background-border image
*
* @param[in] propertyMap The properties describing the background-border
*/
- void CreateBackgroundBorder( Property::Map& propertyMap );
+ void CreateBackgroundBorder(Property::Map& propertyMap);
/**
* Construct a new TextField.
*/
- TextSelectionPopup( TextSelectionPopupCallbackInterface* callbackInterface );
+ TextSelectionPopup(TextSelectionPopupCallbackInterface* callbackInterface);
/**
* A reference counted object may only be deleted by calling Unreference()
virtual ~TextSelectionPopup();
private:
-
// Undefined copy constructor and assignment operators
TextSelectionPopup(const TextSelectionPopup&);
TextSelectionPopup& operator=(const TextSelectionPopup& rhs);
private: // Data
-
-
Dali::Toolkit::TextSelectionToolbar mToolbar;
- Dali::Toolkit::TableView mTableOfButtons; // Actor which holds all the buttons, sensitivity can be set on buttons via this actor
+ Dali::Toolkit::TableView mTableOfButtons; // Actor which holds all the buttons, sensitivity can be set on buttons via this actor
// Images paths to be used by the Popup buttons
std::string mCutIconImage;
std::string mSelectIconImage;
std::string mSelectAllIconImage;
- Size mPopupMaxSize; // Maximum size of the Popup
- Size mOptionMaxSize; // Maximum size of an Option button
- Size mOptionMinSize; // Minimum size of an Option button
- Size mOptionDividerSize; // Size of divider line
+ Size mPopupMaxSize; // Maximum size of the Popup
+ Size mOptionMaxSize; // Maximum size of an Option button
+ Size mOptionMinSize; // Minimum size of an Option button
+ Size mOptionDividerSize; // Size of divider line
std::vector<ButtonRequirement> mOrderListOfButtons; // List of buttons in the order to be displayed and a flag to indicate if needed.
- Toolkit::TextSelectionPopup::Buttons mEnabledButtons; // stores enabled buttons
+ Toolkit::TextSelectionPopup::Buttons mEnabledButtons; // stores enabled buttons
Toolkit::TextSelectionPopupCallbackInterface* mCallbackInterface;
- std::string mPressedImage; // Image used for the popup option when pressed.
- Vector4 mPressedColor; // Color of the popup option when pressed.
- Vector4 mDividerColor; // Color of the divider between buttons
- Vector4 mIconColor; // Color of the popup icon.
+ std::string mPressedImage; // Image used for the popup option when pressed.
+ Vector4 mPressedColor; // Color of the popup option when pressed.
+ Vector4 mDividerColor; // Color of the divider between buttons
+ Vector4 mIconColor; // Color of the popup icon.
// Priority of Options/Buttons in the Cut and Paste pop-up, higher priority buttons are displayed first, left to right.
std::size_t mSelectOptionPriority; // Position of Select Button
std::size_t mCopyOptionPriority; // Position of Copy button
std::size_t mPasteOptionPriority; // Position of Paste button
std::size_t mClipboardOptionPriority; // Position of Clipboard button
- float mFadeInDuration; // Duration of the animation to fade in the Popup
- float mFadeOutDuration; // Duration of the animation to fade out the Popup
-
- bool mShowIcons:1; // Flag to show icons
- bool mShowCaptions:1; // Flag to show text captions
- bool mPopupShowing:1; // Flag to indicate Popup showing
- bool mButtonsChanged:1; // Flag to indicate the Popup Buttons have changed
+ float mFadeInDuration; // Duration of the animation to fade in the Popup
+ float mFadeOutDuration; // Duration of the animation to fade out the Popup
+ bool mShowIcons : 1; // Flag to show icons
+ bool mShowCaptions : 1; // Flag to show text captions
+ bool mPopupShowing : 1; // Flag to indicate Popup showing
+ bool mButtonsChanged : 1; // Flag to indicate the Popup Buttons have changed
};
} // namespace Internal
// Helpers for public-api forwarding methods
-inline Toolkit::Internal::TextSelectionPopup& GetImpl( Toolkit::TextSelectionPopup& textSelectionPopup )
+inline Toolkit::Internal::TextSelectionPopup& GetImpl(Toolkit::TextSelectionPopup& textSelectionPopup)
{
- DALI_ASSERT_ALWAYS( textSelectionPopup );
+ DALI_ASSERT_ALWAYS(textSelectionPopup);
Dali::RefObject& handle = textSelectionPopup.GetImplementation();
return static_cast<Toolkit::Internal::TextSelectionPopup&>(handle);
}
-inline const Toolkit::Internal::TextSelectionPopup& GetImpl( const Toolkit::TextSelectionPopup& textSelectionPopup )
+inline const Toolkit::Internal::TextSelectionPopup& GetImpl(const Toolkit::TextSelectionPopup& textSelectionPopup)
{
- DALI_ASSERT_ALWAYS( textSelectionPopup );
+ DALI_ASSERT_ALWAYS(textSelectionPopup);
const Dali::RefObject& handle = textSelectionPopup.GetImplementation();
} // namespace Dali
#endif // DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_POPUP_H
-
#define DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_TOOLBAR_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
#include <dali-toolkit/devel-api/controls/scroll-bar/scroll-bar.h>
#include <dali-toolkit/devel-api/controls/table-view/table-view.h>
#include <dali-toolkit/devel-api/controls/text-controls/text-selection-toolbar.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
// EXTERNAL INCLUDES
#include <dali/public-api/actors/layer.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class TextSelectionToolbar : public Control
{
public:
-
/**
* @copydoc Dali::Toollkit::TextSelectionToolbar::New()
*/
* @param[in] index The property index.
* @param[in] value The new property value.
*/
- static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
+ static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value);
/**
* @brief Called to retrieve a property of an object of this type.
* @param[in] index The property index.
* @return The current value of the property.
*/
- static Property::Value GetProperty( BaseObject* object, Property::Index index );
+ static Property::Value GetProperty(BaseObject* object, Property::Index index);
/**
* @copydoc Toolkit::TextSelectionToolbar::AddOption()
*/
- void AddOption( Actor& option );
+ void AddOption(Actor& option);
/**
* @copydoc Toolkit::TextSelectionToolbar::AddDivider()
*/
- void AddDivider( Actor& divider );
+ void AddDivider(Actor& divider);
/**
* @copydoc Toolkit::TextSelectionToolbar::ResizeDividers()
*/
- void ResizeDividers( Size& size );
+ void ResizeDividers(Size& size);
/**
* @copydoc Toolkit::TextSelectionToolbar::RaiseAbove()
*/
- void RaiseAbove( Actor target );
+ void RaiseAbove(Actor target);
/**
* Sets the scroll bar padding.
*
* @param[in] padding The padding value.
*/
- void SetScrollBarPadding( const Vector2& padding );
+ void SetScrollBarPadding(const Vector2& padding);
/**
* @return The padding value.
/**
* @copydoc Toolkit::TextSelectionToolbar::ScrollTo()
*/
- void ScrollTo( const Vector2& position );
+ void ScrollTo(const Vector2& position);
private: // From Control
-
/**
* @copydoc Control::OnInitialize()
*/
/**
* @copydoc Control::OnRelayout()
*/
- void OnRelayout( const Vector2& size, RelayoutContainer& container ) override;
+ void OnRelayout(const Vector2& size, RelayoutContainer& container) override;
/**
* @brief Set max size of Popup
* @param[in] maxSize Size (Vector2)
*/
- void SetPopupMaxSize( const Size& maxSize );
+ void SetPopupMaxSize(const Size& maxSize);
/**
* @brief Get Max size of Popup
const Dali::Vector2& GetPopupMaxSize() const;
private: // Implementation
-
/**
* @copydoc Toolkit::TextSelectionToolbar::ConfigureScrollview()
*/
- void ConfigureScrollview( const Property::Map& properties );
+ void ConfigureScrollview(const Property::Map& properties);
/**
* @brief Set up scrollview to scroll Toolbar horizontally
*
* @param[in] enable True if the scroll-bar is required
*/
- void SetUpScrollBar( bool enable );
+ void SetUpScrollBar(bool enable);
/**
* Toolbar has started to scroll
* @param[in] position current scroll view position
*/
- void OnScrollStarted( const Vector2& position );
+ void OnScrollStarted(const Vector2& position);
/**
* Toolbar has stopped scrolling
* @param[in] position current scroll view position
*/
- void OnScrollCompleted( const Vector2& position );
+ void OnScrollCompleted(const Vector2& position);
/**
* Construct a new TextField.
virtual ~TextSelectionToolbar();
private:
-
// Undefined copy constructor and assignment operators
TextSelectionToolbar(const TextSelectionToolbar&);
TextSelectionToolbar& operator=(const TextSelectionToolbar& rhs);
-private: // Data
-
- Actor mToolbarActor; ///< The actor used to house the toolbar.
- Toolkit::TableView mTableOfButtons; ///< Actor which holds all the buttons, sensitivity can be set on buttons via this actor
- Toolkit::ScrollView mScrollView; ///< Provides scrolling of Toolbar when content does not fit.
- Toolkit::ScrollBar mScrollBar; ///< An horizontal scroll bar for the text's popup options.
- RulerPtr mRulerX; ///< Ruler to clamp horizontal scrolling. Updates on Relayout
- Size mMaxSize; ///< Max size of the Toolbar
- Vector2 mScrollBarPadding; ///< The padding used to position the scroll indicator.
- unsigned int mIndexInTable; ///< Index in table to add option
- Dali::Vector< unsigned int > mDividerIndexes; ///< Vector of indexes in the Toolbar that contain dividers.
- bool mFirstScrollEnd; ///< Used for RTL mirroring. Avoids the overshoot to be shown the first time the popup is shown.
+private: // Data
+ Actor mToolbarActor; ///< The actor used to house the toolbar.
+ Toolkit::TableView mTableOfButtons; ///< Actor which holds all the buttons, sensitivity can be set on buttons via this actor
+ Toolkit::ScrollView mScrollView; ///< Provides scrolling of Toolbar when content does not fit.
+ Toolkit::ScrollBar mScrollBar; ///< An horizontal scroll bar for the text's popup options.
+ RulerPtr mRulerX; ///< Ruler to clamp horizontal scrolling. Updates on Relayout
+ Size mMaxSize; ///< Max size of the Toolbar
+ Vector2 mScrollBarPadding; ///< The padding used to position the scroll indicator.
+ unsigned int mIndexInTable; ///< Index in table to add option
+ Dali::Vector<unsigned int> mDividerIndexes; ///< Vector of indexes in the Toolbar that contain dividers.
+ bool mFirstScrollEnd; ///< Used for RTL mirroring. Avoids the overshoot to be shown the first time the popup is shown.
};
} // namespace Internal
// Helpers for public-api forwarding methods
-inline Toolkit::Internal::TextSelectionToolbar& GetImpl( Toolkit::TextSelectionToolbar& textSelectionToolbar )
+inline Toolkit::Internal::TextSelectionToolbar& GetImpl(Toolkit::TextSelectionToolbar& textSelectionToolbar)
{
- DALI_ASSERT_ALWAYS( textSelectionToolbar );
+ DALI_ASSERT_ALWAYS(textSelectionToolbar);
Dali::RefObject& handle = textSelectionToolbar.GetImplementation();
return static_cast<Toolkit::Internal::TextSelectionToolbar&>(handle);
}
-inline const Toolkit::Internal::TextSelectionToolbar& GetImpl( const Toolkit::TextSelectionToolbar& textSelectionToolbar )
+inline const Toolkit::Internal::TextSelectionToolbar& GetImpl(const Toolkit::TextSelectionToolbar& textSelectionToolbar)
{
- DALI_ASSERT_ALWAYS( textSelectionToolbar );
+ DALI_ASSERT_ALWAYS(textSelectionToolbar);
const Dali::RefObject& handle = textSelectionToolbar.GetImplementation();
#define DALI_TOOLKIT_INTERNAL_TOOL_BAR_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/devel-api/common/map-wrapper.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/devel-api/controls/table-view/table-view.h>
#include <dali-toolkit/devel-api/controls/tool-bar/tool-bar.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
namespace Dali
{
-
namespace Toolkit
{
-
class ToolBar;
namespace Internal
{
-
/**
* ToolBar is a control to create a tool bar.
* @see Dali::Toolkit::ToolBar for more details.
class ToolBar : public Control
{
public:
-
/**
* Create an initialized ToolBar.
* @return A handle to a newly allocated Dali resource.
/**
* @copydoc Dali::Toolkit::ToolBar::AddControl()
*/
- void AddControl( Dali::Actor control, float relativeSize, Toolkit::Alignment::Type alignment, const Toolkit::Alignment::Padding& padding );
+ void AddControl(Dali::Actor control, float relativeSize, Toolkit::Alignment::Type alignment, const Toolkit::Alignment::Padding& padding);
/**
* @copydoc Dali::Toolkit::ToolBar::RemoveControl()
*/
- void RemoveControl( Dali::Actor control );
+ void RemoveControl(Dali::Actor control);
private: // From Control
-
/**
* @copydoc Toolkit::Control::OnInitialize()
*/
/**
* Constructor, sets the lock boolean
*/
- Lock( bool& lock )
- : mLock( lock )
+ Lock(bool& lock)
+ : mLock(lock)
{
mLock = true;
}
{
mLock = false;
}
+
private:
bool& mLock;
};
float mAccumulatedRelativeSpace; ///< Stores the total percentage space used by controls.
bool mInitializing; ///< Allows the use of Actor's API to add controls.
- std::map<Actor/*control*/,Toolkit::Alignment> mControls; ///< Stores a relationship between controls and their alignments used to place them inside the table view.
+ std::map<Actor /*control*/, Toolkit::Alignment> mControls; ///< Stores a relationship between controls and their alignments used to place them inside the table view.
};
} // namespace Internal
-
// Helpers for public-api forwarding methods
-inline Toolkit::Internal::ToolBar& GetImpl( Toolkit::ToolBar& toolBar )
+inline Toolkit::Internal::ToolBar& GetImpl(Toolkit::ToolBar& toolBar)
{
- DALI_ASSERT_ALWAYS( toolBar );
+ DALI_ASSERT_ALWAYS(toolBar);
Dali::RefObject& handle = toolBar.GetImplementation();
- return static_cast<Toolkit::Internal::ToolBar&>( handle );
+ return static_cast<Toolkit::Internal::ToolBar&>(handle);
}
-inline const Toolkit::Internal::ToolBar& GetImpl( const Toolkit::ToolBar& toolBar )
+inline const Toolkit::Internal::ToolBar& GetImpl(const Toolkit::ToolBar& toolBar)
{
- DALI_ASSERT_ALWAYS( toolBar );
+ DALI_ASSERT_ALWAYS(toolBar);
const Dali::RefObject& handle = toolBar.GetImplementation();
- return static_cast<const Toolkit::Internal::ToolBar&>( handle );
+ return static_cast<const Toolkit::Internal::ToolBar&>(handle);
}
} // namespace Toolkit
#define DALI_INTERNAL_TOOLTIP_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <string>
#include <dali/public-api/adaptor-framework/timer.h>
#include <dali/public-api/common/intrusive-ptr.h>
#include <dali/public-api/object/property-array.h>
#include <dali/public-api/object/property-map.h>
#include <dali/public-api/object/ref-object.h>
-#include <dali/public-api/signals/connection-tracker.h>
#include <dali/public-api/object/weak-handle.h>
+#include <dali/public-api/signals/connection-tracker.h>
+#include <string>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control.h>
#include <dali-toolkit/devel-api/controls/popup/popup.h>
#include <dali-toolkit/devel-api/controls/tooltip/tooltip-properties.h>
+#include <dali-toolkit/public-api/controls/control.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class Tooltip;
-typedef IntrusivePtr< Tooltip > TooltipPtr;
+typedef IntrusivePtr<Tooltip> TooltipPtr;
/**
* @brief Handles all the required tooltip related functionality for a control.
class Tooltip : public RefObject, public ConnectionTracker
{
public:
-
/**
* @brief Creates an instance of the Tooltip class.
* @param[in] control The control the tooltip should be shown on.
*/
- static TooltipPtr New( Toolkit::Control control );
+ static TooltipPtr New(Toolkit::Control control);
/**
* @brief Sets the properties of the Tooltip.
* If a Property::ARRAY of Visuals then all are displayed in one row.
* @param[in] value This can either be a Property::STRING, Property::MAP or Property::ARRAY.
*/
- void SetProperties( const Property::Value& value );
+ void SetProperties(const Property::Value& value);
/**
* @brief Creates a property map of the tooltip properties.
* @param[out] map Filled with all the properties of the tooltip.
* @note map should be empty.
*/
- void CreatePropertyMap( Property::Map& map ) const;
+ void CreatePropertyMap(Property::Map& map) const;
private:
-
/**
* @brief Private constructor.
*/
- Tooltip( Toolkit::Control control );
+ Tooltip(Toolkit::Control control);
/**
* @brief Private destructor.
*/
~Tooltip();
- Tooltip( const Tooltip& ); ///< Undefined
- Tooltip& operator=( const Tooltip& ); ///< ///< Undefined
+ Tooltip(const Tooltip&); ///< Undefined
+ Tooltip& operator=(const Tooltip&); ///< ///< Undefined
/**
* @brief Sets the content of the tooltip.
* @param[in] control Is used to connect to this control's signals.
* @param[in] value The content property value.
*/
- void SetContent( Toolkit::Control& control, const Property::Value& value );
+ void SetContent(Toolkit::Control& control, const Property::Value& value);
/**
* @brief Sets the background properties of the tooltip.
* @param[in] value The background property value.
*/
- void SetBackground( const Property::Value& value );
+ void SetBackground(const Property::Value& value);
/**
* @brief Sets the tail properties of the tooltip.
* @param[in] value The tail property value.
*/
- void SetTail( const Property::Value& value );
+ void SetTail(const Property::Value& value);
/**
* @brief Method used to connect to the control's Hovered signal.
* @param[in] hover The hover event.
*/
- bool OnHovered( Actor /* actor */, const HoverEvent& hover );
+ bool OnHovered(Actor /* actor */, const HoverEvent& hover);
/**
* @brief Method used to connect to the internal timer used by Tooltip.
* @details This is required so we can appropriately position it.
* @param[in] actor The actor being laid out.
*/
- void OnRelayout( Actor actor );
+ void OnRelayout(Actor actor);
// Data
- Toolkit::Popup mPopup; ///< The Popup class is used to display the actual tooltip.
- Timer mTooltipTimer; ///< Timer used to wait a certain length of time before we display the tooltip.
+ Toolkit::Popup mPopup; ///< The Popup class is used to display the actual tooltip.
+ Timer mTooltipTimer; ///< Timer used to wait a certain length of time before we display the tooltip.
- WeakHandle< Toolkit::Control > mControl; ///< A weak handle to the control we are setting the tooltip on.
+ WeakHandle<Toolkit::Control> mControl; ///< A weak handle to the control we are setting the tooltip on.
- Property::Map mContentTextVisual; ///< If using just one visual, then this is set.
- Property::Map mTailImages; ///< The different images used by the tail.
- Property::Array mContentArray; ///< If using an array of visuals, then this is used.
+ Property::Map mContentTextVisual; ///< If using just one visual, then this is set.
+ Property::Map mTailImages; ///< The different images used by the tail.
+ Property::Array mContentArray; ///< If using an array of visuals, then this is used.
- Rect< int > mBackgroundBorder; ///< The size of the background border in the order: left, right, bottom, top. @see Toolkit::Tooltip::Border::Property::BORDER
+ Rect<int> mBackgroundBorder; ///< The size of the background border in the order: left, right, bottom, top. @see Toolkit::Tooltip::Border::Property::BORDER
- Vector2 mLayout; ///< The layout of the content if using an array.
- Vector2 mHoverPoint; ///< The first point where hover starts.
+ Vector2 mLayout; ///< The layout of the content if using an array.
+ Vector2 mHoverPoint; ///< The first point where hover starts.
Vector2 mHoverPointOffset; ///< The tooltip is displayed with this offset from hover point if using Toolkit::Tooltip::Position::HOVER_POINT.
std::string mBackgroundImage; ///< The path to the background image used for the tooltip.
int mWaitTime; ///< Time in milliseconds to wait before we display the tooltip.
- Toolkit::Tooltip::Position::Type mPositionType; ///< The position of the tooltip.
- bool mTailVisibility; ///< Whether we are showing a tail or not.
- bool mDisappearOnMovement; ///< Whether the tooltip is set to disappear on movement or when we go out of the bounds of mControl.
- bool mSignalsConnected; ///< Whether any signals required for Tooltip functionality have been connected.
+ Toolkit::Tooltip::Position::Type mPositionType; ///< The position of the tooltip.
+ bool mTailVisibility; ///< Whether we are showing a tail or not.
+ bool mDisappearOnMovement; ///< Whether the tooltip is set to disappear on movement or when we go out of the bounds of mControl.
+ bool mSignalsConnected; ///< Whether any signals required for Tooltip functionality have been connected.
};
} // namespace Internal
#define DALI_TOOLKIT_INTERNAL_VIDEO_VIEW_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/video-player.h>
+#include <dali/devel-api/adaptor-framework/video-sync-mode.h>
+#include <dali/integration-api/adaptor-framework/trigger-event-factory.h>
+#include <dali/public-api/images/image-operations.h>
+#include <dali/public-api/object/property-conditions.h>
#include <dali/public-api/object/property-map.h>
#include <dali/public-api/object/property-notification.h>
-#include <dali/public-api/object/property-conditions.h>
#include <dali/public-api/rendering/renderer.h>
-#include <dali/public-api/images/image-operations.h>
#include <dali/public-api/rendering/texture.h>
-#include <dali/devel-api/adaptor-framework/video-player.h>
-#include <dali/integration-api/adaptor-framework/trigger-event-factory.h>
-#include <dali/devel-api/adaptor-framework/video-sync-mode.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
namespace Dali
{
-
namespace Toolkit
{
-
class VideoView;
namespace Internal
{
-
-class VideoView: public Control
+class VideoView : public Control
{
protected:
-
- VideoView( Dali::VideoSyncMode syncMode );
+ VideoView(Dali::VideoSyncMode syncMode);
virtual ~VideoView();
public:
-
/**
* @copydoc Toolkit::DevelVideoView::New()
*/
- static Toolkit::VideoView New( VideoSyncMode syncMode );
+ static Toolkit::VideoView New(VideoSyncMode syncMode);
/**
* @brief Sets a video url to play.
* @SINCE_1_1.38
* @param [in] url The url of the video resource to play
*/
- void SetUrl( const std::string& url );
+ void SetUrl(const std::string& url);
/**
* @brief Returns a video url.
/**
* @copydoc Toolkit::VideoView::Forward()
*/
- void Forward( int millisecond );
+ void Forward(int millisecond);
/**
* @copydoc Toolkit::VideoView::Backward()
*/
- void Backward( int millisecond );
+ void Backward(int millisecond);
/**
* @brief Sets the player mute status.
* @SINCE_1_1.38
* @param[i] mute The new mute status, true is mute.
*/
- void SetMute( bool mute );
+ void SetMute(bool mute);
/**
* @brief Returns the player mute status.
* @param[in] left The left volume scalar
* @param[in] right The right volume scalar
*/
- void SetVolume( float left, float right );
+ void SetVolume(float left, float right);
/**
* @brief Returns current volume factor.
* @param[out] left The current left volume scalar
* @param[out] right The current right volume scalar
*/
- void GetVolume( float& left, float& right );
+ void GetVolume(float& left, float& right);
- /**
+ /**
* @copydoc Dali::Toolkit::VideoView::FinishedSignal()
*/
Dali::Toolkit::VideoView::VideoViewSignalType& FinishedSignal();
* @SINCE_1_1.38
* @param[in] map The Dali::Property::Map to use for to display.
*/
- void SetPropertyMap( Property::Map map );
+ void SetPropertyMap(Property::Map map);
// Properties
/**
* @param[in] index The property index.
* @param[in] value The new property value.
*/
- static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
+ static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value);
/**
* @brief Called to retrieve a property of an object of this type.
* @param[in] index The property index.
* @return The current value of the property.
*/
- static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex );
+ static Property::Value GetProperty(BaseObject* object, Property::Index propertyIndex);
/**
* @brief Set the depth index of this image renderer
* @SINCE_1_1.38
* @param[in] depthIndex The depth index of this renderer
*/
- void SetDepthIndex( int depthIndex );
+ void SetDepthIndex(int depthIndex);
/**
* @brief Performs actions as requested using the action name.
* @param[in] attributes The attributes with which to perfrom this action.
* @return True if action has been accepted by this control
*/
- static bool DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes );
+ static bool DoAction(BaseObject* object, const std::string& actionName, const Property::Map& attributes);
/**
* Connects a callback function with the object's signals.
* @return True if the signal was connected.
* @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the c
*/
- static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
+ static bool DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
/**
* @brief Updates video display area for window rendering target
*/
- void UpdateDisplayArea( Dali::PropertyNotification& source );
+ void UpdateDisplayArea(Dali::PropertyNotification& source);
/**
* @brief Sets underlay flag and initializes new rendering target by flag.
*/
- void SetUnderlay( bool set );
+ void SetUnderlay(bool set);
/**
* @brief Checks underlay flag.
/**
* @brief Sets sw codec type.
*/
- void SetSWCodec( bool on );
+ void SetSWCodec(bool on);
/**
* @brief Gets play position.
/**
* @brief Sets play position.
*/
- void SetPlayPosition( int pos );
+ void SetPlayPosition(int pos);
/**
* @brief Sets Display mode.
*/
- void SetDisplayMode( int mode );
+ void SetDisplayMode(int mode);
/**
* @brief Gets Display mode.
* @param[in] videoView The current VideoView
* @param[in] animation The animation for video view's resize or move.
*/
- void PlayAnimation( Dali::Animation animation );
+ void PlayAnimation(Dali::Animation animation);
private: // From Control
-
/**
* @copydoc Toolkit::Control::OnInitialize()
*/
/**
* @copydoc Toolkit::Control::OnSceneConnection()
*/
- void OnSceneConnection( int depth ) override;
+ void OnSceneConnection(int depth) override;
/**
* @copydoc Toolkit::Control::OnSceneDisconnection()
/**
* @copydoc Toolkit::Control::OnSizeSet()
*/
- void OnSizeSet( const Vector3& targetSize ) override;
+ void OnSizeSet(const Vector3& targetSize) override;
/**
* @copydoc Toolkit::Control::GetNaturalSize
/**
* @copydoc Toolkit::Control::GetHeightForWidth()
*/
- float GetHeightForWidth( float width ) override;
+ float GetHeightForWidth(float width) override;
/**
* @copydoc Toolkit::Control::GetWidthForHeight()
*/
- float GetWidthForHeight( float height ) override;
+ float GetWidthForHeight(float height) override;
private:
-
/**
* @brief Construct a new VideoView.
*/
- VideoView( const VideoView& videoView );
+ VideoView(const VideoView& videoView);
// Undefined assignment operator.
- VideoView& operator=( const VideoView& videoView );
+ VideoView& operator=(const VideoView& videoView);
/**
* @brief SetWindowSurfaceTarget for underlay video playback.
* @param String output
* @return true if the output was found
*/
- bool GetStringFromProperty( const Dali::Property::Value& value, std::string& output );
+ bool GetStringFromProperty(const Dali::Property::Value& value, std::string& output);
/*
* @brief Internal version of SetProperty
*/
- void SetPropertyInternal( Property::Index index, const Property::Value& value );
+ void SetPropertyInternal(Property::Index index, const Property::Value& value);
/*
* @brief Apply properties after reset video player
* so Ui and video player's synchronization can be finished.
*
*/
- void FrameRenderCallback( int frameID );
+ void FrameRenderCallback(int frameID);
/*
* @brief Set frameRender Callback function
*/
void SetFrameRenderCallback();
-
/*
* @brief resize/move animation finished callback function
*
* This function is called the resize/move animation is finished,
*
*/
- void OnAnimationFinished( Dali::Animation& animation );
+ void OnAnimationFinished(Dali::Animation& animation);
private:
-
- Dali::VideoPlayer mVideoPlayer;
+ Dali::VideoPlayer mVideoPlayer;
Dali::ImageDimensions mVideoSize;
- Dali::Property::Map mPropertyMap;
- Dali::Property::Map mEffectPropertyMap;
- Dali::Texture mNativeTexture;
+ Dali::Property::Map mPropertyMap;
+ Dali::Property::Map mEffectPropertyMap;
+ Dali::Texture mNativeTexture;
+
Dali::Toolkit::VideoView::VideoViewSignalType mFinishedSignal;
- std::string mUrl;
+
+ std::string mUrl;
Dali::DisplayArea mDisplayArea;
- Dali::Renderer mOverlayRenderer;
- Dali::Renderer mTextureRenderer;
+ Dali::Renderer mOverlayRenderer;
+ Dali::Renderer mTextureRenderer;
+
Dali::PropertyNotification mPositionUpdateNotification;
Dali::PropertyNotification mSizeUpdateNotification;
Dali::PropertyNotification mScaleUpdateNotification;
+
Dali::Property::Map mPropertyBackup;
int mCurrentVideoPlayPosition;
} // namespace Internal
-inline Toolkit::Internal::VideoView& GetImpl( Toolkit::VideoView& handle )
+inline Toolkit::Internal::VideoView& GetImpl(Toolkit::VideoView& handle)
{
- DALI_ASSERT_ALWAYS( handle );
+ DALI_ASSERT_ALWAYS(handle);
Dali::RefObject& impl = handle.GetImplementation();
- return static_cast< Toolkit::Internal::VideoView& >( impl );
+ return static_cast<Toolkit::Internal::VideoView&>(impl);
}
-inline const Toolkit::Internal::VideoView& GetImpl( const Toolkit::VideoView& handle )
+inline const Toolkit::Internal::VideoView& GetImpl(const Toolkit::VideoView& handle)
{
- DALI_ASSERT_ALWAYS( handle );
+ DALI_ASSERT_ALWAYS(handle);
const Dali::RefObject& impl = handle.GetImplementation();
- return static_cast< const Toolkit::Internal::VideoView& >( impl );
+ return static_cast<const Toolkit::Internal::VideoView&>(impl);
}
} // namespace Toolkit
#define DALI_TOOLKIT_INTERNAL_WEB_VIEW_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <memory>
#include <dali/devel-api/adaptor-framework/web-engine.h>
#include <dali/public-api/images/image-operations.h>
#include <dali/public-api/object/property-notification.h>
+#include <memory>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/controls/web-view/web-view.h>
namespace Dali
{
-
namespace Toolkit
{
-
class KeyEvent;
class TouchEvent;
class WebBackForwardList;
namespace Internal
{
-
class WebView : public Control
{
protected:
-
WebView();
- WebView( const std::string& locale, const std::string& timezoneId );
+ WebView(const std::string& locale, const std::string& timezoneId);
- WebView( int argc, char** argv );
+ WebView(int argc, char** argv);
virtual ~WebView();
public:
-
/**
* @copydoc Dali::Toolkit::WebView::New()
*/
/**
* @copydoc Dali::Toolkit::WebView::New( const std::string&, const std::string& )
*/
- static Toolkit::WebView New( const std::string& locale, const std::string& timezoneId );
+ static Toolkit::WebView New(const std::string& locale, const std::string& timezoneId);
/**
* @brief Get settings of WebEngine.
/**
* @copydoc Dali::Toolkit::WebView::New( int, char** )
*/
- static Toolkit::WebView New( int argc, char** argv );
+ static Toolkit::WebView New(int argc, char** argv);
/**
* @brief Get Favicon of web page.
/**
* @copydoc Dali::Toolkit::WebView::LoadUrl()
*/
- void LoadUrl( const std::string& url );
+ void LoadUrl(const std::string& url);
/**
* @copydoc Dali::WebEngine::LoadHTMLString()
*/
- void LoadHtmlString( const std::string& htmlString );
+ void LoadHtmlString(const std::string& htmlString);
/**
* @copydoc Dali::Toolkit::WebView::Reload()
/**
* @copydoc Dali::Toolkit::WebView::ScrollBy()
*/
- void ScrollBy( int deltaX, int deltaY );
+ void ScrollBy(int deltaX, int deltaY);
/**
* @copydoc Dali::Toolkit::WebView::CanGoForward()
/**
* @copydoc Dali::Toolkit::WebView::EvaluateJavaScript()
*/
- void EvaluateJavaScript( const std::string& script, std::function< void( const std::string& ) > resultHandler );
+ void EvaluateJavaScript(const std::string& script, std::function<void(const std::string&)> resultHandler);
/**
* @copydoc Dali::Toolkit::WebView::AddJavaScriptMessageHandler()
*/
- void AddJavaScriptMessageHandler( const std::string& exposedObjectName, std::function< void( const std::string& ) > handler );
+ void AddJavaScriptMessageHandler(const std::string& exposedObjectName, std::function<void(const std::string&)> handler);
/**
* @brief Clears all tiles resources of Web.
Dali::Toolkit::WebView::WebViewScrollEdgeReachedSignalType& ScrollEdgeReachedSignal();
public: // Properties
-
/**
* @brief Called when a property of an object of this type is set.
*
* @param[in] index The property index.
* @param[in] value The new property value.
*/
- static void SetProperty( Dali::BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value );
+ static void SetProperty(Dali::BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value);
/**
* @brief Called to retrieve a property of an object of this type.
* @param[in] index The property index.
* @return The current value of the property.
*/
- static Dali::Property::Value GetProperty( Dali::BaseObject* object, Dali::Property::Index propertyIndex );
+ static Dali::Property::Value GetProperty(Dali::BaseObject* object, Dali::Property::Index propertyIndex);
/**
* Connects a callback function with the object's signals.
* @return True if the signal was connected.
* @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the c
*/
- static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
+ static bool DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
private: // From Control
-
/**
* @copydoc Toolkit::Control::OnInitialize()
*/
* @param[in] touch The Touch Data.
* @return Whether to consume event or not.
*/
- bool OnTouchEvent( Actor actor, const Dali::TouchEvent& touch );
+ bool OnTouchEvent(Actor actor, const Dali::TouchEvent& touch);
/**
* @copydoc Toolkit::Control::OnKeyEvent()
*/
- bool OnKeyEvent( const Dali::KeyEvent& event ) override;
+ bool OnKeyEvent(const Dali::KeyEvent& event) override;
/**
* @copydoc Toolkit::Control::OnKeyInputFocusGained()
/**
* @copydoc Toolkit::Control::OnSceneConnection()
*/
- void OnSceneConnection( int depth ) override;
+ void OnSceneConnection(int depth) override;
private:
-
// Undefined
- WebView( const WebView& webView );
+ WebView(const WebView& webView);
- WebView& operator=( const WebView& webView );
+ WebView& operator=(const WebView& webView);
/**
* @brief Sets an absolute scroll of the given view.
* @param[in] x The coordinate x of scroll
* @param[in] y The coordinate y of scroll
*/
- void SetScrollPosition( int x, int y );
+ void SetScrollPosition(int x, int y);
/**
* @brief Gets the current scroll position of the given view.
* @brief Set user agent string.
* @param[in] userAgent The string value of user agent
*/
- void SetUserAgent( const std::string& userAgent );
+ void SetUserAgent(const std::string& userAgent);
/**
* @brief Updates display area of web view.
* @param[in] source The soource triggers Notification.
*/
- void UpdateDisplayArea( Dali::PropertyNotification& source );
+ void UpdateDisplayArea(Dali::PropertyNotification& source);
/**
* @brief Enable/Disable video hole for video playing.
* @param[in] enabled True if video hole is enabled, false otherwise.
*/
- void EnableVideoHole( bool enabled );
+ void EnableVideoHole(bool enabled);
/**
* @brief Enable blend mode.
* @param[in] blendEnabled True if turn on blend mode, false otherwise.
*/
- void EnableBlendMode( bool blendEnabled );
+ void EnableBlendMode(bool blendEnabled);
/**
* @brief Callback function to be called when page load started.
* @param[in] url The url currently being loaded
*/
- void OnPageLoadStarted( const std::string& url );
+ void OnPageLoadStarted(const std::string& url);
/**
* @brief Callback function to be called when page load finished.
* @param[in] url The url currently being loaded
*/
- void OnPageLoadFinished( const std::string& url );
+ void OnPageLoadFinished(const std::string& url);
/**
* @brief Callback function to be called when there is an error in page loading.
* @param[in] url The url currently being loaded
* @param[in] errorCode The error code
*/
- void OnPageLoadError( const std::string& url, int errorCode );
+ void OnPageLoadError(const std::string& url, int errorCode);
/**
* @brief Callback function to be called when scroll edge is reached.
* @param[in] e The scroll edge reached.
*/
- void OnScrollEdgeReached( Dali::WebEnginePlugin::ScrollEdge edge );
+ void OnScrollEdgeReached(Dali::WebEnginePlugin::ScrollEdge edge);
private:
-
- std::string mUrl;
- Dali::Toolkit::Visual::Base mVisual;
- Dali::Size mWebViewSize;
- Dali::WebEngine mWebEngine;
-
- Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadStartedSignal;
- Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadFinishedSignal;
- Dali::Toolkit::WebView::WebViewPageLoadErrorSignalType mPageLoadErrorSignal;
+ std::string mUrl;
+ Dali::Toolkit::Visual::Base mVisual;
+ Dali::Size mWebViewSize;
+ Dali::WebEngine mWebEngine;
+
+ Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadStartedSignal;
+ Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadFinishedSignal;
+ Dali::Toolkit::WebView::WebViewPageLoadErrorSignalType mPageLoadErrorSignal;
Dali::Toolkit::WebView::WebViewScrollEdgeReachedSignalType mScrollEdgeReachedSignal;
- std::unique_ptr<Dali::Toolkit::WebContext> mWebContext;
- std::unique_ptr<Dali::Toolkit::WebCookieManager> mWebCookieManager;
- std::unique_ptr<Dali::Toolkit::WebSettings> mWebSettings;
- std::unique_ptr<Dali::Toolkit::WebBackForwardList> mWebBackForwardList;
- Dali::Toolkit::ImageView mFaviconView;
-
- Dali::PropertyNotification mPositionUpdateNotification;
- Dali::PropertyNotification mSizeUpdateNotification;
- Dali::PropertyNotification mScaleUpdateNotification;
- bool mVideoHoleEnabled;
- Dali::Rect< int > mWebViewArea;
+ std::unique_ptr<Dali::Toolkit::WebContext> mWebContext;
+ std::unique_ptr<Dali::Toolkit::WebCookieManager> mWebCookieManager;
+ std::unique_ptr<Dali::Toolkit::WebSettings> mWebSettings;
+ std::unique_ptr<Dali::Toolkit::WebBackForwardList> mWebBackForwardList;
+ Dali::Toolkit::ImageView mFaviconView;
+
+ Dali::PropertyNotification mPositionUpdateNotification;
+ Dali::PropertyNotification mSizeUpdateNotification;
+ Dali::PropertyNotification mScaleUpdateNotification;
+ bool mVideoHoleEnabled;
+ Dali::Rect<int> mWebViewArea;
};
} // namespace Internal
-inline Toolkit::Internal::WebView& GetImpl( Toolkit::WebView& handle )
+inline Toolkit::Internal::WebView& GetImpl(Toolkit::WebView& handle)
{
- DALI_ASSERT_ALWAYS( handle );
+ DALI_ASSERT_ALWAYS(handle);
Dali::RefObject& impl = handle.GetImplementation();
- return static_cast< Toolkit::Internal::WebView& >( impl );
+ return static_cast<Toolkit::Internal::WebView&>(impl);
}
-inline const Toolkit::Internal::WebView& GetImpl( const Toolkit::WebView& handle )
+inline const Toolkit::Internal::WebView& GetImpl(const Toolkit::WebView& handle)
{
- DALI_ASSERT_ALWAYS( handle );
+ DALI_ASSERT_ALWAYS(handle);
const Dali::RefObject& impl = handle.GetImplementation();
- return static_cast< const Toolkit::Internal::WebView& >( impl );
+ return static_cast<const Toolkit::Internal::WebView&>(impl);
}
} // namespace Toolkit
#define DALI_INTERNAL_DRAG_AND_DROP_DETECTOR_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
+#include <algorithm>
#include <string>
#include <vector>
-#include <algorithm>
-#include <dali/public-api/object/base-object.h>
#include <dali/public-api/math/vector2.h>
+#include <dali/public-api/object/base-object.h>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/drag-drop-detector/drag-and-drop-detector.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
-using DragAndDropDetectorPtr = IntrusivePtr< DragAndDropDetector >;
+using DragAndDropDetectorPtr = IntrusivePtr<DragAndDropDetector>;
/**
* This class listens to Drag & Drop events.
class DragAndDropDetector : public Dali::BaseObject, public ConnectionTracker
{
public:
-
using DragAndDropSignal = Dali::Toolkit::DragAndDropDetector::DragAndDropSignal;
// Creation
* Sets the dragged content.
* @param[in] content A string that represents the content that has been dropped.
*/
- void SetContent( const std::string& content );
+ void SetContent(const std::string& content);
/**
* Clears the stored content.
/**
* Sets the position the drop occurred.
*/
- void SetPosition( const Vector2& screenPosition );
+ void SetPosition(const Vector2& screenPosition);
/**
* Called when a draggable object start drag.
void EmitEndedSignal(Dali::Toolkit::Control& control);
public: // Signals
-
/**
* @copydoc Dali::Toolkit::DragAndDropDetector::StartedSignal
*/
void OnPan(Dali::Actor actor, const PanGesture& gesture);
private:
-
// Construction & Destruction
/**
virtual ~DragAndDropDetector();
// Undefined
- DragAndDropDetector( const DragAndDropDetector& ) = delete;
- DragAndDropDetector& operator=( DragAndDropDetector& );
+ DragAndDropDetector(const DragAndDropDetector&) = delete;
+ DragAndDropDetector& operator =(DragAndDropDetector&);
private:
-
- std::string mContent; ///< The current Drag & drop content.
+ std::string mContent; ///< The current Drag & drop content.
DragAndDropSignal mStartedSignal;
DragAndDropSignal mEnteredSignal;
DragAndDropSignal mDroppedSignal;
DragAndDropSignal mEndedSignal;
- std::vector<Dali::Toolkit::Control> mControls; //controls attached by Attach interface for drag&drop
- Dali::Toolkit::Control mDragControl; //the current drag control
- Dali::Toolkit::Control mShadowControl; //a shadow control for indicating where the control is, same size as the dragged control
- std::vector<uint32_t> mFirstEnter; //control id indicating if the cursor is enter
- Dali::PanGestureDetector mPanGestureDetector; //pangesture for calculating the shadow actor position
+ std::vector<Dali::Toolkit::Control> mControls; //controls attached by Attach interface for drag&drop
+ Dali::Toolkit::Control mDragControl; //the current drag control
+ Dali::Toolkit::Control mShadowControl; //a shadow control for indicating where the control is, same size as the dragged control
+ std::vector<uint32_t> mFirstEnter; //control id indicating if the cursor is enter
+ Dali::PanGestureDetector mPanGestureDetector; //pangesture for calculating the shadow actor position
Vector2 mLocalPosition;
Vector2 mDragLocalPosition;
} // namespace Internal
-
// Helpers for public-api forwarding methods
inline Internal::DragAndDropDetector& GetImplementation(Dali::Toolkit::DragAndDropDetector& detector)
{
- DALI_ASSERT_ALWAYS( detector && "DragAndDropDetector handle is empty" );
+ DALI_ASSERT_ALWAYS(detector && "DragAndDropDetector handle is empty");
BaseObject& handle = detector.GetBaseObject();
inline const Internal::DragAndDropDetector& GetImplementation(const Dali::Toolkit::DragAndDropDetector& detector)
{
- DALI_ASSERT_ALWAYS( detector && "DragAndDropDetector handle is empty" );
+ DALI_ASSERT_ALWAYS(detector && "DragAndDropDetector handle is empty");
const BaseObject& handle = detector.GetBaseObject();
#define DALI_FEEDBACK_IDS_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
/**
* Enumerations for the types of feedback
* Note: These are based on feedback_type_e in libsvi
{
FEEDBACK_PATTERN_NONE = -1,
- FEEDBACK_PATTERN_TAP = 0, /**< feedback pattern when general touch */
- FEEDBACK_PATTERN_SIP, /**< feedback pattern when touch text key */
- FEEDBACK_PATTERN_SIP_BACKSPACE, /**< feedback pattern when touch backspace key */
- FEEDBACK_PATTERN_MAX_CHARACTER, /**< feedback pattern when max character */
- FEEDBACK_PATTERN_KEY0, /**< feedback pattern when touch numeric 0 key */
- FEEDBACK_PATTERN_KEY1, /**< feedback pattern when touch numeric 1 key */
- FEEDBACK_PATTERN_KEY2, /**< feedback pattern when touch numeric 2 key */
- FEEDBACK_PATTERN_KEY3, /**< feedback pattern when touch numeric 3 key */
- FEEDBACK_PATTERN_KEY4, /**< feedback pattern when touch numeric 4 key */
- FEEDBACK_PATTERN_KEY5, /**< feedback pattern when touch numeric 5 key */
- FEEDBACK_PATTERN_KEY6, /**< feedback pattern when touch numeric 6 key */
- FEEDBACK_PATTERN_KEY7, /**< feedback pattern when touch numeric 7 key */
- FEEDBACK_PATTERN_KEY8, /**< feedback pattern when touch numeric 8 key */
- FEEDBACK_PATTERN_KEY9, /**< feedback pattern when touch numeric 9 key */
- FEEDBACK_PATTERN_KEY_STAR, /**< feedback pattern when touch star key */
- FEEDBACK_PATTERN_KEY_SHARP, /**< feedback pattern when touch sharp key */
- FEEDBACK_PATTERN_HOLD, /**< feedback pattern when touch hold */
- FEEDBACK_PATTERN_MULTI_TAP, /**< feedback pattern when multi touch */
- FEEDBACK_PATTERN_HW_TAP, /**< feedback pattern when press hardware key */
- FEEDBACK_PATTERN_HW_HOLD, /**< feedback pattern when holding press hardware key */
+ FEEDBACK_PATTERN_TAP = 0, /**< feedback pattern when general touch */
+ FEEDBACK_PATTERN_SIP, /**< feedback pattern when touch text key */
+ FEEDBACK_PATTERN_SIP_BACKSPACE, /**< feedback pattern when touch backspace key */
+ FEEDBACK_PATTERN_MAX_CHARACTER, /**< feedback pattern when max character */
+ FEEDBACK_PATTERN_KEY0, /**< feedback pattern when touch numeric 0 key */
+ FEEDBACK_PATTERN_KEY1, /**< feedback pattern when touch numeric 1 key */
+ FEEDBACK_PATTERN_KEY2, /**< feedback pattern when touch numeric 2 key */
+ FEEDBACK_PATTERN_KEY3, /**< feedback pattern when touch numeric 3 key */
+ FEEDBACK_PATTERN_KEY4, /**< feedback pattern when touch numeric 4 key */
+ FEEDBACK_PATTERN_KEY5, /**< feedback pattern when touch numeric 5 key */
+ FEEDBACK_PATTERN_KEY6, /**< feedback pattern when touch numeric 6 key */
+ FEEDBACK_PATTERN_KEY7, /**< feedback pattern when touch numeric 7 key */
+ FEEDBACK_PATTERN_KEY8, /**< feedback pattern when touch numeric 8 key */
+ FEEDBACK_PATTERN_KEY9, /**< feedback pattern when touch numeric 9 key */
+ FEEDBACK_PATTERN_KEY_STAR, /**< feedback pattern when touch star key */
+ FEEDBACK_PATTERN_KEY_SHARP, /**< feedback pattern when touch sharp key */
+ FEEDBACK_PATTERN_HOLD, /**< feedback pattern when touch hold */
+ FEEDBACK_PATTERN_MULTI_TAP, /**< feedback pattern when multi touch */
+ FEEDBACK_PATTERN_HW_TAP, /**< feedback pattern when press hardware key */
+ FEEDBACK_PATTERN_HW_HOLD, /**< feedback pattern when holding press hardware key */
- FEEDBACK_PATTERN_MESSAGE, /**< feedback pattern when incoming a message */
- FEEDBACK_PATTERN_MESSAGE_ON_CALL, /**< feedback pattern when incoming a message on call */
- FEEDBACK_PATTERN_EMAIL, /**< feedback pattern when incoming an email */
- FEEDBACK_PATTERN_EMAIL_ON_CALL, /**< feedback pattern when incoming an email on call */
- FEEDBACK_PATTERN_WAKEUP, /**< feedback pattern when alert wake up call */
- FEEDBACK_PATTERN_WAKEUP_ON_CALL, /**< feedback pattern when alert wake up call on call */
- FEEDBACK_PATTERN_SCHEDULE, /**< feedback pattern when alert schedule alarm */
- FEEDBACK_PATTERN_SCHEDULE_ON_CALL, /**< feedback pattern when alert schedule alarm on call */
- FEEDBACK_PATTERN_TIMER, /**< feedback pattern when alert timer */
- FEEDBACK_PATTERN_TIMER_ON_CALL, /**< feedback pattern when alert timer on call */
- FEEDBACK_PATTERN_GENERAL, /**< feedback pattern when alert general event */
- FEEDBACK_PATTERN_GENERAL_ON_CALL, /**< feedback pattern when alert general event on call */
+ FEEDBACK_PATTERN_MESSAGE, /**< feedback pattern when incoming a message */
+ FEEDBACK_PATTERN_MESSAGE_ON_CALL, /**< feedback pattern when incoming a message on call */
+ FEEDBACK_PATTERN_EMAIL, /**< feedback pattern when incoming an email */
+ FEEDBACK_PATTERN_EMAIL_ON_CALL, /**< feedback pattern when incoming an email on call */
+ FEEDBACK_PATTERN_WAKEUP, /**< feedback pattern when alert wake up call */
+ FEEDBACK_PATTERN_WAKEUP_ON_CALL, /**< feedback pattern when alert wake up call on call */
+ FEEDBACK_PATTERN_SCHEDULE, /**< feedback pattern when alert schedule alarm */
+ FEEDBACK_PATTERN_SCHEDULE_ON_CALL, /**< feedback pattern when alert schedule alarm on call */
+ FEEDBACK_PATTERN_TIMER, /**< feedback pattern when alert timer */
+ FEEDBACK_PATTERN_TIMER_ON_CALL, /**< feedback pattern when alert timer on call */
+ FEEDBACK_PATTERN_GENERAL, /**< feedback pattern when alert general event */
+ FEEDBACK_PATTERN_GENERAL_ON_CALL, /**< feedback pattern when alert general event on call */
- FEEDBACK_PATTERN_POWER_ON, /**< feedback pattern when power on */
+ FEEDBACK_PATTERN_POWER_ON, /**< feedback pattern when power on */
FEEDBACK_PATTERN_POWER_OFF, /**< feedback pattern when power off */
FEEDBACK_PATTERN_CHARGERCONN, /**< feedback pattern when connecting charger */
FEEDBACK_PATTERN_CHARGERCONN_ON_CALL, /**< feedback pattern when connecting charger on call */
FEEDBACK_PATTERN_END,
};
-
-} // namespace Dali
+} // namespace Dali
#endif // DALI_FEEDBACK_IDS_H
#define DALI_INTERNAL_FEEDBACK_STYLE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <map>
-#include <dali/public-api/object/base-handle.h>
#include <dali/devel-api/adaptor-framework/feedback-player.h>
-#include <dali/public-api/signals/connection-tracker.h>
#include <dali/public-api/adaptor-framework/style-change.h>
+#include <dali/public-api/object/base-handle.h>
+#include <dali/public-api/signals/connection-tracker.h>
#include <dali/public-api/signals/slot-delegate.h>
+#include <map>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/feedback/feedback-ids.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
struct FeedbackStyleInfo;
struct SignalFeedbackInfo;
class FeedbackStyle : public ConnectionTracker
{
public:
-
/**
* Constructor.
*/
* Connects feedback to signals for the newly created object
* @param [in] object Handle to the newly created object
*/
- void ObjectCreated( BaseHandle object );
+ void ObjectCreated(BaseHandle object);
/**
* Style changed so reload the theme file
void StyleChanged(const std::string& userDefinedThemePath, StyleChange::Type styleChange);
private:
-
/**
* Helper to retrieve styleInfo from mStyleInfoLut
* @param type A string described a type of object
* @return The style information for the given object
*/
- const FeedbackStyleInfo& GetStyleInfo( const std::string& type) const;
+ const FeedbackStyleInfo& GetStyleInfo(const std::string& type) const;
/**
* Callback function for Dali::Toolkit::PushButton::SignalPressed signal
* @param [in] data A string represenation of the theme.
* @param [in] format The string representation format ie JSON.
*/
- void LoadFromString( const std::string& data );
+ void LoadFromString(const std::string& data);
/**
* Helper to store signal information.
* @param [in] styleInfo The information will be stored here.
* @param [in] signalInfo The information to add.
*/
- void AddSignalInfo( FeedbackStyleInfo& styleInfo, SignalFeedbackInfo&& signalInfo );
+ void AddSignalInfo(FeedbackStyleInfo& styleInfo, SignalFeedbackInfo&& signalInfo);
/**
* Map a pattern string to feedback pattern ID.
* @param [in] pattern The pattern string.
* @return A feedback pattern ID.
*/
- FeedbackPattern GetFeedbackPattern( const std::string& pattern );
+ FeedbackPattern GetFeedbackPattern(const std::string& pattern);
/**
* Plays a feedback effect
std::map<const std::string, FeedbackStyleInfo> mStyleInfoLut; ///< Converts key strings into style information
};
-} // namespace Toolkit
-
} // namespace Internal
+} // namespace Toolkit
+
} // namespace Dali
#endif // DALI_INTERNAL_FEEDBACK_STYLE_H
#define DALI_TOOLKIT_INTERNAL_BLUR_TWO_PASS_FILTER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/**
* A two pass blur filter, pass one performs a horizontal blur and pass two performs a
* vertical blur on the result of pass one.
void Refresh() override;
/// @copydoc Dali::Toolkit::Internal::ImageFilter::SetSize
- void SetSize( const Vector2& size ) override;
+ void SetSize(const Vector2& size) override;
/**
* Get the property index that controls the strength of the blur applied to the image. Useful for animating this property.
* This property represents a value in the range [0.0 - 1.0] where 0.0 is no blur and 1.0 is full blur.
*/
- Property::Index GetBlurStrengthPropertyIndex() const {return mBlurStrengthPropertyIndex;}
+ Property::Index GetBlurStrengthPropertyIndex() const
+ {
+ return mBlurStrengthPropertyIndex;
+ }
/**
* Retrieve the handle to the object in order to animate or constrain the blur strength property
Handle GetHandleForAnimateBlurStrength();
private:
-
/**
* Setup render tasks for blur
*/
void CreateRenderTasks();
private:
- BlurTwoPassFilter( const BlurTwoPassFilter& );
- BlurTwoPassFilter& operator=( const BlurTwoPassFilter& );
+ BlurTwoPassFilter(const BlurTwoPassFilter&);
+ BlurTwoPassFilter& operator=(const BlurTwoPassFilter&);
private: // Attributes
-
// To perform horizontal blur from mInputTexture to mFrameBufferForHorz
- RenderTask mRenderTaskForHorz;
- Actor mActorForInput;
- FrameBuffer mFrameBufferForHorz;
+ RenderTask mRenderTaskForHorz;
+ Actor mActorForInput;
+ FrameBuffer mFrameBufferForHorz;
// To perform vertical blur from mFrameBufferForHorz to mOutputFrameBuffer
- RenderTask mRenderTaskForVert;
- Actor mActorForHorz;
- FrameBuffer mBlurredFrameBuffer;
+ RenderTask mRenderTaskForVert;
+ Actor mActorForHorz;
+ FrameBuffer mBlurredFrameBuffer;
// To blend the blurred image and input image according to the blur strength
- RenderTask mRenderTaskForBlending;
- Actor mActorForBlending;
- Actor mRootActorForBlending;
- Property::Index mBlurStrengthPropertyIndex;
+ RenderTask mRenderTaskForBlending;
+ Actor mActorForBlending;
+ Actor mRootActorForBlending;
+ Property::Index mBlurStrengthPropertyIndex;
}; // class BlurTwoPassFilter
} // namespace Dali
#endif // DALI_TOOLKIT_INTERNAL_BLUR_TWO_PASS_FILTER_H
-
#define DALI_TOOLKIT_INTERNAL_EMBOSS_FILTER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/**
* An embossing image filter, implements Dali::Toolkit::Internal::ImageFilter
*/
void Refresh() override;
/// @copydoc Dali::Toolkit::Internal::ImageFilter::SetSize
- void SetSize( const Vector2& size ) override;
+ void SetSize(const Vector2& size) override;
private:
/**
void CreateRenderTasks();
private:
- EmbossFilter( const EmbossFilter& );
- EmbossFilter& operator=( const EmbossFilter& );
+ EmbossFilter(const EmbossFilter&);
+ EmbossFilter& operator=(const EmbossFilter&);
private: // Attributes
-
- RenderTask mRenderTaskForEmboss1;
- RenderTask mRenderTaskForEmboss2;
- RenderTask mRenderTaskForOutput;
- FrameBuffer mFrameBufferForEmboss1;
- FrameBuffer mFrameBufferForEmboss2;
- Actor mActorForInput1;
- Actor mActorForInput2;
- Renderer mRendererForEmboss1;
- Renderer mRendererForEmboss2;
- Actor mActorForComposite;
+ RenderTask mRenderTaskForEmboss1;
+ RenderTask mRenderTaskForEmboss2;
+ RenderTask mRenderTaskForOutput;
+ FrameBuffer mFrameBufferForEmboss1;
+ FrameBuffer mFrameBufferForEmboss2;
+ Actor mActorForInput1;
+ Actor mActorForInput2;
+ Renderer mRendererForEmboss1;
+ Renderer mRendererForEmboss2;
+ Actor mActorForComposite;
}; // class EmbossFilter
} // namespace Internal
} // namespace Dali
#endif // DALI_TOOLKIT_INTERNAL_EMBOSS_FILTER_H
-
#define DALI_TOOLKIT_INTERNAL_IMAGE_FILTER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/rendering/texture.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/devel-api/controls/effects-view/effects-view.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/**
* An interface class that provides a interface for image filters that perform
* a simple shader effect on an input texture, rendering the output to a FrameBuffer.
class ImageFilter
{
public:
- typedef std::vector< Vector3 > FilterKernel;
+ typedef std::vector<Vector3> FilterKernel;
public:
-
/**
* Default constructor
*/
/**
* @copydoc Dali::Toolkit::EffectsView::SetRefreshOnDemand
*/
- void SetRefreshOnDemand( bool onDemand );
+ void SetRefreshOnDemand(bool onDemand);
/**
* Set the input texture
* @param[in] The input/original texture.
*/
- void SetInputTexture( Texture texture );
+ void SetInputTexture(Texture texture);
/**
* Set the output frame buffer
* @return The output frame buffer.
*/
- void SetOutputFrameBuffer( FrameBuffer frameBuffer );
+ void SetOutputFrameBuffer(FrameBuffer frameBuffer);
/**
* Set size of ImageFilter. Used to create internal offscreen buffers
* @param[in] size THe size.
*/
- virtual void SetSize( const Vector2& size );
+ virtual void SetSize(const Vector2& size);
/**
* Set the pixel format for internal offscreen buffers
* @param[in] pixelFormat The pixel format.
*/
- void SetPixelFormat( Pixel::Format pixelFormat );
+ void SetPixelFormat(Pixel::Format pixelFormat);
/**
* Set the filter kernel
* @param[in] The filter kernel
*/
- void SetKernel( const FilterKernel& kernel );
+ void SetKernel(const FilterKernel& kernel);
/**
* Get a const reference to the internal filter kernel
* @param[in] weights
* @param[in] count
*/
- void CreateKernel( const float* weights, size_t count);
+ void CreateKernel(const float* weights, size_t count);
/**
* Set the actor which acts as the root actor for all internal actors for connection to stage
* @param[in] rootActor An actor which acts as the root actor for any internal actors that need
* to be created
*/
- void SetRootActor( Actor rootActor );
+ void SetRootActor(Actor rootActor);
/**
* Set the background / clear color
* @param[in] color The background / clear color
*/
- void SetBackgroundColor( const Vector4& color );
+ void SetBackgroundColor(const Vector4& color);
protected:
-
/**
* Setup position and parameters for camera
*/
void SetupCamera();
protected:
- Texture mInputTexture;
- FrameBuffer mOutputFrameBuffer;
- FilterKernel mKernel;
- Actor mRootActor;
- CameraActor mCameraActor;
- Vector4 mBackgroundColor;
- Vector2 mTargetSize;
- Pixel::Format mPixelFormat;
- bool mRefreshOnDemand;
+ Texture mInputTexture;
+ FrameBuffer mOutputFrameBuffer;
+ FilterKernel mKernel;
+ Actor mRootActor;
+ CameraActor mCameraActor;
+ Vector4 mBackgroundColor;
+ Vector2 mTargetSize;
+ Pixel::Format mPixelFormat;
+ bool mRefreshOnDemand;
}; // class Imagefilter
} // namespace Dali
#endif // DALI_TOOLKIT_INTERNAL_IMAGE_FILTER_H
-
#define DALI_TOOLKIT_INTERNAL_SPREAD_FILTER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/**
* A spread/thicken filter. Expands an image into transparent areas.
*/
* Set the amount of spread in pixels.
* @param[in] spread The amount of spread
*/
- void SetSpread( float spread );
+ void SetSpread(float spread);
public: // From ImageFilter
/// @copydoc Dali::Toolkit::Internal::ImageFilter::Enable
void Refresh() override;
/// @copydoc Dali::Toolkit::Internal::ImageFilter::SetSize
- void SetSize( const Vector2& size ) override;
+ void SetSize(const Vector2& size) override;
private:
-
/**
* Setup render tasks for blur
*/
void CreateRenderTasks();
private:
- SpreadFilter( const SpreadFilter& );
- SpreadFilter& operator=( const SpreadFilter& );
+ SpreadFilter(const SpreadFilter&);
+ SpreadFilter& operator=(const SpreadFilter&);
private: // Attributes
-
// To perform horizontal spread from mInputTexture to mFrameBufferForHorz
- RenderTask mRenderTaskForHorz;
- Actor mActorForInput;
- FrameBuffer mFrameBufferForHorz;
+ RenderTask mRenderTaskForHorz;
+ Actor mActorForInput;
+ FrameBuffer mFrameBufferForHorz;
// To perform vertical spread from mFrameBufferForHorz to mOutputFrameBuffer
- RenderTask mRenderTaskForVert;
- Actor mActorForHorz;
+ RenderTask mRenderTaskForVert;
+ Actor mActorForHorz;
- int mSpread;
+ int mSpread;
}; // class SpreadFilter
} // namespace Internal
} // namespace Dali
#endif // DALI_TOOLKIT_INTERNAL_SPREAD_FILTER_H
-
#define DALI_TOOLKIT_INTERNAL_KEYBOARD_FOCUS_MANAGER_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
+#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/object/base-object.h>
#include <dali/public-api/object/weak-handle.h>
-#include <dali/public-api/common/vector-wrapper.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
#include <dali-toolkit/devel-api/focus-manager/keyboard-focus-manager-devel.h>
+#include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
#include <dali/devel-api/adaptor-framework/window-devel.h>
namespace Dali
{
-
namespace Integration
{
-
class SceneHolder;
} // namespace Integration
namespace Toolkit
{
-
namespace Internal
{
-
/**
* @copydoc Toolkit::KeyboardFocusManager
*/
class KeyboardFocusManager : public Dali::BaseObject, public ConnectionTracker
{
public:
-
typedef Toolkit::DevelKeyboardFocusManager::CustomAlgorithmInterface CustomAlgorithmInterface;
enum FocusIndicatorState
{
- UNKNOWN = -1, ///< Unknown state
- HIDE = 0, ///< FocusIndicator is hidden
- SHOW = 1, ///< FocusIndicator is shown
+ UNKNOWN = -1, ///< Unknown state
+ HIDE = 0, ///< FocusIndicator is hidden
+ SHOW = 1, ///< FocusIndicator is shown
};
enum EnableFocusedIndicatorState
{
- DISABLE = 0, ///< FocusIndicator is disable
- ENABLE = 1, ///< FocusIndicator is enable
+ DISABLE = 0, ///< FocusIndicator is disable
+ ENABLE = 1, ///< FocusIndicator is enable
};
enum FocusedIndicatorModeState
{
- NONE = 0, ///< Set nothing
- ALWAYS_SHOW = 1, ///< FocusIndicator is always shown
+ NONE = 0, ///< Set nothing
+ ALWAYS_SHOW = 1, ///< FocusIndicator is always shown
};
/**
bool IsFocusIndicatorEnabled() const;
public:
-
/**
* @copydoc Toolkit::KeyboardFocusManager::PreFocusChangeSignal()
*/
* @return True if the signal was connected.
* @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
*/
- static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
+ static bool DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
protected:
-
/**
* Destructor
*/
virtual ~KeyboardFocusManager();
private:
-
- typedef std::vector< WeakHandle< Actor > > FocusStack; ///< Define Dali::Vector< Dali::BaseObject* > as FocusStack to contain focus history
- typedef FocusStack::iterator FocusStackIterator; ///< Define FocusStack::Iterator as FocusStackIterator to navigate FocusStack
+ typedef std::vector<WeakHandle<Actor> > FocusStack; ///< Define Dali::Vector< Dali::BaseObject* > as FocusStack to contain focus history
+ typedef FocusStack::iterator FocusStackIterator; ///< Define FocusStack::Iterator as FocusStackIterator to navigate FocusStack
/**
* This will be called when the adaptor is initialized
* This will be called when a new scene holder is created
* @param sceneHolder The new scene holder
*/
- void OnSceneHolderCreated( Dali::Integration::SceneHolder& sceneHolder );
+ void OnSceneHolderCreated(Dali::Integration::SceneHolder& sceneHolder);
/**
* Get configuration from StyleManager.
* This function will emit FocusedActorEnterKeySignal.
* @param actor The actor to notify
*/
- void DoKeyboardEnter( Actor actor );
+ void DoKeyboardEnter(Actor actor);
/**
* Check whether the actor is a layout control that supports two dimensional keyboard navigation.
* @param actor The actor to be checked for its parent layout control
* @return The parent layout control the given actor belongs to or an empty handle if the given actor doesn't belong to a layout control
*/
- Toolkit::Control GetParentLayoutControl(Actor actor) const;
+ Toolkit::Control GetParentLayoutControl(Actor actor) const;
/**
* Callback for the key event when no actor in the stage has gained the key input focus
* @param[in] event The KeyEvent event.
*/
- void OnKeyEvent( const KeyEvent& event );
+ void OnKeyEvent(const KeyEvent& event);
/**
* Callback for the touch event when the screen is touched and when the touch ends
* (i.e. the down & up touch events only).
* @param[in] touch The touch information
*/
- void OnTouch( const TouchEvent& touch );
+ void OnTouch(const TouchEvent& touch);
/**
* Called when the window focus is changed.
* @param[in] window The window whose focus is changed
* @param[in] focusIn Whether the focus is in/out
*/
- void OnWindowFocusChanged( Window window, bool focusIn );
+ void OnWindowFocusChanged(Window window, bool focusIn);
/**
* Get the focus Actor from current window
Actor GetFocusActorFromCurrentWindow();
private:
-
// Undefined
KeyboardFocusManager(const KeyboardFocusManager&);
KeyboardFocusManager& operator=(const KeyboardFocusManager& rhs);
private:
-
- Toolkit::KeyboardFocusManager::PreFocusChangeSignalType mPreFocusChangeSignal; ///< The signal to notify the focus will be changed
- Toolkit::KeyboardFocusManager::FocusChangedSignalType mFocusChangedSignal; ///< The signal to notify the focus change
- Toolkit::KeyboardFocusManager::FocusGroupChangedSignalType mFocusGroupChangedSignal; ///< The signal to notify the focus group change
+ Toolkit::KeyboardFocusManager::PreFocusChangeSignalType mPreFocusChangeSignal; ///< The signal to notify the focus will be changed
+ Toolkit::KeyboardFocusManager::FocusChangedSignalType mFocusChangedSignal; ///< The signal to notify the focus change
+ Toolkit::KeyboardFocusManager::FocusGroupChangedSignalType mFocusGroupChangedSignal; ///< The signal to notify the focus group change
Toolkit::KeyboardFocusManager::FocusedActorEnterKeySignalType mFocusedActorEnterKeySignal; ///< The signal to notify that enter has been pressed on the focused actor
- WeakHandle< Actor > mCurrentFocusActor; ///< A weak handle to the current focused actor
+ WeakHandle<Actor> mCurrentFocusActor; ///< A weak handle to the current focused actor
Actor mFocusIndicatorActor; ///< The focus indicator actor shared by all the keyboard focusable actors for highlight
FocusStack mFocusHistory; ///< Stack to contain pre-focused actor's BaseObject*
- SlotDelegate< KeyboardFocusManager > mSlotDelegate;
+ SlotDelegate<KeyboardFocusManager> mSlotDelegate;
CustomAlgorithmInterface* mCustomAlgorithmInterface; ///< The user's (application / toolkit) implementation of CustomAlgorithmInterface
- typedef std::vector< std::pair< WeakHandle< Layer >, WeakHandle< Actor > > > FocusActorContainer;
+ typedef std::vector<std::pair<WeakHandle<Layer>, WeakHandle<Actor> > > FocusActorContainer;
FocusActorContainer mCurrentFocusActors; ///< A container of focused actors
- WeakHandle< Layer > mCurrentFocusedWindow; ///< A weak handle to the current focused window's root layer
+ WeakHandle<Layer> mCurrentFocusedWindow; ///< A weak handle to the current focused window's root layer
FocusIndicatorState mIsFocusIndicatorShown; ///< Whether indicator should be shown / hidden when getting focus. It could be enabled when keyboard focus feature is enabled and navigation keys or 'Tab' key are pressed.
- EnableFocusedIndicatorState mEnableFocusIndicator; ///< Whether use focus indicator
+ EnableFocusedIndicatorState mEnableFocusIndicator; ///< Whether use focus indicator
FocusedIndicatorModeState mAlwaysShowIndicator; ///< Whether always show indicator. If true, the indicator would be directly shown when focused
- bool mFocusGroupLoopEnabled:1; ///< Whether the focus movement is looped within the same focus group
+ bool mFocusGroupLoopEnabled : 1; ///< Whether the focus movement is looped within the same focus group
- bool mIsWaitingKeyboardFocusChangeCommit:1; /// A flag to indicate PreFocusChangeSignal emitted but the proposed focus actor is not commited by the application yet.
+ bool mIsWaitingKeyboardFocusChangeCommit : 1; /// A flag to indicate PreFocusChangeSignal emitted but the proposed focus actor is not commited by the application yet.
- bool mClearFocusOnTouch:1; ///< Whether clear focus on touch.
+ bool mClearFocusOnTouch : 1; ///< Whether clear focus on touch.
};
} // namespace Internal
#define DALI_TOOLKIT_INTERNAL_KEYINPUT_FOCUS_MANAGER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <string>
#include <dali/public-api/object/base-object.h>
#include <dali/public-api/object/object-registry.h>
+#include <string>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
namespace Dali
{
-
namespace Integration
{
-
class SceneHolder;
} // namespace Integration
namespace Toolkit
{
-
namespace Internal
{
-
class KeyInputFocusManager;
/**
Toolkit::Control GetCurrentFocusControl() const;
public:
-
/**
* @copydoc Toolkit::KeyInputFocusManager::KeyInputFocusChangedSignal()
*/
* @return True if the signal was connected.
* @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
*/
- static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
+ static bool DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
protected:
-
/**
* Destructor
*/
* This will be called when a new scene holder is created
* @param sceneHolder The new scene holder
*/
- void OnSceneHolderCreated( Dali::Integration::SceneHolder& sceneHolder );
+ void OnSceneHolderCreated(Dali::Integration::SceneHolder& sceneHolder);
/**
* Callback for the key event when no actor in the stage has gained the key input focus
* Signal handler called when a focused Control is removed from Scene.
* @param[in] control The control removed from the scene.
*/
- void OnFocusControlSceneDisconnection( Dali::Actor control );
+ void OnFocusControlSceneDisconnection(Dali::Actor control);
/**
* Recursively deliver events to the control and its parents, until the event is consumed or the stage is reached.
* @param[in] event The KeyEvent.
* @return True if KeyEvent is consumed.
*/
- bool EmitKeyEventSignal( Toolkit::Control control, const KeyEvent& event );
+ bool EmitKeyEventSignal(Toolkit::Control control, const KeyEvent& event);
private:
-
// Undefined
KeyInputFocusManager(const KeyInputFocusManager&);
KeyInputFocusManager& operator=(const KeyInputFocusManager& rhs);
private:
-
// The key input focus change signal
Toolkit::KeyInputFocusManager::KeyInputFocusChangedSignalType mKeyInputFocusChangedSignal;
- SlotDelegate< KeyInputFocusManager > mSlotDelegate;
+ SlotDelegate<KeyInputFocusManager> mSlotDelegate;
Toolkit::Control mCurrentFocusControl; ///< The current focused control
};
#define DALI_TOOLKIT_INTERNAL_COLOR_CONVERSION_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <string>
#include <dali/public-api/object/property.h>
+#include <string>
namespace Dali
{
-
struct Vector4;
namespace Toolkit
{
namespace Internal
{
-
/*
* @brief Convert the string representation of a color into a Vector4.
*
* @param[out] outColor The color if found.
* @return True if the conversion was successful.
*/
-bool ConvertStringToColor( const std::string& colorString, Vector4& outColor );
+bool ConvertStringToColor(const std::string& colorString, Vector4& outColor);
/*
* @brief Convert a variety of different color representations into a Vector4.
* @param[out] outColor The color if found.
* @return True if the conversion was successful.
*/
-bool ConvertPropertyToColor( const Property::Value& colorValue, Vector4& outColor );
-
-} // Internal
-} // Toolkit
-} // Dali
+bool ConvertPropertyToColor(const Property::Value& colorValue, Vector4& outColor);
+} // namespace Internal
+} // namespace Toolkit
+} // namespace Dali
#endif // DALI_TOOLKIT_INTERNAL_COLOR_CONVERSION_H
#define DALI_TOOLKIT_INTERNAL_PROPERTY_HELPER_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <string>
#include <dali/public-api/object/property.h>
+#include <string>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/**
* @brief Parses a Property::Value to retrieve the string.
*
*
* @return True if a string was extracted successfully.
*/
-bool GetStringFromProperty( const Property::Value& value, std::string& output );
+bool GetStringFromProperty(const Property::Value& value, std::string& output);
} // namespace Internal
} // namespace Dali
-
#endif // DALI_TOOLKIT_INTERNAL_PROPERTY_HELPER_H
#define DALI_TOOLKIT_INTERNAL_ROUND_ROBIN_CONTAINER_VIEW_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/**
* @brief RoundRobinContainerView is a view to a container that allows iterating through the elements cyclically.
*/
// default members
~RoundRobinContainerView() = default;
- RoundRobinContainerView(const RoundRobinContainerView&) = delete;
- RoundRobinContainerView& operator=(const RoundRobinContainerView&) = delete;
- RoundRobinContainerView(RoundRobinContainerView&&) = default;
+ RoundRobinContainerView(const RoundRobinContainerView&) = delete;
+ RoundRobinContainerView& operator=(const RoundRobinContainerView&) = delete;
+ RoundRobinContainerView(RoundRobinContainerView&&) = default;
RoundRobinContainerView& operator=(RoundRobinContainerView&&) = default;
private:
}
private:
- ContainerType mElements; //< container of elements
- size_t mNextIndex; //< index to the next element to be viewed
+ ContainerType mElements; //< container of elements
+ size_t mNextIndex; //< index to the next element to be viewed
};
} // namespace Internal
} // namespace Dali
-
#endif // DALI_TOOLKIT_INTERNAL_ROUND_ROBIN_CONTAINER_VIEW_H
#define DALI_TOOLKIT_ASYNC_IMAGE_LOADER_IMPL_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/object/base-object.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/image-loader/async-image-loader.h>
#include <dali-toolkit/devel-api/image-loader/async-image-loader-devel.h>
#include <dali-toolkit/internal/image-loader/image-load-thread.h>
+#include <dali-toolkit/public-api/image-loader/async-image-loader.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class AsyncImageLoader : public BaseObject
{
public:
-
/**
* Constructor
*/
/**
* @copydoc Toolkit::AsyncImageLoader::LoadAnimatedImage( Dali::AnimatedImageLoading animatedImageLoading, uint32_t frameIndex )
*/
- uint32_t LoadAnimatedImage( Dali::AnimatedImageLoading animatedImageLoading,
- uint32_t frameIndex );
+ uint32_t LoadAnimatedImage(Dali::AnimatedImageLoading animatedImageLoading,
+ uint32_t frameIndex);
/**
* @copydoc Toolkit::AsyncImageLoader::Load( const std::string&, ImageDimensions, FittingMode::Type, SamplingMode::Type, bool , DevelAsyncImageLoader::PreMultiplyOnLoad )
*/
- uint32_t Load( const VisualUrl& url,
- ImageDimensions dimensions,
- FittingMode::Type fittingMode,
- SamplingMode::Type samplingMode,
- bool orientationCorrection,
- DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad );
+ uint32_t Load(const VisualUrl& url,
+ ImageDimensions dimensions,
+ FittingMode::Type fittingMode,
+ SamplingMode::Type samplingMode,
+ bool orientationCorrection,
+ DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad);
/**
* @brief Starts an mask applying task.
* @param[in] preMultiplyOnLoad ON if the image color should be multiplied by it's alpha. Set to OFF if there is no alpha.
* @return The loading task id
*/
- uint32_t ApplyMask( Devel::PixelBuffer pixelBuffer,
- Devel::PixelBuffer maskPixelBuffer,
- float contentScale,
- bool cropToMask,
- DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad );
+ uint32_t ApplyMask(Devel::PixelBuffer pixelBuffer,
+ Devel::PixelBuffer maskPixelBuffer,
+ float contentScale,
+ bool cropToMask,
+ DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad);
/**
* @copydoc Toolkit::AsyncImageLoader::ImageLoadedSignal
/**
* @copydoc Toolkit::AsyncImageLoader::Cancel
*/
- bool Cancel( uint32_t loadingTaskId );
+ bool Cancel(uint32_t loadingTaskId);
/**
* @copydoc Toolkit::AsyncImageLoader::CancelAll
void ProcessLoadedImage();
protected:
-
/**
* Destructor
*/
~AsyncImageLoader() override;
private:
- Toolkit::AsyncImageLoader::ImageLoadedSignalType mLoadedSignal;
+ Toolkit::AsyncImageLoader::ImageLoadedSignalType mLoadedSignal;
Toolkit::DevelAsyncImageLoader::PixelBufferLoadedSignalType mPixelBufferLoadedSignal;
ImageLoadThread mLoadThread;
} // namespace Internal
-inline const Internal::AsyncImageLoader& GetImplementation( const Toolkit::AsyncImageLoader& handle )
+inline const Internal::AsyncImageLoader& GetImplementation(const Toolkit::AsyncImageLoader& handle)
{
- DALI_ASSERT_ALWAYS( handle && "AsyncImageLoader handle is empty" );
+ DALI_ASSERT_ALWAYS(handle && "AsyncImageLoader handle is empty");
const BaseObject& object = handle.GetBaseObject();
- return static_cast<const Internal::AsyncImageLoader&>( object );
+ return static_cast<const Internal::AsyncImageLoader&>(object);
}
-inline Internal::AsyncImageLoader& GetImplementation( Toolkit::AsyncImageLoader& handle )
+inline Internal::AsyncImageLoader& GetImplementation(Toolkit::AsyncImageLoader& handle)
{
- DALI_ASSERT_ALWAYS( handle && "AsyncImageLoader handle is empty" );
+ DALI_ASSERT_ALWAYS(handle && "AsyncImageLoader handle is empty");
BaseObject& object = handle.GetBaseObject();
- return static_cast<Internal::AsyncImageLoader&>( object );
+ return static_cast<Internal::AsyncImageLoader&>(object);
}
} // namespace Toolkit
#define DALI_TOOLKIT_ATLAS_PACKER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
-#include <stdint.h>
#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/math/rect.h>
#include <dali/public-api/math/uint-16-pair.h>
+#include <stdint.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/**
* Binary space tree based bin packing algorithm.
* It is initialised with a fixed width and height and will fit each block into the first node where it fits
class AtlasPacker
{
public:
-
/**
* rectangular area (x,y,width,height)
*/
- typedef uint32_t SizeType;
+ typedef uint32_t SizeType;
typedef Rect<SizeType> RectArea;
/**
*/
struct Node
{
- Node( Node* parent, SizeType x, SizeType y, SizeType width, SizeType height );
+ Node(Node* parent, SizeType x, SizeType y, SizeType width, SizeType height);
RectArea rectArea;
- Node* parent;
- Node* child[2];
- bool occupied;
+ Node* parent;
+ Node* child[2];
+ bool occupied;
};
/**
* @param[in] atlasWidth The width of the atlas.
* @param[in] atlasHeight The height of the atlas.
*/
- AtlasPacker( SizeType atlasWidth, SizeType atlasHeight );
+ AtlasPacker(SizeType atlasWidth, SizeType atlasHeight);
/**
* Destructor
* @param[out] packPositionY The y coordinate of the position to pack the block.
* @return True if there are room for this block, false otherwise.
*/
- bool Pack( SizeType blockWidth, SizeType blockHeight,
- SizeType& packPositionX, SizeType& packPositionY);
+ bool Pack(SizeType blockWidth, SizeType blockHeight, SizeType& packPositionX, SizeType& packPositionY);
/**
* Delete the block.
* @param[in] blockWidth The width of the block to delete.
* @param[in] blockHeight The height of the block to delete.
*/
- void DeleteBlock( SizeType packPositionX, SizeType packPositionY, SizeType blockWidth, SizeType blockHeight );
+ void DeleteBlock(SizeType packPositionX, SizeType packPositionY, SizeType blockWidth, SizeType blockHeight);
/**
* Query how much empty space left.
* @param[out] packPositions The packing position of each block.
* @return The required size to accommodate all the blocks.
*/
- static Uint16Pair GroupPack( const Dali::Vector<Uint16Pair>& blockSizes, Dali::Vector<Uint16Pair>& packPositions );
+ static Uint16Pair GroupPack(const Dali::Vector<Uint16Pair>& blockSizes, Dali::Vector<Uint16Pair>& packPositions);
private:
-
/*
* Search the node which can pack the block with given size.
*
* @return The poniter pointing to node that can pack the block.
* If it is NULL, there are no room in the subtree to pack the block.
*/
- Node* InsertNode( Node* root, SizeType blockWidth, SizeType blockHeight );
+ Node* InsertNode(Node* root, SizeType blockWidth, SizeType blockHeight);
/**
* Split the node into two to fit the block width/size.
* @param[in] blockWidth The width of the block to pack.
* @param[in] blockHeight The height of the block to pack.
*/
- void SplitNode( Node* node, SizeType blockWidth, SizeType blockHeight );
+ void SplitNode(Node* node, SizeType blockWidth, SizeType blockHeight);
/**
* Search the node at the given position and with the given size.
* @param[in] blockWidth The width of the block.
* @param[in] blockHeight The height of the block.
*/
- Node* SearchNode( Node* node, SizeType packPositionX, SizeType packPositionY, SizeType blockWidth, SizeType blockHeight );
+ Node* SearchNode(Node* node, SizeType packPositionX, SizeType packPositionY, SizeType blockWidth, SizeType blockHeight);
/**
* Merge the rect of the node to non-occupied area.
*
* @param[in] node The node to me merged to the non-occupied area
*/
- void MergeToNonOccupied( Node* node );
+ void MergeToNonOccupied(Node* node);
/**
* Delete a node and its subtree.
*
* @parm[in] node The node to delete.
*/
- void DeleteNode( Node* node );
+ void DeleteNode(Node* node);
/**
* Pack a block into the atlas. If there is no enough room, grow the partition tree.
* @param[out] packPositionX The x coordinate of the position to pack the block.
* @param[out] packPositionY The y coordinate of the position to pack the block.
*/
- void GrowPack( SizeType blockWidth, SizeType blockHeight,
- SizeType& packPositionX, SizeType& packPositionY );
+ void GrowPack(SizeType blockWidth, SizeType blockHeight, SizeType& packPositionX, SizeType& packPositionY);
/**
* Add extra node into the partition tree to accommodate the given block.
* @param[in] blockWidth The width of the block to pack.
* @param[in] blockHeight The height of the block to pack.
*/
- void GrowNode( SizeType blockWidth, SizeType blockHeight );
+ void GrowNode(SizeType blockWidth, SizeType blockHeight);
// Undefined
- AtlasPacker( const AtlasPacker& atlasPacker);
+ AtlasPacker(const AtlasPacker& atlasPacker);
// Undefined
- AtlasPacker& operator=( const AtlasPacker& atlasPacker );
+ AtlasPacker& operator=(const AtlasPacker& atlasPacker);
private:
-
- Node* mRoot; ///< The root of the binary space tree
+ Node* mRoot; ///< The root of the binary space tree
unsigned int mAvailableArea;
-
};
-
} // namespace Internal
} // namespace Toolkit
#define DALI_TOOLKIT_IMAGE_ATLAS_IMPL_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
+#include <dali/devel-api/common/owner-container.h>
#include <dali/public-api/common/intrusive-ptr.h>
#include <dali/public-api/object/base-object.h>
#include <dali/public-api/signals/connection-tracker.h>
-#include <dali/devel-api/common/owner-container.h>
-#include <dali/devel-api/common/owner-container.h>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/image-loader/image-atlas.h>
namespace Toolkit
{
-
namespace Internal
{
-
class ImageAtlas : public BaseObject, public ConnectionTracker
{
public:
-
typedef Toolkit::ImageAtlas::SizeType SizeType;
/**
* @copydoc ImageAtlas::PackToAtlas( const std::vector<PixelData>&, Dali::Vector<Vector4>& )
*/
- static Texture PackToAtlas( const std::vector<PixelData>& pixelData, Dali::Vector<Vector4>& textureRects );
+ static Texture PackToAtlas(const std::vector<PixelData>& pixelData, Dali::Vector<Vector4>& textureRects);
/**
* Constructor
* @param [in] height The atlas height in pixels.
* @param [in] pixelFormat The pixel format.
*/
- ImageAtlas( SizeType width, SizeType height, Pixel::Format pixelFormat );
+ ImageAtlas(SizeType width, SizeType height, Pixel::Format pixelFormat);
/**
* @copydoc Toolkit::ImageAtlas::New
*/
- static IntrusivePtr<ImageAtlas> New( SizeType width, SizeType height, Pixel::Format pixelFormat );
+ static IntrusivePtr<ImageAtlas> New(SizeType width, SizeType height, Pixel::Format pixelFormat);
/**
* @copydoc Toolkit::ImageAtlas::GetAtlas
/**
* @copydoc Toolkit::ImageAtlas::SetBrokenImage
*/
- void SetBrokenImage( const std::string& brokenImageUrl );
+ void SetBrokenImage(const std::string& brokenImageUrl);
/**
* @copydoc Toolkit::ImageAtlas::Upload( Vector4&, const std::string&, ImageDimensions,FittingMode::Type, bool )
*/
- bool Upload( Vector4& textureRect,
- const std::string& url,
- ImageDimensions size,
- FittingMode::Type fittingMode,
- bool orientationCorrection,
- AtlasUploadObserver* atlasUploadObserver );
+ bool Upload(Vector4& textureRect,
+ const std::string& url,
+ ImageDimensions size,
+ FittingMode::Type fittingMode,
+ bool orientationCorrection,
+ AtlasUploadObserver* atlasUploadObserver);
/**
* @copydoc Toolkit::ImageAtlas::Upload( Vector4&, PixelData )
*/
- bool Upload( Vector4& textureRect, PixelData pixelData );
+ bool Upload(Vector4& textureRect, PixelData pixelData);
/**
* @copydoc Toolkit::ImageAtlas::Remove
*/
- void Remove( const Vector4& textureRect );
+ void Remove(const Vector4& textureRect);
/**
* Resets the destroying observer pointer so that we know not to call methods of this object any more.
*/
- void ObserverDestroyed( AtlasUploadObserver* observer );
+ void ObserverDestroyed(AtlasUploadObserver* observer);
protected:
-
/**
* Destructor
*/
~ImageAtlas();
private:
-
/**
* @copydoc PixelDataRequester::ProcessPixels
*/
- void UploadToAtlas( uint32_t id, PixelData pixelData );
+ void UploadToAtlas(uint32_t id, PixelData pixelData);
/**
* Upload broken image
*
* @param[in] area The pixel area for uploading.
*/
- void UploadBrokenImage( const Rect<unsigned int>& area );
+ void UploadBrokenImage(const Rect<unsigned int>& area);
// Undefined
- ImageAtlas( const ImageAtlas& imageAtlas);
+ ImageAtlas(const ImageAtlas& imageAtlas);
// Undefined
- ImageAtlas& operator=( const ImageAtlas& imageAtlas );
+ ImageAtlas& operator=(const ImageAtlas& imageAtlas);
private:
-
/**
* Each loading task( identified with an ID ) is associated with a rect region for packing the loaded pixel data into the atlas,
* and an AtlasUploadObserver whose UploadCompleted method should get executed once the sub texture is ready.
*/
struct LoadingTaskInfo
{
- LoadingTaskInfo( unsigned short loadTaskId,
- unsigned int packPositionX,
- unsigned int packPositionY,
- unsigned int width,
- unsigned int height,
- AtlasUploadObserver* observer )
- : loadTaskId( loadTaskId ),
- packRect( packPositionX, packPositionY, width, height ),
- observer( observer )
- {}
-
- unsigned short loadTaskId;
- Rect<unsigned int> packRect;
+ LoadingTaskInfo(unsigned short loadTaskId,
+ unsigned int packPositionX,
+ unsigned int packPositionY,
+ unsigned int width,
+ unsigned int height,
+ AtlasUploadObserver* observer)
+ : loadTaskId(loadTaskId),
+ packRect(packPositionX, packPositionY, width, height),
+ observer(observer)
+ {
+ }
+
+ unsigned short loadTaskId;
+ Rect<unsigned int> packRect;
AtlasUploadObserver* observer;
};
float mWidth;
float mHeight;
Pixel::Format mPixelFormat;
-
-
};
} // namespace Internal
-inline const Internal::ImageAtlas& GetImplementation( const Toolkit::ImageAtlas& imageAtlas )
+inline const Internal::ImageAtlas& GetImplementation(const Toolkit::ImageAtlas& imageAtlas)
{
- DALI_ASSERT_ALWAYS( imageAtlas && "ImageAtlas handle is empty" );
+ DALI_ASSERT_ALWAYS(imageAtlas && "ImageAtlas handle is empty");
const BaseObject& handle = imageAtlas.GetBaseObject();
return static_cast<const Internal::ImageAtlas&>(handle);
}
-inline Internal::ImageAtlas& GetImplementation( Toolkit::ImageAtlas& imageAtlas )
+inline Internal::ImageAtlas& GetImplementation(Toolkit::ImageAtlas& imageAtlas)
{
- DALI_ASSERT_ALWAYS( imageAtlas && "ImageAtlas handle is empty" );
+ DALI_ASSERT_ALWAYS(imageAtlas && "ImageAtlas handle is empty");
BaseObject& handle = imageAtlas.GetBaseObject();
#define DALI_TOOLKIT_IMAGE_LOAD_THREAD_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/common/dali-vector.h>
-#include <dali/public-api/object/ref-object.h>
-#include <dali/public-api/images/image-operations.h>
+#include <dali-toolkit/devel-api/image-loader/async-image-loader-devel.h>
+#include <dali-toolkit/internal/visuals/visual-url.h>
+#include <dali/devel-api/adaptor-framework/event-thread-callback.h>
+#include <dali/devel-api/adaptor-framework/pixel-buffer.h>
#include <dali/devel-api/threading/conditional-wait.h>
#include <dali/devel-api/threading/mutex.h>
#include <dali/devel-api/threading/thread.h>
-#include <dali/devel-api/adaptor-framework/event-thread-callback.h>
-#include <dali/devel-api/adaptor-framework/pixel-buffer.h>
-#include <dali-toolkit/internal/visuals/visual-url.h>
-#include <dali-toolkit/devel-api/image-loader/async-image-loader-devel.h>
#include <dali/integration-api/adaptor-framework/log-factory-interface.h>
+#include <dali/public-api/common/dali-vector.h>
+#include <dali/public-api/images/image-operations.h>
+#include <dali/public-api/object/ref-object.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/**
* The task of loading and packing an image into the atlas.
*/
* @param [in] animatedImageLoading The AnimatedImageLoading to load animated image
* @param [in] frameIndex The frame index of a frame to be loaded frame
*/
- LoadingTask( uint32_t id,
- Dali::AnimatedImageLoading animatedImageLoading,
- uint32_t frameIndex );
+ LoadingTask(uint32_t id,
+ Dali::AnimatedImageLoading animatedImageLoading,
+ uint32_t frameIndex);
/**
* Constructor.
* @param [in] orientationCorrection Reorient the image to respect any orientation metadata in its header.
* @param [in] preMultiplyOnLoad ON if the image's color should be multiplied by it's alpha. Set to OFF if there is no alpha or if the image need to be applied alpha mask.
*/
- LoadingTask( uint32_t id,
- const VisualUrl& url,
- ImageDimensions dimensions,
- FittingMode::Type fittingMode,
- SamplingMode::Type samplingMode,
- bool orientationCorrection,
- DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad );
+ LoadingTask(uint32_t id,
+ const VisualUrl& url,
+ ImageDimensions dimensions,
+ FittingMode::Type fittingMode,
+ SamplingMode::Type samplingMode,
+ bool orientationCorrection,
+ DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad);
/**
* Constructor.
* @param [in] cropToMask Whether to crop the content to the mask size
* @param [in] preMultiplyOnLoad ON if the image's color should be multiplied by it's alpha. Set to OFF if there is no alpha.
*/
- LoadingTask( uint32_t id,
- Devel::PixelBuffer pixelBuffer,
- Devel::PixelBuffer maskPixelBuffer,
- float contentScale,
- bool cropToMask,
- DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad );
+ LoadingTask(uint32_t id,
+ Devel::PixelBuffer pixelBuffer,
+ Devel::PixelBuffer maskPixelBuffer,
+ float contentScale,
+ bool cropToMask,
+ DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad);
/**
* Load the image
void MultiplyAlpha();
private:
-
// Undefined
- LoadingTask( const LoadingTask& queue );
+ LoadingTask(const LoadingTask& queue);
// Undefined
- LoadingTask& operator=( const LoadingTask& queue );
+ LoadingTask& operator=(const LoadingTask& queue);
public:
-
- Devel::PixelBuffer pixelBuffer; ///< pixelBuffer handle after successful load
- ///< or pixelBuffer to be masked image in the mask task
- VisualUrl url; ///< url of the image to load
- uint32_t id; ///< The unique id associated with this task.
- ImageDimensions dimensions; ///< dimensions to load
- FittingMode::Type fittingMode; ///< fitting options
- SamplingMode::Type samplingMode; ///< sampling options
- bool orientationCorrection:1; ///< if orientation correction is needed
- DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad; //< if the image's color should be multiplied by it's alpha
-
- bool isMaskTask; ///< whether this task is for mask or not
- Devel::PixelBuffer maskPixelBuffer; ///< pixelBuffer of mask image
- float contentScale; ///< The factor to scale the content
- bool cropToMask; ///< Whether to crop the content to the mask size
+ Devel::PixelBuffer pixelBuffer; ///< pixelBuffer handle after successful load
+ ///< or pixelBuffer to be masked image in the mask task
+ VisualUrl url; ///< url of the image to load
+ uint32_t id; ///< The unique id associated with this task.
+ ImageDimensions dimensions; ///< dimensions to load
+ FittingMode::Type fittingMode; ///< fitting options
+ SamplingMode::Type samplingMode; ///< sampling options
+ bool orientationCorrection : 1; ///< if orientation correction is needed
+ DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad; //< if the image's color should be multiplied by it's alpha
+
+ bool isMaskTask; ///< whether this task is for mask or not
+ Devel::PixelBuffer maskPixelBuffer; ///< pixelBuffer of mask image
+ float contentScale; ///< The factor to scale the content
+ bool cropToMask; ///< Whether to crop the content to the mask size
Dali::AnimatedImageLoading animatedImageLoading;
- uint32_t frameIndex;
+ uint32_t frameIndex;
};
-
/**
* The worker thread for image loading.
*/
class ImageLoadThread : public Thread
{
public:
-
/**
* Constructor.
*
* @param[in] mTrigger The trigger to wake up the main thread.
*/
- ImageLoadThread( EventThreadCallback* mTrigger );
+ ImageLoadThread(EventThreadCallback* mTrigger);
/**
* Destructor.
*
* @note This class takes ownership of the task object
*/
- void AddTask( LoadingTask* task );
+ void AddTask(LoadingTask* task);
/**
* Pop the next task out from the completed queue.
/**
* Remove the loading task from the waiting queue.
*/
- bool CancelTask( uint32_t loadingTaskId );
+ bool CancelTask(uint32_t loadingTaskId);
/**
* Remove all the loading tasks in the waiting queue.
void CancelAll();
private:
-
/**
* Pop the next loading task out from the queue to process.
*
*
* @param[in] task The task added to the queue.
*/
- void AddCompletedTask( LoadingTask* task );
+ void AddCompletedTask(LoadingTask* task);
protected:
-
/**
* The entry function of the worker thread.
* It fetches loading task from the loadQueue, loads the image and adds to the completeQueue.
void Run() override;
private:
-
// Undefined
- ImageLoadThread( const ImageLoadThread& thread );
+ ImageLoadThread(const ImageLoadThread& thread);
// Undefined
- ImageLoadThread& operator=( const ImageLoadThread& thread );
+ ImageLoadThread& operator=(const ImageLoadThread& thread);
private:
-
- Vector< LoadingTask* > mLoadQueue; ///<The task queue with images for loading.
- Vector< LoadingTask* > mCompleteQueue; ///<The task queue with images loaded.
- EventThreadCallback* mTrigger;
+ Vector<LoadingTask*> mLoadQueue; ///<The task queue with images for loading.
+ Vector<LoadingTask*> mCompleteQueue; ///<The task queue with images loaded.
+ EventThreadCallback* mTrigger;
const Dali::LogFactoryInterface& mLogFactory; ///< The log factory
- ConditionalWait mConditionalWait;
- Dali::Mutex mMutex;
+ ConditionalWait mConditionalWait;
+ Dali::Mutex mMutex;
};
} // namespace Internal
#define DALI_TOOLKIT_INTERNAL_STYLE_MANAGER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <string>
-#include <dali/public-api/common/vector-wrapper.h>
-#include <dali/devel-api/common/map-wrapper.h>
#include <dali/devel-api/adaptor-framework/style-monitor.h>
+#include <dali/devel-api/common/map-wrapper.h>
+#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/object/base-object.h>
#include <dali/public-api/object/property-map.h>
#include <dali/public-api/signals/connection-tracker.h>
+#include <string>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/styling/style-manager.h>
#include <dali-toolkit/devel-api/builder/builder.h>
#include <dali-toolkit/internal/builder/style.h>
+#include <dali-toolkit/public-api/styling/style-manager.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class FeedbackStyle;
/**
virtual ~StyleManager();
public: // Public API
-
/**
* @copydoc Toolkit::StyleManager::ApplyTheme
*/
- void ApplyTheme( const std::string& themeFile );
+ void ApplyTheme(const std::string& themeFile);
/**
* @copydoc Toolkit::StyleManager::ApplyDefaultTheme
/**
* @copydoc Toolkit::StyleManager::SetStyleConstant
*/
- void SetStyleConstant( const std::string& key, const Property::Value& value );
+ void SetStyleConstant(const std::string& key, const Property::Value& value);
/**
* @copydoc Toolkit::StyleManager::GetStyleConstant
*/
- bool GetStyleConstant( const std::string& key, Property::Value& valueOut );
+ bool GetStyleConstant(const std::string& key, Property::Value& valueOut);
/**
* @copydoc Toolkit::StyleManager::GetConfigurations
*
* @param[in] control The control to apply style.
*/
- void ApplyThemeStyle( Toolkit::Control control );
+ void ApplyThemeStyle(Toolkit::Control control);
/**
* @brief Apply the theme style to a control at initialization.
*
* @param[in] control The control to apply style.
*/
- void ApplyThemeStyleAtInit( Toolkit::Control control );
+ void ApplyThemeStyleAtInit(Toolkit::Control control);
/**
* @copydoc Toolkit::StyleManager::ApplyStyle
*/
- void ApplyStyle( Toolkit::Control control, const std::string& jsonFileName, const std::string& styleName );
+ void ApplyStyle(Toolkit::Control control, const std::string& jsonFileName, const std::string& styleName);
/**
* Get the state/style information for the given control
* @param[in] control The control to get state information for
* @return The style information (or empty ptr if not found)
*/
- const StylePtr GetRecordedStyle( Toolkit::Control control );
+ const StylePtr GetRecordedStyle(Toolkit::Control control);
public:
// SIGNALS
* @brief Set the current theme. Called only once per event processing cycle.
* @param[in] themeFile The name of the theme file to read.
*/
- void SetTheme( const std::string& themeFile );
+ void SetTheme(const std::string& themeFile);
/**
* @brief Internal helper method to read a file from file system.
*
* @return Return the newly created builder
*/
- Toolkit::Builder CreateBuilder( const Property::Map& constants );
+ Toolkit::Builder CreateBuilder(const Property::Map& constants);
/**
* @brief Load a JSON file into given builder
* @param[in] jsonFileName The name of the JSON file to load
* @return Return true if file was loaded
*/
- bool LoadJSON( Toolkit::Builder builder, const std::string& jsonFileName );
+ bool LoadJSON(Toolkit::Builder builder, const std::string& jsonFileName);
/**
* @brief Apply a style to the control using the given builder
* @param[in] builder The builder to apply the style from
* @param[in] control The control to apply the style to
*/
- void ApplyStyle( Toolkit::Builder builder, Toolkit::Control control );
+ void ApplyStyle(Toolkit::Builder builder, Toolkit::Control control);
/**
* Search for a builder in the cache
* @param[in] key The key the builder was cached under
* @return Return the cached builder if found or an empty builder object if not found
*/
- Toolkit::Builder FindCachedBuilder( const std::string& key );
+ Toolkit::Builder FindCachedBuilder(const std::string& key);
/**
* Store a given builder in the cache keyed to the given key
* @param[in] builder The builder object to store
* @param[in] key The key to store the builder under
*/
- void CacheBuilder( Toolkit::Builder builder, const std::string& key );
+ void CacheBuilder(Toolkit::Builder builder, const std::string& key);
/**
* Callback for when style monitor raises a signal
* @param[in] styleMonitor The style monitor object
* @param[in] styleChange The style change type
*/
- void StyleMonitorChange( StyleMonitor styleMonitor, StyleChange::Type styleChange );
+ void StyleMonitorChange(StyleMonitor styleMonitor, StyleChange::Type styleChange);
/**
* Emit signals to controls first, app second
*/
- void EmitStyleChangeSignals( StyleChange::Type styleChange );
-
+ void EmitStyleChangeSignals(StyleChange::Type styleChange);
// Undefined
StyleManager(const StyleManager&);
StyleManager& operator=(const StyleManager& rhs);
private:
-
// Map to store builders keyed by JSON file name
- typedef std::map< std::string, Toolkit::Builder > BuilderMap;
+ typedef std::map<std::string, Toolkit::Builder> BuilderMap;
- Toolkit::Builder mThemeBuilder; ///< Builder for all default theme properties
- StyleMonitor mStyleMonitor; ///< Style monitor handle
+ Toolkit::Builder mThemeBuilder; ///< Builder for all default theme properties
+ StyleMonitor mStyleMonitor; ///< Style monitor handle
- int mDefaultFontSize; ///< Logical size, not a point-size
+ int mDefaultFontSize; ///< Logical size, not a point-size
std::string mDefaultFontFamily;
- std::string mDefaultThemeFilePath; ///< The full path of the default theme file
- std::string mThemeFile; ///< The full path of the current theme file
+ std::string mDefaultThemeFilePath; ///< The full path of the default theme file
+ std::string mThemeFile; ///< The full path of the current theme file
- Property::Map mThemeBuilderConstants; ///< Contants to give the theme builder
- Property::Map mStyleBuilderConstants; ///< Constants specific to building styles
+ Property::Map mThemeBuilderConstants; ///< Contants to give the theme builder
+ Property::Map mStyleBuilderConstants; ///< Constants specific to building styles
- BuilderMap mBuilderCache; ///< Cache of builders keyed by JSON file name
+ BuilderMap mBuilderCache; ///< Cache of builders keyed by JSON file name
Toolkit::Internal::FeedbackStyle* mFeedbackStyle; ///< Feedback style
// Signals
Toolkit::StyleManager::StyleChangedSignalType mControlStyleChangeSignal; ///< Emitted when the style( theme/font ) changes for the controls to style themselves
- Toolkit::StyleManager::StyleChangedSignalType mStyleChangedSignal; ///< Emitted after the controls have been styled
+ Toolkit::StyleManager::StyleChangedSignalType mStyleChangedSignal; ///< Emitted after the controls have been styled
};
} // namespace Internal
-inline Internal::StyleManager& GetImpl( Dali::Toolkit::StyleManager& obj )
+inline Internal::StyleManager& GetImpl(Dali::Toolkit::StyleManager& obj)
{
- DALI_ASSERT_ALWAYS( obj );
+ DALI_ASSERT_ALWAYS(obj);
Dali::BaseObject& handle = obj.GetBaseObject();
- return static_cast< Internal::StyleManager& >( handle );
+ return static_cast<Internal::StyleManager&>(handle);
}
-inline const Internal::StyleManager& GetImpl( const Dali::Toolkit::StyleManager& obj )
+inline const Internal::StyleManager& GetImpl(const Dali::Toolkit::StyleManager& obj)
{
- DALI_ASSERT_ALWAYS( obj );
+ DALI_ASSERT_ALWAYS(obj);
const Dali::BaseObject& handle = obj.GetBaseObject();
- return static_cast< const Internal::StyleManager& >( handle );
+ return static_cast<const Internal::StyleManager&>(handle);
}
} // namespace Toolkit
#define DALI_TOOLKIT_TEXT_BIDIRECTIONAL_LINE_INFO_RUN_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief BidirectionalLineInfoRun
*/
{
CharacterRun characterRun; ///< The initial character index within the whole text and the number of characters of the run.
CharacterIndex* visualToLogicalMap; ///< Pointer to the visual to logical map table.
- CharacterDirection direction:1; ///< Direction of the first character of the paragraph.
- bool isIdentity:1; ///< Whether the map is the identity.
+ CharacterDirection direction : 1; ///< Direction of the first character of the paragraph.
+ bool isIdentity : 1; ///< Whether the map is the identity.
};
} // namespace Text
#define DALI_TOOLKIT_TEXT_BIDIRECTIONAL_PARAGRAPH_INFO_RUN_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief BidirectionalParagraphInfoRun
*
*/
struct BidirectionalParagraphInfoRun
{
- CharacterRun characterRun; ///< The initial character index within the whole text and the number of characters of the run.
- BidiInfoIndex bidirectionalInfoIndex; ///< Index to the table with the bidirectional info per paragraph.
- CharacterDirection direction; ///< The paragraph's direction.
+ CharacterRun characterRun; ///< The initial character index within the whole text and the number of characters of the run.
+ BidiInfoIndex bidirectionalInfoIndex; ///< Index to the table with the bidirectional info per paragraph.
+ CharacterDirection direction; ///< The paragraph's direction.
};
} // namespace Text
#define DALI_TOOLKIT_TEXT_BIDIRECTIONAL_SUPPORT_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/actors/actor-enumerations.h>
+#include <dali/public-api/common/dali-vector.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/text/bidirectional-line-info-run.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* Sets the bidirectional info into the logical model.
*
* @param[in] matchSystemLanguageDirection Whether match for system language direction or not.
* @param[in] layoutDirection The direction of the system language.
*/
-void SetBidirectionalInfo( const Vector<Character>& text,
- const Vector<ScriptRun>& scripts,
- const Vector<LineBreakInfo>& lineBreakInfo,
- CharacterIndex startIndex,
- Length numberOfCharacters,
- Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
- bool matchSystemLanguageDirection = false,
- Dali::LayoutDirection::Type layoutDirection = LayoutDirection::LEFT_TO_RIGHT );
+void SetBidirectionalInfo(const Vector<Character>& text,
+ const Vector<ScriptRun>& scripts,
+ const Vector<LineBreakInfo>& lineBreakInfo,
+ CharacterIndex startIndex,
+ Length numberOfCharacters,
+ Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
+ bool matchSystemLanguageDirection = false,
+ Dali::LayoutDirection::Type layoutDirection = LayoutDirection::LEFT_TO_RIGHT);
/**
* @brief Sets the visual to logical map table for a given line.
* @param[in] numberOfCharacters The number of characters.
* @param[in] direction The direction of the line.
*/
-void ReorderLine( const BidirectionalParagraphInfoRun& bidirectionalParagraphInfo,
- Vector<BidirectionalLineInfoRun>& lineInfoRuns,
- BidirectionalLineRunIndex bidiLineIndex,
- CharacterIndex startIndex,
- Length numberOfCharacters,
- CharacterDirection direction );
+void ReorderLine(const BidirectionalParagraphInfoRun& bidirectionalParagraphInfo,
+ Vector<BidirectionalLineInfoRun>& lineInfoRuns,
+ BidirectionalLineRunIndex bidiLineIndex,
+ CharacterIndex startIndex,
+ Length numberOfCharacters,
+ CharacterDirection direction);
/**
* @brief Replaces any character in the right to left paragraphs which could be mirrored.
*
* @return @e true if a character has been replaced.
*/
-bool GetMirroredText( const Vector<Character>& text,
- const Vector<CharacterDirection>& directions,
- const Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
- CharacterIndex startIndex,
- Length numberOfCharacters,
- Vector<Character>& mirroredText );
+bool GetMirroredText(const Vector<Character>& text,
+ const Vector<CharacterDirection>& directions,
+ const Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
+ CharacterIndex startIndex,
+ Length numberOfCharacters,
+ Vector<Character>& mirroredText);
/**
* @brief Retrieves the characters' directions.
* @param[in] numberOfCharacters The number of characters.
* @param[out] directions The direction, @e false is left to right and @e true is right to left, of each character of the paragraph.
*/
-void GetCharactersDirection( const Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
- Length totalNumberOfCharacters,
- CharacterIndex startIndex,
- Length numberOfCharacters,
- Vector<CharacterDirection>& directions );
+void GetCharactersDirection(const Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
+ Length totalNumberOfCharacters,
+ CharacterIndex startIndex,
+ Length numberOfCharacters,
+ Vector<CharacterDirection>& directions);
} // namespace Text
#define DALI_TOOLKIT_TEXT_CHARACTER_RUN_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief A run of consecutive characters.
*/
struct CharacterRun
{
CharacterRun()
- : characterIndex{ 0u },
- numberOfCharacters{ 0u }
- {}
-
- CharacterRun( CharacterIndex characterIndex, Length numberOfCharacters )
- : characterIndex{ characterIndex },
- numberOfCharacters{ numberOfCharacters }
- {}
+ : characterIndex{0u},
+ numberOfCharacters{0u}
+ {
+ }
+
+ CharacterRun(CharacterIndex characterIndex, Length numberOfCharacters)
+ : characterIndex{characterIndex},
+ numberOfCharacters{numberOfCharacters}
+ {
+ }
CharacterIndex characterIndex; ///< Index to the first character.
Length numberOfCharacters; ///< Number of characters in the run.
#define DALI_TOOLKIT_CHARACTER_SET_CONVERSION_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief Retrieves the number of bytes of a utf8 character.
*
*
* @return The number of bytes of the character.
*/
-uint8_t GetUtf8Length( uint8_t utf8LeadByte );
+uint8_t GetUtf8Length(uint8_t utf8LeadByte);
/**
* @brief Retrieves the number of characters of the text array encoded in UTF8
*
* @return The number of characters.
*/
-uint32_t GetNumberOfUtf8Characters( const uint8_t* const utf8, uint32_t length );
+uint32_t GetNumberOfUtf8Characters(const uint8_t* const utf8, uint32_t length);
/**
* @brief Retrieves the number of bytes needed to encode in UTF8 the given text array encoded in UTF32.
*
* @return The number of bytes.
*/
-uint32_t GetNumberOfUtf8Bytes( const uint32_t* const utf32, uint32_t numberOfCharacters );
+uint32_t GetNumberOfUtf8Bytes(const uint32_t* const utf32, uint32_t numberOfCharacters);
/**
* @brief Converts a text array encoded in UTF8 into a text array encoded in UTF32.
*
* @return The number of characters.
*/
-uint32_t Utf8ToUtf32( const uint8_t* const utf8, uint32_t length, uint32_t* utf32 );
+uint32_t Utf8ToUtf32(const uint8_t* const utf8, uint32_t length, uint32_t* utf32);
/**
* @brief Converts a text array encoded in UTF32 into a text array encoded in UTF8.
*
* @return The number of bytes.
*/
-uint32_t Utf32ToUtf8( const uint32_t* const utf32, uint32_t numberOfCharacters, uint8_t* utf8 );
+uint32_t Utf32ToUtf8(const uint32_t* const utf32, uint32_t numberOfCharacters, uint8_t* utf8);
/**
* @brief Converts a text array encoded in UTF32 into a text array encoded in UTF8.
* @param[in] numberOfCharacters The number of characters of the UTF32 array.
* @param[out] utf8 The UTF8 characters will be stored here.
*/
-void Utf32ToUtf8( const uint32_t* const utf32, uint32_t numberOfCharacters, std::string& utf8 );
+void Utf32ToUtf8(const uint32_t* const utf32, uint32_t numberOfCharacters, std::string& utf8);
} // namespace Text
#define DALI_TOOLKIT_TEXT_COLOR_RUN_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief Run of characters with the same color.
*/
#define DALI_TOOLKIT_TEXT_COLOR_SEGMENTATION_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
class LogicalModel;
/**
* @param[out] colors The vector of colors.
* @param[out] colorIndices Indices to the vector of colors.
*/
-void SetColorSegmentationInfo( const Vector<ColorRun>& colorRuns,
- const Vector<GlyphIndex>& charactersToGlyph,
- const Vector<Length>& glyphsPerCharacter,
- CharacterIndex startCharacterIndex,
- GlyphIndex startGlyphIndex,
- Length numberOfCharacters,
- Vector<Vector4>& colors,
- Vector<ColorIndex>& colorIndices );
+void SetColorSegmentationInfo(const Vector<ColorRun>& colorRuns,
+ const Vector<GlyphIndex>& charactersToGlyph,
+ const Vector<Length>& glyphsPerCharacter,
+ CharacterIndex startCharacterIndex,
+ GlyphIndex startGlyphIndex,
+ Length numberOfCharacters,
+ Vector<Vector4>& colors,
+ Vector<ColorIndex>& colorIndices);
} // namespace Text
#define DALI_TOOLKIT_TEXT_CURSOR_HELPER_FUNCTIONS_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
struct CharacterHitTest
{
/**
CursorInfo()
: primaryPosition(),
secondaryPosition(),
- lineOffset( 0.f ),
- glyphOffset( 0.f ),
- lineHeight( 0.f ),
- primaryCursorHeight( 0.f ),
- secondaryCursorHeight( 0.f ),
- isSecondaryCursor( false )
- {}
+ lineOffset(0.f),
+ glyphOffset(0.f),
+ lineHeight(0.f),
+ primaryCursorHeight(0.f),
+ secondaryCursorHeight(0.f),
+ isSecondaryCursor(false)
+ {
+ }
~CursorInfo()
- {}
+ {
+ }
Vector2 primaryPosition; ///< The primary cursor's position (in text's coords).
Vector2 secondaryPosition; ///< The secondary cursor's position (in text's coords).
*/
struct GetCursorPositionParameters
{
- VisualModelPtr visualModel; ///< The visual model.
- LogicalModelPtr logicalModel; ///< The logical model.
- MetricsPtr metrics; ///< A wrapper around FontClient used to get metrics.
- CharacterIndex logical; ///< The logical cursor position (in characters). 0 is just before the first character, a value equal to the number of characters is just after the last character.
- bool isMultiline; ///< Whether the text control is multi-line.
+ VisualModelPtr visualModel; ///< The visual model.
+ LogicalModelPtr logicalModel; ///< The logical model.
+ MetricsPtr metrics; ///< A wrapper around FontClient used to get metrics.
+ CharacterIndex logical; ///< The logical cursor position (in characters). 0 is just before the first character, a value equal to the number of characters is just after the last character.
+ bool isMultiline; ///< Whether the text control is multi-line.
};
/**
*
* @return A line index.
*/
-LineIndex GetClosestLine( VisualModelPtr visualModel,
- float visualY,
- bool& matchedLine );
+LineIndex GetClosestLine(VisualModelPtr visualModel,
+ float visualY,
+ bool& matchedLine);
/**
* @brief Calculates the vertical line's offset for a given line.
*
* @return The vertical offset of the given line.
*/
-float CalculateLineOffset( const Vector<LineRun>& lines,
- LineIndex lineIndex );
+float CalculateLineOffset(const Vector<LineRun>& lines,
+ LineIndex lineIndex);
/**
* @brief Retrieves the cursor's logical position for a given touch point x,y
*
* @return The logical cursor position (in characters). 0 is just before the first character, a value equal to the number of characters is just after the last character.
*/
-CharacterIndex GetClosestCursorIndex( VisualModelPtr visualModel,
- LogicalModelPtr logicalModel,
- MetricsPtr metrics,
- float visualX,
- float visualY,
- CharacterHitTest::Mode mode,
- bool& matchedCharacter );
+CharacterIndex GetClosestCursorIndex(VisualModelPtr visualModel,
+ LogicalModelPtr logicalModel,
+ MetricsPtr metrics,
+ float visualX,
+ float visualY,
+ CharacterHitTest::Mode mode,
+ bool& matchedCharacter);
/**
* @brief Calculates the cursor's position for a given character index in the logical order.
* @param[in] parameters Parameters used to calculate the cursor's position.
* @param[out] cursorInfo The line's height, the cursor's height, the cursor's position and whether there is an alternative cursor.
*/
-void GetCursorPosition( GetCursorPositionParameters& parameters,
- CursorInfo& cursorInfo );
+void GetCursorPosition(GetCursorPositionParameters& parameters,
+ CursorInfo& cursorInfo);
/**
* @brief Find the indices to the first and last characters of a word for the given touch point.
*
* @return @e true if the touch point hits a character.
*/
-bool FindSelectionIndices( VisualModelPtr visualModel,
- LogicalModelPtr logicalModel,
- MetricsPtr metrics,
- float visualX,
- float visualY,
- CharacterIndex& startIndex,
- CharacterIndex& endIndex,
- CharacterIndex& noTextHitIndex );
+bool FindSelectionIndices(VisualModelPtr visualModel,
+ LogicalModelPtr logicalModel,
+ MetricsPtr metrics,
+ float visualX,
+ float visualY,
+ CharacterIndex& startIndex,
+ CharacterIndex& endIndex,
+ CharacterIndex& noTextHitIndex);
} // namespace Text
#define DALI_TOOLKIT_TEXT_DECORATOR_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// EXTERNAL INCLUDES
#include <dali/public-api/common/intrusive-ptr.h>
-#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/math/rect.h>
+#include <dali/public-api/object/ref-object.h>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h>
namespace Dali
{
-
struct Vector2;
struct Vector4;
namespace Toolkit
{
-
namespace Text
{
-
class Decorator;
typedef IntrusivePtr<Decorator> DecoratorPtr;
class Decorator : public RefObject
{
public:
-
class ControllerInterface
{
public:
-
/**
* @brief Constructor.
*/
- ControllerInterface() {};
+ ControllerInterface(){};
/**
* @brief Virtual destructor.
*/
- virtual ~ControllerInterface() {};
+ virtual ~ControllerInterface(){};
/**
* @brief Query the target size of the UI control.
*
* @param[out] targetSize The size of the UI control the decorator is adding it's decorations to.
*/
- virtual void GetTargetSize( Vector2& targetSize ) = 0;
+ virtual void GetTargetSize(Vector2& targetSize) = 0;
/**
* @brief Add a decoration to the parent UI control.
*
* @param[in] decoration The actor displaying a decoration.
*/
- virtual void AddDecoration( Actor& actor, bool needsClipping ) = 0;
+ virtual void AddDecoration(Actor& actor, bool needsClipping) = 0;
/**
* @brief An input event from one of the handles.
* @param[in] x The x position relative to the top-left of the parent control.
* @param[in] y The y position relative to the top-left of the parent control.
*/
- virtual void DecorationEvent( HandleType handleType, HandleState state, float x, float y ) = 0;
+ virtual void DecorationEvent(HandleType handleType, HandleState state, float x, float y) = 0;
};
/**
*
* @return A pointer to a new Decorator.
*/
- static DecoratorPtr New( ControllerInterface& controller,
- TextSelectionPopupCallbackInterface& callbackInterface );
+ static DecoratorPtr New(ControllerInterface& controller,
+ TextSelectionPopupCallbackInterface& callbackInterface);
/**
* @brief Set the bounding box which handles, popup and similar decorations will not exceed.
*
* @param[in] boundingBox Vector( x coordinate, y coordinate, width, height )
*/
- void SetBoundingBox( const Rect<int>& boundingBox );
+ void SetBoundingBox(const Rect<int>& boundingBox);
/**
* @brief Retrieve the bounding box origin and dimensions.
* default is set once control is added to stage, before this the return vector will be Vector4:ZERO
* @param[out] boundingBox The bounding box origin, width and height.
*/
- void GetBoundingBox( Rect<int>& boundingBox ) const;
+ void GetBoundingBox(Rect<int>& boundingBox) const;
/**
* @brief The decorator waits until a relayout before creating actors etc.
*
* @param[in] size The size of the parent control after size-negotiation.
*/
- void Relayout( const Dali::Vector2& size );
+ void Relayout(const Dali::Vector2& size);
/**
* @brief Updates the decorator's actor positions after scrolling.
*
* @param[in] scrollOffset The scroll offset.
*/
- void UpdatePositions( const Vector2& scrollOffset );
+ void UpdatePositions(const Vector2& scrollOffset);
/**
* @brief Sets which of the cursors are active.
* @note Cursor will only be visible if within the parent area.
* @param[in] activeCursor Which of the cursors should be active (if any).
*/
- void SetActiveCursor( ActiveCursor activeCursor );
+ void SetActiveCursor(ActiveCursor activeCursor);
/**
* @brief Query which of the cursors are active.
* @param[in] cursorHeight The logical height of the cursor.
* @param[in] lineHeight The logical height of the line.
*/
- void SetPosition( Cursor cursor, float x, float y, float cursorHeight, float lineHeight );
+ void SetPosition(Cursor cursor, float x, float y, float cursorHeight, float lineHeight);
/**
* @brief Retrieves the position, height and lineHeight of a cursor.
* @param[out] cursorHeight The logical height of the cursor.
* @param[out] lineHeight The logical height of the line.
*/
- void GetPosition( Cursor cursor, float& x, float& y, float& cursorHeight, float& lineHeight ) const;
+ void GetPosition(Cursor cursor, float& x, float& y, float& cursorHeight, float& lineHeight) const;
/**
* @brief Retrieves the position of a cursor.
*
* @return The position.
*/
- const Vector2& GetPosition( Cursor cursor ) const;
-
+ const Vector2& GetPosition(Cursor cursor) const;
/**
* @brief Sets the glyph offset of a cursor.
* @param[in] cursor The cursor to set.
* @param[in] glyphoffset The difference of line ascender and glyph ascender.
*/
- void SetGlyphOffset( Cursor cursor, float glyphOffset );
+ void SetGlyphOffset(Cursor cursor, float glyphOffset);
/**
* @brief Retrieves the glyph offset of a cursor.
*
* @return The glyph offset. glyph offset means difference of line ascender and glyph ascender.
*/
- const float GetGlyphOffset( Cursor cursor ) const;
+ const float GetGlyphOffset(Cursor cursor) const;
/**
* @brief Sets the color for a cursor.
* @param[in] cursor Whether this color is for the primary or secondary cursor.
* @param[in] color The color to use.
*/
- void SetCursorColor( Cursor cursor, const Dali::Vector4& color );
+ void SetCursorColor(Cursor cursor, const Dali::Vector4& color);
/**
* @brief Retrieves the color for a cursor.
* @param[in] cursor Whether this color is for the primary or secondary cursor.
* @return The cursor color.
*/
- const Dali::Vector4& GetColor( Cursor cursor ) const;
+ const Dali::Vector4& GetColor(Cursor cursor) const;
/**
* @brief Start blinking the cursor; see also SetCursorBlinkDuration().
*
* @param[in] seconds The interval in seconds.
*/
- void SetCursorBlinkInterval( float seconds );
+ void SetCursorBlinkInterval(float seconds);
/**
* @brief Retrieves the blink-interval for a cursor.
*
* @param[in] seconds The duration in seconds.
*/
- void SetCursorBlinkDuration( float seconds );
+ void SetCursorBlinkDuration(float seconds);
/**
* @brief Retrieves the blink-duration for a cursor.
*
* @param[in] width The width of the cursor in pixels.
*/
- void SetCursorWidth( int width );
+ void SetCursorWidth(int width);
/**
* @brief Retrieves the width of the cursors.
* @param[in] handleType One of the handles.
* @param[in] active True if the handle should be active.
*/
- void SetHandleActive( HandleType handleType,
- bool active );
+ void SetHandleActive(HandleType handleType,
+ bool active);
/**
* @brief Query whether a handle is active.
*
* @return True if the handle is active.
*/
- bool IsHandleActive( HandleType handleType ) const;
+ bool IsHandleActive(HandleType handleType) const;
/**
* @brief Sets the image file name for one of the handles.
* @param[in] handleImageType A different image can be set for the pressed/released states.
* @param[in] imageFileName The image filename to use.
*/
- void SetHandleImage( HandleType handleType, HandleImageType handleImageType, const std::string& imageFileName );
+ void SetHandleImage(HandleType handleType, HandleImageType handleImageType, const std::string& imageFileName);
/**
* @brief Retrieves the file name of the image for one of the handles.
*
* @return The grab handle image string.
*/
- const std::string& GetHandleImage( HandleType handleType, HandleImageType handleImageType ) const;
+ const std::string& GetHandleImage(HandleType handleType, HandleImageType handleImageType) const;
/**
* @brief Sets the color of the handles
*
* @param[in] color The color to use.
*/
- void SetHandleColor( const Vector4& color );
+ void SetHandleColor(const Vector4& color);
/**
* @brief Retrieves the handles color.
* @param[in] y The y position relative to the top-left of the parent control.
* @param[in] lineHeight The logical line height at this position.
*/
- void SetPosition( HandleType handleType, float x, float y, float lineHeight );
+ void SetPosition(HandleType handleType, float x, float y, float lineHeight);
/**
* @brief Retrieves the position of a selection handle.
* @param[out] y The y position relative to the top-left of the parent control.
* @param[out] lineHeight The logical line height at this position.
*/
- void GetPosition( HandleType handleType, float& x, float& y, float& lineHeight ) const;
+ void GetPosition(HandleType handleType, float& x, float& y, float& lineHeight) const;
/**
* @brief Retrieves the position of a selection handle.
*
* @return The position of the selection handle relative to the top-left of the parent control.
*/
- const Vector2& GetPosition( HandleType handleType ) const;
+ const Vector2& GetPosition(HandleType handleType) const;
/**
* @brief Whether to flip vertically a handle.
* @param[in] handleType The handle to flip vertically.
* @param[in] flip Whether to flip vertically.
*/
- void FlipHandleVertically( HandleType handleType, bool flip );
+ void FlipHandleVertically(HandleType handleType, bool flip);
/**
* @brief Retrieves whether the handle is vertically flipped.
*
* @return @e ture if the handle is vertically flipped.
*/
- bool IsHandleVerticallyFlipped( HandleType handleType ) const;
+ bool IsHandleVerticallyFlipped(HandleType handleType) const;
/**
* @brief Whether to flip the selection handles as soon as they are crossed.
*
* @param[in] enable If @e true the selection handles will flip as soon as they are crossed.
*/
- void FlipSelectionHandlesOnCrossEnabled( bool enable );
+ void FlipSelectionHandlesOnCrossEnabled(bool enable);
/**
* @brief Sets info to calculate the handle flip state.
* @param[in] left The direction of the character pointed by the primary selection handle.
* @param[in] right The direction of the character pointed by the secondary selection handle.
*/
- void SetSelectionHandleFlipState( bool indicesSwapped, bool left, bool right );
+ void SetSelectionHandleFlipState(bool indicesSwapped, bool left, bool right);
/**
* @brief Adds a quad to the existing selection highlights. Vertices are in decorator's coordinates.
* @param[in] index Position in the vector where to add the quad.
* @param[in] quad The quad. The 'x' and 'y' coordinates store the min 'x' and min 'y'. The 'z' and 'w' coordinates store the max 'x' and max 'y'.
*/
- void AddHighlight( unsigned int index, const Vector4& quad );
+ void AddHighlight(unsigned int index, const Vector4& quad);
/**
* @brief Sets the min 'x,y' coordinates and the size of the highlighted box.
* @param[in] size The size of the highlighted text.
* @param[in] outlineOffset The outline's offset.
*/
- void SetHighLightBox( const Vector2& position,
- const Size& size,
- float outlineOffset );
+ void SetHighLightBox(const Vector2& position,
+ const Size& size,
+ float outlineOffset);
/**
* @brief Removes all of the previously added highlights.
*
* @param[in] numberOfQuads The expected number of quads.
*/
- void ResizeHighlightQuads( unsigned int numberOfQuads );
+ void ResizeHighlightQuads(unsigned int numberOfQuads);
/**
* @brief Sets the selection highlight color.
*
* @param[in] color The color to use.
*/
- void SetHighlightColor( const Vector4& color );
+ void SetHighlightColor(const Vector4& color);
/**
* @brief Retrieves the selection highlight color.
*
* @param[in] active Whether the highlight is active.
*/
- void SetHighlightActive( bool active );
+ void SetHighlightActive(bool active);
/**
* @brief Retrieves whether the highlight is active.
*
* @param[in] depth The text's depth.
*/
- void SetTextDepth( int textDepth );
+ void SetTextDepth(int textDepth);
/**
* @brief Set the Selection Popup to show or hide via the active flaf
* @param[in] active true to show, false to hide
*/
- void SetPopupActive( bool active );
+ void SetPopupActive(bool active);
/**
* @brief Query whether the Selection Popup is active.
* @brief Set a bit mask of the buttons to be shown by Popup
* @param[in] enabledButtonsBitMask from TextSelectionPopup::Buttons enum
*/
- void SetEnabledPopupButtons( TextSelectionPopup::Buttons& enabledButtonsBitMask );
+ void SetEnabledPopupButtons(TextSelectionPopup::Buttons& enabledButtonsBitMask);
/**
* @brief Get the current bit mask of buttons to be shown by Popup
*
* @param[in] threshold The scroll threshold in pixels.
*/
- void SetScrollThreshold( float threshold );
+ void SetScrollThreshold(float threshold);
/**
* @brief Retrieves the scroll threshold.
*
* @param[in] speed The scroll speed in pixels/second.
*/
- void SetScrollSpeed( float speed );
+ void SetScrollSpeed(float speed);
- /**
+ /**
* @brief Sets Editable mode decoration.
*
* If this set to false, Primary cursor and grab will always be hidden.
*
* @param[in] isEditable enable or disable Editing.
*/
- void SetEditable( bool isEditable );
+ void SetEditable(bool isEditable);
/**
* @brief Retrieves the scroll speed.
/**
* @copydoc Text::Controller::SetHorizontalScrollEnabled()
*/
- void SetHorizontalScrollEnabled( bool enable );
+ void SetHorizontalScrollEnabled(bool enable);
/**
* @copydoc Text::Controller::IsHorizontalScrollEnabled()
/**
* @copydoc Text::Controller::SetVerticalScrollEnabled()
*/
- void SetVerticalScrollEnabled( bool enable );
+ void SetVerticalScrollEnabled(bool enable);
/**
* @copydoc Text::Controller::IsVerticalScrollEnabled()
/**
* @copydoc Text::Controller::SetSmoothHandlePanEnabled()
*/
- void SetSmoothHandlePanEnabled( bool enable );
+ void SetSmoothHandlePanEnabled(bool enable);
/**
* @copydoc Text::Controller::IsSmoothHandlePanEnabled()
bool IsSmoothHandlePanEnabled() const;
protected:
-
/**
* @brief A reference counted object may only be deleted by calling Unreference().
*/
virtual ~Decorator();
private:
-
/**
* @brief Private constructor.
* @param[in] controller The controller which receives input events from Decorator components.
* @param[in] callbackInterface The text popup callback interface which receives the button click callbacks.
*/
- Decorator( ControllerInterface& controller,
- TextSelectionPopupCallbackInterface& callbackInterface );
+ Decorator(ControllerInterface& controller,
+ TextSelectionPopupCallbackInterface& callbackInterface);
// Undefined
- Decorator( const Decorator& handle );
+ Decorator(const Decorator& handle);
// Undefined
- Decorator& operator=( const Decorator& handle );
+ Decorator& operator=(const Decorator& handle);
private:
-
struct Impl;
Impl* mImpl;
};
#define DALI_TOOLKIT_TEXT_EMBEDDED_ITEM_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief An embedded item within the text.
*
#define DALI_TOOLKIT_TEXT_FONT_DESCRIPTION_RUN_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief Run of characters with the same font.
*/
*/
FontDescriptionRun()
: characterRun{},
- familyName{ nullptr },
- familyLength{ 0u },
- weight{ FontWeight::NONE },
- width{ FontWidth::NONE },
- slant{ FontSlant::NONE },
- size{ 0u },
- familyDefined{ false },
- weightDefined{ false },
- widthDefined{ false },
- slantDefined{ false },
- sizeDefined{ false }
- {}
+ familyName{nullptr},
+ familyLength{0u},
+ weight{FontWeight::NONE},
+ width{FontWidth::NONE},
+ slant{FontSlant::NONE},
+ size{0u},
+ familyDefined{false},
+ weightDefined{false},
+ widthDefined{false},
+ slantDefined{false},
+ sizeDefined{false}
+ {
+ }
- FontDescriptionRun( const CharacterRun& characterRun,
- char* familyName,
- Length familyLength,
- FontWeight weight,
- FontWidth width,
- FontSlant slant,
- PointSize26Dot6 size,
- bool familyDefined,
- bool weightDefined,
- bool widthDefined,
- bool slantDefined,
- bool sizeDefined )
- : characterRun{ characterRun },
- familyName{ familyName },
- familyLength{ familyLength },
- weight{ weight },
- width{ width },
- slant{ slant },
- size{ size },
- familyDefined{ familyDefined },
- weightDefined{ weightDefined },
- widthDefined{ widthDefined },
- slantDefined{ slantDefined },
- sizeDefined{ sizeDefined }
- {}
+ FontDescriptionRun(const CharacterRun& characterRun,
+ char* familyName,
+ Length familyLength,
+ FontWeight weight,
+ FontWidth width,
+ FontSlant slant,
+ PointSize26Dot6 size,
+ bool familyDefined,
+ bool weightDefined,
+ bool widthDefined,
+ bool slantDefined,
+ bool sizeDefined)
+ : characterRun{characterRun},
+ familyName{familyName},
+ familyLength{familyLength},
+ weight{weight},
+ width{width},
+ slant{slant},
+ size{size},
+ familyDefined{familyDefined},
+ weightDefined{weightDefined},
+ widthDefined{widthDefined},
+ slantDefined{slantDefined},
+ sizeDefined{sizeDefined}
+ {
+ }
CharacterRun characterRun; ///< The initial character index and the number of characters of the run.
char* familyName; ///< The font's family name.
FontSlant slant; ///< The font's slant.
PointSize26Dot6 size; ///< The font's size.
- bool familyDefined : 1; ///< Whether the font's family is defined.
- bool weightDefined : 1; ///< Whether the font's weight is defined.
- bool widthDefined : 1; ///< Whether the font's width is defined.
- bool slantDefined : 1; ///< Whether the font's slant is defined.
- bool sizeDefined : 1; ///< Whether the font's size is defined.
+ bool familyDefined : 1; ///< Whether the font's family is defined.
+ bool weightDefined : 1; ///< Whether the font's weight is defined.
+ bool widthDefined : 1; ///< Whether the font's width is defined.
+ bool slantDefined : 1; ///< Whether the font's slant is defined.
+ bool sizeDefined : 1; ///< Whether the font's size is defined.
};
} // namespace Text
#define DALI_TOOLKIT_TEXT_FONT_RUN_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief Run of characters with the same font.
*/
struct FontRun
{
- CharacterRun characterRun; ///< The initial character index and the number of characters of the run.
- FontId fontId; ///< Font id of the run.
- bool isItalicRequired:1; ///< Whether the italic style is required.
- bool isBoldRequired:1; ///< Whether the bold style is required.
+ CharacterRun characterRun; ///< The initial character index and the number of characters of the run.
+ FontId fontId; ///< Font id of the run.
+ bool isItalicRequired : 1; ///< Whether the italic style is required.
+ bool isBoldRequired : 1; ///< Whether the bold style is required.
};
} // namespace Text
#define DALI_TOOLKIT_TEXT_GLYPH_METRICS_HELPER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief Some characters can be shaped in more than one glyph.
* This struct is used to retrieve metrics from these group of glyphs.
struct GlyphMetrics
{
GlyphMetrics()
- : fontId( 0u ),
- fontHeight( 0.f ),
- width( 0.f ),
- advance( 0.f ),
- ascender( 0.f ),
- xBearing( 0.f )
- {}
+ : fontId(0u),
+ fontHeight(0.f),
+ width(0.f),
+ advance(0.f),
+ ascender(0.f),
+ xBearing(0.f)
+ {
+ }
~GlyphMetrics()
- {}
+ {
+ }
FontId fontId; ///< The font id of the glyphs.
float fontHeight; ///< The font's height of those glyphs.
*
* @return The number of glyphs of the group.
*/
-Length GetNumberOfGlyphsOfGroup( GlyphIndex glyphIndex,
- GlyphIndex lastGlyphPlusOne,
- const Length* const charactersPerGlyphBuffer );
+Length GetNumberOfGlyphsOfGroup(GlyphIndex glyphIndex,
+ GlyphIndex lastGlyphPlusOne,
+ const Length* const charactersPerGlyphBuffer);
/**
* @brief Get some glyph's metrics of a group of glyphs formed as a result of shaping one character.
* @param[in] glyphsBuffer The glyphs buffer.
* @param[in] metrics Used to access metrics from FontClient.
*/
-void GetGlyphsMetrics( GlyphIndex glyphIndex,
- Length numberOfGlyphs,
- GlyphMetrics& glyphMetrics,
- const GlyphInfo* const glyphsBuffer,
- MetricsPtr& metrics );
+void GetGlyphsMetrics(GlyphIndex glyphIndex,
+ Length numberOfGlyphs,
+ GlyphMetrics& glyphMetrics,
+ const GlyphInfo* const glyphsBuffer,
+ MetricsPtr& metrics);
} // namespace Text
#define DALI_TOOLKIT_TEXT_GLYPH_RUN_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief A run of consecutive glyphs.
*/
#define DALI_HIDDEN_TEXT_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/object/property-map.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/text-controls/hidden-input-properties.h>
#include <dali-toolkit/internal/text/text-definitions.h>
+#include <dali-toolkit/public-api/controls/text-controls/hidden-input-properties.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* Class to handle the hidden text
*/
class Observer
{
public:
-
/**
* @brief Invoked when the time to show last character is expired
*/
* @brief Constructor
* @param[in] observer The Observer pointer.
*/
- HiddenText( Observer* observer );
+ HiddenText(Observer* observer);
public: // Intended for internal use
-
/**
* @brief Used to set options of hidden text
* @param[in] map The property map describing the option
*/
- void SetProperties( const Property::Map& map );
+ void SetProperties(const Property::Map& map);
/**
* @brief Retrieve property map of hidden text options
* @param[out] map The hidden text option
*/
- void GetProperties( Property::Map& map );
+ void GetProperties(Property::Map& map);
/**
* @brief Convert source text to destination text according to current option
* @param[in] source The original text
* @param[out] destination The applied text
*/
- void Substitute( const Vector<Character>& source, Vector<Character>& destination );
+ void Substitute(const Vector<Character>& source, Vector<Character>& destination);
/**
* @brief Invoked when the timer is expired
bool OnTick();
private:
-
- Timer mTimer;
+ Timer mTimer;
Observer* mObserver;
- int mHideMode;
- int mSubstituteText;
- int mDisplayDuration;
- int mSubstituteCount;
- Length mPreviousTextCount;
+ int mHideMode;
+ int mSubstituteText;
+ int mDisplayDuration;
+ int mSubstituteCount;
+ Length mPreviousTextCount;
};
} // namespace Text
#define DALI_TOOLKIT_TEXT_INPUT_STYLE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* The input text's style.
*/
};
InputStyle()
- : textColor( Color::BLACK ),
+ : textColor(Color::BLACK),
familyName(),
- weight( TextAbstraction::FontWeight::NORMAL ),
- width( TextAbstraction::FontWidth::NORMAL ),
- slant( TextAbstraction::FontSlant::NORMAL ),
- size( 0.f ),
- lineSpacing( 0.f ),
+ weight(TextAbstraction::FontWeight::NORMAL),
+ width(TextAbstraction::FontWidth::NORMAL),
+ slant(TextAbstraction::FontSlant::NORMAL),
+ size(0.f),
+ lineSpacing(0.f),
underlineProperties(),
shadowProperties(),
embossProperties(),
outlineProperties(),
- isDefaultColor( true ),
- isFamilyDefined( false ),
- isWeightDefined( false ),
- isWidthDefined( false ),
- isSlantDefined( false ),
- isSizeDefined( false ),
- isLineSpacingDefined( false ),
- isUnderlineDefined( false ),
- isShadowDefined( false ),
- isEmbossDefined( false ),
- isOutlineDefined( false )
- {}
-
- ~InputStyle()
- {};
+ isDefaultColor(true),
+ isFamilyDefined(false),
+ isWeightDefined(false),
+ isWidthDefined(false),
+ isSlantDefined(false),
+ isSizeDefined(false),
+ isLineSpacingDefined(false),
+ isUnderlineDefined(false),
+ isShadowDefined(false),
+ isEmbossDefined(false),
+ isOutlineDefined(false)
+ {
+ }
+
+ ~InputStyle(){};
/**
* @brief
*
* Does not copy the font-style, underline, shadow, emboss and outline property strings.
*/
- void Copy( const InputStyle& inputStyle )
+ void Copy(const InputStyle& inputStyle)
{
isDefaultColor = inputStyle.isDefaultColor;
- textColor = inputStyle.textColor;
+ textColor = inputStyle.textColor;
isFamilyDefined = inputStyle.isFamilyDefined;
- familyName = inputStyle.familyName;
+ familyName = inputStyle.familyName;
isWeightDefined = inputStyle.isWeightDefined;
- weight = inputStyle.weight;
+ weight = inputStyle.weight;
isWidthDefined = inputStyle.isWidthDefined;
- width = inputStyle.width;
+ width = inputStyle.width;
isSlantDefined = inputStyle.isSlantDefined;
- slant = inputStyle.slant;
+ slant = inputStyle.slant;
isSizeDefined = inputStyle.isSizeDefined;
- size = inputStyle.size;
+ size = inputStyle.size;
isLineSpacingDefined = inputStyle.isLineSpacingDefined;
- lineSpacing = inputStyle.lineSpacing;
+ lineSpacing = inputStyle.lineSpacing;
- isUnderlineDefined = inputStyle.isUnderlineDefined;
+ isUnderlineDefined = inputStyle.isUnderlineDefined;
underlineProperties = inputStyle.underlineProperties;
- isShadowDefined = inputStyle.isShadowDefined;
+ isShadowDefined = inputStyle.isShadowDefined;
shadowProperties = inputStyle.shadowProperties;
- isEmbossDefined = inputStyle.isEmbossDefined;
+ isEmbossDefined = inputStyle.isEmbossDefined;
embossProperties = inputStyle.embossProperties;
- isOutlineDefined = inputStyle.isOutlineDefined;
+ isOutlineDefined = inputStyle.isOutlineDefined;
outlineProperties = inputStyle.outlineProperties;
}
*
* Does not compare the font-style, underline, shadow, emboss and outline property strings.
*/
- bool Equal( const InputStyle& inputStyle ) const
+ bool Equal(const InputStyle& inputStyle) const
{
- if( ( isDefaultColor != inputStyle.isDefaultColor ) ||
- ( isFamilyDefined != inputStyle.isFamilyDefined ) ||
- ( isWeightDefined != inputStyle.isWeightDefined ) ||
- ( isWidthDefined != inputStyle.isWidthDefined ) ||
- ( isSlantDefined != inputStyle.isSlantDefined ) ||
- ( isSizeDefined != inputStyle.isSizeDefined ) ||
- ( isLineSpacingDefined != inputStyle.isLineSpacingDefined ) ||
- ( isUnderlineDefined != inputStyle.isUnderlineDefined ) ||
- ( isShadowDefined != inputStyle.isShadowDefined ) ||
- ( isEmbossDefined != inputStyle.isEmbossDefined ) ||
- ( isOutlineDefined != inputStyle.isOutlineDefined ) ||
- ( textColor != inputStyle.textColor ) ||
- ( familyName != inputStyle.familyName ) ||
- ( weight != inputStyle.weight ) ||
- ( width != inputStyle.width ) ||
- ( slant != inputStyle.slant ) ||
- ( size != inputStyle.size ) ||
- ( lineSpacing != inputStyle.lineSpacing ) ||
- ( underlineProperties != inputStyle.underlineProperties ) ||
- ( shadowProperties != inputStyle.shadowProperties ) ||
- ( embossProperties != inputStyle.embossProperties ) ||
- ( outlineProperties != inputStyle.outlineProperties ) )
+ if((isDefaultColor != inputStyle.isDefaultColor) ||
+ (isFamilyDefined != inputStyle.isFamilyDefined) ||
+ (isWeightDefined != inputStyle.isWeightDefined) ||
+ (isWidthDefined != inputStyle.isWidthDefined) ||
+ (isSlantDefined != inputStyle.isSlantDefined) ||
+ (isSizeDefined != inputStyle.isSizeDefined) ||
+ (isLineSpacingDefined != inputStyle.isLineSpacingDefined) ||
+ (isUnderlineDefined != inputStyle.isUnderlineDefined) ||
+ (isShadowDefined != inputStyle.isShadowDefined) ||
+ (isEmbossDefined != inputStyle.isEmbossDefined) ||
+ (isOutlineDefined != inputStyle.isOutlineDefined) ||
+ (textColor != inputStyle.textColor) ||
+ (familyName != inputStyle.familyName) ||
+ (weight != inputStyle.weight) ||
+ (width != inputStyle.width) ||
+ (slant != inputStyle.slant) ||
+ (size != inputStyle.size) ||
+ (lineSpacing != inputStyle.lineSpacing) ||
+ (underlineProperties != inputStyle.underlineProperties) ||
+ (shadowProperties != inputStyle.shadowProperties) ||
+ (embossProperties != inputStyle.embossProperties) ||
+ (outlineProperties != inputStyle.outlineProperties))
{
return false;
}
return true;
}
- Mask GetInputStyleChangeMask( const InputStyle& inputStyle ) const
+ Mask GetInputStyleChangeMask(const InputStyle& inputStyle) const
{
Mask mask = NONE;
- if( textColor != inputStyle.textColor )
+ if(textColor != inputStyle.textColor)
{
- mask = static_cast<Mask>( mask | INPUT_COLOR );
+ mask = static_cast<Mask>(mask | INPUT_COLOR);
}
- if( familyName != inputStyle.familyName )
+ if(familyName != inputStyle.familyName)
{
- mask = static_cast<Mask>( mask | INPUT_FONT_FAMILY );
+ mask = static_cast<Mask>(mask | INPUT_FONT_FAMILY);
}
- if( weight != inputStyle.weight )
+ if(weight != inputStyle.weight)
{
- mask = static_cast<Mask>( mask | INPUT_FONT_WEIGHT );
+ mask = static_cast<Mask>(mask | INPUT_FONT_WEIGHT);
}
- if( width != inputStyle.width )
+ if(width != inputStyle.width)
{
- mask = static_cast<Mask>( mask | INPUT_FONT_WIDTH );
+ mask = static_cast<Mask>(mask | INPUT_FONT_WIDTH);
}
- if( slant != inputStyle.slant )
+ if(slant != inputStyle.slant)
{
- mask = static_cast<Mask>( mask | INPUT_FONT_SLANT );
+ mask = static_cast<Mask>(mask | INPUT_FONT_SLANT);
}
- if( size != inputStyle.size )
+ if(size != inputStyle.size)
{
- mask = static_cast<Mask>( mask | INPUT_POINT_SIZE );
+ mask = static_cast<Mask>(mask | INPUT_POINT_SIZE);
}
- if( lineSpacing != inputStyle.lineSpacing )
+ if(lineSpacing != inputStyle.lineSpacing)
{
- mask = static_cast<Mask>( mask | INPUT_LINE_SPACING );
+ mask = static_cast<Mask>(mask | INPUT_LINE_SPACING);
}
- if( underlineProperties != inputStyle.underlineProperties )
+ if(underlineProperties != inputStyle.underlineProperties)
{
- mask = static_cast<Mask>( mask | INPUT_UNDERLINE );
+ mask = static_cast<Mask>(mask | INPUT_UNDERLINE);
}
- if( shadowProperties != inputStyle.shadowProperties )
+ if(shadowProperties != inputStyle.shadowProperties)
{
- mask = static_cast<Mask>( mask | INPUT_SHADOW );
+ mask = static_cast<Mask>(mask | INPUT_SHADOW);
}
- if( embossProperties != inputStyle.embossProperties )
+ if(embossProperties != inputStyle.embossProperties)
{
- mask = static_cast<Mask>( mask | INPUT_EMBOSS );
+ mask = static_cast<Mask>(mask | INPUT_EMBOSS);
}
- if( outlineProperties != inputStyle.outlineProperties )
+ if(outlineProperties != inputStyle.outlineProperties)
{
- mask = static_cast<Mask>( mask | INPUT_OUTLINE );
+ mask = static_cast<Mask>(mask | INPUT_OUTLINE);
}
return mask;
}
- Vector4 textColor; ///< The text's color.
- std::string familyName; ///< The font's family name.
- FontWeight weight; ///< The font's weight.
- FontWidth width; ///< The font's width.
- FontSlant slant; ///< The font's slant.
- float size; ///< The font's size.
+ Vector4 textColor; ///< The text's color.
+ std::string familyName; ///< The font's family name.
+ FontWeight weight; ///< The font's weight.
+ FontWidth width; ///< The font's width.
+ FontSlant slant; ///< The font's slant.
+ float size; ///< The font's size.
- float lineSpacing; ///< The line's spacing.
+ float lineSpacing; ///< The line's spacing.
std::string underlineProperties; ///< The underline properties string.
std::string shadowProperties; ///< The shadow properties string.
std::string embossProperties; ///< The emboss properties string.
std::string outlineProperties; ///< The outline properties string.
- bool isDefaultColor : 1; ///< Whether the text's color is the default.
- bool isFamilyDefined : 1; ///< Whether the font's family is defined.
- bool isWeightDefined : 1; ///< Whether the font's weight is defined.
- bool isWidthDefined : 1; ///< Whether the font's width is defined.
- bool isSlantDefined : 1; ///< Whether the font's slant is defined.
- bool isSizeDefined : 1; ///< Whether the font's size is defined.
-
- bool isLineSpacingDefined : 1; ///< Whether the line spacing is defined.
- bool isUnderlineDefined : 1; ///< Whether the underline parameters are defined.
- bool isShadowDefined : 1; ///< Whether the shadow parameters are defined.
- bool isEmbossDefined : 1; ///< Whether the emboss parameters are defined.
- bool isOutlineDefined : 1; ///< Whether the outline parameters are defined.
+ bool isDefaultColor : 1; ///< Whether the text's color is the default.
+ bool isFamilyDefined : 1; ///< Whether the font's family is defined.
+ bool isWeightDefined : 1; ///< Whether the font's weight is defined.
+ bool isWidthDefined : 1; ///< Whether the font's width is defined.
+ bool isSlantDefined : 1; ///< Whether the font's slant is defined.
+ bool isSizeDefined : 1; ///< Whether the font's size is defined.
+
+ bool isLineSpacingDefined : 1; ///< Whether the line spacing is defined.
+ bool isUnderlineDefined : 1; ///< Whether the underline parameters are defined.
+ bool isShadowDefined : 1; ///< Whether the shadow parameters are defined.
+ bool isEmbossDefined : 1; ///< Whether the emboss parameters are defined.
+ bool isOutlineDefined : 1; ///< Whether the outline parameters are defined.
};
} // namespace Text
#define DALI_TOOLKIT_TEXT_LAYOUT_ENGINE_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDE
+#include <dali/public-api/actors/actor-enumerations.h>
#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/math/vector2.h>
-#include <dali/public-api/actors/actor-enumerations.h>
// INTERNAL INCLUDE
-#include <dali-toolkit/public-api/text/text-enumerations.h>
#include <dali-toolkit/internal/text/line-run.h>
#include <dali-toolkit/internal/text/metrics.h>
+#include <dali-toolkit/public-api/text/text-enumerations.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
namespace Layout
{
-
struct Parameters;
/**
class Engine
{
public:
-
enum Type
{
SINGLE_LINE_BOX,
*
* @param[in] metrics Used to get metrics
*/
- void SetMetrics( MetricsPtr& metrics );
+ void SetMetrics(MetricsPtr& metrics);
/**
* @brief Choose the required layout.
*
* @param[in] layout The required layout.
*/
- void SetLayout( Type layout );
+ void SetLayout(Type layout);
/**
* @brief Query the required layout.
*
* @param[in] width The width of the cursor in pixels.
*/
- void SetCursorWidth( int width );
+ void SetCursorWidth(int width);
/**
* @brief Retrieves the width of the cursor.
*
* @return \e true if the text has been re-laid-out. \e false means the given width is too small to layout even a single character.
*/
- bool LayoutText( Parameters& layoutParameters,
- Size& layoutSize,
- bool elideTextEnabled,
- bool& isAutoScrollEnabled );
+ bool LayoutText(Parameters& layoutParameters,
+ Size& layoutSize,
+ bool elideTextEnabled,
+ bool& isAutoScrollEnabled);
/**
* @brief Aligns the laid out lines.
* @param[in] layoutDirection The direction of the system language.
* @param[in] matchSystemLanguageDirection Whether match align for system language direction or not.
*/
- void Align( const Size& size,
- CharacterIndex startIndex,
- Length numberOfCharacters,
- Text::HorizontalAlignment::Type horizontalAlignment,
- Vector<LineRun>& lines,
- float& alignmentOffset,
- Dali::LayoutDirection::Type layoutDirection,
- bool matchSystemLanguageDirection );
+ void Align(const Size& size,
+ CharacterIndex startIndex,
+ Length numberOfCharacters,
+ Text::HorizontalAlignment::Type horizontalAlignment,
+ Vector<LineRun>& lines,
+ float& alignmentOffset,
+ Dali::LayoutDirection::Type layoutDirection,
+ bool matchSystemLanguageDirection);
/**
* @brief Sets the default line spacing.
*
* @param[in] lineSpacing The line spacing.
*/
- void SetDefaultLineSpacing( float lineSpacing );
+ void SetDefaultLineSpacing(float lineSpacing);
/**
* @brief Retrieves the default line spacing.
*
* @param[in] lineSize The line size.
*/
- void SetDefaultLineSize( float lineSize );
+ void SetDefaultLineSize(float lineSize);
/**
* @brief Retrieves the default line size.
float GetDefaultLineSize() const;
private:
-
// Undefined
- Engine( const Engine& handle );
+ Engine(const Engine& handle);
// Undefined
- Engine& operator=( const Engine& handle );
+ Engine& operator=(const Engine& handle);
private:
-
struct Impl;
Impl* mImpl;
};
#define DALI_TOOLKIT_TEXT_LAYOUT_PARAMETERS_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/math/vector2.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/text/text-enumerations.h>
#include <dali-toolkit/internal/text/text-definitions.h>
#include <dali-toolkit/internal/text/text-model.h>
+#include <dali-toolkit/public-api/text/text-enumerations.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
struct BidirectionalLineInfoRun;
namespace Layout
{
-
/**
* @brief Struct used to pass parameters.
*/
* @param[in] boundingBox The size of the box containing the text.
* @param[in,out] textModel The text's model.
*/
- Parameters( const Vector2& boundingBox,
- ModelPtr textModel )
- : boundingBox{ boundingBox },
- textModel{ textModel },
- lineBidirectionalInfoRunsBuffer{ nullptr },
- numberOfBidirectionalInfoRuns{ 0u },
- startGlyphIndex{ 0u },
- numberOfGlyphs{ 0u },
- startLineIndex{ 0u },
- estimatedNumberOfLines{ 0u },
- interGlyphExtraAdvance{ 0.f },
- isLastNewParagraph{ false }
- {}
+ Parameters(const Vector2& boundingBox,
+ ModelPtr textModel)
+ : boundingBox{boundingBox},
+ textModel{textModel},
+ lineBidirectionalInfoRunsBuffer{nullptr},
+ numberOfBidirectionalInfoRuns{0u},
+ startGlyphIndex{0u},
+ numberOfGlyphs{0u},
+ startLineIndex{0u},
+ estimatedNumberOfLines{0u},
+ interGlyphExtraAdvance{0.f},
+ isLastNewParagraph{false}
+ {
+ }
- Vector2 boundingBox; ///< The size of the box containing the text.
- ModelPtr textModel;
- BidirectionalLineInfoRun* lineBidirectionalInfoRunsBuffer; ///< Bidirectional conversion tables per line.
- Length numberOfBidirectionalInfoRuns; ///< The number of lines with bidirectional info.
- GlyphIndex startGlyphIndex; ///< Index to the first glyph to layout.
- Length numberOfGlyphs; ///< The number of glyphs to layout.
- LineIndex startLineIndex; ///< The line index where to insert the new lines.
- Length estimatedNumberOfLines; ///< The estimated number of lines.
- float interGlyphExtraAdvance; ///< Extra advance added to each glyph.
- bool isLastNewParagraph:1; ///< Whether the last character is a new paragraph character.
+ Vector2 boundingBox; ///< The size of the box containing the text.
+ ModelPtr textModel;
+ BidirectionalLineInfoRun* lineBidirectionalInfoRunsBuffer; ///< Bidirectional conversion tables per line.
+ Length numberOfBidirectionalInfoRuns; ///< The number of lines with bidirectional info.
+ GlyphIndex startGlyphIndex; ///< Index to the first glyph to layout.
+ Length numberOfGlyphs; ///< The number of glyphs to layout.
+ LineIndex startLineIndex; ///< The line index where to insert the new lines.
+ Length estimatedNumberOfLines; ///< The estimated number of lines.
+ float interGlyphExtraAdvance; ///< Extra advance added to each glyph.
+ bool isLastNewParagraph : 1; ///< Whether the last character is a new paragraph character.
};
} // namespace Layout
#define DALI_TOOLKIT_TEXT_LINE_RUN_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief LineRun
*/
float alignmentOffset; ///< The horizontal alignment offset.
float lineSpacing; ///< The line's spacing
CharacterDirection direction : 1; ///< Direction of the first character of the paragraph.
- bool ellipsis : 1; ///< Wheter ellipsis is added to the line.
+ bool ellipsis : 1; ///< Wheter ellipsis is added to the line.
};
} // namespace Text
#define DALI_TOOLKIT_TEXT_LOGICAL_MODEL_IMPL_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali-toolkit/internal/text/bidirectional-paragraph-info-run.h>
#include <dali-toolkit/internal/text/color-run.h>
#include <dali-toolkit/internal/text/embedded-item.h>
-#include <dali-toolkit/internal/text/font-run.h>
#include <dali-toolkit/internal/text/font-description-run.h>
+#include <dali-toolkit/internal/text/font-run.h>
#include <dali-toolkit/internal/text/paragraph-run.h>
#include <dali-toolkit/internal/text/script-run.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
class LogicalModel;
typedef IntrusivePtr<LogicalModel> LogicalModelPtr;
struct InputStyle;
class LogicalModel : public RefObject
{
public:
-
/**
* @brief Create a new instance of a LogicalModel.
*
*
* @return The character's script.
*/
- Script GetScript( CharacterIndex characterIndex ) const;
+ Script GetScript(CharacterIndex characterIndex) const;
// Bidirectional support interface.
*
* @return The character's direction.
*/
- CharacterDirection GetCharacterDirection( CharacterIndex characterIndex ) const;
+ CharacterDirection GetCharacterDirection(CharacterIndex characterIndex) const;
// Visual <--> Logical conversion tables.
*
* @return The logical cursor index.
*/
- CharacterIndex GetLogicalCursorIndex( CharacterIndex visualCursorIndex );
+ CharacterIndex GetLogicalCursorIndex(CharacterIndex visualCursorIndex);
/**
* @brief Retrieves the logical character index for the given visual character index.
*
* @return The logical character index.
*/
- CharacterIndex GetLogicalCharacterIndex( CharacterIndex visualCharacterIndex );
+ CharacterIndex GetLogicalCharacterIndex(CharacterIndex visualCharacterIndex);
/**
* @brief Fetch the bidirectional line info for the given character.
*
* @return @e true if the given @e character is in a bidirectional line.
*/
- bool FetchBidirectionalLineInfo( CharacterIndex characterIndex );
+ bool FetchBidirectionalLineInfo(CharacterIndex characterIndex);
/**
* @brief Retrieves the last fetched bidirectional line info.
* @param[in] index The character's index.
* @param[in] numberOfCharacters The number of characters added or removed. If the value is negative the characters are removed.
*/
- void UpdateTextStyleRuns( CharacterIndex index, int numberOfCharacters );
+ void UpdateTextStyleRuns(CharacterIndex index, int numberOfCharacters);
/**
* @brief Retrieves the text's style for the given character index.
* @param[in] index The character index.
* @param[out] style The text's style in the given style.
*/
- void RetrieveStyle( CharacterIndex index, InputStyle& style );
+ void RetrieveStyle(CharacterIndex index, InputStyle& style);
/**
* @brief Clears the font description runs.
* @param[in] startIndex The character from where the paragraph info is set.
* @param[in] numberOfCharacters The number of characters.
*/
- void CreateParagraphInfo( CharacterIndex startIndex,
- Length numberOfCharacters );
+ void CreateParagraphInfo(CharacterIndex startIndex,
+ Length numberOfCharacters);
/**
* @brief Find the paragraphs which contains the given characters.
* @param[in] numberOfCharacters The number of characters of the run.
* @param[out] paragraphs Indices to the paragraphs which contain the characters.
*/
- void FindParagraphs( CharacterIndex index,
- Length numberOfCharacters,
- Vector<ParagraphRunIndex>& paragraphs );
+ void FindParagraphs(CharacterIndex index,
+ Length numberOfCharacters,
+ Vector<ParagraphRunIndex>& paragraphs);
// Embedded images
void ClearEmbeddedImages();
protected:
-
/**
* @brief A reference counted object may only be deleted by calling Unreference().
*/
virtual ~LogicalModel();
private:
-
/**
* @brief Private constructor.
*/
LogicalModel();
// Undefined
- LogicalModel( const LogicalModel& handle );
+ LogicalModel(const LogicalModel& handle);
// Undefined
- LogicalModel& operator=( const LogicalModel& handle );
+ LogicalModel& operator=(const LogicalModel& handle);
public:
-
Vector<Character> mText;
Vector<ScriptRun> mScriptRuns;
Vector<FontRun> mFontRuns;
Vector<LineBreakInfo> mLineBreakInfo;
Vector<ParagraphRun> mParagraphInfo;
Vector<BidirectionalParagraphInfoRun> mBidirectionalParagraphInfo;
- Vector<CharacterDirection> mCharacterDirections; ///< For each character, whether is right to left. ( @e flase is left to right, @e true right to left ).
+ Vector<CharacterDirection> mCharacterDirections; ///< For each character, whether is right to left. ( @e flase is left to right, @e true right to left ).
Vector<BidirectionalLineInfoRun> mBidirectionalLineInfo;
Vector<EmbeddedItem> mEmbeddedItems;
- BidirectionalLineRunIndex mBidirectionalLineIndex; ///< The last fetched bidirectional line info.
+ BidirectionalLineRunIndex mBidirectionalLineIndex; ///< The last fetched bidirectional line info.
};
} // namespace Text
#define DALI_TOOLKIT_TEXT_MARKUP_PROCESSOR_COLOR_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
struct Tag;
struct ColorRun;
* @param[in] tag The color tag and its attributes.
* @param[in,out] colorRun The color run.
*/
-void ProcessColorTag( const Tag& tag, ColorRun& colorRun );
+void ProcessColorTag(const Tag& tag, ColorRun& colorRun);
} // namespace Text
#define DALI_TOOLKIT_TEXT_MARKUP_PROCESSOR_EMBEDDED_ITEM_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
struct Tag;
struct EmbeddedItem;
* @param[in] tag The embedded item tag and its attributes.
* @param[in,out] embeddedItem The embedded item.
*/
-void ProcessEmbeddedItem( const Tag& tag, EmbeddedItem& embeddedItem );
+void ProcessEmbeddedItem(const Tag& tag, EmbeddedItem& embeddedItem);
} // namespace Text
#define DALI_TOOLKIT_TEXT_MARKUP_PROCESSOR_FONT_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
struct Tag;
struct FontDescriptionRun;
* @param[in] tag The font tag and its attributes.
* @param[in,out] fontRun The font description run.
*/
-void ProcessFontTag( const Tag& tag, FontDescriptionRun& fontRun );
+void ProcessFontTag(const Tag& tag, FontDescriptionRun& fontRun);
} // namespace Text
#define DALI_TOOLKIT_TEXT_MARKUP_PROCESSOR_HELPER_FUNCTIONS_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
struct Vector2;
struct Vector4;
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief Stores an attribute pair: name, value.
*/
{
const char* nameBuffer;
const char* valueBuffer;
- Length nameLength;
- Length valueLength;
+ Length nameLength;
+ Length valueLength;
};
/**
* @brief Stores a tag and its attributes.
*/
- struct Tag
- {
- Vector<Attribute> attributes;
- const char* buffer;
- Length length;
- bool isEndTag;
- };
+struct Tag
+{
+ Vector<Attribute> attributes;
+ const char* buffer;
+ Length length;
+ bool isEndTag;
+};
/**
* @brief Compare if two tokens are equal.
*
* @return @e true if both strings are equal.
*/
-bool TokenComparison( const std::string& string1, const char* const stringBuffer2, Length length );
+bool TokenComparison(const std::string& string1, const char* const stringBuffer2, Length length);
/**
* @brief Skips any unnecessary white space.
* @param[in,out] stringBuffer The string buffer. It's a const iterator pointing the current character.
* @param[in] stringEndBuffer Pointer to one character after the end of the string buffer.
*/
-void SkipWhiteSpace( const char*& stringBuffer,
- const char* const stringEndBuffer );
+void SkipWhiteSpace(const char*& stringBuffer,
+ const char* const stringEndBuffer);
/**
* @Brief Jumps to the next white space.
* @param[in,out] stringBuffer The string buffer. It's a const iterator pointing the current character.
* @param[in] stringEndBuffer Pointer to one character after the end of the string buffer.
*/
-void JumpToWhiteSpace( const char*& stringBuffer,
- const char* const stringEndBuffer );
+void JumpToWhiteSpace(const char*& stringBuffer,
+ const char* const stringEndBuffer);
/**
* @brief Converts a string into an unsigned int.
*
* @return The unsigned int value.
*/
-unsigned int StringToUint( const char* const uintStr );
+unsigned int StringToUint(const char* const uintStr);
/**
* @brief Converts a string into an hexadecimal unsigned int.
*
* @return The hexadecimal value.
*/
-unsigned int StringToHex( const char* const uintStr );
+unsigned int StringToHex(const char* const uintStr);
/**
* @brief Converts a string into a float value.
*
* @return The float value.
*/
-float StringToFloat( const char* const floatStr );
+float StringToFloat(const char* const floatStr);
/**
* @brief Converts a float into a string.
* @param[in] value The float value.
* @param[out] floatStr The string.
*/
-void FloatToString( float value, std::string& floatStr );
+void FloatToString(float value, std::string& floatStr);
/**
* @brief Converts an unsigned int into a string.
* @param[in] value The unsigned int value.
* @param[out] uIntStr The string.
*/
-void UintToString( unsigned int value, std::string& uIntStr );
+void UintToString(unsigned int value, std::string& uIntStr);
/**
* @brief Converts an ARGB color packed in 4 byte unsigned int into a Vector4 color used in Dali.
* @param[in] color An ARGB color packed in an unsigned int.
* @param[out] retColor A Vector4 with the converted color.
*/
-void UintColorToVector4( unsigned int color, Vector4& retColor );
+void UintColorToVector4(unsigned int color, Vector4& retColor);
/**
* @brief Converts a color packed inside a string into an ARGB Vector4 color.
* @param[in] length The length of the color string.
* @param[out] retColor A color packed inside a Vector4.
*/
-void ColorStringToVector4( const char* const colorStr, Length length, Vector4& retColor );
+void ColorStringToVector4(const char* const colorStr, Length length, Vector4& retColor);
/**
* @brief Converts a color packed in a Vector4 into a string.
* @param[in] value The color value.
* @param[out] colorStr The string.
*/
-void Vector4ToColorString( const Vector4& value, std::string& vector2Str );
+void Vector4ToColorString(const Vector4& value, std::string& vector2Str);
/**
* @brief Converts a two dimension vector packed inside a string into a Vector2.
* @param[in] length The length of the string.
* @param[out] vector2 The Vector2.
*/
-void StringToVector2( const char* const vectorStr, Length length, Vector2& vector2 );
+void StringToVector2(const char* const vectorStr, Length length, Vector2& vector2);
/**
* @brief Converts a Vector2 into a string.
* @param[in] value The vector2 value.
* @param[out] vector2Str The string.
*/
-void Vector2ToString( const Vector2& value, std::string& vector2Str );
+void Vector2ToString(const Vector2& value, std::string& vector2Str);
} // namespace Text
#define DALI_TOOLKIT_TEXT_MARKUP_PROCESSOR_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief Keeps the plain text and references to vectors from the model which stores runs with text styles.
*/
struct MarkupProcessData
{
-MarkupProcessData( Vector<ColorRun>& colorRuns,
- Vector<FontDescriptionRun>& fontRuns,
- Vector<EmbeddedItem>& items )
- : colorRuns( colorRuns ),
- fontRuns( fontRuns ),
+ MarkupProcessData(Vector<ColorRun>& colorRuns,
+ Vector<FontDescriptionRun>& fontRuns,
+ Vector<EmbeddedItem>& items)
+ : colorRuns(colorRuns),
+ fontRuns(fontRuns),
items(items),
markupProcessedText()
- {}
+ {
+ }
Vector<ColorRun>& colorRuns; ///< The color runs.
Vector<FontDescriptionRun>& fontRuns; ///< The font description runs.
* @param[in] markupString The mark-up string.
* @param[out] markupProcessData The plain text and the style.
*/
-void ProcessMarkupString( const std::string& markupString, MarkupProcessData& markupProcessData );
+void ProcessMarkupString(const std::string& markupString, MarkupProcessData& markupProcessData);
} // namespace Text
#define DALI_TOOLKIT_TEXT_METRICS_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/common/intrusive-ptr.h>
#include <dali/devel-api/text-abstraction/font-client.h>
+#include <dali/public-api/common/intrusive-ptr.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/text/text-definitions.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
class Metrics;
typedef IntrusivePtr<Metrics> MetricsPtr;
class Metrics : public RefObject
{
public:
-
/**
* Create a new Metrics object
*/
- static Metrics* New( TextAbstraction::FontClient& fontClient )
+ static Metrics* New(TextAbstraction::FontClient& fontClient)
{
- return new Metrics( fontClient );
+ return new Metrics(fontClient);
}
/**
*
* @param[in] glyphType The type of glyph; note that metrics for bitmap & vector based glyphs are different.
*/
- void SetGlyphType( TextAbstraction::GlyphType glyphType )
+ void SetGlyphType(TextAbstraction::GlyphType glyphType)
{
mGlyphType = glyphType;
}
* @param[in] fontId The ID of the font for the required glyph.
* @param[out] metrics The font metrics.
*/
- void GetFontMetrics( FontId fontId, FontMetrics& metrics )
+ void GetFontMetrics(FontId fontId, FontMetrics& metrics)
{
- mFontClient.GetFontMetrics( fontId, metrics ); // inline for performance
+ mFontClient.GetFontMetrics(fontId, metrics); // inline for performance
}
/**
* @param[in] size The size of the array.
* @return True if all of the requested metrics were found.
*/
- bool GetGlyphMetrics( GlyphInfo* array, uint32_t size )
+ bool GetGlyphMetrics(GlyphInfo* array, uint32_t size)
{
- return mFontClient.GetGlyphMetrics( array, size, mGlyphType, true ); // inline for performance
+ return mFontClient.GetGlyphMetrics(array, size, mGlyphType, true); // inline for performance
}
/**
*
* @return true if the font has italic style.
*/
- bool HasItalicStyle( FontId fontId ) const
+ bool HasItalicStyle(FontId fontId) const
{
- return mFontClient.HasItalicStyle( fontId );
+ return mFontClient.HasItalicStyle(fontId);
}
protected:
-
/**
* A reference counted object may only be deleted by calling Unreference()
*/
- virtual ~Metrics() {}
+ virtual ~Metrics()
+ {
+ }
private:
-
/**
* Constructor.
*/
- Metrics( TextAbstraction::FontClient& fontClient )
- : mFontClient( fontClient ),
- mGlyphType( TextAbstraction::BITMAP_GLYPH )
- {}
+ Metrics(TextAbstraction::FontClient& fontClient)
+ : mFontClient(fontClient),
+ mGlyphType(TextAbstraction::BITMAP_GLYPH)
+ {
+ }
// Undefined
Metrics(const Metrics&);
Metrics& operator=(const Metrics& rhs);
private:
-
TextAbstraction::FontClient mFontClient;
- TextAbstraction::GlyphType mGlyphType;
+ TextAbstraction::GlyphType mGlyphType;
};
} // namespace Text
#define DALI_TOOLKIT_TEXT_MULTI_LANGUAGE_HELPER_FUNCTIONS_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief Merges font's descriptions to retrieve the combined font's description for a given character.
*
* @param[out] fontPointSize The font's point size for the character.
* @param[out] isDefaultFont Whether the font is a default one.
*/
-void MergeFontDescriptions( const Vector<FontDescriptionRun>& fontDescriptions,
- const TextAbstraction::FontDescription& defaultFontDescription,
- TextAbstraction::PointSize26Dot6 defaultPointSize,
- CharacterIndex characterIndex,
- TextAbstraction::FontDescription& fontDescription,
- TextAbstraction::PointSize26Dot6& fontPointSize,
- bool& isDefaultFont );
+void MergeFontDescriptions(const Vector<FontDescriptionRun>& fontDescriptions,
+ const TextAbstraction::FontDescription& defaultFontDescription,
+ TextAbstraction::PointSize26Dot6 defaultPointSize,
+ CharacterIndex characterIndex,
+ TextAbstraction::FontDescription& fontDescription,
+ TextAbstraction::PointSize26Dot6& fontPointSize,
+ bool& isDefaultFont);
/**
* @brief Retrieves the script Id from the script run for a given character's @p index.
*
* @return The script.
*/
-Script GetScript( Length index,
- Vector<ScriptRun>::ConstIterator& scriptRunIt,
- const Vector<ScriptRun>::ConstIterator& scriptRunEndIt );
+Script GetScript(Length index,
+ Vector<ScriptRun>::ConstIterator& scriptRunIt,
+ const Vector<ScriptRun>::ConstIterator& scriptRunEndIt);
} // namespace Text
#define DALI_TOOLKIT_TEXT_MULTI_LANGUAGE_SUPPORT_IMPL_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace TextAbstraction
{
//Forward declaration
class FontClient;
-}
+} // namespace TextAbstraction
namespace Toolkit
{
-
namespace Text
{
-
namespace Internal
{
-
/**
* @brief Stores valid font ids per script.
*/
*/
ValidateFontsPerScript()
: mValidFonts()
- {}
+ {
+ }
/**
* Default destructor.
*/
~ValidateFontsPerScript()
- {}
+ {
+ }
/**
* @brief Whether the given @p fontId is in the vector of valid fonts.
*
* @return @e true if the font is in the vector of valid fonts.
*/
- bool IsValidFont( FontId fontId ) const;
+ bool IsValidFont(FontId fontId) const;
Vector<FontId> mValidFonts;
};
struct CacheItem
{
TextAbstraction::FontDescription description;
- FontId fontId;
+ FontId fontId;
};
/**
*/
DefaultFonts()
: mFonts()
- {}
+ {
+ }
/**
* Default destructor.
*/
~DefaultFonts()
- {}
+ {
+ }
/**
* @brief Finds a default font for the given @p size.
*
* @return The font id of a default font for the given @p size. If there isn't any font cached it returns 0.
*/
- FontId FindFont( TextAbstraction::FontClient& fontClient,
- const TextAbstraction::FontDescription& description,
- PointSize26Dot6 size ) const;
+ FontId FindFont(TextAbstraction::FontClient& fontClient,
+ const TextAbstraction::FontDescription& description,
+ PointSize26Dot6 size) const;
- void Cache( const TextAbstraction::FontDescription& description, FontId fontId );
+ void Cache(const TextAbstraction::FontDescription& description, FontId fontId);
std::vector<CacheItem> mFonts;
};
class MultilanguageSupport : public BaseObject
{
public:
-
/**
* Constructor
*/
/**
* @copydoc Dali::MultilanguageSupport::SetScripts()
*/
- void SetScripts( const Vector<Character>& text,
- CharacterIndex startIndex,
- Length numberOfCharacters,
- Vector<ScriptRun>& scripts );
+ void SetScripts(const Vector<Character>& text,
+ CharacterIndex startIndex,
+ Length numberOfCharacters,
+ Vector<ScriptRun>& scripts);
/**
* @copydoc Dali::MultilanguageSupport::ValidateFonts()
*/
- void ValidateFonts( const Vector<Character>& text,
- const Vector<ScriptRun>& scripts,
- const Vector<FontDescriptionRun>& fontDescriptions,
- const TextAbstraction::FontDescription& defaultFontDescription,
- TextAbstraction::PointSize26Dot6 defaultFontPointSize,
- CharacterIndex startIndex,
- Length numberOfCharacters,
- Vector<FontRun>& fonts );
+ void ValidateFonts(const Vector<Character>& text,
+ const Vector<ScriptRun>& scripts,
+ const Vector<FontDescriptionRun>& fontDescriptions,
+ const TextAbstraction::FontDescription& defaultFontDescription,
+ TextAbstraction::PointSize26Dot6 defaultFontPointSize,
+ CharacterIndex startIndex,
+ Length numberOfCharacters,
+ Vector<FontRun>& fonts);
private:
Vector<DefaultFonts*> mDefaultFontPerScriptCache; ///< Caches default fonts for a script.
} // namespace Internal
-inline static Internal::MultilanguageSupport& GetImplementation( MultilanguageSupport& multilanguageSupport )
+inline static Internal::MultilanguageSupport& GetImplementation(MultilanguageSupport& multilanguageSupport)
{
- DALI_ASSERT_ALWAYS( multilanguageSupport && "multi-language handle is empty" );
+ DALI_ASSERT_ALWAYS(multilanguageSupport && "multi-language handle is empty");
BaseObject& handle = multilanguageSupport.GetBaseObject();
- return static_cast<Internal::MultilanguageSupport&>( handle );
+ return static_cast<Internal::MultilanguageSupport&>(handle);
}
-inline static const Internal::MultilanguageSupport& GetImplementation( const MultilanguageSupport& multilanguageSupport )
+inline static const Internal::MultilanguageSupport& GetImplementation(const MultilanguageSupport& multilanguageSupport)
{
- DALI_ASSERT_ALWAYS( multilanguageSupport && "multi-language handle is empty" );
+ DALI_ASSERT_ALWAYS(multilanguageSupport && "multi-language handle is empty");
const BaseObject& handle = multilanguageSupport.GetBaseObject();
- return static_cast<const Internal::MultilanguageSupport&>( handle );
+ return static_cast<const Internal::MultilanguageSupport&>(handle);
}
} // namespace Text
#define DALI_TOOLKIT_TEXT_MULTI_LANGUAGE_SUPPORT_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/object/base-handle.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/internal/text/font-run.h>
#include <dali-toolkit/internal/text/font-description-run.h>
+#include <dali-toolkit/internal/text/font-run.h>
#include <dali-toolkit/internal/text/script-run.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
namespace Internal DALI_INTERNAL
{
-
class MultilanguageSupport;
-} // Internal
+} // namespace DALI_INTERNAL
/**
* @brief Sets the character's scripts to the model and validates the fonts set by the user or assigns default ones.
class MultilanguageSupport : public BaseHandle
{
public:
-
/**
* @brief Create an uninitialized MultilanguageSupport handle.
*/
*
* @param[in] implementation A pointer to the internal multi-language support object.
*/
- explicit DALI_INTERNAL MultilanguageSupport( Internal::MultilanguageSupport* implementation );
+ explicit DALI_INTERNAL MultilanguageSupport(Internal::MultilanguageSupport* implementation);
/**
* @brief Retrieve a handle to the MultilanguageSupport instance.
* @param[in] numberOfCharacters The number of characters to set the script.
* @param[out] scripts Vector containing the script runs for the whole text.
*/
- void SetScripts( const Vector<Character>& text,
- CharacterIndex startIndex,
- Length numberOfCharacters,
- Vector<ScriptRun>& scripts );
+ void SetScripts(const Vector<Character>& text,
+ CharacterIndex startIndex,
+ Length numberOfCharacters,
+ Vector<ScriptRun>& scripts);
/**
* @brief Validates the character's font of the whole text.
* @param[in] numberOfCharacters The number of characters to set the font.
* @param[out] fonts The validated fonts.
*/
- void ValidateFonts( const Vector<Character>& text,
- const Vector<ScriptRun>& scripts,
- const Vector<FontDescriptionRun>& fontDescriptions,
- const TextAbstraction::FontDescription& defaultFontDescription,
- TextAbstraction::PointSize26Dot6 defaultFontPointSize,
- CharacterIndex startIndex,
- Length numberOfCharacters,
- Vector<FontRun>& fonts );
+ void ValidateFonts(const Vector<Character>& text,
+ const Vector<ScriptRun>& scripts,
+ const Vector<FontDescriptionRun>& fontDescriptions,
+ const TextAbstraction::FontDescription& defaultFontDescription,
+ TextAbstraction::PointSize26Dot6 defaultFontPointSize,
+ CharacterIndex startIndex,
+ Length numberOfCharacters,
+ Vector<FontRun>& fonts);
};
} // namespace Text
#define DALI_TOOLKIT_TEXT_PARAGRAPH_RUN_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief ParagraphRun
*
*/
struct ParagraphRun
{
- CharacterRun characterRun; ///< The initial character index within the whole text and the number of characters of the run.
- Size layoutSize; ///< The size of the paragraph when is laid-out.
+ CharacterRun characterRun; ///< The initial character index within the whole text and the number of characters of the run.
+ Size layoutSize; ///< The size of the paragraph when is laid-out.
};
} // namespace Text
#define DALI_TOOLKIT_PROPERTY_STRING_PARSER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
// Forward declaration
struct Vector2;
namespace Toolkit
{
-
// Forward declaration
class TreeNode;
namespace Text
{
-
/**
* @brief Creates a map with pairs 'key,value' with the property's parameters.
*
* @param[out] map A map with the property's parameters.
*
*/
-void CreatePropertyMap( const TreeNode* const node, Property::Map& map );
+void CreatePropertyMap(const TreeNode* const node, Property::Map& map);
/**
* @brief Parses a property string.
* @param[out] map A map with the property's parameters.
*
*/
-void ParsePropertyString( const std::string& property, Property::Map& map );
+void ParsePropertyString(const std::string& property, Property::Map& map);
} //namespace Text
#define DALI_TOOLKIT_ATLAS_GLYPH_MANAGER_IMPL_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
-
// EXTERNAL INCLUDES
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/object/base-object.h>
namespace Dali
{
-
namespace Toolkit
{
-
class AtlasGlyphManager;
} // namespace Toolkit
namespace Toolkit
{
-
namespace Internal
{
-
class AtlasGlyphManager;
typedef IntrusivePtr<AtlasGlyphManager> AtlasGlyphManagerPtr;
class AtlasGlyphManager : public Dali::BaseObject
{
public:
-
struct GlyphRecordEntry
{
Text::GlyphIndex mIndex;
- uint32_t mImageId;
- int32_t mCount;
- uint16_t mOutlineWidth;
- bool isItalic:1;
- bool isBold:1;
+ uint32_t mImageId;
+ int32_t mCount;
+ uint16_t mOutlineWidth;
+ bool isItalic : 1;
+ bool isBold : 1;
};
struct FontGlyphRecord
{
- Text::FontId mFontId;
- Vector< GlyphRecordEntry > mGlyphRecords;
+ Text::FontId mFontId;
+ Vector<GlyphRecordEntry> mGlyphRecords;
};
/**
/**
* @copydoc Toolkit::AtlasGlyphManager::Add
*/
- void Add( const Text::GlyphInfo& glyph,
- const Toolkit::AtlasGlyphManager::GlyphStyle& style,
- const PixelData& bitmap,
- Dali::Toolkit::AtlasManager::AtlasSlot& slot );
+ void Add(const Text::GlyphInfo& glyph,
+ const Toolkit::AtlasGlyphManager::GlyphStyle& style,
+ const PixelData& bitmap,
+ Dali::Toolkit::AtlasManager::AtlasSlot& slot);
/**
* @copydoc Toolkit::AtlasGlyphManager::GenerateMeshData
*/
- void GenerateMeshData( uint32_t imageId,
- const Vector2& position,
- Toolkit::AtlasManager::Mesh2D& mesh );
+ void GenerateMeshData(uint32_t imageId,
+ const Vector2& position,
+ Toolkit::AtlasManager::Mesh2D& mesh);
/**
* @copydoc Toolkit::AtlasGlyphManager::IsCached
*/
- bool IsCached( Text::FontId fontId,
- Text::GlyphIndex index,
- const Toolkit::AtlasGlyphManager::GlyphStyle& style,
- Dali::Toolkit::AtlasManager::AtlasSlot& slot );
+ bool IsCached(Text::FontId fontId,
+ Text::GlyphIndex index,
+ const Toolkit::AtlasGlyphManager::GlyphStyle& style,
+ Dali::Toolkit::AtlasManager::AtlasSlot& slot);
/**
* @copydoc Toolkit::AtlasGlyphManager::GetAtlasSize
*/
- Vector2 GetAtlasSize( uint32_t atlasId );
+ Vector2 GetAtlasSize(uint32_t atlasId);
/**
* @copydoc Toolkit::AtlasGlyphManager::SetNewAtlasSize
*/
- void SetNewAtlasSize( uint32_t width, uint32_t height, uint32_t blockWidth, uint32_t blockHeight );
+ void SetNewAtlasSize(uint32_t width, uint32_t height, uint32_t blockWidth, uint32_t blockHeight);
/**
* @copydoc Toolkit::AtlasGlyphManager::GetPixelFormat
*/
- Pixel::Format GetPixelFormat( uint32_t atlasId );
+ Pixel::Format GetPixelFormat(uint32_t atlasId);
/**
* @copydoc toolkit::AtlasGlyphManager::AdjustReferenceCount
*/
- void AdjustReferenceCount( Text::FontId fontId, Text::GlyphIndex index, const Toolkit::AtlasGlyphManager::GlyphStyle& style, int32_t delta );
+ void AdjustReferenceCount(Text::FontId fontId, Text::GlyphIndex index, const Toolkit::AtlasGlyphManager::GlyphStyle& style, int32_t delta);
/**
* @copydoc Toolkit::AtlasGlyphManager::GetTextures
*/
- TextureSet GetTextures( uint32_t atlasId ) const;
+ TextureSet GetTextures(uint32_t atlasId) const;
/**
* @copydoc Toolkit::AtlasGlyphManager::GetMetrics
const Toolkit::AtlasGlyphManager::Metrics& GetMetrics();
protected:
-
/**
* A reference counted object may only be deleted by calling Unreference()
*/
virtual ~AtlasGlyphManager();
private:
-
- Dali::Toolkit::AtlasManager mAtlasManager; ///> Atlas Manager created by GlyphManager
- std::vector< FontGlyphRecord > mFontGlyphRecords;
- Toolkit::AtlasGlyphManager::Metrics mMetrics; ///> Metrics to pass back on GlyphManager status
- Sampler mSampler;
+ Dali::Toolkit::AtlasManager mAtlasManager; ///> Atlas Manager created by GlyphManager
+ std::vector<FontGlyphRecord> mFontGlyphRecords;
+ Toolkit::AtlasGlyphManager::Metrics mMetrics; ///> Metrics to pass back on GlyphManager status
+ Sampler mSampler;
};
} // namespace Internal
inline const Internal::AtlasGlyphManager& GetImplementation(const Toolkit::AtlasGlyphManager& manager)
{
- DALI_ASSERT_ALWAYS( manager && "AtlasGlyphManager handle is empty" );
+ DALI_ASSERT_ALWAYS(manager && "AtlasGlyphManager handle is empty");
const BaseObject& handle = manager.GetBaseObject();
inline Internal::AtlasGlyphManager& GetImplementation(Toolkit::AtlasGlyphManager& manager)
{
- DALI_ASSERT_ALWAYS( manager && "AtlasGlyphManager handle is empty" );
+ DALI_ASSERT_ALWAYS(manager && "AtlasGlyphManager handle is empty");
BaseObject& handle = manager.GetBaseObject();
#define DALI_TOOLKIT_ATLAS_GLYPH_MANAGER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal DALI_INTERNAL
{
class AtlasGlyphManager;
}
-
class AtlasGlyphManager : public BaseHandle
{
public:
-
/**
* Description of GlyphManager state
*/
struct Metrics
{
Metrics()
- : mGlyphCount( 0u )
- {}
+ : mGlyphCount(0u)
+ {
+ }
~Metrics()
- {}
+ {
+ }
- uint32_t mGlyphCount; ///< number of glyphs being managed
- std::string mVerboseGlyphCounts; ///< a verbose list of the glyphs + ref counts
- AtlasManager::Metrics mAtlasMetrics; ///< metrics from the Atlas Manager
+ uint32_t mGlyphCount; ///< number of glyphs being managed
+ std::string mVerboseGlyphCounts; ///< a verbose list of the glyphs + ref counts
+ AtlasManager::Metrics mAtlasMetrics; ///< metrics from the Atlas Manager
};
struct GlyphStyle
{
GlyphStyle()
- : outline{ 0u },
- isItalic{ false },
- isBold{ false }
- {}
-
- uint16_t outline; ///< The outline width of this glyph
- bool isItalic:1; ///< Whether the glyph is italic.
- bool isBold:1; ///< Whether the glyph is bold.
+ : outline{0u},
+ isItalic{false},
+ isBold{false}
+ {
+ }
+
+ uint16_t outline; ///< The outline width of this glyph
+ bool isItalic : 1; ///< Whether the glyph is italic.
+ bool isBold : 1; ///< Whether the glyph is bold.
};
/**
* @param[in] bitmap bitmap to use for glyph addition
* @param[out] slot information returned by atlas manager for addition
*/
- void Add( const Text::GlyphInfo& glyph,
- const GlyphStyle& style,
- const PixelData& bitmap,
- AtlasManager::AtlasSlot& slot );
+ void Add(const Text::GlyphInfo& glyph,
+ const GlyphStyle& style,
+ const PixelData& bitmap,
+ AtlasManager::AtlasSlot& slot);
/**
* @brief Generate mesh data for an image contained in an atlas
* @param[in] position top left of image
* @param[out] meshData generated MeshData
*/
- void GenerateMeshData( uint32_t imageId,
- const Vector2& position,
- Toolkit::AtlasManager::Mesh2D& mesh );
+ void GenerateMeshData(uint32_t imageId,
+ const Vector2& position,
+ Toolkit::AtlasManager::Mesh2D& mesh);
/**
* @brief Check to see if a glyph is being cached
*
* @return Whether glyph is cached or not ?
*/
- bool IsCached( Text::FontId fontId,
- Text::GlyphIndex index,
- const GlyphStyle& style,
- AtlasManager::AtlasSlot& slot );
+ bool IsCached(Text::FontId fontId,
+ Text::GlyphIndex index,
+ const GlyphStyle& style,
+ AtlasManager::AtlasSlot& slot);
/**
* @brief Retrieve the size of an atlas
*
* @return The pixel size of the atlas
*/
- Vector2 GetAtlasSize( uint32_t atlasId );
+ Vector2 GetAtlasSize(uint32_t atlasId);
- /**
+ /**
* @brief Set the atlas size and block size for subsequent Atlas generation
*
* @param[in] width width of atlas in pixels
* @param[in] blockWidth width of a block in pixels
* @param[in] blockHeight height of a block in pixels
*/
- void SetNewAtlasSize( uint32_t width, uint32_t height, uint32_t blockWidth, uint32_t blockHeight );
+ void SetNewAtlasSize(uint32_t width, uint32_t height, uint32_t blockWidth, uint32_t blockHeight);
/**
* @brief Get the Pixel Format used by an atlas
*
* @return The pixel format of the atlas
*/
- Pixel::Format GetPixelFormat( uint32_t atlasId );
+ Pixel::Format GetPixelFormat(uint32_t atlasId);
/**
* @brief Get the texture set used by an atlas
*
* @return The texture set used by the atlas
*/
- TextureSet GetTextures( uint32_t atlasId ) const;
+ TextureSet GetTextures(uint32_t atlasId) const;
/**
* @brief Get Glyph Manager metrics
* @param[in] style The style of this glyph
* @param[in] delta The adjustment to make to the reference count
*/
- void AdjustReferenceCount( Text::FontId fontId, Text::GlyphIndex index, const GlyphStyle& style, int32_t delta );
+ void AdjustReferenceCount(Text::FontId fontId, Text::GlyphIndex index, const GlyphStyle& style, int32_t delta);
private:
-
- explicit DALI_INTERNAL AtlasGlyphManager(Internal::AtlasGlyphManager *impl);
-
+ explicit DALI_INTERNAL AtlasGlyphManager(Internal::AtlasGlyphManager* impl);
};
} // namespace Toolkit
#define DALI_TOOLKIT_ATLAS_MANAGER_IMPL_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
-
// EXTERNAL INCLUDES
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/object/base-object.h>
namespace Dali
{
-
namespace Toolkit
{
-
class AtlasManager;
} // namespace Toolkit
namespace Toolkit
{
-
namespace Internal
{
-
-typedef Dali::Vector< Toolkit::AtlasManager::AtlasSlot > slotContainer;
+typedef Dali::Vector<Toolkit::AtlasManager::AtlasSlot> slotContainer;
class AtlasManager;
typedef IntrusivePtr<AtlasManager> AtlasManagerPtr;
class AtlasManager : public Dali::BaseObject
{
public:
-
typedef uint32_t SizeType;
typedef SizeType AtlasId;
typedef SizeType ImageId;
*/
struct AtlasDescriptor
{
- Dali::Texture mAtlas; // atlas image
- Toolkit::AtlasManager::AtlasSize mSize; // size of atlas
- Pixel::Format mPixelFormat; // pixel format used by atlas
- PixelData mHorizontalStrip; // Image used to pad upload
- PixelData mVerticalStrip; // Image used to pad upload
- TextureSet mTextureSet; // Texture set used for atlas texture
- SizeType mTotalBlocks; // total number of blocks in atlas
- SizeType mAvailableBlocks; // number of blocks available in atlas
- Dali::Vector< SizeType > mFreeBlocksList; // unless there are any previously freed blocks
+ Dali::Texture mAtlas; // atlas image
+ Toolkit::AtlasManager::AtlasSize mSize; // size of atlas
+ Pixel::Format mPixelFormat; // pixel format used by atlas
+ PixelData mHorizontalStrip; // Image used to pad upload
+ PixelData mVerticalStrip; // Image used to pad upload
+ TextureSet mTextureSet; // Texture set used for atlas texture
+ SizeType mTotalBlocks; // total number of blocks in atlas
+ SizeType mAvailableBlocks; // number of blocks available in atlas
+ Dali::Vector<SizeType> mFreeBlocksList; // unless there are any previously freed blocks
};
struct AtlasSlotDescriptor
{
- SizeType mCount; // Reference count for this slot
- SizeType mImageWidth; // Width of image stored
- SizeType mImageHeight; // Height of image stored
- AtlasId mAtlasId; // Image is stored in this Atlas
- SizeType mBlock; // Block within atlas used for image
+ SizeType mCount; // Reference count for this slot
+ SizeType mImageWidth; // Width of image stored
+ SizeType mImageHeight; // Height of image stored
+ AtlasId mAtlasId; // Image is stored in this Atlas
+ SizeType mBlock; // Block within atlas used for image
};
AtlasManager();
/**
* @copydoc: Toolkit::AtlasManager::CreateAtlas
*/
- AtlasId CreateAtlas( const Toolkit::AtlasManager::AtlasSize& size, Pixel::Format pixelformat );
+ AtlasId CreateAtlas(const Toolkit::AtlasManager::AtlasSize& size, Pixel::Format pixelformat);
/**
* @copydoc Toolkit::AtlasManager::SetAddPolicy
*/
- void SetAddPolicy( Toolkit::AtlasManager::AddFailPolicy policy );
+ void SetAddPolicy(Toolkit::AtlasManager::AddFailPolicy policy);
/**
* @copydoc Toolkit::AtlasManager::Add
*/
- bool Add( const PixelData& image,
- Toolkit::AtlasManager::AtlasSlot& slot,
- Toolkit::AtlasManager::AtlasId atlas );
+ bool Add(const PixelData& image,
+ Toolkit::AtlasManager::AtlasSlot& slot,
+ Toolkit::AtlasManager::AtlasId atlas);
/**
* @copydoc Toolkit::AtlasManager::GenerateMeshData
*/
- void GenerateMeshData( ImageId id,
- const Vector2& position,
- Toolkit::AtlasManager::Mesh2D& mesh,
- bool addReference );
+ void GenerateMeshData(ImageId id,
+ const Vector2& position,
+ Toolkit::AtlasManager::Mesh2D& mesh,
+ bool addReference);
/**
* @copydoc Toolkit::AtlasManager::Remove
*/
- bool Remove( ImageId id );
+ bool Remove(ImageId id);
/**
* @copydoc Toolkit::AtlasManager::GetAtlasContainer
*/
- Dali::Texture GetAtlasContainer( AtlasId atlas ) const;
+ Dali::Texture GetAtlasContainer(AtlasId atlas) const;
/**
* @copydoc Toolkit::AtlasManager::GetAtlas
*/
- AtlasId GetAtlas( ImageId id ) const;
+ AtlasId GetAtlas(ImageId id) const;
/**
* @copydoc Toolkit::AtlasManager::SetNewAtlasSize
*/
- void SetNewAtlasSize( const Toolkit::AtlasManager::AtlasSize& size );
+ void SetNewAtlasSize(const Toolkit::AtlasManager::AtlasSize& size);
/**
* @copydoc Toolkit::AtlasManager::GetAtlasSize
*/
- const Toolkit::AtlasManager::AtlasSize& GetAtlasSize( AtlasId atlas );
+ const Toolkit::AtlasManager::AtlasSize& GetAtlasSize(AtlasId atlas);
/**
* @copydoc Toolkit::AtlasManager::GetBlockSize
*/
- Vector2 GetBlockSize( AtlasId atlas );
+ Vector2 GetBlockSize(AtlasId atlas);
/**
* @copydoc Toolkit::AtlasManager::GetFreeBlocks
*/
- SizeType GetFreeBlocks( AtlasId atlas ) const;
+ SizeType GetFreeBlocks(AtlasId atlas) const;
/*
* @copydoc Toolkit::AtlasManager::GetAtlasCount
/**
* @copydoc Toolkit::AtlasManager::GetPixelFormat
*/
- Pixel::Format GetPixelFormat( AtlasId atlas ) const;
+ Pixel::Format GetPixelFormat(AtlasId atlas) const;
/**
* @copydoc Toolkit::AtlasManager::GetMetrics
*/
- void GetMetrics( Toolkit::AtlasManager::Metrics& metrics );
+ void GetMetrics(Toolkit::AtlasManager::Metrics& metrics);
/**
* @copydoc Toolkit::AtlasManager::GetTextures
*/
- TextureSet GetTextures( AtlasId atlas ) const;
+ TextureSet GetTextures(AtlasId atlas) const;
/**
* @copydoc Toolkit::AtlasManager::SetTextures
*/
- void SetTextures( AtlasId atlas, TextureSet& textureSet );
+ void SetTextures(AtlasId atlas, TextureSet& textureSet);
private:
-
- std::vector< AtlasDescriptor > mAtlasList; // List of atlases created
- Vector< AtlasSlotDescriptor > mImageList; // List of bitmaps stored in atlases
- Toolkit::AtlasManager::AtlasSize mNewAtlasSize; // Atlas size to use in next creation
- Toolkit::AtlasManager::AddFailPolicy mAddFailPolicy; // Policy for failing to add an Image
-
- SizeType CheckAtlas( SizeType atlas,
- SizeType width,
- SizeType height,
- Pixel::Format pixelFormat );
-
- void UploadImage( const PixelData& image,
- const AtlasSlotDescriptor& desc );
-
+ std::vector<AtlasDescriptor> mAtlasList; // List of atlases created
+ Vector<AtlasSlotDescriptor> mImageList; // List of bitmaps stored in atlases
+ Toolkit::AtlasManager::AtlasSize mNewAtlasSize; // Atlas size to use in next creation
+ Toolkit::AtlasManager::AddFailPolicy mAddFailPolicy; // Policy for failing to add an Image
+
+ SizeType CheckAtlas(SizeType atlas,
+ SizeType width,
+ SizeType height,
+ Pixel::Format pixelFormat);
+
+ void UploadImage(const PixelData& image,
+ const AtlasSlotDescriptor& desc);
};
} // namespace Internal
inline const Internal::AtlasManager& GetImplementation(const Toolkit::AtlasManager& manager)
{
- DALI_ASSERT_ALWAYS( manager && "AtlasManager handle is empty" );
+ DALI_ASSERT_ALWAYS(manager && "AtlasManager handle is empty");
const BaseObject& handle = manager.GetBaseObject();
inline Internal::AtlasManager& GetImplementation(Toolkit::AtlasManager& manager)
{
- DALI_ASSERT_ALWAYS( manager && "AtlasManager handle is empty" );
+ DALI_ASSERT_ALWAYS(manager && "AtlasManager handle is empty");
BaseObject& handle = manager.GetBaseObject();
} // namespace Dali
-
- #endif // DALI_TOOLKIT_ATLAS_MANAGER_IMPL_H
+#endif // DALI_TOOLKIT_ATLAS_MANAGER_IMPL_H
#define DALI_TOOLKIT_ATLAS_MANAGER_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <stdint.h>
#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/rendering/texture-set.h>
+#include <stdint.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal DALI_INTERNAL
{
-
class AtlasManager;
-} // namespace Internal
+} // namespace DALI_INTERNAL
class AtlasManager : public BaseHandle
{
public:
-
typedef uint32_t SizeType;
typedef SizeType AtlasId;
typedef SizeType ImageId;
struct AtlasSize
{
- SizeType mWidth; ///< width of the atlas in pixels
- SizeType mHeight; ///< height of the atlas in pixels
- SizeType mBlockWidth; ///< width of a block in pixels
- SizeType mBlockHeight; ///< height of a block in pixels
+ SizeType mWidth; ///< width of the atlas in pixels
+ SizeType mHeight; ///< height of the atlas in pixels
+ SizeType mBlockWidth; ///< width of a block in pixels
+ SizeType mBlockHeight; ///< height of a block in pixels
};
/**
*/
struct AtlasMetricsEntry
{
- AtlasSize mSize; ///< size of atlas and blocks
- SizeType mBlocksUsed; ///< number of blocks used in the atlas
- SizeType mTotalBlocks; ///< total blocks used by atlas
- Pixel::Format mPixelFormat; ///< pixel format of the atlas
+ AtlasSize mSize; ///< size of atlas and blocks
+ SizeType mBlocksUsed; ///< number of blocks used in the atlas
+ SizeType mTotalBlocks; ///< total blocks used by atlas
+ Pixel::Format mPixelFormat; ///< pixel format of the atlas
};
struct Metrics
{
Metrics()
- : mAtlasCount( 0u ),
- mTextureMemoryUsed( 0u )
- {}
+ : mAtlasCount(0u),
+ mTextureMemoryUsed(0u)
+ {
+ }
~Metrics()
- {}
+ {
+ }
- SizeType mAtlasCount; ///< number of atlases
- SizeType mTextureMemoryUsed; ///< texture memory used by atlases
- Dali::Vector< AtlasMetricsEntry > mAtlasMetrics; ///< container of atlas information
+ SizeType mAtlasCount; ///< number of atlases
+ SizeType mTextureMemoryUsed; ///< texture memory used by atlases
+ Dali::Vector<AtlasMetricsEntry> mAtlasMetrics; ///< container of atlas information
};
struct Vertex2D
{
- Vector2 mPosition; ///< Vertex posiiton
- Vector2 mTexCoords; ///< Vertex texture co-ordinates
- Vector4 mColor; ///< Vertex color
+ Vector2 mPosition; ///< Vertex posiiton
+ Vector2 mTexCoords; ///< Vertex texture co-ordinates
+ Vector4 mColor; ///< Vertex color
};
struct Mesh2D
{
- Vector< Vertex2D > mVertices; ///< container of vertices
- Vector< unsigned short > mIndices; ///< container of indices
+ Vector<Vertex2D> mVertices; ///< container of vertices
+ Vector<unsigned short> mIndices; ///< container of indices
};
/**
*/
struct AtlasSlot
{
- ImageId mImageId; ///< Id of stored Image
- AtlasId mAtlasId; ///< Id of Atlas containing this slot
+ ImageId mImageId; ///< Id of stored Image
+ AtlasId mAtlasId; ///< Id of Atlas containing this slot
};
- typedef Dali::Vector< AtlasManager::AtlasSlot > slotContainer;
+ typedef Dali::Vector<AtlasManager::AtlasSlot> slotContainer;
/**
* @brief Create a blank atlas of specific dimensions and pixel format with a certain block size
*
* @return atlas Id
*/
- AtlasId CreateAtlas( const AtlasSize& size, Pixel::Format pixelformat = Pixel::RGBA8888 );
+ AtlasId CreateAtlas(const AtlasSize& size, Pixel::Format pixelformat = Pixel::RGBA8888);
/**
* @brief Set the policy on failure to add an image to an atlas
*
* @param policy policy to carry out if add fails
*/
- void SetAddPolicy( AddFailPolicy policy );
+ void SetAddPolicy(AddFailPolicy policy);
/**
* @brief Attempts to add an image to the most suitable atlas
*
* @return true if a new atlas was created
*/
- bool Add( const PixelData& image,
- AtlasSlot& slot,
- AtlasId atlas = 0 );
+ bool Add(const PixelData& image,
+ AtlasSlot& slot,
+ AtlasId atlas = 0);
/**
* @brief Remove previously added bitmapimage from atlas
*
* @return if true then image has been removed from the atlas
*/
- bool Remove( ImageId id );
+ bool Remove(ImageId id);
/**
* @brief Generate mesh data for a previously added image
* @param[out] mesh Mesh Data Object to populate with mesh data
* @param[in] addReference Whether to increase the internal reference count for image or not
*/
- void GenerateMeshData( ImageId id,
- const Vector2& position,
- Mesh2D& mesh,
- bool addReference = true );
+ void GenerateMeshData(ImageId id,
+ const Vector2& position,
+ Mesh2D& mesh,
+ bool addReference = true);
/**
* @brief Get the Texture containing an atlas
*
* @return Atlas Handle
*/
- Dali::Texture GetAtlasContainer( AtlasId atlas ) const;
+ Dali::Texture GetAtlasContainer(AtlasId atlas) const;
/**
* @brief Get the Id of the atlas containing an image
*
* @return Atlas Id
*/
- AtlasId GetAtlas( ImageId id );
+ AtlasId GetAtlas(ImageId id);
/**
* @brief Get the current size of an atlas
*
*
* @return AtlasSize structure for the atlas
*/
- const AtlasSize& GetAtlasSize( AtlasId atlas );
+ const AtlasSize& GetAtlasSize(AtlasId atlas);
/**
* @brief Get the number of blocks available in an atlas
*
* @return Number of blocks free in this atlas
*/
- SizeType GetFreeBlocks( AtlasId atlas );
+ SizeType GetFreeBlocks(AtlasId atlas);
/**
* @brief Sets the pixel area of any new atlas and also the individual block size
*
* @param blockSize pixel area in atlas for a block
*/
- void SetNewAtlasSize( const AtlasSize& size );
+ void SetNewAtlasSize(const AtlasSize& size);
/**
* @brief Get the number of atlases created
*
* @return Pixel format used by this atlas
*/
- Pixel::Format GetPixelFormat( AtlasId atlas ) const;
+ Pixel::Format GetPixelFormat(AtlasId atlas) const;
/**
* @brief Fill in a metrics structure showing current status of this Atlas Manager
*
* @param[in] metrics metrics structure to be filled
*/
- void GetMetrics( Metrics& metrics );
+ void GetMetrics(Metrics& metrics);
/**
* @brief Get TextureSet used by atlas
*
* @return TextureSet used by atlas
*/
- TextureSet GetTextures( AtlasId atlas ) const;
+ TextureSet GetTextures(AtlasId atlas) const;
/**
* @brief Set the texture set used by an atlas
* @param[in] atlas AtlasId
* @param[in] textureSet The texture set to assign
*/
- void SetTextures( AtlasId atlas, TextureSet& textureSet );
+ void SetTextures(AtlasId atlas, TextureSet& textureSet);
private:
-
- explicit DALI_INTERNAL AtlasManager(Internal::AtlasManager *impl);
-
+ explicit DALI_INTERNAL AtlasManager(Internal::AtlasManager* impl);
};
} // namespace Toolkit
#define DALI_TOOLKIT_ATLAS_MESH_FACTORY_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
namespace AtlasMeshFactory
{
- typedef uint32_t SizeType;
+typedef uint32_t SizeType;
- /**
+/**
* @brief Create a Quad that describes an area in an atlas and a position.
*
* @param[in] width Width of area in pixels.
* @param[in] position Position to place area in space.
* @param[out] mesh Mesh object to hold created quad.
*/
- void CreateQuad( SizeType width,
- SizeType height,
- SizeType block,
- const Toolkit::AtlasManager::AtlasSize& atlasSize,
- const Vector2& position,
- Toolkit::AtlasManager::Mesh2D& mesh );
+void CreateQuad(SizeType width,
+ SizeType height,
+ SizeType block,
+ const Toolkit::AtlasManager::AtlasSize& atlasSize,
+ const Vector2& position,
+ Toolkit::AtlasManager::Mesh2D& mesh);
- /**
+/**
* @brief Append one mesh to another.
*
* @param[in,out] first Mesh to append to.
* @param[in] second Mesh to append.
*/
- void AppendMesh( Toolkit::AtlasManager::Mesh2D& first,
- const Toolkit::AtlasManager::Mesh2D& second );
+void AppendMesh(Toolkit::AtlasManager::Mesh2D& first,
+ const Toolkit::AtlasManager::Mesh2D& second);
} // namespace AtlasMeshFactory
#define DALI_TOOLKIT_TEXT_ATLAS_RENDERER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief Implementation of a text renderer based on dynamic atlases.
*
class AtlasRenderer : public Renderer
{
public:
-
/**
* @brief Create the renderer.
*/
/**
* @copydoc Renderer::Render()
*/
- virtual Actor Render( ViewInterface& view,
- Actor textControl,
- Property::Index animatablePropertyIndex,
- float& alignmentOffset,
- int depth );
+ virtual Actor Render(ViewInterface& view,
+ Actor textControl,
+ Property::Index animatablePropertyIndex,
+ float& alignmentOffset,
+ int depth);
protected:
-
/**
* @brief Constructor.
*/
virtual ~AtlasRenderer();
private:
-
// Undefined
- AtlasRenderer( const AtlasRenderer& handle );
+ AtlasRenderer(const AtlasRenderer& handle);
// Undefined
- AtlasRenderer& operator=( const AtlasRenderer& handle );
+ AtlasRenderer& operator=(const AtlasRenderer& handle);
private:
-
struct Impl;
Impl* mImpl;
};
#define DALI_TOOLKIT_INTERNAL_TEXT_BACKEND_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
namespace Internal
{
-
/**
* Implementation of the text rendering backend
*/
class Backend : public BaseObject
{
public:
-
/**
* Constructor
*/
/**
* @copydoc Dali::Toolkit::Text::Backend::NewRenderer()
*/
- RendererPtr NewRenderer( unsigned int renderingType );
+ RendererPtr NewRenderer(unsigned int renderingType);
private:
-
// Undefined copy constructor.
- Backend( const Backend& );
+ Backend(const Backend&);
// Undefined assignment constructor.
- Backend& operator=( Backend& );
+ Backend& operator=(Backend&);
private:
-
struct Impl;
Impl* mImpl;
inline static Internal::Backend& GetImplementation(Backend& backend)
{
- DALI_ASSERT_ALWAYS( backend && "backend handle is empty" );
+ DALI_ASSERT_ALWAYS(backend && "backend handle is empty");
BaseObject& handle = backend.GetBaseObject();
return static_cast<Internal::Backend&>(handle);
}
inline static const Internal::Backend& GetImplementation(const Backend& backend)
{
- DALI_ASSERT_ALWAYS( backend && "backend handle is empty" );
+ DALI_ASSERT_ALWAYS(backend && "backend handle is empty");
const BaseObject& handle = backend.GetBaseObject();
return static_cast<const Internal::Backend&>(handle);
}
#define DALI_TOOLKIT_TEXT_BACKEND_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
namespace Internal DALI_INTERNAL
{
class Backend;
class Backend : public BaseHandle
{
public:
-
/**
* @brief Retrieve a handle to the Backend instance.
*
* @param[in] renderingType The type of rendering required.
* @return A handle to the newly created renderer.
*/
- RendererPtr NewRenderer( unsigned int renderingType );
+ RendererPtr NewRenderer(unsigned int renderingType);
/**
* @brief Create an uninitialized TextAbstraction handle.
*
* @param[in] handle A reference to the copied handle.
*/
- Backend( const Backend& handle );
+ Backend(const Backend& handle);
/**
* @brief This assignment operator is required for (smart) pointer semantics.
* @param [in] handle A reference to the copied handle.
* @return A reference to this.
*/
- Backend& operator=( const Backend& handle );
+ Backend& operator=(const Backend& handle);
public: // Not intended for application developers
-
/**
* @brief This constructor is used by Backend::Get().
*
* @param[in] backend A pointer to the internal backend object.
*/
- explicit DALI_INTERNAL Backend( Internal::Backend* backend );
+ explicit DALI_INTERNAL Backend(Internal::Backend* backend);
};
} // namespace Text
#define DALI_TOOLKIT_TEXT_RENDERER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
class Renderer;
typedef IntrusivePtr<Renderer> RendererPtr;
class Renderer : public RefObject
{
public:
-
/**
* @brief Render the glyphs from a ViewInterface.
*
* @param[in] depth The depth in the tree of the parent.
* @return The Renderable actor used to position the text.
*/
- virtual Actor Render( ViewInterface& view,
- Actor textContol,
- Property::Index animatablePropertyIndex,
- float& alignmentOffset,
- int depth ) = 0;
+ virtual Actor Render(ViewInterface& view,
+ Actor textContol,
+ Property::Index animatablePropertyIndex,
+ float& alignmentOffset,
+ int depth) = 0;
protected:
-
/**
* @brief Constructor.
*/
virtual ~Renderer();
private:
-
// Undefined
- Renderer( const Renderer& handle );
+ Renderer(const Renderer& handle);
// Undefined
- Renderer& operator=( const Renderer& handle );
+ Renderer& operator=(const Renderer& handle);
};
} // namespace Text
#define DALI_TOOLKIT_TEXT_TYPESETTER_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
+#include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
+#include <dali/devel-api/adaptor-framework/pixel-buffer.h>
+#include <dali/devel-api/text-abstraction/text-abstraction-definitions.h>
#include <dali/public-api/common/intrusive-ptr.h>
-#include <dali/public-api/object/ref-object.h>
-#include <dali/public-api/images/pixel.h>
#include <dali/public-api/images/pixel-data.h>
-#include <dali/devel-api/text-abstraction/text-abstraction-definitions.h>
-#include <dali/devel-api/adaptor-framework/pixel-buffer.h>
-#include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
+#include <dali/public-api/images/pixel.h>
+#include <dali/public-api/object/ref-object.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
class ModelInterface;
class ViewModel;
class Typesetter;
class Typesetter : public RefObject
{
public:
-
/**
* @brief Behaviours of how to render the text.
*/
enum RenderBehaviour
{
- RENDER_TEXT_AND_STYLES, ///< Render both the text and its styles
- RENDER_NO_TEXT, ///< Do not render the text itself
- RENDER_NO_STYLES, ///< Do not render any styles
- RENDER_MASK ///< Render an alpha mask (for color glyphs with no color animation, e.g. emoji)
+ RENDER_TEXT_AND_STYLES, ///< Render both the text and its styles
+ RENDER_NO_TEXT, ///< Do not render the text itself
+ RENDER_NO_STYLES, ///< Do not render any styles
+ RENDER_MASK ///< Render an alpha mask (for color glyphs with no color animation, e.g. emoji)
};
/**
*/
enum Style
{
- STYLE_NONE, ///< No style
- STYLE_MASK, ///< Alpha mask
- STYLE_SHADOW, ///< Hard shadow
- STYLE_SOFT_SHADOW, ///< Soft shadow
- STYLE_UNDERLINE, ///< Underline
- STYLE_OUTLINE, ///< Outline
- STYLE_BACKGROUND ///< Text background
+ STYLE_NONE, ///< No style
+ STYLE_MASK, ///< Alpha mask
+ STYLE_SHADOW, ///< Hard shadow
+ STYLE_SOFT_SHADOW, ///< Soft shadow
+ STYLE_UNDERLINE, ///< Underline
+ STYLE_OUTLINE, ///< Outline
+ STYLE_BACKGROUND ///< Text background
};
public: // Constructor.
*
* @param[in] model Pointer to the text's data model.
*/
- static TypesetterPtr New( const ModelInterface* const model );
+ static TypesetterPtr New(const ModelInterface* const model);
public:
/**
*
* @return A pixel data with the text rendered.
*/
- PixelData Render( const Vector2& size, Toolkit::DevelText::TextDirection::Type textDirection, RenderBehaviour behaviour = RENDER_TEXT_AND_STYLES, bool ignoreHorizontalAlignment = false, Pixel::Format pixelFormat = Pixel::RGBA8888 );
+ PixelData Render(const Vector2& size, Toolkit::DevelText::TextDirection::Type textDirection, RenderBehaviour behaviour = RENDER_TEXT_AND_STYLES, bool ignoreHorizontalAlignment = false, Pixel::Format pixelFormat = Pixel::RGBA8888);
private:
/**
*
* @param[in] model Pointer to the text's data model.
*/
- Typesetter( const ModelInterface* const model );
+ Typesetter(const ModelInterface* const model);
// Declared private and left undefined to avoid copies.
- Typesetter( const Typesetter& handle );
+ Typesetter(const Typesetter& handle);
// Declared private and left undefined to avoid copies.
- Typesetter& operator=( const Typesetter& handle );
+ Typesetter& operator=(const Typesetter& handle);
/**
* @brief Create the image buffer for the given range of the glyphs in the given style.
*
* @return An image buffer with the text.
*/
- Devel::PixelBuffer CreateImageBuffer( const unsigned int bufferWidth, const unsigned int bufferHeight, Typesetter::Style style, bool ignoreHorizontalAlignment, Pixel::Format pixelFormat, int horizontalOffset, int verticalOffset, TextAbstraction::GlyphIndex fromGlyphIndex, TextAbstraction::GlyphIndex toGlyphIndex );
+ Devel::PixelBuffer CreateImageBuffer(const unsigned int bufferWidth, const unsigned int bufferHeight, Typesetter::Style style, bool ignoreHorizontalAlignment, Pixel::Format pixelFormat, int horizontalOffset, int verticalOffset, TextAbstraction::GlyphIndex fromGlyphIndex, TextAbstraction::GlyphIndex toGlyphIndex);
/**
* @brief Combine the two RGBA image buffers together.
* @return The combined image buffer with the text.
*
*/
- Devel::PixelBuffer CombineImageBuffer( Devel::PixelBuffer topPixelBuffer, Devel::PixelBuffer bottomPixelBuffer, const unsigned int bufferWidth, const unsigned int bufferHeightbool );
+ Devel::PixelBuffer CombineImageBuffer(Devel::PixelBuffer topPixelBuffer, Devel::PixelBuffer bottomPixelBuffer, const unsigned int bufferWidth, const unsigned int bufferHeightbool);
protected:
-
/**
* @brief A reference counted object may only be deleted by calling Unreference().
*
virtual ~Typesetter();
private:
-
- ViewModel* mModel;
+ ViewModel* mModel;
};
} // namespace Text
-static const char *glyphy_common_glsl =
-"/*\n"
-" * Copyright 2012 Google, Inc. All Rights Reserved.\n"
-" *\n"
-" * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
-" * you may not use this file except in compliance with the License.\n"
-" * You may obtain a copy of the License at\n"
-" *\n"
-" * http://www.apache.org/licenses/LICENSE-2.0\n"
-" *\n"
-" * Unless required by applicable law or agreed to in writing, software\n"
-" * distributed under the License is distributed on an \"AS IS\" BASIS,\n"
-" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"
-" * See the License for the specific language governing permissions and\n"
-" * limitations under the License.\n"
-" *\n"
-" * Google Author(s): Behdad Esfahbod, Maysum Panju\n"
-" */\n"
-"\n"
-"\n"
-"#ifndef GLYPHY_INFINITY\n"
-"# define GLYPHY_INFINITY 1e9\n"
-"#endif\n"
-"#ifndef GLYPHY_EPSILON\n"
-"# define GLYPHY_EPSILON 1e-5\n"
-"#endif\n"
-"\n"
-"#ifndef GLYPHY_RGBA\n"
-"# ifdef GLYPHY_BGRA\n"
-"# define GLYPHY_RGBA(v) glyphy_bgra (v)\n"
-"# else\n"
-"# define GLYPHY_RGBA(v) glyphy_rgba (v)\n"
-"# endif\n"
-"#endif\n"
-"\n"
-"vec4\n"
-"glyphy_rgba (const vec4 v)\n"
-"{\n"
-" return v.rgba;\n"
-"}\n"
-"\n"
-"vec4\n"
-"glyphy_bgra (const vec4 v)\n"
-"{\n"
-" return v.bgra;\n"
-"}\n"
-"\n"
-"\n"
-"struct glyphy_arc_t {\n"
-" vec2 p0;\n"
-" vec2 p1;\n"
-" float d;\n"
-"};\n"
-"\n"
-"struct glyphy_arc_endpoint_t {\n"
-" /* Second arc endpoint */\n"
-" vec2 p;\n"
-" /* Infinity if this endpoint does not form an arc with the previous\n"
-" * endpoint. Ie. a \"move_to\". Test with glyphy_isinf().\n"
-" * Arc depth otherwise. */\n"
-" float d;\n"
-"};\n"
-"\n"
-"struct glyphy_arc_list_t {\n"
-" /* Number of endpoints in the list.\n"
-" * Will be zero if we're far away inside or outside, in which case side is set.\n"
-" * Will be -1 if this arc-list encodes a single line, in which case line_* are set. */\n"
-" int num_endpoints;\n"
-"\n"
-" /* If num_endpoints is zero, this specifies whether we are inside (-1)\n"
-" * or outside (+1). Otherwise we're unsure (0). */\n"
-" int side;\n"
-" /* Offset to the arc-endpoints from the beginning of the glyph blob */\n"
-" int offset;\n"
-"\n"
-" /* A single line is all we care about. It's right here. */\n"
-" float line_angle;\n"
-" float line_distance; /* From nominal glyph center */\n"
-"};\n"
-"\n"
-"bool\n"
-"glyphy_isinf (const float v)\n"
-"{\n"
-" return abs (v) >= GLYPHY_INFINITY * .5;\n"
-"}\n"
-"\n"
-"bool\n"
-"glyphy_iszero (const float v)\n"
-"{\n"
-" return abs (v) <= GLYPHY_EPSILON * 2.;\n"
-"}\n"
-"\n"
-"vec2\n"
-"glyphy_ortho (const vec2 v)\n"
-"{\n"
-" return vec2 (-v.y, v.x);\n"
-"}\n"
-"\n"
-"int\n"
-"glyphy_float_to_byte (const float v)\n"
-"{\n"
-" return int (v * (256. - GLYPHY_EPSILON));\n"
-"}\n"
-"\n"
-"ivec4\n"
-"glyphy_vec4_to_bytes (const vec4 v)\n"
-"{\n"
-" return ivec4 (v * (256. - GLYPHY_EPSILON));\n"
-"}\n"
-"\n"
-"ivec2\n"
-"glyphy_float_to_two_nimbles (const float v)\n"
-"{\n"
-" int f = glyphy_float_to_byte (v);\n"
-" return ivec2 (f / 16, int(mod (float(f), 16.)));\n"
-"}\n"
-"\n"
-"/* returns tan (2 * atan (d)) */\n"
-"float\n"
-"glyphy_tan2atan (const float d)\n"
-"{\n"
-" return 2. * d / (1. - d * d);\n"
-"}\n"
-"\n"
-"glyphy_arc_endpoint_t\n"
-"glyphy_arc_endpoint_decode (const vec4 v, const ivec2 nominal_size)\n"
-"{\n"
-" vec2 p = (vec2 (glyphy_float_to_two_nimbles (v.a)) + v.gb) / 16.;\n"
-" float d = v.r;\n"
-" if (d == 0.)\n"
-" d = GLYPHY_INFINITY;\n"
-" else\n"
-"#define GLYPHY_MAX_D .5\n"
-" d = float(glyphy_float_to_byte (d) - 128) * GLYPHY_MAX_D / 127.;\n"
-"#undef GLYPHY_MAX_D\n"
-" return glyphy_arc_endpoint_t (p * vec2(nominal_size), d);\n"
-"}\n"
-"\n"
-"vec2\n"
-"glyphy_arc_center (const glyphy_arc_t a)\n"
-"{\n"
-" return mix (a.p0, a.p1, .5) +\n"
-" glyphy_ortho (a.p1 - a.p0) / (2. * glyphy_tan2atan (a.d));\n"
-"}\n"
-"\n"
-"bool\n"
-"glyphy_arc_wedge_contains (const glyphy_arc_t a, const vec2 p)\n"
-"{\n"
-" float d2 = glyphy_tan2atan (a.d);\n"
-" return dot (p - a.p0, (a.p1 - a.p0) * mat2(1, d2, -d2, 1)) >= 0. &&\n"
-" dot (p - a.p1, (a.p1 - a.p0) * mat2(1, -d2, d2, 1)) <= 0.;\n"
-"}\n"
-"\n"
-"float\n"
-"glyphy_arc_wedge_signed_dist_shallow (const glyphy_arc_t a, const vec2 p)\n"
-"{\n"
-" vec2 v = normalize (a.p1 - a.p0);\n"
-" float line_d = dot (p - a.p0, glyphy_ortho (v));\n"
-" if (a.d == 0.)\n"
-" return line_d;\n"
-"\n"
-" float d0 = dot ((p - a.p0), v);\n"
-" if (d0 < 0.)\n"
-" return sign (line_d) * distance (p, a.p0);\n"
-" float d1 = dot ((a.p1 - p), v);\n"
-" if (d1 < 0.)\n"
-" return sign (line_d) * distance (p, a.p1);\n"
-" float r = 2. * a.d * (d0 * d1) / (d0 + d1);\n"
-" if (r * line_d > 0.)\n"
-" return sign (line_d) * min (abs (line_d + r), min (distance (p, a.p0), distance (p, a.p1)));\n"
-" return line_d + r;\n"
-"}\n"
-"\n"
-"float\n"
-"glyphy_arc_wedge_signed_dist (const glyphy_arc_t a, const vec2 p)\n"
-"{\n"
-" if (abs (a.d) <= .03)\n"
-" return glyphy_arc_wedge_signed_dist_shallow (a, p);\n"
-" vec2 c = glyphy_arc_center (a);\n"
-" return sign (a.d) * (distance (a.p0, c) - distance (p, c));\n"
-"}\n"
-"\n"
-"float\n"
-"glyphy_arc_extended_dist (const glyphy_arc_t a, const vec2 p)\n"
-"{\n"
-" /* Note: this doesn't handle points inside the wedge. */\n"
-" vec2 m = mix (a.p0, a.p1, .5);\n"
-" float d2 = glyphy_tan2atan (a.d);\n"
-" if (dot (p - m, a.p1 - m) < 0.)\n"
-" return dot (p - a.p0, normalize ((a.p1 - a.p0) * mat2(+d2, -1, +1, +d2)));\n"
-" else\n"
-" return dot (p - a.p1, normalize ((a.p1 - a.p0) * mat2(-d2, -1, +1, -d2)));\n"
-"}\n"
-"\n"
-"int\n"
-"glyphy_arc_list_offset (const vec2 p, const ivec2 nominal_size)\n"
-"{\n"
-" ivec2 cell = ivec2 (clamp (floor (p), vec2 (0.,0.), vec2(nominal_size - 1)));\n"
-" return cell.y * nominal_size.x + cell.x;\n"
-"}\n"
-"\n"
-"glyphy_arc_list_t\n"
-"glyphy_arc_list_decode (const vec4 v, const ivec2 nominal_size)\n"
-"{\n"
-" glyphy_arc_list_t l;\n"
-" ivec4 iv = glyphy_vec4_to_bytes (v);\n"
-" l.side = 0; /* unsure */\n"
-" if (iv.r == 0) { /* arc-list encoded */\n"
-" l.offset = (iv.g * 256) + iv.b;\n"
-" l.num_endpoints = iv.a;\n"
-" if (l.num_endpoints == 255) {\n"
-" l.num_endpoints = 0;\n"
-" l.side = -1;\n"
-" } else if (l.num_endpoints == 0)\n"
-" l.side = +1;\n"
-" } else { /* single line encoded */\n"
-" l.num_endpoints = -1;\n"
-/*" l.line_distance = float(((iv.r - 128) * 256 + iv.g) - 0x4000) / float (0x1FFF)\n"
-" * max (float (nominal_size.x), float (nominal_size.y));\n"
-" l.line_angle = float(-((iv.b * 256 + iv.a) - 0x8000)) / float (0x7FFF) * 3.14159265358979;\n"*/
-/*" l.line_distance = float(((iv.r - 128) * 256 + iv.g) - 16384) / 8191.0 \n"
-" * max (float (nominal_size.x), float (nominal_size.y));\n"
-" l.line_angle = float(-((iv.b * 256 + iv.a) - 32768)) / 32767. * 3.14159;\n"*/
-
-" l.line_distance = ( float(iv.r)/32. + 0.01*float(iv.g)/82.0 - 6.) \n"
-" * max (float (nominal_size.x), float (nominal_size.y));\n"
-" l.line_angle = ( -float(iv.b)/40.74 - float( iv.a )*0.0001 )-3.142;\n"
-" }\n"
-" return l;\n"
-"}\n"
-;
+static const char* glyphy_common_glsl =
+ "/*\n"
+ " * Copyright 2012 Google, Inc. All Rights Reserved.\n"
+ " *\n"
+ " * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
+ " * you may not use this file except in compliance with the License.\n"
+ " * You may obtain a copy of the License at\n"
+ " *\n"
+ " * http://www.apache.org/licenses/LICENSE-2.0\n"
+ " *\n"
+ " * Unless required by applicable law or agreed to in writing, software\n"
+ " * distributed under the License is distributed on an \"AS IS\" BASIS,\n"
+ " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"
+ " * See the License for the specific language governing permissions and\n"
+ " * limitations under the License.\n"
+ " *\n"
+ " * Google Author(s): Behdad Esfahbod, Maysum Panju\n"
+ " */\n"
+ "\n"
+ "\n"
+ "#ifndef GLYPHY_INFINITY\n"
+ "# define GLYPHY_INFINITY 1e9\n"
+ "#endif\n"
+ "#ifndef GLYPHY_EPSILON\n"
+ "# define GLYPHY_EPSILON 1e-5\n"
+ "#endif\n"
+ "\n"
+ "#ifndef GLYPHY_RGBA\n"
+ "# ifdef GLYPHY_BGRA\n"
+ "# define GLYPHY_RGBA(v) glyphy_bgra (v)\n"
+ "# else\n"
+ "# define GLYPHY_RGBA(v) glyphy_rgba (v)\n"
+ "# endif\n"
+ "#endif\n"
+ "\n"
+ "vec4\n"
+ "glyphy_rgba (const vec4 v)\n"
+ "{\n"
+ " return v.rgba;\n"
+ "}\n"
+ "\n"
+ "vec4\n"
+ "glyphy_bgra (const vec4 v)\n"
+ "{\n"
+ " return v.bgra;\n"
+ "}\n"
+ "\n"
+ "\n"
+ "struct glyphy_arc_t {\n"
+ " vec2 p0;\n"
+ " vec2 p1;\n"
+ " float d;\n"
+ "};\n"
+ "\n"
+ "struct glyphy_arc_endpoint_t {\n"
+ " /* Second arc endpoint */\n"
+ " vec2 p;\n"
+ " /* Infinity if this endpoint does not form an arc with the previous\n"
+ " * endpoint. Ie. a \"move_to\". Test with glyphy_isinf().\n"
+ " * Arc depth otherwise. */\n"
+ " float d;\n"
+ "};\n"
+ "\n"
+ "struct glyphy_arc_list_t {\n"
+ " /* Number of endpoints in the list.\n"
+ " * Will be zero if we're far away inside or outside, in which case side is set.\n"
+ " * Will be -1 if this arc-list encodes a single line, in which case line_* are set. */\n"
+ " int num_endpoints;\n"
+ "\n"
+ " /* If num_endpoints is zero, this specifies whether we are inside (-1)\n"
+ " * or outside (+1). Otherwise we're unsure (0). */\n"
+ " int side;\n"
+ " /* Offset to the arc-endpoints from the beginning of the glyph blob */\n"
+ " int offset;\n"
+ "\n"
+ " /* A single line is all we care about. It's right here. */\n"
+ " float line_angle;\n"
+ " float line_distance; /* From nominal glyph center */\n"
+ "};\n"
+ "\n"
+ "bool\n"
+ "glyphy_isinf (const float v)\n"
+ "{\n"
+ " return abs (v) >= GLYPHY_INFINITY * .5;\n"
+ "}\n"
+ "\n"
+ "bool\n"
+ "glyphy_iszero (const float v)\n"
+ "{\n"
+ " return abs (v) <= GLYPHY_EPSILON * 2.;\n"
+ "}\n"
+ "\n"
+ "vec2\n"
+ "glyphy_ortho (const vec2 v)\n"
+ "{\n"
+ " return vec2 (-v.y, v.x);\n"
+ "}\n"
+ "\n"
+ "int\n"
+ "glyphy_float_to_byte (const float v)\n"
+ "{\n"
+ " return int (v * (256. - GLYPHY_EPSILON));\n"
+ "}\n"
+ "\n"
+ "ivec4\n"
+ "glyphy_vec4_to_bytes (const vec4 v)\n"
+ "{\n"
+ " return ivec4 (v * (256. - GLYPHY_EPSILON));\n"
+ "}\n"
+ "\n"
+ "ivec2\n"
+ "glyphy_float_to_two_nimbles (const float v)\n"
+ "{\n"
+ " int f = glyphy_float_to_byte (v);\n"
+ " return ivec2 (f / 16, int(mod (float(f), 16.)));\n"
+ "}\n"
+ "\n"
+ "/* returns tan (2 * atan (d)) */\n"
+ "float\n"
+ "glyphy_tan2atan (const float d)\n"
+ "{\n"
+ " return 2. * d / (1. - d * d);\n"
+ "}\n"
+ "\n"
+ "glyphy_arc_endpoint_t\n"
+ "glyphy_arc_endpoint_decode (const vec4 v, const ivec2 nominal_size)\n"
+ "{\n"
+ " vec2 p = (vec2 (glyphy_float_to_two_nimbles (v.a)) + v.gb) / 16.;\n"
+ " float d = v.r;\n"
+ " if (d == 0.)\n"
+ " d = GLYPHY_INFINITY;\n"
+ " else\n"
+ "#define GLYPHY_MAX_D .5\n"
+ " d = float(glyphy_float_to_byte (d) - 128) * GLYPHY_MAX_D / 127.;\n"
+ "#undef GLYPHY_MAX_D\n"
+ " return glyphy_arc_endpoint_t (p * vec2(nominal_size), d);\n"
+ "}\n"
+ "\n"
+ "vec2\n"
+ "glyphy_arc_center (const glyphy_arc_t a)\n"
+ "{\n"
+ " return mix (a.p0, a.p1, .5) +\n"
+ " glyphy_ortho (a.p1 - a.p0) / (2. * glyphy_tan2atan (a.d));\n"
+ "}\n"
+ "\n"
+ "bool\n"
+ "glyphy_arc_wedge_contains (const glyphy_arc_t a, const vec2 p)\n"
+ "{\n"
+ " float d2 = glyphy_tan2atan (a.d);\n"
+ " return dot (p - a.p0, (a.p1 - a.p0) * mat2(1, d2, -d2, 1)) >= 0. &&\n"
+ " dot (p - a.p1, (a.p1 - a.p0) * mat2(1, -d2, d2, 1)) <= 0.;\n"
+ "}\n"
+ "\n"
+ "float\n"
+ "glyphy_arc_wedge_signed_dist_shallow (const glyphy_arc_t a, const vec2 p)\n"
+ "{\n"
+ " vec2 v = normalize (a.p1 - a.p0);\n"
+ " float line_d = dot (p - a.p0, glyphy_ortho (v));\n"
+ " if (a.d == 0.)\n"
+ " return line_d;\n"
+ "\n"
+ " float d0 = dot ((p - a.p0), v);\n"
+ " if (d0 < 0.)\n"
+ " return sign (line_d) * distance (p, a.p0);\n"
+ " float d1 = dot ((a.p1 - p), v);\n"
+ " if (d1 < 0.)\n"
+ " return sign (line_d) * distance (p, a.p1);\n"
+ " float r = 2. * a.d * (d0 * d1) / (d0 + d1);\n"
+ " if (r * line_d > 0.)\n"
+ " return sign (line_d) * min (abs (line_d + r), min (distance (p, a.p0), distance (p, a.p1)));\n"
+ " return line_d + r;\n"
+ "}\n"
+ "\n"
+ "float\n"
+ "glyphy_arc_wedge_signed_dist (const glyphy_arc_t a, const vec2 p)\n"
+ "{\n"
+ " if (abs (a.d) <= .03)\n"
+ " return glyphy_arc_wedge_signed_dist_shallow (a, p);\n"
+ " vec2 c = glyphy_arc_center (a);\n"
+ " return sign (a.d) * (distance (a.p0, c) - distance (p, c));\n"
+ "}\n"
+ "\n"
+ "float\n"
+ "glyphy_arc_extended_dist (const glyphy_arc_t a, const vec2 p)\n"
+ "{\n"
+ " /* Note: this doesn't handle points inside the wedge. */\n"
+ " vec2 m = mix (a.p0, a.p1, .5);\n"
+ " float d2 = glyphy_tan2atan (a.d);\n"
+ " if (dot (p - m, a.p1 - m) < 0.)\n"
+ " return dot (p - a.p0, normalize ((a.p1 - a.p0) * mat2(+d2, -1, +1, +d2)));\n"
+ " else\n"
+ " return dot (p - a.p1, normalize ((a.p1 - a.p0) * mat2(-d2, -1, +1, -d2)));\n"
+ "}\n"
+ "\n"
+ "int\n"
+ "glyphy_arc_list_offset (const vec2 p, const ivec2 nominal_size)\n"
+ "{\n"
+ " ivec2 cell = ivec2 (clamp (floor (p), vec2 (0.,0.), vec2(nominal_size - 1)));\n"
+ " return cell.y * nominal_size.x + cell.x;\n"
+ "}\n"
+ "\n"
+ "glyphy_arc_list_t\n"
+ "glyphy_arc_list_decode (const vec4 v, const ivec2 nominal_size)\n"
+ "{\n"
+ " glyphy_arc_list_t l;\n"
+ " ivec4 iv = glyphy_vec4_to_bytes (v);\n"
+ " l.side = 0; /* unsure */\n"
+ " if (iv.r == 0) { /* arc-list encoded */\n"
+ " l.offset = (iv.g * 256) + iv.b;\n"
+ " l.num_endpoints = iv.a;\n"
+ " if (l.num_endpoints == 255) {\n"
+ " l.num_endpoints = 0;\n"
+ " l.side = -1;\n"
+ " } else if (l.num_endpoints == 0)\n"
+ " l.side = +1;\n"
+ " } else { /* single line encoded */\n"
+ " l.num_endpoints = -1;\n"
+ /*" l.line_distance = float(((iv.r - 128) * 256 + iv.g) - 0x4000) / float (0x1FFF)\n"
+ " * max (float (nominal_size.x), float (nominal_size.y));\n"
+ " l.line_angle = float(-((iv.b * 256 + iv.a) - 0x8000)) / float (0x7FFF) * 3.14159265358979;\n"*/
+ /*" l.line_distance = float(((iv.r - 128) * 256 + iv.g) - 16384) / 8191.0 \n"
+ " * max (float (nominal_size.x), float (nominal_size.y));\n"
+ " l.line_angle = float(-((iv.b * 256 + iv.a) - 32768)) / 32767. * 3.14159;\n"*/
+ " l.line_distance = ( float(iv.r)/32. + 0.01*float(iv.g)/82.0 - 6.) \n"
+ " * max (float (nominal_size.x), float (nominal_size.y));\n"
+ " l.line_angle = ( -float(iv.b)/40.74 - float( iv.a )*0.0001 )-3.142;\n"
+ " }\n"
+ " return l;\n"
+ "}\n";
-static const char *glyphy_sdf_glsl =
-"/*\n"
-" * Copyright 2012 Google, Inc. All Rights Reserved.\n"
-" *\n"
-" * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
-" * you may not use this file except in compliance with the License.\n"
-" * You may obtain a copy of the License at\n"
-" *\n"
-" * http://www.apache.org/licenses/LICENSE-2.0\n"
-" *\n"
-" * Unless required by applicable law or agreed to in writing, software\n"
-" * distributed under the License is distributed on an \"AS IS\" BASIS,\n"
-" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"
-" * See the License for the specific language governing permissions and\n"
-" * limitations under the License.\n"
-" *\n"
-" * Google Author(s): Behdad Esfahbod, Maysum Panju\n"
-" */\n"
-"\n"
-"#ifndef GLYPHY_TEXTURE1D_FUNC\n"
-"#define GLYPHY_TEXTURE1D_FUNC glyphy_texture1D_func\n"
-"#endif\n"
-"#ifndef GLYPHY_TEXTURE1D_EXTRA_DECLS\n"
-"#define GLYPHY_TEXTURE1D_EXTRA_DECLS\n"
-"#endif\n"
-"#ifndef GLYPHY_TEXTURE1D_EXTRA_ARGS\n"
-"#define GLYPHY_TEXTURE1D_EXTRA_ARGS\n"
-"#endif\n"
-"\n"
-"#ifndef GLYPHY_SDF_TEXTURE1D_FUNC\n"
-"#define GLYPHY_SDF_TEXTURE1D_FUNC GLYPHY_TEXTURE1D_FUNC\n"
-"#endif\n"
-"#ifndef GLYPHY_SDF_TEXTURE1D_EXTRA_DECLS\n"
-"#define GLYPHY_SDF_TEXTURE1D_EXTRA_DECLS GLYPHY_TEXTURE1D_EXTRA_DECLS\n"
-"#endif\n"
-"#ifndef GLYPHY_SDF_TEXTURE1D_EXTRA_ARGS\n"
-"#define GLYPHY_SDF_TEXTURE1D_EXTRA_ARGS GLYPHY_TEXTURE1D_EXTRA_ARGS\n"
-"#endif\n"
-"#ifndef GLYPHY_SDF_TEXTURE1D\n"
-"#define GLYPHY_SDF_TEXTURE1D(offset) GLYPHY_RGBA(GLYPHY_SDF_TEXTURE1D_FUNC (offset GLYPHY_TEXTURE1D_EXTRA_ARGS))\n"
-"#endif\n"
-"\n"
-"#ifndef GLYPHY_MAX_NUM_ENDPOINTS\n"
-"#define GLYPHY_MAX_NUM_ENDPOINTS 32\n"
-"#endif\n"
-"\n"
-"glyphy_arc_list_t\n"
-"glyphy_arc_list (const vec2 p, const ivec2 nominal_size GLYPHY_SDF_TEXTURE1D_EXTRA_DECLS)\n"
-"{\n"
-" int cell_offset = glyphy_arc_list_offset (p, nominal_size);\n"
-" vec4 arc_list_data = GLYPHY_SDF_TEXTURE1D (cell_offset);\n"
-" return glyphy_arc_list_decode (arc_list_data, nominal_size);\n"
-"}\n"
-"\n"
-"float\n"
-"glyphy_sdf (const vec2 p, const ivec2 nominal_size GLYPHY_SDF_TEXTURE1D_EXTRA_DECLS)\n"
-"{\n"
-" glyphy_arc_list_t arc_list = glyphy_arc_list (p, nominal_size GLYPHY_SDF_TEXTURE1D_EXTRA_ARGS);\n"
-"\n"
-" /* Short-circuits */\n"
-" if (arc_list.num_endpoints == 0) {\n"
-" /* far-away cell */\n"
-" return GLYPHY_INFINITY * float(arc_list.side);\n"
-" } if (arc_list.num_endpoints == -1) {\n"
-" /* single-line */\n"
-" float angle = arc_list.line_angle;\n"
-" vec2 n = vec2 (cos (angle), sin (angle));\n"
-" return dot (p - (vec2(nominal_size) * .5), n) - arc_list.line_distance;\n"
-" }\n"
-"\n"
-" float side = float(arc_list.side);\n"
-" float min_dist = GLYPHY_INFINITY;\n"
-" glyphy_arc_t closest_arc;\n"
-"\n"
-" glyphy_arc_endpoint_t endpoint_prev, endpoint;\n"
-" endpoint_prev = glyphy_arc_endpoint_decode (GLYPHY_SDF_TEXTURE1D (arc_list.offset), nominal_size);\n"
-" for (int i = 1; i < GLYPHY_MAX_NUM_ENDPOINTS; i++)\n"
-" {\n"
-" if (i >= arc_list.num_endpoints) {\n"
-" break;\n"
-" }\n"
-" endpoint = glyphy_arc_endpoint_decode (GLYPHY_SDF_TEXTURE1D (arc_list.offset + i), nominal_size);\n"
-" glyphy_arc_t a = glyphy_arc_t (endpoint_prev.p, endpoint.p, endpoint.d);\n"
-" endpoint_prev = endpoint;\n"
-" if (glyphy_isinf (a.d)) continue;\n"
-"\n"
-" if (glyphy_arc_wedge_contains (a, p))\n"
-" {\n"
-" float sdist = glyphy_arc_wedge_signed_dist (a, p);\n"
-" float udist = abs (sdist) * (1. - GLYPHY_EPSILON);\n"
-" if (udist <= min_dist) {\n"
-" min_dist = udist;\n"
-" side = sign (sdist);"
-" }\n"
-" } else {\n"
-" float udist = min (distance (p, a.p0), distance (p, a.p1));\n"
-" if (udist < min_dist) {\n"
-" min_dist = udist;\n"
-" side = 0.; /* unsure */\n"
-" closest_arc = a;\n"
-" } else if (side == 0. && udist == min_dist) {\n"
-" /* If this new distance is the same as the current minimum,\n"
-" * compare extended distances. Take the sign from the arc\n"
-" * with larger extended distance. */\n"
-" float old_ext_dist = glyphy_arc_extended_dist (closest_arc, p);\n"
-" float new_ext_dist = glyphy_arc_extended_dist (a, p);\n"
-"\n"
-" float ext_dist = abs (new_ext_dist) <= abs (old_ext_dist) ?\n"
-" old_ext_dist : new_ext_dist;\n"
-"\n"
-"#ifdef GLYPHY_SDF_PSEUDO_DISTANCE\n"
-" /* For emboldening and stuff: */\n"
-" min_dist = abs (ext_dist);\n"
-"#endif\n"
-" side = sign (ext_dist);\n"
-" }\n"
-" }\n"
-" }\n"
-"\n"
-" if (side == 0.) {\n"
-" // Technically speaking this should not happen, but it does. So try to fix it.\n"
-" float ext_dist = glyphy_arc_extended_dist (closest_arc, p);\n"
-" side = sign (ext_dist);\n"
-" }\n"
-"\n"
-" return min_dist * side;\n"
-"}\n"
-"\n"
-"float\n"
-"glyphy_point_dist (const vec2 p, const ivec2 nominal_size GLYPHY_SDF_TEXTURE1D_EXTRA_DECLS)\n"
-"{\n"
-" glyphy_arc_list_t arc_list = glyphy_arc_list (p, nominal_size GLYPHY_SDF_TEXTURE1D_EXTRA_ARGS);\n"
-"\n"
-" float side = float(arc_list.side);\n"
-" float min_dist = GLYPHY_INFINITY;\n"
-"\n"
-" if (arc_list.num_endpoints == 0)\n"
-" return min_dist;\n"
-"\n"
-" glyphy_arc_endpoint_t endpoint;\n"
-" for (int i = 0; i < GLYPHY_MAX_NUM_ENDPOINTS; i++)\n"
-" {\n"
-" if (i >= arc_list.num_endpoints) {\n"
-" break;\n"
-" }\n"
-" endpoint = glyphy_arc_endpoint_decode (GLYPHY_SDF_TEXTURE1D (arc_list.offset + i), nominal_size);\n"
-" if (glyphy_isinf (endpoint.d)) continue;\n"
-" min_dist = min (min_dist, distance (p, endpoint.p));\n"
-" }\n"
-" return min_dist;\n"
-"}\n"
-;
+static const char* glyphy_sdf_glsl =
+ "/*\n"
+ " * Copyright 2012 Google, Inc. All Rights Reserved.\n"
+ " *\n"
+ " * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
+ " * you may not use this file except in compliance with the License.\n"
+ " * You may obtain a copy of the License at\n"
+ " *\n"
+ " * http://www.apache.org/licenses/LICENSE-2.0\n"
+ " *\n"
+ " * Unless required by applicable law or agreed to in writing, software\n"
+ " * distributed under the License is distributed on an \"AS IS\" BASIS,\n"
+ " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"
+ " * See the License for the specific language governing permissions and\n"
+ " * limitations under the License.\n"
+ " *\n"
+ " * Google Author(s): Behdad Esfahbod, Maysum Panju\n"
+ " */\n"
+ "\n"
+ "#ifndef GLYPHY_TEXTURE1D_FUNC\n"
+ "#define GLYPHY_TEXTURE1D_FUNC glyphy_texture1D_func\n"
+ "#endif\n"
+ "#ifndef GLYPHY_TEXTURE1D_EXTRA_DECLS\n"
+ "#define GLYPHY_TEXTURE1D_EXTRA_DECLS\n"
+ "#endif\n"
+ "#ifndef GLYPHY_TEXTURE1D_EXTRA_ARGS\n"
+ "#define GLYPHY_TEXTURE1D_EXTRA_ARGS\n"
+ "#endif\n"
+ "\n"
+ "#ifndef GLYPHY_SDF_TEXTURE1D_FUNC\n"
+ "#define GLYPHY_SDF_TEXTURE1D_FUNC GLYPHY_TEXTURE1D_FUNC\n"
+ "#endif\n"
+ "#ifndef GLYPHY_SDF_TEXTURE1D_EXTRA_DECLS\n"
+ "#define GLYPHY_SDF_TEXTURE1D_EXTRA_DECLS GLYPHY_TEXTURE1D_EXTRA_DECLS\n"
+ "#endif\n"
+ "#ifndef GLYPHY_SDF_TEXTURE1D_EXTRA_ARGS\n"
+ "#define GLYPHY_SDF_TEXTURE1D_EXTRA_ARGS GLYPHY_TEXTURE1D_EXTRA_ARGS\n"
+ "#endif\n"
+ "#ifndef GLYPHY_SDF_TEXTURE1D\n"
+ "#define GLYPHY_SDF_TEXTURE1D(offset) GLYPHY_RGBA(GLYPHY_SDF_TEXTURE1D_FUNC (offset GLYPHY_TEXTURE1D_EXTRA_ARGS))\n"
+ "#endif\n"
+ "\n"
+ "#ifndef GLYPHY_MAX_NUM_ENDPOINTS\n"
+ "#define GLYPHY_MAX_NUM_ENDPOINTS 32\n"
+ "#endif\n"
+ "\n"
+ "glyphy_arc_list_t\n"
+ "glyphy_arc_list (const vec2 p, const ivec2 nominal_size GLYPHY_SDF_TEXTURE1D_EXTRA_DECLS)\n"
+ "{\n"
+ " int cell_offset = glyphy_arc_list_offset (p, nominal_size);\n"
+ " vec4 arc_list_data = GLYPHY_SDF_TEXTURE1D (cell_offset);\n"
+ " return glyphy_arc_list_decode (arc_list_data, nominal_size);\n"
+ "}\n"
+ "\n"
+ "float\n"
+ "glyphy_sdf (const vec2 p, const ivec2 nominal_size GLYPHY_SDF_TEXTURE1D_EXTRA_DECLS)\n"
+ "{\n"
+ " glyphy_arc_list_t arc_list = glyphy_arc_list (p, nominal_size GLYPHY_SDF_TEXTURE1D_EXTRA_ARGS);\n"
+ "\n"
+ " /* Short-circuits */\n"
+ " if (arc_list.num_endpoints == 0) {\n"
+ " /* far-away cell */\n"
+ " return GLYPHY_INFINITY * float(arc_list.side);\n"
+ " } if (arc_list.num_endpoints == -1) {\n"
+ " /* single-line */\n"
+ " float angle = arc_list.line_angle;\n"
+ " vec2 n = vec2 (cos (angle), sin (angle));\n"
+ " return dot (p - (vec2(nominal_size) * .5), n) - arc_list.line_distance;\n"
+ " }\n"
+ "\n"
+ " float side = float(arc_list.side);\n"
+ " float min_dist = GLYPHY_INFINITY;\n"
+ " glyphy_arc_t closest_arc;\n"
+ "\n"
+ " glyphy_arc_endpoint_t endpoint_prev, endpoint;\n"
+ " endpoint_prev = glyphy_arc_endpoint_decode (GLYPHY_SDF_TEXTURE1D (arc_list.offset), nominal_size);\n"
+ " for (int i = 1; i < GLYPHY_MAX_NUM_ENDPOINTS; i++)\n"
+ " {\n"
+ " if (i >= arc_list.num_endpoints) {\n"
+ " break;\n"
+ " }\n"
+ " endpoint = glyphy_arc_endpoint_decode (GLYPHY_SDF_TEXTURE1D (arc_list.offset + i), nominal_size);\n"
+ " glyphy_arc_t a = glyphy_arc_t (endpoint_prev.p, endpoint.p, endpoint.d);\n"
+ " endpoint_prev = endpoint;\n"
+ " if (glyphy_isinf (a.d)) continue;\n"
+ "\n"
+ " if (glyphy_arc_wedge_contains (a, p))\n"
+ " {\n"
+ " float sdist = glyphy_arc_wedge_signed_dist (a, p);\n"
+ " float udist = abs (sdist) * (1. - GLYPHY_EPSILON);\n"
+ " if (udist <= min_dist) {\n"
+ " min_dist = udist;\n"
+ " side = sign (sdist);"
+ " }\n"
+ " } else {\n"
+ " float udist = min (distance (p, a.p0), distance (p, a.p1));\n"
+ " if (udist < min_dist) {\n"
+ " min_dist = udist;\n"
+ " side = 0.; /* unsure */\n"
+ " closest_arc = a;\n"
+ " } else if (side == 0. && udist == min_dist) {\n"
+ " /* If this new distance is the same as the current minimum,\n"
+ " * compare extended distances. Take the sign from the arc\n"
+ " * with larger extended distance. */\n"
+ " float old_ext_dist = glyphy_arc_extended_dist (closest_arc, p);\n"
+ " float new_ext_dist = glyphy_arc_extended_dist (a, p);\n"
+ "\n"
+ " float ext_dist = abs (new_ext_dist) <= abs (old_ext_dist) ?\n"
+ " old_ext_dist : new_ext_dist;\n"
+ "\n"
+ "#ifdef GLYPHY_SDF_PSEUDO_DISTANCE\n"
+ " /* For emboldening and stuff: */\n"
+ " min_dist = abs (ext_dist);\n"
+ "#endif\n"
+ " side = sign (ext_dist);\n"
+ " }\n"
+ " }\n"
+ " }\n"
+ "\n"
+ " if (side == 0.) {\n"
+ " // Technically speaking this should not happen, but it does. So try to fix it.\n"
+ " float ext_dist = glyphy_arc_extended_dist (closest_arc, p);\n"
+ " side = sign (ext_dist);\n"
+ " }\n"
+ "\n"
+ " return min_dist * side;\n"
+ "}\n"
+ "\n"
+ "float\n"
+ "glyphy_point_dist (const vec2 p, const ivec2 nominal_size GLYPHY_SDF_TEXTURE1D_EXTRA_DECLS)\n"
+ "{\n"
+ " glyphy_arc_list_t arc_list = glyphy_arc_list (p, nominal_size GLYPHY_SDF_TEXTURE1D_EXTRA_ARGS);\n"
+ "\n"
+ " float side = float(arc_list.side);\n"
+ " float min_dist = GLYPHY_INFINITY;\n"
+ "\n"
+ " if (arc_list.num_endpoints == 0)\n"
+ " return min_dist;\n"
+ "\n"
+ " glyphy_arc_endpoint_t endpoint;\n"
+ " for (int i = 0; i < GLYPHY_MAX_NUM_ENDPOINTS; i++)\n"
+ " {\n"
+ " if (i >= arc_list.num_endpoints) {\n"
+ " break;\n"
+ " }\n"
+ " endpoint = glyphy_arc_endpoint_decode (GLYPHY_SDF_TEXTURE1D (arc_list.offset + i), nominal_size);\n"
+ " if (glyphy_isinf (endpoint.d)) continue;\n"
+ " min_dist = min (min_dist, distance (p, endpoint.p));\n"
+ " }\n"
+ " return min_dist;\n"
+ "}\n";
#define DALI_TOOLKIT_TEXT_GLYPHY_SHADER_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief A Shader based on GLyphy authored by Behdad Esfahbod & Maysum Panju.
*
class GlyphyShader : public Shader
{
public:
-
/**
* @brief Create the blob atlas.
*
* @param[in] atlasInfo The metrics of the texture atlas storing vector data.
*/
- static GlyphyShader New( const Vector4& atlasInfo );
+ static GlyphyShader New(const Vector4& atlasInfo);
/**
* @brief Create an uninitialized GlyphyShader handle.
~GlyphyShader();
private: // Not intended for application developer
-
- GlyphyShader( Shader handle );
-
+ GlyphyShader(Shader handle);
};
} // namespace Text
#define DALI_TOOLKIT_TEXT_VECTOR_BASED_RENDERER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief A vector-based renderer
*
class VectorBasedRenderer : public Renderer
{
public:
-
/**
* @brief Create the renderer.
*/
/**
* @copydoc Renderer::Render()
*/
- virtual Actor Render( ViewInterface& view,
- Actor textControl, // Functionality not supported but defined in interface
- Property::Index animatablePropertyIndex, // Functionality not supported but defined in interface
- float& alignmentOffset,
- int depth );
+ virtual Actor Render(ViewInterface& view,
+ Actor textControl, // Functionality not supported but defined in interface
+ Property::Index animatablePropertyIndex, // Functionality not supported but defined in interface
+ float& alignmentOffset,
+ int depth);
protected:
-
/**
* @brief Constructor.
*/
virtual ~VectorBasedRenderer();
private:
-
// Undefined
- VectorBasedRenderer( const VectorBasedRenderer& handle );
+ VectorBasedRenderer(const VectorBasedRenderer& handle);
// Undefined
- VectorBasedRenderer& operator=( const VectorBasedRenderer& handle );
+ VectorBasedRenderer& operator=(const VectorBasedRenderer& handle);
private:
-
struct Impl;
Impl* mImpl;
};
#define DALI_TOOLKIT_VECTOR_BLOB_ATLAS_SHARE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief A singleton for sharing atlases containing vector data
*
class VectorBlobAtlasShare : public BaseHandle
{
public:
-
/**
* @brief Create a VectorBlobAtlasShare handle.
*
VectorBlobAtlas* GetNewAtlas();
private:
-
class Impl;
- explicit DALI_INTERNAL VectorBlobAtlasShare( VectorBlobAtlasShare::Impl* impl );
-
+ explicit DALI_INTERNAL VectorBlobAtlasShare(VectorBlobAtlasShare::Impl* impl);
};
} // namespace Text
#define DALI_TOOLKIT_TEXT_VECTOR_BLOB_ATLAS_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
+#include <dali/devel-api/text-abstraction/text-abstraction-definitions.h>
#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/rendering/shader.h>
-#include <dali/public-api/rendering/texture.h>
#include <dali/public-api/rendering/texture-set.h>
-#include <dali/devel-api/text-abstraction/text-abstraction-definitions.h>
+#include <dali/public-api/rendering/texture.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/text/text-definitions.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
typedef Dali::TextAbstraction::VectorBlob VectorBlob;
struct BlobCoordinate
class VectorBlobAtlas : public RefObject
{
public:
-
/**
* @brief Create a blob atlas.
*
* @param[in] itemHeightQuantum The item height quantum.
* When blobs are added to columns in the atlas, the Y position is advanced by a multiple of this value.
*/
- VectorBlobAtlas( unsigned int textureWidth,
- unsigned int textureHeight,
- unsigned int itemWidth,
- unsigned int itemHeightQuantum );
+ VectorBlobAtlas(unsigned int textureWidth,
+ unsigned int textureHeight,
+ unsigned int itemWidth,
+ unsigned int itemHeightQuantum);
/**
* @brief Query whether the atlas is full.
* Otherwise coords will not be written into.
* @return True if the glyph was found.
*/
- bool FindGlyph( FontId fontId,
- GlyphIndex glyphIndex,
- BlobCoordinate* coords );
+ bool FindGlyph(FontId fontId,
+ GlyphIndex glyphIndex,
+ BlobCoordinate* coords);
/**
* @brief Add a glyph to the atlas.
* @param[out] coords An array of 4 UV coordinates will be returned.
* @return True if the glyph was added. Otherwise the atlas is now full.
*/
- bool AddGlyph( unsigned int fontId,
- unsigned int glyphIndex,
- VectorBlob* blob,
- unsigned int length,
- unsigned int nominalWidth,
- unsigned int nominalHeight,
- BlobCoordinate* coords );
+ bool AddGlyph(unsigned int fontId,
+ unsigned int glyphIndex,
+ VectorBlob* blob,
+ unsigned int length,
+ unsigned int nominalWidth,
+ unsigned int nominalHeight,
+ BlobCoordinate* coords);
/**
* @brief Get the info required by the GLyphy shader.
*/
Vector4 GetInfo() const
{
- return Vector4( mTextureWidth, mTextureHeight, mItemWidth, mItemHeightQuantum );
+ return Vector4(mTextureWidth, mTextureHeight, mItemWidth, mItemHeightQuantum);
}
/**
}
private:
-
/**
* @brief Helper for uploading data to the texture atlas.
*
* @param[in] height The height of the data to upload.
* @param[in] blob The blob of data to upload.
*/
- void TexSubImage( unsigned int offsetX,
- unsigned int offsetY,
- unsigned int width,
- unsigned int height,
- VectorBlob* blob );
+ void TexSubImage(unsigned int offsetX,
+ unsigned int offsetY,
+ unsigned int width,
+ unsigned int height,
+ VectorBlob* blob);
private:
-
unsigned int mTextureWidth;
unsigned int mTextureHeight;
BlobCoordinate coords[4];
};
- std::vector< Key > mItemLookup;
- std::vector< Item > mItemCache;
+ std::vector<Key> mItemLookup;
+ std::vector<Item> mItemCache;
bool mIsFull;
};
#define DALI_TOOLKIT_TEXT_VIEW_MODEL_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/common/dali-vector.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/text/text-enumerations.h>
-#include <dali-toolkit/internal/text/text-model-interface.h>
#include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
+#include <dali-toolkit/internal/text/text-model-interface.h>
+#include <dali-toolkit/public-api/text/text-enumerations.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief Responsible of creating and store temporary modifications of the text model.
* i.e. The elide of text.
*
* @param[in] model Pointer to the text's model interface.
*/
- ViewModel( const ModelInterface* const model );
+ ViewModel(const ModelInterface* const model);
/**
* @brief Virtual destructor.
/**
* @copydoc ModelInterface::GetUnderlineRuns()
*/
- void GetUnderlineRuns( GlyphRun* underlineRuns, UnderlineRunIndex index, Length numberOfRuns ) const override;
+ void GetUnderlineRuns(GlyphRun* underlineRuns, UnderlineRunIndex index, Length numberOfRuns) const override;
/**
* @copydoc ModelInterface::GetOutlineColor()
*/
bool IsBackgroundEnabled() const override;
-/**
+ /**
* @brief Does the text elide.
*
* It stores a copy of the visible glyphs and removes as many glyphs as needed
#define DALI_TOOLKIT_TEXT_SCRIPT_RUN_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief Run of characters with the same script.
*/
struct ScriptRun
{
- CharacterRun characterRun; ///< The initial character index and the number of characters of the run.
- Script script; ///< Script of the run.
+ CharacterRun characterRun; ///< The initial character index and the number of characters of the run.
+ Script script; ///< Script of the run.
bool isRightToLeft; ///< Whether is right to left direction
};
#define DALI_TOOLKIT_TEXT_SEGMENTATION_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
class LogicalModel;
/**
* @param[in] numberOfCharacters The number of characters.
* @param[out] lineBreakInfo The line break info
*/
-void SetLineBreakInfo( const Vector<Character>& text,
- CharacterIndex startIndex,
- Length numberOfCharacters,
- Vector<LineBreakInfo>& lineBreakInfo );
+void SetLineBreakInfo(const Vector<Character>& text,
+ CharacterIndex startIndex,
+ Length numberOfCharacters,
+ Vector<LineBreakInfo>& lineBreakInfo);
/**
* Sets word break info.
* @param[in] numberOfCharacters The number of characters.
* @param[out] wordBreakInfo The word break info.
*/
-void SetWordBreakInfo( const Vector<Character>& text,
- CharacterIndex startIndex,
- Length numberOfCharacters,
- Vector<WordBreakInfo>& wordBreakInfo );
+void SetWordBreakInfo(const Vector<Character>& text,
+ CharacterIndex startIndex,
+ Length numberOfCharacters,
+ Vector<WordBreakInfo>& wordBreakInfo);
} // namespace Text
#define DALI_TOOLKIT_TEXT_SHAPER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
class LogicalModel;
class VisualModel;
* @param[out] charactersPerGlyph Vector containing the number of characters per glyph.
* @param[out] newParagraphGlyphs Vector containing the indices to the new paragraph glyphs.
*/
-void ShapeText( const Vector<Character>& text,
- const Vector<LineBreakInfo>& lineBreakInfo,
- const Vector<ScriptRun>& scripts,
- const Vector<FontRun>& fonts,
- CharacterIndex startCharacterIndex,
- GlyphIndex startGlyphIndex,
- Length numberOfCharacters,
- Vector<GlyphInfo>& glyphs,
- Vector<CharacterIndex>& glyphToCharacterMap,
- Vector<Length>& charactersPerGlyph,
- Vector<GlyphIndex>& newParagraphGlyphs );
+void ShapeText(const Vector<Character>& text,
+ const Vector<LineBreakInfo>& lineBreakInfo,
+ const Vector<ScriptRun>& scripts,
+ const Vector<FontRun>& fonts,
+ CharacterIndex startCharacterIndex,
+ GlyphIndex startGlyphIndex,
+ Length numberOfCharacters,
+ Vector<GlyphInfo>& glyphs,
+ Vector<CharacterIndex>& glyphToCharacterMap,
+ Vector<Length>& charactersPerGlyph,
+ Vector<GlyphIndex>& newParagraphGlyphs);
} // namespace Text
#define DALI_TOOLKIT_TEXT_CONTROL_INTERFACE_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief An interface that the Text::Controller uses to request a text relayout.
*/
class ControlInterface
{
public:
-
/**
* @brief Virtual destructor.
*/
virtual ~ControlInterface()
- {}
+ {
+ }
/**
* @brief Called to request a text relayout.
#define DALI_TOOLKIT_TEXT_CONTROLLER_EVENT_HANDLER_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/input-method-context.h>
#include <dali/public-api/events/gesture-enumerations.h>
#include <dali/public-api/events/key-event.h>
#include <dali/public-api/math/vector2.h>
-#include <dali/devel-api/adaptor-framework/input-method-context.h>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
struct Controller::EventHandler
{
static void KeyboardFocusGainEvent(Controller& controller);
static void TextInsertedEvent(Controller& controller);
static void TextDeletedEvent(Controller& controller);
static bool DeleteEvent(Controller& controller, int keyCode);
- static InputMethodContext::CallbackData OnInputMethodContextEvent(Controller& controller, InputMethodContext& inputMethodContext, const InputMethodContext::EventData& inputMethodContextEvent);
+
+ static InputMethodContext::CallbackData OnInputMethodContextEvent(Controller& controller,
+ InputMethodContext& inputMethodContext,
+ const InputMethodContext::EventData& inputMethodContextEvent);
+
static void PasteClipboardItemEvent(Controller& controller);
static void DecorationEvent(Controller& controller, HandleType handleType, HandleState state, float x, float y);
static void TextPopupButtonTouched(Controller& controller, Dali::Toolkit::TextSelectionPopup::Buttons button);
#define DALI_TOOLKIT_TEXT_CONTROLLER_IMPL_EVENT_HANDLER_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* Contains all the event handling methods for Text::Controller::Impl
*/
* @param controllerImpl A reference to Controller::Impl
* @param event The event
*/
- static void OnSelectEvent(Controller::Impl& controllerImpl, const Event& event );
+ static void OnSelectEvent(Controller::Impl& controllerImpl, const Event& event);
/**
* @brief Called by Controller::Impl when a select all event is received.
static void OnSelectNoneEvent(Controller::Impl& controllerImpl);
private:
-
/**
* @brief Called by OnHandleEvent when we are in the Pressed state.
*
#define DALI_TOOLKIT_TEXT_CONTROLLER_IMPL_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/rendering/shader.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/styling/style-manager-devel.h>
#include <dali-toolkit/internal/text/input-style.h>
#include <dali-toolkit/internal/text/text-controller.h>
#include <dali-toolkit/internal/text/text-model.h>
#include <dali-toolkit/internal/text/text-view.h>
#include <dali-toolkit/public-api/styling/style-manager.h>
-#include <dali-toolkit/devel-api/styling/style-manager-devel.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
-const float DEFAULT_TEXTFIT_MIN = 10.f;
-const float DEFAULT_TEXTFIT_MAX = 100.f;
-const float DEFAULT_TEXTFIT_STEP = 1.f;
+const float DEFAULT_TEXTFIT_MIN = 10.f;
+const float DEFAULT_TEXTFIT_MAX = 100.f;
+const float DEFAULT_TEXTFIT_STEP = 1.f;
const float DEFAULT_FONT_SIZE_SCALE = 1.f;
//Forward declarations
union Param
{
- int mInt;
+ int mInt;
unsigned int mUint;
- float mFloat;
- bool mBool;
+ float mFloat;
+ bool mBool;
};
- Event( Type eventType )
- : type( eventType )
+ Event(Type eventType)
+ : type(eventType)
{
p1.mInt = 0;
p2.mInt = 0;
p3.mInt = 0;
}
- Type type;
+ Type type;
Param p1;
Param p2;
Param p3;
TEXT_PANNING
};
- EventData( DecoratorPtr decorator, InputMethodContext& inputMethodContext );
+ EventData(DecoratorPtr decorator, InputMethodContext& inputMethodContext);
~EventData() = default;
- static bool IsEditingState( State stateToCheck )
+ static bool IsEditingState(State stateToCheck)
{
- return ( stateToCheck == EDITING || stateToCheck == EDITING_WITH_POPUP || stateToCheck == EDITING_WITH_GRAB_HANDLE || stateToCheck == EDITING_WITH_PASTE_POPUP );
+ return (stateToCheck == EDITING || stateToCheck == EDITING_WITH_POPUP || stateToCheck == EDITING_WITH_GRAB_HANDLE || stateToCheck == EDITING_WITH_PASTE_POPUP);
}
DecoratorPtr mDecorator; ///< Pointer to the decorator.
* This is used to delay handling events until after the model has been updated.
* The number of updates to the model is minimized to improve performance.
*/
- std::vector<Event> mEventQueue; ///< The queue of touch events etc.
+ std::vector<Event> mEventQueue; ///< The queue of touch events etc.
Vector<InputStyle::Mask> mInputStyleChangedQueue; ///< Queue of changes in the input style. Used to emit the signal in the iddle callback.
- InputStyle mInputStyle; ///< The style to be set to the new inputed text.
+ InputStyle mInputStyle; ///< The style to be set to the new inputed text.
- State mPreviousState; ///< Stores the current state before it's updated with the new one.
- State mState; ///< Selection mode, edit mode etc.
+ State mPreviousState; ///< Stores the current state before it's updated with the new one.
+ State mState; ///< Selection mode, edit mode etc.
- CharacterIndex mPrimaryCursorPosition; ///< Index into logical model for primary cursor.
- CharacterIndex mLeftSelectionPosition; ///< Index into logical model for left selection handle.
- CharacterIndex mRightSelectionPosition; ///< Index into logical model for right selection handle.
+ CharacterIndex mPrimaryCursorPosition; ///< Index into logical model for primary cursor.
+ CharacterIndex mLeftSelectionPosition; ///< Index into logical model for left selection handle.
+ CharacterIndex mRightSelectionPosition; ///< Index into logical model for right selection handle.
- CharacterIndex mPreEditStartPosition; ///< Used to remove the pre-edit text if necessary.
- Length mPreEditLength; ///< Used to remove the pre-edit text if necessary.
+ CharacterIndex mPreEditStartPosition; ///< Used to remove the pre-edit text if necessary.
+ Length mPreEditLength; ///< Used to remove the pre-edit text if necessary.
- float mCursorHookPositionX; ///< Used to move the cursor with the keys or when scrolling the text vertically with the handles.
+ float mCursorHookPositionX; ///< Used to move the cursor with the keys or when scrolling the text vertically with the handles.
Controller::NoTextTap::Action mDoubleTapAction; ///< Action to be done when there is a double tap on top of 'no text'
Controller::NoTextTap::Action mLongPressAction; ///< Action to be done when there is a long press on top of 'no text'
- bool mIsShowingPlaceholderText : 1; ///< True if the place-holder text is being displayed.
- bool mPreEditFlag : 1; ///< True if the model contains text in pre-edit state.
- bool mDecoratorUpdated : 1; ///< True if the decorator was updated during event processing.
- bool mCursorBlinkEnabled : 1; ///< True if cursor should blink when active.
- bool mGrabHandleEnabled : 1; ///< True if grab handle is enabled.
- bool mGrabHandlePopupEnabled : 1; ///< True if the grab handle popu-up should be shown.
- bool mSelectionEnabled : 1; ///< True if selection handles, highlight etc. are enabled.
- bool mUpdateCursorHookPosition : 1; ///< True if the cursor hook position must be updated. Used to move the cursor with the keys 'up' and 'down'.
- bool mUpdateCursorPosition : 1; ///< True if the visual position of the cursor must be recalculated.
- bool mUpdateGrabHandlePosition : 1; ///< True if the visual position of the grab handle must be recalculated.
- bool mUpdateLeftSelectionPosition : 1; ///< True if the visual position of the left selection handle must be recalculated.
- bool mUpdateRightSelectionPosition : 1; ///< True if the visual position of the right selection handle must be recalculated.
- bool mIsLeftHandleSelected : 1; ///< Whether is the left handle the one which is selected.
- bool mIsRightHandleSelected : 1; ///< Whether is the right handle the one which is selected.
- bool mUpdateHighlightBox : 1; ///< True if the text selection high light box must be updated.
- bool mScrollAfterUpdatePosition : 1; ///< Whether to scroll after the cursor position is updated.
- bool mScrollAfterDelete : 1; ///< Whether to scroll after delete characters.
- bool mAllTextSelected : 1; ///< True if the selection handles are selecting all the text.
- bool mUpdateInputStyle : 1; ///< Whether to update the input style after moving the cursor.
- bool mPasswordInput : 1; ///< True if password input is enabled.
- bool mCheckScrollAmount : 1; ///< Whether to check scrolled amount after updating the position
- bool mIsPlaceholderPixelSize : 1; ///< True if the placeholder font size is set as pixel size.
- bool mIsPlaceholderElideEnabled : 1; ///< True if the placeholder text's elide is enabled.
- bool mPlaceholderEllipsisFlag : 1; ///< True if the text controller sets the placeholder ellipsis.
- bool mShiftSelectionFlag : 1; ///< True if the text selection using Shift key is enabled.
- bool mUpdateAlignment : 1; ///< True if the whole text needs to be full aligned..
- bool mEditingEnabled : 1; ///< True if the editing is enabled, false otherwise.
+ bool mIsShowingPlaceholderText : 1; ///< True if the place-holder text is being displayed.
+ bool mPreEditFlag : 1; ///< True if the model contains text in pre-edit state.
+ bool mDecoratorUpdated : 1; ///< True if the decorator was updated during event processing.
+ bool mCursorBlinkEnabled : 1; ///< True if cursor should blink when active.
+ bool mGrabHandleEnabled : 1; ///< True if grab handle is enabled.
+ bool mGrabHandlePopupEnabled : 1; ///< True if the grab handle popu-up should be shown.
+ bool mSelectionEnabled : 1; ///< True if selection handles, highlight etc. are enabled.
+ bool mUpdateCursorHookPosition : 1; ///< True if the cursor hook position must be updated. Used to move the cursor with the keys 'up' and 'down'.
+ bool mUpdateCursorPosition : 1; ///< True if the visual position of the cursor must be recalculated.
+ bool mUpdateGrabHandlePosition : 1; ///< True if the visual position of the grab handle must be recalculated.
+ bool mUpdateLeftSelectionPosition : 1; ///< True if the visual position of the left selection handle must be recalculated.
+ bool mUpdateRightSelectionPosition : 1; ///< True if the visual position of the right selection handle must be recalculated.
+ bool mIsLeftHandleSelected : 1; ///< Whether is the left handle the one which is selected.
+ bool mIsRightHandleSelected : 1; ///< Whether is the right handle the one which is selected.
+ bool mUpdateHighlightBox : 1; ///< True if the text selection high light box must be updated.
+ bool mScrollAfterUpdatePosition : 1; ///< Whether to scroll after the cursor position is updated.
+ bool mScrollAfterDelete : 1; ///< Whether to scroll after delete characters.
+ bool mAllTextSelected : 1; ///< True if the selection handles are selecting all the text.
+ bool mUpdateInputStyle : 1; ///< Whether to update the input style after moving the cursor.
+ bool mPasswordInput : 1; ///< True if password input is enabled.
+ bool mCheckScrollAmount : 1; ///< Whether to check scrolled amount after updating the position
+ bool mIsPlaceholderPixelSize : 1; ///< True if the placeholder font size is set as pixel size.
+ bool mIsPlaceholderElideEnabled : 1; ///< True if the placeholder text's elide is enabled.
+ bool mPlaceholderEllipsisFlag : 1; ///< True if the text controller sets the placeholder ellipsis.
+ bool mShiftSelectionFlag : 1; ///< True if the text selection using Shift key is enabled.
+ bool mUpdateAlignment : 1; ///< True if the whole text needs to be full aligned..
+ bool mEditingEnabled : 1; ///< True if the editing is enabled, false otherwise.
};
struct ModifyEvent
{
enum Type
{
- TEXT_REPLACED, ///< The entire text was replaced
- TEXT_INSERTED, ///< Insert characters at the current cursor position
- TEXT_DELETED ///< Characters were deleted
+ TEXT_REPLACED, ///< The entire text was replaced
+ TEXT_INSERTED, ///< Insert characters at the current cursor position
+ TEXT_DELETED ///< Characters were deleted
};
Type type;
{
FontDefaults()
: mFontDescription(),
- mDefaultPointSize( 0.f ),
- mFitPointSize( 0.f ),
- mFontId( 0u ),
- familyDefined( false ),
- weightDefined( false ),
- widthDefined( false ),
- slantDefined( false ),
- sizeDefined( false )
+ mDefaultPointSize(0.f),
+ mFitPointSize(0.f),
+ mFontId(0u),
+ familyDefined(false),
+ weightDefined(false),
+ widthDefined(false),
+ slantDefined(false),
+ sizeDefined(false)
{
// Initially use the default platform font
TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
- fontClient.GetDefaultPlatformFontDescription( mFontDescription );
+ fontClient.GetDefaultPlatformFontDescription(mFontDescription);
}
- FontId GetFontId( TextAbstraction::FontClient& fontClient, float fontPointSize )
+ FontId GetFontId(TextAbstraction::FontClient& fontClient, float fontPointSize)
{
- if( !mFontId )
+ if(!mFontId)
{
- const PointSize26Dot6 pointSize = static_cast<PointSize26Dot6>( fontPointSize * 64.f );
- mFontId = fontClient.GetFontId( mFontDescription, pointSize );
+ const PointSize26Dot6 pointSize = static_cast<PointSize26Dot6>(fontPointSize * 64.f);
+ mFontId = fontClient.GetFontId(mFontDescription, pointSize);
}
return mFontId;
TextAbstraction::FontDescription mFontDescription; ///< The default font's description.
float mDefaultPointSize; ///< The default font's point size.
- float mFitPointSize; ///< The fit font's point size.
+ float mFitPointSize; ///< The fit font's point size.
FontId mFontId; ///< The font's id of the default font.
- bool familyDefined:1; ///< Whether the default font's family name is defined.
- bool weightDefined:1; ///< Whether the default font's weight is defined.
- bool widthDefined:1; ///< Whether the default font's width is defined.
- bool slantDefined:1; ///< Whether the default font's slant is defined.
- bool sizeDefined:1; ///< Whether the default font's point size is defined.
+ bool familyDefined : 1; ///< Whether the default font's family name is defined.
+ bool weightDefined : 1; ///< Whether the default font's weight is defined.
+ bool widthDefined : 1; ///< Whether the default font's width is defined.
+ bool slantDefined : 1; ///< Whether the default font's slant is defined.
+ bool sizeDefined : 1; ///< Whether the default font's point size is defined.
};
/**
struct TextUpdateInfo
{
TextUpdateInfo()
- : mCharacterIndex( 0u ),
- mNumberOfCharactersToRemove( 0u ),
- mNumberOfCharactersToAdd( 0u ),
- mPreviousNumberOfCharacters( 0u ),
- mParagraphCharacterIndex( 0u ),
- mRequestedNumberOfCharacters( 0u ),
- mStartGlyphIndex( 0u ),
- mStartLineIndex( 0u ),
- mEstimatedNumberOfLines( 0u ),
- mClearAll( true ),
- mFullRelayoutNeeded( true ),
- mIsLastCharacterNewParagraph( false )
- {}
+ : mCharacterIndex(0u),
+ mNumberOfCharactersToRemove(0u),
+ mNumberOfCharactersToAdd(0u),
+ mPreviousNumberOfCharacters(0u),
+ mParagraphCharacterIndex(0u),
+ mRequestedNumberOfCharacters(0u),
+ mStartGlyphIndex(0u),
+ mStartLineIndex(0u),
+ mEstimatedNumberOfLines(0u),
+ mClearAll(true),
+ mFullRelayoutNeeded(true),
+ mIsLastCharacterNewParagraph(false)
+ {
+ }
~TextUpdateInfo()
- {}
+ {
+ }
- CharacterIndex mCharacterIndex; ///< Index to the first character to be updated.
- Length mNumberOfCharactersToRemove; ///< The number of characters to be removed.
- Length mNumberOfCharactersToAdd; ///< The number of characters to be added.
- Length mPreviousNumberOfCharacters; ///< The number of characters before the text update.
+ CharacterIndex mCharacterIndex; ///< Index to the first character to be updated.
+ Length mNumberOfCharactersToRemove; ///< The number of characters to be removed.
+ Length mNumberOfCharactersToAdd; ///< The number of characters to be added.
+ Length mPreviousNumberOfCharacters; ///< The number of characters before the text update.
- CharacterIndex mParagraphCharacterIndex; ///< Index of the first character of the first paragraph to be updated.
- Length mRequestedNumberOfCharacters; ///< The requested number of characters.
- GlyphIndex mStartGlyphIndex;
- LineIndex mStartLineIndex;
- Length mEstimatedNumberOfLines; ///< The estimated number of lines. Used to avoid reallocations when layouting.
+ CharacterIndex mParagraphCharacterIndex; ///< Index of the first character of the first paragraph to be updated.
+ Length mRequestedNumberOfCharacters; ///< The requested number of characters.
+ GlyphIndex mStartGlyphIndex;
+ LineIndex mStartLineIndex;
+ Length mEstimatedNumberOfLines; ///< The estimated number of lines. Used to avoid reallocations when layouting.
- bool mClearAll:1; ///< Whether the whole text is cleared. i.e. when the text is reset.
- bool mFullRelayoutNeeded:1; ///< Whether a full re-layout is needed. i.e. when a new size is set to the text control.
- bool mIsLastCharacterNewParagraph:1; ///< Whether the last character is a new paragraph character.
+ bool mClearAll : 1; ///< Whether the whole text is cleared. i.e. when the text is reset.
+ bool mFullRelayoutNeeded : 1; ///< Whether a full re-layout is needed. i.e. when a new size is set to the text control.
+ bool mIsLastCharacterNewParagraph : 1; ///< Whether the last character is a new paragraph character.
void Clear()
{
// Clear all info except the mPreviousNumberOfCharacters member.
- mCharacterIndex = static_cast<CharacterIndex>( -1 );
- mNumberOfCharactersToRemove = 0u;
- mNumberOfCharactersToAdd = 0u;
- mParagraphCharacterIndex = 0u;
+ mCharacterIndex = static_cast<CharacterIndex>(-1);
+ mNumberOfCharactersToRemove = 0u;
+ mNumberOfCharactersToAdd = 0u;
+ mParagraphCharacterIndex = 0u;
mRequestedNumberOfCharacters = 0u;
- mStartGlyphIndex = 0u;
- mStartLineIndex = 0u;
- mEstimatedNumberOfLines = 0u;
- mClearAll = false;
- mFullRelayoutNeeded = false;
+ mStartGlyphIndex = 0u;
+ mStartLineIndex = 0u;
+ mEstimatedNumberOfLines = 0u;
+ mClearAll = false;
+ mFullRelayoutNeeded = false;
mIsLastCharacterNewParagraph = false;
}
};
struct Controller::Impl
{
- Impl( ControlInterface* controlInterface,
- EditableControlInterface* editableControlInterface,
- SelectableControlInterface* selectableControlInterface )
- : mControlInterface( controlInterface ),
- mEditableControlInterface( editableControlInterface ),
- mSelectableControlInterface( selectableControlInterface ),
+ Impl(ControlInterface* controlInterface,
+ EditableControlInterface* editableControlInterface,
+ SelectableControlInterface* selectableControlInterface)
+ : mControlInterface(controlInterface),
+ mEditableControlInterface(editableControlInterface),
+ mSelectableControlInterface(selectableControlInterface),
mModel(),
- mFontDefaults( NULL ),
- mUnderlineDefaults( NULL ),
- mShadowDefaults( NULL ),
- mEmbossDefaults( NULL ),
- mOutlineDefaults( NULL ),
- mEventData( NULL ),
+ mFontDefaults(NULL),
+ mUnderlineDefaults(NULL),
+ mShadowDefaults(NULL),
+ mEmbossDefaults(NULL),
+ mOutlineDefaults(NULL),
+ mEventData(NULL),
mFontClient(),
mClipboard(),
mView(),
mMetrics(),
mModifyEvents(),
- mTextColor( Color::BLACK ),
+ mTextColor(Color::BLACK),
mTextUpdateInfo(),
- mOperationsPending( NO_OPERATION ),
- mMaximumNumberOfCharacters( 50u ),
- mHiddenInput( NULL ),
- mRecalculateNaturalSize( true ),
- mMarkupProcessorEnabled( false ),
- mClipboardHideEnabled( true ),
- mIsAutoScrollEnabled( false ),
- mUpdateTextDirection( true ),
- mIsTextDirectionRTL( false ),
- mUnderlineSetByString( false ),
- mShadowSetByString( false ),
- mOutlineSetByString( false ),
- mFontStyleSetByString( false ),
- mShouldClearFocusOnEscape( true ),
- mLayoutDirection( LayoutDirection::LEFT_TO_RIGHT ),
- mTextFitMinSize( DEFAULT_TEXTFIT_MIN ),
- mTextFitMaxSize( DEFAULT_TEXTFIT_MAX ),
- mTextFitStepSize( DEFAULT_TEXTFIT_STEP ),
- mTextFitEnabled( false ),
- mFontSizeScale( DEFAULT_FONT_SIZE_SCALE )
+ mOperationsPending(NO_OPERATION),
+ mMaximumNumberOfCharacters(50u),
+ mHiddenInput(NULL),
+ mRecalculateNaturalSize(true),
+ mMarkupProcessorEnabled(false),
+ mClipboardHideEnabled(true),
+ mIsAutoScrollEnabled(false),
+ mUpdateTextDirection(true),
+ mIsTextDirectionRTL(false),
+ mUnderlineSetByString(false),
+ mShadowSetByString(false),
+ mOutlineSetByString(false),
+ mFontStyleSetByString(false),
+ mShouldClearFocusOnEscape(true),
+ mLayoutDirection(LayoutDirection::LEFT_TO_RIGHT),
+ mTextFitMinSize(DEFAULT_TEXTFIT_MIN),
+ mTextFitMaxSize(DEFAULT_TEXTFIT_MAX),
+ mTextFitStepSize(DEFAULT_TEXTFIT_STEP),
+ mTextFitEnabled(false),
+ mFontSizeScale(DEFAULT_FONT_SIZE_SCALE)
{
mModel = Model::New();
mFontClient = TextAbstraction::FontClient::Get();
- mClipboard = Clipboard::Get();
+ mClipboard = Clipboard::Get();
- mView.SetVisualModel( mModel->mVisualModel );
+ mView.SetVisualModel(mModel->mVisualModel);
// Use this to access FontClient i.e. to get down-scaled Emoji metrics.
- mMetrics = Metrics::New( mFontClient );
- mLayoutEngine.SetMetrics( mMetrics );
+ mMetrics = Metrics::New(mFontClient);
+ mLayoutEngine.SetMetrics(mMetrics);
// Set the text properties to default
- mModel->mVisualModel->SetUnderlineEnabled( false );
- mModel->mVisualModel->SetUnderlineHeight( 0.0f );
+ mModel->mVisualModel->SetUnderlineEnabled(false);
+ mModel->mVisualModel->SetUnderlineHeight(0.0f);
Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
- if( styleManager )
+ if(styleManager)
{
- bool temp;
- Property::Map config = Toolkit::DevelStyleManager::GetConfigurations( styleManager );
- if( config["clearFocusOnEscape"].Get( temp ) )
+ bool temp;
+ Property::Map config = Toolkit::DevelStyleManager::GetConfigurations(styleManager);
+ if(config["clearFocusOnEscape"].Get(temp))
{
mShouldClearFocusOnEscape = temp;
}
/**
* @brief Request a relayout using the ControlInterface.
*/
- void QueueModifyEvent( ModifyEvent::Type type )
+ void QueueModifyEvent(ModifyEvent::Type type)
{
- if( ModifyEvent::TEXT_REPLACED == type)
+ if(ModifyEvent::TEXT_REPLACED == type)
{
// Cancel previously queued inserts etc.
mModifyEvents.Clear();
ModifyEvent event;
event.type = type;
- mModifyEvents.PushBack( event );
+ mModifyEvents.PushBack(event);
// The event will be processed during relayout
RequestRelayout();
*/
bool IsPlaceholderAvailable() const
{
- return ( mEventData &&
- ( !mEventData->mPlaceholderTextInactive.empty() ||
- !mEventData->mPlaceholderTextActive.empty() )
- );
+ return (mEventData &&
+ (!mEventData->mPlaceholderTextInactive.empty() ||
+ !mEventData->mPlaceholderTextActive.empty()));
}
bool IsShowingPlaceholderText() const
{
- return ( mEventData && mEventData->mIsShowingPlaceholderText );
+ return (mEventData && mEventData->mIsShowingPlaceholderText);
}
/**
*/
bool IsFocusedPlaceholderAvailable() const
{
- return ( mEventData && !mEventData->mPlaceholderTextActive.empty() );
+ return (mEventData && !mEventData->mPlaceholderTextActive.empty());
}
bool IsShowingRealText() const
{
- return ( !IsShowingPlaceholderText() &&
- 0u != mModel->mLogicalModel->mText.Count() );
+ return (!IsShowingPlaceholderText() &&
+ 0u != mModel->mLogicalModel->mText.Count());
}
/**
*/
void PlaceholderCleared()
{
- if( mEventData )
+ if(mEventData)
{
mEventData->mIsShowingPlaceholderText = false;
// Remove mPlaceholderTextColor
- mModel->mVisualModel->SetTextColor( mTextColor );
+ mModel->mVisualModel->SetTextColor(mTextColor);
}
}
void ClearPreEditFlag()
{
- if( mEventData )
+ if(mEventData)
{
- mEventData->mPreEditFlag = false;
+ mEventData->mPreEditFlag = false;
mEventData->mPreEditStartPosition = 0;
- mEventData->mPreEditLength = 0;
+ mEventData->mPreEditLength = 0;
}
}
void ResetInputMethodContext()
{
- if( mEventData )
+ if(mEventData)
{
// Reset incase we are in a pre-edit state.
- if( mEventData->mInputMethodContext )
+ if(mEventData->mInputMethodContext)
{
mEventData->mInputMethodContext.Reset(); // Will trigger a message ( commit, get surrounding )
}
*
* @return The number of consecutive white spaces.
*/
- Length GetNumberOfWhiteSpaces( CharacterIndex index ) const;
+ Length GetNumberOfWhiteSpaces(CharacterIndex index) const;
/**
* @brief Retrieve any text previously set starting from the given @p index.
*
* @see Dali::Toolkit::Text::Controller::GetText()
*/
- void GetText( CharacterIndex index, std::string& text ) const;
+ void GetText(CharacterIndex index, std::string& text) const;
bool IsClipboardEmpty()
{
- bool result( mClipboard && mClipboard.NumberOfItems() );
+ bool result(mClipboard && mClipboard.NumberOfItems());
return !result; // If NumberOfItems greater than 0, return false
}
bool IsClipboardVisible()
{
- bool result( mClipboard && mClipboard.IsVisible() );
+ bool result(mClipboard && mClipboard.IsVisible());
return result;
}
*
* @param[out] numberOfCharacters The number of characters to be updated.
*/
- void CalculateTextUpdateIndices( Length& numberOfCharacters );
+ void CalculateTextUpdateIndices(Length& numberOfCharacters);
/**
* @brief Helper to clear completely the parts of the model specified by the given @p operations.
*
* @note It never clears the text stored in utf32.
*/
- void ClearFullModelData( OperationsMask operations );
+ void ClearFullModelData(OperationsMask operations);
/**
* @brief Helper to clear completely the parts of the model related with the characters specified by the given @p operations.
* @param[in] endIndex Index to the last character to be cleared.
* @param[in] operations The operations required.
*/
- void ClearCharacterModelData( CharacterIndex startIndex, CharacterIndex endIndex, OperationsMask operations );
+ void ClearCharacterModelData(CharacterIndex startIndex, CharacterIndex endIndex, OperationsMask operations);
/**
* @brief Helper to clear completely the parts of the model related with the glyphs specified by the given @p operations.
* @param[in] endIndex Index to the last character to be cleared.
* @param[in] operations The operations required.
*/
- void ClearGlyphModelData( CharacterIndex startIndex, CharacterIndex endIndex, OperationsMask operations );
+ void ClearGlyphModelData(CharacterIndex startIndex, CharacterIndex endIndex, OperationsMask operations);
/**
* @brief Helper to clear the parts of the model specified by the given @p operations and from @p startIndex to @p endIndex.
* @param[in] endIndex Index to the last character to be cleared.
* @param[in] operations The operations required.
*/
- void ClearModelData( CharacterIndex startIndex, CharacterIndex endIndex, OperationsMask operations );
+ void ClearModelData(CharacterIndex startIndex, CharacterIndex endIndex, OperationsMask operations);
/**
* @brief Updates the logical and visual models. Updates the style runs in the visual model when the text's styles changes.
*
* @return @e true if the model has been modified.
*/
- bool UpdateModel( OperationsMask operationsRequired );
+ bool UpdateModel(OperationsMask operationsRequired);
/**
* @brief Retreieves the default style.
*
* @param[out] inputStyle The default style.
*/
- void RetrieveDefaultInputStyle( InputStyle& inputStyle );
+ void RetrieveDefaultInputStyle(InputStyle& inputStyle);
/**
* @brief Retrieve the line height of the default font.
/**
* @copydoc Text::Controller::SetPrimaryCursorPosition()
*/
- bool SetPrimaryCursorPosition( CharacterIndex index );
+ bool SetPrimaryCursorPosition(CharacterIndex index);
/**
* @copydoc Text::SelectableControlInterface::SetTextSelectionRange()
*/
- void SetTextSelectionRange(const uint32_t *pStart, const uint32_t *pEndf);
+ void SetTextSelectionRange(const uint32_t* pStart, const uint32_t* pEndf);
/**
* @copydoc Text::SelectableControlInterface::GetTextSelectionRange()
/**
* @copydoc Text::EditableControlInterface::SetEditable()
*/
- void SetEditable( bool editable );
+ void SetEditable(bool editable);
/**
* @brief Retrieves the selected text. It removes the text if the @p deleteAfterRetrieval parameter is @e true.
* @param[out] selectedText The selected text encoded in utf8.
* @param[in] deleteAfterRetrieval Whether the text should be deleted after retrieval.
*/
- void RetrieveSelection( std::string& selectedText, bool deleteAfterRetrieval );
+ void RetrieveSelection(std::string& selectedText, bool deleteAfterRetrieval);
- void SetSelection( int start, int end );
+ void SetSelection(int start, int end);
- std::pair< int, int > GetSelectionIndexes() const;
+ std::pair<int, int> GetSelectionIndexes() const;
void ShowClipboard();
void SetClipboardHideEnable(bool enable);
- bool CopyStringToClipboard( const std::string& source );
+ bool CopyStringToClipboard(const std::string& source);
- void SendSelectionToClipboard( bool deleteAfterSending );
+ void SendSelectionToClipboard(bool deleteAfterSending);
void RequestGetTextFromClipboard();
void RepositionSelectionHandles();
- void RepositionSelectionHandles( float visualX, float visualY, Controller::NoTextTap::Action action );
+ void RepositionSelectionHandles(float visualX, float visualY, Controller::NoTextTap::Action action);
void SetPopupButtons();
- void ChangeState( EventData::State newState );
+ void ChangeState(EventData::State newState);
/**
* @brief Calculates the cursor's position for a given character index in the logical order.
* @param[in] logical The logical cursor position (in characters). 0 is just before the first character, a value equal to the number of characters is just after the last character.
* @param[out] cursorInfo The line's height, the cursor's height, the cursor's position and whether there is an alternative cursor.
*/
- void GetCursorPosition( CharacterIndex logical,
- CursorInfo& cursorInfo );
+ void GetCursorPosition(CharacterIndex logical,
+ CursorInfo& cursorInfo);
/**
* @brief Calculates the new cursor index.
*
* @return The new cursor index.
*/
- CharacterIndex CalculateNewCursorIndex( CharacterIndex index ) const;
+ CharacterIndex CalculateNewCursorIndex(CharacterIndex index) const;
/**
* @brief Updates the cursor position.
* @param[in] cursorInfo Contains the selection handle position in Actor's coords.
*
*/
- void UpdateCursorPosition( const CursorInfo& cursorInfo );
+ void UpdateCursorPosition(const CursorInfo& cursorInfo);
/**
* @brief Updates the position of the given selection handle. It transforms the handle's position into decorator's coords.
* @param[in] handleType One of the selection handles.
* @param[in] cursorInfo Contains the selection handle position in Actor's coords.
*/
- void UpdateSelectionHandle( HandleType handleType,
- const CursorInfo& cursorInfo );
+ void UpdateSelectionHandle(HandleType handleType,
+ const CursorInfo& cursorInfo);
/**
* @biref Clamps the horizontal scrolling to get the control always filled with text.
*
* @param[in] layoutSize The size of the laid out text.
*/
- void ClampHorizontalScroll( const Vector2& layoutSize );
+ void ClampHorizontalScroll(const Vector2& layoutSize);
/**
* @biref Clamps the vertical scrolling to get the control always filled with text.
*
* @param[in] layoutSize The size of the laid out text.
*/
- void ClampVerticalScroll( const Vector2& layoutSize );
+ void ClampVerticalScroll(const Vector2& layoutSize);
/**
* @brief Scrolls the text to make a position visible.
* This method is called after inserting text, moving the cursor with the grab handle or the keypad,
* or moving the selection handles.
*/
- void ScrollToMakePositionVisible( const Vector2& position, float lineHeight );
+ void ScrollToMakePositionVisible(const Vector2& position, float lineHeight);
/**
* @brief Scrolls the text to make the cursor visible.
*
* This method is called after deleting text.
*/
- void ScrollTextToMatchCursor( const CursorInfo& cursorInfo );
+ void ScrollTextToMatchCursor(const CursorInfo& cursorInfo);
/**
* @brief Scrolls the text to make primary cursor visible.
*/
- void ScrollTextToMatchCursor( );
+ void ScrollTextToMatchCursor();
/**
* @brief Create an actor that renders the text background color
Actor CreateBackgroundActor();
public:
-
/**
* @brief Gets implementation from the controller handle.
* @param controller The text controller
* @return The implementation of the Controller
*/
- static Impl& GetImplementation( Text::Controller& controller )
+ static Impl& GetImplementation(Text::Controller& controller)
{
return *controller.mImpl;
}
private:
// Declared private and left undefined to avoid copies.
- Impl( const Impl& );
+ Impl(const Impl&);
// Declared private and left undefined to avoid copies.
- Impl& operator=( const Impl& );
+ Impl& operator=(const Impl&);
public:
-
- ControlInterface* mControlInterface; ///< Reference to the text controller.
- EditableControlInterface* mEditableControlInterface; ///< Reference to the editable text controller.
+ ControlInterface* mControlInterface; ///< Reference to the text controller.
+ EditableControlInterface* mEditableControlInterface; ///< Reference to the editable text controller.
SelectableControlInterface* mSelectableControlInterface; ///< Reference to the selectable text controller.
- ModelPtr mModel; ///< Pointer to the text's model.
- FontDefaults* mFontDefaults; ///< Avoid allocating this when the user does not specify a font.
- UnderlineDefaults* mUnderlineDefaults; ///< Avoid allocating this when the user does not specify underline parameters.
- ShadowDefaults* mShadowDefaults; ///< Avoid allocating this when the user does not specify shadow parameters.
- EmbossDefaults* mEmbossDefaults; ///< Avoid allocating this when the user does not specify emboss parameters.
- OutlineDefaults* mOutlineDefaults; ///< Avoid allocating this when the user does not specify outline parameters.
- EventData* mEventData; ///< Avoid allocating everything for text input until EnableTextInput().
- TextAbstraction::FontClient mFontClient; ///< Handle to the font client.
- Clipboard mClipboard; ///< Handle to the system clipboard
- View mView; ///< The view interface to the rendering back-end.
- MetricsPtr mMetrics; ///< A wrapper around FontClient used to get metrics & potentially down-scaled Emoji metrics.
- Layout::Engine mLayoutEngine; ///< The layout engine.
- Vector<ModifyEvent> mModifyEvents; ///< Temporary stores the text set until the next relayout.
- Vector4 mTextColor; ///< The regular text color
- TextUpdateInfo mTextUpdateInfo; ///< Info of the characters updated.
- OperationsMask mOperationsPending; ///< Operations pending to be done to layout the text.
- Length mMaximumNumberOfCharacters; ///< Maximum number of characters that can be inserted.
- HiddenText* mHiddenInput; ///< Avoid allocating this when the user does not specify hidden input mode.
- Vector2 mTextFitContentSize; ///< Size of Text fit content
-
- bool mRecalculateNaturalSize:1; ///< Whether the natural size needs to be recalculated.
- bool mMarkupProcessorEnabled:1; ///< Whether the mark-up procesor is enabled.
- bool mClipboardHideEnabled:1; ///< Whether the ClipboardHide function work or not
- bool mIsAutoScrollEnabled:1; ///< Whether auto text scrolling is enabled.
- bool mUpdateTextDirection:1; ///< Whether the text direction needs to be updated.
- CharacterDirection mIsTextDirectionRTL:1; ///< Whether the text direction is right to left or not
-
- bool mUnderlineSetByString:1; ///< Set when underline is set by string (legacy) instead of map
- bool mShadowSetByString:1; ///< Set when shadow is set by string (legacy) instead of map
- bool mOutlineSetByString:1; ///< Set when outline is set by string (legacy) instead of map
- bool mFontStyleSetByString:1; ///< Set when font style is set by string (legacy) instead of map
- bool mShouldClearFocusOnEscape:1; ///< Whether text control should clear key input focus
- LayoutDirection::Type mLayoutDirection; ///< Current system language direction
-
- Shader mShaderBackground; ///< The shader for text background.
-
- float mTextFitMinSize; ///< Minimum Font Size for text fit. Default 10
- float mTextFitMaxSize; ///< Maximum Font Size for text fit. Default 100
- float mTextFitStepSize; ///< Step Size for font intervalse. Default 1
- bool mTextFitEnabled : 1; ///< Whether the text's fit is enabled.
- float mFontSizeScale; ///< Scale value for Font Size. Default 1.0
+ ModelPtr mModel; ///< Pointer to the text's model.
+ FontDefaults* mFontDefaults; ///< Avoid allocating this when the user does not specify a font.
+ UnderlineDefaults* mUnderlineDefaults; ///< Avoid allocating this when the user does not specify underline parameters.
+ ShadowDefaults* mShadowDefaults; ///< Avoid allocating this when the user does not specify shadow parameters.
+ EmbossDefaults* mEmbossDefaults; ///< Avoid allocating this when the user does not specify emboss parameters.
+ OutlineDefaults* mOutlineDefaults; ///< Avoid allocating this when the user does not specify outline parameters.
+ EventData* mEventData; ///< Avoid allocating everything for text input until EnableTextInput().
+ TextAbstraction::FontClient mFontClient; ///< Handle to the font client.
+ Clipboard mClipboard; ///< Handle to the system clipboard
+ View mView; ///< The view interface to the rendering back-end.
+ MetricsPtr mMetrics; ///< A wrapper around FontClient used to get metrics & potentially down-scaled Emoji metrics.
+ Layout::Engine mLayoutEngine; ///< The layout engine.
+ Vector<ModifyEvent> mModifyEvents; ///< Temporary stores the text set until the next relayout.
+ Vector4 mTextColor; ///< The regular text color
+ TextUpdateInfo mTextUpdateInfo; ///< Info of the characters updated.
+ OperationsMask mOperationsPending; ///< Operations pending to be done to layout the text.
+ Length mMaximumNumberOfCharacters; ///< Maximum number of characters that can be inserted.
+ HiddenText* mHiddenInput; ///< Avoid allocating this when the user does not specify hidden input mode.
+ Vector2 mTextFitContentSize; ///< Size of Text fit content
+
+ bool mRecalculateNaturalSize : 1; ///< Whether the natural size needs to be recalculated.
+ bool mMarkupProcessorEnabled : 1; ///< Whether the mark-up procesor is enabled.
+ bool mClipboardHideEnabled : 1; ///< Whether the ClipboardHide function work or not
+ bool mIsAutoScrollEnabled : 1; ///< Whether auto text scrolling is enabled.
+ bool mUpdateTextDirection : 1; ///< Whether the text direction needs to be updated.
+ CharacterDirection mIsTextDirectionRTL : 1; ///< Whether the text direction is right to left or not
+
+ bool mUnderlineSetByString : 1; ///< Set when underline is set by string (legacy) instead of map
+ bool mShadowSetByString : 1; ///< Set when shadow is set by string (legacy) instead of map
+ bool mOutlineSetByString : 1; ///< Set when outline is set by string (legacy) instead of map
+ bool mFontStyleSetByString : 1; ///< Set when font style is set by string (legacy) instead of map
+ bool mShouldClearFocusOnEscape : 1; ///< Whether text control should clear key input focus
+ LayoutDirection::Type mLayoutDirection; ///< Current system language direction
+
+ Shader mShaderBackground; ///< The shader for text background.
+
+ float mTextFitMinSize; ///< Minimum Font Size for text fit. Default 10
+ float mTextFitMaxSize; ///< Maximum Font Size for text fit. Default 100
+ float mTextFitStepSize; ///< Step Size for font intervalse. Default 1
+ bool mTextFitEnabled : 1; ///< Whether the text's fit is enabled.
+ float mFontSizeScale; ///< Scale value for Font Size. Default 1.0
private:
friend ControllerImplEventHandler;
#define DALI_TOOLKIT_TEXT_CONTROLLER_INPUT_FONT_HANDLER_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
struct Controller::InputFontHandler
{
- static void SetInputFontFamily(Controller& controller, const std::string& fontFamily);
+ static void SetInputFontFamily(Controller& controller, const std::string& fontFamily);
static const std::string& GetInputFontFamily(const Controller& controller);
- static void SetInputFontWeight(const Controller& controller, FontWeight weight);
- static bool IsInputFontWeightDefined(const Controller& controller);
- static FontWeight GetInputFontWeight(const Controller& controller);
- static void SetInputFontWidth(Controller& controller, FontWidth width);
- static bool IsInputFontWidthDefined(const Controller& controller);
- static FontWidth GetInputFontWidth(const Controller& controller);
- static void SetInputFontSlant(Controller& controller, FontSlant slant);
- static bool IsInputFontSlantDefined(const Controller& controller);
- static FontSlant GetInputFontSlant(const Controller& controller);
- static void SetInputFontPointSize(Controller& controller, float size);
- static float GetInputFontPointSize(const Controller& controller);
+ static void SetInputFontWeight(const Controller& controller, FontWeight weight);
+ static bool IsInputFontWeightDefined(const Controller& controller);
+ static FontWeight GetInputFontWeight(const Controller& controller);
+ static void SetInputFontWidth(Controller& controller, FontWidth width);
+ static bool IsInputFontWidthDefined(const Controller& controller);
+ static FontWidth GetInputFontWidth(const Controller& controller);
+ static void SetInputFontSlant(Controller& controller, FontSlant slant);
+ static bool IsInputFontSlantDefined(const Controller& controller);
+ static FontSlant GetInputFontSlant(const Controller& controller);
+ static void SetInputFontPointSize(Controller& controller, float size);
+ static float GetInputFontPointSize(const Controller& controller);
};
} // namespace Text
#define DALI_TOOLKIT_TEXT_CONTROLLER_PLACEHOLDER_HANDLER_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
struct Controller::PlaceholderHandler
{
- static void SetPlaceholderTextElideEnabled(Controller& controller, bool enabled);
- static bool IsPlaceholderTextElideEnabled(const Controller& controller);
- static void SetPlaceholderText(Controller& controller, PlaceholderType type, const std::string& text);
- static void GetPlaceholderText(const Controller& controller, PlaceholderType type, std::string& text);
- static void SetPlaceholderFontFamily(Controller& controller, const std::string& placeholderTextFontFamily);
+ static void SetPlaceholderTextElideEnabled(Controller& controller, bool enabled);
+ static bool IsPlaceholderTextElideEnabled(const Controller& controller);
+ static void SetPlaceholderText(Controller& controller, PlaceholderType type, const std::string& text);
+ static void GetPlaceholderText(const Controller& controller, PlaceholderType type, std::string& text);
+ static void SetPlaceholderFontFamily(Controller& controller, const std::string& placeholderTextFontFamily);
static const std::string& GetPlaceholderFontFamily(const Controller& controller);
- static void SetPlaceholderTextFontWeight(Controller& controller, FontWeight weight);
- static bool IsPlaceholderTextFontWeightDefined(const Controller& controller);
- static FontWeight GetPlaceholderTextFontWeight(const Controller& controller);
- static void SetPlaceholderTextFontWidth(Controller& controller, FontWidth width);
- static bool IsPlaceholderTextFontWidthDefined(const Controller& controller);
- static FontWidth GetPlaceholderTextFontWidth(const Controller& controller);
- static void SetPlaceholderTextFontSlant(Controller& controller, FontSlant slant);
- static bool IsPlaceholderTextFontSlantDefined(const Controller& controller);
- static FontSlant GetPlaceholderTextFontSlant(const Controller& controller);
- static void SetPlaceholderTextFontSize(Controller& controller, float fontSize, FontSizeType type);
- static float GetPlaceholderTextFontSize(const Controller& controller, FontSizeType type );
- static void SetPlaceholderTextColor(Controller& controller, const Vector4& textColor );
- static const Vector4& GetPlaceholderTextColor(const Controller& controller);
- static void SetPlaceholderProperty(Controller& controller, const Property::Map& map );
- static void GetPlaceholderProperty(Controller& controller, Property::Map& map);
- static void ShowPlaceholderText(Controller& controller);
+ static void SetPlaceholderTextFontWeight(Controller& controller, FontWeight weight);
+ static bool IsPlaceholderTextFontWeightDefined(const Controller& controller);
+ static FontWeight GetPlaceholderTextFontWeight(const Controller& controller);
+ static void SetPlaceholderTextFontWidth(Controller& controller, FontWidth width);
+ static bool IsPlaceholderTextFontWidthDefined(const Controller& controller);
+ static FontWidth GetPlaceholderTextFontWidth(const Controller& controller);
+ static void SetPlaceholderTextFontSlant(Controller& controller, FontSlant slant);
+ static bool IsPlaceholderTextFontSlantDefined(const Controller& controller);
+ static FontSlant GetPlaceholderTextFontSlant(const Controller& controller);
+ static void SetPlaceholderTextFontSize(Controller& controller, float fontSize, FontSizeType type);
+ static float GetPlaceholderTextFontSize(const Controller& controller, FontSizeType type);
+ static void SetPlaceholderTextColor(Controller& controller, const Vector4& textColor);
+ static const Vector4& GetPlaceholderTextColor(const Controller& controller);
+ static void SetPlaceholderProperty(Controller& controller, const Property::Map& map);
+ static void GetPlaceholderProperty(Controller& controller, Property::Map& map);
+ static void ShowPlaceholderText(Controller& controller);
};
} // namespace Text
#define DALI_TOOLKIT_TEXT_CONTROLLER_RELAYOUTER_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* Contains all the relayouting related methods for Text::Controller
*/
* @param[in/out] layoutSize The Layout size which can be updated depending on the result of the performed operations
* @return
*/
- static bool DoRelayout(Controller& controller, const Size& size, OperationsMask operationsRequired, Size& layoutSize );
+ static bool DoRelayout(Controller& controller, const Size& size, OperationsMask operationsRequired, Size& layoutSize);
/**
* @brief Called by the Controller to calculate the veritcal offset give the control size.
#define DALI_TOOLKIT_TEXT_UPDATER_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
-
// EXTERNAL INCLUDES
#include <string>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief Methods that update the text
*/
#define DALI_TOOLKIT_TEXT_CONTROLLER_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/events/gesture.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/text/text-enumerations.h>
-#include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h>
#include <dali-toolkit/devel-api/controls/text-controls/text-label-devel.h>
+#include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h>
#include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
#include <dali-toolkit/internal/text/decorator/text-decorator.h>
-#include <dali-toolkit/internal/text/layouts/layout-engine.h>
#include <dali-toolkit/internal/text/hidden-text.h>
+#include <dali-toolkit/internal/text/layouts/layout-engine.h>
#include <dali-toolkit/internal/text/text-model-interface.h>
#include <dali-toolkit/internal/text/text-selectable-control-interface.h>
+#include <dali-toolkit/public-api/text/text-enumerations.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
class Controller;
class ControlInterface;
class EditableControlInterface;
class View;
class RenderingController;
- /**
+/**
* @brief Text selection operations .
*/
- enum SelectionType
- {
- INTERACTIVE = 0x0000,
- ALL = 0x0001,
- NONE = 0x0002
- };
+enum SelectionType
+{
+ INTERACTIVE = 0x0000,
+ ALL = 0x0001,
+ NONE = 0x0002
+};
typedef IntrusivePtr<Controller> ControllerPtr;
class Controller : public RefObject, public Decorator::ControllerInterface, public TextSelectionPopupCallbackInterface, public HiddenText::Observer
{
public: // Enumerated types.
-
/**
* @brief Text related operations to be done in the relayout process.
*/
*/
enum FontSizeType
{
- POINT_SIZE, // The size of font in points.
- PIXEL_SIZE // The size of font in pixels.
+ POINT_SIZE, // The size of font in points.
+ PIXEL_SIZE // The size of font in pixels.
};
struct NoTextTap
};
public: // Constructor.
-
/**
* @brief Create a new instance of a Controller.
*
*
* @return A pointer to a new Controller.
*/
- static ControllerPtr New( ControlInterface* controlInterface );
+ static ControllerPtr New(ControlInterface* controlInterface);
/**
* @brief Create a new instance of a Controller.
*
* @return A pointer to a new Controller.
*/
- static ControllerPtr New( ControlInterface* controlInterface,
- EditableControlInterface* editableControlInterface,
- SelectableControlInterface* selectableControlInterface );
+ static ControllerPtr New(ControlInterface* controlInterface,
+ EditableControlInterface* editableControlInterface,
+ SelectableControlInterface* selectableControlInterface);
public: // Configure the text controller.
-
/**
* @brief Called to enable text input.
*
* @param[in] decorator Used to create cursor, selection handle decorations etc.
* @param[in] inputMethodContext Used to manager ime.
*/
- void EnableTextInput( DecoratorPtr decorator, InputMethodContext& inputMethodContext );
+ void EnableTextInput(DecoratorPtr decorator, InputMethodContext& inputMethodContext);
/**
* @brief Used to switch between bitmap & vector based glyphs
*
* @param[in] glyphType The type of glyph; note that metrics for bitmap & vector based glyphs are different.
*/
- void SetGlyphType( TextAbstraction::GlyphType glyphType );
+ void SetGlyphType(TextAbstraction::GlyphType glyphType);
/**
* @brief Enables/disables the mark-up processor.
*
* @param[in] enable Whether to enable the mark-up processor.
*/
- void SetMarkupProcessorEnabled( bool enable );
+ void SetMarkupProcessorEnabled(bool enable);
/**
* @brief Retrieves whether the mark-up processor is enabled.
*
* @param[in] enable Whether to enable the auto scrolling
*/
- void SetAutoScrollEnabled( bool enable );
+ void SetAutoScrollEnabled(bool enable);
/**
* @brief Retrieves whether auto text scrolling is enabled.
*
* @param[in] enable Whether to enable the horizontal scrolling.
*/
- void SetHorizontalScrollEnabled( bool enable );
+ void SetHorizontalScrollEnabled(bool enable);
/**
* @brief Retrieves whether the horizontal scrolling is enabled.
*
* @param[in] enable Whether to enable the vertical scrolling.
*/
- void SetVerticalScrollEnabled( bool enable );
+ void SetVerticalScrollEnabled(bool enable);
/**
* @brief Retrieves whether the verticall scrolling is enabled.
*
* @param[in] enable Whether to enable the smooth handle panning.
*/
- void SetSmoothHandlePanEnabled( bool enable );
+ void SetSmoothHandlePanEnabled(bool enable);
/**
* @brief Retrieves whether the smooth handle panning is enabled.
*
* @param[in] maxCharacters maximum number of characters to be accepted
*/
- void SetMaximumNumberOfCharacters( Length maxCharacters );
+ void SetMaximumNumberOfCharacters(Length maxCharacters);
/**
* @brief Sets the maximum number of characters that can be inserted into the TextModel
* @note Only editable controls should calls this.
* @param[in] enabled Whether the cursor should blink or not.
*/
- void SetEnableCursorBlink( bool enable );
+ void SetEnableCursorBlink(bool enable);
/**
* @brief Query whether cursor blink is enabled.
*
* @param[in] enable \e true enables the multi-line (by default)
*/
- void SetMultiLineEnabled( bool enable );
+ void SetMultiLineEnabled(bool enable);
/**
* @return Whether the multi-line layout is enabled.
*
* @param[in] alignment The horizontal alignment.
*/
- void SetHorizontalAlignment( HorizontalAlignment::Type alignment );
+ void SetHorizontalAlignment(HorizontalAlignment::Type alignment);
/**
* @copydoc ModelInterface::GetHorizontalAlignment()
*
* @param[in] alignment The vertical alignment.
*/
- void SetVerticalAlignment( VerticalAlignment::Type alignment );
+ void SetVerticalAlignment(VerticalAlignment::Type alignment);
/**
* @copydoc ModelInterface::GetVerticalAlignment()
* @brief Sets the text's wrap mode
* @param[in] text wrap mode The unit of wrapping
*/
- void SetLineWrapMode( Text::LineWrap::Mode textWarpMode );
+ void SetLineWrapMode(Text::LineWrap::Mode textWarpMode);
/**
* @brief Retrieve text wrap mode previously set.
*
* @param[in] enabled Whether to enable the text elide.
*/
- void SetTextElideEnabled( bool enabled );
+ void SetTextElideEnabled(bool enabled);
/**
* @copydoc ModelInterface::IsTextElideEnabled()
* @param[in] minimum size value.
* @param[in] type The font size type is point size or pixel size
*/
- void SetTextFitMinSize( float pointSize, FontSizeType type );
+ void SetTextFitMinSize(float pointSize, FontSizeType type);
/**
* @brief Retrieves the minimum point size valid for text fit.
* @param[in] maximum size value.
* @param[in] type The font size type is point size or pixel size
*/
- void SetTextFitMaxSize( float pointSize, FontSizeType type );
+ void SetTextFitMaxSize(float pointSize, FontSizeType type);
/**
* @brief Retrieves the maximum point size valid for text fit.
* @param[in] step size value.
* @param[in] type The font size type is point size or pixel size
*/
- void SetTextFitStepSize( float step, FontSizeType type );
+ void SetTextFitStepSize(float step, FontSizeType type);
/**
* @brief Retrieves the step point size valid for text fit.
* @brief Enable or disable the placeholder text elide.
* @param enabled Whether to enable the placeholder text elide.
*/
- void SetPlaceholderTextElideEnabled( bool enabled );
+ void SetPlaceholderTextElideEnabled(bool enabled);
/**
* @brief Whether the placeholder text elide property is enabled.
* @brief Enable or disable the text selection.
* @param[in] enabled Whether to enable the text selection.
*/
- void SetSelectionEnabled( bool enabled );
+ void SetSelectionEnabled(bool enabled);
/**
* @brief Whether the text selection is enabled or not.
* @brief Enable or disable the text selection using Shift key.
* @param enabled Whether to enable the text selection using Shift key
*/
- void SetShiftSelectionEnabled( bool enabled );
+ void SetShiftSelectionEnabled(bool enabled);
/**
* @brief Whether the text selection using Shift key is enabled or not.
*
* @param[in] enabled Whether to enable the grab handles
*/
- void SetGrabHandleEnabled( bool enabled );
+ void SetGrabHandleEnabled(bool enabled);
/**
* @brief Returns whether the grab handles are enabled.
*
* @param[in] enabled Whether to enable the grab handles
*/
- void SetGrabHandlePopupEnabled( bool enabled );
+ void SetGrabHandlePopupEnabled(bool enabled);
/**
* @brief Returns whether the grab handles are enabled.
*
* @param[in] passwordInput True if password input is enabled.
*/
- void SetInputModePassword( bool passwordInput );
+ void SetInputModePassword(bool passwordInput);
/**
* @brief Returns whether the input mode type is set as password.
*
* @param[in] action The action to do.
*/
- void SetNoTextDoubleTapAction( NoTextTap::Action action );
+ void SetNoTextDoubleTapAction(NoTextTap::Action action);
/**
* @brief Retrieves the action when there is a double tap event on top of a text area with no text.
*
* @param[in] action The action to do.
*/
- void SetNoTextLongPressAction( NoTextTap::Action action );
+ void SetNoTextLongPressAction(NoTextTap::Action action);
/**
* @brief Retrieves the action when there is a long press event on top of a text area with no text.
* Set method underline setting were set by
* @param[in] bool, true if set by string
*/
- void UnderlineSetByString( bool setByString );
+ void UnderlineSetByString(bool setByString);
/**
* @brief Query if shadow settings were provided by string or map
* Set method shadow setting were set by
* @param[in] bool, true if set by string
*/
- void ShadowSetByString( bool setByString );
+ void ShadowSetByString(bool setByString);
/**
* @brief Query if outline settings were provided by string or map
* Set method outline setting were set by
* @param[in] bool, true if set by string
*/
- void OutlineSetByString( bool setByString );
+ void OutlineSetByString(bool setByString);
/**
* @brief Query if font style settings were provided by string or map
* Set method font style setting were set by
* @param[in] bool, true if set by string
*/
- void FontStyleSetByString( bool setByString );
+ void FontStyleSetByString(bool setByString);
public: // Update.
-
/**
* @brief Replaces any text previously set.
*
* @note This will be converted into UTF-32 when stored in the text model.
* @param[in] text A string of UTF-8 characters.
*/
- void SetText( const std::string& text );
+ void SetText(const std::string& text);
/**
* @brief Retrieve any text previously set.
*
* @param[out] text A string of UTF-8 characters.
*/
- void GetText( std::string& text ) const;
+ void GetText(std::string& text) const;
/**
* @brief Replaces any placeholder text previously set.
* @param[in] type Different placeholder-text can be shown when the control is active/inactive.
* @param[in] text A string of UTF-8 characters.
*/
- void SetPlaceholderText( PlaceholderType type, const std::string& text );
+ void SetPlaceholderText(PlaceholderType type, const std::string& text);
/**
* @brief Retrieve any placeholder text previously set.
* @param[in] type Different placeholder-text can be shown when the control is active/inactive.
* @param[out] A string of UTF-8 characters.
*/
- void GetPlaceholderText( PlaceholderType type, std::string& text ) const;
+ void GetPlaceholderText(PlaceholderType type, std::string& text) const;
/**
* @ brief Update the text after a font change
* @param[in] newDefaultFont The new font to change to
*/
- void UpdateAfterFontChange( const std::string& newDefaultFont );
+ void UpdateAfterFontChange(const std::string& newDefaultFont);
/**
* @brief The method acquires currently selected text
* @param selectedText variable to place selected text in
*/
- void RetrieveSelection( std::string& selectedText ) const;
+ void RetrieveSelection(std::string& selectedText) const;
/**
* @brief The method sets selection in given range
* @param start index of first character
* @param end index of first character after selection
*/
- void SetSelection( int start, int end );
+ void SetSelection(int start, int end);
/**
* @brief This method retrieve indexes of current selection
*
* @return a pair, where first element is left index of selection and second is the right one
*/
- std::pair< int, int > GetSelectionIndexes() const;
+ std::pair<int, int> GetSelectionIndexes() const;
/**
* Place string in system clipboard
* @param source std::string
*/
- void CopyStringToClipboard( const std::string& source );
+ void CopyStringToClipboard(const std::string& source);
/**
* Place currently selected text in system clipboard
* @param deleteAfterSending flag pointing if text should be deleted after sending to clipboard
*/
- void SendSelectionToClipboard( bool deleteAfterSending );
+ void SendSelectionToClipboard(bool deleteAfterSending);
public: // Default style & Input style
-
/**
* @brief Set the default font family.
*
* @param[in] defaultFontFamily The default font family.
*/
- void SetDefaultFontFamily( const std::string& defaultFontFamily );
+ void SetDefaultFontFamily(const std::string& defaultFontFamily);
/**
* @brief Retrieve the default font family.
* @brief Sets the placeholder text font family.
* @param[in] placeholderTextFontFamily The placeholder text font family.
*/
- void SetPlaceholderFontFamily( const std::string& placeholderTextFontFamily );
+ void SetPlaceholderFontFamily(const std::string& placeholderTextFontFamily);
/**
* @brief Retrieves the placeholder text font family.
*
* @param[in] weight The font weight.
*/
- void SetDefaultFontWeight( FontWeight weight );
+ void SetDefaultFontWeight(FontWeight weight);
/**
* @brief Whether the font's weight has been defined.
*
* @param[in] weight The font weight
*/
- void SetPlaceholderTextFontWeight( FontWeight weight );
+ void SetPlaceholderTextFontWeight(FontWeight weight);
/**
* @brief Whether the font's weight has been defined.
*
* @param[in] width The font width.
*/
- void SetDefaultFontWidth( FontWidth width );
+ void SetDefaultFontWidth(FontWidth width);
/**
* @brief Whether the font's width has been defined.
*
* @param[in] width The font width
*/
- void SetPlaceholderTextFontWidth( FontWidth width );
+ void SetPlaceholderTextFontWidth(FontWidth width);
/**
* @brief Whether the font's width has been defined.
*
* @param[in] slant The font slant.
*/
- void SetDefaultFontSlant( FontSlant slant );
+ void SetDefaultFontSlant(FontSlant slant);
/**
* @brief Whether the font's slant has been defined.
*
* @param[in] slant The font slant
*/
- void SetPlaceholderTextFontSlant( FontSlant slant );
+ void SetPlaceholderTextFontSlant(FontSlant slant);
/**
* @brief Whether the font's slant has been defined.
* @param[in] fontSize The default font size
* @param[in] type The font size type is point size or pixel size
*/
- void SetDefaultFontSize( float fontSize, FontSizeType type );
+ void SetDefaultFontSize(float fontSize, FontSizeType type);
/**
* @brief Retrieve the default point size.
* @param[in] type The font size type
* @return The default point size.
*/
- float GetDefaultFontSize( FontSizeType type ) const;
+ float GetDefaultFontSize(FontSizeType type) const;
/**
* @brief Set the font size scale.
*
* @param[in] scale The font size scale
*/
- void SetFontSizeScale( float scale );
+ void SetFontSizeScale(float scale);
/**
* @brief Get the font size scale.
* @param[in] fontSize The placeholder text font size
* @param[in] type The font size type is point size or pixel size
*/
- void SetPlaceholderTextFontSize( float fontSize, FontSizeType type );
+ void SetPlaceholderTextFontSize(float fontSize, FontSizeType type);
/**
* @brief Retrieves the Placeholder text font size.
* @param[in] type The font size type
* @return The placeholder font size
*/
- float GetPlaceholderTextFontSize( FontSizeType type ) const;
+ float GetPlaceholderTextFontSize(FontSizeType type) const;
/**
* @brief Sets the text's default color.
*
* @param color The default color.
*/
- void SetDefaultColor( const Vector4& color );
+ void SetDefaultColor(const Vector4& color);
/**
* @brief Retrieves the text's default color.
*
* @param textColor The text color
*/
- void SetPlaceholderTextColor( const Vector4& textColor );
+ void SetPlaceholderTextColor(const Vector4& textColor);
/**
* @brief Retrieve the text color
*
* @param[in] shadowOffset The shadow offset, 0,0 indicates no shadow.
*/
- void SetShadowOffset( const Vector2& shadowOffset );
+ void SetShadowOffset(const Vector2& shadowOffset);
/**
* @brief Retrieve the shadow offset.
*
* @param[in] shadowColor The shadow color.
*/
- void SetShadowColor( const Vector4& shadowColor );
+ void SetShadowColor(const Vector4& shadowColor);
/**
* @brief Retrieve the shadow color.
*
* @param[in] shadowBlurRadius The shadow blur radius, 0,0 indicates no blur.
*/
- void SetShadowBlurRadius( const float& shadowBlurRadius );
+ void SetShadowBlurRadius(const float& shadowBlurRadius);
/**
* @brief Retrieve the shadow blur radius.
*
* @param[in] color color of underline.
*/
- void SetUnderlineColor( const Vector4& color );
+ void SetUnderlineColor(const Vector4& color);
/**
* @brief Retrieve the underline color.
*
* @param[in] enabled The underline enabled flag.
*/
- void SetUnderlineEnabled( bool enabled );
+ void SetUnderlineEnabled(bool enabled);
/**
* @brief Returns whether the text is underlined or not.
*
* @param[in] height The height in pixels of the underline
*/
- void SetUnderlineHeight( float height );
+ void SetUnderlineHeight(float height);
/**
* @brief Retrieves the override height of an underline, 0 indicates height is supplied by font metrics
*
* @param[in] color color of outline.
*/
- void SetOutlineColor( const Vector4& color );
+ void SetOutlineColor(const Vector4& color);
/**
* @brief Retrieve the outline color.
*
* @param[in] width The width in pixels of the outline, 0 indicates no outline
*/
- void SetOutlineWidth( uint16_t width );
+ void SetOutlineWidth(uint16_t width);
/**
* @brief Retrieves the width of an outline
*
* @param[in] color color of background.
*/
- void SetBackgroundColor( const Vector4& color );
+ void SetBackgroundColor(const Vector4& color);
/**
* @brief Retrieve the background color.
*
* @param[in] enabled The background enabled flag.
*/
- void SetBackgroundEnabled( bool enabled );
+ void SetBackgroundEnabled(bool enabled);
/**
* @brief Returns whether to enable text background or not.
*
* @param[in] embossProperties The emboss's properties string.
*/
- void SetDefaultEmbossProperties( const std::string& embossProperties );
+ void SetDefaultEmbossProperties(const std::string& embossProperties);
/**
* @brief Retrieves the emboss's properties string.
*
* @param[in] outlineProperties The outline's properties string.
*/
- void SetDefaultOutlineProperties( const std::string& outlineProperties );
+ void SetDefaultOutlineProperties(const std::string& outlineProperties);
/**
* @brief Retrieves the outline's properties string.
*
* @return True if lineSpacing has been updated, false otherwise
*/
- bool SetDefaultLineSpacing( float lineSpacing );
+ bool SetDefaultLineSpacing(float lineSpacing);
/**
* @brief Retrieves the default line spacing.
*
* @return True if lineSize has been updated, false otherwise
*/
- bool SetDefaultLineSize( float lineSize );
+ bool SetDefaultLineSize(float lineSize);
/**
* @brief Retrieves the default line size.
*
* @param[in] color The input text's color.
*/
- void SetInputColor( const Vector4& color );
+ void SetInputColor(const Vector4& color);
/**
* @brief Retrieves the input text's color.
*
* @param[in] fontFamily The text's font family name.
*/
- void SetInputFontFamily( const std::string& fontFamily );
+ void SetInputFontFamily(const std::string& fontFamily);
/**
* @brief Retrieves the input text's font family name.
*
* @param[in] weight The input font's weight.
*/
- void SetInputFontWeight( FontWeight weight );
+ void SetInputFontWeight(FontWeight weight);
/**
* @return Whether the font's weight has been defined.
*
* @param[in] width The input font's width.
*/
- void SetInputFontWidth( FontWidth width );
+ void SetInputFontWidth(FontWidth width);
/**
* @return Whether the font's width has been defined.
*
* @param[in] slant The input font's slant.
*/
- void SetInputFontSlant( FontSlant slant );
+ void SetInputFontSlant(FontSlant slant);
/**
* @return Whether the font's slant has been defined.
*
* @param[in] size The input font's point size.
*/
- void SetInputFontPointSize( float size );
+ void SetInputFontPointSize(float size);
/**
* @brief Retrieves the input font's point size.
*
* @param[in] lineSpacing The line spacing.
*/
- void SetInputLineSpacing( float lineSpacing );
+ void SetInputLineSpacing(float lineSpacing);
/**
* @brief Retrieves the input line spacing.
*
* @param[in] shadowProperties The shadow's properties string.
*/
- void SetInputShadowProperties( const std::string& shadowProperties );
+ void SetInputShadowProperties(const std::string& shadowProperties);
/**
* @brief Retrieves the input shadow's properties string.
*
* @param[in] underlineProperties The underline's properties string.
*/
- void SetInputUnderlineProperties( const std::string& underlineProperties );
+ void SetInputUnderlineProperties(const std::string& underlineProperties);
/**
* @brief Retrieves the input underline's properties string.
*
* @param[in] embossProperties The emboss's properties string.
*/
- void SetInputEmbossProperties( const std::string& embossProperties );
+ void SetInputEmbossProperties(const std::string& embossProperties);
/**
* @brief Retrieves the input emboss's properties string.
*
* @param[in] outlineProperties The outline's properties string.
*/
- void SetInputOutlineProperties( const std::string& outlineProperties );
+ void SetInputOutlineProperties(const std::string& outlineProperties);
/**
* @brief Retrieves the input outline's properties string.
*
* @param[in] controlInterface The control's interface.
*/
- void SetControlInterface( ControlInterface* controlInterface );
+ void SetControlInterface(ControlInterface* controlInterface);
public: // Queries & retrieves.
-
/**
* @brief Return the layout engine.
*
/**
* @copydoc Control::GetHeightForWidth()
*/
- float GetHeightForWidth( float width );
+ float GetHeightForWidth(float width);
/**
* @brief Calculates the point size for text for given layout()
*/
- void FitPointSizeforLayout( Size layoutSize );
+ void FitPointSizeforLayout(Size layoutSize);
/**
* @brief Checks if the point size fits within the layout size.
*
* @return Whether the point size fits within the layout size.
*/
- bool CheckForTextFit( float pointSize, Size& layoutSize );
+ bool CheckForTextFit(float pointSize, Size& layoutSize);
/**
* @brief Retrieves the text's number of lines for a given width.
* @param[in] width The width of the text's area.
* @ return The number of lines.
*/
- int GetLineCount( float width );
+ int GetLineCount(float width);
/**
* @brief Retrieves the text's model.
*
* @return Whether the text scroll position is changed or not after last update.
*/
- bool GetTextScrollInfo( float& scrollPosition, float& controlHeight, float& layoutHeight );
+ bool GetTextScrollInfo(float& scrollPosition, float& controlHeight, float& layoutHeight);
/**
* @brief Used to set the hidden input option
*/
- void SetHiddenInputOption( const Property::Map& options );
+ void SetHiddenInputOption(const Property::Map& options);
/**
* @brief Used to get the hidden input option
*/
- void GetHiddenInputOption( Property::Map& options );
+ void GetHiddenInputOption(Property::Map& options);
/**
* @brief Sets the Placeholder Properties.
*
* @param[in] map The placeholder property map
*/
- void SetPlaceholderProperty( const Property::Map& map );
+ void SetPlaceholderProperty(const Property::Map& map);
/**
* @brief Retrieves the Placeholder Property map.
*
* @param[out] map The property map
*/
- void GetPlaceholderProperty( Property::Map& map );
+ void GetPlaceholderProperty(Property::Map& map);
/**
* @brief Checks text direction.
* @brief Sets vertical line alignment
* @param[in] alignment The vertical line alignment for the text
*/
- void SetVerticalLineAlignment( Toolkit::DevelText::VerticalLineAlignment::Type alignment );
+ void SetVerticalLineAlignment(Toolkit::DevelText::VerticalLineAlignment::Type alignment);
/**
* @brief Retrieves ignoreSpaceAfterText value from model
* @brief Sets ignoreSpaceAfterText value to model
* @param[in] ignore The value of ignoreSpacesAfterText for the text
*/
- void SetIgnoreSpacesAfterText( bool ignore );
+ void SetIgnoreSpacesAfterText(bool ignore);
/**
* @brief Retrieves matchSystemLanguageDirection value from model
* @brief Sets matchSystemLanguageDirection value to model
* @param[in] match The value of matchSystemLanguageDirection for the text
*/
- void SetMatchSystemLanguageDirection( bool match );
+ void SetMatchSystemLanguageDirection(bool match);
/**
* @brief Sets layoutDirection value
* @param[in] layoutDirection The value of system language direction
*/
- void SetLayoutDirection( Dali::LayoutDirection::Type layoutDirection );
+ void SetLayoutDirection(Dali::LayoutDirection::Type layoutDirection);
/**
* @brief Retrieves if showing real text or not.
bool IsShowingRealText() const;
public: // Relayout.
-
/**
* @brief Triggers a relayout which updates View (if necessary).
*
*
* @return Whether the text model or decorations were updated.
*/
- UpdateTextType Relayout( const Size& size, Dali::LayoutDirection::Type layoutDirection = Dali::LayoutDirection::LEFT_TO_RIGHT );
+ UpdateTextType Relayout(const Size& size, Dali::LayoutDirection::Type layoutDirection = Dali::LayoutDirection::LEFT_TO_RIGHT);
/**
* @brief Request a relayout using the ControlInterface.
void RequestRelayout();
public: // Input style change signals.
-
/**
* @return Whether the queue of input style changed signals is empty.
*/
void ProcessInputStyleChangedSignals();
public: // Text-input Event Queuing.
-
/**
* @brief Called by editable UI controls when keyboard focus is gained.
*/
* @param[in] event The key event.
* @param[in] type Used to distinguish between regular key events and InputMethodContext events.
*/
- bool KeyEvent( const Dali::KeyEvent& event );
+ bool KeyEvent(const Dali::KeyEvent& event);
/**
* @brief Called by editable UI controls when a tap gesture occurs.
* @param[in] x The x position relative to the top-left of the parent control.
* @param[in] y The y position relative to the top-left of the parent control.
*/
- void TapEvent( unsigned int tapCount, float x, float y );
+ void TapEvent(unsigned int tapCount, float x, float y);
/**
* @brief Called by editable UI controls when a pan gesture occurs.
* @param[in] state The state of the gesture.
* @param[in] displacement This distance panned since the last pan gesture.
*/
- void PanEvent( GestureState state, const Vector2& displacement );
+ void PanEvent(GestureState state, const Vector2& displacement);
/**
* @brief Called by editable UI controls when a long press gesture occurs.
* @param[in] x The x position relative to the top-left of the parent control.
* @param[in] y The y position relative to the top-left of the parent control.
*/
- void LongPressEvent( GestureState state, float x, float y );
+ void LongPressEvent(GestureState state, float x, float y);
/**
* @brief Used to get the Primary cursor position.
* @param[in] index for the Primary cursor position.
* @return[in] true if cursor position changed, false otherwise.
*/
- bool SetPrimaryCursorPosition( CharacterIndex index );
+ bool SetPrimaryCursorPosition(CharacterIndex index);
/**
* @brief Creates a selection event.
* @param[in] y The y position relative to the top-left of the parent control.
* @param[in] selection type like the whole text is selected or unselected.
*/
- void SelectEvent( float x, float y, SelectionType selection );
+ void SelectEvent(float x, float y, SelectionType selection);
/**
* @copydoc Text::SelectableControlInterface::SetTextSelectionRange()
*/
- void SetTextSelectionRange(const uint32_t *start, const uint32_t *end);
+ void SetTextSelectionRange(const uint32_t* start, const uint32_t* end);
/**
* @copydoc Text::SelectableControlInterface::GetTextSelectionRange()
/**
* @copydoc Text::EditableControlInterface::SetEditable()
*/
- virtual void SetEditable( bool editable );
+ virtual void SetEditable(bool editable);
/**
* @copydoc Dali::Toolkit::Internal::TextEditor::ScrollBy()
*/
- virtual void ScrollBy( Vector2 scroll );
+ virtual void ScrollBy(Vector2 scroll);
/**
* @copydoc Dali::Toolkit::Internal::TextEditor::GetHorizontalScrollPosition()
* @param[in] inputMethodContextEvent The event received.
* @return A data struture indicating if update is needed, cursor position and current text.
*/
- InputMethodContext::CallbackData OnInputMethodContextEvent( InputMethodContext& inputMethodContext, const InputMethodContext::EventData& inputMethodContextEvent );
+ InputMethodContext::CallbackData OnInputMethodContextEvent(InputMethodContext& inputMethodContext, const InputMethodContext::EventData& inputMethodContextEvent);
/**
* @brief Event from Clipboard notifying an Item has been selected for pasting
*
* @param[in] cursorIndex Where to place the cursor.
*/
- void ResetCursorPosition( CharacterIndex cursorIndex );
+ void ResetCursorPosition(CharacterIndex cursorIndex);
/**
* @brief The method acquires current position of cursor
CharacterIndex GetCursorPosition();
protected: // Inherit from Text::Decorator::ControllerInterface.
-
/**
* @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::GetTargetSize()
*/
- void GetTargetSize( Vector2& targetSize ) override;
+ void GetTargetSize(Vector2& targetSize) override;
/**
* @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::AddDecoration()
*/
- void AddDecoration( Actor& actor, bool needsClipping ) override;
+ void AddDecoration(Actor& actor, bool needsClipping) override;
/**
* @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::DecorationEvent()
*/
- void DecorationEvent( HandleType handle, HandleState state, float x, float y ) override;
+ void DecorationEvent(HandleType handle, HandleState state, float x, float y) override;
protected: // Inherit from TextSelectionPopup::TextPopupButtonCallbackInterface.
-
/**
* @copydoc Dali::Toolkit::TextSelectionPopup::TextPopupButtonCallbackInterface::TextPopupButtonTouched()
*/
- void TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::Buttons button ) override;
+ void TextPopupButtonTouched(Dali::Toolkit::TextSelectionPopup::Buttons button) override;
protected: // Inherit from HiddenText.
-
/**
* @brief Invoked from HiddenText when showing time of the last character was expired
*/
void DisplayTimeExpired() override;
private: // Update.
-
/**
* @brief Called by editable UI controls when key events are received.
*
* @param[in] text The text to insert.
* @param[in] type Used to distinguish between regular key events and InputMethodContext events.
*/
- void InsertText( const std::string& text, InsertType type );
+ void InsertText(const std::string& text, InsertType type);
/**
* @brief Paste given string into Text model
* @param[in] stringToPaste this string will be inserted into the text model
*/
- void PasteText( const std::string& stringToPaste );
+ void PasteText(const std::string& stringToPaste);
/**
* @brief Remove a given number of characters
* @param[in] type Whether to update the input style.
* @return True if the remove was successful.
*/
- bool RemoveText( int cursorOffset,
- int numberOfCharacters,
- UpdateInputStyleType type );
+ bool RemoveText(int cursorOffset,
+ int numberOfCharacters,
+ UpdateInputStyleType type);
/**
* @brief Checks if text is selected and if so removes it.
bool RemoveSelectedText();
private: // Relayout.
-
/**
* @brief Lays-out the text.
*
* @param[in] operations The layout operations which need to be done.
* @param[out] layoutSize The size of the laid-out text.
*/
- bool DoRelayout( const Size& size,
- OperationsMask operations,
- Size& layoutSize );
+ bool DoRelayout(const Size& size,
+ OperationsMask operations,
+ Size& layoutSize);
/**
* @brief Calulates the vertical offset to align the text inside the bounding box.
*
* @param[in] size The size of the bounding box.
*/
- void CalculateVerticalOffset( const Size& size );
+ void CalculateVerticalOffset(const Size& size);
private: // Events.
-
/**
* @brief Process queued events which modify the model.
*/
* @param[in] keyCode The keycode for the key pressed
* @return True if a character was deleted.
*/
- bool DeleteEvent( int keyCode );
+ bool DeleteEvent(int keyCode);
private: // Helpers.
-
/**
* @brief Used to remove the text included the placeholder text.
*/
void ResetScrollPosition();
private: // Private contructors & copy operator.
-
/**
* @brief Private constructor.
*/
/**
* @brief Private constructor.
*/
- Controller( ControlInterface* controlInterface );
+ Controller(ControlInterface* controlInterface);
/**
* @brief Private constructor.
*/
- Controller( ControlInterface* controlInterface,
- EditableControlInterface* editableControlInterface,
- SelectableControlInterface* selectableControlInterface );
+ Controller(ControlInterface* controlInterface,
+ EditableControlInterface* editableControlInterface,
+ SelectableControlInterface* selectableControlInterface);
// Undefined
- Controller( const Controller& handle );
+ Controller(const Controller& handle);
// Undefined
- Controller& operator=( const Controller& handle );
+ Controller& operator=(const Controller& handle);
protected: // Destructor.
-
/**
* @brief A reference counted object may only be deleted by calling Unreference().
*/
virtual ~Controller();
public:
-
struct Impl; ///< Made public for testing purposes
private:
-
struct EventHandler;
struct InputFontHandler;
struct PlaceholderHandler;
#define DALI_TEXT_ABSTRACTION_TEXT_TYPE_DEFINITIONS_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <dali/devel-api/text-abstraction/text-abstraction-definitions.h>
#include <dali/devel-api/text-abstraction/font-list.h>
#include <dali/devel-api/text-abstraction/font-metrics.h>
#include <dali/devel-api/text-abstraction/glyph-info.h>
#include <dali/devel-api/text-abstraction/script.h>
+#include <dali/devel-api/text-abstraction/text-abstraction-definitions.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
typedef TextAbstraction::FontId FontId; ///< The unique identifier for a font face (generated by FontClient).
typedef TextAbstraction::FontWidth::Type FontWidth; ///< The font's width.
typedef TextAbstraction::FontWeight::Type FontWeight; ///< The font's weight.
typedef TextAbstraction::ColorBlendingMode ColorBlendingMode; ///< Defines how a color is blended.
typedef TextAbstraction::ColorIndex ColorIndex; ///< An index into an array of colors.
-typedef uint32_t GlyphIndex; ///< An index into an array of glyphs.
-typedef uint32_t ScriptRunIndex; ///< An index into an array of script runs.
-typedef uint32_t FontRunIndex; ///< An index into an array of font runs.
-typedef uint32_t UnderlineRunIndex; ///< An index into an array of underline runs.
-typedef uint32_t BidirectionalRunIndex; ///< An index into an array of bidirectional info.
-typedef uint32_t BidirectionalLineRunIndex; ///< An index into an array of bidirectional line info.
-typedef uint32_t LineIndex; ///< An index into an array of lines.
-typedef uint32_t ParagraphRunIndex; ///< An index into an array of paragraphs.
+typedef uint32_t GlyphIndex; ///< An index into an array of glyphs.
+typedef uint32_t ScriptRunIndex; ///< An index into an array of script runs.
+typedef uint32_t FontRunIndex; ///< An index into an array of font runs.
+typedef uint32_t UnderlineRunIndex; ///< An index into an array of underline runs.
+typedef uint32_t BidirectionalRunIndex; ///< An index into an array of bidirectional info.
+typedef uint32_t BidirectionalLineRunIndex; ///< An index into an array of bidirectional line info.
+typedef uint32_t LineIndex; ///< An index into an array of lines.
+typedef uint32_t ParagraphRunIndex; ///< An index into an array of paragraphs.
} // namespace Text
#define DALI_TOOLKIT_TEXT_EDITABLE_CONTROL_INTERFACE_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
class Actor;
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief An interface that the Text::Controller uses to notify about text changes and add decoration to the text control.
*/
class EditableControlInterface
{
public:
-
/**
* @brief Virtual destructor.
*/
virtual ~EditableControlInterface()
- {}
+ {
+ }
/**
* @brief Called to signal that text has been inserted.
*/
- virtual void TextInserted( unsigned int position, unsigned int length, const std::string &content ) = 0;
+ virtual void TextInserted(unsigned int position, unsigned int length, const std::string& content) = 0;
/**
* @brief Called to signal that text has been deleted.
*/
- virtual void TextDeleted( unsigned int position, unsigned int length, const std::string &content ) = 0;
+ virtual void TextDeleted(unsigned int position, unsigned int length, const std::string& content) = 0;
/**
* @brief Called to signal that caret (cursor position) has been moved.
*/
- virtual void CaretMoved( unsigned int position ) = 0;
+ virtual void CaretMoved(unsigned int position) = 0;
/**
* @brief Called to signal that text has been inserted or deleted.
*
* @param[in] inputStyleMask Mask with the bits of the input style that has changed.
*/
- virtual void InputStyleChanged( InputStyle::Mask inputStyleMask ) = 0;
+ virtual void InputStyleChanged(InputStyle::Mask inputStyleMask) = 0;
/**
* @brief Add a decoration.
* @param[in] decoration The actor displaying a decoration.
* @param[in] needsClipping Whether the actor needs clipping.
*/
- virtual void AddDecoration( Actor& actor, bool needsClipping ) = 0;
+ virtual void AddDecoration(Actor& actor, bool needsClipping) = 0;
/**
* @brief Editable status (on/off).
*
* @param[in] editable The editable status.
*/
- virtual void SetEditable( bool editable ) = 0;
+ virtual void SetEditable(bool editable) = 0;
};
} // namespace Text
#define DALI_TOOLKIT_INTERNAL_TEXT_EFFECTS_STYLE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
namespace EffectStyle
{
- enum Type
- {
- DEFAULT, ///< The default text effect style.
- INPUT ///< The input text effect style.
- };
+enum Type
+{
+ DEFAULT, ///< The default text effect style.
+ INPUT ///< The input text effect style.
+};
};
/**
* @param[out] offsetDefined Whether the shadow's offset is defined.
* @param[out] offset The shadow's offset.
*/
-bool ParseShadowProperties( const Property::Map& shadowProperties,
- bool& colorDefined,
- Vector4& color,
- bool& offsetDefined,
- Vector2& offset );
+bool ParseShadowProperties(const Property::Map& shadowProperties,
+ bool& colorDefined,
+ Vector4& color,
+ bool& offsetDefined,
+ Vector2& offset);
/**
* @brief Parses the underline properties.
* @param[out] heightDefined Whether the underline's height is defined.
* @param[out] height The underline's height.
*/
-bool ParseUnderlineProperties( const Property::Map& underlineProperties,
- bool& enabled,
- bool& colorDefined,
- Vector4& color,
- bool& heightDefined,
- float& height );
+bool ParseUnderlineProperties(const Property::Map& underlineProperties,
+ bool& enabled,
+ bool& colorDefined,
+ Vector4& color,
+ bool& heightDefined,
+ float& height);
/**
* @brief Parses the outline properties.
* @param[out] widthDefined Whether the outline's width is defined.
* @param[out] width The outline's width.
*/
-bool ParseOutlineProperties( const Property::Map& outlineProperties,
- bool& colorDefined,
- Vector4& color,
- bool& widthDefined,
- unsigned int& width );
-
+bool ParseOutlineProperties(const Property::Map& outlineProperties,
+ bool& colorDefined,
+ Vector4& color,
+ bool& widthDefined,
+ unsigned int& width);
/**
* @brief Parses the background properties.
* @param[out] colorDefined Whether the background color is defined.
* @param[out] color The background color.
*/
-bool ParseBackgroundProperties( const Property::Map& backgroundProperties,
- bool& enabled,
- bool& colorDefined,
- Vector4& color );
+bool ParseBackgroundProperties(const Property::Map& backgroundProperties,
+ bool& enabled,
+ bool& colorDefined,
+ Vector4& color);
/**
* @brief Sets the underline properties.
*
* @return Whether the underline properties have been updated.
*/
-bool SetUnderlineProperties( ControllerPtr controller, const Property::Value& value, EffectStyle::Type type );
+bool SetUnderlineProperties(ControllerPtr controller, const Property::Value& value, EffectStyle::Type type);
/**
* @brief Retrieves the underline's properties.
* @param[out] value The value of the underline's properties.
* @param[in] type Whether the property is for the default underline or the input underline.
*/
-void GetUnderlineProperties( ControllerPtr controller, Property::Value& value, EffectStyle::Type type );
+void GetUnderlineProperties(ControllerPtr controller, Property::Value& value, EffectStyle::Type type);
/**
* @brief Sets the shadow properties.
*
* @return Whether the shadow properties have been updated.
*/
-bool SetShadowProperties( ControllerPtr controller, const Property::Value& value, EffectStyle::Type type );
+bool SetShadowProperties(ControllerPtr controller, const Property::Value& value, EffectStyle::Type type);
/**
* @brief Retrieves the shadow's properties.
* @param[out] value The value of the shadow's properties.
* @param[in] type Whether the property is for the default shadow or the input shadow.
*/
-void GetShadowProperties( ControllerPtr controller, Property::Value& value, EffectStyle::Type type );
+void GetShadowProperties(ControllerPtr controller, Property::Value& value, EffectStyle::Type type);
/**
* @brief Sets the emboss properties.
*
* @return Whether the emboss properties have been updated.
*/
-bool SetEmbossProperties( ControllerPtr controller, const Property::Value& value, EffectStyle::Type type );
+bool SetEmbossProperties(ControllerPtr controller, const Property::Value& value, EffectStyle::Type type);
/**
* @brief Retrieves the emboss's properties.
* @param[out] value The value of the emboss's properties.
* @param[in] type Whether the property is for the default emboss or the input emboss.
*/
-void GetEmbossProperties( ControllerPtr controller, Property::Value& value, EffectStyle::Type type );
+void GetEmbossProperties(ControllerPtr controller, Property::Value& value, EffectStyle::Type type);
/**
* @brief Sets the outline properties.
*
* @return Whether the outline properties have been updated.
*/
-bool SetOutlineProperties( ControllerPtr controller, const Property::Value& value, EffectStyle::Type type );
+bool SetOutlineProperties(ControllerPtr controller, const Property::Value& value, EffectStyle::Type type);
/**
* @brief Retrieves the outline's properties.
* @param[out] value The value of the outline's properties.
* @param[in] type Whether the property is for the default outline or the input outline.
*/
-void GetOutlineProperties( ControllerPtr controller, Property::Value& value, EffectStyle::Type type );
+void GetOutlineProperties(ControllerPtr controller, Property::Value& value, EffectStyle::Type type);
/**
* @brief Sets the background properties.
*
* @return Whether the background properties have been updated.
*/
-bool SetBackgroundProperties( ControllerPtr controller, const Property::Value& value, EffectStyle::Type type );
+bool SetBackgroundProperties(ControllerPtr controller, const Property::Value& value, EffectStyle::Type type);
/**
* @brief Retrieves the background's properties.
* @param[out] value The value of the underline's properties.
* @param[in] type Whether the property is for the default background or the input background.
*/
-void GetBackgroundProperties( ControllerPtr controller, Property::Value& value, EffectStyle::Type type );
+void GetBackgroundProperties(ControllerPtr controller, Property::Value& value, EffectStyle::Type type);
} // namespace Text
#define DALI_TOOLKIT_TEXT_ENUMERATION_IMPL_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief Get the alignment from the provided property value.
* @param[in] propertyValue The source value (which can be a Property::INTEGER or Property::STRING type)
* @param[out] alignment The resulting alignment from the given source
* @return true if the resulting alignment has been updated
*/
-bool GetHorizontalAlignmentEnumeration( const Property::Value& propertyValue, Toolkit::Text::HorizontalAlignment::Type& alignment );
+bool GetHorizontalAlignmentEnumeration(const Property::Value& propertyValue, Toolkit::Text::HorizontalAlignment::Type& alignment);
/**
* @brief Get the alignment from the provided property value.
* @param[out] alignment The resulting alignment from the given source
* @return true if the resulting alignment has been updated
*/
-bool GetVerticalAlignmentEnumeration( const Property::Value& propertyValue, Toolkit::Text::VerticalAlignment::Type& alignment );
+bool GetVerticalAlignmentEnumeration(const Property::Value& propertyValue, Toolkit::Text::VerticalAlignment::Type& alignment);
/**
* @brief Get the line-wrap-mode from the provided property value.
* @param[out] alignment The resulting lineWrapMode from the given source
* @return true if the resulting lineWrapMode has been updated
*/
-bool GetLineWrapModeEnumeration( const Property::Value& propertyValue, Toolkit::Text::LineWrap::Mode& lineWrapMode );
+bool GetLineWrapModeEnumeration(const Property::Value& propertyValue, Toolkit::Text::LineWrap::Mode& lineWrapMode);
/**
* @brief Get the alignment string from the provided alignment string.
* @param[in] alignment the Text::HORIZONTAL enum source
* @return the string equivalent
*/
-const char* GetHorizontalAlignmentString( const Toolkit::Text::HorizontalAlignment::Type& alignment );
+const char* GetHorizontalAlignmentString(const Toolkit::Text::HorizontalAlignment::Type& alignment);
/**
* @brief Get the alignment string from the provided alignment string.
* @param[in] alignment the Text::VerticalAlignment enum source
* @return the string equivalent
*/
-const char* GetVerticalAlignmentString( const Toolkit::Text::VerticalAlignment::Type& alignment );
+const char* GetVerticalAlignmentString(const Toolkit::Text::VerticalAlignment::Type& alignment);
} // namespace Text
#define DALI_TOOLKIT_INTERNAL_TEXT_FONT_STYLE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
const Scripting::StringEnum FONT_WEIGHT_STRING_TABLE[] =
-{
- { "thin", TextAbstraction::FontWeight::THIN },
- { "ultraLight", TextAbstraction::FontWeight::ULTRA_LIGHT },
- { "extraLight", TextAbstraction::FontWeight::EXTRA_LIGHT },
- { "light", TextAbstraction::FontWeight::LIGHT },
- { "demiLight", TextAbstraction::FontWeight::DEMI_LIGHT },
- { "semiLight", TextAbstraction::FontWeight::SEMI_LIGHT },
- { "book", TextAbstraction::FontWeight::BOOK },
- { "normal", TextAbstraction::FontWeight::NORMAL },
- { "regular", TextAbstraction::FontWeight::REGULAR },
- { "medium", TextAbstraction::FontWeight::MEDIUM },
- { "demiBold", TextAbstraction::FontWeight::DEMI_BOLD },
- { "semiBold", TextAbstraction::FontWeight::SEMI_BOLD },
- { "bold", TextAbstraction::FontWeight::BOLD },
- { "ultraBold", TextAbstraction::FontWeight::ULTRA_BOLD },
- { "extraBold", TextAbstraction::FontWeight::EXTRA_BOLD },
- { "black", TextAbstraction::FontWeight::BLACK },
- { "heavy", TextAbstraction::FontWeight::HEAVY },
- { "extraBlack", TextAbstraction::FontWeight::EXTRA_BLACK }
-};
-const unsigned int FONT_WEIGHT_STRING_TABLE_COUNT = sizeof( FONT_WEIGHT_STRING_TABLE ) / sizeof( FONT_WEIGHT_STRING_TABLE[0] );
+ {
+ {"thin", TextAbstraction::FontWeight::THIN},
+ {"ultraLight", TextAbstraction::FontWeight::ULTRA_LIGHT},
+ {"extraLight", TextAbstraction::FontWeight::EXTRA_LIGHT},
+ {"light", TextAbstraction::FontWeight::LIGHT},
+ {"demiLight", TextAbstraction::FontWeight::DEMI_LIGHT},
+ {"semiLight", TextAbstraction::FontWeight::SEMI_LIGHT},
+ {"book", TextAbstraction::FontWeight::BOOK},
+ {"normal", TextAbstraction::FontWeight::NORMAL},
+ {"regular", TextAbstraction::FontWeight::REGULAR},
+ {"medium", TextAbstraction::FontWeight::MEDIUM},
+ {"demiBold", TextAbstraction::FontWeight::DEMI_BOLD},
+ {"semiBold", TextAbstraction::FontWeight::SEMI_BOLD},
+ {"bold", TextAbstraction::FontWeight::BOLD},
+ {"ultraBold", TextAbstraction::FontWeight::ULTRA_BOLD},
+ {"extraBold", TextAbstraction::FontWeight::EXTRA_BOLD},
+ {"black", TextAbstraction::FontWeight::BLACK},
+ {"heavy", TextAbstraction::FontWeight::HEAVY},
+ {"extraBlack", TextAbstraction::FontWeight::EXTRA_BLACK}};
+const unsigned int FONT_WEIGHT_STRING_TABLE_COUNT = sizeof(FONT_WEIGHT_STRING_TABLE) / sizeof(FONT_WEIGHT_STRING_TABLE[0]);
const Scripting::StringEnum FONT_WIDTH_STRING_TABLE[] =
-{
- { "ultraCondensed", TextAbstraction::FontWidth::ULTRA_CONDENSED },
- { "extraCondensed", TextAbstraction::FontWidth::EXTRA_CONDENSED },
- { "condensed", TextAbstraction::FontWidth::CONDENSED },
- { "semiCondensed", TextAbstraction::FontWidth::SEMI_CONDENSED },
- { "normal", TextAbstraction::FontWidth::NORMAL },
- { "semiExpanded", TextAbstraction::FontWidth::SEMI_EXPANDED },
- { "expanded", TextAbstraction::FontWidth::EXPANDED },
- { "extraExpanded", TextAbstraction::FontWidth::EXTRA_EXPANDED },
- { "ultraExpanded", TextAbstraction::FontWidth::ULTRA_EXPANDED },
+ {
+ {"ultraCondensed", TextAbstraction::FontWidth::ULTRA_CONDENSED},
+ {"extraCondensed", TextAbstraction::FontWidth::EXTRA_CONDENSED},
+ {"condensed", TextAbstraction::FontWidth::CONDENSED},
+ {"semiCondensed", TextAbstraction::FontWidth::SEMI_CONDENSED},
+ {"normal", TextAbstraction::FontWidth::NORMAL},
+ {"semiExpanded", TextAbstraction::FontWidth::SEMI_EXPANDED},
+ {"expanded", TextAbstraction::FontWidth::EXPANDED},
+ {"extraExpanded", TextAbstraction::FontWidth::EXTRA_EXPANDED},
+ {"ultraExpanded", TextAbstraction::FontWidth::ULTRA_EXPANDED},
};
-const unsigned int FONT_WIDTH_STRING_TABLE_COUNT = sizeof( FONT_WIDTH_STRING_TABLE ) / sizeof( FONT_WIDTH_STRING_TABLE[0] );
+const unsigned int FONT_WIDTH_STRING_TABLE_COUNT = sizeof(FONT_WIDTH_STRING_TABLE) / sizeof(FONT_WIDTH_STRING_TABLE[0]);
const Scripting::StringEnum FONT_SLANT_STRING_TABLE[] =
-{
- { "normal", TextAbstraction::FontSlant::NORMAL },
- { "roman", TextAbstraction::FontSlant::ROMAN },
- { "italic", TextAbstraction::FontSlant::ITALIC },
- { "oblique", TextAbstraction::FontSlant::OBLIQUE }
-};
-const unsigned int FONT_SLANT_STRING_TABLE_COUNT = sizeof( FONT_SLANT_STRING_TABLE ) / sizeof( FONT_SLANT_STRING_TABLE[0] );
+ {
+ {"normal", TextAbstraction::FontSlant::NORMAL},
+ {"roman", TextAbstraction::FontSlant::ROMAN},
+ {"italic", TextAbstraction::FontSlant::ITALIC},
+ {"oblique", TextAbstraction::FontSlant::OBLIQUE}};
+const unsigned int FONT_SLANT_STRING_TABLE_COUNT = sizeof(FONT_SLANT_STRING_TABLE) / sizeof(FONT_SLANT_STRING_TABLE[0]);
namespace FontStyle
{
- enum Type
- {
- DEFAULT, ///< The default font's style.
- INPUT, ///< The input font's style.
- PLACEHOLDER ///< The placeholder text font's style.
- };
+enum Type
+{
+ DEFAULT, ///< The default font's style.
+ INPUT, ///< The input font's style.
+ PLACEHOLDER ///< The placeholder text font's style.
+};
};
/**
* @param[in] controller The text's controller.
* @param[in] value The value of the font's family.
*/
-void SetFontFamilyProperty( ControllerPtr controller, const Property::Value& value );
+void SetFontFamilyProperty(ControllerPtr controller, const Property::Value& value);
/**
* @brief Sets the font's style property.
* @param[in] type Whether the property is for the default font's style, the input font's style or the placeholder font's style.
*
*/
-void SetFontStyleProperty( ControllerPtr controller, const Property::Value& value, FontStyle::Type type );
+void SetFontStyleProperty(ControllerPtr controller, const Property::Value& value, FontStyle::Type type);
/**
* @brief Retrieves the font's style property.
* @param[out] value The value of the font's style.
* @param[in] type Whether the property is for the default font's style, the input font's style or the placeholder font's style.
*/
-void GetFontStyleProperty( ControllerPtr controller, Property::Value& value, FontStyle::Type type );
+void GetFontStyleProperty(ControllerPtr controller, Property::Value& value, FontStyle::Type type);
/**
* @brief Converts a weight string into @e FontWeight.
*
* @return The @e FontWeight value corresponding to the string.
*/
-FontWeight StringToWeight( const char* const weightStr );
+FontWeight StringToWeight(const char* const weightStr);
/**
* @brief Converts a width string into @e FontWidth.
*
* @return The @e FontWidth value corresponding to the string.
*/
-FontWidth StringToWidth( const char* const widthStr );
+FontWidth StringToWidth(const char* const widthStr);
/**
* @brief Converts a slant string into @e FontSlant.
*
* @return The @e FontSlant value corresponding to the string.
*/
-FontSlant StringToSlant( const char* const slantStr );
+FontSlant StringToSlant(const char* const slantStr);
} // namespace Text
} // namespace Toolkit
#define DALI_TEXT_ABSTRACTION_TEXT_IO_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <iosfwd>
#include <dali/public-api/common/dali-vector.h>
+#include <iosfwd>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/text/font-run.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief Print a vector of characters.
*
* @param [in] text The text to print.
* @return The output stream operator.
*/
-std::ostream& operator<< (std::ostream& o, const Vector<Character>& text);
+std::ostream& operator<<(std::ostream& o, const Vector<Character>& text);
/**
* @brief Print a vector of script runs.
* @param [in] scriptRuns The script runs to print.
* @return The output stream operator.
*/
-std::ostream& operator<< (std::ostream& o, const Vector<ScriptRun>& scriptRuns);
+std::ostream& operator<<(std::ostream& o, const Vector<ScriptRun>& scriptRuns);
/**
* @brief Print a vector of font runs.
* @param [in] fontRuns The font runs to print.
* @return The output stream operator.
*/
-std::ostream& operator<< (std::ostream& o, const Vector<FontRun>& fontRuns);
+std::ostream& operator<<(std::ostream& o, const Vector<FontRun>& fontRuns);
/**
* @brief Print a vector of line runs.
* @param [in] lineRuns The line runs to print.
* @return The output stream operator.
*/
-std::ostream& operator<< (std::ostream& o, const Vector<LineRun>& lineRuns);
+std::ostream& operator<<(std::ostream& o, const Vector<LineRun>& lineRuns);
} // namespace Text
#define DALI_TOOLKIT_TEXT_MODEL_INTERFACE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/math/vector2.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/text/text-enumerations.h>
+#include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
#include <dali-toolkit/internal/text/line-run.h>
#include <dali-toolkit/internal/text/script-run.h>
#include <dali-toolkit/internal/text/text-definitions.h>
-#include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
+#include <dali-toolkit/public-api/text/text-enumerations.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief Interface class used to retrieve the text's model from the text-controller.
*/
* @brief Virtual destructor.
*/
virtual ~ModelInterface()
- {}
+ {
+ }
/**
* @brief Retrives the control's size.
* @param[in] index Index of the first underline run to be copied.
* @param[in] numberOfRuns Number of underline runs to be copied.
*/
- virtual void GetUnderlineRuns( GlyphRun* underlineRuns, UnderlineRunIndex index, Length numberOfRuns ) const = 0;
+ virtual void GetUnderlineRuns(GlyphRun* underlineRuns, UnderlineRunIndex index, Length numberOfRuns) const = 0;
/**
* @brief Retrieve the outline color.
* @return The background state.
*/
virtual bool IsBackgroundEnabled() const = 0;
-
};
} // namespace Text
#define DALI_TOOLKIT_TEXT_MODEL_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/object/ref-object.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/text/text-enumerations.h>
#include <dali-toolkit/internal/text/logical-model-impl.h>
#include <dali-toolkit/internal/text/text-model-interface.h>
#include <dali-toolkit/internal/text/visual-model-impl.h>
+#include <dali-toolkit/public-api/text/text-enumerations.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
// Forward declarations.
class Model;
*/
class Model : public RefObject, public ModelInterface
{
-
public: // Constructor.
-
/**
* @brief Create a new instance of a text Model.
*
static ModelPtr New();
public:
-
/**
* @copydoc ModelInterface::GetControlSize()
*/
/**
* @copydoc ModelInterface::GetUnderlineRuns()
*/
- void GetUnderlineRuns( GlyphRun* underlineRuns, UnderlineRunIndex index, Length numberOfRuns ) const override;
+ void GetUnderlineRuns(GlyphRun* underlineRuns, UnderlineRunIndex index, Length numberOfRuns) const override;
/**
* @copydoc ModelInterface::GetOutlineColor()
bool IsBackgroundEnabled() const override;
private: // Private contructors & copy operator.
-
/**
* @brief Private constructor.
*/
Model();
// Undefined.
- Model( const Model& handle );
+ Model(const Model& handle);
// Undefined.
- Model& operator=( const Model& handle );
+ Model& operator=(const Model& handle);
protected:
-
/**
* @brief A reference counted object may only be deleted by calling Unreference().
*/
virtual ~Model();
public:
- LogicalModelPtr mLogicalModel; ///< Pointer to the logical model.
- VisualModelPtr mVisualModel; ///< Pointer to the visual model.
+ LogicalModelPtr mLogicalModel; ///< Pointer to the logical model.
+ VisualModelPtr mVisualModel; ///< Pointer to the visual model.
/**
* 0,0 means that the top-left corner of the layout matches the top-left corner of the UI control.
* Typically this will have a negative value with scrolling occurs.
*/
- Vector2 mScrollPosition; ///< The text is offset by this position when scrolling.
- Vector2 mScrollPositionLast; ///< The last offset value of mScrollPosition
- HorizontalAlignment::Type mHorizontalAlignment; ///< The layout's horizontal alignment.
- VerticalAlignment::Type mVerticalAlignment; ///< The layout's vertical alignment.
- DevelText::VerticalLineAlignment::Type mVerticalLineAlignment; ///< The layout's vertical line alignment.
- Text::LineWrap::Mode mLineWrapMode; ///< The text wrap mode
- float mAlignmentOffset; ///< The alignment offset.
- bool mElideEnabled:1; ///< Whether the text's elide is enabled.
- bool mIgnoreSpacesAfterText:1; ///< Whether ignoring spaces after text or not. Default is true.
- bool mMatchSystemLanguageDirection:1; ///< Whether match align for system language direction or not. Default is false.
+ Vector2 mScrollPosition; ///< The text is offset by this position when scrolling.
+ Vector2 mScrollPositionLast; ///< The last offset value of mScrollPosition
+ HorizontalAlignment::Type mHorizontalAlignment; ///< The layout's horizontal alignment.
+ VerticalAlignment::Type mVerticalAlignment; ///< The layout's vertical alignment.
+ DevelText::VerticalLineAlignment::Type mVerticalLineAlignment; ///< The layout's vertical line alignment.
+ Text::LineWrap::Mode mLineWrapMode; ///< The text wrap mode
+ float mAlignmentOffset; ///< The alignment offset.
+ bool mElideEnabled : 1; ///< Whether the text's elide is enabled.
+ bool mIgnoreSpacesAfterText : 1; ///< Whether ignoring spaces after text or not. Default is true.
+ bool mMatchSystemLanguageDirection : 1; ///< Whether match align for system language direction or not. Default is false.
};
} // namespace Text
#define DALI_TOOLKIT_TEXT_RUN_CONTAINER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief Clears the runs starting from the given character index.
*
* @param[out] startRemoveIndex The index to the first run to be removed.
* @param[out] endRemoveIndex The index to the last run to be removed.
*/
-template< typename T >
-void ClearCharacterRuns( CharacterIndex startIndex,
- CharacterIndex endIndex,
- Vector<T>& runs,
- uint32_t& startRemoveIndex,
- uint32_t& endRemoveIndex )
+template<typename T>
+void ClearCharacterRuns(CharacterIndex startIndex,
+ CharacterIndex endIndex,
+ Vector<T>& runs,
+ uint32_t& startRemoveIndex,
+ uint32_t& endRemoveIndex)
{
T* runsBuffer = runs.Begin();
- T* run = runsBuffer;
+ T* run = runsBuffer;
const Length length = runs.Count();
- Length index = 0u;
- for( index = 0u; index < length; ++index )
+ Length index = 0u;
+ for(index = 0u; index < length; ++index)
{
- if( ( run->characterRun.characterIndex <= endIndex ) &&
- ( startIndex < run->characterRun.characterIndex + run->characterRun.numberOfCharacters ) )
+ if((run->characterRun.characterIndex <= endIndex) &&
+ (startIndex < run->characterRun.characterIndex + run->characterRun.numberOfCharacters))
{
// Run found.
++run;
}
- run = ( runsBuffer + startRemoveIndex );
- for( index = startRemoveIndex; index < length; ++index )
+ run = (runsBuffer + startRemoveIndex);
+ for(index = startRemoveIndex; index < length; ++index)
{
- if( ( run->characterRun.characterIndex > endIndex ) ||
- ( startIndex >= run->characterRun.characterIndex + run->characterRun.numberOfCharacters ) )
+ if((run->characterRun.characterIndex > endIndex) ||
+ (startIndex >= run->characterRun.characterIndex + run->characterRun.numberOfCharacters))
{
// Run found. Nothing else to do.
break;
// Update the character index of the next runs.
run = runsBuffer;
- for( Length index = 0u; index < length; ++index )
+ for(Length index = 0u; index < length; ++index)
{
- if( run->characterRun.characterIndex > startIndex )
+ if(run->characterRun.characterIndex > startIndex)
{
run->characterRun.characterIndex -= numberOfCharactersRemoved;
}
* @param[in] endIndex The ending character index used to remove runs.
* @param[in,out] runs The text's runs.
*/
-template< typename T >
-void ClearCharacterRuns( CharacterIndex startIndex,
- CharacterIndex endIndex,
- Vector<T>& runs )
+template<typename T>
+void ClearCharacterRuns(CharacterIndex startIndex,
+ CharacterIndex endIndex,
+ Vector<T>& runs)
{
uint32_t startRemoveIndex = runs.Count();
- uint32_t endRemoveIndex = startRemoveIndex;
- ClearCharacterRuns( startIndex,
- endIndex,
- runs,
- startRemoveIndex,
- endRemoveIndex );
+ uint32_t endRemoveIndex = startRemoveIndex;
+ ClearCharacterRuns(startIndex,
+ endIndex,
+ runs,
+ startRemoveIndex,
+ endRemoveIndex);
// Remove all remaining runs.
T* runBuffer = runs.Begin();
- runs.Erase( runBuffer + startRemoveIndex, runBuffer + endRemoveIndex );
+ runs.Erase(runBuffer + startRemoveIndex, runBuffer + endRemoveIndex);
}
/**
* @param[in,out] runs The text's style runs.
* @param[out] removedRuns The text's style removed runs.
*/
-template< typename T >
-void UpdateCharacterRuns( CharacterIndex index,
- int numberOfCharacters,
- Length totalNumberOfCharacters,
- Vector<T>& runs,
- Vector<T>& removedRuns )
+template<typename T>
+void UpdateCharacterRuns(CharacterIndex index,
+ int numberOfCharacters,
+ Length totalNumberOfCharacters,
+ Vector<T>& runs,
+ Vector<T>& removedRuns)
{
- if( 0 > numberOfCharacters )
+ if(0 > numberOfCharacters)
{
// Remove characters.
const Length numberOfRemovedCharacters = -numberOfCharacters;
- if( ( 0u == index ) && ( numberOfRemovedCharacters == totalNumberOfCharacters ) )
+ if((0u == index) && (numberOfRemovedCharacters == totalNumberOfCharacters))
{
// Set the removed runs.
removedRuns = runs;
// Temporary vector used to remove runs.
Vector<T> tempRuns;
// Reserve some space for the temporary vector.
- tempRuns.Reserve( size );
- removedRuns.Reserve( size );
+ tempRuns.Reserve(size);
+ removedRuns.Reserve(size);
// Whether any run has to be removed.
bool runsRemoved = false;
const CharacterIndex lastIndex = index + numberOfRemovedCharacters - 1u;
// Update the style runs
- for( typename Vector<T>::Iterator it = runs.Begin(),
- endIt = runs.End();
- it != endIt;
- ++it )
+ for(typename Vector<T>::Iterator it = runs.Begin(),
+ endIt = runs.End();
+ it != endIt;
+ ++it)
{
T& run = *it;
- if (run.characterRun.numberOfCharacters == 0)
- continue;
+ if(run.characterRun.numberOfCharacters == 0)
+ continue;
const CharacterIndex lastRunIndex = run.characterRun.characterIndex + run.characterRun.numberOfCharacters - 1u;
- if( lastRunIndex < index )
+ if(lastRunIndex < index)
{
// The style run is not affected by the removed text.
- tempRuns.PushBack( run );
+ tempRuns.PushBack(run);
continue;
}
- if( ( index <= run.characterRun.characterIndex ) &&
- ( lastIndex >= lastRunIndex ) )
+ if((index <= run.characterRun.characterIndex) &&
+ (lastIndex >= lastRunIndex))
{
// Add the removed run into the vector.
- removedRuns.PushBack( run );
+ removedRuns.PushBack(run);
// All the characters are removed.
runsRemoved = true;
}
else
{
- if( lastIndex < run.characterRun.characterIndex )
+ if(lastIndex < run.characterRun.characterIndex)
{
// Just move the character index.
run.characterRun.characterIndex -= numberOfRemovedCharacters;
}
else
{
- if( run.characterRun.characterIndex < index )
+ if(run.characterRun.characterIndex < index)
{
// Remove characters starting from a character within the run.
- run.characterRun.numberOfCharacters -= std::min( numberOfRemovedCharacters, 1u + lastRunIndex - index );
+ run.characterRun.numberOfCharacters -= std::min(numberOfRemovedCharacters, 1u + lastRunIndex - index);
}
else
{
}
}
- tempRuns.PushBack( run );
+ tempRuns.PushBack(run);
}
}
// Copy the temporary vector if there are runs removed.
- if( runsRemoved )
+ if(runsRemoved)
{
runs = tempRuns;
}
// Add characters.
// Update the style runs
- for( typename Vector<T>::Iterator it = runs.Begin(),
- endIt = runs.End();
- it != endIt;
- ++it )
+ for(typename Vector<T>::Iterator it = runs.Begin(),
+ endIt = runs.End();
+ it != endIt;
+ ++it)
{
T& run = *it;
- if (run.characterRun.numberOfCharacters == 0)
- continue;
+ if(run.characterRun.numberOfCharacters == 0)
+ continue;
// Update the number of characters of the style run.
- if( ( 0u == index ) && ( 0u == run.characterRun.characterIndex ) )
+ if((0u == index) && (0u == run.characterRun.characterIndex))
{
run.characterRun.numberOfCharacters += numberOfCharacters;
}
- else if( index <= run.characterRun.characterIndex )
+ else if(index <= run.characterRun.characterIndex)
{
run.characterRun.characterIndex += numberOfCharacters;
}
- else if( index <= run.characterRun.characterIndex + run.characterRun.numberOfCharacters )
+ else if(index <= run.characterRun.characterIndex + run.characterRun.numberOfCharacters)
{
run.characterRun.numberOfCharacters += numberOfCharacters;
}
* @param[out] startRemoveIndex The index to the first run to be removed.
* @param[out] endRemoveIndex The index to the last run to be removed.
*/
-template< typename T >
-void ClearGlyphRuns( GlyphIndex startIndex,
- GlyphIndex endIndex,
- Vector<T>& runs,
- uint32_t& startRemoveIndex,
- uint32_t& endRemoveIndex )
+template<typename T>
+void ClearGlyphRuns(GlyphIndex startIndex,
+ GlyphIndex endIndex,
+ Vector<T>& runs,
+ uint32_t& startRemoveIndex,
+ uint32_t& endRemoveIndex)
{
T* runsBuffer = runs.Begin();
- T* run = runsBuffer;
+ T* run = runsBuffer;
const Length length = runs.Count();
- Length index = 0u;
- for( index = 0u; index < length; ++index )
+ Length index = 0u;
+ for(index = 0u; index < length; ++index)
{
- if( ( run->glyphRun.glyphIndex <= endIndex ) &&
- ( startIndex < run->glyphRun.glyphIndex + run->glyphRun.numberOfGlyphs ) )
+ if((run->glyphRun.glyphIndex <= endIndex) &&
+ (startIndex < run->glyphRun.glyphIndex + run->glyphRun.numberOfGlyphs))
{
// Run found.
++run;
}
- run = ( runsBuffer + startRemoveIndex );
- for( index = startRemoveIndex; index < length; ++index )
+ run = (runsBuffer + startRemoveIndex);
+ for(index = startRemoveIndex; index < length; ++index)
{
- if( ( run->glyphRun.glyphIndex > endIndex ) ||
- ( startIndex >= run->glyphRun.glyphIndex + run->glyphRun.numberOfGlyphs ) )
+ if((run->glyphRun.glyphIndex > endIndex) ||
+ (startIndex >= run->glyphRun.glyphIndex + run->glyphRun.numberOfGlyphs))
{
// Run found. Nothing else to do.
break;
// Update the glyph index of the next runs.
run = runsBuffer;
- for( Length index = 0u; index < length; ++index )
+ for(Length index = 0u; index < length; ++index)
{
-
- if( run->glyphRun.glyphIndex > startIndex )
+ if(run->glyphRun.glyphIndex > startIndex)
{
run->glyphRun.glyphIndex -= numberOfGlyphsRemoved;
}
* @param[in] endIndex The ending glyph index used to remove runs.
* @param[in,out] runs The text's runs.
*/
-template< typename T >
-void ClearGlyphRuns( GlyphIndex startIndex,
- GlyphIndex endIndex,
- Vector<T>& runs )
+template<typename T>
+void ClearGlyphRuns(GlyphIndex startIndex,
+ GlyphIndex endIndex,
+ Vector<T>& runs)
{
uint32_t startRemoveIndex = runs.Count();
- uint32_t endRemoveIndex = startRemoveIndex;
- ClearGlyphRuns( startIndex,
- endIndex,
- runs,
- startRemoveIndex,
- endRemoveIndex );
+ uint32_t endRemoveIndex = startRemoveIndex;
+ ClearGlyphRuns(startIndex,
+ endIndex,
+ runs,
+ startRemoveIndex,
+ endRemoveIndex);
// Remove all remaining runs.
T* runBuffer = runs.Begin();
- runs.Erase( runBuffer + startRemoveIndex, runBuffer + endRemoveIndex );
+ runs.Erase(runBuffer + startRemoveIndex, runBuffer + endRemoveIndex);
}
} // namespace Text
#define DALI_TOOLKIT_TEXT_SCROLLER_INTERFACE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
class Actor;
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief An interface used by the text-controls which implement auto-scrolling
*/
class ScrollerInterface
{
public:
-
/**
* @brief Virtual destructor.
*/
virtual ~ScrollerInterface()
- {}
+ {
+ }
/**
* @brief Called when the scrolling finishes
#define DALI_TOOLKIT_TEXT_SCROLLER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/rendering/renderer.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/text/text-enumerations.h>
-#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
#include <dali-toolkit/internal/text/text-definitions.h>
+#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
+#include <dali-toolkit/public-api/text/text-enumerations.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
class TextScroller;
class ScrollerInterface;
class TextScroller : public RefObject, public ConnectionTracker
{
public:
-
/**
* @brief Text Scrolling helper, used to automatically scroll text, SetParameters should be called before scrolling is needed.
* CleanUp removes the Scrolling actors from stage whilst keeping the Scroller object alive and preserving Speed, Gap and Loop count.
*
* @param[in] scrollerInterface scroller interface
*/
- static TextScrollerPtr New( ScrollerInterface& scrollerInterface );
+ static TextScrollerPtr New(ScrollerInterface& scrollerInterface);
/**
* @brief Set parameters relating to source required for scrolling
* @param[in] horizontalAlignment horizontal alignment of the text
* @param[in] verticalAlignment vertical alignment of the text
*/
- void SetParameters( Actor scrollingTextActor, Dali::Renderer renderer, TextureSet textureSet, const Size& controlSize, const Size& textureSize, const float wrapGap, CharacterDirection direction, HorizontalAlignment::Type horizontalAlignment, VerticalAlignment::Type verticalAlignment );
+ void SetParameters(Actor scrollingTextActor, Dali::Renderer renderer, TextureSet textureSet, const Size& controlSize, const Size& textureSize, const float wrapGap, CharacterDirection direction, HorizontalAlignment::Type horizontalAlignment, VerticalAlignment::Type verticalAlignment);
/**
* @brief Set the gap distance to elapse before the text wraps around
* @param[in] gap distance to elapse
*/
- void SetGap( int gap );
+ void SetGap(int gap);
/**
* @brief Get the distance before scrolling wraps
* @brief Set speed the text should scroll
* @param[in] scrollSpeed pixels per second
*/
- void SetSpeed( int scrollSpeed );
+ void SetSpeed(int scrollSpeed);
/**
* @brief Get the speed of text scrolling
* @brief Set the number of times the text scrolling should loop, can stop current scrolling by passing in 0;
* @param[in] loopCount number of times the scrolled text should loop, 0 to stop scrolling
*/
- void SetLoopCount( int loopCount );
+ void SetLoopCount(int loopCount);
/**
* @brief Get the number of loops
* @brief Set the delay time of scroll animation loop
* @param[in] float delay time seconds of loops
*/
- void SetLoopDelay( float delay );
+ void SetLoopDelay(float delay);
/**
* @brief Get the delay time of scroll
* @brief Set the mode of scrolling stop
* @param[in] stopMode type when text scrolling is stoped.
*/
- void SetStopMode( TextLabel::AutoScrollStopMode::Type stopMode );
+ void SetStopMode(TextLabel::AutoScrollStopMode::Type stopMode);
/**
* @brief Stop the auto scrolling.
TextLabel::AutoScrollStopMode::Type GetStopMode() const;
private: // Implementation
-
/**
* Constructor
*/
- TextScroller( ScrollerInterface& scrollerInterface );
+ TextScroller(ScrollerInterface& scrollerInterface);
/**
* Destructor
~TextScroller();
// Undefined
- TextScroller( const TextScroller& handle );
+ TextScroller(const TextScroller& handle);
// Undefined
- TextScroller& operator=( const TextScroller& handle );
+ TextScroller& operator=(const TextScroller& handle);
/**
* @brief Callback for end of animation
* @param[in] animation Animation handle
*/
- void AutoScrollAnimationFinished( Dali::Animation& animation );
+ void AutoScrollAnimationFinished(Dali::Animation& animation);
/**
* @brief variables required to set up scrolling animation
* @param[in] scrollDuration duration of aninmation
* @param[in] loopCount number of times to loop the scrolling text
*/
- void StartScrolling( Actor scrollingTextActor, float scrollAmount, float scrollDuration, int loopCount );
+ void StartScrolling(Actor scrollingTextActor, float scrollAmount, float scrollDuration, int loopCount);
private:
-
- ScrollerInterface& mScrollerInterface; // Interface implemented by control that requires scrolling
- Property::Index mScrollDeltaIndex; // Property used by shader to represent distance to scroll
- Animation mScrollAnimation; // Animation used to update the mScrollDeltaIndex
- Dali::Renderer mRenderer; // Renderer used to render the text
- Shader mShader; // Shader originally used by the renderer while not scrolling
- TextureSet mTextureSet; // Texture originally used by the renderer while not scrolling
-
- int mScrollSpeed; ///< Speed which text should automatically scroll at
- int mLoopCount; ///< Number of time the text should scroll
- float mLoopDelay; ///< Time delay of loop start
- float mWrapGap; ///< Gap before text wraps around when scrolling
- TextLabel::AutoScrollStopMode::Type mStopMode; ///< Stop mode of scrolling text, when loop count is 0.
+ ScrollerInterface& mScrollerInterface; // Interface implemented by control that requires scrolling
+ Property::Index mScrollDeltaIndex; // Property used by shader to represent distance to scroll
+ Animation mScrollAnimation; // Animation used to update the mScrollDeltaIndex
+ Dali::Renderer mRenderer; // Renderer used to render the text
+ Shader mShader; // Shader originally used by the renderer while not scrolling
+ TextureSet mTextureSet; // Texture originally used by the renderer while not scrolling
+
+ int mScrollSpeed; ///< Speed which text should automatically scroll at
+ int mLoopCount; ///< Number of time the text should scroll
+ float mLoopDelay; ///< Time delay of loop start
+ float mWrapGap; ///< Gap before text wraps around when scrolling
+ TextLabel::AutoScrollStopMode::Type mStopMode; ///< Stop mode of scrolling text, when loop count is 0.
}; // TextScroller class
} // namespace Dali
#endif // DALI_TOOLKIT_TEXT_SCROLLER_H
-
#define DALI_TOOLKIT_TEXT_SELECTABLE_CONTROL_INTERFACE_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
-using Uint32Pair = std::pair<uint32_t,uint32_t>;
-using string = std::string;
+using Uint32Pair = std::pair<uint32_t, uint32_t>;
+using string = std::string;
namespace Text
{
-
/**
* @brief An interface that the Text::Controller used for text selection functionality.
*/
class SelectableControlInterface
{
public:
-
/**
* @brief Virtual destructor.
*/
* @param start start selection position (pass NULL to ignore).
* @param end end selection position (pass NULL to ignore).
*/
- virtual void SetTextSelectionRange(const uint32_t *start, const uint32_t *end) = 0;
+ virtual void SetTextSelectionRange(const uint32_t* start, const uint32_t* end) = 0;
/**
* @brief Called to return the selection postions in the texts.
#define DALI_TOOLKIT_TEXT_SELECTION_HANDLE_CONTROLLER_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// INTERNAL INCLUDES
-#include <dali-toolkit/internal/text/decorator/text-decorator.h>
#include <dali-toolkit/internal/text/cursor-helper-functions.h>
+#include <dali-toolkit/internal/text/decorator/text-decorator.h>
#include <dali-toolkit/internal/text/text-controller.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief Updates the Selection Handles.
*/
#define DALI_TOOLKIT_TEXT_VERTICAL_SCROLLER_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
class TextVerticalScroller;
typedef IntrusivePtr<TextVerticalScroller> TextVerticalScrollerPtr;
class TextVerticalScroller : public RefObject, public ConnectionTracker
{
public:
-
/**
* @brief Text Scrolling helper, used to automatically scroll text, StartScroll should be called when scrolling is needed.
*
* @param[in] y The new y position
* @param[in] scrollAmount The distance to destination y position for actor to be animated
*/
- void CheckStartAnimation( Actor& sourceActor, float x, float y, float scrollAmount );
+ void CheckStartAnimation(Actor& sourceActor, float x, float y, float scrollAmount);
/**
* @brief Set duration the text should scroll
* @param[in] duration The duration in seconds
*/
- void SetDuration( float duration );
+ void SetDuration(float duration);
private: // Implementation
/**
virtual ~TextVerticalScroller();
private:
-
- Animation mScrollAnimation; // Animation used to update the actor's position
- Actor mScrollingActor; // The actor being animated
- float mDuration; // The duration of text scrolling
- float mScrollTo; // The destination y position
-}; // TextVerticalScroller class
+ Animation mScrollAnimation; // Animation used to update the actor's position
+ Actor mScrollingActor; // The actor being animated
+ float mDuration; // The duration of text scrolling
+ float mScrollTo; // The destination y position
+}; // TextVerticalScroller class
} // namespace Text
#define DALI_TOOLKIT_TEXT_VIEW_INTERFACE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
struct Vector2;
struct Vector4;
namespace Toolkit
{
-
namespace Text
{
-
struct GlyphRun;
/**
class ViewInterface
{
public:
-
/**
* @brief Constructor.
*/
*
* @return The number of glyphs.
*/
- virtual Length GetGlyphs( GlyphInfo* glyphs,
- Vector2* glyphPositions,
- float& minLineOffset,
- GlyphIndex glyphIndex,
- Length numberOfGlyphs ) const = 0;
+ virtual Length GetGlyphs(GlyphInfo* glyphs,
+ Vector2* glyphPositions,
+ float& minLineOffset,
+ GlyphIndex glyphIndex,
+ Length numberOfGlyphs) const = 0;
/**
* @brief Retrieves the vector of colors.
* @param[in] index Index of the first underline run to be copied.
* @param[in] numberOfRuns Number of underline runs to be copied.
*/
- virtual void GetUnderlineRuns( GlyphRun* underlineRuns,
- UnderlineRunIndex index,
- Length numberOfRuns ) const = 0;
+ virtual void GetUnderlineRuns(GlyphRun* underlineRuns,
+ UnderlineRunIndex index,
+ Length numberOfRuns) const = 0;
/**
* @brief Retrieve the outline color.
* @return The width of the outline.
*/
virtual uint16_t GetOutlineWidth() const = 0;
-
};
} // namespace Text
#define DALI_TOOLKIT_TEXT_VIEW_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief View provides an interface between the Text layout engine and rendering back-end.
*/
class View : public ViewInterface
{
public:
-
/**
* @brief Create a new instance of a View.
*/
*
* @param[in] visualModel The visual model used by the View.
*/
- void SetVisualModel( VisualModelPtr visualModel );
+ void SetVisualModel(VisualModelPtr visualModel);
/**
* @copydoc Dali::Toolkit::Text::ViewInterface::GetControlSize()
/**
* @copydoc Dali::Toolkit::Text::ViewInterface::GetGlyphs()
*/
- virtual Length GetGlyphs( GlyphInfo* glyphs,
- Vector2* glyphPositions,
- float& minLineOffset,
- GlyphIndex glyphIndex,
- Length numberOfGlyphs ) const;
+ virtual Length GetGlyphs(GlyphInfo* glyphs,
+ Vector2* glyphPositions,
+ float& minLineOffset,
+ GlyphIndex glyphIndex,
+ Length numberOfGlyphs) const;
/**
* @copydoc Dali::Toolkit::Text::ViewInterface::GetColors()
/**
* @copydoc Dali::Toolkit::Text::ViewInterface::GetUnderlineRuns()
*/
- virtual void GetUnderlineRuns( GlyphRun* underlineRuns,
- UnderlineRunIndex index,
- Length numberOfRuns ) const;
+ virtual void GetUnderlineRuns(GlyphRun* underlineRuns,
+ UnderlineRunIndex index,
+ Length numberOfRuns) const;
/**
* @copydoc Dali::Toolkit::Text::ViewInterface::GetOutlineColor()
uint16_t GetOutlineWidth() const override;
private:
-
// Undefined
- View( const View& handle );
+ View(const View& handle);
// Undefined
- View& operator=( const View& handle );
+ View& operator=(const View& handle);
private:
-
struct Impl;
Impl* mImpl;
};
#define DALI_TOOLKIT_TEXT_VISUAL_MODEL_IMPL_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/object/ref-object.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/internal/text/line-run.h>
#include <dali-toolkit/internal/text/color-run.h>
+#include <dali-toolkit/internal/text/line-run.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
class VisualModel;
typedef IntrusivePtr<VisualModel> VisualModelPtr;
class VisualModel : public RefObject
{
public:
-
/**
* @brief Create a new instance of a VisualModel.
*
* @param[in] startGlyphIndex The glyph from where the conversion table is created.
* @param[in] numberOfCharacters The number of characters.
*/
- void CreateCharacterToGlyphTable( CharacterIndex startIndex,
- GlyphIndex startGlyphIndex,
- Length numberOfCharacters );
+ void CreateCharacterToGlyphTable(CharacterIndex startIndex,
+ GlyphIndex startGlyphIndex,
+ Length numberOfCharacters);
/**
* @brief Creates an array containing the number of glyphs per character.
* @param[in] startGlyphIndex The glyph from where the conversion table is created.
* @param[in] numberOfCharacters The number of characters.
*/
- void CreateGlyphsPerCharacterTable( CharacterIndex startIndex,
- GlyphIndex startGlyphIndex,
- Length numberOfCharacters );
+ void CreateGlyphsPerCharacterTable(CharacterIndex startIndex,
+ GlyphIndex startGlyphIndex,
+ Length numberOfCharacters);
/**
* @brief Retrieves glyphs in the given buffer.
* @param[in] glyphIndex Index to the first glyph.
* @param[in] numberOfGlyphs Number of glyphs to be copied.
*/
- void GetGlyphs( GlyphInfo* glyphs,
- GlyphIndex glyphIndex,
- Length numberOfGlyphs ) const;
+ void GetGlyphs(GlyphInfo* glyphs,
+ GlyphIndex glyphIndex,
+ Length numberOfGlyphs) const;
// Position interface
* @param[in] glyphIndex Index to the first glyph position.
* @param[in] numberOfGlyphs The number of positions to be copied.
*/
- void GetGlyphPositions( Vector2* glyphPositions,
- GlyphIndex glyphIndex,
- Length numberOfGlyphs ) const;
+ void GetGlyphPositions(Vector2* glyphPositions,
+ GlyphIndex glyphIndex,
+ Length numberOfGlyphs) const;
// Line interface.
* @param[out] firstLine Index to the line containing the glyph index.
* @param[out] numberOfLines The number of lines.
*/
- void GetNumberOfLines( GlyphIndex glyphIndex,
- Length numberOfGlyphs,
- LineIndex& firstLine,
- Length& numberOfLines ) const;
+ void GetNumberOfLines(GlyphIndex glyphIndex,
+ Length numberOfGlyphs,
+ LineIndex& firstLine,
+ Length& numberOfLines) const;
/**
* @brief Retrieves the lines where the given range of glyphs is laid out.
* @param[in] glyphIndex Index to the first glyphs of the range.
* @param[in] numberOfGlyphs Number of glyphs in the range.
*/
- void GetLinesOfGlyphRange( LineRun* lines,
- GlyphIndex glyphIndex,
- Length numberOfGlyphs ) const;
+ void GetLinesOfGlyphRange(LineRun* lines,
+ GlyphIndex glyphIndex,
+ Length numberOfGlyphs) const;
/**
* @brief Retrieves the line index where the character is laid-out.
*
* @return The line index.
*/
- LineIndex GetLineOfCharacter( CharacterIndex characterIndex );
+ LineIndex GetLineOfCharacter(CharacterIndex characterIndex);
// Underline runs
* @param[in] index Index of the first underline run to be copied.
* @param[in] numberOfRuns Number of underline runs to be copied.
*/
- void GetUnderlineRuns( GlyphRun* underlineRuns,
- UnderlineRunIndex index,
- Length numberOfRuns ) const;
+ void GetUnderlineRuns(GlyphRun* underlineRuns,
+ UnderlineRunIndex index,
+ Length numberOfRuns) const;
// Size interface
*
* @param[in] size The text's natural size.
*/
- void SetNaturalSize( const Vector2& size );
+ void SetNaturalSize(const Vector2& size);
/**
* @brief Retrieves the natural size.
*
* @param[in] size The text's size.
*/
- void SetLayoutSize( const Vector2& size );
+ void SetLayoutSize(const Vector2& size);
/**
* @brief Retrieves the text's layout size.
*
* @param[in] textColor The text's color
*/
- void SetTextColor( const Vector4& textColor );
+ void SetTextColor(const Vector4& textColor);
/**
* @brief Retrieve the text's color
*
* @param[in] shadowOffset The shadow offset, 0,0 indicates no shadow.
*/
- void SetShadowOffset( const Vector2& shadowOffset );
+ void SetShadowOffset(const Vector2& shadowOffset);
/**
* @brief Retrieves the text's shadow offset.
*
* @param[in] shadowColor The shadow color.
*/
- void SetShadowColor( const Vector4& shadowColor );
+ void SetShadowColor(const Vector4& shadowColor);
/**
* @brief Retrieves the text's shadow color.
*
* @param[in] shadowBlurRadius The shadow blur radius, 0,0 indicates no blur.
*/
- void SetShadowBlurRadius( const float& shadowBlurRadius );
+ void SetShadowBlurRadius(const float& shadowBlurRadius);
/**
* @brief Retrieve the shadow blur radius.
*
* @param[in] color The text's underline color.
*/
- void SetUnderlineColor( const Vector4& color );
+ void SetUnderlineColor(const Vector4& color);
/**
* @brief Retrieves the text's underline color.
*
* @param[in] enabled true if underlined.
*/
- void SetUnderlineEnabled( bool enabled );
+ void SetUnderlineEnabled(bool enabled);
/**
* @brief Returns whether the text is underlined or not.
*
* @param[in] height The height in pixels of the underline
*/
- void SetUnderlineHeight( float height );
+ void SetUnderlineHeight(float height);
/**
* @brief Retrieves the underline height override
*
* @param[in] color color of outline.
*/
- void SetOutlineColor( const Vector4& color );
+ void SetOutlineColor(const Vector4& color);
/**
* @brief Retrieve the outline color.
*
* @param[in] width The width in pixels of the outline, 0 indicates no outline
*/
- void SetOutlineWidth( uint16_t width );
+ void SetOutlineWidth(uint16_t width);
/**
* @brief Retrieves the width of an outline
*
* @param[in] color The text's background color.
*/
- void SetBackgroundColor( const Vector4& color );
+ void SetBackgroundColor(const Vector4& color);
/**
* @brief Retrieves the text's background color.
*
* @param[in] enabled true if the text has a background.
*/
- void SetBackgroundEnabled( bool enabled );
+ void SetBackgroundEnabled(bool enabled);
/**
* @brief Returns whether the text has a background or not.
bool IsBackgroundEnabled() const;
protected:
-
/**
* @brief A reference counted object may only be deleted by calling Unreference().
*/
virtual ~VisualModel();
private:
-
/**
* @brief Private constructor.
*/
VisualModel();
// Undefined
- VisualModel( const VisualModel& handle );
+ VisualModel(const VisualModel& handle);
// Undefined
- VisualModel& operator=( const VisualModel& handle );
+ VisualModel& operator=(const VisualModel& handle);
public:
-
- Vector<GlyphInfo> mGlyphs; ///< For each glyph, the font's id, glyph's index within the font and glyph's metrics.
- Vector<CharacterIndex> mGlyphsToCharacters; ///< For each glyph, the index of the first character.
- Vector<GlyphIndex> mCharactersToGlyph; ///< For each character, the index of the first glyph.
- Vector<Length> mCharactersPerGlyph; ///< For each glyph, the number of characters that form the glyph.
- Vector<Length> mGlyphsPerCharacter; ///< For each character, the number of glyphs that are shaped.
- Vector<Vector2> mGlyphPositions; ///< For each glyph, the position.
- Vector<LineRun> mLines; ///< The laid out lines.
- Vector<GlyphRun> mUnderlineRuns; ///< Runs of glyphs that are underlined.
- Vector<Vector4> mColors; ///< Colors of the glyphs.
- Vector<ColorIndex> mColorIndices; ///< Indices to the vector of colors for each glyphs.
- Vector<Vector4> mBackgroundColors; ///< Background colors of the glyphs.
+ Vector<GlyphInfo> mGlyphs; ///< For each glyph, the font's id, glyph's index within the font and glyph's metrics.
+ Vector<CharacterIndex> mGlyphsToCharacters; ///< For each glyph, the index of the first character.
+ Vector<GlyphIndex> mCharactersToGlyph; ///< For each character, the index of the first glyph.
+ Vector<Length> mCharactersPerGlyph; ///< For each glyph, the number of characters that form the glyph.
+ Vector<Length> mGlyphsPerCharacter; ///< For each character, the number of glyphs that are shaped.
+ Vector<Vector2> mGlyphPositions; ///< For each glyph, the position.
+ Vector<LineRun> mLines; ///< The laid out lines.
+ Vector<GlyphRun> mUnderlineRuns; ///< Runs of glyphs that are underlined.
+ Vector<Vector4> mColors; ///< Colors of the glyphs.
+ Vector<ColorIndex> mColorIndices; ///< Indices to the vector of colors for each glyphs.
+ Vector<Vector4> mBackgroundColors; ///< Background colors of the glyphs.
Vector<ColorIndex> mBackgroundColorIndices; ///< Indices to the vector of background colors for each glyphs.
- Vector4 mTextColor; ///< The text color
- Vector4 mShadowColor; ///< Color of drop shadow
- Vector4 mUnderlineColor; ///< Color of underline
- Vector4 mOutlineColor; ///< Color of outline
- Vector4 mBackgroundColor; ///< Color of text background
- Size mControlSize; ///< The size of the UI control.
- Vector2 mShadowOffset; ///< Offset for drop shadow, 0 indicates no shadow
- float mUnderlineHeight; ///< Fixed height for underline to override font metrics.
- float mShadowBlurRadius; ///< Blur radius of shadow, 0 indicates no blur.
- uint16_t mOutlineWidth; ///< Width of outline.
+ Vector4 mTextColor; ///< The text color
+ Vector4 mShadowColor; ///< Color of drop shadow
+ Vector4 mUnderlineColor; ///< Color of underline
+ Vector4 mOutlineColor; ///< Color of outline
+ Vector4 mBackgroundColor; ///< Color of text background
+ Size mControlSize; ///< The size of the UI control.
+ Vector2 mShadowOffset; ///< Offset for drop shadow, 0 indicates no shadow
+ float mUnderlineHeight; ///< Fixed height for underline to override font metrics.
+ float mShadowBlurRadius; ///< Blur radius of shadow, 0 indicates no blur.
+ uint16_t mOutlineWidth; ///< Width of outline.
private:
-
- Size mNaturalSize; ///< Size of the text with no line wrapping.
- Size mLayoutSize; ///< Size of the laid-out text considering the layout properties set.
+ Size mNaturalSize; ///< Size of the text with no line wrapping.
+ Size mLayoutSize; ///< Size of the laid-out text considering the layout properties set.
// Caches to increase performance in some consecutive operations.
LineIndex mCachedLineIndex; ///< Used to increase performance in consecutive calls to GetLineOfGlyph() or GetLineOfCharacter() with consecutive glyphs or characters.
public:
-
- bool mUnderlineEnabled:1; ///< Underline enabled flag
- bool mUnderlineColorSet:1; ///< Has the underline color been explicitly set?
- bool mBackgroundEnabled:1; ///< Background enabled flag
+ bool mUnderlineEnabled : 1; ///< Underline enabled flag
+ bool mUnderlineColorSet : 1; ///< Has the underline color been explicitly set?
+ bool mBackgroundEnabled : 1; ///< Background enabled flag
};
} // namespace Text
#define DALI_TOOLKIT_TEXT_XHTML_ENTITIES_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
/**
*
* @return pointer to UTF8 entity code if namedEntity found in table otherwise NULL
*/
-const char* const NamedEntityToUtf8( const char* const markupText, unsigned int len );
+const char* const NamedEntityToUtf8(const char* const markupText, unsigned int len);
} // namespace Text
#define DALI_TOOLKIT_INTERNAL_CUBE_TRANSITION_CROSS_EFFECT_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
class CubeTransitionCrossEffect;
namespace Internal
{
-
class CubeTransitionEffect;
class CubeTransitionCrossEffect : public CubeTransitionEffect
{
-
public:
-
/**
* @copydoc Toolkit::CubeTransitionCrossEffect::New
*/
- static Toolkit::CubeTransitionCrossEffect New( unsigned int numRows, unsigned int numColumns );
+ static Toolkit::CubeTransitionCrossEffect New(unsigned int numRows, unsigned int numColumns);
protected:
-
- /**
+ /**
* @copydoc Toolkit::Internal::CubeTransitionEffect::OnInitialize
*/
- void OnInitialize() override;
+ void OnInitialize() override;
- /**
+ /**
* @copydoc Toolkit::Internal::CubeTransitionEffect::OnStartTransition
*/
- void OnStartTransition( Vector2 panPosition, Vector2 panDisplacement ) override;
+ void OnStartTransition(Vector2 panPosition, Vector2 panDisplacement) override;
private:
-
- /**
+ /**
* @brief Construct a new CubeTransitionCrossEffect object
*
* @param[in] numRows How many rows of cubes
* @param[in] numColumns How many columns of cubes
*/
- CubeTransitionCrossEffect( unsigned int numRows, unsigned int numColumns );
+ CubeTransitionCrossEffect(unsigned int numRows, unsigned int numColumns);
- /**
+ /**
* @brief Set up animation to an Actor
* This will also displace the cubes in the z direction by mCubeDisplacement and spread them apart on the xy plane
* given by the closeness of displacementCentre to the XY plane at 0.
* @param[in] angle The angle of the rotation animation
* @param[in] the centre to "explode" the tiles outwards from
*/
- void SetupAnimation( unsigned int actorIndex, unsigned int x, unsigned int y, float angle, const Vector3 axis, const Vector3& displacementCentre );
+ void SetupAnimation(unsigned int actorIndex, unsigned int x, unsigned int y, float angle, const Vector3 axis, const Vector3& displacementCentre);
private:
-
- /**
+ /**
* The factor that determines how spread apart from each other the cubes will go
* when they are displaced during the transition animation.
* The larger the value the more the spread apart the cubes will be.
* it should be in the range (0.0, +infinity)
*/
- float mDisplacementSpreadFactor;
+ float mDisplacementSpreadFactor;
}; //class CubeTransitionCrossEffect
// Helpers for public-api forwarding methods
-inline Internal::CubeTransitionCrossEffect& GetImpl( Dali::Toolkit::CubeTransitionCrossEffect& obj )
+inline Internal::CubeTransitionCrossEffect& GetImpl(Dali::Toolkit::CubeTransitionCrossEffect& obj)
{
- DALI_ASSERT_ALWAYS( obj );
+ DALI_ASSERT_ALWAYS(obj);
Dali::RefObject& handle = obj.GetImplementation();
- return static_cast< Internal::CubeTransitionCrossEffect& >( handle );
+ return static_cast<Internal::CubeTransitionCrossEffect&>(handle);
}
-inline const Internal::CubeTransitionCrossEffect& GetImpl( const Dali::Toolkit::CubeTransitionCrossEffect& obj )
+inline const Internal::CubeTransitionCrossEffect& GetImpl(const Dali::Toolkit::CubeTransitionCrossEffect& obj)
{
- DALI_ASSERT_ALWAYS( obj );
+ DALI_ASSERT_ALWAYS(obj);
const Dali::RefObject& handle = obj.GetImplementation();
- return static_cast< const Internal::CubeTransitionCrossEffect& >( handle );
+ return static_cast<const Internal::CubeTransitionCrossEffect&>(handle);
}
} // namespace Toolkit
#define DALI_TOOLKIT_INTERNAL_CUBE_TRANSITION_EFFECT_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
class CubeTransitionEffect;
namespace Internal
{
-
/**
* CubeTransitionEffect implementation class
*/
class CubeTransitionEffect : public Control
{
-
public:
-
/**
* Destructor
*/
/**
* @copydoc Toolkit::CubeTransitionEffect::SetTransitionDuration
*/
- void SetTransitionDuration( float duration );
+ void SetTransitionDuration(float duration);
/**
* @copydoc Toolkit::CubeTransitionEffect::GetTransitionDuration
/**
* @copydoc Toolkit::CubeTransitionEffect::SetCubeDisplacement
*/
- void SetCubeDisplacement( float displacement );
+ void SetCubeDisplacement(float displacement);
/**
* @copydoc Toolkit::CubeTransitionEffect::GetCubeDisplacement
/**
* @copydoc Toolkit::CubeTransitionEffect::SetCurrentTexture
*/
- void SetCurrentTexture( Texture texture );
+ void SetCurrentTexture(Texture texture);
/**
* @copydoc Toolkit::CubeTransitionEffect::SetTargetTexture
*/
- void SetTargetTexture( Texture texture );
+ void SetTargetTexture(Texture texture);
/**
* @copydoc Toolkit::CubeTransitionEffect::StartTransition(bool)
*/
- void StartTransition( bool toNextImage = true );
+ void StartTransition(bool toNextImage = true);
/**
* @copydoc Toolkit::CubeTransitionEffect::StartTransition(Vector2, Vector2)
*/
- void StartTransition( Vector2 panPosition, Vector2 panDisplacement );
+ void StartTransition(Vector2 panPosition, Vector2 panDisplacement);
/**
* @copydoc Toolkit::CubeTransitionEffect::PauseTransition()
void StopTransition();
public: //Signal
-
/**
* @copydoc Toolkit::CubeTransitionEffect::TransitionCompletedSignal()
*/
* @return True if the signal was connected.
* @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
*/
- static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
+ static bool DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
protected:
/**
* @copydoc CustomActorImpl::OnSceneConnection()
*/
- void OnSceneConnection( int depth ) override;
+ void OnSceneConnection(int depth) override;
/**
* @copydoc CustomActorImpl::OnSceneDisconnection()
void OnSceneDisconnection() override;
protected:
-
/**
* Construct a new CubeTransitionEffect object
* Called in the constructor of subclasses
* @param[in] numRows How many rows of cubes
* @param[in] numColumns How many columns of cubes
*/
- CubeTransitionEffect( unsigned int numRows, unsigned int numColumns );
+ CubeTransitionEffect(unsigned int numRows, unsigned int numColumns);
/**
* Initialization steps: creating a layer, two groups of tiles,
*/
void Initialize();
-
protected:
- void SetTargetLeft( unsigned int idx );
- void SetTargetRight( unsigned int idx );
- void SetTargetTop( unsigned int idx );
- void SetTargetBottom( unsigned int idx );
+ void SetTargetLeft(unsigned int idx);
+ void SetTargetRight(unsigned int idx);
+ void SetTargetTop(unsigned int idx);
+ void SetTargetBottom(unsigned int idx);
private:
-
/**
* Callback function of transition animation finished
* Hide transition layer, show current image, and set isAnimating flag to false
* This method is called after the CubeTransitionEffect has been initialized. Derived classes should do
* any second phase initialization by overriding this method.
*/
- virtual void OnInitialize() { }
+ virtual void OnInitialize()
+ {
+ }
/**
* This method is called after the a new transition is activated.
* @param[in] panPosition The press down position of panGesture
* @param[in] panDisplacement The displacement vector of panGesture
*/
- virtual void OnStartTransition( Vector2 panPosition, Vector2 panDisplacement ) {}
+ virtual void OnStartTransition(Vector2 panPosition, Vector2 panDisplacement)
+ {
+ }
/**
* This method is called when the transition is forced stop in the middle of animation.
* Derived classed should set the rotation status of the cubes to the same as the final state when the animation is finished completely.
* So that the next transition would be started correctly.
*/
- virtual void OnStopTransition() {}
+ virtual void OnStopTransition()
+ {
+ }
- void OnRelayout( const Vector2& size, RelayoutContainer& container ) override;
+ void OnRelayout(const Vector2& size, RelayoutContainer& container) override;
void ResetToInitialState();
-
protected:
- typedef std::vector< Actor > ActorArray;
- enum FACE { TOP, BOTTOM, LEFT, RIGHT };
+ typedef std::vector<Actor> ActorArray;
+ enum FACE
+ {
+ TOP,
+ BOTTOM,
+ LEFT,
+ RIGHT
+ };
- ActorArray mBoxes;
- Vector< FACE > mBoxType;
- ActorArray mCurrentTiles;
- ActorArray mTargetTiles;
+ ActorArray mBoxes;
+ Vector<FACE> mBoxType;
+ ActorArray mCurrentTiles;
+ ActorArray mTargetTiles;
- Actor mBoxRoot;
+ Actor mBoxRoot;
- unsigned int mRows;
- unsigned int mColumns;
+ unsigned int mRows;
+ unsigned int mColumns;
- Renderer mCurrentRenderer;
- Renderer mTargetRenderer;
+ Renderer mCurrentRenderer;
+ Renderer mTargetRenderer;
- Texture mCurrentTexture;
- Texture mTargetTexture;
+ Texture mCurrentTexture;
+ Texture mTargetTexture;
- Animation mAnimation;
+ Animation mAnimation;
- Vector2 mTileSize;
+ Vector2 mTileSize;
- bool mIsAnimating;
- bool mIsPaused;
+ bool mIsAnimating;
+ bool mIsPaused;
- float mAnimationDuration;
- float mCubeDisplacement;
+ float mAnimationDuration;
+ float mCubeDisplacement;
- static const Vector4 FULL_BRIGHTNESS;
- static const Vector4 HALF_BRIGHTNESS;
+ static const Vector4 FULL_BRIGHTNESS;
+ static const Vector4 HALF_BRIGHTNESS;
private:
-
Toolkit::CubeTransitionEffect::TransitionCompletedSignalType mTransitionCompletedSignal;
-
};
} // namespace Internal
#define DALI_TOOLKIT_INTERNAL_CUBE_TRANSITION_FOLD_EFFECT_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
class CubeTransitionFoldEffect;
namespace Internal
{
-
class CubeTransitionEffect;
class CubeTransitionFoldEffect : public CubeTransitionEffect
{
-
public:
-
/**
* @copydoc Toolkit::CubeTransitionFoldEffect::New
*/
- static Toolkit::CubeTransitionFoldEffect New( unsigned int numRows, unsigned int numColumns );
+ static Toolkit::CubeTransitionFoldEffect New(unsigned int numRows, unsigned int numColumns);
protected:
-
- /**
+ /**
* @copydoc Toolkit::CubeTransitionEffect::OnInitialize
*/
- void OnInitialize() override;
+ void OnInitialize() override;
- /**
+ /**
* @copydoc Toolkit::CubeTransitionEffect::OnStartTransition
*/
- void OnStartTransition( Vector2 panPosition, Vector2 panDisplacement ) override;
+ void OnStartTransition(Vector2 panPosition, Vector2 panDisplacement) override;
private:
-
- /**
+ /**
* Construct a new CubeTransitionFoldEffect object
* @param[in] numRows How many rows of cubes
* @param[in] numColumns How many columns of cubes
*/
- CubeTransitionFoldEffect( unsigned int numRows, unsigned int numColumns );
+ CubeTransitionFoldEffect(unsigned int numRows, unsigned int numColumns);
- /**
+ /**
* Set up animation to an Actor
* @param[in] actorIndex The index of the cube in the cube array
* @param[in] angle The angle of the rotation animation
*/
- void SetupAnimation( unsigned int actorIndex, unsigned int x, float angle );
+ void SetupAnimation(unsigned int actorIndex, unsigned int x, float angle);
}; //class CubeTransitionFoldEffect
// Helpers for public-api forwarding methods
-inline Internal::CubeTransitionFoldEffect& GetImpl( Dali::Toolkit::CubeTransitionFoldEffect& obj )
+inline Internal::CubeTransitionFoldEffect& GetImpl(Dali::Toolkit::CubeTransitionFoldEffect& obj)
{
- DALI_ASSERT_ALWAYS( obj );
+ DALI_ASSERT_ALWAYS(obj);
Dali::RefObject& handle = obj.GetImplementation();
- return static_cast< Internal::CubeTransitionFoldEffect& >( handle );
+ return static_cast<Internal::CubeTransitionFoldEffect&>(handle);
}
-inline const Internal::CubeTransitionFoldEffect& GetImpl( const Dali::Toolkit::CubeTransitionFoldEffect& obj )
+inline const Internal::CubeTransitionFoldEffect& GetImpl(const Dali::Toolkit::CubeTransitionFoldEffect& obj)
{
- DALI_ASSERT_ALWAYS( obj );
+ DALI_ASSERT_ALWAYS(obj);
const Dali::RefObject& handle = obj.GetImplementation();
- return static_cast< const Internal::CubeTransitionFoldEffect& >( handle );
+ return static_cast<const Internal::CubeTransitionFoldEffect&>(handle);
}
} // namespace Toolkit
#define DALI_TOOLKIT_INTERNAL_CUBE_TRANSITION_WAVE_EFFECT_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
class CubeTransitionWaveEffect;
namespace Internal
{
-
class CubeTransitionEffect;
class CubeTransitionWaveEffect : public CubeTransitionEffect
{
-
public:
-
/**
* @copydoc Toolkit::CubeTransitionWaveEffect::New
*/
- static Toolkit::CubeTransitionWaveEffect New(unsigned int numRows, unsigned int numColumns );
+ static Toolkit::CubeTransitionWaveEffect New(unsigned int numRows, unsigned int numColumns);
protected:
-
/**
* @copydoc Toolkit::Internal::CubeTransitionEffect::OnInitialize
*/
/**
* @copydoc Toolkit::Internal::CubeTransitionEffect::OnStartTransition
*/
- void OnStartTransition( Vector2 panPosition, Vector2 panDisplacement ) override;
+ void OnStartTransition(Vector2 panPosition, Vector2 panDisplacement) override;
private:
-
/**
* Construct a new CubeTransitionWaveEffect object
* @param[in] numRows How many rows of cubes
* @param[in] numColumns How many columns of cubes
*/
- CubeTransitionWaveEffect( unsigned int numRows, unsigned int numColumns );
+ CubeTransitionWaveEffect(unsigned int numRows, unsigned int numColumns);
/**
* The Saddle surface (Hyperbolic paraboloid)function is used to calculate the delay of rotating animation for each cube
* @param[in] position The press down position of panGesture
* @param[in] displacement The displacement vector of panGesture
*/
- void CalculateSaddleSurfaceParameters( Vector2 position, Vector2 displacement);
+ void CalculateSaddleSurfaceParameters(Vector2 position, Vector2 displacement);
/**
* Calculate the delay of the animation for each cube
* @param[in] y The Y coordinate of the cube
* @return The delay time of the animation
*/
- float CalculateDelay( float x, float y, bool forward );
+ float CalculateDelay(float x, float y, bool forward);
private:
-
//saddle surface(Hyperbolic paraboloid)function, used to calculate the delay time of each cube
//z = 1.0 + y*y/a/a - x*x/b/b
//with our selection of parameters(a and b), this value for any cube is between 0.0 and 2.0
- float mSaddleAA; //a*a
- float mSaddleBB; //b*b
- float mSaddleB; //b
- Vector2 mTranslation;
- Vector2 mRotation;
+ float mSaddleAA; //a*a
+ float mSaddleBB; //b*b
+ float mSaddleB; //b
+ Vector2 mTranslation;
+ Vector2 mRotation;
}; // class CubeTransitionWaveEffect
// Helpers for public-api forwarding methods
-inline Internal::CubeTransitionWaveEffect& GetImpl( Dali::Toolkit::CubeTransitionWaveEffect& obj )
+inline Internal::CubeTransitionWaveEffect& GetImpl(Dali::Toolkit::CubeTransitionWaveEffect& obj)
{
- DALI_ASSERT_ALWAYS( obj );
+ DALI_ASSERT_ALWAYS(obj);
Dali::RefObject& handle = obj.GetImplementation();
- return static_cast< Internal::CubeTransitionWaveEffect& >( handle );
+ return static_cast<Internal::CubeTransitionWaveEffect&>(handle);
}
-inline const Internal::CubeTransitionWaveEffect& GetImpl( const Dali::Toolkit::CubeTransitionWaveEffect& obj )
+inline const Internal::CubeTransitionWaveEffect& GetImpl(const Dali::Toolkit::CubeTransitionWaveEffect& obj)
{
- DALI_ASSERT_ALWAYS( obj );
+ DALI_ASSERT_ALWAYS(obj);
const Dali::RefObject& handle = obj.GetImplementation();
- return static_cast< const Internal::CubeTransitionWaveEffect& >( handle );
+ return static_cast<const Internal::CubeTransitionWaveEffect&>(handle);
}
} // namespace Toolkit
*/
//EXTERNAL INCLUDES
+#include <dali-toolkit/devel-api/visuals/animated-gradient-visual-properties-devel.h>
+#include <dali/devel-api/common/owner-container.h>
#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/common/intrusive-ptr.h>
-#include <dali/devel-api/common/owner-container.h>
-#include <dali-toolkit/devel-api/visuals/animated-gradient-visual-properties-devel.h>
//INTERNAL INCLUDES
+#include <dali-toolkit/internal/visuals/visual-base-impl.h>
#include <dali/devel-api/scripting/enum-helper.h>
#include <dali/devel-api/scripting/scripting.h>
-#include <dali-toolkit/internal/visuals/visual-base-impl.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
class AnimatedGradientVisual;
-typedef IntrusivePtr< AnimatedGradientVisual > AnimatedGradientVisualPtr;
+typedef IntrusivePtr<AnimatedGradientVisual> AnimatedGradientVisualPtr;
/**
* This visual which renders smooth transition of colors to the control's quad.
class AnimatedGradientVisual : public Visual::Base
{
public:
-
/**
* Animation informations what this visual using
*/
struct GradientAnimationData
{
- GradientAnimationData()
- : index( Property::INVALID_INDEX ),
- loop_count( 0 ),
- delay( 0.0f ),
- forward( false ),
- auto_mirror( false )
+ GradientAnimationData()
+ : index(Property::INVALID_INDEX),
+ loop_count(0),
+ delay(0.0f),
+ forward(false),
+ auto_mirror(false)
{
}
Toolkit::TransitionData transition;
- Animation animation;
- Property::Index index;
- int loop_count; ///< if < 0, loop unlimited. else, loop loop_count times.
- float delay; ///< delay time. if > 0, wait 'delay' seconds. else, play animation at '-delay' seconds.
- bool forward; ///< True if AnimationParameter::DirectionType::Type is FORWARD
- bool auto_mirror; ///< True if AnimationParameter::LoopType::Type is MIRROR
+ Animation animation;
+ Property::Index index;
+ int loop_count; ///< if < 0, loop unlimited. else, loop loop_count times.
+ float delay; ///< delay time. if > 0, wait 'delay' seconds. else, play animation at '-delay' seconds.
+ bool forward; ///< True if AnimationParameter::DirectionType::Type is FORWARD
+ bool auto_mirror; ///< True if AnimationParameter::LoopType::Type is MIRROR
};
- using GradientAnimationDataList = Dali::OwnerContainer< GradientAnimationData* >;
+ using GradientAnimationDataList = Dali::OwnerContainer<GradientAnimationData*>;
public:
-
/**
* @brief Create a new animated gradient visual.
*
* @param[in] properties A Property::Map containing settings for this visual
* @return A smart-pointer to the newly allocated visual
*/
- static AnimatedGradientVisualPtr New( VisualFactoryCache& factoryCache, const Property::Map& properties );
+ static AnimatedGradientVisualPtr New(VisualFactoryCache& factoryCache, const Property::Map& properties);
private: //from Visual
-
/**
* @copydoc Visual::Base::CreatePropertyMap
*/
- void DoCreatePropertyMap( Property::Map& map ) const override;
+ void DoCreatePropertyMap(Property::Map& map) const override;
/**
* @copydoc Visual::Base::CreateInstancePropertyMap
*/
- void DoCreateInstancePropertyMap( Property::Map& map ) const override;
+ void DoCreateInstancePropertyMap(Property::Map& map) const override;
protected:
-
/**
* @brief Constructor.
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
*/
- AnimatedGradientVisual( VisualFactoryCache& factoryCache );
+ AnimatedGradientVisual(VisualFactoryCache& factoryCache);
/**
* @brief A reference counted object may only be deleted by calling Unrefecence()
/**
* @copydoc Visual::Base::DoSetProperties
*/
- void DoSetProperties( const Property::Map& propertyMap ) override;
+ void DoSetProperties(const Property::Map& propertyMap) override;
/**
* @copydoc Visual::Base::OnSetTransform
/**
* @copydoc Visual::Base::DoSetOnScene
*/
- void DoSetOnScene( Actor& actor ) override;
+ void DoSetOnScene(Actor& actor) override;
/**
* @copydoc Visual::Base::DoSetOffScene
*/
- void DoSetOffScene( Actor& actor ) override;
+ void DoSetOffScene(Actor& actor) override;
private:
-
/**
* @brief Initialize the default value of properies.
*/
*
* param[in] propertyMap A Property::Map come from DoSetProperties
*/
- void SetupGradientAnimationData( const Property::Map& propertyMap );
+ void SetupGradientAnimationData(const Property::Map& propertyMap);
/**
* @brief Create new shader
Shader CreateShader();
// Undefined
- AnimatedGradientVisual( const AnimatedGradientVisual& gradientRenderer );
+ AnimatedGradientVisual(const AnimatedGradientVisual& gradientRenderer);
// Undefined
- AnimatedGradientVisual& operator=( const AnimatedGradientVisual& gradientRenderer );
+ AnimatedGradientVisual& operator=(const AnimatedGradientVisual& gradientRenderer);
private:
GradientAnimationDataList mGradientAnimationDataList;
- Property::Map mValueMap;
+ Property::Map mValueMap;
Dali::Toolkit::DevelAnimatedGradientVisual::GradientType::Type mGradientType;
- Dali::Toolkit::DevelAnimatedGradientVisual::UnitType::Type mUnitType;
- Dali::Toolkit::DevelAnimatedGradientVisual::SpreadType::Type mSpreadType;
+ Dali::Toolkit::DevelAnimatedGradientVisual::UnitType::Type mUnitType;
+ Dali::Toolkit::DevelAnimatedGradientVisual::SpreadType::Type mSpreadType;
};
-}//namespace Internal
+} //namespace Internal
-}//namespace Toolkit
+} //namespace Toolkit
-}//namespace Dali
+} //namespace Dali
#endif
*/
// EXTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/animated-image-loading.h>
+#include <dali/public-api/adaptor-framework/timer.h>
#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/common/intrusive-ptr.h>
#include <dali/public-api/math/vector4.h>
#include <dali/public-api/object/weak-handle.h>
-#include <dali/public-api/adaptor-framework/timer.h>
-#include <dali/devel-api/adaptor-framework/animated-image-loading.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/internal/visuals/visual-base-impl.h>
-#include <dali-toolkit/internal/visuals/visual-url.h>
-#include <dali-toolkit/internal/visuals/animated-image/image-cache.h>
#include <dali-toolkit/devel-api/visuals/animated-image-visual-actions-devel.h>
#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
+#include <dali-toolkit/internal/visuals/animated-image/image-cache.h>
+#include <dali-toolkit/internal/visuals/visual-base-impl.h>
+#include <dali-toolkit/internal/visuals/visual-url.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class ImageVisualShaderFactory;
class AnimatedImageVisual;
-typedef IntrusivePtr< AnimatedImageVisual > AnimatedImageVisualPtr;
+typedef IntrusivePtr<AnimatedImageVisual> AnimatedImageVisualPtr;
/**
* The visual which renders an animated image
public ConnectionTracker,
public ImageCache::FrameReadyObserver
{
-
public:
-
/**
* @brief Create the animated image Visual using the image URL.
*
* @param[in] properties A Property::Map containing settings for this visual
* @return A smart-pointer to the newly allocated visual.
*/
- static AnimatedImageVisualPtr New( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl, const Property::Map& properties );
+ static AnimatedImageVisualPtr New(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl, const Property::Map& properties);
/**
* @brief Create the animated image Visual using image URLs.
* @param[in] properties A Property::Map containing settings for this visual
* @return A smart-pointer to the newly allocated visual.
*/
- static AnimatedImageVisualPtr New( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const Property::Array& imageUrls, const Property::Map& properties );
+ static AnimatedImageVisualPtr New(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const Property::Array& imageUrls, const Property::Map& properties);
/**
* @brief Create the animated image visual using the image URL.
* @param[in] shaderFactory The ImageVisualShaderFactory object
* @param[in] imageUrl The URL to animated image resource to use
*/
- static AnimatedImageVisualPtr New( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl );
-
-public: // from Visual
+ static AnimatedImageVisualPtr New(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl);
+public: // from Visual
/**
* @copydoc Visual::Base::GetNaturalSize
*/
- void GetNaturalSize( Vector2& naturalSize ) override;
+ void GetNaturalSize(Vector2& naturalSize) override;
/**
* @copydoc Visual::Base::CreatePropertyMap
*/
- void DoCreatePropertyMap( Property::Map& map ) const override;
+ void DoCreatePropertyMap(Property::Map& map) const override;
/**
* @copydoc Visual::Base::CreateInstancePropertyMap
*/
- void DoCreateInstancePropertyMap( Property::Map& map ) const override;
+ void DoCreateInstancePropertyMap(Property::Map& map) const override;
/**
* @copydoc Visual::Base::OnDoAction
*/
- void OnDoAction( const Dali::Property::Index actionName, const Dali::Property::Value& attributes ) override;
+ void OnDoAction(const Dali::Property::Index actionName, const Dali::Property::Value& attributes) override;
protected:
-
/**
* @brief Constructor.
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
* @param[in] shaderFactory The ImageVisualShaderFactory object
*/
- AnimatedImageVisual( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory );
+ AnimatedImageVisual(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory);
/**
* @brief A reference counted object may only be deleted by calling Unreference().
/**
* @copydoc Visual::Base::DoSetProperties
*/
- void DoSetProperties( const Property::Map& propertyMap ) override;
+ void DoSetProperties(const Property::Map& propertyMap) override;
/**
* Helper method to set individual values by index key.
* @param[in] index The index key of the value
* @param[in] value The value
*/
- void DoSetProperty( Property::Index index, const Property::Value& value );
+ void DoSetProperty(Property::Index index, const Property::Value& value);
/**
* @copydoc Visual::Base::DoSetOnScene
*/
- void DoSetOnScene( Actor& actor ) override;
+ void DoSetOnScene(Actor& actor) override;
/**
* @copydoc Visual::Base::DoSetOffScene
*/
- void DoSetOffScene( Actor& actor ) override;
+ void DoSetOffScene(Actor& actor) override;
/**
* @copydoc Visual::Base::OnSetTransform
* placement actor, and starts the frame timer
* @param[in] textureSet The texture set to apply
*/
- void StartFirstFrame( TextureSet& textureSet );
+ void StartFirstFrame(TextureSet& textureSet);
/**
* Prepares the texture set for displaying
* Set the image size from the texture set
* @param[in] textureSet The texture set to get the size from
*/
- void SetImageSize( TextureSet& textureSet );
+ void SetImageSize(TextureSet& textureSet);
/**
* Called when the next frame is ready.
* @param[in] textureSet the texture set to apply
*/
- void FrameReady( TextureSet textureSet ) override;
+ void FrameReady(TextureSet textureSet) override;
/**
* Display the next frame. It is called when the mFrameDelayTimer ticks.
* Initialize the animated image variables.
* @param[in] imageUrl The url of the animated image
*/
- void InitializeAnimatedImage( const VisualUrl& imageUrl );
+ void InitializeAnimatedImage(const VisualUrl& imageUrl);
// Undefined
- AnimatedImageVisual( const AnimatedImageVisual& animatedImageVisual );
+ AnimatedImageVisual(const AnimatedImageVisual& animatedImageVisual);
// Undefined
- AnimatedImageVisual& operator=( const AnimatedImageVisual& animatedImageVisual );
+ AnimatedImageVisual& operator=(const AnimatedImageVisual& animatedImageVisual);
private:
-
- Timer mFrameDelayTimer;
- WeakHandle<Actor> mPlacementActor;
+ Timer mFrameDelayTimer;
+ WeakHandle<Actor> mPlacementActor;
ImageVisualShaderFactory& mImageVisualShaderFactory;
// Variables for Animated Image player
- Vector4 mPixelArea;
- VisualUrl mImageUrl;
+ Vector4 mPixelArea;
+ VisualUrl mImageUrl;
Dali::AnimatedImageLoading mAnimatedImageLoading; // Only needed for animated image
- uint32_t mFrameIndexForJumpTo; // Frame index into textureRects
+ uint32_t mFrameIndexForJumpTo; // Frame index into textureRects
// Variables for Multi-Image player
ImageCache::UrlList* mImageUrls;
- ImageCache* mImageCache;
- uint16_t mCacheSize;
- uint16_t mBatchSize;
- uint16_t mFrameDelay;
- int16_t mLoopCount;
- int16_t mCurrentLoopIndex;
- uint16_t mUrlIndex;
+ ImageCache* mImageCache;
+ uint16_t mCacheSize;
+ uint16_t mBatchSize;
+ uint16_t mFrameDelay;
+ int16_t mLoopCount;
+ int16_t mCurrentLoopIndex;
+ uint16_t mUrlIndex;
// Shared variables
- uint32_t mFrameCount; // Number of frames
+ uint32_t mFrameCount; // Number of frames
ImageDimensions mImageSize;
- Dali::WrapMode::Type mWrapModeU:3;
- Dali::WrapMode::Type mWrapModeV:3;
- DevelAnimatedImageVisual::Action::Type mActionStatus:3;
- DevelImageVisual::StopBehavior::Type mStopBehavior:2;
- bool mStartFirstFrame:1;
- bool mIsJumpTo:1;
+ Dali::WrapMode::Type mWrapModeU : 3;
+ Dali::WrapMode::Type mWrapModeV : 3;
+ DevelAnimatedImageVisual::Action::Type mActionStatus : 3;
+ DevelImageVisual::StopBehavior::Type mStopBehavior : 2;
+ bool mStartFirstFrame : 1;
+ bool mIsJumpTo : 1;
};
} // namespace Internal
#define DALI_TOOLKIT_INTERNAL_FIXED_IMAGE_CACHE_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
{
namespace Internal
{
-
class FixedImageCache : public ImageCache, public TextureUploadObserver
{
public:
* This will start loading textures immediately, according to the
* batch and cache sizes. The cache is as large as the number of urls.
*/
- FixedImageCache( TextureManager& textureManager,
- UrlList& urlList,
- ImageCache::FrameReadyObserver& observer,
- unsigned int batchSize );
+ FixedImageCache(TextureManager& textureManager,
+ UrlList& urlList,
+ ImageCache::FrameReadyObserver& observer,
+ unsigned int batchSize);
~FixedImageCache() override;
* Get the Nth frame. If it's not ready, this will trigger the
* sending of FrameReady() when the image becomes ready.
*/
- TextureSet Frame( uint32_t frameIndex ) override;
+ TextureSet Frame(uint32_t frameIndex) override;
/**
* Get the first frame. If it's not ready, this will trigger the
/**
* Get the interval of Nth frame.
*/
- uint32_t GetFrameInterval( uint32_t frameIndex ) const override;
+ uint32_t GetFrameInterval(uint32_t frameIndex) const override;
/**
* Get the current rendered frame index.
/**
* Find the matching image frame, and set it to ready
*/
- void SetImageFrameReady( TextureManager::TextureId textureId );
+ void SetImageFrameReady(TextureManager::TextureId textureId);
/**
* Get the texture set of the front frame.
* Check if the front frame has become ready - if so, inform observer
* @param[in] wasReady Readiness before call.
*/
- void CheckFrontFrame( bool wasReady );
+ void CheckFrontFrame(bool wasReady);
protected:
void UploadComplete(
TextureSet textureSet,
bool useAtlasing,
const Vector4& atlasRect,
- bool premultiplied ) override;
+ bool premultiplied) override;
void LoadComplete(
- bool loadSuccess,
+ bool loadSuccess,
Devel::PixelBuffer pixelBuffer,
- const VisualUrl& url,
- bool preMultiplied ) override;
+ const VisualUrl& url,
+ bool preMultiplied) override;
private:
std::vector<UrlStore>& mImageUrls;
- std::vector<bool> mReadyFlags;
- unsigned int mFront;
+ std::vector<bool> mReadyFlags;
+ unsigned int mFront;
};
} //namespace Internal
#define DALI_TOOLKIT_INTERNAL_IMAGE_CACHE_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <dali-toolkit/internal/visuals/texture-upload-observer.h>
#include <dali-toolkit/internal/visuals/texture-manager-impl.h>
+#include <dali-toolkit/internal/visuals/texture-upload-observer.h>
namespace Dali
{
{
namespace Internal
{
-
class ImageCache : public TextureManager::LifecycleObserver
{
public:
* Informs observer when the next texture set is ready to display
* @param[in] textureSet The ready texture set
*/
- virtual void FrameReady( TextureSet textureSet ) = 0;
+ virtual void FrameReady(TextureSet textureSet) = 0;
};
struct UrlStore
{
TextureManager::TextureId mTextureId = TextureManager::INVALID_TEXTURE_ID;
- std::string mUrl;
+ std::string mUrl;
};
/**
* This will start loading textures immediately, according to the
* batch and cache sizes. The cache is as large as the number of urls.
*/
- ImageCache( TextureManager& textureManager,
- ImageCache::FrameReadyObserver& observer,
- unsigned int batchSize );
+ ImageCache(TextureManager& textureManager,
+ ImageCache::FrameReadyObserver& observer,
+ unsigned int batchSize);
virtual ~ImageCache();
* Get the Nth frame. If it's not ready, this will trigger the
* sending of FrameReady() when the image becomes ready.
*/
- virtual TextureSet Frame( uint32_t frameIndex ) = 0;
+ virtual TextureSet Frame(uint32_t frameIndex) = 0;
/**
* Get the interval of Nth frame.
*/
- virtual uint32_t GetFrameInterval( uint32_t frameIndex ) const = 0;
+ virtual uint32_t GetFrameInterval(uint32_t frameIndex) const = 0;
/**
* Get the current rendered frame index.
virtual int32_t GetTotalFrameCount() const = 0;
private:
-
/**
* Called before the texture manager is destroyed.
*/
void TextureManagerDestroyed() final;
protected:
- TextureManager& mTextureManager;
- FrameReadyObserver& mObserver;
- unsigned int mBatchSize;
- unsigned int mUrlIndex;
- bool mWaitingForReadyFrame:1;
- bool mRequestingLoad:1;
- bool mTextureManagerAlive:1;
+ TextureManager& mTextureManager;
+ FrameReadyObserver& mObserver;
+ unsigned int mBatchSize;
+ unsigned int mUrlIndex;
+ bool mWaitingForReadyFrame : 1;
+ bool mRequestingLoad : 1;
+ bool mTextureManagerAlive : 1;
};
} //namespace Internal
#define DALI_TOOLKIT_INTERNAL_ROLLING_ANIMATED_IMAGE_CACHE_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/animated-image-loading.h>
-#include <dali/devel-api/common/circular-queue.h>
#include <dali-toolkit/internal/visuals/animated-image/image-cache.h>
#include <dali-toolkit/internal/visuals/texture-manager-impl.h>
+#include <dali/devel-api/adaptor-framework/animated-image-loading.h>
+#include <dali/devel-api/common/circular-queue.h>
namespace Dali
{
{
namespace Internal
{
-
/**
* Class to manage a rolling cache of Animated images, where the cache size
* is smaller than the total number of images.
* This will start loading textures immediately, according to the
* batch and cache sizes.
*/
- RollingAnimatedImageCache( TextureManager& textureManager,
- AnimatedImageLoading& animatedImageLoader,
- uint32_t frameCount,
- ImageCache::FrameReadyObserver& observer,
- uint16_t cacheSize,
- uint16_t batchSize,
- bool isSynchronousLoading );
+ RollingAnimatedImageCache(TextureManager& textureManager,
+ AnimatedImageLoading& animatedImageLoader,
+ uint32_t frameCount,
+ ImageCache::FrameReadyObserver& observer,
+ uint16_t cacheSize,
+ uint16_t batchSize,
+ bool isSynchronousLoading);
/**
* Destructor
* Get the Nth frame. If it's not ready, this will trigger the
* sending of FrameReady() when the image becomes ready.
*/
- TextureSet Frame( uint32_t frameIndex ) override;
+ TextureSet Frame(uint32_t frameIndex) override;
/**
* Get the first frame. If it's not ready, this will trigger the
/**
* Get the interval of Nth frame.
*/
- uint32_t GetFrameInterval( uint32_t frameIndex ) const override;
+ uint32_t GetFrameInterval(uint32_t frameIndex) const override;
/**
* Get the current rendered frame index.
/**
* Request to Load a frame
*/
- void RequestFrameLoading( uint32_t frameIndex );
+ void RequestFrameLoading(uint32_t frameIndex);
/**
* Load the next batch of images
/**
* Find the matching image frame, and set it to ready
*/
- void SetImageFrameReady( TextureManager::TextureId textureId );
+ void SetImageFrameReady(TextureManager::TextureId textureId);
/**
* Get the texture set of the front frame.
/**
* Get the texture id of the given index
*/
- TextureManager::TextureId GetCachedTextureId( int index ) const;
+ TextureManager::TextureId GetCachedTextureId(int index) const;
/**
* Check if the front frame has become ready - if so, inform observer
* @param[in] wasReady Readiness before call.
*/
- void CheckFrontFrame( bool wasReady );
+ void CheckFrontFrame(bool wasReady);
protected:
void UploadComplete(
TextureSet textureSet,
bool useAtlasing,
const Vector4& atlasRect,
- bool preMultiplied ) override;
+ bool preMultiplied) override;
void LoadComplete(
- bool loadSuccess,
+ bool loadSuccess,
Devel::PixelBuffer pixelBuffer,
- const VisualUrl& url,
- bool preMultiplied ) override;
+ const VisualUrl& url,
+ bool preMultiplied) override;
private:
/**
struct ImageFrame
{
unsigned int mFrameNumber = 0u;
- bool mReady = false;
+ bool mReady = false;
};
- Dali::AnimatedImageLoading mAnimatedImageLoading;
- uint32_t mFrameCount;
- int mFrameIndex;
- int mCacheSize;
- std::vector<UrlStore> mImageUrls;
- std::vector<int32_t> mIntervals;
- std::vector<uint32_t> mLoadWaitingQueue;
- CircularQueue<ImageFrame> mQueue;
- bool mIsSynchronousLoading;
- bool mOnLoading;
+ Dali::AnimatedImageLoading mAnimatedImageLoading;
+ uint32_t mFrameCount;
+ int mFrameIndex;
+ int mCacheSize;
+ std::vector<UrlStore> mImageUrls;
+ std::vector<int32_t> mIntervals;
+ std::vector<uint32_t> mLoadWaitingQueue;
+ CircularQueue<ImageFrame> mQueue;
+ bool mIsSynchronousLoading;
+ bool mOnLoading;
};
} // namespace Internal
#define DALI_TOOLKIT_INTERNAL_ROLLING_IMAGE_CACHE_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// EXTERNAL INCLUDES
-#include <dali/devel-api/common/circular-queue.h>
#include <dali-toolkit/internal/visuals/animated-image/image-cache.h>
#include <dali-toolkit/internal/visuals/texture-manager-impl.h>
+#include <dali/devel-api/common/circular-queue.h>
namespace Dali
{
{
namespace Internal
{
-
/**
* Class to manage a rolling cache of images, where the cache size
* is smaller than the total number of images.
* This will start loading textures immediately, according to the
* batch and cache sizes.
*/
- RollingImageCache( TextureManager& textureManager,
- UrlList& urlList,
- ImageCache::FrameReadyObserver& observer,
- uint16_t cacheSize,
- uint16_t batchSize );
+ RollingImageCache(TextureManager& textureManager,
+ UrlList& urlList,
+ ImageCache::FrameReadyObserver& observer,
+ uint16_t cacheSize,
+ uint16_t batchSize);
/**
* Destructor
* Get the Nth frame. If it's not ready, this will trigger the
* sending of FrameReady() when the image becomes ready.
*/
- TextureSet Frame( uint32_t frameIndex ) override;
+ TextureSet Frame(uint32_t frameIndex) override;
/**
* Get the first frame. If it's not ready, this will trigger the
/**
* Get the interval of Nth frame.
*/
- uint32_t GetFrameInterval( uint32_t frameIndex ) const override;
+ uint32_t GetFrameInterval(uint32_t frameIndex) const override;
/**
* Get the current rendered frame index.
/**
* Find the matching image frame, and set it to ready
*/
- void SetImageFrameReady( TextureManager::TextureId textureId );
+ void SetImageFrameReady(TextureManager::TextureId textureId);
/**
* Get the texture set of the front frame.
/**
* Get the texture id of the given index
*/
- TextureManager::TextureId GetCachedTextureId( int index ) const;
+ TextureManager::TextureId GetCachedTextureId(int index) const;
/**
* Check if the front frame has become ready - if so, inform observer
* @param[in] wasReady Readiness before call.
*/
- void CheckFrontFrame( bool wasReady );
+ void CheckFrontFrame(bool wasReady);
protected:
void UploadComplete(
TextureSet textureSet,
bool useAtlasing,
const Vector4& atlasRect,
- bool preMultiplied ) override;
+ bool preMultiplied) override;
void LoadComplete(
- bool loadSuccess,
+ bool loadSuccess,
Devel::PixelBuffer pixelBuffer,
- const VisualUrl& url,
- bool preMultiplied ) override;
+ const VisualUrl& url,
+ bool preMultiplied) override;
private:
/**
struct ImageFrame
{
unsigned int mUrlIndex = 0u;
- bool mReady = false;
+ bool mReady = false;
};
- std::vector<UrlStore>& mImageUrls;
+ std::vector<UrlStore>& mImageUrls;
CircularQueue<ImageFrame> mQueue;
};
*/
// EXTERNAL INCLUDES
+#include <dali/devel-api/actors/actor-devel.h>
+#include <dali/public-api/adaptor-framework/window.h>
#include <dali/public-api/common/intrusive-ptr.h>
-#include <dali/public-api/object/weak-handle.h>
#include <dali/public-api/object/property-notification.h>
-#include <dali/public-api/adaptor-framework/window.h>
-#include <dali/devel-api/actors/actor-devel.h>
+#include <dali/public-api/object/weak-handle.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/internal/visuals/visual-base-impl.h>
-#include <dali-toolkit/internal/visuals/visual-url.h>
#include <dali-toolkit/devel-api/visuals/animated-vector-image-visual-actions-devel.h>
-#include <dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.h>
#include <dali-toolkit/internal/visuals/animated-vector-image/vector-animation-manager.h>
+#include <dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.h>
+#include <dali-toolkit/internal/visuals/visual-base-impl.h>
+#include <dali-toolkit/internal/visuals/visual-url.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class ImageVisualShaderFactory;
class AnimatedVectorImageVisual;
-using AnimatedVectorImageVisualPtr = IntrusivePtr< AnimatedVectorImageVisual >;
+using AnimatedVectorImageVisualPtr = IntrusivePtr<AnimatedVectorImageVisual>;
/**
* The visual which renders an animated vector image using VectorAnimationRenderer.
* | url | STRING |
*
*/
-class AnimatedVectorImageVisual: public Visual::Base, public ConnectionTracker, public VectorAnimationManager::LifecycleObserver
+class AnimatedVectorImageVisual : public Visual::Base, public ConnectionTracker, public VectorAnimationManager::LifecycleObserver
{
public:
-
/**
* @brief Create the AnimatedVectorImageVisual using the image URL.
*
* @param[in] properties A Property::Map containing settings for this visual
* @return A smart-pointer to the newly allocated visual.
*/
- static AnimatedVectorImageVisualPtr New( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl, const Property::Map& properties );
+ static AnimatedVectorImageVisualPtr New(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl, const Property::Map& properties);
/**
* @brief Create the AnimatedVectorImageVisual using the image URL.
* @param[in] imageUrl The URL to an animated vector image to use
* @return A smart-pointer to the newly allocated visual.
*/
- static AnimatedVectorImageVisualPtr New( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl );
-
-public: // from Visual
+ static AnimatedVectorImageVisualPtr New(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl);
+public: // from Visual
/**
* @copydoc Visual::Base::GetNaturalSize
*/
- void GetNaturalSize( Vector2& naturalSize ) override;
+ void GetNaturalSize(Vector2& naturalSize) override;
/**
* @copydoc Visual::Base::CreatePropertyMap
*/
- void DoCreatePropertyMap( Property::Map& map ) const override;
+ void DoCreatePropertyMap(Property::Map& map) const override;
/**
* @copydoc Visual::Base::CreateInstancePropertyMap
*/
- void DoCreateInstancePropertyMap( Property::Map& map ) const override;
+ void DoCreateInstancePropertyMap(Property::Map& map) const override;
protected: // From VectorAnimationManager::LifecycleObserver:
/**
void VectorAnimationManagerDestroyed() override;
protected:
-
/**
* @brief Constructor.
*
* @param[in] shaderFactory The ImageVisualShaderFactory object
* @param[in] imageUrl The URL to an animated vector image to use
*/
- AnimatedVectorImageVisual( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl );
+ AnimatedVectorImageVisual(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl);
/**
* @brief A reference counted object may only be deleted by calling Unreference().
/**
* @copydoc Visual::Base::DoSetProperties
*/
- void DoSetProperties( const Property::Map& propertyMap ) override;
+ void DoSetProperties(const Property::Map& propertyMap) override;
/**
* @copydoc Visual::Base::DoSetOnScene
*/
- void DoSetOnScene( Actor& actor ) override;
+ void DoSetOnScene(Actor& actor) override;
/**
* @copydoc Visual::Base::DoSetOffScene
*/
- void DoSetOffScene( Actor& actor ) override;
+ void DoSetOffScene(Actor& actor) override;
/**
* @copydoc Visual::Base::OnSetTransform
/**
* @copydoc Visual::Base::OnDoAction
*/
- void OnDoAction( const Property::Index actionId, const Property::Value& attributes ) override;
+ void OnDoAction(const Property::Index actionId, const Property::Value& attributes) override;
private:
-
/**
* Helper method to set individual values by index key.
* @param[in] index The index key of the value
* @param[in] value The value
*/
- void DoSetProperty( Property::Index index, const Property::Value& value );
+ void DoSetProperty(Property::Index index, const Property::Value& value);
/**
* @brief Called when the texture upload is completed.
/**
* @brief Callback when the world scale factor changes.
*/
- void OnScaleNotification( PropertyNotification& source );
+ void OnScaleNotification(PropertyNotification& source);
/**
* @brief Callback when the size changes.
*/
- void OnSizeNotification( PropertyNotification& source );
+ void OnSizeNotification(PropertyNotification& source);
/**
* @brief Callback when the visibility of the actor is changed.
*/
- void OnControlVisibilityChanged( Actor actor, bool visible, DevelActor::VisibilityChange::Type type );
+ void OnControlVisibilityChanged(Actor actor, bool visible, DevelActor::VisibilityChange::Type type);
/**
* @brief Callback when the visibility of the window is changed.
*/
- void OnWindowVisibilityChanged( Window window, bool visible );
+ void OnWindowVisibilityChanged(Window window, bool visible);
/**
* @brief Callback when the event is processed.
void OnProcessEvents();
// Undefined
- AnimatedVectorImageVisual( const AnimatedVectorImageVisual& visual ) = delete;
+ AnimatedVectorImageVisual(const AnimatedVectorImageVisual& visual) = delete;
// Undefined
- AnimatedVectorImageVisual& operator=( const AnimatedVectorImageVisual& visual ) = delete;
+ AnimatedVectorImageVisual& operator=(const AnimatedVectorImageVisual& visual) = delete;
private:
- VisualUrl mUrl;
- VectorAnimationTask::AnimationData mAnimationData;
- VectorAnimationTaskPtr mVectorAnimationTask;
- ImageVisualShaderFactory& mImageVisualShaderFactory;
- PropertyNotification mScaleNotification;
- PropertyNotification mSizeNotification;
- Vector2 mVisualSize;
- Vector2 mVisualScale;
- WeakHandle< Actor > mPlacementActor;
- DevelImageVisual::PlayState::Type mPlayState;
- CallbackBase* mEventCallback; // Not owned
- bool mRendererAdded;
- bool mCoreShutdown;
- bool mRedrawInScalingDown;
+ VisualUrl mUrl;
+ VectorAnimationTask::AnimationData mAnimationData;
+ VectorAnimationTaskPtr mVectorAnimationTask;
+ ImageVisualShaderFactory& mImageVisualShaderFactory;
+ PropertyNotification mScaleNotification;
+ PropertyNotification mSizeNotification;
+ Vector2 mVisualSize;
+ Vector2 mVisualScale;
+ WeakHandle<Actor> mPlacementActor;
+ DevelImageVisual::PlayState::Type mPlayState;
+ CallbackBase* mEventCallback; // Not owned
+ bool mRendererAdded;
+ bool mCoreShutdown;
+ bool mRedrawInScalingDown;
};
} // namespace Internal
#define DALI_TOOLKIT_INTERNAL_VECTOR_ANIMATION_MANAGER_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/signals/callback.h>
-#include <dali/public-api/common/vector-wrapper.h>
#include <dali/integration-api/processor-interface.h>
+#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/public-api/signals/callback.h>
#include <memory>
// INTERNAL INCLUDES
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class VectorAnimationThread;
/**
* @brief Vector animation manager
*/
-class VectorAnimationManager: public Integration::Processor
+class VectorAnimationManager : public Integration::Processor
{
public:
struct LifecycleObserver
* Add a lifecycle observer
* @param[in] observer The object watching this one
*/
- void AddObserver( LifecycleObserver& observer );
+ void AddObserver(LifecycleObserver& observer);
/**
* Remove a lifecycle observer
* @param[in] observer The object watching this one
*/
- void RemoveObserver( LifecycleObserver& observer );
+ void RemoveObserver(LifecycleObserver& observer);
/**
* Get the vector animation thread.
* @param callback The callback to register
* @note Ownership of the callback is passed onto this class.
*/
- void RegisterEventCallback( CallbackBase* callback );
+ void RegisterEventCallback(CallbackBase* callback);
/**
* @brief Unregister a previously registered callback
*
* @param callback The callback to unregister
*/
- void UnregisterEventCallback( CallbackBase* callback );
+ void UnregisterEventCallback(CallbackBase* callback);
protected: // Implementation of Processor
-
/**
* @copydoc Dali::Integration::Processor::Process()
*/
void Process() override;
private:
-
// Undefined
- VectorAnimationManager( const VectorAnimationManager& manager ) = delete;
+ VectorAnimationManager(const VectorAnimationManager& manager) = delete;
// Undefined
- VectorAnimationManager& operator=( const VectorAnimationManager& manager ) = delete;
+ VectorAnimationManager& operator=(const VectorAnimationManager& manager) = delete;
private:
-
- std::vector< CallbackBase* > mEventCallbacks;
- std::vector<LifecycleObserver*> mLifecycleObservers;
- std::unique_ptr< VectorAnimationThread > mVectorAnimationThread;
- bool mProcessorRegistered;
+ std::vector<CallbackBase*> mEventCallbacks;
+ std::vector<LifecycleObserver*> mLifecycleObservers;
+ std::unique_ptr<VectorAnimationThread> mVectorAnimationThread;
+ bool mProcessorRegistered;
};
} // namespace Internal
#define DALI_TOOLKIT_VECTOR_ANIMATION_TASK_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/object/property-array.h>
#include <dali/devel-api/adaptor-framework/event-thread-callback.h>
#include <dali/devel-api/adaptor-framework/vector-animation-renderer.h>
#include <dali/devel-api/threading/conditional-wait.h>
-#include <memory>
+#include <dali/public-api/object/property-array.h>
#include <chrono>
+#include <memory>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class VisualFactoryCache;
class VectorAnimationThread;
class VectorAnimationTask;
-typedef IntrusivePtr< VectorAnimationTask > VectorAnimationTaskPtr;
+typedef IntrusivePtr<VectorAnimationTask> VectorAnimationTaskPtr;
/**
* The task of the vector animation.
class VectorAnimationTask : public RefObject
{
public:
-
using UploadCompletedSignalType = Dali::VectorAnimationRenderer::UploadCompletedSignalType;
/**
struct AnimationData
{
AnimationData()
- : resendFlag( 0 ),
+ : resendFlag(0),
playRange(),
playState(),
- stopBehavior( DevelImageVisual::StopBehavior::CURRENT_FRAME ),
- loopingMode( DevelImageVisual::LoopingMode::RESTART ),
- currentFrame( 0 ),
- width( 0 ),
- height( 0 ),
- loopCount( -1 )
+ stopBehavior(DevelImageVisual::StopBehavior::CURRENT_FRAME),
+ loopingMode(DevelImageVisual::LoopingMode::RESTART),
+ currentFrame(0),
+ width(0),
+ height(0),
+ loopCount(-1)
{
}
- AnimationData& operator= ( const AnimationData& rhs )
+ AnimationData& operator=(const AnimationData& rhs)
{
resendFlag |= rhs.resendFlag; // OR resend flag
- playRange = rhs.playRange;
- playState = rhs.playState;
+ playRange = rhs.playRange;
+ playState = rhs.playState;
stopBehavior = rhs.stopBehavior;
- loopingMode = rhs.loopingMode;
+ loopingMode = rhs.loopingMode;
currentFrame = rhs.currentFrame;
- width = rhs.width;
- height = rhs.height;
- loopCount = rhs.loopCount;
+ width = rhs.width;
+ height = rhs.height;
+ loopCount = rhs.loopCount;
return *this;
}
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
* @param[in] url The url of the vector animation file
*/
- VectorAnimationTask( VisualFactoryCache& factoryCache, const std::string& url );
+ VectorAnimationTask(VisualFactoryCache& factoryCache, const std::string& url);
/**
* @brief Destructor.
*
* @param[in] renderer The renderer used to display the result image
*/
- void SetRenderer( Renderer renderer );
+ void SetRenderer(Renderer renderer);
/**
* @brief Sets data to specify animation playback.
* @param[in] data The animation data
*/
- void SetAnimationData( const AnimationData& data );
+ void SetAnimationData(const AnimationData& data);
/**
* @brief This callback is called after the animation is finished.
* @param[in] callback The animation finished callback
*/
- void SetAnimationFinishedCallback( EventThreadCallback* callback );
+ void SetAnimationFinishedCallback(EventThreadCallback* callback);
/**
* @brief Gets the playing range in frame number.
* @param[out] startFrame The frame number to specify minimum progress.
* @param[out] endFrame The frame number to specify maximum progress.
*/
- void GetPlayRange( uint32_t& startFrame, uint32_t& endFrame );
+ void GetPlayRange(uint32_t& startFrame, uint32_t& endFrame);
/**
* @brief Retrieves the current frame number of the animation.
* @brief Gets the default size of the file,.
* @return The default size of the file
*/
- void GetDefaultSize( uint32_t& width, uint32_t& height ) const;
+ void GetDefaultSize(uint32_t& width, uint32_t& height) const;
/**
* @brief Gets the layer information of all the child layers.
* @param[out] map The layer information
*/
- void GetLayerInfo( Property::Map& map ) const;
+ void GetLayerInfo(Property::Map& map) const;
/**
* @brief Connect to this signal to be notified when the texture upload is completed.
* @brief Calculates the time for the next frame rasterization.
* @return The time for the next frame rasterization.
*/
- std::chrono::time_point< std::chrono::system_clock > CalculateNextFrameTime( bool renderNow );
+ std::chrono::time_point<std::chrono::system_clock> CalculateNextFrameTime(bool renderNow);
/**
* @brief Gets the time for the next frame rasterization.
* @return The time for the next frame rasterization.
*/
- std::chrono::time_point< std::chrono::system_clock > GetNextFrameTime();
+ std::chrono::time_point<std::chrono::system_clock> GetNextFrameTime();
private:
-
/**
* @brief Initializes the vector renderer.
*/
* @param[in] width The target image width
* @param[in] height The target image height
*/
- void SetSize( uint32_t width, uint32_t height );
+ void SetSize(uint32_t width, uint32_t height);
/**
* @brief Enable looping for 'count' repeats. -1 means to repeat forever.
* @param[in] count The number of times to loop
*/
- void SetLoopCount( int32_t count );
+ void SetLoopCount(int32_t count);
/**
* @brief Set the playing range in frame number.
* @param[in] playRange The array to specify minimum and maximum progress.
* The animation will play between those values.
*/
- void SetPlayRange( const Property::Array& playRange );
+ void SetPlayRange(const Property::Array& playRange);
/**
* @brief Sets the current frame number of the animation.
* @param[in] frameNumber The new frame number between [0, the maximum frame number] or between the play range if specified.
*/
- void SetCurrentFrameNumber( uint32_t frameNumber );
+ void SetCurrentFrameNumber(uint32_t frameNumber);
/**
* @brief Sets the stop behavior of the animation. This is performed when the animation is stopped.
* @param[in] stopBehavior The stop behavior
*/
- void SetStopBehavior( DevelImageVisual::StopBehavior::Type stopBehavior );
+ void SetStopBehavior(DevelImageVisual::StopBehavior::Type stopBehavior);
/**
* @brief Sets the looping mode.
* Animation plays forwards and then restarts from the beginning or runs backwards again.
* @param[in] loopingMode The looping mode
*/
- void SetLoopingMode( DevelImageVisual::LoopingMode::Type loopingMode );
+ void SetLoopingMode(DevelImageVisual::LoopingMode::Type loopingMode);
/**
* @brief Gets the frame number when the animation is stopped according to the stop behavior.
*/
- uint32_t GetStoppedFrame( uint32_t startFrame, uint32_t endFrame, uint32_t currentFrame );
+ uint32_t GetStoppedFrame(uint32_t startFrame, uint32_t endFrame, uint32_t currentFrame);
/**
* @brief Applies the animation data set by the main thread.
void ApplyAnimationData();
// Undefined
- VectorAnimationTask( const VectorAnimationTask& task ) = delete;
+ VectorAnimationTask(const VectorAnimationTask& task) = delete;
// Undefined
- VectorAnimationTask& operator=( const VectorAnimationTask& task ) = delete;
+ VectorAnimationTask& operator=(const VectorAnimationTask& task) = delete;
private:
-
enum class PlayState
{
- STOPPING, ///< The animation is stopping
- STOPPED, ///< The animation has stopped
- PLAYING, ///< The animation is playing
- PAUSED ///< The animation is paused
+ STOPPING, ///< The animation is stopping
+ STOPPED, ///< The animation has stopped
+ PLAYING, ///< The animation is playing
+ PAUSED ///< The animation is paused
};
- std::string mUrl;
- VectorAnimationRenderer mVectorRenderer;
- AnimationData mAnimationData[2];
- VectorAnimationThread& mVectorAnimationThread;
- ConditionalWait mConditionalWait;
- std::unique_ptr< EventThreadCallback > mAnimationFinishedTrigger;
- PlayState mPlayState;
- DevelImageVisual::StopBehavior::Type mStopBehavior;
- DevelImageVisual::LoopingMode::Type mLoopingMode;
- std::chrono::time_point< std::chrono::system_clock > mNextFrameStartTime;
- int64_t mFrameDurationNanoSeconds;
- float mFrameRate;
- uint32_t mCurrentFrame;
- uint32_t mTotalFrame;
- uint32_t mStartFrame;
- uint32_t mEndFrame;
- uint32_t mWidth;
- uint32_t mHeight;
- uint32_t mAnimationDataIndex;
- int32_t mLoopCount;
- int32_t mCurrentLoop;
- bool mForward;
- bool mUpdateFrameNumber;
- bool mNeedAnimationFinishedTrigger;
- bool mAnimationDataUpdated;
- bool mDestroyTask;
+ std::string mUrl;
+ VectorAnimationRenderer mVectorRenderer;
+ AnimationData mAnimationData[2];
+ VectorAnimationThread& mVectorAnimationThread;
+ ConditionalWait mConditionalWait;
+ std::unique_ptr<EventThreadCallback> mAnimationFinishedTrigger;
+ PlayState mPlayState;
+ DevelImageVisual::StopBehavior::Type mStopBehavior;
+ DevelImageVisual::LoopingMode::Type mLoopingMode;
+ std::chrono::time_point<std::chrono::system_clock> mNextFrameStartTime;
+ int64_t mFrameDurationNanoSeconds;
+ float mFrameRate;
+ uint32_t mCurrentFrame;
+ uint32_t mTotalFrame;
+ uint32_t mStartFrame;
+ uint32_t mEndFrame;
+ uint32_t mWidth;
+ uint32_t mHeight;
+ uint32_t mAnimationDataIndex;
+ int32_t mLoopCount;
+ int32_t mCurrentLoop;
+ bool mForward;
+ bool mUpdateFrameNumber;
+ bool mNeedAnimationFinishedTrigger;
+ bool mAnimationDataUpdated;
+ bool mDestroyTask;
};
} // namespace Internal
#define DALI_TOOLKIT_VECTOR_ANIMATION_THREAD_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <memory>
-#include <dali/public-api/signals/connection-tracker.h>
#include <dali/devel-api/threading/conditional-wait.h>
#include <dali/devel-api/threading/thread.h>
#include <dali/integration-api/adaptor-framework/log-factory-interface.h>
+#include <dali/public-api/signals/connection-tracker.h>
+#include <memory>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/helpers/round-robin-container-view.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/**
* The main animation thread for vector animations
*/
class VectorAnimationThread : public Thread
{
public:
-
/**
* @brief Constructor.
*/
*
* @param[in] task The task added to the thread.
*/
- void AddTask( VectorAnimationTaskPtr task );
+ void AddTask(VectorAnimationTaskPtr task);
/**
* @brief Called when the rasterization is completed from the rasterize thread.
* @param task The completed task
*/
- void OnTaskCompleted( VectorAnimationTaskPtr task, bool stopped );
+ void OnTaskCompleted(VectorAnimationTaskPtr task, bool stopped);
/**
* @brief Called when the sleep thread is awaken.
void OnAwakeFromSleep();
protected:
-
/**
* @brief The entry function of the animation thread.
*/
void Run() override;
private:
-
/**
* Rasterizes the tasks.
*/
void Rasterize();
private:
-
/**
* @brief Helper class to keep the relation between VectorRasterizeThread and corresponding container
*/
*
* @param[in] animationThread Reference to the VectorAnimationThread
*/
- RasterizeHelper( VectorAnimationThread& animationThread );
+ RasterizeHelper(VectorAnimationThread& animationThread);
/**
* @brief Rasterizes the task.
*
* @param[in] task The task to rasterize.
*/
- void Rasterize( VectorAnimationTaskPtr task );
+ void Rasterize(VectorAnimationTaskPtr task);
public:
- RasterizeHelper( const RasterizeHelper& ) = delete;
- RasterizeHelper& operator=( const RasterizeHelper& ) = delete;
+ RasterizeHelper(const RasterizeHelper&) = delete;
+ RasterizeHelper& operator=(const RasterizeHelper&) = delete;
- RasterizeHelper( RasterizeHelper&& rhs );
- RasterizeHelper& operator=( RasterizeHelper&& rhs ) = delete;
+ RasterizeHelper(RasterizeHelper&& rhs);
+ RasterizeHelper& operator=(RasterizeHelper&& rhs) = delete;
private:
-
/**
* @brief Main constructor that used by all other constructors
*/
- RasterizeHelper( std::unique_ptr< VectorRasterizeThread > rasterizer, VectorAnimationThread& animationThread );
+ RasterizeHelper(std::unique_ptr<VectorRasterizeThread> rasterizer, VectorAnimationThread& animationThread);
private:
- std::unique_ptr< VectorRasterizeThread > mRasterizer;
- VectorAnimationThread& mAnimationThread;
+ std::unique_ptr<VectorRasterizeThread> mRasterizer;
+ VectorAnimationThread& mAnimationThread;
};
/**
class SleepThread : public Thread
{
public:
-
/**
* @brief Constructor.
*/
- SleepThread( CallbackBase* callback );
+ SleepThread(CallbackBase* callback);
/**
* @brief Destructor.
/**
* @brief Sleeps untile the specified time point.
*/
- void SleepUntil( std::chrono::time_point< std::chrono::system_clock > timeToSleepUntil );
+ void SleepUntil(std::chrono::time_point<std::chrono::system_clock> timeToSleepUntil);
protected:
-
/**
* @brief The entry function of the animation thread.
*/
void Run() override;
private:
-
- SleepThread( const SleepThread& thread ) = delete;
- SleepThread& operator=( const SleepThread& thread ) = delete;
+ SleepThread(const SleepThread& thread) = delete;
+ SleepThread& operator=(const SleepThread& thread) = delete;
private:
- ConditionalWait mConditionalWait;
- std::unique_ptr< CallbackBase > mAwakeCallback;
- std::chrono::time_point< std::chrono::system_clock > mSleepTimePoint;
- const Dali::LogFactoryInterface& mLogFactory;
- bool mNeedToSleep;
- bool mDestroyThread;
+ ConditionalWait mConditionalWait;
+ std::unique_ptr<CallbackBase> mAwakeCallback;
+ std::chrono::time_point<std::chrono::system_clock> mSleepTimePoint;
+ const Dali::LogFactoryInterface& mLogFactory;
+ bool mNeedToSleep;
+ bool mDestroyThread;
};
private:
-
// Undefined
- VectorAnimationThread( const VectorAnimationThread& thread ) = delete;
+ VectorAnimationThread(const VectorAnimationThread& thread) = delete;
// Undefined
- VectorAnimationThread& operator=( const VectorAnimationThread& thread ) = delete;
+ VectorAnimationThread& operator=(const VectorAnimationThread& thread) = delete;
private:
-
- std::vector< VectorAnimationTaskPtr > mAnimationTasks;
- std::vector< VectorAnimationTaskPtr > mCompletedTasks;
- std::vector< VectorAnimationTaskPtr > mWorkingTasks;
- RoundRobinContainerView< RasterizeHelper > mRasterizers;
- SleepThread mSleepThread;
- ConditionalWait mConditionalWait;
- bool mNeedToSleep;
- bool mDestroyThread;
- const Dali::LogFactoryInterface& mLogFactory;
-
+ std::vector<VectorAnimationTaskPtr> mAnimationTasks;
+ std::vector<VectorAnimationTaskPtr> mCompletedTasks;
+ std::vector<VectorAnimationTaskPtr> mWorkingTasks;
+ RoundRobinContainerView<RasterizeHelper> mRasterizers;
+ SleepThread mSleepThread;
+ ConditionalWait mConditionalWait;
+ bool mNeedToSleep;
+ bool mDestroyThread;
+ const Dali::LogFactoryInterface& mLogFactory;
};
} // namespace Internal
#define DALI_TOOLKIT_VECTOR_IMAGE_RASTERIZE_THREAD_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <vector>
-#include <memory>
#include <dali/devel-api/threading/conditional-wait.h>
#include <dali/devel-api/threading/thread.h>
#include <dali/integration-api/adaptor-framework/log-factory-interface.h>
+#include <memory>
+#include <vector>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/**
* The worker thread for vector image rasterization.
*/
class VectorRasterizeThread : public Thread
{
public:
-
/**
* @brief Constructor.
*/
* The callback is called from the rasterize thread after the rasterization is completed.
* @param[in] callBack The function to call.
*/
- void SetCompletedCallback( CallbackBase* callback );
+ void SetCompletedCallback(CallbackBase* callback);
/**
* Add a task to rasterize.
*
* @param[in] task The task to rasterize
*/
- void AddTask( VectorAnimationTaskPtr task );
+ void AddTask(VectorAnimationTaskPtr task);
protected:
-
/**
* @brief The entry function of the worker thread.
* It rasterizes the vector image.
void Run() override;
private:
-
/**
* Rasterizes the tasks.
*/
void Rasterize();
private:
-
// Undefined
- VectorRasterizeThread( const VectorRasterizeThread& thread ) = delete;
+ VectorRasterizeThread(const VectorRasterizeThread& thread) = delete;
// Undefined
- VectorRasterizeThread& operator=( const VectorRasterizeThread& thread ) = delete;
+ VectorRasterizeThread& operator=(const VectorRasterizeThread& thread) = delete;
private:
-
- std::vector< VectorAnimationTaskPtr > mRasterizeTasks;
- ConditionalWait mConditionalWait;
- std::unique_ptr< CallbackBase > mCompletedCallback;
- bool mDestroyThread; ///< Whether the thread be destroyed
- bool mIsThreadStarted;
- const Dali::LogFactoryInterface& mLogFactory; ///< The log factory
-
+ std::vector<VectorAnimationTaskPtr> mRasterizeTasks;
+ ConditionalWait mConditionalWait;
+ std::unique_ptr<CallbackBase> mCompletedCallback;
+ bool mDestroyThread; ///< Whether the thread be destroyed
+ bool mIsThreadStarted;
+ const Dali::LogFactoryInterface& mLogFactory; ///< The log factory
};
} // namespace Internal
#include <dali/public-api/common/intrusive-ptr.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/internal/visuals/visual-base-impl.h>
#include <dali-toolkit/devel-api/visuals/arc-visual-properties-devel.h>
+#include <dali-toolkit/internal/visuals/visual-base-impl.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class ArcVisual;
-typedef IntrusivePtr< ArcVisual > ArcVisualPtr;
+typedef IntrusivePtr<ArcVisual> ArcVisualPtr;
/**
* The visual which renders an arc to the control's quad
* | SWEEP_ANGLE | FLOAT |
* | CAP | INTEGER |
*/
-class ArcVisual: public Visual::Base
+class ArcVisual : public Visual::Base
{
public:
-
/**
* @brief Create a new arc visual.
*
* @param[in] properties A Property::Map containing settings for this visual
* @return A smart-pointer to the newly allocated visual.
*/
- static ArcVisualPtr New( VisualFactoryCache& factoryCache, const Property::Map& properties );
-
-public: // from Visual
+ static ArcVisualPtr New(VisualFactoryCache& factoryCache, const Property::Map& properties);
+public: // from Visual
/**
* @copydoc Visual::Base::CreatePropertyMap
*/
- void DoCreatePropertyMap( Property::Map& map ) const override;
+ void DoCreatePropertyMap(Property::Map& map) const override;
/**
* @copydoc Visual::Base::CreateInstancePropertyMap
*/
- void DoCreateInstancePropertyMap( Property::Map& map ) const override;
+ void DoCreateInstancePropertyMap(Property::Map& map) const override;
protected:
-
/**
* @brief Constructor.
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
*/
- ArcVisual( VisualFactoryCache& factoryCache );
+ ArcVisual(VisualFactoryCache& factoryCache);
/**
* @brief A reference counted object may only be deleted by calling Unreference().
/**
* @copydoc Visual::Base::DoSetProperties
*/
- void DoSetProperties( const Property::Map& propertyMap ) override;
+ void DoSetProperties(const Property::Map& propertyMap) override;
/**
* @copydoc Visual::Base::DoSetOnScene
*/
- void DoSetOnScene( Actor& actor ) override;
+ void DoSetOnScene(Actor& actor) override;
/**
* @copydoc Visual::Base::DoSetOffScene
/**
* @copydoc Visual::Base::OnDoAction
*/
- void OnDoAction( const Property::Index actionId, const Property::Value& attributes ) override;
+ void OnDoAction(const Property::Index actionId, const Property::Value& attributes) override;
private:
-
// Undefined
- ArcVisual( const ArcVisual& arcVisual ) = delete;
+ ArcVisual(const ArcVisual& arcVisual) = delete;
// Undefined
- ArcVisual& operator=( const ArcVisual& arcVisual ) = delete;
+ ArcVisual& operator=(const ArcVisual& arcVisual) = delete;
private:
-
- float mThickness; ///< The thickness of the arc.
- float mRadius; ///< The radius of the arc.
- float mStartAngle; ///< The start angle of the arc.
- float mSweepAngle; ///< The sweep angle of the arc.
- Property::Index mRadiusIndex; ///< The index of the radius property.
- Property::Index mThicknessIndex; ///< The index of the thickness property.
- Property::Index mStartAngleIndex; ///< The index of the start angle property.
- Property::Index mSweepAngleIndex; ///< The index of the sweep angle property.
- DevelArcVisual::Cap::Type mCapType; ///< The cap type.
+ float mThickness; ///< The thickness of the arc.
+ float mRadius; ///< The radius of the arc.
+ float mStartAngle; ///< The start angle of the arc.
+ float mSweepAngle; ///< The sweep angle of the arc.
+ Property::Index mRadiusIndex; ///< The index of the radius property.
+ Property::Index mThicknessIndex; ///< The index of the thickness property.
+ Property::Index mStartAngleIndex; ///< The index of the start angle property.
+ Property::Index mSweepAngleIndex; ///< The index of the sweep angle property.
+ DevelArcVisual::Cap::Type mCapType; ///< The cap type.
};
} // namespace Internal
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/rendering/geometry.h>
#include <dali/public-api/common/intrusive-ptr.h>
+#include <dali/public-api/rendering/geometry.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class BorderVisual;
-typedef IntrusivePtr< BorderVisual > BorderVisualPtr;
+typedef IntrusivePtr<BorderVisual> BorderVisualPtr;
/**
* The visual which renders a solid color to the control's quad border fixed to a specified size.
class BorderVisual : public Visual::Base
{
public:
-
/**
* @brief Create a new border visual.
*
* @param[in] properties A Property::Map containing settings for this visual
* @return A smart-pointer to the newly allocated visual.
*/
- static BorderVisualPtr New( VisualFactoryCache& factoryCache, const Property::Map& properties );
+ static BorderVisualPtr New(VisualFactoryCache& factoryCache, const Property::Map& properties);
protected:
-
/**
* @brief Constructor.
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
*/
- BorderVisual( VisualFactoryCache& factoryCache );
+ BorderVisual(VisualFactoryCache& factoryCache);
/**
* @brief A reference counted object may only be deleted by calling Unreference().
/**
* @copydoc Visual::Base::DoSetProperties
*/
- void DoSetProperties( const Property::Map& propertyMap ) override;
+ void DoSetProperties(const Property::Map& propertyMap) override;
/**
* @copydoc Visual::Base::DoSetOnScene
*/
- void DoSetOnScene( Actor& actor ) override;
+ void DoSetOnScene(Actor& actor) override;
/**
* @copydoc Visual::Base::CreatePropertyMap
*/
- void DoCreatePropertyMap( Property::Map& map ) const override;
+ void DoCreatePropertyMap(Property::Map& map) const override;
/**
* @copydoc Visual::Base::CreateInstancePropertyMap
*/
- void DoCreateInstancePropertyMap( Property::Map& map ) const override;
+ void DoCreateInstancePropertyMap(Property::Map& map) const override;
/**
* @copydoc Visual::Base::OnSetTransform
void OnSetTransform() override;
private:
-
/**
* Request the border shader from the factory cache. If fail, create tha shader and add it to cache.
* @return The border shader.
* @param[in] index The index key of the value
* @param[in] value The value
*/
- void DoSetProperty( Property::Index index, const Property::Value& value );
+ void DoSetProperty(Property::Index index, const Property::Value& value);
// Undefined
- BorderVisual( const BorderVisual& borderRenderer );
+ BorderVisual(const BorderVisual& borderRenderer);
// Undefined
- BorderVisual& operator=( const BorderVisual& borderRenderer );
+ BorderVisual& operator=(const BorderVisual& borderRenderer);
private:
-
Vector4 mBorderColor;
float mBorderSize;
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class ColorVisual;
-typedef IntrusivePtr< ColorVisual > ColorVisualPtr;
+typedef IntrusivePtr<ColorVisual> ColorVisualPtr;
/**
* The visual which renders a solid color to the control's quad
* |-----------------|-------------|
* | mixColor | VECTOR4 |
*/
-class ColorVisual: public Visual::Base
+class ColorVisual : public Visual::Base
{
public:
-
/**
* @brief Create a new color visual.
*
* @param[in] properties A Property::Map containing settings for this visual
* @return A smart-pointer to the newly allocated visual.
*/
- static ColorVisualPtr New( VisualFactoryCache& factoryCache, const Property::Map& properties );
-
-public: // from Visual
+ static ColorVisualPtr New(VisualFactoryCache& factoryCache, const Property::Map& properties);
+public: // from Visual
/**
* @copydoc Visual::Base::CreatePropertyMap
*/
- void DoCreatePropertyMap( Property::Map& map ) const override;
+ void DoCreatePropertyMap(Property::Map& map) const override;
/**
* @copydoc Visual::Base::CreateInstancePropertyMap
*/
- void DoCreateInstancePropertyMap( Property::Map& map ) const override;
+ void DoCreateInstancePropertyMap(Property::Map& map) const override;
protected:
-
/**
* @brief Constructor.
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
*/
- ColorVisual( VisualFactoryCache& factoryCache );
+ ColorVisual(VisualFactoryCache& factoryCache);
/**
* @brief A reference counted object may only be deleted by calling Unreference().
/**
* @copydoc Visual::Base::DoSetProperties
*/
- void DoSetProperties( const Property::Map& propertyMap ) override;
+ void DoSetProperties(const Property::Map& propertyMap) override;
/**
* @copydoc Visual::Base::DoSetOnScene
*/
- void DoSetOnScene( Actor& actor ) override;
+ void DoSetOnScene(Actor& actor) override;
/**
* @copydoc Visual::Base::DoSetOffScene
/**
* @copydoc Visual::Base::OnDoAction
*/
- void OnDoAction( const Property::Index actionId, const Property::Value& attributes ) override;
+ void OnDoAction(const Property::Index actionId, const Property::Value& attributes) override;
/**
* @copydoc Visual::Base::UpdateShader
Dali::Property OnGetPropertyObject(Dali::Property::Key key) override;
private:
-
/**
* @brief Get a shader for the current properties.
* @return The shader for the current properties.
Shader GetShader();
private:
-
// Undefined
- ColorVisual( const ColorVisual& colorRenderer );
+ ColorVisual(const ColorVisual& colorRenderer);
// Undefined
- ColorVisual& operator=( const ColorVisual& colorRenderer );
+ ColorVisual& operator=(const ColorVisual& colorRenderer);
private:
float mBlurRadius; ///< The blur radius
#include <dali/public-api/common/intrusive-ptr.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/internal/visuals/visual-base-impl.h>
#include <dali-toolkit/internal/visuals/gradient/gradient.h>
+#include <dali-toolkit/internal/visuals/visual-base-impl.h>
namespace Dali
{
namespace Toolkit
{
-
namespace Internal
{
-
class Gradient;
class GradientVisual;
-typedef IntrusivePtr< GradientVisual > GradientVisualPtr;
+typedef IntrusivePtr<GradientVisual> GradientVisualPtr;
/**
* The visual which renders smooth transition of colors to the control's quad.
* Valid values for spreadMethod are 'pad', 'repeat' and 'reflect.'
* If not provided, 'objectBoundingBox' is used as default gradient units, and 'pad' is used as default spread method.
*/
-class GradientVisual: public Visual::Base
+class GradientVisual : public Visual::Base
{
public:
-
/**
* Types of the gradient
*/
* @param[in] properties A Property::Map containing settings for this visual
* @return A smart-pointer to the newly allocated visual.
*/
- static GradientVisualPtr New( VisualFactoryCache& factoryCache, const Property::Map& properties );
-
-public: // from Visual
+ static GradientVisualPtr New(VisualFactoryCache& factoryCache, const Property::Map& properties);
+public: // from Visual
/**
* @copydoc Visual::Base::CreatePropertyMap
*/
- void DoCreatePropertyMap( Property::Map& map ) const override;
+ void DoCreatePropertyMap(Property::Map& map) const override;
/**
* @copydoc Visual::Base::CreateInstancePropertyMap
*/
- void DoCreateInstancePropertyMap( Property::Map& map ) const override;
+ void DoCreateInstancePropertyMap(Property::Map& map) const override;
protected:
-
/**
* @brief Constructor.
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
*/
- GradientVisual( VisualFactoryCache& factoryCache );
+ GradientVisual(VisualFactoryCache& factoryCache);
/**
* @brief A reference counted object may only be deleted by calling Unreference().
/**
* @copydoc Visual::Base::DoSetProperties
*/
- void DoSetProperties( const Property::Map& propertyMap ) override;
+ void DoSetProperties(const Property::Map& propertyMap) override;
/**
* @copydoc Visual::Base::OnSetTransform
/**
* @copydoc Visual::Base::DoSetOnScene
*/
- void DoSetOnScene( Actor& actor ) override;
+ void DoSetOnScene(Actor& actor) override;
/**
* @copydoc Visual::Base::UpdateShader
void UpdateShader() override;
private:
-
/**
* New a gradient object with the given property map.
*
static void GetStopOffsets(const Property::Value* value, Vector<float>& stopOffsets);
// Undefined
- GradientVisual( const GradientVisual& gradientVisual );
+ GradientVisual(const GradientVisual& gradientVisual);
// Undefined
- GradientVisual& operator=( const GradientVisual& gradientVisual );
+ GradientVisual& operator=(const GradientVisual& gradientVisual);
private:
-
- Matrix3 mGradientTransform;
+ Matrix3 mGradientTransform;
IntrusivePtr<Gradient> mGradient;
- Type mGradientType;
- bool mIsOpaque; ///< Set to false if any of the stop colors are not opaque
+ Type mGradientType;
+ bool mIsOpaque; ///< Set to false if any of the stop colors are not opaque
};
} // namespace Internal
#define DALI_TOOLKIT_INTERNAL_GRADIENT_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
class Vector4;
namespace Toolkit
{
-
namespace Internal
{
-
/**
* Gradients consist of continuously smooth color transitions along a vector from one color to another,
* possibly followed by additional transitions along the same vector to other colors.
class Gradient : public RefObject
{
public:
-
/**
* The stop node tells the gradient what color it should be at certain position.
*/
struct GradientStop
{
- GradientStop( float offset, const Vector4& color )
- : mOffset( offset ), mStopColor( color )
- {}
+ GradientStop(float offset, const Vector4& color)
+ : mOffset(offset),
+ mStopColor(color)
+ {
+ }
bool operator<(const GradientStop& rhs) const
{
return mOffset < rhs.mOffset;
}
- float mOffset; // A value ranging from 0 to 1 to indicate where the gradient stop is placed.
- Vector4 mStopColor; // The color to use at this gradient stop
+ float mOffset; // A value ranging from 0 to 1 to indicate where the gradient stop is placed.
+ Vector4 mStopColor; // The color to use at this gradient stop
};
public:
-
/**
* Add a gradient stop.
*
* Set the coordinate system used by the gradient attributes.
* @param[in] gradientUnits The the attributes are defined using the current user coordinate system or the bounding box of the shape.
*/
- void SetGradientUnits( Toolkit::GradientVisual::Units::Type gradientUnits );
+ void SetGradientUnits(Toolkit::GradientVisual::Units::Type gradientUnits);
/**
* Get the coordinate system used by the gradient attributes.
*
* @param[in] spread The method to fill the remainder of target region which is outside the gradient bounds
*/
- void SetSpreadMethod( Toolkit::GradientVisual::SpreadMethod::Type spread );
+ void SetSpreadMethod(Toolkit::GradientVisual::SpreadMethod::Type spread);
/**
* Get the filling method for the the remainder of target region which is outside the gradient boun.
Dali::Texture GenerateLookupTexture();
private:
-
/**
* Estimate the resolution of the lookup texture.
* Note: Only call this function after the gradient stops are sorted in order.
unsigned int EstimateTextureResolution();
protected:
-
/**
* Construct a new Gradient object
* Called in the constructor of subclasses
virtual ~Gradient();
// Undefined
- Gradient( const Gradient& gradient );
+ Gradient(const Gradient& gradient);
// Undefined
- Gradient& operator=( const Gradient& handle );
+ Gradient& operator=(const Gradient& handle);
protected:
-
Vector<GradientStop> mGradientStops;
Matrix3 mAlignmentTransform;
Toolkit::GradientVisual::Units::Type mGradientUnits;
Toolkit::GradientVisual::SpreadMethod::Type mSpreadMethod;
-
};
} // namespace Internal
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/**
* Linear gradients change color evenly along a straight line.
* The gradient is defined by an axis (the gradient line) at any specified angles.
class LinearGradient : public Gradient
{
public:
-
/**
* Constructor.
* @param[in] startPosition The starting point onto which the 0% gradient stops are mapped.
* @param[in] endPosition The ending point r onto which the 100% gradient stops are mapped.
*/
- LinearGradient( const Vector2& startPosition, const Vector2& endPosition );
+ LinearGradient(const Vector2& startPosition, const Vector2& endPosition);
/**
* Destructor.
* @param[in] startPosition The starting point of the gradient vector.
* @param[in] endPosition The ending point of the gradient vector.
*/
- void SetStartAndEndPosition( const Vector2& startPosition, const Vector2& endPosition );
+ void SetStartAndEndPosition(const Vector2& startPosition, const Vector2& endPosition);
/**
* Get the stating point of the gradient vector.
const Vector2& GetEndPosition() const;
private:
-
// Undefined
- LinearGradient( const LinearGradient& gradient );
+ LinearGradient(const LinearGradient& gradient);
// Undefined
- LinearGradient& operator=( const LinearGradient& handle );
+ LinearGradient& operator=(const LinearGradient& handle);
private:
-
Vector2 mStartPosition;
Vector2 mEndPosition;
};
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/**
* Radial gradients change color circularly.
* The color transition starts from the center of the circle and distribute outwardly.
class RadialGradient : public Gradient
{
public:
-
/**
* Contructor.
* @param[in] center The center of the gradient circle onto which the 0% gradient stop is mapped.
* @param[in] radius The radius of the outmost circle onto which the 100% gradient stop is mapped.
*/
- RadialGradient( const Vector2& center, float radius );
+ RadialGradient(const Vector2& center, float radius);
/**
* Destructor.
* @param[in] center The center of the gradient circle onto which the 0% gradient stop is mapped.
* @param[in] radius The radius of the outmost circle onto which the 100% gradient stop is mapped.
*/
- void SetCenterAndRadius( const Vector2& center, float radius );
+ void SetCenterAndRadius(const Vector2& center, float radius);
/**
* Get the center of the gradient circle.
float GetRadius() const;
private:
-
// Undefined
- RadialGradient( const RadialGradient& gradient );
+ RadialGradient(const RadialGradient& gradient);
// Undefined
- RadialGradient& operator=( const RadialGradient& handle );
+ RadialGradient& operator=(const RadialGradient& handle);
private:
-
Vector2 mCenter;
float mRadius;
};
#define DALI_TOOLKIT_IMAGE_ATLAS_MANAGER_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <string>
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/rendering/texture-set.h>
+#include <string>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/image-loader/image-atlas.h>
namespace Dali
{
-
namespace Toolkit
{
-
class AtlasUploadObserver;
namespace Internal
{
-
/**
* The manager for automatic image atlasing. Owned by VisualFactory
*/
class ImageAtlasManager : public RefObject
{
public:
- typedef std::vector< Toolkit::ImageAtlas > AtlasContainer;
- typedef std::vector< TextureSet > TextureSetContainer;
+ typedef std::vector<Toolkit::ImageAtlas> AtlasContainer;
+ typedef std::vector<TextureSet> TextureSetContainer;
public:
-
/**
* Construtor
*
* @param [in] atlasUploadObserver The object to observe the uploading state inside ImageAtlas.
* @return The texture set containing the image.
*/
- TextureSet Add( Vector4& textureRect,
- const std::string& url,
- ImageDimensions& size,
- FittingMode::Type fittingMode = FittingMode::DEFAULT,
- bool orientationCorrection = true,
- AtlasUploadObserver* atlasUploadObserver = NULL );
+ TextureSet Add(Vector4& textureRect,
+ const std::string& url,
+ ImageDimensions& size,
+ FittingMode::Type fittingMode = FittingMode::DEFAULT,
+ bool orientationCorrection = true,
+ AtlasUploadObserver* atlasUploadObserver = NULL);
/**
* @brief Add a pixel buffer to the atlas
*
* @param [in] pixelData The pixel data.
* @return The texture set containing the image.
*/
- TextureSet Add( Vector4& textureRect,
- PixelData pixelData );
+ TextureSet Add(Vector4& textureRect,
+ PixelData pixelData);
/**
* Remove the image at the given rectangle from the texture set.
* @param [in] textureSet The texture set containing the atlas image.
* @param [in] textureRect The texture area to be removed.
*/
- void Remove( TextureSet textureSet, const Vector4& textureRect );
+ void Remove(TextureSet textureSet, const Vector4& textureRect);
/**
* @brief Set the broken image which is used to replace the image if loading fails.
*
* @param[in] brokenImageUrl The url of the broken image.
*/
- void SetBrokenImage( const std::string& brokenImageUrl );
+ void SetBrokenImage(const std::string& brokenImageUrl);
/**
* @brief Get shader
Shader GetShader() const;
private:
-
/**
* @brief Create a new atlas.
*
void CreateNewAtlas();
protected:
-
/**
* Destructor
*/
*/
ImageAtlasManager& operator=(const ImageAtlasManager& rhs);
-
private:
-
- AtlasContainer mAtlasList;
+ AtlasContainer mAtlasList;
TextureSetContainer mTextureSetList;
- std::string mBrokenImageUrl;
-
+ std::string mBrokenImageUrl;
};
-} // name Internal
+} // namespace Internal
} // namespace Toolkit
#define DALI_TOOLKIT_IMAGE_VISUAL_SHADER_FACTORY_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/**
* ImageVisualShaderFactory is an object that provides and shares shaders between image visuals
*/
class ImageVisualShaderFactory
{
public:
-
-public:
-
/**
* @brief Constructor
*/
* @param[in] defaultTextureWrapping Whether the default texture wrap mode is applied.
* @param[in] roundedCorner Whether the rounded corder is applied.
*/
- Shader GetShader( VisualFactoryCache& factoryCache, bool atlasing, bool defaultTextureWrapping, bool roundedCorner );
+ Shader GetShader(VisualFactoryCache& factoryCache, bool atlasing, bool defaultTextureWrapping, bool roundedCorner);
/**
* Request the default vertex shader source.
std::string_view GetFragmentShaderSource();
protected:
-
/**
* Undefined copy constructor.
*/
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/image-loader/atlas-upload-observer.h>
+#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
#include <dali-toolkit/internal/visuals/texture-upload-observer.h>
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
#include <dali-toolkit/internal/visuals/visual-url.h>
-#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
namespace Dali
{
-
class NativeImage;
namespace Toolkit
{
-
namespace Internal
{
-
class ImageVisualShaderFactory;
class ImageVisual;
-typedef IntrusivePtr< ImageVisual > ImageVisualPtr;
+typedef IntrusivePtr<ImageVisual> ImageVisualPtr;
/**
* The visual which renders an image to a quad geometry
* If the Visual is in a LayerUI it will pixel align the image, using a Layer3D will disable pixel alignment.
* Changing layer behaviour between LayerUI to Layer3D whilst the visual is already staged will not have an effect.
*/
-class ImageVisual: public Visual::Base, public ConnectionTracker, public AtlasUploadObserver, public TextureUploadObserver
+class ImageVisual : public Visual::Base, public ConnectionTracker, public AtlasUploadObserver, public TextureUploadObserver
{
public:
-
/**
* @brief Create a new image visual with a URL.
*
* @param[in] samplingMode The SamplingMode of the resource to load
* @return A smart-pointer to the newly allocated visual.
*/
- static ImageVisualPtr New( VisualFactoryCache& factoryCache,
- ImageVisualShaderFactory& shaderFactory,
- const VisualUrl& imageUrl,
- const Property::Map& properties,
- ImageDimensions size = ImageDimensions(),
- FittingMode::Type fittingMode = FittingMode::DEFAULT,
- Dali::SamplingMode::Type samplingMode = SamplingMode::BOX_THEN_LINEAR );
+ static ImageVisualPtr New(VisualFactoryCache& factoryCache,
+ ImageVisualShaderFactory& shaderFactory,
+ const VisualUrl& imageUrl,
+ const Property::Map& properties,
+ ImageDimensions size = ImageDimensions(),
+ FittingMode::Type fittingMode = FittingMode::DEFAULT,
+ Dali::SamplingMode::Type samplingMode = SamplingMode::BOX_THEN_LINEAR);
/**
* @brief Create a new image visual with a URL.
* @param[in] samplingMode The SamplingMode of the resource to load
* @return A smart-pointer to the newly allocated visual.
*/
- static ImageVisualPtr New( VisualFactoryCache& factoryCache,
- ImageVisualShaderFactory& shaderFactory,
- const VisualUrl& imageUrl,
- ImageDimensions size = ImageDimensions(),
- FittingMode::Type fittingMode = FittingMode::DEFAULT,
- Dali::SamplingMode::Type samplingMode = SamplingMode::BOX_THEN_LINEAR );
-
-public: // from Visual
-
+ static ImageVisualPtr New(VisualFactoryCache& factoryCache,
+ ImageVisualShaderFactory& shaderFactory,
+ const VisualUrl& imageUrl,
+ ImageDimensions size = ImageDimensions(),
+ FittingMode::Type fittingMode = FittingMode::DEFAULT,
+ Dali::SamplingMode::Type samplingMode = SamplingMode::BOX_THEN_LINEAR);
+
+public: // from Visual
/**
* @copydoc Visual::Base::GetNaturalSize
*/
- void GetNaturalSize( Vector2& naturalSize ) override;
+ void GetNaturalSize(Vector2& naturalSize) override;
/**
* @copydoc Visual::Base::CreatePropertyMap
*/
- void DoCreatePropertyMap( Property::Map& map ) const override;
+ void DoCreatePropertyMap(Property::Map& map) const override;
/**
* @copydoc Visual::Base::CreateInstancePropertyMap
*/
- void DoCreateInstancePropertyMap( Property::Map& map ) const override;
+ void DoCreateInstancePropertyMap(Property::Map& map) const override;
/**
* @copydoc Visual::Base::OnDoAction
*/
- void OnDoAction( const Dali::Property::Index actionName, const Dali::Property::Value& attributes ) override;
+ void OnDoAction(const Dali::Property::Index actionName, const Dali::Property::Value& attributes) override;
protected:
-
/**
* @brief Constructor with a URL.
*
* @param[in] fittingMode The FittingMode of the resource to load
* @param[in] samplingMode The SamplingMode of the resource to load
*/
- ImageVisual( VisualFactoryCache& factoryCache,
- ImageVisualShaderFactory& shaderFactory,
- const VisualUrl& imageUrl,
- ImageDimensions size,
- FittingMode::Type fittingMode,
- Dali::SamplingMode::Type samplingMode );
+ ImageVisual(VisualFactoryCache& factoryCache,
+ ImageVisualShaderFactory& shaderFactory,
+ const VisualUrl& imageUrl,
+ ImageDimensions size,
+ FittingMode::Type fittingMode,
+ Dali::SamplingMode::Type samplingMode);
/**
* @brief A reference counted object may only be deleted by calling Unreference().
/**
* @copydoc Visual::Base::DoSetProperties
*/
- void DoSetProperties( const Property::Map& propertyMap ) override;
+ void DoSetProperties(const Property::Map& propertyMap) override;
/**
* @copydoc Visual::Base::DoSetOnScene
*/
- void DoSetOnScene( Actor& actor ) override;
+ void DoSetOnScene(Actor& actor) override;
/**
* @copydoc Visual::Base::DoSetOffScene
*/
- void DoSetOffScene( Actor& actor ) override;
+ void DoSetOffScene(Actor& actor) override;
/**
* @copydoc Visual::Base::OnSetTransform
void UpdateShader() override;
public:
-
/**
* @copydoc AtlasUploadObserver::UploadCompleted
*
* To avoid rendering garbage pixels, renderer should be added to actor after the resources are ready.
* This callback is the place to add the renderer as it would be called once the loading is finished.
*/
- void UploadComplete( bool success, int32_t textureId, TextureSet textureSet,
- bool usingAtlas, const Vector4& atlasRectangle, bool preMultiplied ) override;
+ void UploadComplete(bool success, int32_t textureId, TextureSet textureSet, bool usingAtlas, const Vector4& atlasRectangle, bool preMultiplied) override;
private:
-
/**
* @copydoc TextureUploadObserver::LoadComplete
*
* To avoid rendering garbage pixels, renderer should be added to actor after the resources are ready.
* This callback is the place to add the renderer as it would be called once the PixelBuffer loading is finished.
*/
- void LoadComplete( bool loadSuccess, Devel::PixelBuffer pixelBuffer, const VisualUrl& url, bool preMultiplied ) override {}
+ void LoadComplete(bool loadSuccess, Devel::PixelBuffer pixelBuffer, const VisualUrl& url, bool preMultiplied) override
+ {
+ }
/**
* Allocate the mask data when a masking property is defined in the property map
* @param[in] orientationCorrection flag determines if orientation correction should be performed
* @param[in] forceReload flag determines if the texture should be reloaded from its source or use the cached texture.
*/
- void LoadTexture( bool& atlasing, Vector4& atlasRect, TextureSet& textures, bool orientationCorrection, TextureManager::ReloadPolicy forceReload );
+ void LoadTexture(bool& atlasing, Vector4& atlasRect, TextureSet& textures, bool orientationCorrection, TextureManager::ReloadPolicy forceReload);
/**
* @brief Checks if atlasing should be attempted
* @param[in] attemptAtlasing If true will attempt atlasing, otherwise create unique texture
* @return the texture set to use
*/
- TextureSet CreateTextureSet( Vector4& textureRect, bool synchronousLoading, bool attemptAtlasing );
+ TextureSet CreateTextureSet(Vector4& textureRect, bool synchronousLoading, bool attemptAtlasing);
/**
* Set the value to the uTextureRect uniform
* @param[in] textureRect The texture rectangular area.
*/
- void SetTextureRectUniform( const Vector4& textureRect );
+ void SetTextureRectUniform(const Vector4& textureRect);
/**
* Remove texture with valid TextureId
* @param[in] index The index key of the value
* @param[in] value The value
*/
- void DoSetProperty( Property::Index index, const Property::Value& value );
+ void DoSetProperty(Property::Index index, const Property::Value& value);
/**
* @brief Get a shader for the current properties.
Shader GetShader();
private:
-
- Vector4 mPixelArea;
- WeakHandle<Actor> mPlacementActor;
- VisualUrl mImageUrl;
+ Vector4 mPixelArea;
+ WeakHandle<Actor> mPlacementActor;
+ VisualUrl mImageUrl;
TextureManager::MaskingDataPointer mMaskingData;
- Dali::ImageDimensions mDesiredSize;
+ Dali::ImageDimensions mDesiredSize;
TextureManager::TextureId mTextureId;
- TextureSet mTextures;
+ TextureSet mTextures;
ImageVisualShaderFactory& mImageVisualShaderFactory;
- Dali::FittingMode::Type mFittingMode:3;
- Dali::SamplingMode::Type mSamplingMode:4;
- Dali::WrapMode::Type mWrapModeU:3;
- Dali::WrapMode::Type mWrapModeV:3;
- Dali::Toolkit::ImageVisual::LoadPolicy::Type mLoadPolicy;
+ Dali::FittingMode::Type mFittingMode : 3;
+ Dali::SamplingMode::Type mSamplingMode : 4;
+ Dali::WrapMode::Type mWrapModeU : 3;
+ Dali::WrapMode::Type mWrapModeV : 3;
+ Dali::Toolkit::ImageVisual::LoadPolicy::Type mLoadPolicy;
Dali::Toolkit::ImageVisual::ReleasePolicy::Type mReleasePolicy;
- Vector4 mAtlasRect;
- Dali::ImageDimensions mAtlasRectSize;
- TextureManager::LoadState mLoadState; ///< The texture loading state
- bool mAttemptAtlasing; ///< If true will attempt atlasing, otherwise create unique texture
- bool mOrientationCorrection; ///< true if the image will have it's orientation corrected.
+ Vector4 mAtlasRect;
+ Dali::ImageDimensions mAtlasRectSize;
+ TextureManager::LoadState mLoadState; ///< The texture loading state
+ bool mAttemptAtlasing; ///< If true will attempt atlasing, otherwise create unique texture
+ bool mOrientationCorrection; ///< true if the image will have it's orientation corrected.
};
} // namespace Internal
*/
// EXTERNAL INCLUDES
-#include <fstream>
-#include <string.h>
#include <dali/public-api/common/intrusive-ptr.h>
+#include <string.h>
+#include <fstream>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/visuals/mesh-visual-properties.h>
-#include <dali-toolkit/internal/visuals/visual-base-impl.h>
#include <dali-toolkit/internal/controls/model3d-view/obj-loader.h>
+#include <dali-toolkit/internal/visuals/visual-base-impl.h>
+#include <dali-toolkit/public-api/visuals/mesh-visual-properties.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class MeshVisual;
-typedef IntrusivePtr< MeshVisual > MeshVisualPtr;
+typedef IntrusivePtr<MeshVisual> MeshVisualPtr;
/**
* The visual which renders a 3D object to the control's quad
* | useSoftNormals | BOOLEAN | If true, average normals at points for smooth textures. Default true. |
* | lightPosition | VECTOR3 | The position (on stage) of the light |
*/
-class MeshVisual: public Visual::Base
+class MeshVisual : public Visual::Base
{
public:
-
/**
* @brief Create a new mesh visual.
*
* @param[in] properties A Property::Map containing settings for this visual
* @return A smart-pointer to the newly allocated visual.
*/
- static MeshVisualPtr New( VisualFactoryCache& factoryCache, const Property::Map& properties );
-
-public: // from Visual
+ static MeshVisualPtr New(VisualFactoryCache& factoryCache, const Property::Map& properties);
+public: // from Visual
/**
* @copydoc Visual::Base::CreatePropertyMap
*/
- void DoCreatePropertyMap( Property::Map& map ) const override;
+ void DoCreatePropertyMap(Property::Map& map) const override;
/**
* @copydoc Visual::Base::CreateInstancePropertyMap
*/
- void DoCreateInstancePropertyMap( Property::Map& map ) const override;
+ void DoCreateInstancePropertyMap(Property::Map& map) const override;
protected:
-
/**
* @brief Constructor.
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
*/
- MeshVisual( VisualFactoryCache& factoryCache );
+ MeshVisual(VisualFactoryCache& factoryCache);
/**
* @brief A reference counted object may only be deleted by calling Unreference().
/**
* @copydoc Visual::Base::DoSetProperties
*/
- void DoSetProperties( const Property::Map& propertyMap ) override;
+ void DoSetProperties(const Property::Map& propertyMap) override;
/**
* @copydoc Visual::Base::OnSetTransform
/**
* @copydoc Visual::Base::DoSetOnScene
*/
- void DoSetOnScene( Actor& actor ) override;
+ void DoSetOnScene(Actor& actor) override;
private:
-
/**
* @brief Provide an empty geometry for the visual to use.
* @details For use in error cases where the initialisation has failed for varying reasons.
* @param[in] index The index key of the value
* @param[in] value The value
*/
- void DoSetProperty( Property::Index index, const Property::Value& value );
+ void DoSetProperty(Property::Index index, const Property::Value& value);
private:
-
// Undefined
- MeshVisual( const MeshVisual& meshVisual );
+ MeshVisual(const MeshVisual& meshVisual);
// Undefined
- MeshVisual& operator=( const MeshVisual& meshVisual );
+ MeshVisual& operator=(const MeshVisual& meshVisual);
private:
-
std::string mObjectUrl;
std::string mMaterialUrl;
std::string mGlossTextureUrl;
std::string mTexturesPath;
- Shader mShader;
- Geometry mGeometry;
+ Shader mShader;
+ Geometry mGeometry;
TextureSet mTextureSet;
ObjLoader mObjLoader;
- Vector3 mSceneCenter;
- Vector3 mSceneSize;
+ Vector3 mSceneCenter;
+ Vector3 mSceneSize;
- Vector3 mLightPosition;
+ Vector3 mLightPosition;
Toolkit::MeshVisual::ShadingMode::Value mShadingMode;
bool mUseTexture;
#define DALI_TOOLKIT_NPATCH_DATA_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <string>
-#include <dali/public-api/rendering/texture-set.h>
#include <dali/devel-api/adaptor-framework/pixel-buffer.h>
+#include <dali/public-api/rendering/texture-set.h>
+#include <string>
// INTERNAL INCLUDES
-#include <dali-toolkit/internal/visuals/texture-manager-impl.h>
#include <dali-toolkit/devel-api/utility/npatch-utilities.h>
+#include <dali-toolkit/internal/visuals/texture-manager-impl.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class NPatchData : public Dali::Toolkit::TextureUploadObserver
{
public:
- typedef int32_t NPatchDataId; ///< The NPatchDataId type. This is used as a handle to refer to a particular Npatch Data.
+ typedef int32_t NPatchDataId; ///< The NPatchDataId type. This is used as a handle to refer to a particular Npatch Data.
static const int INVALID_NPATCH_DATA_ID = -1; ///< Used to represent a null TextureId or error
/**
};
public:
-
/**
* Constructor
*/
~NPatchData();
public:
-
/**
* @brief Set cache data id.
*
*/
LoadingState GetLoadingState() const;
-
/**
* @brief Retrieve NPatch rendering data.
*
* @param [in] pixelBuffer loaded pixel buffer.
* @param [in] preMultiplied whether the loaded image is premultiplied or not
*/
- void SetLoadedNPatchData( Devel::PixelBuffer& pixelBuffer, bool preMultiplied );
+ void SetLoadedNPatchData(Devel::PixelBuffer& pixelBuffer, bool preMultiplied);
private:
-
/**
* @copydoc TextureUploadObserver::UploadCompleted
*
* To avoid rendering garbage pixels, renderer should be added to actor after the resources are ready.
* This callback is the place to add the renderer as it would be called once the loading is finished.
*/
- void UploadComplete( bool loadSuccess, int32_t textureId, TextureSet textureSet, bool useAtlasing, const Vector4& atlasRect, bool preMultiplied ) override {}
+ void UploadComplete(bool loadSuccess, int32_t textureId, TextureSet textureSet, bool useAtlasing, const Vector4& atlasRect, bool preMultiplied) override
+ {
+ }
/**
* @copydoc TextureUploadObserver::LoadComplete
* To avoid rendering garbage pixels, renderer should be added to actor after the resources are ready.
* This callback is the place to add the renderer as it would be called once the loading is finished.
*/
- void LoadComplete( bool loadSuccess, Devel::PixelBuffer pixelBuffer, const VisualUrl& url, bool preMultiplied ) override;
-
+ void LoadComplete(bool loadSuccess, Devel::PixelBuffer pixelBuffer, const VisualUrl& url, bool preMultiplied) override;
private:
-
using ObserverListType = Dali::Vector<TextureUploadObserver*>;
NPatchDataId mId;
#define DALI_TOOLKIT_NPATCH_LOADER_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <string>
-#include <dali/public-api/rendering/texture-set.h>
-#include <dali/devel-api/common/owner-container.h>
#include <dali/devel-api/adaptor-framework/pixel-buffer.h>
+#include <dali/devel-api/common/owner-container.h>
+#include <dali/public-api/rendering/texture-set.h>
+#include <string>
// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/utility/npatch-utilities.h>
#include <dali-toolkit/internal/visuals/npatch-data.h>
#include <dali-toolkit/internal/visuals/texture-manager-impl.h>
-#include <dali-toolkit/devel-api/utility/npatch-utilities.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/**
* The manager for loading Npatch textures.
* It caches them internally for better performance; i.e. to avoid loading and
class NPatchLoader
{
public:
-
/**
* Constructor
*/
* @param [in] synchronousLoading True if the image will be loaded in synchronous time.
* @return id of the texture.
*/
- std::size_t Load( TextureManager& textureManager, TextureUploadObserver* textureObserver, const std::string& url, const Rect< int >& border, bool& preMultiplyOnLoad, bool synchronousLoading );
+ std::size_t Load(TextureManager& textureManager, TextureUploadObserver* textureObserver, const std::string& url, const Rect<int>& border, bool& preMultiplyOnLoad, bool synchronousLoading);
/**
* @brief Set loaded PixelBuffer and its information
* @param [in] pixelBuffer of loaded image
* @param [in] preMultiplied True if the image had pre-multiplied alpha applied
*/
- void SetNPatchData( std::size_t id, Devel::PixelBuffer& pixelBuffer, bool preMultiplied );
+ void SetNPatchData(std::size_t id, Devel::PixelBuffer& pixelBuffer, bool preMultiplied);
/**
* @brief Retrieve N patch data matching to an id
* @param [out] data const pointer to the NPatchData
* @return true if data matching to id was really found
*/
- bool GetNPatchData( const NPatchData::NPatchDataId id, const NPatchData*& data );
+ bool GetNPatchData(const NPatchData::NPatchDataId id, const NPatchData*& data);
/**
* @brief Remove a texture matching id.
* @param [in] id cache data id
* @param [in] textureObserver The NPatchVisual that requested loading.
*/
- void Remove( std::size_t id, TextureUploadObserver* textureObserver );
+ void Remove(std::size_t id, TextureUploadObserver* textureObserver);
private:
-
NPatchData::NPatchDataId GenerateUniqueNPatchDataId();
- int32_t GetCacheIndexFromId( const NPatchData::NPatchDataId id );
+ int32_t GetCacheIndexFromId(const NPatchData::NPatchDataId id);
protected:
-
/**
* Undefined copy constructor.
*/
NPatchLoader& operator=(const NPatchLoader& rhs);
private:
-
- NPatchData::NPatchDataId mCurrentNPatchDataId;
- OwnerContainer< NPatchData* > mCache;
+ NPatchData::NPatchDataId mCurrentNPatchDataId;
+ OwnerContainer<NPatchData*> mCache;
};
-} // name Internal
+} // namespace Internal
} // namespace Toolkit
// EXTERNAL INCLUDES
#include <dali/public-api/common/intrusive-ptr.h>
#include <dali/public-api/images/image-operations.h>
+#include <dali/public-api/object/weak-handle.h>
#include <dali/public-api/rendering/geometry.h>
#include <dali/public-api/rendering/sampler.h>
#include <dali/public-api/rendering/shader.h>
-#include <dali/public-api/object/weak-handle.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
#include <dali-toolkit/internal/visuals/texture-upload-observer.h>
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
#include <dali-toolkit/internal/visuals/visual-url.h>
+#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
class ImageVisualShaderFactory;
class NPatchVisual;
-typedef IntrusivePtr< NPatchVisual > NPatchVisualPtr;
+typedef IntrusivePtr<NPatchVisual> NPatchVisualPtr;
/**
* The visual which renders an 9 patch image to the control's quad
* | auxiliaryImage | STRING |
* | auxiliaryImageAlpha | FLOAT |
*/
-class NPatchVisual: public Visual::Base, public TextureUploadObserver
+class NPatchVisual : public Visual::Base, public TextureUploadObserver
{
public:
/**
*/
static NPatchVisualPtr New(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl);
-public: // from Visual
-
+public: // from Visual
/**
* @copydoc Visual::Base::GetNaturalSize
*/
- void GetNaturalSize( Vector2& naturalSize ) override;
+ void GetNaturalSize(Vector2& naturalSize) override;
/**
* @copydoc Visual::Base::CreatePropertyMap
*/
- void DoCreatePropertyMap( Property::Map& map ) const override;
+ void DoCreatePropertyMap(Property::Map& map) const override;
/**
* @copydoc Visual::Base::CreateInstancePropertyMap
*/
- void DoCreateInstancePropertyMap( Property::Map& map ) const override;
+ void DoCreateInstancePropertyMap(Property::Map& map) const override;
protected:
-
/**
* @brief Constructor.
*
/**
* @copydoc Visual::Base::DoSetProperties
*/
- void DoSetProperties( const Property::Map& propertyMap ) override;
+ void DoSetProperties(const Property::Map& propertyMap) override;
/**
* @copydoc Visual::Base::DoSetOnScene
*/
- void DoSetOnScene( Actor& actor ) override;
+ void DoSetOnScene(Actor& actor) override;
/**
* @copydoc Visual::Base::DoSetOffScene
*/
- void DoSetOffScene( Actor& actor ) override;
+ void DoSetOffScene(Actor& actor) override;
/**
* @copydoc Visual::Base::OnSetTransform
void OnSetTransform() override;
private:
-
/**
* Loads the NPatch image and the Auxiliary image if needed
*/
* @param subType to use
* @return the geometry
*/
- Geometry GetNinePatchGeometry( VisualFactoryCache::GeometryType subType );
+ Geometry GetNinePatchGeometry(VisualFactoryCache::GeometryType subType);
/**
* @brief Creates a geometry for the grid size to be used by this visuals' shaders
* @param[in] gridSize The grid size of the solid geometry to create
* @return Returns the created geometry for the grid size
*/
- Geometry CreateGridGeometry( Uint16Pair gridSize );
+ Geometry CreateGridGeometry(Uint16Pair gridSize);
/**
* @brief Creates a geometry with the border only for the grid size to be used by this visuals' shaders
* @param[in] gridSize The grid size of the solid geometry to create
* @return Returns the created geometry for the grid size
*/
- Geometry CreateBorderGeometry( Uint16Pair gridSize );
+ Geometry CreateBorderGeometry(Uint16Pair gridSize);
/**
* @brief Creates a renderer by using loaded resource.
void SetResource();
private:
-
/**
* @copydoc TextureUploadObserver::UploadCompleted
*
* To avoid rendering garbage pixels, renderer should be added to actor after the resources are ready.
* This callback is the place to add the renderer as it would be called once the loading is finished.
*/
- void UploadComplete( bool loadSuccess, int32_t textureId, TextureSet textureSet, bool useAtlasing, const Vector4& atlasRect, bool preMultiplied ) override;
+ void UploadComplete(bool loadSuccess, int32_t textureId, TextureSet textureSet, bool useAtlasing, const Vector4& atlasRect, bool preMultiplied) override;
/**
* @copydoc TextureUploadObserver::LoadComplete
* To avoid rendering garbage pixels, renderer should be added to actor after the resources are ready.
* This callback is the place to add the renderer as it would be called once the loading is finished.
*/
- void LoadComplete( bool loadSuccess, Devel::PixelBuffer pixelBuffer, const VisualUrl& url, bool preMultiplied ) override;
+ void LoadComplete(bool loadSuccess, Devel::PixelBuffer pixelBuffer, const VisualUrl& url, bool preMultiplied) override;
private:
WeakHandle<Actor> mPlacementActor; ///< Weakhandle to contain Actor during texture loading
bool mBorderOnly; ///< if only border is desired
Rect<int> mBorder; ///< The size of the border
float mAuxiliaryImageAlpha; ///< The alpha value for the auxiliary image only
- Toolkit::ImageVisual::ReleasePolicy::Type mReleasePolicy; ///< The release policy to determine when an image should no longer be cached.
+ Toolkit::ImageVisual::ReleasePolicy::Type mReleasePolicy; ///< The release policy to determine when an image should no longer be cached.
};
} // namespace Internal
#include <dali/public-api/common/intrusive-ptr.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/visuals/primitive-visual-properties.h>
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
+#include <dali-toolkit/public-api/visuals/primitive-visual-properties.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class PrimitiveVisual;
-typedef IntrusivePtr< PrimitiveVisual > PrimitiveVisualPtr;
+typedef IntrusivePtr<PrimitiveVisual> PrimitiveVisualPtr;
/**
* The visual which renders a simple 3D shape to the control's quad
* |-----------------|-------------|-----------------------------------------|
* | lightPosition | VECTOR3 | The position (on stage) of the light |
*/
-class PrimitiveVisual: public Visual::Base
+class PrimitiveVisual : public Visual::Base
{
public:
-
/**
* @brief Create a new primitive visual.
*
* @param[in] properties A Property::Map containing settings for this visual
* @return A smart-pointer to the newly allocated visual.
*/
- static PrimitiveVisualPtr New( VisualFactoryCache& factoryCache, const Property::Map& properties );
-
-public: // from Visual
+ static PrimitiveVisualPtr New(VisualFactoryCache& factoryCache, const Property::Map& properties);
+public: // from Visual
/**
* @copydoc Visual::Base::GetNaturalSize
*/
- void GetNaturalSize( Vector2& naturalSize ) override;
+ void GetNaturalSize(Vector2& naturalSize) override;
/**
* @copydoc Visual::Base::CreatePropertyMap
*/
- void DoCreatePropertyMap( Property::Map& map ) const override;
+ void DoCreatePropertyMap(Property::Map& map) const override;
/**
* @copydoc Visual::Base::CreateInstancePropertyMap
*/
- void DoCreateInstancePropertyMap( Property::Map& map ) const override;
+ void DoCreateInstancePropertyMap(Property::Map& map) const override;
protected:
-
/**
* @brief Constructor.
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
*/
- PrimitiveVisual( VisualFactoryCache& factoryCache );
+ PrimitiveVisual(VisualFactoryCache& factoryCache);
/**
* @brief A reference counted object may only be deleted by calling Unreference().
/**
* @copydoc Visual::Base::DoSetProperties
*/
- void DoSetProperties( const Property::Map& propertyMap ) override;
+ void DoSetProperties(const Property::Map& propertyMap) override;
/**
* @copydoc Visual::Base::DoSetOnScene
*/
- void DoSetOnScene( Actor& actor ) override;
+ void DoSetOnScene(Actor& actor) override;
/**
* @copydoc Visual::Base::OnSetTransform
void OnSetTransform() override;
private:
-
//Simple struct to store the position and normal of a single vertex.
struct Vertex
{
Vertex()
- {}
+ {
+ }
- Vertex( const Vector3& position, const Vector3& normal, const Vector2& textureCoord )
- : position( position ), normal( normal )
- {}
+ Vertex(const Vector3& position, const Vector3& normal, const Vector2& textureCoord)
+ : position(position),
+ normal(normal)
+ {
+ }
Vector3 position;
Vector3 normal;
* @param[in] slices The number of slices as you go around the sphere. Affects the smoothness of the surface.
* @param[in] stacks The number of stacks as you go down the sphere. Affects the smoothness of the surface.
*/
- void CreateSphere( Vector<Vertex>& vertices, Vector<unsigned short>& indices, int slices, int stacks );
+ void CreateSphere(Vector<Vertex>& vertices, Vector<unsigned short>& indices, int slices, int stacks);
/**
* @brief Compute the vertices and the triangles for a conic shape.
* @param[in] scaleHeight The scale of the height of the object, compared to the other dimensions.
* @param[in] slices The number of slices as you go around the conic shape. Affects the smoothness of the surface.
*/
- void CreateConic( Vector<Vertex>& vertices, Vector<unsigned short>& indices, float scaleTopRadius,
- float scaleBottomRadius, float scaleHeight, int slices );
+ void CreateConic(Vector<Vertex>& vertices, Vector<unsigned short>& indices, float scaleTopRadius, float scaleBottomRadius, float scaleHeight, int slices);
/**
* @brief Compute the vertices and the triangles for a bevelled cube.
* @param[in] bevelPercentage The ratio of the outer face widths to the cube's width. Between 0.0 and 1.0.
* @param[in] bevelSmoothness The smoothness of the bevelled edges. Between 0.0 and 1.0.
*/
- void CreateBevelledCube( Vector<Vertex>& vertices, Vector<unsigned short>& indices, Vector3 dimensions,
- float bevelPercentage, float bevelSmoothness );
+ void CreateBevelledCube(Vector<Vertex>& vertices, Vector<unsigned short>& indices, Vector3 dimensions, float bevelPercentage, float bevelSmoothness);
/**
* @brief Computes look-up tables for sin and cos, over angle divisions of (2 * Pi) / divisions
* @param[in] divisions Determines the angle coverage of the table. E.g divisions of '4' will have the sin values 0 = sin(0), 1 = sin(Pi/2), 2 = sin(Pi), 3 = sin(3Pi/2)
* @Param[in] halfCircle If true, go from 0 to Pi instead of 0 to 2Pi.
*/
- void ComputeCircleTables( Vector<float>& sinTable, Vector<float>& cosTable, int divisions, bool halfCircle );
+ void ComputeCircleTables(Vector<float>& sinTable, Vector<float>& cosTable, int divisions, bool halfCircle);
/**
* @brief Compute the vertices for a sphere.
* @param[in] slices The number of slices as you go around the sphere. Affects the smoothness of the surface.
* @param[in] stacks The number of stacks as you go down the sphere. Affects the smoothness of the surface.
*/
- void ComputeSphereVertices( Vector<Vertex>& vertices, int slices, int stacks );
+ void ComputeSphereVertices(Vector<Vertex>& vertices, int slices, int stacks);
/**
* @brief Compute the triangles for a sphere.
* @param[in] slices The number of slices as you go around the sphere. Affects the smoothness of the surface.
* @param[in] stacks The number of stacks as you go down the sphere. Affects the smoothness of the surface.
*/
- void FormSphereTriangles( Vector<unsigned short>& indices, int slices, int stacks );
+ void FormSphereTriangles(Vector<unsigned short>& indices, int slices, int stacks);
/**
* @brief Compute the vertices for a conical.
* @param[in] scaleHeight The scale of the height of the object, compared to the other dimensions.
* @param[in] slices The number of slices as you go around the conical. Affects the smoothness of the surface.
*/
- void ComputeConicVertices( Vector<Vertex>& vertices, float scaleTopRadius, float scaleBottomRadius,
- float scaleHeight, int slices );
+ void ComputeConicVertices(Vector<Vertex>& vertices, float scaleTopRadius, float scaleBottomRadius, float scaleHeight, int slices);
/**
* @brief Compute the triangles for a conic.
* @param[in] coneBottom True if the bottom circle has a radius of zero, i.e. the object is an inverted complete cone.
* @param[in] slices The number of slices as you go around the conic. Affects the smoothness of the surface.
*/
- void FormConicTriangles( Vector<unsigned short>& indices, float scaleTopRadius, float scaleBottomRadius,
- int slices );
+ void FormConicTriangles(Vector<unsigned short>& indices, float scaleTopRadius, float scaleBottomRadius, int slices);
/**
* @brief Compute the vertices for a cube.
* @param[in, out] vertices The vector of vertices.
* @Param[in] dimensions The dimensions of the object.
*/
- void ComputeCubeVertices( Vector<Vertex>& vertices, Vector3 dimensions );
+ void ComputeCubeVertices(Vector<Vertex>& vertices, Vector3 dimensions);
/**
* @brief Compute the triangles for a cube.
* @param[in, out] indices The vector of triangles, consisting of groups of three vertex indices.
*/
- void FormCubeTriangles( Vector<unsigned short>& indices );
+ void FormCubeTriangles(Vector<unsigned short>& indices);
/**
* @brief Compute the vertices for an octahedron (maximumly bevelled cube).
* @Param[in] dimensions The dimensions of the object.
* @Param[in] smoothness Defines how rounded the edges appear under lighting. Between 0.0 and 1.0.
*/
- void ComputeOctahedronVertices( Vector<Vertex>& vertices, Vector3 dimensions, float smoothness );
+ void ComputeOctahedronVertices(Vector<Vertex>& vertices, Vector3 dimensions, float smoothness);
/**
* @brief Compute the triangles for an octahedron.
* @param[in, out] indices The vector of triangles, consisting of groups of three vertex indices.
*/
- void FormOctahedronTriangles( Vector<unsigned short>& indices );
+ void FormOctahedronTriangles(Vector<unsigned short>& indices);
/**
* @brief Compute the vertices for a bevelled cube.
* @param[in] bevelPercentage The ratio of the outer face widths to the cube's width. Between 0.0 and 1.0.
* @param[in] bevelSmoothness The smoothness of the bevelled edges. Between 0.0 and 1.0.
*/
- void ComputeBevelledCubeVertices( Vector<Vertex>& vertices, Vector3 dimensions, float bevelPercentage,
- float bevelSmoothness );
+ void ComputeBevelledCubeVertices(Vector<Vertex>& vertices, Vector3 dimensions, float bevelPercentage, float bevelSmoothness);
/**
* @brief Compute the triangles for a bevelled cube.
* @param[in, out] indices The vector of triangles, consisting of groups of three vertex indices.
*/
- void FormBevelledCubeTriangles( Vector<unsigned short>& indices );
+ void FormBevelledCubeTriangles(Vector<unsigned short>& indices);
private:
-
// Undefined
- PrimitiveVisual( const PrimitiveVisual& PrimitiveVisual );
+ PrimitiveVisual(const PrimitiveVisual& PrimitiveVisual);
// Undefined
- PrimitiveVisual& operator=( const PrimitiveVisual& PrimitiveVisual );
+ PrimitiveVisual& operator=(const PrimitiveVisual& PrimitiveVisual);
private:
- Shader mShader;
+ Shader mShader;
Geometry mGeometry;
- Vector3 mObjectDimensions; //Dimensions of shape, scaled to be between 0.0 and 1.0.
+ Vector3 mObjectDimensions; //Dimensions of shape, scaled to be between 0.0 and 1.0.
Vector3 mSceneCenter;
Vector3 mSceneSize;
Vector3 mLightPosition;
//Shape properties.
- Vector3 mScaleDimensions; ///< Scale of dimensions of bevelled cube and sub-shapes.
- float mScaleTopRadius; ///< Scale of radius of top circle, to use when creating certain objects.
- float mScaleBottomRadius; ///< Scale of radius of bottom circle, to use when creating certain objects.
- float mScaleHeight; ///< Scale of height, to use when creating certain objects.
- float mScaleRadius; ///< Scale of radius, to use when creating certain objects.
- float mBevelPercentage; ///< Used to determine bevel amount when creating certain objects.
- float mBevelSmoothness; ///< Used to determine the smoothness of bevelled edges.
- int mSlices; ///< Number of slices to use when creating certain objects.
- int mStacks; ///< Number of stacks to use when creating certain objects.
-
- Toolkit::PrimitiveVisual::Shape::Type mPrimitiveType; //Shape to render, as enum.
+ Vector3 mScaleDimensions; ///< Scale of dimensions of bevelled cube and sub-shapes.
+ float mScaleTopRadius; ///< Scale of radius of top circle, to use when creating certain objects.
+ float mScaleBottomRadius; ///< Scale of radius of bottom circle, to use when creating certain objects.
+ float mScaleHeight; ///< Scale of height, to use when creating certain objects.
+ float mScaleRadius; ///< Scale of radius, to use when creating certain objects.
+ float mBevelPercentage; ///< Used to determine bevel amount when creating certain objects.
+ float mBevelSmoothness; ///< Used to determine the smoothness of bevelled edges.
+ int mSlices; ///< Number of slices to use when creating certain objects.
+ int mStacks; ///< Number of stacks to use when creating certain objects.
+
+ Toolkit::PrimitiveVisual::Shape::Type mPrimitiveType; //Shape to render, as enum.
};
} // namespace Internal
#define DALI_RENDERING_ADDON_H
/*
-* Copyright (c) 2020 Samsung Electronics Co., Ltd.
+* Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
-#include <dali/devel-api/common/addon-binder.h>
#include <dali-toolkit/internal/visuals/npatch/npatch-visual.h>
+#include <dali/devel-api/common/addon-binder.h>
namespace Dali
{
{
namespace Internal
{
-
/**
* Interface of Overdrawing AddOn
*/
class RenderingAddOn : public Dali::AddOn::AddOnBinder
{
using TextureManager = Dali::Toolkit::Internal::TextureManager;
+
public:
- RenderingAddOn() : Dali::AddOn::AddOnBinder( "oo-rendering", 0u )
- {}
+ RenderingAddOn()
+ : Dali::AddOn::AddOnBinder("oo-rendering", 0u)
+ {
+ }
// Bind AddOn functions
ADDON_BIND_FUNCTION(
GetGeometry,
- Dali::Geometry(TextureManager::TextureId, uint32_t&, uint32_t& ) );
+ Dali::Geometry(TextureManager::TextureId, uint32_t&, uint32_t&));
ADDON_BIND_FUNCTION(
CreateGeometry,
- Dali::Geometry( TextureManager::TextureId, const Dali::Devel::PixelBuffer& pixelBuffer ) );
+ Dali::Geometry(TextureManager::TextureId, const Dali::Devel::PixelBuffer& pixelBuffer));
ADDON_BIND_FUNCTION(
Initialize,
- void*() );
+ void*());
ADDON_BIND_FUNCTION(
CreateGeometryGrid,
- Dali::Geometry( const void*, const Uint16Pair&, uint32_t*) );
+ Dali::Geometry(const void*, const Uint16Pair&, uint32_t*));
ADDON_BIND_FUNCTION(
SubmitRenderTask,
- void( Renderer&, const void* ) );
+ void(Renderer&, const void*));
ADDON_BIND_FUNCTION(
BuildNPatch,
- void*( const Devel::PixelBuffer&, void*) );
+ void*(const Devel::PixelBuffer&, void*));
ADDON_BIND_FUNCTION(
DestroyNPatch,
- void( void* ) );
+ void(void*));
/**
* Single instance of the addon
static RenderingAddOn& Get()
{
static RenderingAddOn* addon = nullptr;
- if( !addon )
+ if(!addon)
{
addon = new RenderingAddOn();
if(addon->IsValid())
}
};
-} // Internal
-} // Toolkit
-} // Dali
+} // namespace Internal
+} // namespace Toolkit
+} // namespace Dali
#endif //DALI_CMAKE_RENDERING_ADDON_H
#define DALI_TOOLKIT_SVG_RASTERIZE_THREAD_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// EXTERNAL INCLUDES
#include <dali/devel-api/adaptor-framework/event-thread-callback.h>
+#include <dali/devel-api/adaptor-framework/vector-image-renderer.h>
#include <dali/devel-api/threading/conditional-wait.h>
#include <dali/devel-api/threading/mutex.h>
#include <dali/devel-api/threading/thread.h>
-#include <dali/public-api/images/pixel-data.h>
+#include <dali/integration-api/adaptor-framework/log-factory-interface.h>
+#include <dali/integration-api/processor-interface.h>
#include <dali/public-api/common/intrusive-ptr.h>
#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/public-api/images/pixel-data.h>
#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/rendering/texture-set.h>
-#include <dali/devel-api/adaptor-framework/vector-image-renderer.h>
-#include <dali/integration-api/adaptor-framework/log-factory-interface.h>
-#include <dali/integration-api/processor-interface.h>
#include <memory>
// INTERNAL INCLUDES
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class SvgVisual;
-typedef IntrusivePtr< SvgVisual > SvgVisualPtr;
+typedef IntrusivePtr<SvgVisual> SvgVisualPtr;
class RasterizingTask;
-typedef IntrusivePtr< RasterizingTask > RasterizingTaskPtr;
+typedef IntrusivePtr<RasterizingTask> RasterizingTaskPtr;
/**
* The svg rasterizing tasks to be processed in the worker thread.
private:
// Undefined
- RasterizingTask( const RasterizingTask& task );
+ RasterizingTask(const RasterizingTask& task);
// Undefined
- RasterizingTask& operator=( const RasterizingTask& task );
+ RasterizingTask& operator=(const RasterizingTask& task);
private:
- SvgVisualPtr mSvgVisual;
+ SvgVisualPtr mSvgVisual;
VectorImageRenderer mVectorRenderer;
- VisualUrl mUrl;
- PixelData mPixelData;
- float mDpi;
- unsigned int mWidth;
- unsigned int mHeight;
- bool mLoadSuccess;
+ VisualUrl mUrl;
+ PixelData mPixelData;
+ float mDpi;
+ unsigned int mWidth;
+ unsigned int mHeight;
+ bool mLoadSuccess;
};
/**
class SvgRasterizeThread : public Thread, Integration::Processor
{
public:
-
/**
* Constructor.
*
/**
* Terminate the svg rasterize thread, join and delete.
*/
- static void TerminateThread( SvgRasterizeThread*& thread );
+ static void TerminateThread(SvgRasterizeThread*& thread);
/**
* Add a rasterization task into the waiting queue, called by main thread.
*
* @param[in] task The task added to the queue.
*/
- void AddTask( RasterizingTaskPtr task );
+ void AddTask(RasterizingTaskPtr task);
/**
* Pop the next task out from the completed queue, called by main thread.
*
* @param[in] visual The visual pointer.
*/
- void RemoveTask( SvgVisual* visual );
+ void RemoveTask(SvgVisual* visual);
/**
* Delete the parsed SVG image, called by main thread.
*
* @param[in] VectorImage The image to be deleted
*/
- void DeleteImage( VectorImageRenderer vectorImage );
+ void DeleteImage(VectorImageRenderer vectorImage);
- /**
+ /**
* @copydoc Dali::Integration::Processor::Process()
*/
void Process() override;
private:
-
/**
* Pop the next task out from the queue.
*
*
* @param[in] task The task added to the queue.
*/
- void AddCompletedTask( RasterizingTaskPtr task );
+ void AddCompletedTask(RasterizingTaskPtr task);
/**
* Applies the rasterized image to material
void UnregisterProcessor();
protected:
-
/**
* Destructor.
*/
~SvgRasterizeThread() override;
-
/**
* The entry function of the worker thread.
* It fetches task from the Queue, rasterizes the image and apply to the renderer.
void Run() override;
private:
-
// Undefined
- SvgRasterizeThread( const SvgRasterizeThread& thread );
+ SvgRasterizeThread(const SvgRasterizeThread& thread);
// Undefined
- SvgRasterizeThread& operator=( const SvgRasterizeThread& thread );
+ SvgRasterizeThread& operator=(const SvgRasterizeThread& thread);
private:
-
- std::vector<RasterizingTaskPtr> mRasterizeTasks; //The queue of the tasks waiting to rasterize the SVG image
- std::vector <RasterizingTaskPtr> mCompletedTasks; //The queue of the tasks with the SVG rasterization completed
- Vector <VectorImageRenderer*> mDeleteSvg; //The images that the event thread requested to delete
-
- ConditionalWait mConditionalWait;
- Dali::Mutex mMutex;
- std::unique_ptr< EventThreadCallback > mTrigger;
- const Dali::LogFactoryInterface& mLogFactory;
- bool mIsThreadWaiting;
- bool mProcessorRegistered;
+ std::vector<RasterizingTaskPtr> mRasterizeTasks; //The queue of the tasks waiting to rasterize the SVG image
+ std::vector<RasterizingTaskPtr> mCompletedTasks; //The queue of the tasks with the SVG rasterization completed
+ Vector<VectorImageRenderer*> mDeleteSvg; //The images that the event thread requested to delete
+
+ ConditionalWait mConditionalWait;
+ Dali::Mutex mMutex;
+ std::unique_ptr<EventThreadCallback> mTrigger;
+ const Dali::LogFactoryInterface& mLogFactory;
+ bool mIsThreadWaiting;
+ bool mProcessorRegistered;
};
} // namespace Internal
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class ImageVisualShaderFactory;
class SvgVisual;
-typedef IntrusivePtr< SvgVisual > SvgVisualPtr;
+typedef IntrusivePtr<SvgVisual> SvgVisualPtr;
/**
* The visual which renders a svg image
* | url | STRING |
*
*/
-class SvgVisual: public Visual::Base
+class SvgVisual : public Visual::Base
{
public:
-
/**
* @brief Create the SVG Visual using the image URL.
*
* @param[in] properties A Property::Map containing settings for this visual
* @return A smart-pointer to the newly allocated visual.
*/
- static SvgVisualPtr New( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl, const Property::Map& properties );
+ static SvgVisualPtr New(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl, const Property::Map& properties);
/**
* @brief Create the SVG Visual using the image URL.
* @param[in] imageUrl The URL to svg resource to use
* @return A smart-pointer to the newly allocated visual.
*/
- static SvgVisualPtr New( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl );
-
-public: // from Visual
+ static SvgVisualPtr New(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl);
+public: // from Visual
/**
* @copydoc Visual::Base::GetNaturalSize
*/
- void GetNaturalSize( Vector2& naturalSize ) override;
+ void GetNaturalSize(Vector2& naturalSize) override;
/**
* @copydoc Visual::Base::CreatePropertyMap
*/
- void DoCreatePropertyMap( Property::Map& map ) const override;
+ void DoCreatePropertyMap(Property::Map& map) const override;
/**
* @copydoc Visual::Base::CreateInstancePropertyMap
*/
- void DoCreateInstancePropertyMap( Property::Map& map ) const override;
+ void DoCreateInstancePropertyMap(Property::Map& map) const override;
protected:
-
/**
* @brief Constructor.
*
* @param[in] shaderFactory The ImageVisualShaderFactory object
* @param[in] imageUrl The URL to svg resource to use
*/
- SvgVisual( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl );
+ SvgVisual(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl);
/**
* @brief A reference counted object may only be deleted by calling Unreference().
/**
* @copydoc Visual::Base::DoSetProperties
*/
- void DoSetProperties( const Property::Map& propertyMap ) override;
+ void DoSetProperties(const Property::Map& propertyMap) override;
/**
* @copydoc Visual::Base::DoSetOnScene
*/
- void DoSetOnScene( Actor& actor ) override;
+ void DoSetOnScene(Actor& actor) override;
/**
* @copydoc Visual::Base::DoSetOffScene
*/
- void DoSetOffScene( Actor& actor ) override;
+ void DoSetOffScene(Actor& actor) override;
/**
* @copydoc Visual::Base::OnSetTransform
bool IsResourceReady() const override;
public:
-
/**
* @bried Apply the rasterized image to the visual.
*
* @param[in] rasterizedPixelData The pixel buffer with the rasterized pixels
* @param[in] bool Whether the resource is loaded
*/
- void ApplyRasterizedImage( VectorImageRenderer vectorImage, PixelData rasterizedPixelData, bool isLoaded );
+ void ApplyRasterizedImage(VectorImageRenderer vectorImage, PixelData rasterizedPixelData, bool isLoaded);
private:
/**
*
* @param[in] size The target size of the SVG rasterization.
*/
- void AddRasterizationTask( const Vector2& size );
+ void AddRasterizationTask(const Vector2& size);
/**
* Helper method to set individual values by index key.
* @param[in] index The index key of the value
* @param[in] value The value
*/
- void DoSetProperty( Property::Index index, const Property::Value& value );
+ void DoSetProperty(Property::Index index, const Property::Value& value);
// Undefined
- SvgVisual( const SvgVisual& svgRenderer );
+ SvgVisual(const SvgVisual& svgRenderer);
// Undefined
- SvgVisual& operator=( const SvgVisual& svgRenderer );
+ SvgVisual& operator=(const SvgVisual& svgRenderer);
private:
ImageVisualShaderFactory& mImageVisualShaderFactory;
WeakHandle<Actor> mPlacementActor;
Vector2 mVisualSize;
bool mLoadFailed;
- bool mAttemptAtlasing; ///< If true will attempt atlasing, otherwise create unique texture
+ bool mAttemptAtlasing; ///< If true will attempt atlasing, otherwise create unique texture
};
} // namespace Internal
#include <dali/public-api/object/weak-handle.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/internal/visuals/visual-base-impl.h>
#include <dali-toolkit/internal/text/rendering/text-typesetter.h>
#include <dali-toolkit/internal/text/text-controller.h>
+#include <dali-toolkit/internal/visuals/visual-base-impl.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class TextVisual;
-typedef IntrusivePtr< TextVisual > TextVisualPtr;
+typedef IntrusivePtr<TextVisual> TextVisualPtr;
/**
* The visual which renders text
class TextVisual : public Visual::Base
{
public:
-
/**
* @brief Create a new text visual.
*
* @param[in] properties A Property::Map containing settings for this visual
* @return A smart-pointer to the newly allocated visual.
*/
- static TextVisualPtr New( VisualFactoryCache& factoryCache, const Property::Map& properties );
+ static TextVisualPtr New(VisualFactoryCache& factoryCache, const Property::Map& properties);
/**
* @brief Converts all strings keys in property map to index keys. Property Map can then be merged correctly.
* @param[in] propertyMap containing string keys or a mix of strings and indexes.
* @return Property::Map containing index keys.
*/
- static Property::Map ConvertStringKeysToIndexKeys( const Property::Map& propertyMap );
+ static Property::Map ConvertStringKeysToIndexKeys(const Property::Map& propertyMap);
/**
* @brief Retrieve the text's controller.
* @param[in] visual The text visual.
* @return The text controller
*/
- static Text::ControllerPtr GetController( Toolkit::Visual::Base visual )
+ static Text::ControllerPtr GetController(Toolkit::Visual::Base visual)
{
- return GetVisualObject( visual ).mController;
+ return GetVisualObject(visual).mController;
};
/**
* @param[in] visual The text visual.
* @param[in] animatablePropertyIndex The index of the animatable property
*/
- static void SetAnimatableTextColorProperty( Toolkit::Visual::Base visual, Property::Index animatablePropertyIndex )
+ static void SetAnimatableTextColorProperty(Toolkit::Visual::Base visual, Property::Index animatablePropertyIndex)
{
- GetVisualObject( visual ).mAnimatableTextColorPropertyIndex = animatablePropertyIndex;
+ GetVisualObject(visual).mAnimatableTextColorPropertyIndex = animatablePropertyIndex;
};
/**
* @brief Set the flag to trigger the textures to be initialized and renderer to be added to the control.
* @param[in] visual The text visual.
*/
- static void EnableRendererUpdate( Toolkit::Visual::Base visual )
+ static void EnableRendererUpdate(Toolkit::Visual::Base visual)
{
- GetVisualObject( visual ).mRendererUpdateNeeded = true;
+ GetVisualObject(visual).mRendererUpdateNeeded = true;
};
/**
* @brief Instantly updates the renderer
* @param[in] visual The text visual.
*/
- static void UpdateRenderer( Toolkit::Visual::Base visual )
+ static void UpdateRenderer(Toolkit::Visual::Base visual)
{
- GetVisualObject( visual ).UpdateRenderer();
+ GetVisualObject(visual).UpdateRenderer();
};
public: // from Visual::Base
-
/**
* @copydoc Visual::Base::GetHeightForWidth()
*/
- float GetHeightForWidth( float width ) override;
+ float GetHeightForWidth(float width) override;
/**
* @copydoc Visual::Base::GetNaturalSize()
*/
- void GetNaturalSize( Vector2& naturalSize ) override;
+ void GetNaturalSize(Vector2& naturalSize) override;
/**
* @copydoc Visual::Base::CreatePropertyMap()
*/
- void DoCreatePropertyMap( Property::Map& map ) const override;
+ void DoCreatePropertyMap(Property::Map& map) const override;
/**
* @copydoc Visual::Base::CreateInstancePropertyMap
*/
- void DoCreateInstancePropertyMap( Property::Map& map ) const override;
+ void DoCreateInstancePropertyMap(Property::Map& map) const override;
protected:
-
/**
* @brief Constructor.
*
* @param[in] factoryCache The VisualFactoryCache object
*/
- TextVisual( VisualFactoryCache& factoryCache );
+ TextVisual(VisualFactoryCache& factoryCache);
/**
* @brief A reference counted object may only be deleted by calling Unreference().
/**
* @copydoc Visual::Base::DoSetProperties()
*/
- void DoSetProperties( const Property::Map& propertyMap ) override;
+ void DoSetProperties(const Property::Map& propertyMap) override;
/**
* @copydoc Visual::Base::DoSetOnScene()
*/
- void DoSetOnScene( Actor& actor ) override;
+ void DoSetOnScene(Actor& actor) override;
/**
* @copydoc Visual::Base::DoSetOffScene()
*/
- void DoSetOffScene( Actor& actor ) override;
+ void DoSetOffScene(Actor& actor) override;
/**
* @copydoc Visual::Base::OnSetTransform
void OnSetTransform() override;
private:
-
struct TilingInfo
{
unsigned char* textBuffer;
unsigned char* styleBuffer;
unsigned char* maskBuffer;
- int width;
- int height;
- Pixel::Format textPixelFormat;
- int offsetPosition;
- Vector2 offSet;
-
- TilingInfo( int width, int height, Pixel::Format textPixelFormat )
- : textBuffer( NULL ),
- styleBuffer( NULL ),
- maskBuffer( NULL ),
- width( width ),
- height( height ),
- textPixelFormat( textPixelFormat ),
- offsetPosition( 0 ),
- offSet( 0.f, 0.f )
+ int width;
+ int height;
+ Pixel::Format textPixelFormat;
+ int offsetPosition;
+ Vector2 offSet;
+
+ TilingInfo(int width, int height, Pixel::Format textPixelFormat)
+ : textBuffer(NULL),
+ styleBuffer(NULL),
+ maskBuffer(NULL),
+ width(width),
+ height(height),
+ textPixelFormat(textPixelFormat),
+ offsetPosition(0),
+ offSet(0.f, 0.f)
{
}
~TilingInfo()
{
- if( textBuffer )
+ if(textBuffer)
{
- free( textBuffer );
+ free(textBuffer);
}
- if( styleBuffer )
+ if(styleBuffer)
{
- free( styleBuffer );
+ free(styleBuffer);
}
- if( maskBuffer )
+ if(maskBuffer)
{
- free( maskBuffer );
+ free(maskBuffer);
}
}
-
};
/**
*
* @param[in] propertyValue The value to set.
*/
- void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue );
+ void DoSetProperty(Dali::Property::Index index, const Dali::Property::Value& propertyValue);
/**
* @brief Updates the text's renderer.
/**
* @brief Removes the text's renderer.
*/
- void RemoveRenderer( Actor& actor );
+ void RemoveRenderer(Actor& actor);
/**
* @brief Create a texture in textureSet and add it.
* @param[in] sampler The sampler.
* @param[in] textureSetIndex The Index of TextureSet.
*/
- void AddTexture( TextureSet& textureSet, PixelData& data, Sampler& sampler, unsigned int textureSetIndex );
+ void AddTexture(TextureSet& textureSet, PixelData& data, Sampler& sampler, unsigned int textureSetIndex);
/**
* @brief Convert the buffer to pixelData.
* @param[in] offsetPosition The The buffer's start position.
* @param[in] textPixelFormat The PixelForma of text.
*/
- PixelData ConvertToPixelData( unsigned char* buffer, int width, int height, int offsetPosition, const Pixel::Format textPixelFormat );
+ PixelData ConvertToPixelData(unsigned char* buffer, int width, int height, int offsetPosition, const Pixel::Format textPixelFormat);
/**
* @brief Create the text's texture.
* @param[in] containsColorGlyph Whether the text contains color glyph.
* @param[in] styleEnabled Whether the text contains any styles (e.g. shadow, underline, etc.).
*/
- void CreateTextureSet( TilingInfo& info, Renderer& renderer, Sampler& sampler, bool hasMultipleTextColors, bool containsColorGlyph, bool styleEnabled );
+ void CreateTextureSet(TilingInfo& info, Renderer& renderer, Sampler& sampler, bool hasMultipleTextColors, bool containsColorGlyph, bool styleEnabled);
/**
* Create renderer of the text for rendering.
* @param[in] containsColorGlyph Whether the text contains color glyph.
* @param[in] styleEnabled Whether the text contains any styles (e.g. shadow, underline, etc.).
*/
- void AddRenderer( Actor& actor, const Vector2& size, bool hasMultipleTextColors, bool containsColorGlyph, bool styleEnabled );
-
+ void AddRenderer(Actor& actor, const Vector2& size, bool hasMultipleTextColors, bool containsColorGlyph, bool styleEnabled);
/**
* Get the texture of the text for rendering.
* @param[in] containsColorGlyph Whether the text contains color glyph.
* @param[in] styleEnabled Whether the text contains any styles (e.g. shadow, underline, etc.).
*/
- TextureSet GetTextTexture( const Vector2& size, bool hasMultipleTextColors, bool containsColorGlyph, bool styleEnabled );
+ TextureSet GetTextTexture(const Vector2& size, bool hasMultipleTextColors, bool containsColorGlyph, bool styleEnabled);
/**
* Get the text rendering shader.
* @param[in] containsColorGlyph Whether the text contains color glyph.
* @param[in] styleEnabled Whether the text contains any styles (e.g. shadow, underline, etc.).
*/
- Shader GetTextShader( VisualFactoryCache& factoryCache, bool hasMultipleTextColors, bool containsColorGlyph, bool styleEnabled );
+ Shader GetTextShader(VisualFactoryCache& factoryCache, bool hasMultipleTextColors, bool containsColorGlyph, bool styleEnabled);
/**
* @brief Retrieve the TextVisual object.
* @param[in] visual A handle to the TextVisual
* @return The TextVisual object
*/
- static TextVisual& GetVisualObject( Toolkit::Visual::Base visual )
+ static TextVisual& GetVisualObject(Toolkit::Visual::Base visual)
{
- return static_cast< TextVisual& >( Toolkit::GetImplementation( visual ).GetVisualObject() );
+ return static_cast<TextVisual&>(Toolkit::GetImplementation(visual).GetVisualObject());
};
private:
-
- typedef std::vector< Renderer > RendererContainer;
+ typedef std::vector<Renderer> RendererContainer;
/**
* Used as an alternative to boolean so that it is obvious whether the text contains single or multiple text colors, and emoji and styles.
enum Type
{
SINGLE_COLOR_TEXT = 0, ///< The text contains single color only.
- MULTI_COLOR_TEXT = 1, ///< The text contains multiple colors.
- NO_EMOJI = 0, ///< The text contains no emoji.
- HAS_EMOJI = 1, ///< The text contains emoji.
- NO_STYLES = 0, ///< The text contains contains no styles.
- HAS_SYLES = 1 ///< The text contains contains styles.
+ MULTI_COLOR_TEXT = 1, ///< The text contains multiple colors.
+ NO_EMOJI = 0, ///< The text contains no emoji.
+ HAS_EMOJI = 1, ///< The text contains emoji.
+ NO_STYLES = 0, ///< The text contains contains no styles.
+ HAS_SYLES = 1 ///< The text contains contains styles.
};
};
-
private:
- Text::ControllerPtr mController; ///< The text's controller.
- Text::TypesetterPtr mTypesetter; ///< The text's typesetter.
- WeakHandle<Actor> mControl; ///< The control where the renderer is added.
- Property::Index mAnimatableTextColorPropertyIndex; ///< The index of animatable text color property registered by the control.
- bool mRendererUpdateNeeded:1; ///< The flag to indicate whether the renderer needs to be updated.
+ Text::ControllerPtr mController; ///< The text's controller.
+ Text::TypesetterPtr mTypesetter; ///< The text's typesetter.
+ WeakHandle<Actor> mControl; ///< The control where the renderer is added.
+ Property::Index mAnimatableTextColorPropertyIndex; ///< The index of animatable text color property registered by the control.
+ bool mRendererUpdateNeeded : 1; ///< The flag to indicate whether the renderer needs to be updated.
RendererContainer mRendererList;
};
#define DALI_TOOLKIT_TEXTURE_MANAGER_IMPL_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <deque>
-#include <functional>
-#include <string>
-#include <memory>
+#include <dali/devel-api/adaptor-framework/pixel-buffer.h>
+#include <dali/devel-api/common/owner-container.h>
#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/object/ref-object.h>
-#include <dali/public-api/rendering/texture-set.h>
-#include <dali/devel-api/common/owner-container.h>
-#include <dali/devel-api/adaptor-framework/pixel-buffer.h>
#include <dali/public-api/rendering/geometry.h>
+#include <dali/public-api/rendering/texture-set.h>
+#include <deque>
+#include <functional>
+#include <memory>
+#include <string>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/image-loader/async-image-loader-devel.h>
#include <dali-toolkit/devel-api/image-loader/image-atlas.h>
-#include <dali-toolkit/public-api/image-loader/async-image-loader.h>
-#include <dali-toolkit/internal/visuals/texture-upload-observer.h>
-#include <dali-toolkit/internal/visuals/visual-url.h>
#include <dali-toolkit/internal/helpers/round-robin-container-view.h>
#include <dali-toolkit/internal/image-loader/async-image-loader-impl.h>
-
+#include <dali-toolkit/internal/visuals/texture-upload-observer.h>
+#include <dali-toolkit/internal/visuals/visual-url.h>
+#include <dali-toolkit/public-api/image-loader/async-image-loader.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
class ImageAtlasManager;
class TextureManager : public ConnectionTracker
{
public:
-
- typedef int32_t TextureId; ///< The TextureId type. This is used as a handle to refer to a particular Texture.
+ typedef int32_t TextureId; ///< The TextureId type. This is used as a handle to refer to a particular Texture.
static const int INVALID_TEXTURE_ID = -1; ///< Used to represent a null TextureId or error
/**
/**
* Whether the pixel data should be kept in TextureManager, returned with pixelBuffer or uploaded for rendering
*/
- enum class StorageType: uint8_t
+ enum class StorageType : uint8_t
{
KEEP_PIXEL_BUFFER,
RETURN_PIXEL_BUFFER,
/**
* Whether the texture should be loaded synchronously or asynchronously.
*/
- enum class LoadType: uint8_t
+ enum class LoadType : uint8_t
{
LOAD_ASYNCHRONOUSLY,
LOAD_SYNCHRONOUSLY
/**
* @brief The LoadState Enumeration represents the current state of a particular Texture's life-cycle.
*/
- enum class LoadState: uint8_t
+ enum class LoadState : uint8_t
{
- NOT_STARTED, ///< Default
- LOADING, ///< Loading has been started, but not finished.
- LOAD_FINISHED, ///< Loading has finished. (for CPU storage only)
- WAITING_FOR_MASK,///< Loading has finished, but waiting for mask image
- MASK_APPLYING, ///< Loading has finished, Mask is applying
- MASK_APPLIED, ///< Loading has finished, Mask is applyied by GPU
- UPLOADED, ///< Uploaded and ready. (For GPU upload only)
- CANCELLED, ///< Removed before loading completed
- LOAD_FAILED ///< Async loading failed, e.g. connection problem
+ NOT_STARTED, ///< Default
+ LOADING, ///< Loading has been started, but not finished.
+ LOAD_FINISHED, ///< Loading has finished. (for CPU storage only)
+ WAITING_FOR_MASK, ///< Loading has finished, but waiting for mask image
+ MASK_APPLYING, ///< Loading has finished, Mask is applying
+ MASK_APPLIED, ///< Loading has finished, Mask is applyied by GPU
+ UPLOADED, ///< Uploaded and ready. (For GPU upload only)
+ CANCELLED, ///< Removed before loading completed
+ LOAD_FAILED ///< Async loading failed, e.g. connection problem
};
/**
*/
enum class ReloadPolicy
{
- CACHED = 0, ///< Loads cached texture if it exists.
- FORCED ///< Forces reloading of texture.
+ CACHED = 0, ///< Loads cached texture if it exists.
+ FORCED ///< Forces reloading of texture.
};
/**
};
public:
-
struct MaskingData
{
MaskingData();
~MaskingData() = default;
- VisualUrl mAlphaMaskUrl;
+ VisualUrl mAlphaMaskUrl;
TextureManager::TextureId mAlphaMaskId;
- float mContentScaleFactor;
- bool mCropToMask;
+ float mContentScaleFactor;
+ bool mCropToMask;
};
using MaskingDataPointer = std::unique_ptr<MaskingData>;
-
/**
* Class to provide lifecycle event on destruction of texture manager.
*/
* @return The texture set containing the frame of animated image, or empty if still loading.
*/
- TextureSet LoadAnimatedImageTexture( Dali::AnimatedImageLoading animatedImageLoading,
- uint32_t frameIndex,
- Dali::SamplingMode::Type samplingMode,
- bool synchronousLoading,
- TextureManager::TextureId& textureId,
- Dali::WrapMode::Type wrapModeU, Dali::WrapMode::Type wrapModeV,
- TextureUploadObserver* textureObserver );
+ TextureSet LoadAnimatedImageTexture(Dali::AnimatedImageLoading animatedImageLoading,
+ uint32_t frameIndex,
+ Dali::SamplingMode::Type samplingMode,
+ bool synchronousLoading,
+ TextureManager::TextureId& textureId,
+ Dali::WrapMode::Type wrapModeU,
+ Dali::WrapMode::Type wrapModeV,
+ TextureUploadObserver* textureObserver);
/**
* @brief Requests an image load of the given URL to get PixelBuffer.
* @return The pixel buffer containing the image, or empty if still loading.
*/
- Devel::PixelBuffer LoadPixelBuffer( const VisualUrl& url,
- Dali::ImageDimensions desiredSize,
- Dali::FittingMode::Type fittingMode,
- Dali::SamplingMode::Type samplingMode,
- bool synchronousLoading,
- TextureUploadObserver* textureObserver,
- bool orientationCorrection,
- TextureManager::MultiplyOnLoad& preMultiplyOnLoad );
-
+ Devel::PixelBuffer LoadPixelBuffer(const VisualUrl& url,
+ Dali::ImageDimensions desiredSize,
+ Dali::FittingMode::Type fittingMode,
+ Dali::SamplingMode::Type samplingMode,
+ bool synchronousLoading,
+ TextureUploadObserver* textureObserver,
+ bool orientationCorrection,
+ TextureManager::MultiplyOnLoad& preMultiplyOnLoad);
/**
* @brief Requests an image load of the given URL.
* @return The texture set containing the image, or empty if still loading.
*/
- TextureSet LoadTexture( const VisualUrl& url,
- Dali::ImageDimensions desiredSize,
- Dali::FittingMode::Type fittingMode,
- Dali::SamplingMode::Type samplingMode,
- MaskingDataPointer& maskInfo,
- bool synchronousLoading,
- TextureManager::TextureId& textureId,
- Vector4& textureRect,
- Dali::ImageDimensions& textureRectSize,
- bool& atlasingStatus,
- bool& loadingStatus,
- Dali::WrapMode::Type wrapModeU,
- Dali::WrapMode::Type wrapModeV,
- TextureUploadObserver* textureObserver,
- AtlasUploadObserver* atlasObserver,
- ImageAtlasManagerPtr imageAtlasManager,
- bool orientationCorrection,
- TextureManager::ReloadPolicy reloadPolicy,
- MultiplyOnLoad& preMultiplyOnLoad );
+ TextureSet LoadTexture(const VisualUrl& url,
+ Dali::ImageDimensions desiredSize,
+ Dali::FittingMode::Type fittingMode,
+ Dali::SamplingMode::Type samplingMode,
+ MaskingDataPointer& maskInfo,
+ bool synchronousLoading,
+ TextureManager::TextureId& textureId,
+ Vector4& textureRect,
+ Dali::ImageDimensions& textureRectSize,
+ bool& atlasingStatus,
+ bool& loadingStatus,
+ Dali::WrapMode::Type wrapModeU,
+ Dali::WrapMode::Type wrapModeV,
+ TextureUploadObserver* textureObserver,
+ AtlasUploadObserver* atlasObserver,
+ ImageAtlasManagerPtr imageAtlasManager,
+ bool orientationCorrection,
+ TextureManager::ReloadPolicy reloadPolicy,
+ MultiplyOnLoad& preMultiplyOnLoad);
/**
* @brief Requests an image load of the given URL.
* @param[in,out] preMultiplyOnLoad True if the image color should be multiplied by it's alpha. Set to false if the image has no alpha channel
* @return A TextureId to use as a handle to reference this Texture
*/
- TextureId RequestLoad( const VisualUrl& url,
- const ImageDimensions desiredSize,
- FittingMode::Type fittingMode,
- Dali::SamplingMode::Type samplingMode,
- const UseAtlas useAtlasing,
- TextureUploadObserver* observer,
- bool orientationCorrection,
- TextureManager::ReloadPolicy reloadPolicy,
- MultiplyOnLoad& preMultiplyOnLoad );
+ TextureId RequestLoad(const VisualUrl& url,
+ const ImageDimensions desiredSize,
+ FittingMode::Type fittingMode,
+ Dali::SamplingMode::Type samplingMode,
+ const UseAtlas useAtlasing,
+ TextureUploadObserver* observer,
+ bool orientationCorrection,
+ TextureManager::ReloadPolicy reloadPolicy,
+ MultiplyOnLoad& preMultiplyOnLoad);
/**
* @brief Requests an image load of the given URL, when the texture has
* image has no alpha channel
* @return A TextureId to use as a handle to reference this Texture
*/
- TextureId RequestLoad( const VisualUrl& url,
- TextureId maskTextureId,
- float contentScale,
- const ImageDimensions desiredSize,
- FittingMode::Type fittingMode,
- Dali::SamplingMode::Type samplingMode,
- const UseAtlas useAtlasing,
- bool cropToMask,
- TextureUploadObserver* observer,
- bool orientationCorrection,
- TextureManager::ReloadPolicy reloadPolicy,
- MultiplyOnLoad& preMultiplyOnLoad );
+ TextureId RequestLoad(const VisualUrl& url,
+ TextureId maskTextureId,
+ float contentScale,
+ const ImageDimensions desiredSize,
+ FittingMode::Type fittingMode,
+ Dali::SamplingMode::Type samplingMode,
+ const UseAtlas useAtlasing,
+ bool cropToMask,
+ TextureUploadObserver* observer,
+ bool orientationCorrection,
+ TextureManager::ReloadPolicy reloadPolicy,
+ MultiplyOnLoad& preMultiplyOnLoad);
/**
* Requests a masking image to be loaded. This mask is not uploaded to GL,
* instead, it is stored in CPU memory, and can be used for CPU blending.
*/
- TextureId RequestMaskLoad( const VisualUrl& maskUrl );
+ TextureId RequestMaskLoad(const VisualUrl& maskUrl);
/**
* @brief Remove a Texture from the TextureManager.
* @param[in] textureId The ID of the Texture to remove.
* @param[in] textureObserver The texture observer.
*/
- void Remove( const TextureManager::TextureId textureId, TextureUploadObserver* textureObserver );
+ void Remove(const TextureManager::TextureId textureId, TextureUploadObserver* textureObserver);
/**
* @brief Get the visualUrl associated with the texture id.
* @param[in] textureId The texture Id to get
* @return The visual Url associated with the texture id.
*/
- VisualUrl GetVisualUrl( TextureId textureId );
+ VisualUrl GetVisualUrl(TextureId textureId);
/**
* @brief Get the current state of a texture
* @return The loading state if the texture is valid, or NOT_STARTED if the textureId
* is not valid.
*/
- LoadState GetTextureState( TextureId textureId );
+ LoadState GetTextureState(TextureId textureId);
/**
* @brief Get the associated texture set if the texture id is valid
* @param[in] textureId The texture Id to look up
* @return the associated texture set, or an empty handle if textureId is not valid
*/
- TextureSet GetTextureSet( TextureId textureId );
+ TextureSet GetTextureSet(TextureId textureId);
/**
* Adds an external texture to the texture manager
* @param[in] texture The texture to add
* @return string containing the URL for the texture
*/
- std::string AddExternalTexture( TextureSet& texture );
+ std::string AddExternalTexture(TextureSet& texture);
/**
* Removes an external texture from texture manager
* @param[in] url The string containing the texture to remove
* @return handle to the texture
*/
- TextureSet RemoveExternalTexture( const std::string& url );
+ TextureSet RemoveExternalTexture(const std::string& url);
/**
* Add an observer to the object.
* @param[in] observer The observer to add.
*/
- void AddObserver( TextureManager::LifecycleObserver& observer );
+ void AddObserver(TextureManager::LifecycleObserver& observer);
/**
* Remove an observer from the object
* @pre The observer has already been added.
* @param[in] observer The observer to remove.
*/
- void RemoveObserver( TextureManager::LifecycleObserver& observer );
+ void RemoveObserver(TextureManager::LifecycleObserver& observer);
/**
* @brief Returns the geometry associated with texture.
* @param[out] backElements number of back elements
* @return Returns valid geometry object
*/
- Geometry GetRenderGeometry(TextureId textureId, uint32_t& frontElements, uint32_t& backElements );
+ Geometry GetRenderGeometry(TextureId textureId, uint32_t& frontElements, uint32_t& backElements);
private:
-
/**
* @brief Requests an image load of the given URL, when the texture has
* have loaded, if there is a valid maskTextureId, it will perform a
* @return A TextureId to use as a handle to reference this Texture
*/
TextureId RequestLoadInternal(
- const VisualUrl& url,
- TextureId maskTextureId,
- float contentScale,
- const ImageDimensions desiredSize,
- FittingMode::Type fittingMode,
- Dali::SamplingMode::Type samplingMode,
- UseAtlas useAtlas,
- bool cropToMask,
- StorageType storageType,
- TextureUploadObserver* observer,
- bool orientationCorrection,
- TextureManager::ReloadPolicy reloadPolicy,
- MultiplyOnLoad& preMultiplyOnLoad,
- Dali::AnimatedImageLoading animatedImageLoading,
- uint32_t frameIndex );
+ const VisualUrl& url,
+ TextureId maskTextureId,
+ float contentScale,
+ const ImageDimensions desiredSize,
+ FittingMode::Type fittingMode,
+ Dali::SamplingMode::Type samplingMode,
+ UseAtlas useAtlas,
+ bool cropToMask,
+ StorageType storageType,
+ TextureUploadObserver* observer,
+ bool orientationCorrection,
+ TextureManager::ReloadPolicy reloadPolicy,
+ MultiplyOnLoad& preMultiplyOnLoad,
+ Dali::AnimatedImageLoading animatedImageLoading,
+ uint32_t frameIndex);
/**
* @brief Get the current state of a texture
* @return The loading state if the texture is valid, or NOT_STARTED if the textureId
* is not valid.
*/
- LoadState GetTextureStateInternal( TextureId textureId );
+ LoadState GetTextureStateInternal(TextureId textureId);
typedef size_t TextureHash; ///< The type used to store the hash used for Texture caching.
*/
struct TextureInfo
{
- TextureInfo( TextureId textureId,
- TextureId maskTextureId,
- const VisualUrl& url,
- ImageDimensions desiredSize,
- float scaleFactor,
- FittingMode::Type fittingMode,
- Dali::SamplingMode::Type samplingMode,
- bool loadSynchronously,
- bool cropToMask,
- UseAtlas useAtlas,
- TextureManager::TextureHash hash,
- bool orientationCorrection,
- bool preMultiplyOnLoad,
- Dali::AnimatedImageLoading animatedImageLoading,
- uint32_t frameIndex )
- : url( url ),
- desiredSize( desiredSize ),
- useSize( desiredSize ),
- atlasRect( 0.0f, 0.0f, 1.0f, 1.0f ), // Full atlas rectangle
- textureId( textureId ),
- maskTextureId( maskTextureId ),
- hash( hash ),
- scaleFactor( scaleFactor ),
- referenceCount( 1u ),
- loadState( LoadState::NOT_STARTED ),
- fittingMode( fittingMode ),
- samplingMode( samplingMode ),
- storageType( StorageType::UPLOAD_TO_TEXTURE ),
- animatedImageLoading( animatedImageLoading ),
- frameIndex( frameIndex ),
- loadSynchronously( loadSynchronously ),
- useAtlas( useAtlas ),
- cropToMask( cropToMask ),
- orientationCorrection( true ),
- preMultiplyOnLoad( preMultiplyOnLoad ),
- preMultiplied( false )
+ TextureInfo(TextureId textureId,
+ TextureId maskTextureId,
+ const VisualUrl& url,
+ ImageDimensions desiredSize,
+ float scaleFactor,
+ FittingMode::Type fittingMode,
+ Dali::SamplingMode::Type samplingMode,
+ bool loadSynchronously,
+ bool cropToMask,
+ UseAtlas useAtlas,
+ TextureManager::TextureHash hash,
+ bool orientationCorrection,
+ bool preMultiplyOnLoad,
+ Dali::AnimatedImageLoading animatedImageLoading,
+ uint32_t frameIndex)
+ : url(url),
+ desiredSize(desiredSize),
+ useSize(desiredSize),
+ atlasRect(0.0f, 0.0f, 1.0f, 1.0f), // Full atlas rectangle
+ textureId(textureId),
+ maskTextureId(maskTextureId),
+ hash(hash),
+ scaleFactor(scaleFactor),
+ referenceCount(1u),
+ loadState(LoadState::NOT_STARTED),
+ fittingMode(fittingMode),
+ samplingMode(samplingMode),
+ storageType(StorageType::UPLOAD_TO_TEXTURE),
+ animatedImageLoading(animatedImageLoading),
+ frameIndex(frameIndex),
+ loadSynchronously(loadSynchronously),
+ useAtlas(useAtlas),
+ cropToMask(cropToMask),
+ orientationCorrection(true),
+ preMultiplyOnLoad(preMultiplyOnLoad),
+ preMultiplied(false)
{
}
/**
* Container type used to store all observer clients of this Texture
*/
- typedef Dali::Vector< TextureUploadObserver* > ObserverListType;
-
- ObserverListType observerList; ///< Container used to store all observer clients of this Texture
- Toolkit::ImageAtlas atlas; ///< The atlas this Texture lays within (if any)
- Devel::PixelBuffer pixelBuffer;///< The PixelBuffer holding the image data (May be empty after upload)
- TextureSet textureSet; ///< The TextureSet holding the Texture
- VisualUrl url; ///< The URL of the image
- ImageDimensions desiredSize; ///< The size requested
- ImageDimensions useSize; ///< The size used
- Vector4 atlasRect; ///< The atlas rect used if atlased
- TextureId textureId; ///< The TextureId associated with this Texture
- TextureId maskTextureId; ///< The mask TextureId to be applied on load
- TextureManager::TextureHash hash; ///< The hash used to cache this Texture
- float scaleFactor; ///< The scale factor to apply to the Texture when masking
- int16_t referenceCount; ///< The reference count of clients using this Texture
- LoadState loadState; ///< The load state showing the load progress of the Texture
- FittingMode::Type fittingMode:3; ///< The requested FittingMode
- Dali::SamplingMode::Type samplingMode:3; ///< The requested SamplingMode
- StorageType storageType; ///< CPU storage / GPU upload;
- Dali::AnimatedImageLoading animatedImageLoading; ///< AnimatedImageLoading that contains animated image information.
- uint32_t frameIndex; ///< frame index that be loaded, in case of animated image
- bool loadSynchronously:1; ///< True if synchronous loading was requested
- UseAtlas useAtlas:2; ///< USE_ATLAS if an atlas was requested.
- ///< This is updated to false if atlas is not used
- bool cropToMask:1; ///< true if the image should be cropped to the mask size.
- bool orientationCorrection:1; ///< true if the image should be rotated to match exif orientation data
- bool preMultiplyOnLoad:1; ///< true if the image's color should be multiplied by it's alpha
- bool preMultiplied:1; ///< true if the image's color was multiplied by it's alpha
+ typedef Dali::Vector<TextureUploadObserver*> ObserverListType;
+
+ ObserverListType observerList; ///< Container used to store all observer clients of this Texture
+ Toolkit::ImageAtlas atlas; ///< The atlas this Texture lays within (if any)
+ Devel::PixelBuffer pixelBuffer; ///< The PixelBuffer holding the image data (May be empty after upload)
+ TextureSet textureSet; ///< The TextureSet holding the Texture
+ VisualUrl url; ///< The URL of the image
+ ImageDimensions desiredSize; ///< The size requested
+ ImageDimensions useSize; ///< The size used
+ Vector4 atlasRect; ///< The atlas rect used if atlased
+ TextureId textureId; ///< The TextureId associated with this Texture
+ TextureId maskTextureId; ///< The mask TextureId to be applied on load
+ TextureManager::TextureHash hash; ///< The hash used to cache this Texture
+ float scaleFactor; ///< The scale factor to apply to the Texture when masking
+ int16_t referenceCount; ///< The reference count of clients using this Texture
+ LoadState loadState; ///< The load state showing the load progress of the Texture
+ FittingMode::Type fittingMode : 3; ///< The requested FittingMode
+ Dali::SamplingMode::Type samplingMode : 3; ///< The requested SamplingMode
+ StorageType storageType; ///< CPU storage / GPU upload;
+ Dali::AnimatedImageLoading animatedImageLoading; ///< AnimatedImageLoading that contains animated image information.
+ uint32_t frameIndex; ///< frame index that be loaded, in case of animated image
+ bool loadSynchronously : 1; ///< True if synchronous loading was requested
+ UseAtlas useAtlas : 2; ///< USE_ATLAS if an atlas was requested.
+ ///< This is updated to false if atlas is not used
+ bool cropToMask : 1; ///< true if the image should be cropped to the mask size.
+ bool orientationCorrection : 1; ///< true if the image should be rotated to match exif orientation data
+ bool preMultiplyOnLoad : 1; ///< true if the image's color should be multiplied by it's alpha
+ bool preMultiplied : 1; ///< true if the image's color was multiplied by it's alpha
};
/**
*/
struct LoadQueueElement
{
- LoadQueueElement( TextureId textureId, TextureUploadObserver* observer )
- : mTextureId( textureId ),
- mObserver( observer )
+ LoadQueueElement(TextureId textureId, TextureUploadObserver* observer)
+ : mTextureId(textureId),
+ mObserver(observer)
{
}
- TextureId mTextureId; ///< The texture id of the requested load.
- TextureUploadObserver* mObserver; ///< Observer of texture load.
+ TextureId mTextureId; ///< The texture id of the requested load.
+ TextureUploadObserver* mObserver; ///< Observer of texture load.
};
/**
*/
struct AsyncLoadingInfo
{
- AsyncLoadingInfo( TextureId textureId )
- : textureId( textureId ),
- loadId( 0 )
+ AsyncLoadingInfo(TextureId textureId)
+ : textureId(textureId),
+ loadId(0)
{
}
- TextureId textureId; ///< The external Texture Id assigned to this load
- uint32_t loadId; ///< The load Id used by the async loader to reference this load
+ TextureId textureId; ///< The external Texture Id assigned to this load
+ uint32_t loadId; ///< The load Id used by the async loader to reference this load
};
// Private typedefs:
- typedef std::deque<AsyncLoadingInfo> AsyncLoadingInfoContainerType; ///< The container type used to manage Asynchronous loads in progress
- typedef std::vector<TextureInfo> TextureInfoContainerType; ///< The container type used to manage the life-cycle and caching of Textures
+ typedef std::deque<AsyncLoadingInfo> AsyncLoadingInfoContainerType; ///< The container type used to manage Asynchronous loads in progress
+ typedef std::vector<TextureInfo> TextureInfoContainerType; ///< The container type used to manage the life-cycle and caching of Textures
/**
* @brief Initiate a load or queue load if NotifyObservers is invoking callbacks
* @param[in] textureInfo The TextureInfo struct associated with the Texture
* @param[in] observer The observer wishing to observe the texture upload
*/
- void LoadOrQueueTexture( TextureInfo& textureInfo, TextureUploadObserver* observer );
+ void LoadOrQueueTexture(TextureInfo& textureInfo, TextureUploadObserver* observer);
/**
* @brief Queue a texture load to be subsequently handled by ProcessQueuedTextures.
* @param[in] textureInfo The TextureInfo struct associated with the Texture
* @param[in] observer The observer wishing to observe the texture upload
*/
- void QueueLoadTexture( TextureInfo& textureInfo, TextureUploadObserver* observer );
+ void QueueLoadTexture(TextureInfo& textureInfo, TextureUploadObserver* observer);
/**
* @brief Used internally to initiate a load.
* @param[in] textureInfo The TextureInfo struct associated with the Texture
* @param[in] observer The observer wishing to observe the texture upload
*/
- void LoadTexture( TextureInfo& textureInfo, TextureUploadObserver* observer );
+ void LoadTexture(TextureInfo& textureInfo, TextureUploadObserver* observer);
/**
* @brief Initiate load of textures queued whilst NotifyObservers invoking callbacks.
* @param[in] textureInfo The TextureInfo struct associated with the texture
* @param[in] observer The observer wishing to observe the texture upload
*/
- void ObserveTexture( TextureInfo & textureInfo, TextureUploadObserver* observer );
+ void ObserveTexture(TextureInfo& textureInfo, TextureUploadObserver* observer);
/**
* @brief This signal handler is called when the async local loader finishes loading.
* @param[in] id This is the async image loaders Id
* @param[in] pixelBuffer The loaded image data
*/
- void AsyncLocalLoadComplete( uint32_t id, Devel::PixelBuffer pixelBuffer );
+ void AsyncLocalLoadComplete(uint32_t id, Devel::PixelBuffer pixelBuffer);
/**
* @brief This signal handler is called when the async local loader finishes loading.
* @param[in] id This is the async image loaders Id
* @param[in] pixelBuffer The loaded image data
*/
- void AsyncRemoteLoadComplete( uint32_t id, Devel::PixelBuffer pixelBuffer );
+ void AsyncRemoteLoadComplete(uint32_t id, Devel::PixelBuffer pixelBuffer);
/**
* Common method to handle loading completion
* @param[in] id This is the async image loaders Id
* @param[in] pixelBuffer The loaded image data
*/
- void AsyncLoadComplete( AsyncLoadingInfoContainerType& container, uint32_t id, Devel::PixelBuffer pixelBuffer );
+ void AsyncLoadComplete(AsyncLoadingInfoContainerType& container, uint32_t id, Devel::PixelBuffer pixelBuffer);
/**
* @brief Performs Post-Load steps including atlasing.
* @param[in] pixelBuffer The image pixelBuffer
* @return True if successful
*/
- void PostLoad( TextureManager::TextureInfo& textureInfo, Devel::PixelBuffer& pixelBuffer );
+ void PostLoad(TextureManager::TextureInfo& textureInfo, Devel::PixelBuffer& pixelBuffer);
/**
* Check if there is a texture waiting to be masked. If there
* is then apply this mask and upload it.
* @param[in] maskTextureInfo The texture info of the mask that has just loaded.
*/
- void CheckForWaitingTexture( TextureInfo& maskTextureInfo );
+ void CheckForWaitingTexture(TextureInfo& maskTextureInfo);
/**
* Apply the mask to the pixelBuffer.
* @param[in] textureInfo The information of texture to apply the mask to
* @param[in] maskTextureId The texture id of the mask.
*/
- void ApplyMask( TextureInfo& textureInfo, TextureId maskTextureId );
+ void ApplyMask(TextureInfo& textureInfo, TextureId maskTextureId);
/**
* Upload the texture specified in pixelBuffer to the appropriate location
* @param[in] textureInfo The texture info containing the location to
* store the data to.
*/
- void UploadTexture( Devel::PixelBuffer& pixelBuffer, TextureInfo& textureInfo );
+ void UploadTexture(Devel::PixelBuffer& pixelBuffer, TextureInfo& textureInfo);
/**
* Creates tiled geometry of for the texture which separates fully-opaque
* @param pixelBuffer
* @param textureInfo
*/
- bool CreateTiledGeometry( const Devel::PixelBuffer& pixelBuffer, TextureInfo& textureInfo );
+ bool CreateTiledGeometry(const Devel::PixelBuffer& pixelBuffer, TextureInfo& textureInfo);
/**
* Mark the texture as complete, and inform observers
* @param[in] textureInfo The struct associated with this Texture
*/
- void UploadComplete( TextureInfo& textureInfo );
+ void UploadComplete(TextureInfo& textureInfo);
/**
* Notify the current observers that the texture upload is complete,
* @param[in] textureInfo The struct associated with this Texture
* @param[in] success If the pixel data was retrieved successfully and uploaded to GPU
*/
- void NotifyObservers( TextureInfo& textureInfo, bool success );
+ void NotifyObservers(TextureInfo& textureInfo, bool success);
/**
* @brief Generates a new, unique TextureId
* @param[in] textureId The TextureId to look up
* @return The cache index
*/
- int GetCacheIndexFromId( TextureId textureId );
-
+ int GetCacheIndexFromId(TextureId textureId);
/**
* @brief Generates a hash for caching based on the input parameters.
* @param[in] maskTextureId The masking texture id (or INVALID_TEXTURE_ID)
* @return A hash of the provided data for caching.
*/
- TextureHash GenerateHash( const std::string& url, const ImageDimensions size,
- const FittingMode::Type fittingMode,
- const Dali::SamplingMode::Type samplingMode, const UseAtlas useAtlas,
- TextureId maskTextureId );
+ TextureHash GenerateHash(const std::string& url, const ImageDimensions size, const FittingMode::Type fittingMode, const Dali::SamplingMode::Type samplingMode, const UseAtlas useAtlas, TextureId maskTextureId);
/**
* @brief Looks up a cached texture by its hash.
*/
TextureManager::TextureId FindCachedTexture(
const TextureManager::TextureHash hash,
- const std::string& url,
- const ImageDimensions size,
- const FittingMode::Type fittingMode,
- const Dali::SamplingMode::Type samplingMode,
- const bool useAtlas,
- TextureId maskTextureId,
- MultiplyOnLoad preMultiplyOnLoad);
+ const std::string& url,
+ const ImageDimensions size,
+ const FittingMode::Type fittingMode,
+ const Dali::SamplingMode::Type samplingMode,
+ const bool useAtlas,
+ TextureId maskTextureId,
+ MultiplyOnLoad preMultiplyOnLoad);
private:
-
/**
* @brief Helper class to keep the relation between AsyncImageLoader and corresponding LoadingInfo container
*/
* @param[in] animatedImageLoading The AnimatedImageLoading to load animated image
* @param[in] frameIndex The frame index of a frame to be loaded frame
*/
- void LoadAnimatedImage( TextureId textureId,
- Dali::AnimatedImageLoading animatedImageLoading,
- uint32_t frameIndex);
+ void LoadAnimatedImage(TextureId textureId,
+ Dali::AnimatedImageLoading animatedImageLoading,
+ uint32_t frameIndex);
/**
* @brief Load a new texture.
* e.g., from portrait to landscape
* @param[in] preMultiplyOnLoad if the image's color should be multiplied by it's alpha. Set to OFF if there is no alpha or if the image need to be applied alpha mask.
*/
- void Load(TextureId textureId,
- const VisualUrl& url,
- ImageDimensions desiredSize,
- FittingMode::Type fittingMode,
- SamplingMode::Type samplingMode,
- bool orientationCorrection,
+ void Load(TextureId textureId,
+ const VisualUrl& url,
+ ImageDimensions desiredSize,
+ FittingMode::Type fittingMode,
+ SamplingMode::Type samplingMode,
+ bool orientationCorrection,
DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad);
/**
* @param [in] cropToMask Whether to crop the content to the mask size
* @param [in] preMultiplyOnLoad if the image's color should be multiplied by it's alpha. Set to OFF if there is no alpha.
*/
- void ApplyMask( TextureId textureId,
- Devel::PixelBuffer pixelBuffer,
- Devel::PixelBuffer maskPixelBuffer,
- float contentScale,
- bool cropToMask,
- DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad );
+ void ApplyMask(TextureId textureId,
+ Devel::PixelBuffer pixelBuffer,
+ Devel::PixelBuffer maskPixelBuffer,
+ float contentScale,
+ bool cropToMask,
+ DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad);
public:
AsyncLoadingHelper(const AsyncLoadingHelper&) = delete;
AsyncLoadingHelper& operator=(const AsyncLoadingHelper&) = delete;
AsyncLoadingHelper(AsyncLoadingHelper&& rhs);
- AsyncLoadingHelper& operator=(AsyncLoadingHelper&&rhs) = delete;
+ AsyncLoadingHelper& operator=(AsyncLoadingHelper&& rhs) = delete;
private:
/**
* @brief Main constructor that used by all other constructors
*/
- AsyncLoadingHelper( Toolkit::AsyncImageLoader loader,
- TextureManager& textureManager,
- AsyncLoadingInfoContainerType&& loadingInfoContainer );
+ AsyncLoadingHelper(Toolkit::AsyncImageLoader loader,
+ TextureManager& textureManager,
+ AsyncLoadingInfoContainerType&& loadingInfoContainer);
/**
* @brief Callback to be called when texture loading is complete, it passes the pixel buffer on to texture manager.
* @param[in] id Loader id
* @param[in] pixelBuffer Image data
*/
- void AsyncLoadComplete( uint32_t id, Devel::PixelBuffer pixelBuffer );
+ void AsyncLoadComplete(uint32_t id, Devel::PixelBuffer pixelBuffer);
private:
Toolkit::AsyncImageLoader mLoader;
struct ExternalTextureInfo
{
- TextureId textureId;
+ TextureId textureId;
TextureSet textureSet;
};
private:
-
/**
* Deleted copy constructor.
*/
- TextureManager( const TextureManager& ) = delete;
+ TextureManager(const TextureManager&) = delete;
/**
* Deleted assignment operator.
*/
- TextureManager& operator=( const TextureManager& rhs ) = delete;
+ TextureManager& operator=(const TextureManager& rhs) = delete;
/**
* This is called by the TextureManagerUploadObserver when an observer is destroyed.
* We use the callback to know when to remove an observer from our notify list.
* @param[in] observer The observer that generated the callback
*/
- void ObserverDestroyed( TextureUploadObserver* observer );
-
-private: // Member Variables:
-
- TextureInfoContainerType mTextureInfoContainer; ///< Used to manage the life-cycle and caching of Textures
- RoundRobinContainerView< AsyncLoadingHelper > mAsyncLocalLoaders; ///< The Asynchronous image loaders used to provide all local async loads
- RoundRobinContainerView< AsyncLoadingHelper > mAsyncRemoteLoaders; ///< The Asynchronous image loaders used to provide all remote async loads
- std::vector< ExternalTextureInfo > mExternalTextures; ///< Externally provided textures
- Dali::Vector<LifecycleObserver*> mLifecycleObservers; ///< Lifecycle observers of texture manager
- Dali::Vector<LoadQueueElement> mLoadQueue; ///< Queue of textures to load after NotifyObservers
- TextureId mCurrentTextureId; ///< The current value used for the unique Texture Id generation
- bool mQueueLoadFlag; ///< Flag that causes Load Textures to be queued.
+ void ObserverDestroyed(TextureUploadObserver* observer);
+
+private: // Member Variables:
+ TextureInfoContainerType mTextureInfoContainer; ///< Used to manage the life-cycle and caching of Textures
+ RoundRobinContainerView<AsyncLoadingHelper> mAsyncLocalLoaders; ///< The Asynchronous image loaders used to provide all local async loads
+ RoundRobinContainerView<AsyncLoadingHelper> mAsyncRemoteLoaders; ///< The Asynchronous image loaders used to provide all remote async loads
+ std::vector<ExternalTextureInfo> mExternalTextures; ///< Externally provided textures
+ Dali::Vector<LifecycleObserver*> mLifecycleObservers; ///< Lifecycle observers of texture manager
+ Dali::Vector<LoadQueueElement> mLoadQueue; ///< Queue of textures to load after NotifyObservers
+ TextureId mCurrentTextureId; ///< The current value used for the unique Texture Id generation
+ bool mQueueLoadFlag; ///< Flag that causes Load Textures to be queued.
};
-
-} // name Internal
+} // namespace Internal
} // namespace Toolkit
#define DALI_TOOLKIT_INTERNAL_TEXTURE_UPLOAD_OBSERVER_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/signals/dali-signal.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/dali-toolkit-common.h>
#include <dali-toolkit/internal/visuals/visual-url.h>
+#include <dali-toolkit/public-api/dali-toolkit-common.h>
namespace Dali
{
-
class TextureSet;
namespace Toolkit
{
-
-
/**
* @brief Base class used to observe the upload status of a texture.
*
class TextureUploadObserver
{
public:
-
- typedef Signal< void ( TextureUploadObserver* ) > DestructionSignalType; ///< Signal prototype for the Destruction Signal.
+ typedef Signal<void(TextureUploadObserver*)> DestructionSignalType; ///< Signal prototype for the Destruction Signal.
/**
* @brief Constructor.
* @param[in] atlasRect If using atlasing, this is the rectangle within the atlas to use.
* @param[in] preMultiplied True if the image had pre-multiplied alpha applied
*/
- virtual void UploadComplete( bool loadSuccess, int32_t textureId, TextureSet textureSet, bool useAtlasing,
- const Vector4& atlasRect, bool preMultiplied ) = 0;
+ virtual void UploadComplete(bool loadSuccess, int32_t textureId, TextureSet textureSet, bool useAtlasing, const Vector4& atlasRect, bool preMultiplied) = 0;
/**
* The action to be taken once the async load has finished.
* @param[in] url The url address of the loaded image.
* @param[in] preMultiplied True if the image had pre-multiplied alpha applied
*/
- virtual void LoadComplete( bool loadSuccess, Devel::PixelBuffer pixelBuffer, const Internal::VisualUrl& url, bool preMultiplied ) = 0;
+ virtual void LoadComplete(bool loadSuccess, Devel::PixelBuffer pixelBuffer, const Internal::VisualUrl& url, bool preMultiplied) = 0;
/**
* @brief Returns the destruction signal.
DestructionSignalType& DestructionSignal();
private:
-
DestructionSignalType mDestructionSignal; ///< The destruction signal emitted when the observer is destroyed.
-
};
-
} // namespace Toolkit
} // namespace Dali
#define DALI_TOOLKIT_INTERNAL_TRANSITION_DATA_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/object/base-object.h>
+#include <dali/devel-api/common/owner-container.h>
#include <dali/public-api/animation/alpha-function.h>
+#include <dali/public-api/object/base-object.h>
#include <dali/public-api/object/property-key.h>
-#include <dali/devel-api/common/owner-container.h>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/visual-factory/transition-data.h>
{
namespace Internal
{
-
class TransitionData;
typedef IntrusivePtr<TransitionData> TransitionDataPtr;
class TransitionData : public BaseObject
{
public:
-
/**
* @brief TransitionDataElement Describes one animator of an transition.
*/
struct Animator
{
Animator()
- : propertyKey( Property::INVALID_INDEX ),
- alphaFunction( AlphaFunction::DEFAULT ),
- timePeriodDelay( 0.0f ),
- timePeriodDuration( 1.0f ),
+ : propertyKey(Property::INVALID_INDEX),
+ alphaFunction(AlphaFunction::DEFAULT),
+ timePeriodDelay(0.0f),
+ timePeriodDuration(1.0f),
animate(false)
{
}
- std::string objectName; ///< An identifier of the actor or visual
- Property::Key propertyKey; ///< A property key of the property owner
- Property::Value initialValue; ///< The value to set at the start of the transition
- Property::Value targetValue; ///< The value to set or animate to
+ std::string objectName; ///< An identifier of the actor or visual
+ Property::Key propertyKey; ///< A property key of the property owner
+ Property::Value initialValue; ///< The value to set at the start of the transition
+ Property::Value targetValue; ///< The value to set or animate to
Dali::AlphaFunction alphaFunction;
- float timePeriodDelay;
- float timePeriodDuration;
- bool animate;
+ float timePeriodDelay;
+ float timePeriodDuration;
+ bool animate;
};
/**
* @brief TransitionData holds the required data required to define an
* transition to be performed on a property owner
*/
- typedef Dali::OwnerContainer< Animator* > AnimatorList;
- typedef AnimatorList::Iterator Iterator;
+ typedef Dali::OwnerContainer<Animator*> AnimatorList;
+ typedef AnimatorList::Iterator Iterator;
public:
/**
* @copydoc Dali::Transition::New()
*/
- static TransitionDataPtr New( const Property::Array& value );
+ static TransitionDataPtr New(const Property::Array& value);
/**
* @copydoc Dali::Transition::New()
*/
- static TransitionDataPtr New( const Property::Map& value );
+ static TransitionDataPtr New(const Property::Map& value);
/**
* @brief Iterator to the beginning of the data
/**
* @copydoc Dali::Transition::GetAnimatorAt()
*/
- Property::Map GetAnimatorAt( size_t index );
+ Property::Map GetAnimatorAt(size_t index);
private: // Implementation
/**
/**
* Second stage initialiazation
*/
- void Initialize( const Property::Map& value );
+ void Initialize(const Property::Map& value);
/**
* Second stage initialiazation
*/
- void Initialize( const Property::Array& value );
+ void Initialize(const Property::Array& value);
/**
* @brief Adds one Animator to the list to describe a transition.
* @param[in] animator An animator data structure
*/
- void Add( Animator* animator );
+ void Add(Animator* animator);
/**
* Convert a Property map into Animator data
*/
- Animator* ConvertMap( const Property::Map& map );
+ Animator* ConvertMap(const Property::Map& map);
protected:
/**
~TransitionData() override;
private: // Unimplemented methods
- TransitionData( const TransitionData& );
- TransitionData& operator=( const TransitionData& );
+ TransitionData(const TransitionData&);
+ TransitionData& operator=(const TransitionData&);
-private: // Data members
+private: // Data members
AnimatorList mAnimators; ///< A vector of individual property transitions from which to generate a Dali::Animation.
};
} // namespace Internal
// Helpers for public-api forwarding methods
-inline Internal::TransitionData& GetImplementation( Dali::Toolkit::TransitionData& handle )
+inline Internal::TransitionData& GetImplementation(Dali::Toolkit::TransitionData& handle)
{
DALI_ASSERT_ALWAYS(handle && "TransitionData handle is empty");
BaseObject& object = handle.GetBaseObject();
return static_cast<Internal::TransitionData&>(object);
}
-inline const Internal::TransitionData& GetImplementation( const Dali::Toolkit::TransitionData& handle )
+inline const Internal::TransitionData& GetImplementation(const Dali::Toolkit::TransitionData& handle)
{
DALI_ASSERT_ALWAYS(handle && "TransitionData handle is empty");
const BaseObject& object = handle.GetBaseObject();
} // namespace Toolkit
} // namespace Dali
-
#endif // DALI_TOOLKIT_INTERNAL_TRANSITION_DATA_H
#define DALI_TOOLKIT_INTERNAL_VISUAL_BASE_DATA_IMPL_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/rendering/renderer.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
#include <dali-toolkit/internal/visuals/visual-event-observer.h>
#include <dali-toolkit/public-api/align-enumerations.h>
#include <dali-toolkit/public-api/visuals/visual-properties.h>
-#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
namespace Visual
{
-
struct Base::Impl
{
/**
* @param [in] fittingMode that the derived class prefers
* @param [in] type The type of the this visual
*/
- Impl( FittingMode fittingMode, Toolkit::Visual::Type type );
+ Impl(FittingMode fittingMode, Toolkit::Visual::Type type);
/**
* Destructor
enum Flags
{
- IS_ON_SCENE = 1,
- IS_ATLASING_APPLIED = 1<<1,
- IS_PREMULTIPLIED_ALPHA = 1 << 2,
+ IS_ON_SCENE = 1,
+ IS_ATLASING_APPLIED = 1 << 1,
+ IS_PREMULTIPLIED_ALPHA = 1 << 2,
IS_SYNCHRONOUS_RESOURCE_LOADING = 1 << 3
};
struct CustomShader
{
- CustomShader( const Property::Map& map );
- void SetPropertyMap( const Property::Map& map );
- void CreatePropertyMap( Property::Map& map ) const;
+ CustomShader(const Property::Map& map);
+ void SetPropertyMap(const Property::Map& map);
+ void CreatePropertyMap(Property::Map& map) const;
- std::string mVertexShader;
- std::string mFragmentShader;
- Dali::ImageDimensions mGridSize;
+ std::string mVertexShader;
+ std::string mFragmentShader;
+ Dali::ImageDimensions mGridSize;
Dali::Shader::Hint::Value mHints; //(bitfield) values from enum Shader::Hint
};
* attributes, and sets the remaining attributes to their default
* values.
*/
- void SetPropertyMap( const Property::Map& map );
+ void SetPropertyMap(const Property::Map& map);
/**
* Add the transform attributes to the map (using integer keys)
*/
- void GetPropertyMap( Property::Map& map ) const;
+ void GetPropertyMap(Property::Map& map) const;
/**
* Update zero or more attributes from the property map.
*/
- void UpdatePropertyMap( const Property::Map& map );
+ void UpdatePropertyMap(const Property::Map& map);
/**
* Register or set the uniform properties onto the renderer
*/
- void RegisterUniforms( Renderer renderer, Toolkit::Direction::Type direction );
+ void RegisterUniforms(Renderer renderer, Toolkit::Direction::Type direction);
/**
* Convert the control size and the transform attributes into the actual
* size of the visual.
*/
- Vector2 GetVisualSize( const Vector2& controlSize );
+ Vector2 GetVisualSize(const Vector2& controlSize);
- Vector2 mOffset;
- Vector2 mSize;
- Vector2 mExtraSize;
- Vector4 mOffsetSizeMode;
+ Vector2 mOffset;
+ Vector2 mSize;
+ Vector2 mExtraSize;
+ Vector4 mOffsetSizeMode;
Toolkit::Align::Type mOrigin;
Toolkit::Align::Type mAnchorPoint;
Property::Index mOffsetIndex;
Property::Index mSizeIndex;
};
- Renderer mRenderer;
- CustomShader* mCustomShader;
- EventObserver* mEventObserver; ///< Allows controls to observe when the visual has events to notify
- std::string mName;
- Transform mTransform;
- Vector4 mMixColor;
- Size mControlSize;
- float mCornerRadius;
- float mCornerRadiusPolicy;
- int mDepthIndex;
- Property::Index mMixColorIndex;
- Property::Index mCornerRadiusIndex;
- FittingMode mFittingMode; //< How the contents should fit the view
- int mFlags;
- Toolkit::Visual::ResourceStatus mResourceStatus;
- const Toolkit::Visual::Type mType;
- bool mNeedCornerRadius;
+ Renderer mRenderer;
+ CustomShader* mCustomShader;
+ EventObserver* mEventObserver; ///< Allows controls to observe when the visual has events to notify
+ std::string mName;
+ Transform mTransform;
+ Vector4 mMixColor;
+ Size mControlSize;
+ float mCornerRadius;
+ float mCornerRadiusPolicy;
+ int mDepthIndex;
+ Property::Index mMixColorIndex;
+ Property::Index mCornerRadiusIndex;
+ FittingMode mFittingMode; //< How the contents should fit the view
+ int mFlags;
+ Toolkit::Visual::ResourceStatus mResourceStatus;
+ const Toolkit::Visual::Type mType;
+ bool mNeedCornerRadius;
};
} // namespace Visual
#include <dali/public-api/rendering/shader.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+#include <dali-toolkit/devel-api/direction-enums.h>
#include <dali-toolkit/devel-api/visual-factory/visual-base.h>
+#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/internal/visuals/transition-data-impl.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
-#include <dali-toolkit/devel-api/direction-enums.h>
#include <dali-toolkit/public-api/visuals/visual-properties.h>
-#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
namespace Visual
{
-
class EventObserver;
using FittingMode = DevelVisual::FittingMode;
class Base : public BaseObject
{
public:
-
/**
* Setting the properties of the visual, this API should only called by the VisualFactory
* @param[in] propertyMap The properties for the requested Visual object.
*/
- void SetProperties( const Property::Map& propertyMap );
+ void SetProperties(const Property::Map& propertyMap);
/**
* @copydoc Toolkit::Visual::Base::SetName
*/
- void SetName( const std::string& name );
+ void SetName(const std::string& name);
/**
* @copydoc Toolkit::Visual::Base::GetName
/**
* @copydoc Toolkit::Visual::Base::SetSize
*/
- void SetTransformAndSize( const Property::Map& transform, Size controlSize );
+ void SetTransformAndSize(const Property::Map& transform, Size controlSize);
/**
* @brief Performs an action on the visual with the given action name and attributes.
* @param[in] actionName The name of the action to perform this API only takes an Index
* @param[in] attributes The list of attributes for the action. ( optional for this data structure to have content )
*/
- void DoAction( const Dali::Property::Index actionName, const Dali::Property::Value attributes );
+ void DoAction(const Dali::Property::Index actionName, const Dali::Property::Value attributes);
/**
* @copydoc Toolkit::Visual::Base::GetHeightForWidth
*/
- virtual float GetHeightForWidth( float width );
+ virtual float GetHeightForWidth(float width);
/**
* @copydoc Toolkit::Visual::Base::GetWidthForHeight
*/
- virtual float GetWidthForHeight( float height );
+ virtual float GetWidthForHeight(float height);
/**
* @copydoc Toolkit::Visual::Base::GetNaturalSize
*/
- virtual void GetNaturalSize( Vector2& naturalSize );
+ virtual void GetNaturalSize(Vector2& naturalSize);
/**
* @copydoc Toolkit::Visual::Base::SetDepthIndex
*/
- void SetDepthIndex( int index );
+ void SetDepthIndex(int index);
/**
* @copydoc Toolkit::Visual::Base::GetDepthIndex
* @copydoc Toolkit::Visual::Base::SetOnScene
* @pre Impl->mGeometry must be created before this method is called
*/
- void SetOnScene( Actor& actor );
+ void SetOnScene(Actor& actor);
/**
* @copydoc Toolkit::Visual::Base::SetOffScene
*/
- void SetOffScene( Actor& actor );
+ void SetOffScene(Actor& actor);
/**
* @copydoc Toolkit::Visual::Base::CreatePropertyMap
*/
- void CreatePropertyMap( Property::Map& map ) const;
+ void CreatePropertyMap(Property::Map& map) const;
/**
* @brief Create a property map containing per-instance visual properties.
* (e.g. for image visual, the desired size, and for text visual, the actual text).
* @param[in] map The property map into which to write
*/
- void CreateInstancePropertyMap( Property::Map& map ) const;
+ void CreateInstancePropertyMap(Property::Map& map) const;
/**
* @brief Set whether the Pre-multiplied Alpha Blending is required
*
* @param[in] preMultiplied whether alpha is pre-multiplied.
*/
- void EnablePreMultipliedAlpha( bool preMultiplied );
+ void EnablePreMultipliedAlpha(bool preMultiplied);
/**
* @brief Query whether alpha is pre-multiplied.
* @brief Sets properties of custom shader
* @param[in] propertyMap Property map containing the custom shader data
*/
- void SetCustomShader( const Property::Map& propertyMap );
+ void SetCustomShader(const Property::Map& propertyMap);
/**
* @copydoc Toolkit::Visual::Base::SetProperty
*/
- void SetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue );
+ void SetProperty(Dali::Property::Index index, const Dali::Property::Value& propertyValue);
/**
* @copydoc Toolkit::Visual::Base::GetProperty
*/
- Dali::Property::Value GetProperty( Dali::Property::Index index );
+ Dali::Property::Value GetProperty(Dali::Property::Index index);
/**
* Gets currently staged renderer, or an empty handle if not staged
* Sets the mix color ( including opacity ) of the visual.
* @param[in] mixColor The new mix color
*/
- void SetMixColor( const Vector4& color );
+ void SetMixColor(const Vector4& color);
/**
* Sets the mix color of the visual.
* @param[in] mixColor The new mix color
*/
- void SetMixColor( const Vector3& color );
+ void SetMixColor(const Vector3& color);
/**
* Animate the property if it exists in the visual or renderer.
* @param[in] transition The animation to create or attach to
* @param[in] animator The animation parameters of the property.
*/
- void AnimateProperty( Dali::Animation& transition,
- Internal::TransitionData::Animator& animator );
+ void AnimateProperty(Dali::Animation& transition,
+ Internal::TransitionData::Animator& animator);
/**
* @brief Add an observer to watch for when the Visuals have events to notify
* Currently only supports a single observer
*/
- void AddEventObserver( Visual::EventObserver& observer );
+ void AddEventObserver(Visual::EventObserver& observer);
/**
* @brief Remove an observer
*/
- void RemoveEventObserver( Visual::EventObserver& observer );
+ void RemoveEventObserver(Visual::EventObserver& observer);
/**
* @brief Called when the visuals resources are loaded / ready
*/
- void ResourceReady( Toolkit::Visual::ResourceStatus resourceStatus );
+ void ResourceReady(Toolkit::Visual::ResourceStatus resourceStatus);
/**
* @brief Called when the visuals resources are loaded / ready
* @param[in] fittingMode The value that determines how the visual should be fit to the view
* @param[in] type The type of the this visual
*/
- Base( VisualFactoryCache& factoryCache, FittingMode fittingMode, Toolkit::Visual::Type type );
+ Base(VisualFactoryCache& factoryCache, FittingMode fittingMode, Toolkit::Visual::Type type);
/**
* @brief A reference counted object may only be deleted by calling Unreference().
*
* @param[out] map The visual property map.
*/
- virtual void DoCreatePropertyMap( Property::Map& map ) const = 0;
+ virtual void DoCreatePropertyMap(Property::Map& map) const = 0;
/**
* @brief Called by CreateInstancePropertyMap() allowing derived
*
* @param[out] map The visual property map
*/
- virtual void DoCreateInstancePropertyMap( Property::Map& map ) const = 0;
+ virtual void DoCreateInstancePropertyMap(Property::Map& map) const = 0;
/**
* @brief Called by SetProperties() allowing sub classes to set their properties
*
* @param[in] propertyMap The properties for the requested Visual object.
*/
- virtual void DoSetProperties( const Property::Map& propertyMap ) = 0;
+ virtual void DoSetProperties(const Property::Map& propertyMap) = 0;
/**
* @brief Called when transform or control size changes
*
* @param[in] actor The actor applying this visual.
*/
- virtual void DoSetOnScene( Actor& actor ) = 0;
+ virtual void DoSetOnScene(Actor& actor) = 0;
/**
* @brief Called by SetOffScene() allowing sub classes to respond to the SetOffScene event
*
* @param[in] actor The actor applying this visual.
*/
- virtual void DoSetOffScene( Actor& actor );
+ virtual void DoSetOffScene(Actor& actor);
/**
* @brief Called by DoAction() allowing sub classes to do the given action.
* @param[in] actionId The action to perform
* @param[in] attributes The list of attributes for the action. ( optional for this data structure to have content )
*/
- virtual void OnDoAction( const Property::Index actionId, const Property::Value& attributes );
+ virtual void OnDoAction(const Property::Index actionId, const Property::Value& attributes);
/**
* @brief Update the shader when some properties are changed.
}
protected:
-
/**
* @brief Gets the on scene state for this Visual
*
bool IsRoundedCornerRequired() const;
private:
-
/**
* Register the mix color uniform on the Renderer and store the property index.
* Note, this is not used by Color or Primitive Visuals, which will use their
* @param[in] key The key to match.
* @return the matching index, or INVALID_INDEX if it's not found
*/
- Property::Index GetPropertyIndex( Property::Key key );
+ Property::Index GetPropertyIndex(Property::Key key);
/**
* Set up the transition. If no animation is required, then
* @param[in] initialValue The optional initial value
* @param[in] targetValue The target value to use
*/
- void SetupTransition( Dali::Animation& transition,
- Internal::TransitionData::Animator& animator,
- Property::Index index,
- Property::Value& initialValue,
- Property::Value& targetValue );
+ void SetupTransition(Dali::Animation& transition,
+ Internal::TransitionData::Animator& animator,
+ Property::Index index,
+ Property::Value& initialValue,
+ Property::Value& targetValue);
/**
* Animate the opacity property - Special handling to
* @param[in] transition The transition to use or set up.
* @param[in] animator The animation data to use
*/
- void AnimateOpacityProperty( Dali::Animation& transition,
- Internal::TransitionData::Animator& animator );
+ void AnimateOpacityProperty(Dali::Animation& transition,
+ Internal::TransitionData::Animator& animator);
/**
* Animate the renderer property - no special handling
* @param[in] transition The transition to use or set up.
* @param[in] animator The animation data to use
*/
- void AnimateRendererProperty( Dali::Animation& transition,
- Internal::TransitionData::Animator& animator );
+ void AnimateRendererProperty(Dali::Animation& transition,
+ Internal::TransitionData::Animator& animator);
/**
* Animate the mix color property.
* @param[in] transition The transition to use or set up.
* @param[in] animator The animation data to use
*/
- void AnimateMixColorProperty( Dali::Animation& transition,
- Internal::TransitionData::Animator& animator );
+ void AnimateMixColorProperty(Dali::Animation& transition,
+ Internal::TransitionData::Animator& animator);
// Undefined
- Base( const Visual::Base& visual );
+ Base(const Visual::Base& visual);
// Undefined
- Base& operator=( const Visual::Base& visual );
+ Base& operator=(const Visual::Base& visual);
protected:
struct Impl;
- Impl* mImpl;
+ Impl* mImpl;
VisualFactoryCache& mFactoryCache;
};
typedef IntrusivePtr<Base> BasePtr;
-} // namspace Visual
+} // namespace Visual
} // namespace Internal
-inline const Internal::Visual::Base& GetImplementation(const Toolkit::Visual::Base& visualBase )
+inline const Internal::Visual::Base& GetImplementation(const Toolkit::Visual::Base& visualBase)
{
- DALI_ASSERT_ALWAYS( visualBase && "visual base handle is empty" );
+ DALI_ASSERT_ALWAYS(visualBase && "visual base handle is empty");
const BaseObject& handle = visualBase.GetBaseObject();
inline Internal::Visual::Base& GetImplementation(Toolkit::Visual::Base& visualBase)
{
- DALI_ASSERT_ALWAYS( visualBase && "visual base handle is empty" );
+ DALI_ASSERT_ALWAYS(visualBase && "visual base handle is empty");
BaseObject& handle = visualBase.GetBaseObject();
#define DALI_INTERNAL_TOOLKIT_VISUAL_EVENT_OBSERVER_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
{
namespace Visual
{
-
class Base;
/**
class EventObserver
{
public:
-
/**
* Inform the observer of the object when a resource is ready.
* @param[in] object The connection owner
*/
- virtual void ResourceReady( Visual::Base& object ) = 0;
+ virtual void ResourceReady(Visual::Base& object) = 0;
/**
* Inform the observer of the object when an event occurs.
* @param[in] object The connection owner
* @param[in] signalId The signal to emit. See Visual to find supported signals
*/
- virtual void NotifyVisualEvent( Visual::Base& object, Property::Index signalId ) = 0;
+ virtual void NotifyVisualEvent(Visual::Base& object, Property::Index signalId) = 0;
protected:
-
/**
* constructor
*/
}
// Undefined copy constructor.
- EventObserver( const EventObserver& ) = delete;
+ EventObserver(const EventObserver&) = delete;
// Undefined assignment operator.
- EventObserver& operator=( const EventObserver& ) = delete;
+ EventObserver& operator=(const EventObserver&) = delete;
};
-} // Visual
-} // Internal
-} // Toolkit
-} // Dali
+} // namespace Visual
+} // namespace Internal
+} // namespace Toolkit
+} // namespace Dali
#endif // DALI_INTERNAL_TOOLKIT_VISUAL_EVENT_OBSERVER_H
#define DALI_TOOLKIT_VISUAL_FACTORY_CACHE_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
+#include <dali/devel-api/common/owner-container.h>
#include <dali/public-api/math/uint-16-pair.h>
#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/rendering/geometry.h>
#include <dali/public-api/rendering/shader.h>
-#include <dali/devel-api/common/owner-container.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/visuals/npatch-loader.h>
namespace Toolkit
{
-
namespace Internal
{
class ImageAtlasManager;
typedef IntrusivePtr<ImageAtlasManager> ImageAtlasManagerPtr;
-
/**
* Caches shaders and geometries. Owned by VisualFactory.
*/
class VisualFactoryCache
{
public:
-
/**
* Type of shader for caching.
*/
};
public:
-
/**
* @brief Constructor
*
* @param[in] preMultiplyOnLoad True if image visuals should pre-multiply alpha on image load.
*/
- VisualFactoryCache( bool preMultiplyOnLoad );
+ VisualFactoryCache(bool preMultiplyOnLoad);
/**
* @brief Destructor
* Request geometry of the given type.
* @return The geometry of the required type if it exist in the cache. Otherwise, an empty handle is returned.
*/
- Geometry GetGeometry( GeometryType type );
+ Geometry GetGeometry(GeometryType type);
/**
* Cache the geometry of the give type.
* @param[in] type The geometry type.
* @param[in] geometry The geometry for caching.
*/
- void SaveGeometry( GeometryType type, Geometry geometry);
+ void SaveGeometry(GeometryType type, Geometry geometry);
/**
* Request shader of the given type.
* @return The shader of the required type if it exist in the cache. Otherwise, an empty handle is returned.
*/
- Shader GetShader( ShaderType type );
+ Shader GetShader(ShaderType type);
/**
* Cache the geometry of the give type.
* @param[in] type The geometry type.
* @param[in] geometry The geometry for caching.
*/
- void SaveShader( ShaderType type, Shader shader );
+ void SaveShader(ShaderType type, Shader shader);
/*
* Greate the quad geometry.
* @param[in] gridSize The size of the grid.
* @return The created grid geometry.
*/
- static Geometry CreateGridGeometry( Uint16Pair gridSize );
+ static Geometry CreateGridGeometry(Uint16Pair gridSize);
/**
* @brief Returns a new Texture to use when a visual has failed to correctly render
/**
* @copydoc Toolkit::VisualFactory::SetPreMultiplyOnLoad()
*/
- void SetPreMultiplyOnLoad( bool preMultiply );
+ void SetPreMultiplyOnLoad(bool preMultiply);
/**
* @copydoc Toolkit::VisualFactory::GetPreMultiplyOnLoad()
VectorAnimationManager& GetVectorAnimationManager();
protected:
-
/**
* Undefined copy constructor.
*/
VisualFactoryCache& operator=(const VisualFactoryCache& rhs);
private:
- Geometry mGeometry[GEOMETRY_TYPE_MAX+1];
- Shader mShader[SHADER_TYPE_MAX+1];
-
- ImageAtlasManagerPtr mAtlasManager;
- TextureManager mTextureManager;
- NPatchLoader mNPatchLoader;
- Texture mBrokenImageTexture;
- SvgRasterizeThread* mSvgRasterizeThread;
- std::unique_ptr< VectorAnimationManager > mVectorAnimationManager;
- std::string mBrokenImageUrl;
- bool mPreMultiplyOnLoad;
+ Geometry mGeometry[GEOMETRY_TYPE_MAX + 1];
+ Shader mShader[SHADER_TYPE_MAX + 1];
+
+ ImageAtlasManagerPtr mAtlasManager;
+ TextureManager mTextureManager;
+ NPatchLoader mNPatchLoader;
+ Texture mBrokenImageTexture;
+ SvgRasterizeThread* mSvgRasterizeThread;
+ std::unique_ptr<VectorAnimationManager> mVectorAnimationManager;
+ std::string mBrokenImageUrl;
+ bool mPreMultiplyOnLoad;
};
} // namespace Internal
#define DALI_TOOLKIT_VISUAL_FACTORY_IMPL_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/object/base-object.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+#include <dali-toolkit/devel-api/styling/style-manager-devel.h>
#include <dali-toolkit/devel-api/visual-factory/visual-base.h>
+#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
#include <dali-toolkit/public-api/styling/style-manager.h>
-#include <dali-toolkit/devel-api/styling/style-manager-devel.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class VisualFactoryCache;
class ImageVisualShaderFactory;
class VisualFactory : public BaseObject
{
public:
-
/**
* @brief Constructor
*
* @param[in] debugEnabled If true, use debug renderer to replace all the concrete renderer.
*/
- VisualFactory( bool debugEnabled );
+ VisualFactory(bool debugEnabled);
/**
* @brief StyleChanged callback
* @param[in] styleManager Handle for style manager.
* @param[in] type Style change type.
*/
- void OnStyleChangedSignal( Toolkit::StyleManager styleManager, StyleChange::Type type );
+ void OnStyleChangedSignal(Toolkit::StyleManager styleManager, StyleChange::Type type);
/**
* @copydoc Toolkit::VisualFactory::CreateVisual( const Property::Map& )
*/
- Toolkit::Visual::Base CreateVisual( const Property::Map& propertyMap );
+ Toolkit::Visual::Base CreateVisual(const Property::Map& propertyMap);
/**
* @copydoc Toolkit::VisualFactory::CreateVisual( const std::string&, ImageDimensions )
*/
- Toolkit::Visual::Base CreateVisual( const std::string& image, ImageDimensions size );
+ Toolkit::Visual::Base CreateVisual(const std::string& image, ImageDimensions size);
/**
* @copydoc Toolkit::VisualFactory::SetPreMultiplyOnLoad()
*/
- void SetPreMultiplyOnLoad( bool preMultiply );
+ void SetPreMultiplyOnLoad(bool preMultiply);
/**
* @copydoc Toolkit::VisualFactory::GetPreMultiplyOnLoad()
Internal::TextureManager& GetTextureManager();
protected:
-
/**
* A reference counted object may only be deleted by calling Unreference()
*/
VisualFactory& operator=(const VisualFactory& rhs) = delete;
private:
- std::unique_ptr< VisualFactoryCache > mFactoryCache;
- std::unique_ptr< ImageVisualShaderFactory > mImageVisualShaderFactory;
- SlotDelegate< VisualFactory > mSlotDelegate;
- bool mDebugEnabled:1;
- bool mPreMultiplyOnLoad:1; ///< Local store for this flag
+ std::unique_ptr<VisualFactoryCache> mFactoryCache;
+ std::unique_ptr<ImageVisualShaderFactory> mImageVisualShaderFactory;
+ SlotDelegate<VisualFactory> mSlotDelegate;
+ bool mDebugEnabled : 1;
+ bool mPreMultiplyOnLoad : 1; ///< Local store for this flag
};
/**
* @param[in] param0 First template based argument passed to the visual factory
* @param[in] param1 Second template based argument passed to the visual factory
*/
-template< class ParameterType0, class ParameterType1 >
-void InitializeVisual( Actor& actor, Toolkit::Visual::Base& visual, ParameterType0& param0, ParameterType1& param1 )
+template<class ParameterType0, class ParameterType1>
+void InitializeVisual(Actor& actor, Toolkit::Visual::Base& visual, ParameterType0& param0, ParameterType1& param1)
{
- if( actor )
+ if(actor)
{
- Toolkit::GetImplementation(visual).SetOffScene( actor );
+ Toolkit::GetImplementation(visual).SetOffScene(actor);
}
- visual = Toolkit::VisualFactory::Get().CreateVisual( param0, param1 );
- if( visual && actor && actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) )
+ visual = Toolkit::VisualFactory::Get().CreateVisual(param0, param1);
+ if(visual && actor && actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE))
{
Toolkit::GetImplementation(visual).SetOnScene(actor);
}
* @param[in,out] visual The visual to be replaced
* @param[in] param Template based argument passed to the visual factory
*/
-template< class ParameterType >
-void InitializeVisual( Actor& actor, Toolkit::Visual::Base& visual, ParameterType& param )
+template<class ParameterType>
+void InitializeVisual(Actor& actor, Toolkit::Visual::Base& visual, ParameterType& param)
{
- if( actor && visual )
+ if(actor && visual)
{
- Toolkit::GetImplementation(visual).SetOffScene( actor );
+ Toolkit::GetImplementation(visual).SetOffScene(actor);
}
- visual = Toolkit::VisualFactory::Get().CreateVisual( param );
- if( visual && actor && actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) )
+ visual = Toolkit::VisualFactory::Get().CreateVisual(param);
+ if(visual && actor && actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE))
{
Toolkit::GetImplementation(visual).SetOnScene(actor);
}
inline const Internal::VisualFactory& GetImplementation(const Toolkit::VisualFactory& factory)
{
- DALI_ASSERT_ALWAYS( factory && "VisualFactory handle is empty" );
+ DALI_ASSERT_ALWAYS(factory && "VisualFactory handle is empty");
const BaseObject& handle = factory.GetBaseObject();
inline Internal::VisualFactory& GetImplementation(Toolkit::VisualFactory& factory)
{
- DALI_ASSERT_ALWAYS( factory && "VisualFactory handle is empty" );
+ DALI_ASSERT_ALWAYS(factory && "VisualFactory handle is empty");
BaseObject& handle = factory.GetBaseObject();
#define DALI_TOOLKIT_INTERNAL_VISUAL_STRING_CONSTANTS_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
// Visual type
-extern const char * const VISUAL_TYPE;
+extern const char* const VISUAL_TYPE;
extern const Dali::Scripting::StringEnum VISUAL_TYPE_TABLE[];
-extern const unsigned int VISUAL_TYPE_TABLE_COUNT;
+extern const unsigned int VISUAL_TYPE_TABLE_COUNT;
// Custom shader
-extern const char * const CUSTOM_SHADER;
-extern const char * const CUSTOM_VERTEX_SHADER;
-extern const char * const CUSTOM_FRAGMENT_SHADER;
-extern const char * const CUSTOM_SUBDIVIDE_GRID_X;
-extern const char * const CUSTOM_SUBDIVIDE_GRID_Y;
-extern const char * const CUSTOM_SHADER_HINTS;
+extern const char* const CUSTOM_SHADER;
+extern const char* const CUSTOM_VERTEX_SHADER;
+extern const char* const CUSTOM_FRAGMENT_SHADER;
+extern const char* const CUSTOM_SUBDIVIDE_GRID_X;
+extern const char* const CUSTOM_SUBDIVIDE_GRID_Y;
+extern const char* const CUSTOM_SHADER_HINTS;
// Transform
-extern const char * const TRANSFORM;
-extern const char * const SIZE;
-extern const char * const OFFSET;
-extern const char * const OFFSET_SIZE_MODE;
-extern const char * const ORIGIN;
-extern const char * const ANCHOR_POINT;
-extern const char * const EXTRA_SIZE;
+extern const char* const TRANSFORM;
+extern const char* const SIZE;
+extern const char* const OFFSET;
+extern const char* const OFFSET_SIZE_MODE;
+extern const char* const ORIGIN;
+extern const char* const ANCHOR_POINT;
+extern const char* const EXTRA_SIZE;
// Premultiplied alpha
-extern const char * const PREMULTIPLIED_ALPHA;
+extern const char* const PREMULTIPLIED_ALPHA;
// Mix color
-extern const char * const MIX_COLOR;
-extern const char * const OPACITY;
+extern const char* const MIX_COLOR;
+extern const char* const OPACITY;
// Fitting mode
-extern const char * const VISUAL_FITTING_MODE;
+extern const char* const VISUAL_FITTING_MODE;
// Corner radius
-extern const char * const CORNER_RADIUS;
-extern const char * const CORNER_RADIUS_POLICY;
+extern const char* const CORNER_RADIUS;
+extern const char* const CORNER_RADIUS_POLICY;
// Color visual
-extern const char * const RENDER_IF_TRANSPARENT_NAME;
-extern const char * const BLUR_RADIUS_NAME;
+extern const char* const RENDER_IF_TRANSPARENT_NAME;
+extern const char* const BLUR_RADIUS_NAME;
// Image visual
-extern const char * const IMAGE_URL_NAME;
-extern const char * const ATLAS_RECT_UNIFORM_NAME;
-extern const char * const PIXEL_AREA_UNIFORM_NAME;
-extern const char * const WRAP_MODE_UNIFORM_NAME;
-extern const char * const IMAGE_WRAP_MODE_U;
-extern const char * const IMAGE_WRAP_MODE_V;
-extern const char * const IMAGE_BORDER;
-extern const char * const PIXEL_ALIGNED_UNIFORM_NAME;
-extern const char * const ANIMATED_IMAGE_URLS_NAME;
-extern const char * const BATCH_SIZE_NAME;
-extern const char * const CACHE_SIZE_NAME;
-extern const char * const FRAME_DELAY_NAME;
-extern const char * const LOOP_COUNT_NAME;
-extern const char * const MASK_CONTENT_SCALE_NAME;
-extern const char * const CROP_TO_MASK_NAME;
-extern const char * const LOAD_POLICY_NAME;
-extern const char * const RELEASE_POLICY_NAME;
-extern const char * const ORIENTATION_CORRECTION_NAME;
-extern const char * const AUXILLARY_IMAGE_NAME;
-extern const char * const AUXILLARY_IMAGE_ALPHA_NAME;
-extern const char * const PLAY_RANGE_NAME;
-extern const char * const PLAY_STATE_NAME;
-extern const char * const CURRENT_FRAME_NUMBER_NAME;
-extern const char * const TOTAL_FRAME_NUMBER_NAME;
-extern const char * const STOP_BEHAVIOR_NAME;
-extern const char * const LOOPING_MODE_NAME;
-extern const char * const IMAGE_ATLASING;
-extern const char * const SYNCHRONOUS_LOADING;
-extern const char * const IMAGE_FITTING_MODE;
-extern const char * const IMAGE_SAMPLING_MODE;
-extern const char * const IMAGE_DESIRED_WIDTH;
-extern const char * const IMAGE_DESIRED_HEIGHT;
-extern const char * const ALPHA_MASK_URL;
-extern const char * const REDRAW_IN_SCALING_DOWN_NAME;
+extern const char* const IMAGE_URL_NAME;
+extern const char* const ATLAS_RECT_UNIFORM_NAME;
+extern const char* const PIXEL_AREA_UNIFORM_NAME;
+extern const char* const WRAP_MODE_UNIFORM_NAME;
+extern const char* const IMAGE_WRAP_MODE_U;
+extern const char* const IMAGE_WRAP_MODE_V;
+extern const char* const IMAGE_BORDER;
+extern const char* const PIXEL_ALIGNED_UNIFORM_NAME;
+extern const char* const ANIMATED_IMAGE_URLS_NAME;
+extern const char* const BATCH_SIZE_NAME;
+extern const char* const CACHE_SIZE_NAME;
+extern const char* const FRAME_DELAY_NAME;
+extern const char* const LOOP_COUNT_NAME;
+extern const char* const MASK_CONTENT_SCALE_NAME;
+extern const char* const CROP_TO_MASK_NAME;
+extern const char* const LOAD_POLICY_NAME;
+extern const char* const RELEASE_POLICY_NAME;
+extern const char* const ORIENTATION_CORRECTION_NAME;
+extern const char* const AUXILLARY_IMAGE_NAME;
+extern const char* const AUXILLARY_IMAGE_ALPHA_NAME;
+extern const char* const PLAY_RANGE_NAME;
+extern const char* const PLAY_STATE_NAME;
+extern const char* const CURRENT_FRAME_NUMBER_NAME;
+extern const char* const TOTAL_FRAME_NUMBER_NAME;
+extern const char* const STOP_BEHAVIOR_NAME;
+extern const char* const LOOPING_MODE_NAME;
+extern const char* const IMAGE_ATLASING;
+extern const char* const SYNCHRONOUS_LOADING;
+extern const char* const IMAGE_FITTING_MODE;
+extern const char* const IMAGE_SAMPLING_MODE;
+extern const char* const IMAGE_DESIRED_WIDTH;
+extern const char* const IMAGE_DESIRED_HEIGHT;
+extern const char* const ALPHA_MASK_URL;
+extern const char* const REDRAW_IN_SCALING_DOWN_NAME;
// Text visual
-extern const char * const TEXT_PROPERTY;
-extern const char * const FONT_FAMILY_PROPERTY;
-extern const char * const FONT_STYLE_PROPERTY;
-extern const char * const POINT_SIZE_PROPERTY;
-extern const char * const MULTI_LINE_PROPERTY;
-extern const char * const HORIZONTAL_ALIGNMENT_PROPERTY;
-extern const char * const VERTICAL_ALIGNMENT_PROPERTY;
-extern const char * const TEXT_COLOR_PROPERTY;
-extern const char * const ENABLE_MARKUP_PROPERTY;
-extern const char * const SHADOW_PROPERTY;
-extern const char * const UNDERLINE_PROPERTY;
-extern const char * const OUTLINE_PROPERTY;
-extern const char * const BACKGROUND_PROPERTY;
+extern const char* const TEXT_PROPERTY;
+extern const char* const FONT_FAMILY_PROPERTY;
+extern const char* const FONT_STYLE_PROPERTY;
+extern const char* const POINT_SIZE_PROPERTY;
+extern const char* const MULTI_LINE_PROPERTY;
+extern const char* const HORIZONTAL_ALIGNMENT_PROPERTY;
+extern const char* const VERTICAL_ALIGNMENT_PROPERTY;
+extern const char* const TEXT_COLOR_PROPERTY;
+extern const char* const ENABLE_MARKUP_PROPERTY;
+extern const char* const SHADOW_PROPERTY;
+extern const char* const UNDERLINE_PROPERTY;
+extern const char* const OUTLINE_PROPERTY;
+extern const char* const BACKGROUND_PROPERTY;
//NPatch visual
-extern const char * const BORDER_ONLY;
-extern const char * const BORDER;
-extern const char * const AUXILIARY_IMAGE_NAME;
-extern const char * const AUXILIARY_IMAGE_ALPHA_NAME;
+extern const char* const BORDER_ONLY;
+extern const char* const BORDER;
+extern const char* const AUXILIARY_IMAGE_NAME;
+extern const char* const AUXILIARY_IMAGE_ALPHA_NAME;
// non-animated property
extern const char* const GRADIENT_TYPE_NAME;
extern const char* const UNIFORM_OFFSET_NAME;
// Border visual
-extern const char * const COLOR_NAME;
-extern const char * const SIZE_NAME;
-extern const char * const ANTI_ALIASING;
+extern const char* const COLOR_NAME;
+extern const char* const SIZE_NAME;
+extern const char* const ANTI_ALIASING;
// properties: radial gradient
-extern const char * const CENTER_NAME; // Property::VECTOR2
-extern const char * const RADIUS_NAME; // Property::FLOAT
+extern const char* const CENTER_NAME; // Property::VECTOR2
+extern const char* const RADIUS_NAME; // Property::FLOAT
// properties: linear&radial gradient
-extern const char * const STOP_OFFSET_NAME; // Property::Array FLOAT
-extern const char * const STOP_COLOR_NAME; // Property::Array VECTOR4
-extern const char * const UNITS_NAME; // Property::String "userSpaceOnUse | objectBoundingBox"
-extern const char * const SPREAD_METHOD_NAME; // Property::String "pad | reflect | repeat"
+extern const char* const STOP_OFFSET_NAME; // Property::Array FLOAT
+extern const char* const STOP_COLOR_NAME; // Property::Array VECTOR4
+extern const char* const UNITS_NAME; // Property::String "userSpaceOnUse | objectBoundingBox"
+extern const char* const SPREAD_METHOD_NAME; // Property::String "pad | reflect | repeat"
//mesh visual
-extern const char * const OBJECT_URL_NAME;
-extern const char * const MATERIAL_URL_NAME;
-extern const char * const TEXTURES_PATH_NAME;
-extern const char * const SHADING_MODE_NAME;
-extern const char * const USE_MIPMAPPING_NAME;
-extern const char * const USE_SOFT_NORMALS_NAME;
-extern const char * const LIGHT_POSITION_NAME;
+extern const char* const OBJECT_URL_NAME;
+extern const char* const MATERIAL_URL_NAME;
+extern const char* const TEXTURES_PATH_NAME;
+extern const char* const SHADING_MODE_NAME;
+extern const char* const USE_MIPMAPPING_NAME;
+extern const char* const USE_SOFT_NORMALS_NAME;
+extern const char* const LIGHT_POSITION_NAME;
//Primitive properties
-extern const char * const PRIMITIVE_SHAPE;
-extern const char * const SLICES;
-extern const char * const STACKS;
-extern const char * const SCALE_TOP_RADIUS;
-extern const char * const SCALE_BOTTOM_RADIUS;
-extern const char * const SCALE_HEIGHT;
-extern const char * const SCALE_RADIUS;
-extern const char * const SCALE_DIMENSIONS;
-extern const char * const BEVEL_PERCENTAGE;
-extern const char * const BEVEL_SMOOTHNESS;
-extern const char * const LIGHT_POSITION_UNIFORM_NAME;
+extern const char* const PRIMITIVE_SHAPE;
+extern const char* const SLICES;
+extern const char* const STACKS;
+extern const char* const SCALE_TOP_RADIUS;
+extern const char* const SCALE_BOTTOM_RADIUS;
+extern const char* const SCALE_HEIGHT;
+extern const char* const SCALE_RADIUS;
+extern const char* const SCALE_DIMENSIONS;
+extern const char* const BEVEL_PERCENTAGE;
+extern const char* const BEVEL_SMOOTHNESS;
+extern const char* const LIGHT_POSITION_UNIFORM_NAME;
// Arc visual
-extern const char * const THICKNESS_NAME;
-extern const char * const START_ANGLE_NAME;
-extern const char * const SWEEP_ANGLE_NAME;
-extern const char * const CAP_NAME;
+extern const char* const THICKNESS_NAME;
+extern const char* const START_ANGLE_NAME;
+extern const char* const SWEEP_ANGLE_NAME;
+extern const char* const CAP_NAME;
} // namespace Internal
#define DALI_TOOLKIT_INTERNAL_VISUAL_URL_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class VisualUrl
{
public:
-
/**
* The type of the URL based on the string contents
*/
* Determines type of visual and whether the url is local or remote
* @param[in] url The URL to store and resolve
*/
- VisualUrl( const std::string& url );
+ VisualUrl(const std::string& url);
/**
* Copy constructor
* @param[in] url The VisualUrl to copy
*/
- VisualUrl( const VisualUrl& url );
+ VisualUrl(const VisualUrl& url);
/**
* Assignment operator
* @param[in] url The VisualUrl to copy
*/
- VisualUrl& operator=( const VisualUrl& url );
+ VisualUrl& operator=(const VisualUrl& url);
/**
* Get the full URL
* @param location the location of the texture
* @return the Url
*/
- static std::string CreateTextureUrl( const std::string& location );
+ static std::string CreateTextureUrl(const std::string& location);
private:
- std::string mUrl;
- Type mType;
+ std::string mUrl;
+ Type mType;
ProtocolType mLocation;
};
-
} // namespace Internal
} // namespace Toolkit
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
class WireframeVisual;
-typedef IntrusivePtr< WireframeVisual > WireframeVisualPtr;
+typedef IntrusivePtr<WireframeVisual> WireframeVisualPtr;
/**
* @brief Renders a wireframe outline to the control's quad.
*/
-class WireframeVisual: public Visual::Base
+class WireframeVisual : public Visual::Base
{
public:
-
/**
* @brief Create a new wireframe visual.
*
* @param[in] properties A Property::Map containing settings for this visual
* @return A smart-pointer to the newly allocated visual.
*/
- static WireframeVisualPtr New( VisualFactoryCache& factoryCache, const Property::Map& properties );
+ static WireframeVisualPtr New(VisualFactoryCache& factoryCache, const Property::Map& properties);
/**
* @brief Create a new wireframe visual with an encapsulated actual visual.
* @param[in] actualVisual The encapsulated actual visual.
* @return A smart-pointer to the newly allocated visual.
*/
- static WireframeVisualPtr New( VisualFactoryCache& factoryCache, Visual::BasePtr actualVisual );
+ static WireframeVisualPtr New(VisualFactoryCache& factoryCache, Visual::BasePtr actualVisual);
/**
* @brief Create a new wireframe visual with an encapsulated actual visual.
* @param[in] properties A Property::Map containing settings for this visual
* @return A smart-pointer to the newly allocated visual.
*/
- static WireframeVisualPtr New( VisualFactoryCache& factoryCache, Visual::BasePtr actualVisual, const Property::Map& properties );
-
+ static WireframeVisualPtr New(VisualFactoryCache& factoryCache, Visual::BasePtr actualVisual, const Property::Map& properties);
protected:
-
/**
* @brief Constructor.
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
* @param[in] actualVisual The encapsulated actual visual.
*/
- WireframeVisual( VisualFactoryCache& factoryCache, Visual::BasePtr actualVisual );
+ WireframeVisual(VisualFactoryCache& factoryCache, Visual::BasePtr actualVisual);
/**
* @brief A reference counted object may only be deleted by calling Unreference().
/**
* @copydoc Visual::Base::GetHeightForWidth()
*/
- float GetHeightForWidth( float width ) override;
+ float GetHeightForWidth(float width) override;
/**
* @copydoc Visual::Base::GetNaturalSize()
*/
- void GetNaturalSize( Vector2& naturalSize ) override;
+ void GetNaturalSize(Vector2& naturalSize) override;
/**
* @copydoc Visual::Base::CreatePropertyMap()
*/
- void DoCreatePropertyMap( Property::Map& map ) const override;
+ void DoCreatePropertyMap(Property::Map& map) const override;
/**
* @copydoc Visual::Base::CreateInstancePropertyMap
*/
- void DoCreateInstancePropertyMap( Property::Map& map ) const override;
+ void DoCreateInstancePropertyMap(Property::Map& map) const override;
/**
* @copydoc Visual::Base::DoSetProperties()
*/
- void DoSetProperties( const Property::Map& propertyMap ) override;
+ void DoSetProperties(const Property::Map& propertyMap) override;
/**
* @copydoc Visual::Base::DoSetOnScene
*/
- void DoSetOnScene( Actor& actor ) override;
+ void DoSetOnScene(Actor& actor) override;
/**
* @copydoc Visual::Base::OnSetTransform
Geometry CreateQuadWireframeGeometry();
// Undefined
- WireframeVisual( const WireframeVisual& visual);
+ WireframeVisual(const WireframeVisual& visual);
// Undefined
- WireframeVisual& operator=( const WireframeVisual& visual );
+ WireframeVisual& operator=(const WireframeVisual& visual);
private:
-
Visual::BasePtr mActualVisual;
-
};
} // namespace Internal
#define DALI_TOOLKIT_CONTROL_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* @note A RelayoutRequest is queued by Control before this signal is emitted
*/
ResourceReadySignalType& ResourceReadySignal();
+
public: // Intended for control developers
/**
* @brief Creates an initialized Control.