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.
24 #include <dali/public-api/object/base-handle.h>
25 #include <dali/public-api/signals/dali-signal.h>
28 #include "style-change.h"
33 namespace Internal DALI_INTERNAL
42 * @brief Monitors the platform for style changes.
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
48 class DALI_IMPORT_API StyleMonitor : public BaseHandle
52 typedef Signal< void (StyleMonitor, StyleChange) > StyleChangeSignalType; ///< StyleChange Signal type
54 public: // Creation & Destruction
57 * @brief Create an uninitialized StyleMonitor handle.
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.
66 * @brief Creates a copy of the handle.
68 * The copy will point to the same implementation as the original.
69 * @param[in] monitor The Style Monitor to copy from.
71 StyleMonitor(const StyleMonitor& monitor);
74 * @brief Retrieve the initialized instance of the StyleMonitor.
75 * @return Handle to StyleMonitor.
77 static StyleMonitor Get();
82 * This is non-virtual since derived Handle types must not contain data or virtual methods.
87 * @brief Downcast an Object handle to StyleMonitor handle.
89 * If handle points to a StyleMonitor object the downcast produces a
90 * valid handle. If not the returned handle is left uninitialized.
92 * @param[in] handle to An object @return handle to a Timer object
93 * or an uninitialized handle
95 static StyleMonitor DownCast( BaseHandle handle );
97 public: // Style Information
100 * @brief Retrieves the default font family.
101 * @return The default font family.
103 std::string GetDefaultFontFamily() const;
106 * @brief Retrieves the default font size
107 * @return The default font size.
109 float GetDefaultFontSize() const;
112 * @brief Retrieves the user defined Theme.
113 * @return The user defined Theme.
115 const std::string& GetTheme() const;
118 * @brief Sets an user defined Theme.
119 * @param[in] themeFilePath Path of the user defined theme
121 void SetTheme(const std::string& themeFilePath);
126 * @brief This signal is emitted whenever the style changes on the device.
128 * A callback of the following type may be connected:
130 * void YourCallbackName(StyleMonitor styleMonitor, StyleChange change);
132 * @return The signal to connect to.
134 StyleChangeSignalType& StyleChangeSignal();
139 * @brief Assignment operator.
141 * The handle points to the same implementation as the one being copied from.
142 * @param[in] monitor The Style Monitor to copy from.
143 * @return reference to this object
145 StyleMonitor& operator=(const StyleMonitor& monitor);
147 public: // Not intended for application developers
149 * @brief This constructor is used internally to create a handle from an object pointer.
150 * @param [in] styleMonitor A pointer the internal style monitor.
152 explicit DALI_INTERNAL StyleMonitor(Internal::Adaptor::StyleMonitor* styleMonitor);
157 #endif // __DALI_STYLE_MONITOR_H__