TextInput Popup has a tail which points to the TextInput
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / internal / factory / localized-control-factory-impl.h
1 #ifndef __DALI_TOOLKIT_INTERNAL_LOCALIZED_CONTROL_FACTORY_H__
2 #define __DALI_TOOLKIT_INTERNAL_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 // EXTERNAL INCLUDES
22 #include <string>
23 #include <set>
24
25 // INTERNAL INCLUDES
26 #include <dali/dali.h>
27 #include <dali-toolkit/public-api/factory/localized-control-factory.h>
28
29 namespace Dali
30 {
31
32 namespace Toolkit
33 {
34
35 namespace Internal
36 {
37
38 /**
39  * @copydoc Toolkit::LocalizedControlFactory
40  */
41 class LocalizedControlFactory : public Dali::BaseObject, public ConnectionTracker
42 {
43 public:
44
45   /**
46    * Structure used to store/retrieve localisation info.
47    */
48   struct LocalisedStringInfo
49   {
50     LocalisedStringInfo()
51     {
52     }
53
54     LocalisedStringInfo(std::string id, std::string domain, std::string theme)
55     : textID(id),
56       textDomain(domain),
57       textViewTheme(theme)
58     {
59
60     }
61
62     std::string textID;
63     std::string textDomain;
64     std::string textViewTheme;
65   };
66
67   typedef std::map< const Dali::RefObject*, LocalisedStringInfo > ObjectEntriesContainer;
68   typedef ObjectEntriesContainer::iterator ObjectEntriesIterator;
69   typedef ObjectEntriesContainer::const_iterator ObjectEntriesConstIterator;
70
71   /**
72    * Construct a new LocalizedControlFactory.
73    */
74   LocalizedControlFactory();
75
76   /**
77    * @copydoc Toolkit::LocalizedControlFactory::CreateLocalizedTextView
78    */
79   Dali::Toolkit::TextView CreateLocalizedTextView( const std::string& textID, const std::string& textDomain, const std::string& textViewTheme );
80
81 protected:
82
83   /**
84    * Destructor
85    */
86   virtual ~LocalizedControlFactory();
87
88 private:
89
90   /**
91    * Callback for Object destructed signal.
92    * @param objectPointer Pointer to a RefObject
93    */
94   void OnObjectDestruction( const Dali::RefObject* objectPointer );
95
96   /**
97    * Callback for language changed signal.
98    * @param adaptor Reference to a Dali::Adaptor instance
99    */
100   void OnLanguageChanged( Dali::Adaptor& adaptor);
101
102 private:
103
104   // Undefined
105   LocalizedControlFactory(const LocalizedControlFactory&);
106   LocalizedControlFactory& operator=(const LocalizedControlFactory& rhs);
107
108 private:
109
110   ObjectEntriesContainer mObjectEntries;
111   bool mSignalsConnected:1;
112
113 };
114
115 } // namespace Internal
116
117 inline Internal::LocalizedControlFactory& GetImpl(Dali::Toolkit::LocalizedControlFactory& obj)
118 {
119   DALI_ASSERT_ALWAYS(obj);
120
121   Dali::BaseObject& handle = obj.GetBaseObject();
122
123   return static_cast<Internal::LocalizedControlFactory&>(handle);
124 }
125
126 inline const Internal::LocalizedControlFactory& GetImpl(const Dali::Toolkit::LocalizedControlFactory& obj)
127 {
128   DALI_ASSERT_ALWAYS(obj);
129
130   const Dali::BaseObject& handle = obj.GetBaseObject();
131
132   return static_cast<const Internal::LocalizedControlFactory&>(handle);
133 }
134
135 } // namespace Toolkit
136
137 } // namespace Dali
138
139 #endif // __DALI_TOOLKIT_INTERNAL_LOCALIZED_CONTROL_FACTORY_H__