(Control) Ensure background-color blends fully with the control color
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / public-api / factory / localized-control-factory.h
1 #ifndef __DALI_TOOLKIT_LOCALIZED_CONTROL_FACTORY_H__
2 #define __DALI_TOOLKIT_LOCALIZED_CONTROL_FACTORY_H__
3
4 /*
5  * Copyright (c) 2014 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/text-view/text-view.h>
23
24 namespace Dali DALI_IMPORT_API
25 {
26
27 namespace Toolkit
28 {
29
30 namespace Internal DALI_INTERNAL
31 {
32 class LocalizedControlFactory;
33 }
34
35 /**
36  * @brief This class provides functionality for creating controls which have localized text.
37  *
38  * This class keeps track of objects created using its factory methods, and updates them
39  * when the system language changes.
40  *
41  * Warning: If the developer calls SetText on the object to overwrite the managed TextView,
42  * then it leads to an inconsistent state where the object will be overwritten with the
43  * localized text when language/locale changes.
44  */
45
46 class LocalizedControlFactory : public BaseHandle
47 {
48 public:
49
50   /**
51    * @brief Creates a localized TextView, which is automatically updated when the locale or language changes.
52    *
53    * @pre The LocalizedControlFactory has been initialized.
54    *
55    * @param textID The id of the localized text with which a platform request (gettext) for localized text can be made.
56    * @param textDomain The text domain for the localized text. Eg "sys_string"
57    * @param textViewTheme A string containing style info about various properties of TextView for different
58    *        locale/language.
59    * @return handle to a new localized TextView
60    */
61   static Dali::Toolkit::TextView CreateLocalizedTextView( const std::string& textID, const std::string& textDomain = "sys_string", const std::string& textViewTheme = "{}" );
62
63
64 private:
65
66   /**
67    * @brief Create a LocalizedControlFactory handle; this can be initialised with LocalizedControlFactory::New().
68    *
69    * Calling member functions with an uninitialised handle is not allowed.
70    */
71   LocalizedControlFactory();
72
73   /**
74    * @brief Destructor
75    *
76    * This is non-virtual since derived Handle types must not contain data or virtual methods.
77    */
78   ~LocalizedControlFactory();
79
80   /**
81    * @brief Get the singleton of LocalizedControlFactory object.
82    *
83    * @return A handle to the LocalizedControlFactory control.
84    */
85   static LocalizedControlFactory Get();
86
87   /**
88    * @brief Allows the creation of this Control from an Internal::LocalizedControlFactory pointer.
89    *
90    * @param[in]  impl  A pointer to the internal LocalizedControlFactory.
91    */
92   LocalizedControlFactory(Internal::LocalizedControlFactory *impl);
93 }; // class LocalizedControlFactory
94
95 } // namespace Toolkit
96
97 } // namespace Dali
98
99 #endif // __DALI_TOOLKIT_LOCALIZED_CONTROL_FACTORY_H__