Merge "Fix documentation for Text::EditableControlInterface interface override functi...
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / arc / arc-visual.h
1 #ifndef DALI_TOOLKIT_INTERNAL_ARC_VISUAL_H
2 #define DALI_TOOLKIT_INTERNAL_ARC_VISUAL_H
3
4 /*
5  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/common/intrusive-ptr.h>
23
24 // INTERNAL INCLUDES
25 #include <dali-toolkit/internal/visuals/visual-base-impl.h>
26 #include <dali-toolkit/devel-api/visuals/arc-visual-properties-devel.h>
27
28 namespace Dali
29 {
30
31 namespace Toolkit
32 {
33
34 namespace Internal
35 {
36
37 class ArcVisual;
38 typedef IntrusivePtr< ArcVisual > ArcVisualPtr;
39
40 /**
41  * The visual which renders an arc to the control's quad
42  *
43  * The following properties are required for create an ArcVisual
44  *
45  * | %Property Name  | Type        |
46  * |-----------------|-------------|
47  * | THICKNESS       | FLOAT       |
48  * | START_ANGLE     | FLOAT       |
49  * | SWEEP_ANGLE     | FLOAT       |
50  * | CAP             | INTEGER     |
51  */
52 class ArcVisual: public Visual::Base
53 {
54 public:
55
56   /**
57    * @brief Create a new arc visual.
58    *
59    * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
60    * @param[in] properties A Property::Map containing settings for this visual
61    * @return A smart-pointer to the newly allocated visual.
62    */
63   static ArcVisualPtr New( VisualFactoryCache& factoryCache, const Property::Map& properties );
64
65 public:  // from Visual
66
67   /**
68    * @copydoc Visual::Base::CreatePropertyMap
69    */
70   void DoCreatePropertyMap( Property::Map& map ) const override;
71
72   /**
73    * @copydoc Visual::Base::CreateInstancePropertyMap
74    */
75   void DoCreateInstancePropertyMap( Property::Map& map ) const override;
76
77 protected:
78
79   /**
80    * @brief Constructor.
81    *
82    * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
83    */
84   ArcVisual( VisualFactoryCache& factoryCache );
85
86   /**
87    * @brief A reference counted object may only be deleted by calling Unreference().
88    */
89   virtual ~ArcVisual();
90
91   /**
92    * @copydoc Visual::Base::DoSetProperties
93    */
94   void DoSetProperties( const Property::Map& propertyMap ) override;
95
96   /**
97    * @copydoc Visual::Base::DoSetOnScene
98    */
99   void DoSetOnScene( Actor& actor ) override;
100
101   /**
102    * @copydoc Visual::Base::OnSetTransform
103    */
104   void OnSetTransform() override;
105
106   /**
107    * @copydoc Visual::Base::OnDoAction
108    */
109   void OnDoAction( const Property::Index actionId, const Property::Value& attributes ) override;
110
111 private:
112
113   /**
114    * @brief Initialize the renderer with the geometry and shader from the cache, if not available, create and save to the cache for sharing.
115    */
116   void InitializeRenderer();
117
118 private:
119
120   // Undefined
121   ArcVisual( const ArcVisual& arcVisual ) = delete;
122
123   // Undefined
124   ArcVisual& operator=( const ArcVisual& arcVisual ) = delete;
125
126 private:
127
128   float mThickness;                    ///< The thickness of the arc.
129   float mRadius;                       ///< The radius of the arc.
130   float mStartAngle;                   ///< The start angle of the arc.
131   float mSweepAngle;                   ///< The sweep angle of the arc.
132   Property::Index mRadiusIndex;        ///< The index of the radius property.
133   Property::Index mThicknessIndex;     ///< The index of the thickness property.
134   Property::Index mStartAngleIndex;    ///< The index of the start angle property.
135   Property::Index mSweepAngleIndex;    ///< The index of the sweep angle property.
136   DevelArcVisual::Cap::Type mCapType;  ///< The cap type.
137 };
138
139 } // namespace Internal
140
141 } // namespace Toolkit
142
143 } // namespace Dali
144
145 #endif /* DALI_TOOLKIT_INTERNAL_ARC_VISUAL_H */