Revert "[Tizen] Add DALi Autofill implementation"
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / style-monitor.h
1 #ifndef DALI_STYLE_MONITOR_H
2 #define DALI_STYLE_MONITOR_H
3
4 /*
5  * Copyright (c) 2019 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
24 #include <dali/public-api/object/base-handle.h>
25 #include <dali/public-api/signals/dali-signal.h>
26
27 // INTERNAL INCLUDES
28 #include <dali/public-api/adaptor-framework/style-change.h>
29
30 namespace Dali
31 {
32
33 namespace Internal DALI_INTERNAL
34 {
35 namespace Adaptor
36 {
37 class StyleMonitor;
38 }
39 }
40
41 /**
42  * @brief Monitors the platform for style changes.
43  *
44  * This is a handle to the adaptor's style monitor which holds the platform's style information.
45  * It provides a signal when any aspect of the default style changes on the device.
46  * @see Adaptor::GetStyleMonitor
47  */
48 class DALI_ADAPTOR_API StyleMonitor : public BaseHandle
49 {
50 public: // Typedefs
51
52   typedef Signal< void ( StyleMonitor, StyleChange::Type ) > StyleChangeSignalType;   ///< StyleChange Signal type
53
54 public: // Creation & Destruction
55
56   /**
57    * @brief Create an uninitialized StyleMonitor handle.
58    *
59    * Tthis can be set by retrieving the style monitor from the Adaptor
60    * or the Application classes.  Calling member functions when
61    * uninitialized is not allowed.
62    */
63   StyleMonitor();
64
65   /**
66    * @brief Creates a copy of the handle.
67    *
68    * The copy will point to the same implementation as the original.
69    * @param[in]  monitor  The Style Monitor to copy from.
70    */
71   StyleMonitor(const StyleMonitor& monitor);
72
73   /**
74    * @brief Retrieve the initialized instance of the StyleMonitor.
75    * @return Handle to StyleMonitor.
76    */
77   static StyleMonitor Get();
78
79   /**
80    * @brief Destructor
81    *
82    * This is non-virtual since derived Handle types must not contain data or virtual methods.
83    */
84   ~StyleMonitor();
85
86   /**
87    * @brief Downcast an Object handle to StyleMonitor handle.
88    *
89    * If handle points to a StyleMonitor object the downcast produces a
90    * valid handle. If not the returned handle is left uninitialized.
91    *
92    * @param[in] handle to An object @return handle to a Timer object
93    * or an uninitialized handle
94    */
95   static StyleMonitor DownCast( BaseHandle handle );
96
97 public: // Style Information
98
99   /**
100    * @brief Retrieves the default font family.
101    * @return The default font family.
102    */
103   std::string GetDefaultFontFamily() const;
104
105   /**
106    * @brief Retrieves the default font style.
107    * @return The default font style.
108    */
109   std::string GetDefaultFontStyle() const;
110
111   /**
112    * @brief Retrieves the default font size.
113    *
114    * This is an logical size, which is mapped to a UI Control specific point-size in stylesheets.
115    * For example if zero the smallest size, this could potentially map to TextLabel point-size 8.
116    * @return The default font size, or a negative value if not set.
117    */
118   int GetDefaultFontSize() const;
119
120   /**
121    * @brief Retrieves the user defined Theme.
122    * @return The user defined Theme.
123    */
124   const std::string& GetTheme() const;
125
126   /**
127    * @brief Sets an user defined Theme.
128    * @param[in] themeFilePath Path of the user defined theme
129    */
130   void SetTheme(const std::string& themeFilePath);
131
132   /**
133    * @brief Utility to load a theme file
134    * @param filename of the theme
135    * @param output to write the contents to
136    * @return true if the load is successful
137    */
138   bool LoadThemeFile( const std::string& filename, std::string& output );
139
140 public: // Signals
141
142   /**
143    * @brief This signal is emitted whenever the style changes on the device.
144    *
145    * A callback of the following type may be connected:
146    * @code
147    *   void YourCallbackName(StyleMonitor styleMonitor, StyleChange change);
148    * @endcode
149    * @return The signal to connect to.
150    */
151   StyleChangeSignalType& StyleChangeSignal();
152
153 public: // Operators
154
155   /**
156    * @brief Assignment operator.
157    *
158    * The handle points to the same implementation as the one being copied from.
159    * @param[in]  monitor  The Style Monitor to copy from.
160    * @return reference to this object
161    */
162   StyleMonitor& operator=(const StyleMonitor& monitor);
163
164 public: // Not intended for application developers
165   /**
166    * @brief This constructor is used internally to create a handle from an object pointer.
167    * @param [in] styleMonitor A pointer the internal style monitor.
168    */
169   explicit DALI_INTERNAL StyleMonitor(Internal::Adaptor::StyleMonitor* styleMonitor);
170 };
171
172 } // namespace Dali
173
174 #endif // DALI_STYLE_MONITOR_H