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 #include <boost/function.hpp>
25 #include <dali/public-api/object/base-handle.h>
26 #include <dali/public-api/signals/dali-signal-v2.h>
29 #include "style-change.h"
34 namespace Internal DALI_INTERNAL
43 * @brief Monitors the platform for style changes.
45 * This is a handle to the adaptor's style monitor which holds the platform's style information.
46 * It provides a signal when any aspect of the default style changes on the device.
47 * @see Adaptor::GetStyleMonitor
49 class DALI_IMPORT_API StyleMonitor : public BaseHandle
53 typedef SignalV2< void (StyleMonitor, StyleChange) > StyleChangeSignalV2; ///< StyleChange Signal type
55 public: // Creation & Destruction
58 * @brief Create an uninitialized StyleMonitor handle.
60 * Tthis can be set by retrieving the style monitor from the Adaptor
61 * or the Application classes. Calling member functions when
62 * uninitialized is not allowed.
67 * @brief Creates a copy of the handle.
69 * The copy will point to the same implementation as the original.
70 * @param[in] monitor The Style Monitor to copy from.
72 StyleMonitor(const StyleMonitor& monitor);
75 * @brief Retrieve the initialized instance of the StyleMonitor.
76 * @return Handle to StyleMonitor.
78 static StyleMonitor Get();
83 * This is non-virtual since derived Handle types must not contain data or virtual methods.
88 * @brief Downcast an Object handle to StyleMonitor handle.
90 * If handle points to a StyleMonitor object the downcast produces a
91 * valid handle. If not the returned handle is left uninitialized.
93 * @param[in] handle to An object @return handle to a Timer object
94 * or an uninitialized handle
96 static StyleMonitor DownCast( BaseHandle handle );
98 public: // Style Information
101 * @brief Retrieves the default font family.
102 * @return The default font family.
104 std::string GetDefaultFontFamily() const;
107 * @brief Retrieves the default font size
108 * @return The default font size.
110 float GetDefaultFontSize() const;
113 * @brief Retrieves the user defined Theme.
114 * @return The user defined Theme.
116 const std::string& GetTheme() const;
119 * @brief Sets an user defined Theme.
120 * @param[in] themeFilePath Path of the user defined theme
122 void SetTheme(const std::string& themeFilePath);
127 * @brief This signal is emitted whenever the style changes on the device.
129 * A callback of the following type may be connected:
131 * void YourCallbackName(StyleMonitor styleMonitor, StyleChange change);
133 * @return The signal to connect to.
135 StyleChangeSignalV2& StyleChangeSignal();
140 * @brief Assignment operator.
142 * The handle points to the same implementation as the one being copied from.
143 * @param[in] monitor The Style Monitor to copy from.
144 * @return reference to this object
146 StyleMonitor& operator=(const StyleMonitor& monitor);
148 public: // Not intended for application developers
150 * @brief This constructor is used internally to create a handle from an object pointer.
151 * @param [in] styleMonitor A pointer the internal style monitor.
153 explicit DALI_INTERNAL StyleMonitor(Internal::Adaptor::StyleMonitor* styleMonitor);
158 #endif // __DALI_STYLE_MONITOR_H__