[dali_2.1.0] 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) 2021 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 Destructor
103    *
104    * This is non-virtual since derived Handle types must not contain data or virtual methods.
105    */
106   ~TextAnchor();
107
108   /**
109    * @brief Downcast a handle to TextAnchor.
110    *
111    * If the BaseHandle points is a TextAnchor the downcast returns a valid handle.
112    * If not the returned handle is left empty.
113    *
114    * @param[in] handle Handle to an object
115    * @return handle to a TextAnchor or an empty handle
116    */
117   static TextAnchor DownCast(BaseHandle handle);
118
119 public: // Not intended for application developers
120   /**
121    * @brief Creates a handle using the Toolkit::Internal implementation.
122    *
123    * @param[in] implementation The Control implementation.
124    */
125   DALI_INTERNAL TextAnchor(Internal::TextAnchor& implementation);
126
127   /**
128    * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
129    *
130    * @param[in]  internal  A pointer to the internal CustomActor.
131    */
132   explicit DALI_INTERNAL TextAnchor(Dali::Internal::CustomActor* internal);
133
134 }; // Class TextAnchor
135
136 } // namespace Toolkit
137
138 } // namespace Dali
139
140 #endif // DALI_TOOLKIT_TEXT_ANCHOR_DEVEL_H