Conversion to Apache 2.0 license
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / public-api / controls / control-impl.cpp
index d8d1e36..6f9275c 100644 (file)
@@ -1,18 +1,19 @@
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
 
 #include <dali-toolkit/public-api/controls/control-impl.h>
 
@@ -576,15 +577,12 @@ void Control::Initialize()
   // Calling deriving classes
   OnInitialize();
 
-  if( mImpl->mFlags & REQUIRES_THEME_CHANGE_SIGNALS )
+  if( mImpl->mFlags & REQUIRES_STYLE_CHANGE_SIGNALS )
   {
     Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
 
-    // Register for font/theme changes
-    styleManager.ThemeChangeSignal().Connect( this, &ControlImpl::OnThemeChange );
-
-    // Set theme
-    GetImpl( styleManager ).ApplyThemeStyle( GetOwner() );
+    // Register for style changes
+    styleManager.StyleChangeSignal().Connect( this, &ControlImpl::DoStyleChange );
   }
 
   mImpl->mInitialized = true;
@@ -743,6 +741,11 @@ Actor Control::GetBackgroundActor() const
   return Actor();
 }
 
+void Control::OnThemeChange( Toolkit::StyleManager styleManager )
+{
+  GetImpl( styleManager ).ApplyThemeStyle( GetOwner() );
+}
+
 void Control::OnPinch(PinchGesture pinch)
 {
   if (pinch.state == Gesture::Started)
@@ -906,6 +909,21 @@ void Control::DoActivatedAction(const PropertyValueContainer& attributes)
   OnActivated();
 }
 
+void Control::DoStyleChange( Toolkit::StyleManager styleManager, StyleChange change )
+{
+  if( change.themeChange )
+  {
+    OnThemeChange( styleManager );
+  }
+  else if( change.defaultFontChange || change.defaultFontSizeChange )
+  {
+    // This OnStyleChange(StyleChange change ) is deprecated, use OnFontChange instead
+    OnStyleChange( change );
+
+    OnFontChange( change.defaultFontChange, change.defaultFontSizeChange );
+  }
+}
+
 Toolkit::Control::KeyEventSignalV2& Control::KeyEventSignal()
 {
   return mImpl->mKeyEventSignalV2;
@@ -1188,11 +1206,6 @@ void Control::NegotiateSize( Vector2 allocatedSize, ActorSizeContainer& containe
   Relayout( size, container );
 }
 
-void Control::OnThemeChange( Toolkit::StyleManager styleManager )
-{
-  GetImpl( styleManager ).ApplyThemeStyle( GetOwner() );
-}
-
 bool Control::EmitKeyEventSignal( const KeyEvent& event )
 {
   // Guard against destruction during signal emission