f1214f7dcb27acd5c5633b701b29d77ca5c9f7a2
[platform/core/uifw/dali-adaptor.git] / capi / dali / public-api / adaptor-framework / common / style-monitor.h
1 #ifndef __DALI_STYLE_MONITOR_H__
2 #define __DALI_STYLE_MONITOR_H__
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
7 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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  * @addtogroup CAPI_DALI_ADAPTOR_MODULE
22  * @{
23  */
24
25 // EXTERNAL INCLUDES
26 #include <boost/function.hpp>
27 #include <string>
28
29 #include <dali/public-api/object/base-handle.h>
30 #include <dali/public-api/signals/dali-signal-v2.h>
31
32 // INTERNAL INCLUDES
33 #include <dali/public-api/adaptor-framework/common/style-change.h>
34
35 namespace Dali DALI_IMPORT_API
36 {
37
38 namespace Internal DALI_INTERNAL
39 {
40 namespace Adaptor
41 {
42 class StyleMonitor;
43 }
44 }
45
46 /**
47  * @brief Monitors the platform for style changes.
48  *
49  * This is a handle to the adaptor's style monitor which holds the platform's style information.
50  * It provides a signal when any aspect of the default style changes on the device.
51  * @see Adaptor::GetStyleMonitor
52  */
53 class StyleMonitor : public BaseHandle
54 {
55 public: // Typedefs
56
57   typedef SignalV2< void (StyleMonitor, StyleChange) > StyleChangeSignalV2;   ///< StyleChange Signal type
58
59 public: // Creation & Destruction
60
61   /**
62    * @brief Create an uninitialized StyleMonitor handle.
63    *
64    * Tthis can be set by retrieving the style monitor from the Adaptor
65    * or the Application classes.  Calling member functions when
66    * uninitialized is not allowed.
67    */
68   StyleMonitor();
69
70   /**
71    * @brief Creates a copy of the handle.
72    *
73    * The copy will point to the same implementation as the original.
74    * @param[in]  monitor  The Style Monitor to copy from.
75    */
76   StyleMonitor(const StyleMonitor& monitor);
77
78   /**
79    * @brief Retrieve the initialized instance of the StyleMonitor.
80    * @return Handle to StyleMonitor.
81    */
82   static StyleMonitor Get();
83
84   /**
85    * @brief Destructor.
86    */
87   virtual ~StyleMonitor();
88
89   /**
90    * @brief Downcast an Object handle to StyleMonitor handle.
91    *
92    * If handle points to a StyleMonitor object the downcast produces a
93    * valid handle. If not the returned handle is left uninitialized.
94    *
95    * @param[in] handle to An object @return handle to a Timer object
96    * or an uninitialized handle
97    */
98   static StyleMonitor DownCast( BaseHandle handle );
99
100   /**
101    * @copydoc Dali::BaseHandle::operator=
102    */
103   using BaseHandle::operator=;
104
105 public: // Style Information
106
107   /**
108    * @brief Retrieves the default font family.
109    * @return The default font family.
110    */
111   std::string GetDefaultFontFamily() const;
112
113   /**
114    * @brief Retrieves the default font size
115    * @return The default font size.
116    */
117   float GetDefaultFontSize() const;
118
119   /**
120    * @brief Retrieves the user defined Theme.
121    * @return The user defined Theme.
122    */
123   const std::string& GetTheme() const;
124
125   /**
126    * @brief Sets an user defined Theme.
127    * @param[in] themeFilePath Path of the user defined theme
128    */
129   void SetTheme(const std::string& themeFilePath);
130
131 public: // Signals
132
133   /**
134    * @brief This signal is emitted whenever the style changes on the device.
135    *
136    * A callback of the following type may be connected:
137    * @code
138    *   void YourCallbackName(StyleMonitor styleMonitor, StyleChange change);
139    * @endcode
140    * @return The signal to connect to.
141    */
142   StyleChangeSignalV2& StyleChangeSignal();
143
144 public: // Operators
145
146   /**
147    * @brief Assignment operator.
148    *
149    * The handle points to the same implementation as the one being copied from.
150    * @param[in]  monitor  The Style Monitor to copy from.
151    * @return reference to this object
152    */
153   StyleMonitor& operator=(const StyleMonitor& monitor);
154
155
156 public: // Not intended for application developers
157   /**
158    * @brief This constructor is used internally to create a handle from an object pointer.
159    * @param [in] styleMonitor A pointer the internal style monitor.
160    */
161   explicit DALI_INTERNAL StyleMonitor(Internal::Adaptor::StyleMonitor* styleMonitor);
162 };
163
164 } // namespace Dali
165
166 /**
167  * @}
168  */
169 #endif // __DALI_STYLE_MONITOR_H__