X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Fpublic-api%2Fcontrols%2Fcontrol.cpp;h=14205f908b10eab1ac6c3ea80e19bcac32880ced;hb=a0a28eb90260b017d231b0a2ff993825405fd058;hp=bf3d9cc1825d7d5ee2d5fe155e8d2fa1189ca08e;hpb=818994dc0acac601b0b27c0b715259b504ef4ceb;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/public-api/controls/control.cpp b/dali-toolkit/public-api/controls/control.cpp index bf3d9cc..14205f9 100644 --- a/dali-toolkit/public-api/controls/control.cpp +++ b/dali-toolkit/public-api/controls/control.cpp @@ -1,21 +1,29 @@ -// -// 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) 2017 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 + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES #include +#include namespace Dali { @@ -23,20 +31,17 @@ namespace Dali namespace Toolkit { -const char* const Control::ACTION_CONTROL_ACTIVATED = "control-activated"; -const char* const Control::SIGNAL_KEY_EVENT = "key-event"; - Control Control::New() { - return ControlImpl::New(); + return Internal::Control::New(); } Control::Control() { } -Control::Control(const Control& uiControl) -: CustomActor( uiControl ? static_cast( uiControl.GetImplementation() ).GetOwner() : NULL) +Control::Control( const Control& uiControl ) +: CustomActor( uiControl ) { } @@ -55,130 +60,117 @@ Control& Control::operator=( const Control& handle ) Control Control::DownCast( BaseHandle handle ) { - return DownCast(handle); + return DownCast< Control, Internal::Control >(handle); } -ControlImpl& Control::GetImplementation() +void Control::SetKeyInputFocus() { - return static_cast(CustomActor::GetImplementation()); + Internal::GetImplementation(*this).SetKeyInputFocus(); } -const ControlImpl& Control::GetImplementation() const +bool Control::HasKeyInputFocus() { - return static_cast(CustomActor::GetImplementation()); + return Internal::GetImplementation(*this).HasKeyInputFocus(); } -void Control::SetSizePolicy( SizePolicy widthPolicy, SizePolicy heightPolicy ) +void Control::ClearKeyInputFocus() { - GetImplementation().SetSizePolicy( widthPolicy, heightPolicy ); + Internal::GetImplementation(*this).ClearKeyInputFocus(); } -void Control::GetSizePolicy( SizePolicy& widthPolicy, SizePolicy& heightPolicy ) const +PinchGestureDetector Control::GetPinchGestureDetector() const { - GetImplementation().GetSizePolicy( widthPolicy, heightPolicy ); + return Internal::GetImplementation(*this).GetPinchGestureDetector(); } -void Control::SetMinimumSize( const Vector3& size ) +PanGestureDetector Control::GetPanGestureDetector() const { - GetImplementation().SetMinimumSize( size ); + return Internal::GetImplementation(*this).GetPanGestureDetector(); } -const Vector3& Control::GetMinimumSize() const +TapGestureDetector Control::GetTapGestureDetector() const { - return GetImplementation().GetMinimumSize(); + return Internal::GetImplementation(*this).GetTapGestureDetector(); } -void Control::SetMaximumSize( const Vector3& size ) +LongPressGestureDetector Control::GetLongPressGestureDetector() const { - GetImplementation().SetMaximumSize( size ); + return Internal::GetImplementation(*this).GetLongPressGestureDetector(); } -const Vector3& Control::GetMaximumSize() const +void Control::SetStyleName( const std::string& styleName ) { - return GetImplementation().GetMaximumSize(); + Internal::GetImplementation(*this).SetStyleName( styleName ); } -Vector3 Control::GetNaturalSize() +const std::string& Control::GetStyleName() const { - return GetImplementation().GetNaturalSize(); + return Internal::GetImplementation(*this).GetStyleName(); } -float Control::GetHeightForWidth( float width ) +void Control::SetBackgroundColor( const Vector4& color ) { - return GetImplementation().GetHeightForWidth( width ); + Internal::GetImplementation(*this).SetBackgroundColor( color ); } -float Control::GetWidthForHeight( float height ) +Vector4 Control::GetBackgroundColor() const { - return GetImplementation().GetWidthForHeight( height ); -} + DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: GetBackgroundColor() is deprecated and will be removed from next release. use Property::BACKGROUND instead.\n" ); -void Control::SetKeyInputFocus() -{ - GetImplementation().SetKeyInputFocus(); + return Internal::GetImplementation(*this).GetBackgroundColor(); } -bool Control::HasKeyInputFocus() +void Control::SetBackgroundImage( Image image ) { - return GetImplementation().HasKeyInputFocus(); -} + DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetBackgroundImage() is deprecated and will be removed from next release. use Property::BACKGROUND instead.\n" ); -void Control::ClearKeyInputFocus() -{ - GetImplementation().ClearKeyInputFocus(); + Internal::GetImplementation(*this).SetBackgroundImage( image ); } -PinchGestureDetector Control::GetPinchGestureDetector() const +void Control::ClearBackground() { - return GetImplementation().GetPinchGestureDetector(); + Internal::GetImplementation(*this).ClearBackground(); } -PanGestureDetector Control::GetPanGestureDetector() const +bool Control::IsResourceReady() const { - return GetImplementation().GetPanGestureDetector(); -} + const Internal::Control& internalControl = Toolkit::Internal::GetImplementation( *this ); + const Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( internalControl ); -TapGestureDetector Control::GetTapGestureDetector() const -{ - return GetImplementation().GetTapGestureDetector(); + return controlDataImpl.IsResourceReady(); } -LongPressGestureDetector Control::GetLongPressGestureDetector() const +Toolkit::Visual::ResourceStatus Control::GetVisualResourceStatus( Dali::Property::Index index ) { - return GetImplementation().GetLongPressGestureDetector(); + const Internal::Control& internalControl = Toolkit::Internal::GetImplementation( *this ); + const Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( internalControl ); + return controlDataImpl.GetVisualResourceStatus( index ); } -Control::KeyEventSignalV2& Control::KeyEventSignal() +Control::KeyEventSignalType& Control::KeyEventSignal() { - return GetImplementation().KeyEventSignal(); + return Internal::GetImplementation(*this).KeyEventSignal(); } -/** - * @copydoc ConnectionTrackerInterface::SignalConnected - */ -void Control::SignalConnected( SlotObserver* slotObserver, CallbackBase* callback ) +Control::KeyInputFocusSignalType& Control::KeyInputFocusGainedSignal() { - GetImplementation().SignalConnected(slotObserver, callback ); + return Internal::GetImplementation(*this).KeyInputFocusGainedSignal(); } -/** - * @copydoc ConnectionTrackerInterface::SignalDisconnected - */ -void Control::SignalDisconnected( SlotObserver* slotObserver, CallbackBase* callback ) +Control::KeyInputFocusSignalType& Control::KeyInputFocusLostSignal() { - GetImplementation().SignalDisconnected(slotObserver, callback ); + return Internal::GetImplementation(*this).KeyInputFocusLostSignal(); } -/** - * @copydoc ConnectionTrackerInterface::GetConnectionCount - */ -std::size_t Control::GetConnectionCount() const +Control::ResourceReadySignalType& Control::ResourceReadySignal() { - return GetImplementation().GetConnectionCount( ); -} + Internal::Control& internalControl = Toolkit::Internal::GetImplementation( *this ); + Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get( internalControl ); + return controlImpl.mResourceReadySignal; +} -Control::Control(ControlImpl& implementation) +Control::Control(Internal::Control& implementation) : CustomActor(implementation) { } @@ -186,7 +178,7 @@ Control::Control(ControlImpl& implementation) Control::Control(Dali::Internal::CustomActor* internal) : CustomActor(internal) { - VerifyCustomActorPointer(internal); + VerifyCustomActorPointer(internal); } } // namespace Toolkit