[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / controls / text-controls / text-anchor-devel.h
1 #ifndef DALI_TOOLKIT_TEXT_ANCHOR_DEVEL_H
2 #define DALI_TOOLKIT_TEXT_ANCHOR_DEVEL_H
3
4 /*
5  * Copyright (c) 2022 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 // INTERNAL INCLUDES
22 #include <dali-toolkit/public-api/controls/control.h>
23
24 namespace Dali
25 {
26 namespace Toolkit
27 {
28 namespace Internal DALI_INTERNAL
29 {
30 class TextAnchor;
31 }
32
33 /**
34  * @brief A control which renders anchor (hyperlink) in hypertext.
35  */
36 class DALI_TOOLKIT_API TextAnchor : public Control
37 {
38 public:
39   /**
40    * @brief The start and end property ranges for this control.
41    */
42   enum PropertyRange
43   {
44     PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
45     PROPERTY_END_INDEX   = PROPERTY_START_INDEX + 1000 ///< Reserve property indices
46   };
47
48   /**
49    * @brief An enumeration of properties belonging to the TextAnchor class.
50    */
51   struct Property
52   {
53     enum
54     {
55       /**
56        * @brief The index of a character in text at which an anchor starts.
57        * @details Name "startCharacterIndex", type INTEGER.
58        */
59       START_CHARACTER_INDEX = PROPERTY_START_INDEX,
60
61       /**
62        * @brief The index of a character in text that stands one position after the anchor's last character.
63        * @details Name "endCharacterIndex", type INTEGER.
64        */
65       END_CHARACTER_INDEX,
66
67       /**
68        * @brief The URI associated with an anchor.
69        * @details Name "uri", type STRING.
70        */
71       URI
72     };
73   };
74
75   /**
76    * @brief Creates the TextAnchor control.
77    * @return A handle to the TextAnchor control.
78    */
79   static TextAnchor New();
80
81   /**
82    * @brief Creates an empty handle.
83    */
84   TextAnchor();
85
86   /**
87    * @brief Copy constructor.
88    *
89    * @param[in] handle The handle to copy from.
90    */
91   TextAnchor(const TextAnchor& handle);
92
93   /**
94    * @brief Assignment operator.
95    *
96    * @param[in] handle The handle to copy from.
97    * @return A reference to this.
98    */
99   TextAnchor& operator=(const TextAnchor& handle);
100
101   /**
102    * @brief Move constructor.
103    *
104    * @param[in] handle The handle to move from.
105    */
106   TextAnchor(TextAnchor&& handle);
107
108   /**
109    * @brief Move assignment operator.
110    *
111    * @param[in] handle The handle to move from.
112    * @return A reference to this.
113    */
114   TextAnchor& operator=(TextAnchor&& handle);
115
116   /**
117    * @brief Destructor
118    *
119    * This is non-virtual since derived Handle types must not contain data or virtual methods.
120    */
121   ~TextAnchor();
122
123   /**
124    * @brief Downcast a handle to TextAnchor.
125    *
126    * If the BaseHandle points is a TextAnchor the downcast returns a valid handle.
127    * If not the returned handle is left empty.
128    *
129    * @param[in] handle Handle to an object
130    * @return handle to a TextAnchor or an empty handle
131    */
132   static TextAnchor DownCast(BaseHandle handle);
133
134 public: // Not intended for application developers
135   /**
136    * @brief Creates a handle using the Toolkit::Internal implementation.
137    *
138    * @param[in] implementation The Control implementation.
139    */
140   DALI_INTERNAL TextAnchor(Internal::TextAnchor& implementation);
141
142   /**
143    * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
144    *
145    * @param[in]  internal  A pointer to the internal CustomActor.
146    */
147   explicit DALI_INTERNAL TextAnchor(Dali::Internal::CustomActor* internal);
148
149 }; // Class TextAnchor
150
151 } // namespace Toolkit
152
153 } // namespace Dali
154
155 #endif // DALI_TOOLKIT_TEXT_ANCHOR_DEVEL_H