1 #ifndef __DALI_INTERNAL_STYLE_MONITOR_H__
2 #define __DALI_INTERNAL_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 <dali/public-api/object/ref-object.h>
23 #include <dali/public-api/object/base-object.h>
24 #include <dali/devel-api/text-abstraction/font-client.h>
27 #include <style-monitor.h>
39 * This holds the platform's style information.
40 * It provides a signal when any aspect of the default style changes on the device.
42 class StyleMonitor : public BaseObject
46 // Creation & Destruction
54 * Retrieve the initialized instance of the StyleMonitor.
55 * @return Handle to StyleMonitor.
57 static Dali::StyleMonitor Get();
59 // Style Change Notifications
62 * Informs the Style Monitor that the style has changed.
63 * @param[in] styleChange The details of the change.
65 void StyleChanged( StyleChange::Type styleChange );
70 * @copydoc Dali::StyleMonitor::GetDefaultFontFamily() const
72 std::string GetDefaultFontFamily() const;
75 * @copydoc Dali::StyleMonitor::GetDefaultFontStyle() const
77 std::string GetDefaultFontStyle() const;
80 * @copydoc Dali::StyleMonitor::GetDefaultFontSize() const
82 int GetDefaultFontSize() const;
85 * @copydoc Dali::StyleMonitor::GetTheme() const
87 const std::string& GetTheme() const;
90 * @copydoc Dali::StyleMonitor::SetTheme()
92 void SetTheme(const std::string& themeFilePath);
95 * @copydoc Dali::StyleMonitor::LoadThemeFile()
97 bool LoadThemeFile( const std::string& filename, std::string& output );
100 * @copydoc Dali::StyleMonitor::GetIgnoreGlobalFontSizeChange()
102 int GetIgnoreGlobalFontSizeChange();
105 * @copydoc Dali::StyleMonitor::SetIgnoreGlobalFontSizeChange()
107 void SetIgnoreGlobalFontSizeChange(int value);
112 * @copydoc Dali::StyleMonitor::StyleChangeSignal()
114 Dali::StyleMonitor::StyleChangeSignalType& StyleChangeSignal();
119 * Virtual Destructor.
121 virtual ~StyleMonitor();
126 * Emit the style change signal.
127 * @param[in] styleChange The details of the style change
129 inline void EmitStyleChangeSignal( StyleChange::Type styleChange );
133 Dali::StyleMonitor::StyleChangeSignalType mStyleChangeSignal; ///< Emitted when the style changes
135 TextAbstraction::FontClient mFontClient;
136 std::string mDefaultFontFamily; ///< The system default font family
137 std::string mDefaultFontStyle; ///< The default font style
138 std::string mUserDefinedThemeFilePath; ///< String containing the user defined theme file path
139 int mDefaultFontSize; ///< The default accessibility font size e.g. 0 is smallest
140 int mIgnoreGlobalFontSizeChange; ///< Ignore global font size change when it is 1
143 } // namespace Adaptor
145 } // namespace Internal
147 // Additional Helpers for public-api forwarding methods
149 inline Internal::Adaptor::StyleMonitor& GetImplementation(Dali::StyleMonitor& monitor)
151 DALI_ASSERT_ALWAYS(monitor && "Monitor handle is empty");
152 BaseObject& handle = monitor.GetBaseObject();
153 return static_cast<Internal::Adaptor::StyleMonitor&>(handle);
156 inline const Internal::Adaptor::StyleMonitor& GetImplementation(const Dali::StyleMonitor& monitor)
158 DALI_ASSERT_ALWAYS(monitor && "Monitor handle is empty");
159 const BaseObject& handle = monitor.GetBaseObject();
160 return static_cast<const Internal::Adaptor::StyleMonitor&>(handle);
165 #endif // __DALI_INTERNAL_STYLE_MONITOR_H__