Dali 3D User Interface Engine
toolkit-style-monitor.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 #include "toolkit-style-monitor.h"
19 
23 
24 namespace Dali
25 {
26 
27 
28 namespace Internal
29 {
30 namespace Adaptor
31 {
35 class StyleMonitor : public BaseObject
36 {
37 public: // Creation & Destruction
38  static Dali::StyleMonitor Get();
39  StyleMonitor();
40  ~StyleMonitor();
41 
42 public: // Style Information
43  std::string GetDefaultFontFamily() const;
44  float GetDefaultFontSize() const;
45  const std::string& GetTheme() const;
46  void SetTheme(std::string theme);
47 
48 public: // Signals
50 
52  {
53  mStyleChangeSignal.Emit(Dali::StyleMonitor(this), styleChange);
54  }
55 
56 private:
59  std::string mTheme;
60 };
61 
63 
65 {
66  if( ! mToolkitStyleMonitor )
67  {
69  }
70  return mToolkitStyleMonitor;
71 }
72 
74 : mTheme("default")
75 {
76 }
77 
79 {
80 }
81 
82 std::string StyleMonitor::GetDefaultFontFamily() const
83 {
85 }
86 
88 {
90 }
91 
92 const std::string& StyleMonitor::GetTheme() const
93 {
94  return mTheme;
95 }
96 
97 void StyleMonitor::SetTheme(std::string path)
98 {
99  mTheme = path;
101 }
102 
104 {
105  return mStyleChangeSignal;
106 }
107 
108 } // namespace Adaptor
109 } // namespace Internal
110 
112 
113 Internal::Adaptor::StyleMonitor& GetImplementation(Dali::StyleMonitor& monitor)
114 {
115  BaseObject& object = monitor.GetBaseObject();
116  return static_cast<Internal::Adaptor::StyleMonitor&>(object);
117 }
118 const Internal::Adaptor::StyleMonitor& GetImplementation(const Dali::StyleMonitor& monitor)
119 {
120  const BaseObject& object = monitor.GetBaseObject();
121  return static_cast<const Internal::Adaptor::StyleMonitor&>(object);
122 }
123 
124 const std::string Dali::StyleMonitor::DEFAULT_FONT_FAMILY("DefaultFont");
125 const float Dali::StyleMonitor::DEFAULT_FONT_SIZE(1.0f);
126 
128 {
129 }
130 
132 : BaseHandle(monitor)
133 {
134 }
135 
137 {
139 }
140 
142 {
143 }
144 
146 {
147  return GetImplementation(*this).GetDefaultFontFamily();
148 }
149 
151 {
152  return GetImplementation(*this).GetDefaultFontSize();
153 }
154 
155 const std::string& StyleMonitor::GetTheme() const
156 {
157  return GetImplementation(*this).GetTheme();
158 }
159 
160 void StyleMonitor::SetTheme(std::string themeFilePath)
161 {
162  GetImplementation(*this).SetTheme(themeFilePath);
163 }
164 
166 {
167  return GetImplementation(*this).StyleChangeSignal();
168 }
169 
171 {
172  GetImplementation(*this).EmitStyleChangeSignal(styleChange);
173 }
174 
176 {
177  if( *this != monitor )
178  {
179  BaseHandle::operator=(monitor);
180  }
181  return *this;
182 }
183 
185 : BaseHandle(internal)
186 {
187 }
188 
189 } // namespace Dali
Dali Docs Home
Read more about Dali