From: Adeel Kazmi Date: Wed, 10 Sep 2014 10:09:02 +0000 (+0100) Subject: [dali_1.0.8] Merge branch 'tizen' X-Git-Tag: dali_1.0.14~6 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=4306459adff5af631450cc660ca9dc8afd44d195;hp=5a1ea0b7f27fd31e8dd025aa385478996ee55427 [dali_1.0.8] Merge branch 'tizen' Change-Id: Icdf80abf29cb1bc9a0fb71ceb2206f3b5495083a --- diff --git a/automated-tests/src/dali-toolkit-internal/CMakeLists.txt b/automated-tests/src/dali-toolkit-internal/CMakeLists.txt index da51107..ff683d5 100644 --- a/automated-tests/src/dali-toolkit-internal/CMakeLists.txt +++ b/automated-tests/src/dali-toolkit-internal/CMakeLists.txt @@ -25,6 +25,7 @@ LIST(APPEND TC_SOURCES ../dali-toolkit/dali-toolkit-test-utils/toolkit-orientation.cpp ../dali-toolkit/dali-toolkit-test-utils/toolkit-physical-keyboard.cpp ../dali-toolkit/dali-toolkit-test-utils/toolkit-style-monitor.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-singleton-service.cpp ../dali-toolkit/dali-toolkit-test-utils/toolkit-timer.cpp ../dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp ../dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp diff --git a/automated-tests/src/dali-toolkit-unmanaged/CMakeLists.txt b/automated-tests/src/dali-toolkit-unmanaged/CMakeLists.txt index a1e6c7f..13c2d32 100644 --- a/automated-tests/src/dali-toolkit-unmanaged/CMakeLists.txt +++ b/automated-tests/src/dali-toolkit-unmanaged/CMakeLists.txt @@ -61,6 +61,7 @@ LIST(APPEND TC_SOURCES ../dali-toolkit/dali-toolkit-test-utils/toolkit-imf-manager.cpp ../dali-toolkit/dali-toolkit-test-utils/toolkit-physical-keyboard.cpp ../dali-toolkit/dali-toolkit-test-utils/toolkit-style-monitor.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-singleton-service.cpp ../dali-toolkit/dali-toolkit-test-utils/toolkit-timer.cpp ../dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp ../dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-Builder.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-Builder.cpp index 833a40e..f95bbe7 100644 --- a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-Builder.cpp +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-Builder.cpp @@ -19,6 +19,7 @@ #include #include #include +#include using namespace Dali; using namespace Toolkit; @@ -159,6 +160,21 @@ std::string ReplaceQuotes(const std::string &in_s) return s; } +struct BuilderFunctor +{ + BuilderFunctor( bool& called ) : mCalled( called ) + { + mCalled = false; + } + + void operator()() + { + mCalled = true; + } + + bool& mCalled; +}; + } // namespace @@ -429,3 +445,44 @@ int UtcDaliBuilderApplyFromJson(void) END_TEST; } + +int UtcDaliBuilderQuitSignal(void) +{ + ToolkitTestApplication application; + + // JSON with a quit event when the actor is touched + std::string json( + "{" + "\"stage\":" + "[{" + "\"type\": \"Actor\"," + "\"size\": [100,100,1]," + "\"parent-origin\": \"TOP_LEFT\"," + "\"anchor-point\": \"TOP_LEFT\"," + "\"signals\": [{" + "\"name\": \"touched\"," + "\"action\": \"quit\"" + "}]" + "}]" + "}" + ); + Builder builder = Builder::New(); + builder.LoadFromString( json ); + builder.AddActors ( Stage::GetCurrent().GetRootLayer() ); + + // Connect to builder's quit signal + bool functorCalled( false ); + builder.QuitSignal().Connect( &application, BuilderFunctor( functorCalled ) ); + + // Render and notify + application.SendNotification(); + application.Render(); + + // Emit touch event and check that our quit method is called + Integration::TouchEvent touchEvent; + touchEvent.points.push_back( TouchPoint ( 0, TouchPoint::Down, 10.0f, 10.0f ) ); + application.ProcessEvent( touchEvent ); + DALI_TEST_CHECK( functorCalled ); + + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/CMakeLists.txt b/automated-tests/src/dali-toolkit/CMakeLists.txt index a476f28..52f8353 100644 --- a/automated-tests/src/dali-toolkit/CMakeLists.txt +++ b/automated-tests/src/dali-toolkit/CMakeLists.txt @@ -43,6 +43,7 @@ LIST(APPEND TC_SOURCES dali-toolkit-test-utils/toolkit-imf-manager.cpp dali-toolkit-test-utils/toolkit-physical-keyboard.cpp dali-toolkit-test-utils/toolkit-style-monitor.cpp + dali-toolkit-test-utils/toolkit-singleton-service.cpp dali-toolkit-test-utils/toolkit-timer.cpp dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp dali-toolkit-test-utils/dummy-control.cpp diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp index 186fadd..17bd210 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp @@ -40,8 +40,6 @@ public: virtual Dali::Any GetSurface() { return Dali::Any(); } virtual Dali::Any GetDisplay() { return Dali::Any(); } virtual PositionSize GetPositionSize() const { return PositionSize(0, 0, 640, 480);} - virtual void SetRenderMode(RenderMode mode){} - virtual RenderMode GetRenderMode() const { return RenderSurface::RENDER_60FPS; } }; typedef Dali::Rect PositionSize; @@ -55,10 +53,6 @@ public: typedef SignalV2< void ( Adaptor& ) > AdaptorSignalV2; - typedef std::pair SingletonPair; - typedef std::map SingletonContainer; - typedef SingletonContainer::const_iterator SingletonConstIter; - public: Adaptor(ToolkitAdaptor& toolkitAdaptor); @@ -78,9 +72,6 @@ public: void RenderSync(); RenderSurface& GetSurface(); - void RegisterSingleton(const std::type_info& info, Dali::BaseHandle singleton); - Dali::BaseHandle GetSingleton(const std::type_info& info) const; - public: // static methods static Adaptor& Get(); static bool IsAvailable(); @@ -103,8 +94,6 @@ private: AdaptorSignalV2 mResizeSignal; TestRenderSurface mRenderSurface; ToolkitAdaptor& mToolkitAdaptor; - - SingletonContainer mSingletonContainer; }; namespace @@ -206,31 +195,6 @@ bool Adaptor::IsAvailable() return available; } -void Adaptor::RegisterSingleton(const std::type_info& info, Dali::BaseHandle singleton) -{ - mToolkitAdaptor.mFunctionsCalled.RegisterSingleton = true; - - if(singleton) - { - mSingletonContainer.insert(SingletonPair(info.name(), singleton)); - } -} - -Dali::BaseHandle Adaptor::GetSingleton(const std::type_info& info) const -{ - mToolkitAdaptor.mFunctionsCalled.GetSingleton = true; - - Dali::BaseHandle object = Dali::BaseHandle(); - - SingletonConstIter iter = mSingletonContainer.find(info.name()); - if(iter != mSingletonContainer.end()) - { - object = (*iter).second; - } - - return object; -} - Adaptor::AdaptorSignalV2& Adaptor::SignalResize() { mToolkitAdaptor.mFunctionsCalled.SignalResize = true; diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-singleton-service.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-singleton-service.cpp new file mode 100644 index 0000000..d92eb15 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-singleton-service.cpp @@ -0,0 +1,161 @@ +/* + * 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 "toolkit-singleton-service.h" + +#include +#include +#include +#include + +namespace Dali +{ + + +namespace Internal +{ +namespace Adaptor +{ + +/** + * Stub for the SingletonService + */ +class SingletonService : public Dali::BaseObject +{ +public: + static Dali::SingletonService New(); + static Dali::SingletonService Get(); + void Register( const std::type_info& info, BaseHandle singleton ); + BaseHandle GetSingleton( const std::type_info& info ) const; + +private: + SingletonService(); + virtual ~SingletonService(); + + // Undefined + SingletonService( const SingletonService& ); + SingletonService& operator=( SingletonService& ); + +private: + + typedef std::pair SingletonPair; + typedef std::map SingletonContainer; + typedef SingletonContainer::const_iterator SingletonConstIter; + + SingletonContainer mSingletonContainer; ///< The container to look up singleton by its type name + + static Dali::SingletonService mToolkitSingletonService; +}; + +Dali::SingletonService SingletonService::mToolkitSingletonService; + +Dali::SingletonService SingletonService::New() +{ + return Get(); +} + +Dali::SingletonService SingletonService::Get() +{ + if( ! mToolkitSingletonService ) + { + mToolkitSingletonService = Dali::SingletonService( new Dali::Internal::Adaptor::SingletonService ); + } + return mToolkitSingletonService; +} + +void SingletonService::Register( const std::type_info& info, BaseHandle singleton ) +{ + if( singleton ) + { + mSingletonContainer.insert( SingletonPair( info.name(), singleton ) ); + } +} + +BaseHandle SingletonService::GetSingleton( const std::type_info& info ) const +{ + BaseHandle object; + + SingletonConstIter iter = mSingletonContainer.find(info.name()); + if( iter != mSingletonContainer.end() ) + { + object = ( *iter ).second; + } + + return object; +} + +SingletonService::SingletonService() +: mSingletonContainer() +{ +} + +SingletonService::~SingletonService() +{ +} + +} // namespace Adaptor +} // namespace Internal + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +Internal::Adaptor::SingletonService& GetImplementation(Dali::SingletonService& player) +{ + DALI_ASSERT_ALWAYS( player && "SingletonService handle is empty" ); + + BaseObject& handle = player.GetBaseObject(); + + return static_cast(handle); +} + +const Internal::Adaptor::SingletonService& GetImplementation(const Dali::SingletonService& player) +{ + DALI_ASSERT_ALWAYS( player && "SingletonService handle is empty" ); + + const BaseObject& handle = player.GetBaseObject(); + + return static_cast(handle); +} + +SingletonService::SingletonService() +{ +} + +SingletonService SingletonService::Get() +{ + return Internal::Adaptor::SingletonService::Get(); +} + +SingletonService::~SingletonService() +{ +} + +void SingletonService::Register( const std::type_info& info, BaseHandle singleton ) +{ + GetImplementation( *this ).Register( info, singleton ); +} + +BaseHandle SingletonService::GetSingleton( const std::type_info& info ) const +{ + return GetImplementation( *this ).GetSingleton( info ); +} + +SingletonService::SingletonService( Internal::Adaptor::SingletonService* singletonService ) +: BaseHandle( singletonService ) +{ +} + +} // namespace Dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-singleton-service.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-singleton-service.h new file mode 100644 index 0000000..956925e --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-singleton-service.h @@ -0,0 +1,55 @@ +#ifndef __DALI_TOOLKIT_TOOLKIT_SINGLETON_SERVICE_H__ +#define __DALI_TOOLKIT_TOOLKIT_SINGLETON_SERVICE_H__ + +/* + * 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. + * + */ + +// EXTERNAL INCLUDES + +#define __DALI_SINGELTON_SERVICE_H__ +#include +#include + +// INTERNAL INCLUDES + +namespace Dali +{ + +namespace Internal DALI_INTERNAL +{ +namespace Adaptor +{ +class SingletonService; +} +} + +class SingletonService : public BaseHandle +{ +public: + SingletonService(); + static SingletonService Get(); + ~SingletonService(); + void Register( const std::type_info& info, BaseHandle singleton ); + BaseHandle GetSingleton( const std::type_info& info ) const; + +public: // Not intended for application developers + SingletonService( Internal::Adaptor::SingletonService* singletonService ); +}; + +} // namespace Dali + +#endif // __DALI_TOOLKIT_TOOLKIT_SINGLETON_SERVICE_H__ diff --git a/base/dali-toolkit/images/radio-button-active.png b/base/dali-toolkit/images/radio-button-active.png new file mode 100644 index 0000000..a59c438 Binary files /dev/null and b/base/dali-toolkit/images/radio-button-active.png differ diff --git a/base/dali-toolkit/images/radio-button-inactive.png b/base/dali-toolkit/images/radio-button-inactive.png new file mode 100644 index 0000000..04b05da Binary files /dev/null and b/base/dali-toolkit/images/radio-button-inactive.png differ diff --git a/base/dali-toolkit/internal/builder/builder-impl.cpp b/base/dali-toolkit/internal/builder/builder-impl.cpp index 31def0e..f6af80e 100644 --- a/base/dali-toolkit/internal/builder/builder-impl.cpp +++ b/base/dali-toolkit/internal/builder/builder-impl.cpp @@ -20,6 +20,7 @@ // EXTERNAL INCLUDES #include +#include #include // INTERNAL INCLUDES @@ -49,8 +50,8 @@ extern bool SetPropertyFromNode( const TreeNode& node, Property::Value& value ); extern bool SetPropertyFromNode( const TreeNode& node, Property::Value& value, const Replacement& replacements ); extern bool SetPropertyFromNode( const TreeNode& node, Property::Type type, Property::Value& value ); extern bool SetPropertyFromNode( const TreeNode& node, Property::Type type, Property::Value& value, const Replacement& replacements ); -extern Actor SetupSignalAction(ConnectionTracker* tracker, const TreeNode &root, const TreeNode &child, Actor actor); -extern Actor SetupPropertyNotification(ConnectionTracker* tracker, const TreeNode &root, const TreeNode &child, Actor actor); +extern Actor SetupSignalAction(ConnectionTracker* tracker, const TreeNode &root, const TreeNode &child, Actor actor, boost::function quitAction); +extern Actor SetupPropertyNotification(ConnectionTracker* tracker, const TreeNode &root, const TreeNode &child, Actor actor, boost::function quitAction); extern Actor SetupActor( const TreeNode& node, Actor& actor, const Replacement& constant ); #if defined(DEBUG_ENABLED) @@ -208,6 +209,23 @@ void CollectAllStyles( const TreeNode& stylesCollection, const TreeNode& style, } } +struct QuitAction +{ +public: + QuitAction( Builder& builder ) + : mBuilder( builder ) + { + } + + void operator()(void) + { + mBuilder.EmitQuitSignal(); + } + +private: + Builder& mBuilder; +}; + } // namespace anon /* @@ -335,9 +353,9 @@ void Builder::ApplyProperties( const TreeNode& root, const TreeNode& node, SetupActor( node, actor, constant ); // add signals - SetupSignalAction( mSlotDelegate.GetConnectionTracker(), root, node, actor ); - - SetupPropertyNotification( mSlotDelegate.GetConnectionTracker(), root, node, actor ); + QuitAction quitAction( *this ); + SetupSignalAction( mSlotDelegate.GetConnectionTracker(), root, node, actor, quitAction ); + SetupPropertyNotification( mSlotDelegate.GetConnectionTracker(), root, node, actor, quitAction ); } } else @@ -726,6 +744,16 @@ FrameBufferImage Builder::GetFrameBufferImage( const std::string &name, const Re return ret; } +Toolkit::Builder::Signal& Builder::QuitSignal() +{ + return mQuitSignal; +} + +void Builder::EmitQuitSignal() +{ + mQuitSignal.Emit(); +} + void Builder::AddActors( Actor toActor ) { // 'stage' is the default/by convention section to add from diff --git a/base/dali-toolkit/internal/builder/builder-impl.h b/base/dali-toolkit/internal/builder/builder-impl.h index d533366..e82ed93 100644 --- a/base/dali-toolkit/internal/builder/builder-impl.h +++ b/base/dali-toolkit/internal/builder/builder-impl.h @@ -178,6 +178,16 @@ public: */ FrameBufferImage GetFrameBufferImage( const std::string &name, const Replacement& constant ); + /** + * @copydoc Toolkit::Builder::QuitSignal + */ + Toolkit::Builder::Signal& QuitSignal(); + + /** + * Emits the quit signal + */ + void EmitQuitSignal(); + protected: virtual ~Builder(); @@ -225,6 +235,7 @@ private: void SetProperties( const TreeNode& node, Handle& handle, const Replacement& constant ); + Toolkit::Builder::Signal mQuitSignal; }; } // namespace Internal diff --git a/base/dali-toolkit/internal/builder/builder-signals.cpp b/base/dali-toolkit/internal/builder/builder-signals.cpp index a22815e..3124c46 100644 --- a/base/dali-toolkit/internal/builder/builder-signals.cpp +++ b/base/dali-toolkit/internal/builder/builder-signals.cpp @@ -43,17 +43,6 @@ using namespace Dali; // Signal Actions // -// Action quit; connected to signals -// TODO: MOVE TO BUILDER TEMPLATE -struct ActionQuit -{ - ActionQuit(void) {}; - - void operator()(void) { - // Dali::Application::Get().Quit(); - }; -}; - // Action on child actor. The child is found by alias so can be 'previous' etc. struct ChildActorAction { @@ -233,7 +222,7 @@ void DoNothing(void) {}; /** * Get an action as boost function callback */ -boost::function GetAction(const TreeNode &root, const TreeNode &child, Actor actor) +boost::function GetAction(const TreeNode &root, const TreeNode &child, Actor actor, boost::function quitAction) { OptionalString childActorName(IsString( IsChild(&child, "child-actor")) ); OptionalString actorName(IsString( IsChild(&child, "actor")) ); @@ -279,7 +268,7 @@ boost::function GetAction(const TreeNode &root, const TreeNode &chi } else if("quit" == *actionName) { - callback = ActionQuit(); + callback = quitAction; } else if("play" == *actionName) { @@ -383,7 +372,7 @@ Actor SetupPropertyNotification(const TreeNode &child, Actor actor); /** * Setup signals and actions on an actor */ -Actor SetupSignalAction(ConnectionTracker* tracker, const TreeNode &root, const TreeNode &child, Actor actor) +Actor SetupSignalAction(ConnectionTracker* tracker, const TreeNode &root, const TreeNode &child, Actor actor, boost::function quitAction) { DALI_ASSERT_ALWAYS(actor); @@ -400,7 +389,7 @@ Actor SetupSignalAction(ConnectionTracker* tracker, const TreeNode &root, const OptionalString name( IsString( IsChild( key_child.second, "name")) ); DALI_ASSERT_ALWAYS(name && "Signal must have a name"); - boost::function callback = GetAction(root, key_child.second, actor); + boost::function callback = GetAction(root, key_child.second, actor, quitAction); actor.ConnectSignal(tracker, *name, callback); } @@ -412,7 +401,7 @@ Actor SetupSignalAction(ConnectionTracker* tracker, const TreeNode &root, const /** * Setup Property notifications for an actor */ -Actor SetupPropertyNotification(ConnectionTracker* tracker, const TreeNode &root, const TreeNode &child, Actor actor) +Actor SetupPropertyNotification(ConnectionTracker* tracker, const TreeNode &root, const TreeNode &child, Actor actor, boost::function quitAction) { DALI_ASSERT_ALWAYS(actor); @@ -426,7 +415,7 @@ Actor SetupPropertyNotification(ConnectionTracker* tracker, const TreeNode &root // Actor actions reference by pointer because of circular reference actor->signal // So this callback should only go onto the actor maintained list. - boost::function callback = GetAction(root, key_child.second, actor); + boost::function callback = GetAction(root, key_child.second, actor, quitAction); OptionalString prop(IsString( IsChild(key_child.second, "property")) ); DALI_ASSERT_ALWAYS(prop && "Notification signal must specify a property"); diff --git a/base/dali-toolkit/internal/controls/buttons/radio-button-impl.cpp b/base/dali-toolkit/internal/controls/buttons/radio-button-impl.cpp new file mode 100644 index 0000000..669394a --- /dev/null +++ b/base/dali-toolkit/internal/controls/buttons/radio-button-impl.cpp @@ -0,0 +1,222 @@ +/* + * 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 "radio-button-impl.h" + +using namespace Dali; +using namespace Dali::Toolkit::Internal; + +namespace Dali +{ +namespace Toolkit +{ +const Property::Index RadioButton::PROPERTY_ACTIVE = Internal::Button::BUTTON_PROPERTY_END_INDEX + 11; +const Property::Index RadioButton::PROPERTY_LABEL_ACTOR = Internal::Button::BUTTON_PROPERTY_END_INDEX + 12; +} +} + +namespace +{ + +BaseHandle Create() +{ + return Toolkit::RadioButton::New(); +} + +TypeRegistration typeRegistration(typeid (Toolkit::RadioButton ), typeid (Toolkit::Button ), Create); + +PropertyRegistration property1(typeRegistration, "active", Toolkit::RadioButton::PROPERTY_ACTIVE, Property::BOOLEAN, &RadioButton::SetProperty, &RadioButton::GetProperty); +PropertyRegistration property2(typeRegistration, "label-actor", Toolkit::RadioButton::PROPERTY_LABEL_ACTOR, Property::MAP, &RadioButton::SetProperty, &RadioButton::GetProperty); +} + +namespace +{ +const char* const INACTIVE_BUTTON_IMAGE_DIR = DALI_IMAGE_DIR "radio-button-inactive.png"; +const char* const ACTIVE_BUTTON_IMAGE_DIR = DALI_IMAGE_DIR "radio-button-active.png"; +const Vector3 IMAGE_WIDTH(16.f, 0.f, 0.f); +const Vector3 DISTANCE_BETWEEN_IMAGE_AND_LABEL(5.f, 0.f, 0.f); +} + +Dali::Toolkit::RadioButton RadioButton::New() +{ + // Create the implementation, temporarily owned on stack + IntrusivePtr< RadioButton > internalRadioButton = new RadioButton(); + + // Pass ownership to CustomActor + Dali::Toolkit::RadioButton radioButton(*internalRadioButton); + + // Second-phase init of the implementation + // This can only be done after the CustomActor connection has been made... + internalRadioButton->Initialize(); + + return radioButton; +} + +RadioButton::RadioButton() + : Button(), + mActive(false) +{ + mInactiveImage = Dali::Image::New(INACTIVE_BUTTON_IMAGE_DIR); + mActiveImage = Dali::Image::New(ACTIVE_BUTTON_IMAGE_DIR); + + mImageActor = Dali::ImageActor::New(mInactiveImage); + mLabel = Actor::New(); +} + +RadioButton::~RadioButton() +{ +} + +void RadioButton::SetLabel(const std::string& label) +{ + mLabel.Reset(); + mLabel = Actor::New(); + + Toolkit::TextView textView = Toolkit::TextView::New(label); + textView.SetWidthExceedPolicy(Toolkit::TextView::ShrinkToFit); // Make sure our text always fits inside the button + textView.SetAnchorPoint(AnchorPoint::TOP_LEFT); + + mLabel.Add(textView); +} + +void RadioButton::SetLabel(Actor label) +{ + if( mLabel != label ) + { + Self().Remove(mLabel); + mLabel = label; + Self().Add(mLabel); + } +} + +Actor RadioButton::GetLabel() const +{ + return mLabel; +} + +void RadioButton::SetActive(bool active) +{ + if( mActive != active ) + { + if( active ) + { + Actor parent = Self().GetParent(); + + if( parent ) + { + for( unsigned int i = 0; i < parent.GetChildCount(); ++i ) + { + Dali::Toolkit::RadioButton rbChild = Dali::Toolkit::RadioButton::DownCast(parent.GetChildAt(i)); + + if( rbChild ) + { + rbChild.SetActive(false); + } + } + } + mActive = true; + mImageActor.SetImage(mActiveImage); + } + else + { + mActive = false; + mImageActor.SetImage(mInactiveImage); + } + } +} + +bool RadioButton::IsActive()const +{ + return mActive; +} + +void RadioButton::ToggleState() +{ + SetActive(!mActive); +} + +void RadioButton::OnInitialize() +{ + mImageActor.SetAnchorPoint(AnchorPoint::TOP_LEFT); + Self().Add(mImageActor); + + mLabel.SetAnchorPoint(AnchorPoint::TOP_LEFT); + mLabel.MoveBy(IMAGE_WIDTH + DISTANCE_BETWEEN_IMAGE_AND_LABEL); + Self().Add(mLabel); +} + +void RadioButton::OnButtonUp() +{ + ToggleState(); +} + +void RadioButton::SetProperty(BaseObject* object, Property::Index propertyIndex, const Property::Value& value) +{ + Toolkit::RadioButton radioButton = Toolkit::RadioButton::DownCast(Dali::BaseHandle(object)); + + if( radioButton ) + { + RadioButton & radioButtonImpl(GetImplementation(radioButton)); + + switch ( propertyIndex ) + { + case Toolkit::RadioButton::PROPERTY_ACTIVE: + { + radioButtonImpl.SetActive(value.Get< bool >( )); + break; + } + case Toolkit::RadioButton::PROPERTY_LABEL_ACTOR: + { + radioButtonImpl.SetLabel(Scripting::NewActor(value.Get< Property::Map >( ))); + break; + } + } + } +} + +Property::Value RadioButton::GetProperty(BaseObject* object, Property::Index propertyIndex) +{ + Property::Value value; + + Toolkit::RadioButton radioButton = Toolkit::RadioButton::DownCast(Dali::BaseHandle(object)); + + if( radioButton ) + { + RadioButton & radioButtonImpl(GetImplementation(radioButton)); + + switch ( propertyIndex ) + { + case Toolkit::RadioButton::PROPERTY_ACTIVE: + { + value = radioButtonImpl.mActive; + break; + } + case Toolkit::RadioButton::PROPERTY_LABEL_ACTOR: + { + Property::Map map; + Scripting::CreatePropertyMap(radioButtonImpl.mLabel, map); + value = map; + break; + } + } + } + + return value; +} \ No newline at end of file diff --git a/base/dali-toolkit/internal/controls/buttons/radio-button-impl.h b/base/dali-toolkit/internal/controls/buttons/radio-button-impl.h new file mode 100644 index 0000000..1ee813f --- /dev/null +++ b/base/dali-toolkit/internal/controls/buttons/radio-button-impl.h @@ -0,0 +1,171 @@ +#ifndef __DALI_TOOLKIT_INTERNAL_RADIO_BUTTON_H__ +#define __DALI_TOOLKIT_INTERNAL_RADIO_BUTTON_H__ + +/* + * 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. + * + */ + +// INTERNAL INCLUDES +#include + +#include + +#include + +#include + +#include "button-impl.h" + +namespace Dali +{ +namespace Toolkit +{ +namespace Internal +{ + +/** + * RadioButton implementation class. + * + * \sa Dali::Toolkit::RadioButton + */ +class RadioButton: public Button +{ + public: + + /** + * Create a new RadioButton. + * + * @return A smart-pointer to the newly allocated PushButton. + */ + static Dali::Toolkit::RadioButton New(); + + /** + * Construct a new PushButton. + */ + RadioButton(); + + /** + * Construct a new PushButton with label. + */ + RadioButton(const std::string& label); + + /** + * Construct a new PushButton with label. + */ + RadioButton(Actor label); + + /** + * A reference counted object may only be deleted by calling Unreference() + */ + virtual ~RadioButton(); + + /** + * @copydoc Dali::Toolkit::RadioButton::SetLabel(const std::string& label) + */ + void SetLabel(const std::string& label); + + /** + * @copydoc Dali::Toolkit::RadioButton::SetLabel(Actor label) + */ + void SetLabel(Actor label); + + /** + * @copydoc Dali::Toolkit::RadioButton::GetLabel() + */ + Actor GetLabel() const; + + /** + * @copydoc Dali::Toolkit::RadioButton::SetActive(bool active) + */ + void SetActive(bool active); + + /** + * @copydoc Dali::Toolkit::RadioButton::IsActive() + */ + bool IsActive()const; + + /** + * @copydoc Dali::Toolkit::RadioButton::ToggleState() + */ + void ToggleState(); + + public: + // Properties + + /** + * @copydoc Button::SetProperty + */ + static void SetProperty(BaseObject* object, Property::Index propertyIndex, const Property::Value& value); + + /** + * @copydoc Button::GetProperty + */ + static Property::Value GetProperty(BaseObject* object, Property::Index propertyIndex); + + protected: // From Control + + /** + * Sets the relative position of image and label. + */ + virtual void OnInitialize(); + + protected: // From Button + /** + * Change button state when the button is pressed. + */ + virtual void OnButtonUp(); + + private: + + // Undefined + RadioButton(const RadioButton& origin); + + // Undefined + RadioButton& operator=(const RadioButton& origin); + + Image mInactiveImage; ///< Stores the inactive image + Image mActiveImage; ///< Stores the active image + ImageActor mImageActor; ///< Stores the current image + Actor mLabel; ///< Stores the button label + bool mActive; ///< Stores the active state +} ; + +} // namespace Internal + +// Helpers for public-api forwarding methods + +inline Toolkit::Internal::RadioButton& GetImplementation(Toolkit::RadioButton& button) +{ + DALI_ASSERT_ALWAYS(button); + + Dali::RefObject& handle = button.GetImplementation(); + + return static_cast (handle); +} + +inline const Toolkit::Internal::RadioButton& GetImplementation(const Toolkit::RadioButton& button) +{ + DALI_ASSERT_ALWAYS(button); + + const Dali::RefObject& handle = button.GetImplementation(); + + return static_cast (handle); +} + +} // namespace Toolkit +} // namespace Dali + +#endif // __DALI_TOOLKIT_INTERNAL_RADIO_BUTTON_H__ \ No newline at end of file diff --git a/base/dali-toolkit/internal/controls/relayout-controller.cpp b/base/dali-toolkit/internal/controls/relayout-controller.cpp index 8dce13a..1a3a4e6 100644 --- a/base/dali-toolkit/internal/controls/relayout-controller.cpp +++ b/base/dali-toolkit/internal/controls/relayout-controller.cpp @@ -67,24 +67,27 @@ void RelayoutController::Request() RelayoutController controller; // Check whether the RelayoutController is already created - Dali::Adaptor& adaptor = Dali::Adaptor::Get(); - Dali::BaseHandle handle = adaptor.GetSingleton(typeid(RelayoutController)); - - if(handle) + SingletonService singletonService( SingletonService::Get() ); + if ( singletonService ) { - // If so, downcast the handle of singleton to RelayoutController - controller = RelayoutController(dynamic_cast(handle.GetObjectPtr())); + Dali::BaseHandle handle = singletonService.GetSingleton(typeid(RelayoutController)); + + if(handle) + { + // If so, downcast the handle of singleton to RelayoutController + controller = RelayoutController(dynamic_cast(handle.GetObjectPtr())); + } + + if(!controller) + { + // If not, create the RelayoutController and register it as a singleton + controller = RelayoutController( new Internal::RelayoutControllerImpl(gRelayoutRequestPending) ); + singletonService.Register( typeid(controller), controller ); + } + + GetImpl(controller).Request(); + gRelayoutRequestPending = true; } - - if(!controller) - { - // If not, create the RelayoutController and register it as a singleton - controller = RelayoutController( new Internal::RelayoutControllerImpl(gRelayoutRequestPending) ); - adaptor.RegisterSingleton( typeid(controller), controller ); - } - - GetImpl(controller).Request(); - gRelayoutRequestPending = true; } } diff --git a/base/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp b/base/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp index dc33722..d7c6d8e 100755 --- a/base/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp +++ b/base/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp @@ -27,8 +27,8 @@ const char* DEFAULT_INDICATOR_IMAGE_PATH = DALI_IMAGE_DIR "popup_scroll.png"; const Vector4 DEFAULT_INDICATOR_NINE_PATCH_BORDER(4.0f, 9.0f, 7.0f, 11.0f); const float MINIMUM_INDICATOR_HEIGHT(20.0f); // The minimum indicator height for the nine patch border const float DEFAULT_SLIDER_DEPTH(1.0f); -const float INDICATOR_SHOW_TIME(0.5f); -const float INDICATOR_HIDE_TIME(0.5f); +const float DEFAULT_INDICATOR_SHOW_DURATION(0.5f); +const float DEFAULT_INDICATOR_HIDE_DURATION(0.5f); const float DEFAULT_PAN_GESTURE_PROCESS_TIME(16.7f); // 16.7 milliseconds, i.e. one frame const float DEFAULT_INDICATOR_FIXED_HEIGHT(80.0f); @@ -115,6 +115,8 @@ namespace Toolkit const Property::Index ScrollBar::PROPERTY_INDICATOR_HEIGHT_POLICY( Internal::ScrollBar::SCROLLBAR_PROPERTY_START_INDEX ); const Property::Index ScrollBar::PROPERTY_INDICATOR_FIXED_HEIGHT( Internal::ScrollBar::SCROLLBAR_PROPERTY_START_INDEX + 1 ); +const Property::Index ScrollBar::PROPERTY_INDICATOR_SHOW_DURATION( Internal::ScrollBar::SCROLLBAR_PROPERTY_START_INDEX + 2 ); +const Property::Index ScrollBar::PROPERTY_INDICATOR_HIDE_DURATION( Internal::ScrollBar::SCROLLBAR_PROPERTY_START_INDEX + 3 ); namespace Internal { @@ -135,10 +137,14 @@ TypeRegistration typeRegistration( typeid(Toolkit::ScrollBar), typeid(Toolkit::S PropertyRegistration property1( typeRegistration, "indicator-height-policy", Toolkit::ScrollBar::PROPERTY_INDICATOR_HEIGHT_POLICY, Property::STRING, &ScrollBar::SetProperty, &ScrollBar::GetProperty ); PropertyRegistration property2( typeRegistration, "indicator-fixed-height", Toolkit::ScrollBar::PROPERTY_INDICATOR_FIXED_HEIGHT, Property::FLOAT, &ScrollBar::SetProperty, &ScrollBar::GetProperty ); +PropertyRegistration property3( typeRegistration, "indicator-show-duration", Toolkit::ScrollBar::PROPERTY_INDICATOR_SHOW_DURATION, Property::FLOAT, &ScrollBar::SetProperty, &ScrollBar::GetProperty ); +PropertyRegistration property4( typeRegistration, "indicator-hide-duration", Toolkit::ScrollBar::PROPERTY_INDICATOR_HIDE_DURATION, Property::FLOAT, &ScrollBar::SetProperty, &ScrollBar::GetProperty ); } ScrollBar::ScrollBar() -: mScrollStart(0.0f), +: mIndicatorShowDuration(DEFAULT_INDICATOR_SHOW_DURATION), + mIndicatorHideDuration(DEFAULT_INDICATOR_HIDE_DURATION), + mScrollStart(0.0f), mIsPanning(false), mCurrentScrollPosition(0.0f), mIndicatorHeightPolicy(Toolkit::ScrollBar::Variable), @@ -272,9 +278,16 @@ void ScrollBar::Show() mAnimation.Reset(); } - mAnimation = Animation::New( INDICATOR_SHOW_TIME ); - mAnimation.OpacityTo( Self(), 1.0f, AlphaFunctions::EaseIn ); - mAnimation.Play(); + if(mIndicatorShowDuration > 0.0f) + { + mAnimation = Animation::New( mIndicatorShowDuration ); + mAnimation.OpacityTo( Self(), 1.0f, AlphaFunctions::EaseIn ); + mAnimation.Play(); + } + else + { + Self().SetOpacity(1.0f); + } } void ScrollBar::Hide() @@ -286,9 +299,16 @@ void ScrollBar::Hide() mAnimation.Reset(); } - mAnimation = Animation::New( INDICATOR_HIDE_TIME ); - mAnimation.OpacityTo( Self(), 0.0f, AlphaFunctions::EaseIn ); - mAnimation.Play(); + if(mIndicatorHideDuration > 0.0f) + { + mAnimation = Animation::New( mIndicatorHideDuration ); + mAnimation.OpacityTo( Self(), 0.0f, AlphaFunctions::EaseIn ); + mAnimation.Play(); + } + else + { + Self().SetOpacity(0.0f); + } } bool ScrollBar::OnPanGestureProcessTick() @@ -397,6 +417,26 @@ float ScrollBar::GetIndicatorFixedHeight() return mIndicatorFixedHeight; } +void ScrollBar::SetIndicatorShowDuration( float durationSeconds ) +{ + mIndicatorShowDuration = durationSeconds; +} + +float ScrollBar::GetIndicatorShowDuration() +{ + return mIndicatorShowDuration; +} + +void ScrollBar::SetIndicatorHideDuration( float durationSeconds ) +{ + mIndicatorHideDuration = durationSeconds; +} + +float ScrollBar::GetIndicatorHideDuration() +{ + return mIndicatorHideDuration; +} + void ScrollBar::OnIndicatorHeightPolicyPropertySet( Property::Value propertyValue ) { std::string policyName( propertyValue.Get() ); @@ -433,6 +473,16 @@ void ScrollBar::SetProperty( BaseObject* object, Property::Index index, const Pr scrollBarImpl.SetIndicatorFixedHeight(value.Get()); break; } + case Toolkit::ScrollBar::PROPERTY_INDICATOR_SHOW_DURATION: + { + scrollBarImpl.SetIndicatorShowDuration(value.Get()); + break; + } + case Toolkit::ScrollBar::PROPERTY_INDICATOR_HIDE_DURATION: + { + scrollBarImpl.SetIndicatorHideDuration(value.Get()); + break; + } } } } @@ -458,6 +508,16 @@ Property::Value ScrollBar::GetProperty( BaseObject* object, Property::Index inde value = scrollBarImpl.GetIndicatorFixedHeight(); break; } + case Toolkit::ScrollBar::PROPERTY_INDICATOR_SHOW_DURATION: + { + value = scrollBarImpl.GetIndicatorShowDuration(); + break; + } + case Toolkit::ScrollBar::PROPERTY_INDICATOR_HIDE_DURATION: + { + value = scrollBarImpl.GetIndicatorHideDuration(); + break; + } } } return value; diff --git a/base/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h b/base/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h index dee5479..0ceaf44 100755 --- a/base/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h +++ b/base/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h @@ -113,6 +113,26 @@ public: float GetIndicatorFixedHeight(); /** + * @copydoc Toolkit::ScrollBar::SetIndicatorShowDuration() + */ + void SetIndicatorShowDuration( float durationSeconds ); + + /** + * @copydoc Toolkit::ScrollBar::GetIndicatorShowDuration() + */ + float GetIndicatorShowDuration(); + + /** + * @copydoc Toolkit::ScrollBar::SetIndicatorHideDuration() + */ + void SetIndicatorHideDuration( float durationSeconds ); + + /** + * @copydoc Toolkit::ScrollBar::GetIndicatorHideDuration() + */ + float GetIndicatorHideDuration(); + + /** * @copydoc Toolkit::ScrollBar::Show() */ void Show(); @@ -203,6 +223,9 @@ private: ImageActor mIndicator; ///< Image of scroll indicator. Animation mAnimation; ///< Scroll indicator Show/Hide Animation. + float mIndicatorShowDuration; ///< The duration of scroll indicator show animation + float mIndicatorHideDuration; ///< The duration of scroll indicator hide animation + float mScrollStart; ///< Scroll Start position (start of drag) Vector3 mGestureDisplacement; ///< Gesture Displacement. diff --git a/base/dali-toolkit/internal/controls/text-view/relayout-utilities.cpp b/base/dali-toolkit/internal/controls/text-view/relayout-utilities.cpp index 6c7dd1c..17c9534 100644 --- a/base/dali-toolkit/internal/controls/text-view/relayout-utilities.cpp +++ b/base/dali-toolkit/internal/controls/text-view/relayout-utilities.cpp @@ -16,19 +16,14 @@ */ // FILE HEADER -#include "relayout-utilities.h" +#include + +// INTERNAL INCLUDES +#include // EXTERNAL INCLUDES #include -// INTERNAL INCLUDES -#include -#include -#include "text-view-line-processor.h" -#include "text-view-word-processor.h" -#include "text-view-processor-helper-functions.h" -#include "text-view-processor-dbg.h" - namespace Dali { diff --git a/base/dali-toolkit/internal/controls/text-view/relayout-utilities.h b/base/dali-toolkit/internal/controls/text-view/relayout-utilities.h index cb14524..ad288ce 100644 --- a/base/dali-toolkit/internal/controls/text-view/relayout-utilities.h +++ b/base/dali-toolkit/internal/controls/text-view/relayout-utilities.h @@ -19,11 +19,8 @@ */ // INTERNAL INCLUDES -#include -#include - -#include "text-view-impl.h" -#include "text-view-processor-types.h" +#include +#include namespace Dali { diff --git a/base/dali-toolkit/internal/controls/text-view/split-by-char-policies.cpp b/base/dali-toolkit/internal/controls/text-view/split-by-char-policies.cpp index 43c0690..5563ff5 100644 --- a/base/dali-toolkit/internal/controls/text-view/split-by-char-policies.cpp +++ b/base/dali-toolkit/internal/controls/text-view/split-by-char-policies.cpp @@ -16,16 +16,12 @@ */ // FILE HEADER - -#include "split-by-char-policies.h" - -// EXTERNAL INCLUDES +#include // INTERNAL INCLUDES - -#include "relayout-utilities.h" -#include "text-view-processor.h" #include +#include +#include namespace Dali { diff --git a/base/dali-toolkit/internal/controls/text-view/split-by-char-policies.h b/base/dali-toolkit/internal/controls/text-view/split-by-char-policies.h index c5b079a..a0624ca 100644 --- a/base/dali-toolkit/internal/controls/text-view/split-by-char-policies.h +++ b/base/dali-toolkit/internal/controls/text-view/split-by-char-policies.h @@ -19,7 +19,7 @@ */ // INTERNAL INCLUDES -#include "text-view-impl.h" +#include namespace Dali { diff --git a/base/dali-toolkit/internal/controls/text-view/split-by-new-line-char-policies.cpp b/base/dali-toolkit/internal/controls/text-view/split-by-new-line-char-policies.cpp index 7d803c2..7e9020a 100644 --- a/base/dali-toolkit/internal/controls/text-view/split-by-new-line-char-policies.cpp +++ b/base/dali-toolkit/internal/controls/text-view/split-by-new-line-char-policies.cpp @@ -16,16 +16,12 @@ */ // FILE HEADER - -#include "split-by-new-line-char-policies.h" - -// EXTERNAL INCLUDES +#include // INTERNAL INCLUDES - -#include "relayout-utilities.h" -#include "text-view-processor.h" #include +#include +#include namespace Dali { diff --git a/base/dali-toolkit/internal/controls/text-view/split-by-new-line-char-policies.h b/base/dali-toolkit/internal/controls/text-view/split-by-new-line-char-policies.h index c923e8f..4869d60 100644 --- a/base/dali-toolkit/internal/controls/text-view/split-by-new-line-char-policies.h +++ b/base/dali-toolkit/internal/controls/text-view/split-by-new-line-char-policies.h @@ -19,8 +19,7 @@ */ // INTERNAL INCLUDES -#include "text-view-impl.h" -#include "text-view-processor-types.h" +#include namespace Dali { diff --git a/base/dali-toolkit/internal/controls/text-view/split-by-word-policies.cpp b/base/dali-toolkit/internal/controls/text-view/split-by-word-policies.cpp index ad64236..0cfcfa1 100644 --- a/base/dali-toolkit/internal/controls/text-view/split-by-word-policies.cpp +++ b/base/dali-toolkit/internal/controls/text-view/split-by-word-policies.cpp @@ -16,16 +16,12 @@ */ // FILE HEADER - -#include "split-by-word-policies.h" - -// EXTERNAL INCLUDES +#include // INTERNAL INCLUDES - -#include "relayout-utilities.h" -#include "text-view-processor.h" #include +#include +#include namespace Dali { diff --git a/base/dali-toolkit/internal/controls/text-view/split-by-word-policies.h b/base/dali-toolkit/internal/controls/text-view/split-by-word-policies.h index f7a10ba..df4ce3a 100644 --- a/base/dali-toolkit/internal/controls/text-view/split-by-word-policies.h +++ b/base/dali-toolkit/internal/controls/text-view/split-by-word-policies.h @@ -19,7 +19,7 @@ */ // INTERNAL INCLUDES -#include "text-view-impl.h" +#include namespace Dali { diff --git a/base/dali-toolkit/internal/controls/text-view/text-processor.cpp b/base/dali-toolkit/internal/controls/text-view/text-processor.cpp index 1baeda0..7d36205 100644 --- a/base/dali-toolkit/internal/controls/text-view/text-processor.cpp +++ b/base/dali-toolkit/internal/controls/text-view/text-processor.cpp @@ -15,13 +15,12 @@ * */ +// FILE HEADER +#include + // EXTERNAL INCLUDES #include -// INTERNAL INCLUDES - -#include - namespace Dali { diff --git a/base/dali-toolkit/internal/controls/text-view/text-view-character-processor.cpp b/base/dali-toolkit/internal/controls/text-view/text-view-character-processor.cpp index e6eed65..c94db79 100644 --- a/base/dali-toolkit/internal/controls/text-view/text-view-character-processor.cpp +++ b/base/dali-toolkit/internal/controls/text-view/text-view-character-processor.cpp @@ -16,7 +16,7 @@ */ // INTERNAL INCLUDES -#include "text-view-processor-types.h" +#include namespace Dali { diff --git a/base/dali-toolkit/internal/controls/text-view/text-view-impl.cpp b/base/dali-toolkit/internal/controls/text-view/text-view-impl.cpp index 3919c6d..ddf6cd7 100644 --- a/base/dali-toolkit/internal/controls/text-view/text-view-impl.cpp +++ b/base/dali-toolkit/internal/controls/text-view/text-view-impl.cpp @@ -16,16 +16,15 @@ */ // CLASS HEADER -#include "text-view-impl.h" +#include // INTERNAL INCLUDES -#include "split-by-new-line-char-policies.h" -#include "split-by-word-policies.h" -#include "split-by-char-policies.h" -#include "text-view-processor.h" -#include "text-view-word-processor.h" -#include "relayout-utilities.h" -#include "text-view-processor-dbg.h" +#include +#include +#include +#include +#include +#include namespace Dali { diff --git a/base/dali-toolkit/internal/controls/text-view/text-view-impl.h b/base/dali-toolkit/internal/controls/text-view/text-view-impl.h index 8d76347..85db821d 100644 --- a/base/dali-toolkit/internal/controls/text-view/text-view-impl.h +++ b/base/dali-toolkit/internal/controls/text-view/text-view-impl.h @@ -19,13 +19,10 @@ */ // INTERNAL INCLUDES -#include - -#include #include #include -#include "text-actor-cache.h" -#include "text-view-processor-types.h" +#include +#include namespace Dali { diff --git a/base/dali-toolkit/internal/controls/text-view/text-view-line-processor.cpp b/base/dali-toolkit/internal/controls/text-view/text-view-line-processor.cpp index bf4efe5..18f670f 100644 --- a/base/dali-toolkit/internal/controls/text-view/text-view-line-processor.cpp +++ b/base/dali-toolkit/internal/controls/text-view/text-view-line-processor.cpp @@ -15,12 +15,14 @@ * */ +// FILE HEADER +#include + // INTERNAL INCLUDES -#include "text-view-line-processor.h" -#include "text-view-word-group-processor.h" -#include "text-view-word-processor.h" -#include "text-view-processor-helper-functions.h" -#include "text-processor.h" +#include +#include +#include +#include namespace Dali { diff --git a/base/dali-toolkit/internal/controls/text-view/text-view-line-processor.h b/base/dali-toolkit/internal/controls/text-view/text-view-line-processor.h index a7732e1..4fa5185 100644 --- a/base/dali-toolkit/internal/controls/text-view/text-view-line-processor.h +++ b/base/dali-toolkit/internal/controls/text-view/text-view-line-processor.h @@ -19,8 +19,7 @@ */ // INTERNAL INCLUDES -#include "text-view-impl.h" -#include "text-view-processor-types.h" +#include namespace Dali { diff --git a/base/dali-toolkit/internal/controls/text-view/text-view-processor-dbg.cpp b/base/dali-toolkit/internal/controls/text-view/text-view-processor-dbg.cpp index 100c570..8e36603 100644 --- a/base/dali-toolkit/internal/controls/text-view/text-view-processor-dbg.cpp +++ b/base/dali-toolkit/internal/controls/text-view/text-view-processor-dbg.cpp @@ -15,8 +15,11 @@ * */ +// FILE HEADER +#include + // INTERNAL INCLUDES -#include "text-view-processor-dbg.h" +#include namespace Dali { diff --git a/base/dali-toolkit/internal/controls/text-view/text-view-processor-dbg.h b/base/dali-toolkit/internal/controls/text-view/text-view-processor-dbg.h index 96cf037..c471341 100644 --- a/base/dali-toolkit/internal/controls/text-view/text-view-processor-dbg.h +++ b/base/dali-toolkit/internal/controls/text-view/text-view-processor-dbg.h @@ -19,8 +19,9 @@ */ // INTERNAL INCLUDES -#include "text-view-processor-types.h" #include +#include +#include namespace Dali { diff --git a/base/dali-toolkit/internal/controls/text-view/text-view-processor-helper-functions.cpp b/base/dali-toolkit/internal/controls/text-view/text-view-processor-helper-functions.cpp index 541ccfe..0533cb4 100644 --- a/base/dali-toolkit/internal/controls/text-view/text-view-processor-helper-functions.cpp +++ b/base/dali-toolkit/internal/controls/text-view/text-view-processor-helper-functions.cpp @@ -15,9 +15,11 @@ * */ +// FILE HEADER +#include + // INTERNAL INCLUDES -#include "text-view-processor-helper-functions.h" -#include "text-view-processor-dbg.h" +#include namespace Dali { diff --git a/base/dali-toolkit/internal/controls/text-view/text-view-processor-helper-functions.h b/base/dali-toolkit/internal/controls/text-view/text-view-processor-helper-functions.h index c841409..3affae1 100644 --- a/base/dali-toolkit/internal/controls/text-view/text-view-processor-helper-functions.h +++ b/base/dali-toolkit/internal/controls/text-view/text-view-processor-helper-functions.h @@ -19,7 +19,8 @@ */ // INTERNAL INCLUDES -#include "text-view-processor-types.h" +#include +#include namespace Dali { diff --git a/base/dali-toolkit/internal/controls/text-view/text-view-processor-types.h b/base/dali-toolkit/internal/controls/text-view/text-view-processor-types.h index 7bc3e4f..55be5a8 100644 --- a/base/dali-toolkit/internal/controls/text-view/text-view-processor-types.h +++ b/base/dali-toolkit/internal/controls/text-view/text-view-processor-types.h @@ -19,7 +19,7 @@ */ // INTERNAL INCLUDES -#include +#include #include namespace Dali diff --git a/base/dali-toolkit/internal/controls/text-view/text-view-processor.cpp b/base/dali-toolkit/internal/controls/text-view/text-view-processor.cpp index 8d33877..0c3f074 100644 --- a/base/dali-toolkit/internal/controls/text-view/text-view-processor.cpp +++ b/base/dali-toolkit/internal/controls/text-view/text-view-processor.cpp @@ -15,15 +15,15 @@ * */ +// FILE HEADER +#include + // INTERNAL INCLUDES -#include -#include "text-view-processor.h" -#include "text-view-word-processor.h" -#include "text-view-word-group-processor.h" -#include "text-view-line-processor.h" -#include "text-view-processor-helper-functions.h" -#include "text-processor.h" -#include "text-view-processor-dbg.h" +#include +#include +#include +#include +#include namespace Dali { diff --git a/base/dali-toolkit/internal/controls/text-view/text-view-processor.h b/base/dali-toolkit/internal/controls/text-view/text-view-processor.h index 5ca4160..bd31fd1 100644 --- a/base/dali-toolkit/internal/controls/text-view/text-view-processor.h +++ b/base/dali-toolkit/internal/controls/text-view/text-view-processor.h @@ -19,8 +19,7 @@ */ // INTERNAL INCLUDES -#include "text-view-impl.h" -#include "text-view-processor-types.h" +#include namespace Dali { diff --git a/base/dali-toolkit/internal/controls/text-view/text-view-word-group-processor.cpp b/base/dali-toolkit/internal/controls/text-view/text-view-word-group-processor.cpp index cb58f37..e5c2804 100644 --- a/base/dali-toolkit/internal/controls/text-view/text-view-word-group-processor.cpp +++ b/base/dali-toolkit/internal/controls/text-view/text-view-word-group-processor.cpp @@ -15,11 +15,13 @@ * */ +// FILE HEADER +#include + // INTERNAL INCLUDES -#include "text-view-word-group-processor.h" -#include "text-view-word-processor.h" -#include "text-view-processor-helper-functions.h" -#include "text-processor.h" +#include +#include +#include namespace Dali { diff --git a/base/dali-toolkit/internal/controls/text-view/text-view-word-group-processor.h b/base/dali-toolkit/internal/controls/text-view/text-view-word-group-processor.h index 3fe7d09..f790d3d 100644 --- a/base/dali-toolkit/internal/controls/text-view/text-view-word-group-processor.h +++ b/base/dali-toolkit/internal/controls/text-view/text-view-word-group-processor.h @@ -19,8 +19,7 @@ */ // INTERNAL INCLUDES -#include "text-view-impl.h" -#include "text-view-processor-types.h" +#include namespace Dali { diff --git a/base/dali-toolkit/internal/controls/text-view/text-view-word-processor.cpp b/base/dali-toolkit/internal/controls/text-view/text-view-word-processor.cpp index c21c5c0..6e3f8cc 100644 --- a/base/dali-toolkit/internal/controls/text-view/text-view-word-processor.cpp +++ b/base/dali-toolkit/internal/controls/text-view/text-view-word-processor.cpp @@ -16,12 +16,11 @@ */ // FILE HEADER -#include "text-view-word-processor.h" +#include // INTERNAL INCLUDES -#include -#include "text-view-processor-helper-functions.h" -#include "text-view-processor-dbg.h" +#include +#include namespace Dali { diff --git a/base/dali-toolkit/internal/controls/text-view/text-view-word-processor.h b/base/dali-toolkit/internal/controls/text-view/text-view-word-processor.h index ab03c6b..a9ef345 100644 --- a/base/dali-toolkit/internal/controls/text-view/text-view-word-processor.h +++ b/base/dali-toolkit/internal/controls/text-view/text-view-word-processor.h @@ -19,8 +19,7 @@ */ // INTERNAL INCLUDES -#include "text-view-impl.h" -#include "text-view-processor-types.h" +#include namespace Dali { diff --git a/base/dali-toolkit/internal/file.list b/base/dali-toolkit/internal/file.list index 75591bd..7b00a3d 100644 --- a/base/dali-toolkit/internal/file.list +++ b/base/dali-toolkit/internal/file.list @@ -10,6 +10,7 @@ toolkit_base_src_files = \ $(toolkit_base_src_dir)/controls/buttons/check-box-button-impl.cpp \ $(toolkit_base_src_dir)/controls/buttons/push-button-default-painter-impl.cpp \ $(toolkit_base_src_dir)/controls/buttons/push-button-impl.cpp \ + $(toolkit_base_src_dir)/controls/buttons/radio-button-impl.cpp \ $(toolkit_base_src_dir)/controls/popup/popup-impl.cpp \ $(toolkit_base_src_dir)/controls/popup/popup-style-impl.cpp \ $(toolkit_base_src_dir)/controls/scroll-bar/scroll-bar-impl.cpp \ diff --git a/base/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp b/base/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp index a6ed055..12b6748 100644 --- a/base/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp +++ b/base/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp @@ -50,11 +50,15 @@ BaseHandle Create() { BaseHandle handle = KeyboardFocusManager::Get(); - if ( !handle && Adaptor::IsAvailable() ) + if ( !handle ) { - Toolkit::KeyboardFocusManager manager = Toolkit::KeyboardFocusManager( new Internal::KeyboardFocusManager() ); - Adaptor::Get().RegisterSingleton( typeid( manager ), manager ); - handle = manager; + SingletonService singletonService( SingletonService::Get() ); + if ( singletonService ) + { + Toolkit::KeyboardFocusManager manager = Toolkit::KeyboardFocusManager( new Internal::KeyboardFocusManager() ); + singletonService.Register( typeid( manager ), manager ); + handle = manager; + } } return handle; @@ -67,10 +71,11 @@ Toolkit::KeyboardFocusManager KeyboardFocusManager::Get() { Toolkit::KeyboardFocusManager manager; - if ( Adaptor::IsAvailable() ) + SingletonService singletonService( SingletonService::Get() ); + if ( singletonService ) { // Check whether the keyboard focus manager is already created - Dali::BaseHandle handle = Dali::Adaptor::Get().GetSingleton( typeid( Toolkit::KeyboardFocusManager ) ); + Dali::BaseHandle handle = singletonService.GetSingleton( typeid( Toolkit::KeyboardFocusManager ) ); if(handle) { // If so, downcast the handle of singleton to keyboard focus manager diff --git a/base/dali-toolkit/internal/styling/style-manager-impl.cpp b/base/dali-toolkit/internal/styling/style-manager-impl.cpp index 53c05cd..57be231 100644 --- a/base/dali-toolkit/internal/styling/style-manager-impl.cpp +++ b/base/dali-toolkit/internal/styling/style-manager-impl.cpp @@ -59,11 +59,15 @@ BaseHandle Create() { BaseHandle handle = StyleManager::Get(); - if ( !handle && Adaptor::IsAvailable() ) + if ( !handle ) { - Toolkit::StyleManager manager = Toolkit::StyleManager( new Internal::StyleManager() ); - Adaptor::Get().RegisterSingleton( typeid( manager ), manager ); - handle = manager; + SingletonService singletonService( SingletonService::Get() ); + if ( singletonService ) + { + Toolkit::StyleManager manager = Toolkit::StyleManager( new Internal::StyleManager() ); + singletonService.Register( typeid( manager ), manager ); + handle = manager; + } } return handle; @@ -88,10 +92,11 @@ Toolkit::StyleManager StyleManager::Get() { Toolkit::StyleManager manager; - if ( Adaptor::IsAvailable() ) + SingletonService singletonService( SingletonService::Get() ); + if ( singletonService ) { // Check whether the style manager is already created - Dali::BaseHandle handle = Dali::Adaptor::Get().GetSingleton( typeid( Toolkit::StyleManager ) ); + Dali::BaseHandle handle = singletonService.GetSingleton( typeid( Toolkit::StyleManager ) ); if( handle ) { // If so, downcast the handle of singleton diff --git a/base/dali-toolkit/public-api/builder/builder.cpp b/base/dali-toolkit/public-api/builder/builder.cpp index 79173f1..fbf4223 100644 --- a/base/dali-toolkit/public-api/builder/builder.cpp +++ b/base/dali-toolkit/public-api/builder/builder.cpp @@ -144,6 +144,11 @@ FrameBufferImage Builder::GetFrameBufferImage( const std::string &name ) return GetImpl(*this).GetFrameBufferImage( name ); } +Builder::Signal& Builder::QuitSignal() +{ + return GetImpl( *this ).QuitSignal(); +} + } // namespace Toolkit } // namespace Dali diff --git a/base/dali-toolkit/public-api/builder/builder.h b/base/dali-toolkit/public-api/builder/builder.h index ddbb041..b0db57e 100644 --- a/base/dali-toolkit/public-api/builder/builder.h +++ b/base/dali-toolkit/public-api/builder/builder.h @@ -398,6 +398,18 @@ class Builder : public BaseHandle */ FrameBufferImage GetFrameBufferImage( const std::string &name ); + // Signals + + /** + * @brief Builder signal type + */ + typedef SignalV2< void () > Signal; + + /** + * @brief Signal emitted when a quit action is requested by the builder. + */ + Signal& QuitSignal(); + private: Builder(Internal::Builder *impl); diff --git a/base/dali-toolkit/public-api/controls/buttons/radio-button.cpp b/base/dali-toolkit/public-api/controls/buttons/radio-button.cpp new file mode 100644 index 0000000..fbb4f69 --- /dev/null +++ b/base/dali-toolkit/public-api/controls/buttons/radio-button.cpp @@ -0,0 +1,122 @@ +/* + * 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 + +// INTERNAL INCLUDES + +#include + +namespace Dali +{ + +namespace Toolkit +{ + +RadioButton::RadioButton() + : Button() +{ +} + +RadioButton::RadioButton(Internal::RadioButton& implementation) + : Button(implementation) +{ +} + +RadioButton::RadioButton(const RadioButton& radioButton) + : Button(radioButton) +{ +} + +RadioButton& RadioButton::operator=(const RadioButton& radioButton ) +{ + if( &radioButton != this ) + { + Button::operator=( radioButton ); + } + return *this; +} + +RadioButton::RadioButton(Dali::Internal::CustomActor* internal) + : Button(internal) +{ + VerifyCustomActorPointer( internal ); +} + +RadioButton::~RadioButton() +{ +} + +RadioButton RadioButton::New() +{ + return Internal::RadioButton::New(); +} + +RadioButton RadioButton::New(const std::string& label) +{ + RadioButton radioButton = Internal::RadioButton::New(); + radioButton.SetLabel(label); + return radioButton; +} + +RadioButton RadioButton::New(Actor label) +{ + RadioButton radioButton = Internal::RadioButton::New(); + radioButton.SetLabel(label); + return radioButton; +} + +RadioButton RadioButton::DownCast(BaseHandle handle) +{ + return Control::DownCast( handle ); +} + +void RadioButton::SetLabel(const std::string& label) +{ + Dali::Toolkit::GetImplementation(*this).SetLabel(label); +} + +void RadioButton::SetLabel(Actor label) +{ + Dali::Toolkit::GetImplementation(*this).SetLabel(label); +} + +Actor RadioButton::GetLabel() const +{ + return Dali::Toolkit::GetImplementation(*this).GetLabel(); +} + +void RadioButton::SetActive(bool active) +{ + Dali::Toolkit::GetImplementation(*this).SetActive(active); +} + +bool RadioButton::IsActive()const +{ + return Dali::Toolkit::GetImplementation(*this).IsActive(); +} + +void RadioButton::ToggleState() +{ + Dali::Toolkit::GetImplementation(*this).ToggleState(); +} + +} // namespace Toolkit + +} // namespace Dali diff --git a/base/dali-toolkit/public-api/controls/buttons/radio-button.h b/base/dali-toolkit/public-api/controls/buttons/radio-button.h new file mode 100644 index 0000000..37f3860 --- /dev/null +++ b/base/dali-toolkit/public-api/controls/buttons/radio-button.h @@ -0,0 +1,186 @@ +#ifndef __DALI_TOOLKIT_RADIO_BUTTON_H__ +#define __DALI_TOOLKIT_RADIO_BUTTON_H__ + +/* + * 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. + * + */ + +// INTERNAL INCLUDES +#include "button.h" + +namespace Dali DALI_IMPORT_API +{ + +namespace Toolkit +{ + +// Forward declarations + +namespace Internal DALI_INTERNAL +{ +// Forward declarations + +class RadioButton; +} + +/** + * @brief A RadioButton provides a radio button which two states \e active or \e inactive. + * + * Radio buttons are designed to select one of many option at the same time. + * + * Every button have its own \e label and \e state, which can be modified by RadioButton::SetLabel and RadioBUtton::SetActive. + * + * RadioButton can change its current state using RadioButton::ToggleState. + * + * RadioButtons can be grouped. + * Two or more RadioButtons are in one group when they have this same parent. + * In each groups only one RadioButton can be \e active at a given time. + * So when RadioButton is set to \e active, other RadioButtons in its group are set to \e inactive. + * When \e active RadioButton is set to \e inactive no other RadioButtons in his group is set to \e active. + * + * A Button::ClickedSignal() is emitted when the RadioButton change its state to \e active or \e inactive. + */ +class RadioButton: public Button +{ + public: + + // Properties + static const Property::Index PROPERTY_ACTIVE; ///< name "active", @see SetActive(), type BOOLEAN + static const Property::Index PROPERTY_LABEL_ACTOR; ///< name "label-actor", @see SetLabel(), type MAP + + public: + /** + * @brief Create an uninitialized RadioButton; this can be initialized with RadioButton::New(). + * + * Calling member functions with an uninitialized Dali::Object is not allowed. + */ + RadioButton(); + + /** + * @brief Copy constructor. + */ + RadioButton(const RadioButton& radioButton); + + /** + * @brief Assignment operator. + */ + RadioButton& operator=(const RadioButton& radioButton); + + /** + * @brief Destructor + * + * This is non-virtual since derived Handle types must not contain data or virtual methods. + */ + ~RadioButton(); + + /** + * @brief Create an initialized RadioButton. + * + * @return A handle to a newly allocated Dali resource. + */ + static RadioButton New(); + + /** + * @brief Create an initialized RadioButton with given label. + * + * @param[in] label The button label. + * + * @return A handle to a newly allocated Dali resource. + */ + static RadioButton New(const std::string& label); + + /** + * @brief Create an initialized RadioButton with existing Actor. + * + * @param[in] label An Actor with the label. + * + * @return A handle to a newly allocated Dali resource. + */ + static RadioButton New(Actor label); + + /** + * @brief Downcast an Object handle to RadioButton. + * + * If handle points to a RadioButton the downcast produces valid + * handle. If not the returned handle is left uninitialized. + * + * @param[in] handle Handle to an object + * @return handle to a RadioButton or an uninitialized handle + */ + static RadioButton DownCast(BaseHandle handle); + + /** + * @brief Sets the button label. + * + * @param[in] label The button label. + */ + void SetLabel(const std::string& label); + + /** + * @brief Sets the button label using existing Actor. + * + * @param[in] label An Actor with the label. + */ + void SetLabel(Actor label); + + /** + * @brief Gets the label. + * + * @return An Actor with the label. + */ + Actor GetLabel() const; + + /** + * @brief Sets the button as active or inactive. + * + * @param[in] active property + */ + void SetActive(bool active); + + /** + * @return true if button is active, false if button is inactive. + */ + bool IsActive()const; + + /** + * @brief Change button state. + * + * If button is active deactivate it. If button is inactive activate it. + */ + void ToggleState(); + + public: // Not intended for application developers + + /** + * @brief Creates a handle using the Toolkit::Internal implementation. + * + * @param[in] implementation The Control implementation. + */ + RadioButton(Internal::RadioButton& implementation); + + /** + * @brief Allows the creation of this Control from an Internal::CustomActor pointer. + * + * @param[in] internal A pointer to the internal CustomActor. + */ + RadioButton(Dali::Internal::CustomActor* internal); +} ; + +} // namespace Toolkit + +} // namespace Dali + +#endif // __DALI_TOOLKIT_RADIO_BUTTON_H__ diff --git a/base/dali-toolkit/public-api/controls/scroll-bar/scroll-bar.cpp b/base/dali-toolkit/public-api/controls/scroll-bar/scroll-bar.cpp index ed08541..367e7e4 100755 --- a/base/dali-toolkit/public-api/controls/scroll-bar/scroll-bar.cpp +++ b/base/dali-toolkit/public-api/controls/scroll-bar/scroll-bar.cpp @@ -104,6 +104,26 @@ float ScrollBar::GetIndicatorFixedHeight() return GetImpl(*this).GetIndicatorFixedHeight(); } +void ScrollBar::SetIndicatorShowDuration( float durationSeconds ) +{ + GetImpl(*this).SetIndicatorShowDuration(durationSeconds); +} + +float ScrollBar::GetIndicatorShowDuration() +{ + return GetImpl(*this).GetIndicatorShowDuration(); +} + +void ScrollBar::SetIndicatorHideDuration( float durationSeconds ) +{ + GetImpl(*this).SetIndicatorHideDuration(durationSeconds); +} + +float ScrollBar::GetIndicatorHideDuration() +{ + return GetImpl(*this).GetIndicatorHideDuration(); +} + void ScrollBar::Show() { GetImpl(*this).Show(); diff --git a/base/dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h b/base/dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h index ad13fee..372e3c3 100755 --- a/base/dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h +++ b/base/dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h @@ -51,8 +51,10 @@ public: typedef SignalV2< void ( float ) > ScrollPositionNotifiedSignalType; // Properties - static const Property::Index PROPERTY_INDICATOR_HEIGHT_POLICY; ///< name "indicator-height-policy", type STRING - static const Property::Index PROPERTY_INDICATOR_FIXED_HEIGHT; ///< name "indicator-fixed-height", type FLOAT + static const Property::Index PROPERTY_INDICATOR_HEIGHT_POLICY; ///< name "indicator-height-policy", @see SetIndicatorHeightPolicy(), type STRING + static const Property::Index PROPERTY_INDICATOR_FIXED_HEIGHT; ///< name "indicator-fixed-height", @see SetIndicatorFixedHeight(), type FLOAT + static const Property::Index PROPERTY_INDICATOR_SHOW_DURATION; ///< name "indicator-show-duration", @see SetIndicatorShowDuration(), type FLOAT + static const Property::Index PROPERTY_INDICATOR_HIDE_DURATION; ///< name "indicator-hide-duration", @see SetIndicatorHideDuration(), type FLOAT public: @@ -170,6 +172,36 @@ public: float GetIndicatorFixedHeight(); /** + * @brief Sets the duration in second for the scroll indicator to become fully visible + * + * @pre The scroll bar actor has been initialised. + * + * @param[in] durationSeconds The duration for the scroll indicator to become fully visible + */ + void SetIndicatorShowDuration( float durationSeconds ); + + /** + * @brief Gets the duration in second for the scroll indicator to become fully visible + * @return The duration for the scroll indicator to become fully visible + */ + float GetIndicatorShowDuration(); + + /** + * @brief Sets the duration in second for the scroll indicator to become fully invisible + * + * @pre The scroll bar actor has been initialised. + * + * @param[in] durationSeconds The duration for the scroll indicator to become fully invisible + */ + void SetIndicatorHideDuration( float durationSeconds ); + + /** + * @brief Gets the duration in second for the scroll indicator to become fully invisible + * @return The duration for the scroll indicator to become fully invisible + */ + float GetIndicatorHideDuration(); + + /** * @brief Shows the scroll indicator */ void Show(); diff --git a/base/dali-toolkit/public-api/controls/text-view/text-view.cpp b/base/dali-toolkit/public-api/controls/text-view/text-view.cpp index b4f0d80..2221ebd 100644 --- a/base/dali-toolkit/public-api/controls/text-view/text-view.cpp +++ b/base/dali-toolkit/public-api/controls/text-view/text-view.cpp @@ -16,11 +16,9 @@ */ // CLASS HEADER - #include // INTERNAL INCLUDES - #include namespace Dali diff --git a/base/dali-toolkit/public-api/factory/localized-control-factory.cpp b/base/dali-toolkit/public-api/factory/localized-control-factory.cpp index 724c1f3..d8999c1 100644 --- a/base/dali-toolkit/public-api/factory/localized-control-factory.cpp +++ b/base/dali-toolkit/public-api/factory/localized-control-factory.cpp @@ -50,19 +50,22 @@ LocalizedControlFactory LocalizedControlFactory::Get() LocalizedControlFactory factory; // Check whether the focus factory is already created - Dali::Adaptor& adaptor = Dali::Adaptor::Get(); - Dali::BaseHandle handle = adaptor.GetSingleton(typeid(LocalizedControlFactory)); - if(handle) + SingletonService singletonService( SingletonService::Get() ); + if ( singletonService ) { - // If so, downcast the handle of singleton to focus factory - factory = LocalizedControlFactory(dynamic_cast(handle.GetObjectPtr())); - } - - if(!factory) - { - // If not, create the focus factory and register it as a singleton - factory = LocalizedControlFactory(new Internal::LocalizedControlFactory()); - adaptor.RegisterSingleton(typeid(factory), factory); + Dali::BaseHandle handle = singletonService.GetSingleton(typeid(LocalizedControlFactory)); + if(handle) + { + // If so, downcast the handle of singleton to focus factory + factory = LocalizedControlFactory(dynamic_cast(handle.GetObjectPtr())); + } + + if(!factory) + { + // If not, create the focus factory and register it as a singleton + factory = LocalizedControlFactory(new Internal::LocalizedControlFactory()); + singletonService.Register(typeid(factory), factory); + } } return factory; diff --git a/base/dali-toolkit/public-api/file.list b/base/dali-toolkit/public-api/file.list index a5e5fea..e46991d 100755 --- a/base/dali-toolkit/public-api/file.list +++ b/base/dali-toolkit/public-api/file.list @@ -8,6 +8,7 @@ public_api_base_src_files = \ $(public_api_base_src_dir)/controls/buttons/button.cpp \ $(public_api_base_src_dir)/controls/buttons/check-box-button.cpp \ $(public_api_base_src_dir)/controls/buttons/push-button.cpp \ + $(public_api_base_src_dir)/controls/buttons/radio-button.cpp \ $(public_api_base_src_dir)/controls/default-controls/solid-color-actor.cpp \ $(public_api_base_src_dir)/controls/default-controls/check-button-factory.cpp \ $(public_api_base_src_dir)/controls/default-controls/push-button-factory.cpp \ @@ -69,7 +70,8 @@ public_api_base_alignment_header_files = \ public_api_base_buttons_header_files = \ $(public_api_base_src_dir)/controls/buttons/check-box-button.h \ $(public_api_base_src_dir)/controls/buttons/button.h \ - $(public_api_base_src_dir)/controls/buttons/push-button.h + $(public_api_base_src_dir)/controls/buttons/push-button.h \ + $(public_api_base_src_dir)/controls/buttons/radio-button.h public_api_base_default_controls_header_files = \ $(public_api_base_src_dir)/controls/default-controls/check-button-factory.h \ diff --git a/base/dali-toolkit/public-api/focus-manager/focus-manager.cpp b/base/dali-toolkit/public-api/focus-manager/focus-manager.cpp index f8e2060..a4cddb1 100644 --- a/base/dali-toolkit/public-api/focus-manager/focus-manager.cpp +++ b/base/dali-toolkit/public-api/focus-manager/focus-manager.cpp @@ -48,19 +48,22 @@ FocusManager FocusManager::Get() FocusManager manager; // Check whether the focus manager is already created - Dali::Adaptor& adaptor = Dali::Adaptor::Get(); - Dali::BaseHandle handle = adaptor.GetSingleton(typeid(FocusManager)); - if(handle) + SingletonService singletonService( SingletonService::Get() ); + if ( singletonService ) { - // If so, downcast the handle of singleton to focus manager - manager = FocusManager(dynamic_cast(handle.GetObjectPtr())); - } - - if(!manager) - { - // If not, create the focus manager and register it as a singleton - manager = FocusManager(new Internal::FocusManager()); - adaptor.RegisterSingleton(typeid(manager), manager); + Dali::BaseHandle handle = singletonService.GetSingleton(typeid(FocusManager)); + if(handle) + { + // If so, downcast the handle of singleton to focus manager + manager = FocusManager(dynamic_cast(handle.GetObjectPtr())); + } + + if(!manager) + { + // If not, create the focus manager and register it as a singleton + manager = FocusManager(new Internal::FocusManager()); + singletonService.Register(typeid(manager), manager); + } } return manager; diff --git a/base/dali-toolkit/public-api/focus-manager/keyinput-focus-manager.cpp b/base/dali-toolkit/public-api/focus-manager/keyinput-focus-manager.cpp index f427283..b81e807 100644 --- a/base/dali-toolkit/public-api/focus-manager/keyinput-focus-manager.cpp +++ b/base/dali-toolkit/public-api/focus-manager/keyinput-focus-manager.cpp @@ -47,19 +47,22 @@ KeyInputFocusManager KeyInputFocusManager::Get() KeyInputFocusManager manager; // Check whether the focus manager is already created - Dali::Adaptor& adaptor = Dali::Adaptor::Get(); - Dali::BaseHandle handle = adaptor.GetSingleton(typeid(KeyInputFocusManager)); - if(handle) + SingletonService singletonService( SingletonService::Get() ); + if ( singletonService ) { - // If so, downcast the handle of singleton to focus manager - manager = KeyInputFocusManager(dynamic_cast(handle.GetObjectPtr())); - } - - if(!manager) - { - // If not, create the focus manager and register it as a singleton - manager = KeyInputFocusManager(new Internal::KeyInputFocusManager()); - adaptor.RegisterSingleton(typeid(manager), manager); + Dali::BaseHandle handle = singletonService.GetSingleton(typeid(KeyInputFocusManager)); + if(handle) + { + // If so, downcast the handle of singleton to focus manager + manager = KeyInputFocusManager(dynamic_cast(handle.GetObjectPtr())); + } + + if(!manager) + { + // If not, create the focus manager and register it as a singleton + manager = KeyInputFocusManager(new Internal::KeyInputFocusManager()); + singletonService.Register(typeid(manager), manager); + } } return manager; diff --git a/base/dali-toolkit/public-api/markup-processor/markup-processor.cpp b/base/dali-toolkit/public-api/markup-processor/markup-processor.cpp index 5d50c03..83359fd 100644 --- a/base/dali-toolkit/public-api/markup-processor/markup-processor.cpp +++ b/base/dali-toolkit/public-api/markup-processor/markup-processor.cpp @@ -18,10 +18,6 @@ // HEADER INCLUDE #include -// INTERNAL INCLUDES -#include - - // EXTERNAL INCLUDES #include #include diff --git a/optional/dali-toolkit/dali-toolkit.h b/optional/dali-toolkit/dali-toolkit.h index ff72f77..2c838cd 100644 --- a/optional/dali-toolkit/dali-toolkit.h +++ b/optional/dali-toolkit/dali-toolkit.h @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include diff --git a/optional/dali-toolkit/public-api/dali-toolkit-version.cpp b/optional/dali-toolkit/public-api/dali-toolkit-version.cpp index 603eed8..8cb5200 100644 --- a/optional/dali-toolkit/public-api/dali-toolkit-version.cpp +++ b/optional/dali-toolkit/public-api/dali-toolkit-version.cpp @@ -31,7 +31,7 @@ namespace Toolkit const unsigned int TOOLKIT_MAJOR_VERSION = 1; const unsigned int TOOLKIT_MINOR_VERSION = 0; -const unsigned int TOOLKIT_MICRO_VERSION = 7; +const unsigned int TOOLKIT_MICRO_VERSION = 8; const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/packaging/dali-toolkit.spec b/packaging/dali-toolkit.spec index e2d38e2..aae4ffd 100644 --- a/packaging/dali-toolkit.spec +++ b/packaging/dali-toolkit.spec @@ -1,6 +1,6 @@ Name: dali-toolkit Summary: The OpenGLES Canvas Core Library Toolkit -Version: 1.0.7 +Version: 1.0.8 Release: 1 Group: System/Libraries License: Apache-2.0