X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Fpublic-api%2Fcontrols%2Fcontrol.cpp;h=b83a6523ba15f4435d4136d2779c084822fe8036;hb=aaf4d0fc389f5dea68d99ce68413c18a472f7e4e;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..b83a652 100644 --- a/dali-toolkit/public-api/controls/control.cpp +++ b/dali-toolkit/public-api/controls/control.cpp @@ -1,20 +1,27 @@ -// -// 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) 2015 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 namespace Dali @@ -23,20 +30,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 +59,94 @@ Control& Control::operator=( const Control& handle ) Control Control::DownCast( BaseHandle handle ) { - return DownCast(handle); -} - -ControlImpl& Control::GetImplementation() -{ - return static_cast(CustomActor::GetImplementation()); -} - -const ControlImpl& Control::GetImplementation() const -{ - return static_cast(CustomActor::GetImplementation()); + return DownCast< Control, Internal::Control >(handle); } -void Control::SetSizePolicy( SizePolicy widthPolicy, SizePolicy heightPolicy ) -{ - GetImplementation().SetSizePolicy( widthPolicy, heightPolicy ); -} - -void Control::GetSizePolicy( SizePolicy& widthPolicy, SizePolicy& heightPolicy ) const -{ - GetImplementation().GetSizePolicy( widthPolicy, heightPolicy ); -} - -void Control::SetMinimumSize( const Vector3& size ) +void Control::SetKeyInputFocus() { - GetImplementation().SetMinimumSize( size ); + Internal::GetImplementation(*this).SetKeyInputFocus(); } -const Vector3& Control::GetMinimumSize() const +bool Control::HasKeyInputFocus() { - return GetImplementation().GetMinimumSize(); + return Internal::GetImplementation(*this).HasKeyInputFocus(); } -void Control::SetMaximumSize( const Vector3& size ) +void Control::ClearKeyInputFocus() { - GetImplementation().SetMaximumSize( size ); + Internal::GetImplementation(*this).ClearKeyInputFocus(); } -const Vector3& Control::GetMaximumSize() const +PinchGestureDetector Control::GetPinchGestureDetector() const { - return GetImplementation().GetMaximumSize(); + return Internal::GetImplementation(*this).GetPinchGestureDetector(); } -Vector3 Control::GetNaturalSize() +PanGestureDetector Control::GetPanGestureDetector() const { - return GetImplementation().GetNaturalSize(); + return Internal::GetImplementation(*this).GetPanGestureDetector(); } -float Control::GetHeightForWidth( float width ) +TapGestureDetector Control::GetTapGestureDetector() const { - return GetImplementation().GetHeightForWidth( width ); + return Internal::GetImplementation(*this).GetTapGestureDetector(); } -float Control::GetWidthForHeight( float height ) +LongPressGestureDetector Control::GetLongPressGestureDetector() const { - return GetImplementation().GetWidthForHeight( height ); + return Internal::GetImplementation(*this).GetLongPressGestureDetector(); } -void Control::SetKeyInputFocus() +void Control::SetStyleName( const std::string& styleName ) { - GetImplementation().SetKeyInputFocus(); + Internal::GetImplementation(*this).SetStyleName( styleName ); } -bool Control::HasKeyInputFocus() +const std::string& Control::GetStyleName() const { - return GetImplementation().HasKeyInputFocus(); + return Internal::GetImplementation(*this).GetStyleName(); } -void Control::ClearKeyInputFocus() +void Control::SetBackgroundColor( const Vector4& color ) { - GetImplementation().ClearKeyInputFocus(); -} + DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetBackgroundImage() is deprecated and will be removed from next release. use Property::BACKGROUND instead.\n" ); -PinchGestureDetector Control::GetPinchGestureDetector() const -{ - return GetImplementation().GetPinchGestureDetector(); + Internal::GetImplementation(*this).SetBackgroundColor( color ); } -PanGestureDetector Control::GetPanGestureDetector() const +Vector4 Control::GetBackgroundColor() const { - return GetImplementation().GetPanGestureDetector(); -} + DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: GetBackgroundColor() is deprecated and will be removed from next release. use Property::BACKGROUND instead.\n" ); -TapGestureDetector Control::GetTapGestureDetector() const -{ - return GetImplementation().GetTapGestureDetector(); + return Internal::GetImplementation(*this).GetBackgroundColor(); } -LongPressGestureDetector Control::GetLongPressGestureDetector() const +void Control::SetBackgroundImage( Image image ) { - return GetImplementation().GetLongPressGestureDetector(); + Internal::GetImplementation(*this).SetBackgroundImage( image ); } -Control::KeyEventSignalV2& Control::KeyEventSignal() +void Control::ClearBackground() { - return GetImplementation().KeyEventSignal(); + Internal::GetImplementation(*this).ClearBackground(); } -/** - * @copydoc ConnectionTrackerInterface::SignalConnected - */ -void Control::SignalConnected( SlotObserver* slotObserver, CallbackBase* callback ) +Control::KeyEventSignalType& Control::KeyEventSignal() { - GetImplementation().SignalConnected(slotObserver, callback ); + return Internal::GetImplementation(*this).KeyEventSignal(); } -/** - * @copydoc ConnectionTrackerInterface::SignalDisconnected - */ -void Control::SignalDisconnected( SlotObserver* slotObserver, CallbackBase* callback ) +Control::KeyInputFocusSignalType& Control::KeyInputFocusGainedSignal() { - GetImplementation().SignalDisconnected(slotObserver, callback ); + return Internal::GetImplementation(*this).KeyInputFocusGainedSignal(); } -/** - * @copydoc ConnectionTrackerInterface::GetConnectionCount - */ -std::size_t Control::GetConnectionCount() const +Control::KeyInputFocusSignalType& Control::KeyInputFocusLostSignal() { - return GetImplementation().GetConnectionCount( ); + return Internal::GetImplementation(*this).KeyInputFocusLostSignal(); } - -Control::Control(ControlImpl& implementation) +Control::Control(Internal::Control& implementation) : CustomActor(implementation) { } @@ -186,7 +154,7 @@ Control::Control(ControlImpl& implementation) Control::Control(Dali::Internal::CustomActor* internal) : CustomActor(internal) { - VerifyCustomActorPointer(internal); + VerifyCustomActorPointer(internal); } } // namespace Toolkit