Merge "Boost removal from performance server" into devel/master
[platform/core/uifw/dali-adaptor.git] / adaptors / common / style-monitor-impl.h
1 #ifndef __DALI_INTERNAL_STYLE_MONITOR_H__
2 #define __DALI_INTERNAL_STYLE_MONITOR_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
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 // EXTERNAL INCLUDES
22 #include <dali/public-api/object/ref-object.h>
23 #include <dali/public-api/object/base-object.h>
24 #include <dali/integration-api/platform-abstraction.h>
25
26 // INTERNAL INCLUDES
27 #include <style-monitor.h>
28
29 namespace Dali
30 {
31
32 namespace Internal
33 {
34
35 namespace Adaptor
36 {
37
38 /**
39  * This holds the platform's style information.
40  * It provides a signal when any aspect of the default style changes on the device.
41  */
42 class StyleMonitor : public BaseObject
43 {
44 public:
45
46   // Creation & Destruction
47
48   /**
49    * Constructor.
50    * @param[in]  platformAbstraction  The platform abstraction.
51    */
52   StyleMonitor(Integration::PlatformAbstraction& platformAbstraction);
53
54   /**
55    * Retrieve the initialized instance of the StyleMonitor.
56    * @return Handle to StyleMonitor.
57    */
58   static Dali::StyleMonitor Get();
59
60   // Style Change Notifications
61
62   /**
63    * Informs the Style Monitor that the style has changed.
64    * @param[in]  styleChange  The details of the change.
65    */
66   void StyleChanged( StyleChange::Type styleChange );
67
68   // Style Information
69
70   /**
71    * @copydoc Dali::StyleMonitor::GetDefaultFontFamily() const
72    */
73   std::string GetDefaultFontFamily() const;
74
75   /**
76    * @copydoc Dali::StyleMonitor::GetDefaultFontStyle() const
77    */
78   std::string GetDefaultFontStyle() const;
79
80   /**
81    * @copydoc Dali::StyleMonitor::GetDefaultFontSize() const
82    */
83   int GetDefaultFontSize() const;
84
85   /**
86    * @copydoc Dali::StyleMonitor::GetTheme() const
87    */
88   const std::string& GetTheme() const;
89
90   /**
91    * @copydoc Dali::StyleMonitor::SetTheme()
92    */
93   void SetTheme(const std::string& themeFilePath);
94
95   /**
96    * @copydoc Dali::StyleMonitor::LoadThemeFile()
97    */
98   bool LoadThemeFile( const std::string& filename, std::string& output );
99
100   // Signals
101
102   /**
103    * @copydoc Dali::StyleMonitor::StyleChangeSignal()
104    */
105   Dali::StyleMonitor::StyleChangeSignalType& StyleChangeSignal();
106
107 protected:
108
109   /**
110    * Virtual Destructor.
111    */
112   virtual ~StyleMonitor();
113
114 private:
115
116   /**
117    * Emit the style change signal.
118    * @param[in]  styleChange  The details of the style change
119    */
120   inline void EmitStyleChangeSignal( StyleChange::Type styleChange );
121
122 private:
123
124   Dali::StyleMonitor::StyleChangeSignalType mStyleChangeSignal; ///< Emitted when the style changes
125
126   Integration::PlatformAbstraction& mPlatformAbstraction; ///< Reference to the PlatformAbstraction (for retrieving defaults)
127
128   std::string mDefaultFontFamily;        ///< The default font family
129   std::string mDefaultFontStyle;         ///< The default font style
130   std::string mUserDefinedThemeFilePath; ///< String containing the user defined theme file path
131   int mDefaultFontSize;                  ///< The default accessibility font size e.g. 0 is smallest
132 };
133
134 } // namespace Adaptor
135
136 } // namespace Internal
137
138 // Additional Helpers for public-api forwarding methods
139
140 inline Internal::Adaptor::StyleMonitor& GetImplementation(Dali::StyleMonitor& monitor)
141 {
142   DALI_ASSERT_ALWAYS(monitor && "Monitor handle is empty");
143   BaseObject& handle = monitor.GetBaseObject();
144   return static_cast<Internal::Adaptor::StyleMonitor&>(handle);
145 }
146
147 inline const Internal::Adaptor::StyleMonitor& GetImplementation(const Dali::StyleMonitor& monitor)
148 {
149   DALI_ASSERT_ALWAYS(monitor && "Monitor handle is empty");
150   const BaseObject& handle = monitor.GetBaseObject();
151   return static_cast<const Internal::Adaptor::StyleMonitor&>(handle);
152 }
153
154 } // namespace Dali
155
156 #endif // __DALI_INTERNAL_STYLE_MONITOR_H__