1 #ifndef __DALI_STYLE_MONITOR_H__
2 #define __DALI_STYLE_MONITOR_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 * @addtogroup CAPI_DALI_ADAPTOR_MODULE
27 #include <boost/function.hpp>
30 #include <dali/public-api/object/base-handle.h>
31 #include <dali/public-api/signals/dali-signal-v2.h>
34 #include "style-change.h"
36 namespace Dali DALI_IMPORT_API
39 namespace Internal DALI_INTERNAL
48 * @brief Monitors the platform for style changes.
50 * This is a handle to the adaptor's style monitor which holds the platform's style information.
51 * It provides a signal when any aspect of the default style changes on the device.
52 * @see Adaptor::GetStyleMonitor
54 class StyleMonitor : public BaseHandle
58 typedef SignalV2< void (StyleMonitor, StyleChange) > StyleChangeSignalV2; ///< StyleChange Signal type
60 public: // Creation & Destruction
63 * @brief Create an uninitialized StyleMonitor handle.
65 * Tthis can be set by retrieving the style monitor from the Adaptor
66 * or the Application classes. Calling member functions when
67 * uninitialized is not allowed.
72 * @brief Creates a copy of the handle.
74 * The copy will point to the same implementation as the original.
75 * @param[in] monitor The Style Monitor to copy from.
77 StyleMonitor(const StyleMonitor& monitor);
80 * @brief Retrieve the initialized instance of the StyleMonitor.
81 * @return Handle to StyleMonitor.
83 static StyleMonitor Get();
88 * This is non-virtual since derived Handle types must not contain data or virtual methods.
93 * @brief Downcast an Object handle to StyleMonitor handle.
95 * If handle points to a StyleMonitor object the downcast produces a
96 * valid handle. If not the returned handle is left uninitialized.
98 * @param[in] handle to An object @return handle to a Timer object
99 * or an uninitialized handle
101 static StyleMonitor DownCast( BaseHandle handle );
104 * @copydoc Dali::BaseHandle::operator=
106 using BaseHandle::operator=;
108 public: // Style Information
111 * @brief Retrieves the default font family.
112 * @return The default font family.
114 std::string GetDefaultFontFamily() const;
117 * @brief Retrieves the default font size
118 * @return The default font size.
120 float GetDefaultFontSize() const;
123 * @brief Retrieves the user defined Theme.
124 * @return The user defined Theme.
126 const std::string& GetTheme() const;
129 * @brief Sets an user defined Theme.
130 * @param[in] themeFilePath Path of the user defined theme
132 void SetTheme(const std::string& themeFilePath);
137 * @brief This signal is emitted whenever the style changes on the device.
139 * A callback of the following type may be connected:
141 * void YourCallbackName(StyleMonitor styleMonitor, StyleChange change);
143 * @return The signal to connect to.
145 StyleChangeSignalV2& StyleChangeSignal();
150 * @brief Assignment operator.
152 * The handle points to the same implementation as the one being copied from.
153 * @param[in] monitor The Style Monitor to copy from.
154 * @return reference to this object
156 StyleMonitor& operator=(const StyleMonitor& monitor);
159 public: // Not intended for application developers
161 * @brief This constructor is used internally to create a handle from an object pointer.
162 * @param [in] styleMonitor A pointer the internal style monitor.
164 explicit DALI_INTERNAL StyleMonitor(Internal::Adaptor::StyleMonitor* styleMonitor);
172 #endif // __DALI_STYLE_MONITOR_H__