X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=base%2Fdali-toolkit%2Fpublic-api%2Fcontrols%2Fcontrol-impl.cpp;h=1e420b1fde5f963d223e6ac1f9f0ee15920eeb95;hb=4870ce3c93eb1c86cf19f216195e003f3b578d27;hp=018e4f0c31f9a18d9161635c08fb810c08674b41;hpb=022b76df6f53c2860f2684ef1ffee81af1805e2e;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/base/dali-toolkit/public-api/controls/control-impl.cpp b/base/dali-toolkit/public-api/controls/control-impl.cpp index 018e4f0..1e420b1 100644 --- a/base/dali-toolkit/public-api/controls/control-impl.cpp +++ b/base/dali-toolkit/public-api/controls/control-impl.cpp @@ -1,22 +1,22 @@ -// -// 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 -#include #include #include @@ -577,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; @@ -744,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) @@ -776,7 +778,7 @@ void Control::OnChildAdd(Actor& child) return; } - // Request for relayout. + // Request for relayout as we may need to position the new child and old ones RelayoutRequest(); // Notify derived classes. @@ -791,7 +793,7 @@ void Control::OnChildRemove(Actor& child) return; } - // Request for relayout. + // Request for relayout as we may need to re-position the old child RelayoutRequest(); // Notify derived classes. @@ -856,6 +858,11 @@ bool Control::OnAccessibilityPan(PanGesture gesture) return false; // Accessibility pan gesture is not handled by default } +bool Control::OnAccessibilityTouch(const TouchEvent& touchEvent) +{ + return false; // Accessibility touch event is not handled by default +} + bool Control::OnAccessibilityValueChange(bool isIncrease) { return false; // Accessibility value change action is not handled by default @@ -894,12 +901,32 @@ bool Control::DoAction(BaseObject* object, const std::string& actionName, const { bool ret = false; + if( object && (actionName == Toolkit::Control::ACTION_CONTROL_ACTIVATED) ) + { + Toolkit::Control control = Toolkit::Control::DownCast( BaseHandle( object ) ); + if( control ) + { + // if cast succeeds there is an implementation so no need to check + control.GetImplementation().OnActivated(); + } + } + return ret; } -void Control::DoActivatedAction(const PropertyValueContainer& attributes) +void Control::DoStyleChange( Toolkit::StyleManager styleManager, StyleChange change ) { - OnActivated(); + 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() @@ -1038,7 +1065,12 @@ void Control::ClearKeyInputFocus() void Control::RelayoutRequest() { - Internal::RelayoutController::Get().Request(); + // unfortunate double negative but thats to guarantee new controls get size negotiation + // by default and have to "opt-out" if they dont want it + if( !(mImpl->mFlags & NO_SIZE_NEGOTIATION) ) + { + Internal::RelayoutController::Request(); + } } void Control::Relayout( Vector2 size, ActorSizeContainer& container ) @@ -1184,11 +1216,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