Merge "Makes the LTR/RTL alignment of text follow the system language by default...
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / hidden-text.h
1 #ifndef DALI_HIDDEN_TEXT_H
2 #define DALI_HIDDEN_TEXT_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 // EXTERNAL INCLUDES
22 #include <dali/public-api/adaptor-framework/timer.h>
23 #include <dali/public-api/object/property-map.h>
24
25 // INTERNAL INCLUDES
26 #include <dali-toolkit/internal/text/text-definitions.h>
27 #include <dali-toolkit/public-api/controls/text-controls/hidden-input-properties.h>
28
29 namespace Dali
30 {
31 namespace Toolkit
32 {
33 namespace Text
34 {
35 /**
36  * Class to handle the hidden text
37  */
38 class HiddenText : public ConnectionTracker
39 {
40 public:
41   class Observer
42   {
43   public:
44     /**
45      * @brief Invoked when the time to show last character is expired
46      */
47     virtual void DisplayTimeExpired() = 0;
48   };
49
50   /**
51    * @brief Constructor
52    * @param[in] observer The Observer pointer.
53    */
54   HiddenText(Observer* observer);
55
56 public: // Intended for internal use
57   /**
58    * @brief Used to set options of hidden text
59    * @param[in] map The property map describing the option
60    */
61   void SetProperties(const Property::Map& map);
62
63   /**
64    * @brief Retrieve property map of hidden text options
65    * @param[out] map The hidden text option
66    */
67   void GetProperties(Property::Map& map);
68
69   /**
70    * @brief Convert source text to destination text according to current option
71    * @param[in] source The original text
72    * @param[out] destination The applied text
73    */
74   void Substitute(const Vector<Character>& source, Vector<Character>& destination);
75
76   /**
77    * @brief Invoked when the timer is expired
78    */
79   bool OnTick();
80
81 private:
82   Timer     mTimer;
83   Observer* mObserver;
84   int       mHideMode;
85   int       mSubstituteText;
86   int       mDisplayDuration;
87   int       mSubstituteCount;
88   Length    mPreviousTextCount;
89 };
90
91 } // namespace Text
92
93 } // namespace Toolkit
94
95 } // namespace Dali
96
97 #endif // DALI_HIDDEN_TEXT_H