X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Fpublic-api%2Fcontrols%2Fcontrol.cpp;h=5bbc4e72ac3dfb48c715e4fe960acdc33e8ac859;hp=8652f1a0ec90110642ea4eea0c1905f7add99c5c;hb=5ff76a127dce1541de4f27d29db5e019d80363e0;hpb=d57dd5d306bcfaee778dcb6c00e24465f0f4f5de diff --git a/dali-toolkit/public-api/controls/control.cpp b/dali-toolkit/public-api/controls/control.cpp index 8652f1a..5bbc4e7 100644 --- a/dali-toolkit/public-api/controls/control.cpp +++ b/dali-toolkit/public-api/controls/control.cpp @@ -1,20 +1,24 @@ -// -// 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 + +// INTERNAL INCLUDES #include namespace Dali @@ -23,22 +27,9 @@ 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() { - // Use TypeRegistry to create instance of control so that the type-info matches Control rather than ControlImpl - TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(Control) ); - DALI_ASSERT_ALWAYS( typeInfo && "TypeRegistry returning Invalid TypeInfo" ); - - BaseHandle handle = typeInfo.CreateInstance(); - DALI_ASSERT_ALWAYS( handle && "Unable to Create Control" ); - - Control control = DownCast( handle ); - DALI_ASSERT_ALWAYS( handle && "TypeRegistry did not create a Control" ); - - return control; + return Internal::Control::New(); } Control::Control() @@ -46,7 +37,7 @@ Control::Control() } Control::Control(const Control& uiControl) -: CustomActor( uiControl ? static_cast( uiControl.GetImplementation() ).GetOwner() : NULL) +: CustomActor( uiControl ? static_cast< const Internal::Control& >( uiControl.GetImplementation() ).GetOwner() : NULL) { } @@ -65,62 +56,17 @@ 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()); -} - -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 ) -{ - GetImplementation().SetMinimumSize( size ); -} - -const Vector3& Control::GetMinimumSize() const -{ - return GetImplementation().GetMinimumSize(); -} - -void Control::SetMaximumSize( const Vector3& size ) -{ - GetImplementation().SetMaximumSize( size ); -} - -const Vector3& Control::GetMaximumSize() const -{ - return GetImplementation().GetMaximumSize(); -} - -Vector3 Control::GetNaturalSize() -{ - return GetImplementation().GetNaturalSize(); + return DownCast< Control, Internal::Control >(handle); } -float Control::GetHeightForWidth( float width ) +Internal::Control& Control::GetImplementation() { - return GetImplementation().GetHeightForWidth( width ); + return static_cast(CustomActor::GetImplementation()); } -float Control::GetWidthForHeight( float height ) +const Internal::Control& Control::GetImplementation() const { - return GetImplementation().GetWidthForHeight( height ); + return static_cast(CustomActor::GetImplementation()); } void Control::SetKeyInputFocus() @@ -158,6 +104,16 @@ LongPressGestureDetector Control::GetLongPressGestureDetector() const return GetImplementation().GetLongPressGestureDetector(); } +void Control::SetStyleName( const std::string& styleName ) +{ + GetImplementation().SetStyleName( styleName ); +} + +const std::string& Control::GetStyleName() const +{ + return GetImplementation().GetStyleName(); +} + void Control::SetBackgroundColor( const Vector4& color ) { GetImplementation().SetBackgroundColor( color ); @@ -168,9 +124,9 @@ Vector4 Control::GetBackgroundColor() const return GetImplementation().GetBackgroundColor(); } -void Control::SetBackground( Image image ) +void Control::SetBackgroundImage( Image image ) { - GetImplementation().SetBackground( image ); + GetImplementation().SetBackgroundImage( image ); } void Control::ClearBackground() @@ -183,37 +139,22 @@ Actor Control::GetBackgroundActor() const return GetImplementation().GetBackgroundActor(); } -Control::KeyEventSignalV2& Control::KeyEventSignal() +Control::KeyEventSignalType& Control::KeyEventSignal() { return GetImplementation().KeyEventSignal(); } -/** - * @copydoc ConnectionTrackerInterface::SignalConnected - */ -void Control::SignalConnected( SlotObserver* slotObserver, CallbackBase* callback ) +Control::KeyInputFocusSignalType& Control::KeyInputFocusGainedSignal() { - GetImplementation().SignalConnected(slotObserver, callback ); + return GetImplementation().KeyInputFocusGainedSignal(); } -/** - * @copydoc ConnectionTrackerInterface::SignalDisconnected - */ -void Control::SignalDisconnected( SlotObserver* slotObserver, CallbackBase* callback ) +Control::KeyInputFocusSignalType& Control::KeyInputFocusLostSignal() { - GetImplementation().SignalDisconnected(slotObserver, callback ); + return GetImplementation().KeyInputFocusLostSignal(); } -/** - * @copydoc ConnectionTrackerInterface::GetConnectionCount - */ -std::size_t Control::GetConnectionCount() const -{ - return GetImplementation().GetConnectionCount( ); -} - - -Control::Control(ControlImpl& implementation) +Control::Control(Internal::Control& implementation) : CustomActor(implementation) { } @@ -221,7 +162,7 @@ Control::Control(ControlImpl& implementation) Control::Control(Dali::Internal::CustomActor* internal) : CustomActor(internal) { - VerifyCustomActorPointer(internal); + VerifyCustomActorPointer(internal); } } // namespace Toolkit