X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fnavigation-frame%2Fnavigation-control-impl.cpp;h=84eb4e4e2be19549130fec66b4a4f756344a104e;hb=69b938841cf1ee06dde7659fa56ecfac20d48923;hp=37ca96a50a9dd9231b436954db2dde775bdc545d;hpb=e2eda444afbe82e9591fe198eef339227f90a616;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.cpp b/dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.cpp index 37ca96a..84eb4e4 100644 --- a/dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.cpp +++ b/dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.cpp @@ -1,26 +1,34 @@ -// -// 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. + * + */ // CLASS HEADER #include "navigation-control-impl.h" -//INTERNAL INCLUDES +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include + +// INTERNAL INCLUDES +#include #include #include -#include #include namespace Dali @@ -34,19 +42,24 @@ namespace Internal namespace // to register type { + BaseHandle Create() { return Toolkit::NavigationControl::New(); } -TypeRegistration mType( typeid(Toolkit::NavigationControl), typeid(Toolkit::Control), Create ); +// Setup properties, signals and actions using the type-registry. +DALI_TYPE_REGISTRATION_BEGIN( Toolkit::NavigationControl, Toolkit::Control, Create ) + +DALI_ACTION_REGISTRATION( NavigationControl, "push", ACTION_PUSH ) +DALI_ACTION_REGISTRATION( NavigationControl, "pop", ACTION_POP ) + +DALI_TYPE_REGISTRATION_END() -TypeAction a1(mType, Toolkit::NavigationControl::ACTION_PUSH, &NavigationControl::DoAction); -TypeAction a2(mType, Toolkit::NavigationControl::ACTION_POP, &NavigationControl::DoAction); } NavigationControl::NavigationControl() -: ControlImpl( true ), +: Control( REQUIRES_TOUCH_EVENTS ), mToolBar(NULL), mTitleBar(NULL), mOrientationAngle( 0 ), @@ -251,12 +264,12 @@ void NavigationControl::OrientationChanged( int angle ) } } + Actor self = Self(); Animation animation = Animation::New( mOrientationAnimationDuration ); - animation.SetDestroyAction( Animation::Bake ); - animation.RotateTo( Self(), Degree( -angle ), Vector3::ZAXIS, mOrientationAnimationAlphaFunc ); + animation.AnimateTo( Property( self, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( -angle ) ), Vector3::ZAXIS ), mOrientationAnimationAlphaFunc ); animation.Play(); - Self().SetSize( targetSize ); + self.SetSize( targetSize ); RelayoutRequest(); } @@ -273,7 +286,7 @@ Layer NavigationControl::GetBarLayer() const return mBarLayer; } -void NavigationControl::OnRelaidOut( Vector2 size, ActorSizeContainer& container ) +void NavigationControl::OnRelayout( const Vector2& size, RelayoutContainer& container ) { const Vector2 setSize( size ); @@ -296,11 +309,11 @@ void NavigationControl::OnRelaidOut( Vector2 size, ActorSizeContainer& container mCurrentItem.SetPosition( mItemPositionCoefficient * positionOffset); Vector2 itemSize( setSize.x, setSize.y-sizeShrink ); - Relayout(mCurrentItem, itemSize, container); + container.Add( mCurrentItem, itemSize ); } - container.push_back(ActorSizePair( mBarLayer, setSize )); - container.push_back(ActorSizePair( mPopupLayer, setSize )); + container.Add( mBarLayer, setSize ); + container.Add( mPopupLayer, setSize ); } void NavigationControl::OnControlSizeSet( const Vector3& size ) @@ -398,48 +411,48 @@ void NavigationControl::OnPopupTouchedOutside() } } -Toolkit::NavigationControl::ItemPushedSignalV2& NavigationControl::ItemPushedSignal() +Toolkit::NavigationControl::ItemPushedSignalType& NavigationControl::ItemPushedSignal() { return mItemPushedSignal; } -Toolkit::NavigationControl::ItemPoppedSignalV2& NavigationControl::ItemPoppedSignal() +Toolkit::NavigationControl::ItemPoppedSignalType& NavigationControl::ItemPoppedSignal() { return mItemPoppedSignal; } -bool NavigationControl::DoAction(BaseObject* object, const std::string& actionName, const std::vector& attributes) +bool NavigationControl::DoAction( BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes ) { bool ret = false; - Dali::BaseHandle handle(object); - Toolkit::NavigationControl control = Toolkit::NavigationControl::DownCast(handle); - DALI_ASSERT_ALWAYS(control); + Dali::BaseHandle handle( object ); + Toolkit::NavigationControl control = Toolkit::NavigationControl::DownCast( handle ); + DALI_ASSERT_ALWAYS( control ); - if (Toolkit::NavigationControl::ACTION_PUSH == actionName) + if( 0 == strcmp( actionName.c_str(), ACTION_PUSH ) ) { - for (PropertyValueConstIter iter = attributes.begin(); iter != attributes.end(); ++iter) + for( PropertyValueConstIter iter = attributes.begin(); iter != attributes.end(); ++iter ) { const Property::Value& value = *iter; - DALI_ASSERT_ALWAYS(value.GetType() == Property::STRING); - std::string itemName = value.Get (); + DALI_ASSERT_ALWAYS( value.GetType() == Property::STRING ); + std::string itemName = value.Get(); - for (std::list::iterator itemsIter = GetImpl(control).mUnpushedItems.begin(); itemsIter != GetImpl(control).mUnpushedItems.end(); ++itemsIter) + for( std::list::iterator itemsIter = GetImpl( control ).mUnpushedItems.begin(); itemsIter != GetImpl( control ).mUnpushedItems.end(); ++itemsIter ) { Toolkit::Page page = *itemsIter; - if (page.GetName() == itemName) + if( page.GetName() == itemName ) { - GetImpl(control).PushItem(page); + GetImpl( control ).PushItem( page ); ret = true; break; } } } } - else if(Toolkit::NavigationControl::ACTION_POP == actionName) + else if( 0 == strcmp( actionName.c_str(), ACTION_POP ) ) { - GetImpl(control).PopItem(); + GetImpl( control ).PopItem(); ret = true; }