# Append list of test harness files (Won't get parsed for test cases)
LIST(APPEND TC_SOURCES
../dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-manager.cpp
- ../dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-application.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-imf-manager.cpp
# Append list of test harness files (Won't get parsed for test cases)
LIST(APPEND TC_SOURCES
../dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-manager.cpp
- ../dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-application.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-imf-manager.cpp
# Append list of test harness files (Won't get parsed for test cases)
LIST(APPEND TC_SOURCES
dali-toolkit-test-utils/toolkit-accessibility-manager.cpp
- dali-toolkit-test-utils/toolkit-adaptor.cpp
dali-toolkit-test-utils/toolkit-application.cpp
dali-toolkit-test-utils/toolkit-clipboard.cpp
dali-toolkit-test-utils/toolkit-imf-manager.cpp
+++ /dev/null
-/*
- * 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.
- *
- */
-
-#define __DALI_ADAPTOR_H__
-#define __DALI_ACCESSIBILITY_MANAGER_H__
-#define __DALI_TIMER_H__
-#define __DALI_CLIPBOARD_H__
-#define __DALI_IMF_MANAGER_H__
-
-#include "toolkit-adaptor.h"
-#include <map>
-#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/signals/dali-signal-v2.h>
-
-namespace Dali
-{
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-class TestRenderSurface : public RenderSurface
-{
-public:
- TestRenderSurface(){}
- virtual ~TestRenderSurface(){}
- virtual SurfaceType GetType() { return RenderSurface::WINDOW; }
- virtual Dali::Any GetSurface() { return Dali::Any(); }
- virtual Dali::Any GetDisplay() { return Dali::Any(); }
- virtual PositionSize GetPositionSize() const { return PositionSize(0, 0, 640, 480);}
-};
-
-typedef Dali::Rect<int> PositionSize;
-
-/**
- * Stub for the Adaptor
- */
-class Adaptor
-{
-public:
-
- typedef SignalV2< void ( Adaptor& ) > AdaptorSignalV2;
-
-public:
-
- Adaptor(ToolkitAdaptor& toolkitAdaptor);
- ~Adaptor();
-
-public:
-
- void Start();
- void Pause();
- void Resume();
- void Stop();
- bool AddIdle(boost::function<void(void)> callBack);
- void FeedEvent(TouchPoint& point, int timeStamp);
- bool MoveResize(const PositionSize& positionSize);
- void SurfaceResized(const PositionSize& positionSize);
- void ReplaceSurface(RenderSurface& surface);
- void RenderSync();
- RenderSurface& GetSurface();
-
-public: // static methods
- static Adaptor& Get();
- static bool IsAvailable();
-
-public: // Signals
-
- AdaptorSignalV2& SignalResize();
-
- void EmitSignalResize()
- {
- mResizeSignal.Emit( *this );
- }
-
-private:
-
- // Undefined
- Adaptor(const Adaptor&);
- Adaptor& operator=(Adaptor&);
-
- AdaptorSignalV2 mResizeSignal;
- TestRenderSurface mRenderSurface;
- ToolkitAdaptor& mToolkitAdaptor;
-};
-
-namespace
-{
-Adaptor* gAdaptor = NULL;
-
-}
-
-Adaptor::Adaptor(ToolkitAdaptor& toolkitAdaptor)
-: mToolkitAdaptor(toolkitAdaptor)
-{
-}
-
-Adaptor::~Adaptor()
-{
-
-}
-
-void Adaptor::Start()
-{
- mToolkitAdaptor.mFunctionsCalled.Start = true;
-}
-
-void Adaptor::Pause()
-{
- mToolkitAdaptor.mFunctionsCalled.Pause = true;
-}
-
-void Adaptor::Resume()
-{
- mToolkitAdaptor.mFunctionsCalled.Resume = true;
-}
-
-void Adaptor::Stop()
-{
- mToolkitAdaptor.mFunctionsCalled.Stop = true;
-}
-
-bool Adaptor::AddIdle(boost::function<void(void)> callBack)
-{
- mToolkitAdaptor.mFunctionsCalled.AddIdle = true;
- mToolkitAdaptor.mLastIdleAdded = callBack;
- return true;
-}
-
-void Adaptor::FeedEvent(TouchPoint& point, int timeStamp)
-{
- mToolkitAdaptor.mFunctionsCalled.FeedEvent = true;
- mToolkitAdaptor.mLastTouchPointFed = point;
- mToolkitAdaptor.mLastTimeStampFed = timeStamp;
-}
-
-bool Adaptor::MoveResize(const PositionSize& positionSize)
-{
- mToolkitAdaptor.mFunctionsCalled.MoveResize = true;
- mToolkitAdaptor.mLastSizeSet = positionSize;
- return true;
-}
-
-void Adaptor::SurfaceResized(const PositionSize& positionSize)
-{
- mToolkitAdaptor.mFunctionsCalled.SurfaceResized = true;
- mToolkitAdaptor.mLastSizeSet = positionSize;
-}
-
-void Adaptor::ReplaceSurface(RenderSurface& surface)
-{
- mToolkitAdaptor.mFunctionsCalled.ReplaceSurface = true;
-}
-
-void Adaptor::RenderSync()
-{
- mToolkitAdaptor.mFunctionsCalled.RenderSync = true;
-}
-
-RenderSurface& Adaptor::GetSurface()
-{
- mToolkitAdaptor.mFunctionsCalled.GetSurface = true;
- return mRenderSurface;
-}
-
-Adaptor& Adaptor::Get()
-{
- DALI_ASSERT_ALWAYS(gAdaptor);
- gAdaptor->mToolkitAdaptor.mFunctionsCalled.Get = true;
- return *gAdaptor;
-}
-
-bool Adaptor::IsAvailable()
-{
- bool available(false);
-
- if (gAdaptor)
- {
- gAdaptor->mToolkitAdaptor.mFunctionsCalled.IsAvailable = true;
- available = true;
- }
-
- return available;
-}
-
-Adaptor::AdaptorSignalV2& Adaptor::SignalResize()
-{
- mToolkitAdaptor.mFunctionsCalled.SignalResize = true;
- return mResizeSignal;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-ToolkitAdaptor::ToolkitAdaptor()
-: mLastTouchPointFed(0, TouchPoint::Down, 0.0f, 0.0f),
- mLastTimeStampFed(0),
- mStyleMonitor(StyleMonitor::Get()),
- mAccessibilityManager(AccessibilityManager::Get()),
- mImfManager(ImfManager::Get()),
- mAdaptorStub(new Adaptor(*this))
-{
- gAdaptor = mAdaptorStub;
-}
-
-ToolkitAdaptor::~ToolkitAdaptor()
-{
- delete mAdaptorStub;
- gAdaptor = NULL;
-}
-
-void ToolkitAdaptor::EmitSignalResize()
-{
- mAdaptorStub->EmitSignalResize();
-}
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_TOOLKIT_TOOLKIT_ADAPTOR_H__
-#define __DALI_TOOLKIT_TOOLKIT_ADAPTOR_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
-#include <boost/function.hpp>
-
-// INTERNAL INCLUDES
-#include "toolkit-style-monitor.h"
-#include "toolkit-accessibility-manager.h"
-#include "toolkit-timer.h"
-#include "toolkit-imf-manager.h"
-#include "toolkit-clipboard-event-notifier.h"
-
-#include <dali/public-api/events/touch-point.h>
-#include <dali/public-api/math/rect.h>
-
-namespace Dali
-{
-
-class Adaptor;
-
-typedef Dali::Rect<int> PositionSize;
-
-/**
- * This creates a stubbed Adaptor so that internal Toolkit Adaptor calls work.
- * Furthermore, it provides an interface to see if certain methods were invoked.
- */
-class ToolkitAdaptor
-{
-public: // Construction & Destruction
-
- ToolkitAdaptor();
- ~ToolkitAdaptor();
-
-public: // Getters
-
- boost::function<void(void)> GetLastIdleAdded() const
- {
- return mLastIdleAdded;
- }
-
- TouchPoint GetLastTouchPointFed() const
- {
- return mLastTouchPointFed;
- }
-
- int GetLastTimeStampFed() const
- {
- return mLastTimeStampFed;
- }
-
- PositionSize GetLastSizeSet() const
- {
- return mLastSizeSet;
- }
-
- StyleMonitor& GetToolkitStyleMonitor()
- {
- return mStyleMonitor;
- }
-
- AccessibilityManager& GetAccessibilityManager()
- {
- return mAccessibilityManager;
- }
-
- ToolkitClipboardEventNotifier& GetClipboardEventNotifier()
- {
- return mClipboardEventNotifier;
- }
-
-public: // Signal Emissions
-
- void EmitSignalResize();
-
-public: // TEST FUNCTIONS
-
- // Enumeration of Adaptor methods
- enum TestFuncEnum
- {
- StartType,
- PauseType,
- ResumeType,
- StopType,
- AddIdleType,
- FeedEventType,
- MoveResizeType,
- SurfaceResizedType,
- ReplaceSurfaceType,
- RenderSyncType,
- GetSurfaceType,
- GetType,
- IsAvailableType,
- RegisterSingletonType,
- GetSingletonType,
- SignalResizeType,
- };
-
- void Reset()
- {
- mFunctionsCalled.Reset();
- }
-
- bool WasCalled(TestFuncEnum func)
- {
- switch(func)
- {
- case StartType: return mFunctionsCalled.Start;
- case PauseType: return mFunctionsCalled.Pause;
- case ResumeType: return mFunctionsCalled.Resume;
- case StopType: return mFunctionsCalled.Stop;
- case AddIdleType: return mFunctionsCalled.AddIdle;
- case FeedEventType: return mFunctionsCalled.FeedEvent;
- case MoveResizeType: return mFunctionsCalled.MoveResize;
- case SurfaceResizedType: return mFunctionsCalled.SurfaceResized;
- case ReplaceSurfaceType: return mFunctionsCalled.ReplaceSurface;
- case RenderSyncType: return mFunctionsCalled.RenderSync;
- case GetSurfaceType: return mFunctionsCalled.GetSurface;
- case GetType: return mFunctionsCalled.Get;
- case IsAvailableType: return mFunctionsCalled.IsAvailable;
- case RegisterSingletonType: return mFunctionsCalled.RegisterSingleton;
- case GetSingletonType: return mFunctionsCalled.GetSingleton;
- case SignalResizeType: return mFunctionsCalled.SignalResize;
- }
- return false;
- }
-
- void ResetCallStatistics(TestFuncEnum func)
- {
- switch(func)
- {
- case StartType: mFunctionsCalled.Start = false; break;
- case PauseType: mFunctionsCalled.Pause = false; break;
- case ResumeType: mFunctionsCalled.Resume = false; break;
- case StopType: mFunctionsCalled.Stop = false; break;
- case AddIdleType: mFunctionsCalled.AddIdle = false; break;
- case FeedEventType: mFunctionsCalled.FeedEvent = false; break;
- case MoveResizeType: mFunctionsCalled.MoveResize = false; break;
- case SurfaceResizedType: mFunctionsCalled.SurfaceResized = false; break;
- case ReplaceSurfaceType: mFunctionsCalled.ReplaceSurface = false; break;
- case RenderSyncType: mFunctionsCalled.RenderSync = false; break;
- case GetSurfaceType: mFunctionsCalled.GetSurface = false; break;
- case GetType: mFunctionsCalled.Get = false; break;
- case IsAvailableType: mFunctionsCalled.IsAvailable = false; break;
- case RegisterSingletonType: mFunctionsCalled.RegisterSingleton = false; break;
- case GetSingletonType: mFunctionsCalled.GetSingleton = false; break;
- case SignalResizeType: mFunctionsCalled.SignalResize = false; break;
- }
- }
-
-private:
-
- struct TestFunctions
- {
- TestFunctions()
- : Start(false),
- Pause(false),
- Resume(false),
- Stop(false),
- AddIdle(false),
- FeedEvent(false),
- MoveResize(false),
- SurfaceResized(false),
- ReplaceSurface(false),
- RenderSync(false),
- GetSurface(false),
- Get(false),
- IsAvailable(false),
- RegisterSingleton(false),
- GetSingleton(false),
- SignalResize(false)
- {
- }
-
- void Reset()
- {
- Start = false;
- Pause = false;
- Resume = false;
- Stop = false;
- AddIdle = false;
- FeedEvent = false;
- MoveResize = false;
- SurfaceResized = false;
- ReplaceSurface = false;
- RenderSync = false;
- GetSurface = false;
- Get = false;
- IsAvailable = false;
- RegisterSingleton = false;
- GetSingleton = false;
- SignalResize = false;
- }
-
- bool Start;
- bool Pause;
- bool Resume;
- bool Stop;
- bool AddIdle;
- bool FeedEvent;
- bool MoveResize;
- bool SurfaceResized;
- bool ReplaceSurface;
- bool RenderSync;
- bool GetSurface;
- bool Get;
- bool IsAvailable;
- bool RegisterSingleton;
- bool GetSingleton;
- bool SignalResize;
- };
-
- TestFunctions mFunctionsCalled;
-
- // Last set information
- boost::function<void(void)> mLastIdleAdded;
- TouchPoint mLastTouchPointFed;
- int mLastTimeStampFed;
- PositionSize mLastSizeSet;
-
- // Contains Test functions for the Style Monitor
- StyleMonitor mStyleMonitor;
-
- // Stub for AccessibilityManager
- AccessibilityManager mAccessibilityManager;
-
- // Stub for ClipboardEventNotifier
- ToolkitClipboardEventNotifier mClipboardEventNotifier;
-
- ImfManager mImfManager;
-
- // The Adaptor Stub
- Adaptor* mAdaptorStub;
- friend class Adaptor;
-};
-
-} // namespace Dali
-
-#endif // __DALI_TOOLKIT_TOOLKIT_ADAPTOR_H__
namespace Dali
{
-namespace
-{
-ToolkitClipboardEventNotifier* gToolkitClipboardEventNotifier(NULL);
-} // unnamed namespace
-
namespace Internal
{
namespace Adaptor
{
-/**
- * Stub for the ClipboardEventNotifier
- */
-class ClipboardEventNotifier : public BaseObject
+class ClipboardEventNotifier : public Dali::BaseObject
{
-public: // Creation & Destruction
+public:
+
+ typedef Dali::ClipboardEventNotifier::ClipboardEventSignalV2 ClipboardEventSignalV2;
+ // Creation
+ static Dali::ClipboardEventNotifier New();
static Dali::ClipboardEventNotifier Get();
+ // Public API
+ const std::string& GetContent() const;
+ void SetContent( const std::string& content );
+ void ClearContent();
+ void EmitContentSelectedSignal();
+
+ // Signals
+ ClipboardEventSignalV2& ContentSelectedSignal()
+ {
+ return mContentSelectedSignalV2;
+ }
+
+private:
+ // Construction & Destruction
ClipboardEventNotifier();
- ClipboardEventNotifier(ToolkitClipboardEventNotifier *clipboardEventNotifier);
- ~ClipboardEventNotifier();
+ virtual ~ClipboardEventNotifier();
+
+ // Undefined
+ ClipboardEventNotifier( const ClipboardEventNotifier& );
+ ClipboardEventNotifier& operator=( ClipboardEventNotifier& );
+
+private:
-public: // Signals
+ std::string mContent; ///< The current selected content.
+ ClipboardEventSignalV2 mContentSelectedSignalV2;
- Dali::ClipboardEventNotifier::ClipboardEventSignalV2& SignalContentSelected()
+ static Dali::ClipboardEventNotifier mToolkitClipboardEventNotifier;
+
+public:
+
+ // Helpers for public-api forwarding methods
+
+ inline static Internal::Adaptor::ClipboardEventNotifier& GetImplementation(Dali::ClipboardEventNotifier& detector)
{
- return mClipboardSignal;
+ DALI_ASSERT_ALWAYS( detector && "ClipboardEventNotifier handle is empty" );
+
+ BaseObject& handle = detector.GetBaseObject();
+
+ return static_cast<Internal::Adaptor::ClipboardEventNotifier&>(handle);
}
-private:
+ inline static const Internal::Adaptor::ClipboardEventNotifier& GetImplementation(const Dali::ClipboardEventNotifier& detector)
+ {
+ DALI_ASSERT_ALWAYS( detector && "ClipboardEventNotifier handle is empty" );
+
+ const BaseObject& handle = detector.GetBaseObject();
- ToolkitClipboardEventNotifier* mToolkitClipboardEventNotifier;
- Dali::ClipboardEventNotifier::ClipboardEventSignalV2 mClipboardSignal;
+ return static_cast<const Internal::Adaptor::ClipboardEventNotifier&>(handle);
+ }
};
+Dali::ClipboardEventNotifier ClipboardEventNotifier::mToolkitClipboardEventNotifier;
+
+Dali::ClipboardEventNotifier ClipboardEventNotifier::New()
+{
+ return Get();
+}
+
Dali::ClipboardEventNotifier ClipboardEventNotifier::Get()
{
- return gToolkitClipboardEventNotifier->GetClipboardEventNotifier();
+ if ( !mToolkitClipboardEventNotifier )
+ {
+ mToolkitClipboardEventNotifier = Dali::ClipboardEventNotifier( new ClipboardEventNotifier );
+ }
+ return mToolkitClipboardEventNotifier;
}
-ClipboardEventNotifier::ClipboardEventNotifier()
-: mToolkitClipboardEventNotifier(NULL)
+const std::string& ClipboardEventNotifier::GetContent() const
+{
+ return mContent;
+}
+
+void ClipboardEventNotifier::SetContent( const std::string& content )
{
+ mContent = content;
}
-ClipboardEventNotifier::ClipboardEventNotifier(ToolkitClipboardEventNotifier *clipboardEventNotifier)
-: mToolkitClipboardEventNotifier(clipboardEventNotifier)
+void ClipboardEventNotifier::ClearContent()
+{
+ mContent.clear();
+}
+
+void ClipboardEventNotifier::EmitContentSelectedSignal()
+{
+ if ( !mContentSelectedSignalV2.Empty() )
+ {
+ Dali::ClipboardEventNotifier handle( this );
+ mContentSelectedSignalV2.Emit( handle );
+ }
+}
+
+ClipboardEventNotifier::ClipboardEventNotifier()
+: mContent()
{
}
}
} // namespace Adaptor
-
} // namespace Internal
////////////////////////////////////////////////////////////////////////////////////////////////////
-ToolkitClipboardEventNotifier::ToolkitClipboardEventNotifier()
-: mClipboardEventNotifierStub(new Internal::Adaptor::ClipboardEventNotifier(this)),
- mClipboardEventNotifier( mClipboardEventNotifierStub )
+const char* const ClipboardEventNotifier::SIGNAL_CONTENT_SELECTED( "content-selected" );
+
+ClipboardEventNotifier::ClipboardEventNotifier()
+{
+}
+
+ClipboardEventNotifier ClipboardEventNotifier::Get()
+{
+ return Internal::Adaptor::ClipboardEventNotifier::Get();
+}
+
+ClipboardEventNotifier::~ClipboardEventNotifier()
+{
+}
+
+const std::string& ClipboardEventNotifier::GetContent() const
+{
+ return Internal::Adaptor::ClipboardEventNotifier::GetImplementation(*this).GetContent();
+}
+
+void ClipboardEventNotifier::SetContent( const std::string& content )
+{
+ Internal::Adaptor::ClipboardEventNotifier::GetImplementation(*this).SetContent(content);
+}
+
+void ClipboardEventNotifier::ClearContent()
+{
+ Internal::Adaptor::ClipboardEventNotifier::GetImplementation(*this).ClearContent();
+}
+
+void ClipboardEventNotifier::EmitContentSelectedSignal()
{
- gToolkitClipboardEventNotifier = this;
+ Internal::Adaptor::ClipboardEventNotifier::GetImplementation(*this).EmitContentSelectedSignal();
}
-ToolkitClipboardEventNotifier::~ToolkitClipboardEventNotifier()
+ClipboardEventNotifier::ClipboardEventSignalV2& ClipboardEventNotifier::ContentSelectedSignal()
{
- gToolkitClipboardEventNotifier = NULL;
+ return Internal::Adaptor::ClipboardEventNotifier::GetImplementation(*this).ContentSelectedSignal();
}
-ClipboardEventNotifier ToolkitClipboardEventNotifier::GetClipboardEventNotifier()
+ClipboardEventNotifier::ClipboardEventNotifier( Internal::Adaptor::ClipboardEventNotifier* notifier )
+: BaseHandle( notifier )
{
- return mClipboardEventNotifier;
}
} // namespace Dali
#include <string>
// PUBLIC INCLUDES
-#include <dali/public-api/adaptor-framework/clipboard-event-notifier.h>
+#define __DALI_CLIPBOARD_EVENT_NOTIFIER_H__
+#include <dali/public-api/object/base-handle.h>
+#include <dali/public-api/signals/dali-signal-v2.h>
+
namespace Dali
{
}
}
-/**
- * This creates a stubbed ClipboardEventNotifier so that internal Toolkit Adaptor calls work.
- */
-class ToolkitClipboardEventNotifier
+class ClipboardEventNotifier : public BaseHandle
{
-public: // Constants
-
-public: // Construction & Destruction
-
- ToolkitClipboardEventNotifier();
- ~ToolkitClipboardEventNotifier();
-
-public: // Getters
-
- ClipboardEventNotifier GetClipboardEventNotifier();
-
-public: // Signal Emissions
+public:
+ typedef SignalV2< void ( ClipboardEventNotifier& ) > ClipboardEventSignalV2;
+ static const char* const SIGNAL_CONTENT_SELECTED; ///< name "content-selected"
- ClipboardEventNotifier::ClipboardEventSignalV2& SignalContentSelected();
+ ClipboardEventNotifier();
+ static ClipboardEventNotifier Get();
+ ~ClipboardEventNotifier();
-public: // TEST FUNCTIONS
+ const std::string& GetContent() const;
+ void SetContent( const std::string& content );
+ void ClearContent();
-private:
+ void EmitContentSelectedSignal();
+ ClipboardEventSignalV2& ContentSelectedSignal();
- Internal::Adaptor::ClipboardEventNotifier* mClipboardEventNotifierStub;
- friend class Internal::Adaptor::ClipboardEventNotifier;
- ClipboardEventNotifier mClipboardEventNotifier; // Hold a handle ourselves.
+ ClipboardEventNotifier( Internal::Adaptor::ClipboardEventNotifier* notifier );
};
} // namespace Dali
// INTERNAL INCLUDES
#include <dali-test-suite-utils.h>
-#include "toolkit-adaptor.h"
#include "toolkit-orientation.h"
namespace Dali
mCore = NULL;
}
- inline ToolkitAdaptor& GetAdaptor()
- {
- return mAdaptor;
- }
-
//ToolkitOrientation& GetOrientation()
//{
//return mOrientation;
//}
private:
- ToolkitAdaptor mAdaptor;
//ToolkitOrientation mOrientation;
};
// Need to override adaptor classes for toolkit test harness, so include
// test harness headers before dali headers.
#include <dali-toolkit-test-suite-utils.h>
+#include "toolkit-style-monitor.h"
#include <dali.h>
#include <dali-toolkit/dali-toolkit.h>
DALI_TEST_EQUALS( dummyImpl.fontChangeCalled, false, TEST_LOCATION );
StyleChange styleChange;
styleChange.defaultFontChange = true;
- Dali::StyleMonitor styleMonitor = application.GetAdaptor().GetToolkitStyleMonitor();
+ Dali::StyleMonitor styleMonitor = StyleMonitor::Get();
styleMonitor.EmitStyleChangeSignal(styleChange);
DALI_TEST_EQUALS( dummyImpl.fontChangeCalled, true, TEST_LOCATION );
mClipboard = Clipboard::Get(); // Store handle to clipboard
// Now in edit mode we can accept string to paste from clipboard
- if( Adaptor::IsAvailable() )
+ ClipboardEventNotifier notifier( ClipboardEventNotifier::Get() );
+ if ( notifier )
{
- ClipboardEventNotifier notifier( ClipboardEventNotifier::Get() );
- if ( notifier )
- {
- notifier.ContentSelectedSignal().Connect( this, &TextInput::OnClipboardTextSelected );
- }
+ notifier.ContentSelectedSignal().Connect( this, &TextInput::OnClipboardTextSelected );
}
}
mClipboard.Reset();
// No longer in edit mode so do not want to receive string from clipboard
- if( Adaptor::IsAvailable() )
+ ClipboardEventNotifier notifier( ClipboardEventNotifier::Get() );
+ if ( notifier )
{
- ClipboardEventNotifier notifier( ClipboardEventNotifier::Get() );
- if ( notifier )
- {
- notifier.ContentSelectedSignal().Disconnect( this, &TextInput::OnClipboardTextSelected );
- }
- Clipboard clipboard = Clipboard::Get();
+ notifier.ContentSelectedSignal().Disconnect( this, &TextInput::OnClipboardTextSelected );
+ }
- if ( clipboard )
- {
- clipboard.HideClipboard();
- }
+ Clipboard clipboard = Clipboard::Get();
+ if ( clipboard )
+ {
+ clipboard.HideClipboard();
}
}
+++ /dev/null
-/*
- * 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 "localized-control-factory-impl.h"
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali/integration-api/debug.h>
-
-// EXTERNAL INCLUDES
-#include <libintl.h>
-
-using std::string;
-using namespace Dali;
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Internal
-{
-
-namespace // unnamed namespace
-{
-
-
-}
-
-LocalizedControlFactory::LocalizedControlFactory()
-: mObjectEntries(),
- mSignalsConnected( false )
-{
-}
-
-LocalizedControlFactory::~LocalizedControlFactory()
-{
-}
-
-Dali::Toolkit::TextView LocalizedControlFactory::CreateLocalizedTextView( const std::string& textID, const std::string& textDomain, const std::string& textViewTheme )
-{
- if( !mSignalsConnected )
- {
- Stage::GetCurrent().GetObjectRegistry().ObjectDestroyedSignal().Connect( this, &LocalizedControlFactory::OnObjectDestruction );
- Adaptor::Get().LanguageChangedSignal().Connect( this, &LocalizedControlFactory::OnLanguageChanged );
- mSignalsConnected = true;
- }
-
- const string& localizedText = dgettext(textDomain.c_str(), textID.c_str());
- Dali::Toolkit::TextView textView = Dali::Toolkit::TextView::New();
- textView.SetText(localizedText);
-
- LocalisedStringInfo info(textID, textDomain, textViewTheme);
-
- mObjectEntries[textView.GetObjectPtr()] = info;
-
- return textView;
-}
-
-void LocalizedControlFactory::OnObjectDestruction( const Dali::RefObject* objectPointer )
-{
- if(!mObjectEntries.empty())
- {
- //Needs optimization. All the destructed objects are currently checked for existence in entries.
- mObjectEntries.erase(objectPointer);
- }
-}
-
-void LocalizedControlFactory::OnLanguageChanged( Dali::Adaptor& adaptor)
-{
- if(!mObjectEntries.empty())
- {
- ObjectEntriesIterator iter = mObjectEntries.begin();
- ObjectEntriesIterator iterEnd = mObjectEntries.end();
- while(iter != iterEnd)
- {
- RefObject* refObjectPtr = const_cast<RefObject*> (iter->first);
- BaseHandle handle(static_cast<BaseObject*>(refObjectPtr));
- LocalisedStringInfo info = iter->second;
-
- const string& localizedText = dgettext(info.textDomain.c_str(), info.textID.c_str());
-
- Toolkit::TextView textView = Dali::Toolkit::TextView::DownCast( handle );
-
- if(textView)
- {
- textView.SetText( localizedText );
- }
- else
- {
- DALI_ASSERT_ALWAYS(false && "Corrupt TextView internal pointer in entries!");
- }
-
- ++iter;
- }
- }
-}
-
-
-
-} // namespace Internal
-
-} // namespace Toolkit
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_TOOLKIT_INTERNAL_LOCALIZED_CONTROL_FACTORY_H__
-#define __DALI_TOOLKIT_INTERNAL_LOCALIZED_CONTROL_FACTORY_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
-#include <string>
-#include <set>
-
-// INTERNAL INCLUDES
-#include <dali/dali.h>
-#include <dali-toolkit/public-api/factory/localized-control-factory.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Internal
-{
-
-/**
- * @copydoc Toolkit::LocalizedControlFactory
- */
-class LocalizedControlFactory : public Dali::BaseObject, public ConnectionTracker
-{
-public:
-
- /**
- * Structure used to store/retrieve localisation info.
- */
- struct LocalisedStringInfo
- {
- LocalisedStringInfo()
- {
- }
-
- LocalisedStringInfo(std::string id, std::string domain, std::string theme)
- : textID(id),
- textDomain(domain),
- textViewTheme(theme)
- {
-
- }
-
- std::string textID;
- std::string textDomain;
- std::string textViewTheme;
- };
-
- typedef std::map< const Dali::RefObject*, LocalisedStringInfo > ObjectEntriesContainer;
- typedef ObjectEntriesContainer::iterator ObjectEntriesIterator;
- typedef ObjectEntriesContainer::const_iterator ObjectEntriesConstIterator;
-
- /**
- * Construct a new LocalizedControlFactory.
- */
- LocalizedControlFactory();
-
- /**
- * @copydoc Toolkit::LocalizedControlFactory::CreateLocalizedTextView
- */
- Dali::Toolkit::TextView CreateLocalizedTextView( const std::string& textID, const std::string& textDomain, const std::string& textViewTheme );
-
-protected:
-
- /**
- * Destructor
- */
- virtual ~LocalizedControlFactory();
-
-private:
-
- /**
- * Callback for Object destructed signal.
- * @param objectPointer Pointer to a RefObject
- */
- void OnObjectDestruction( const Dali::RefObject* objectPointer );
-
- /**
- * Callback for language changed signal.
- * @param adaptor Reference to a Dali::Adaptor instance
- */
- void OnLanguageChanged( Dali::Adaptor& adaptor);
-
-private:
-
- // Undefined
- LocalizedControlFactory(const LocalizedControlFactory&);
- LocalizedControlFactory& operator=(const LocalizedControlFactory& rhs);
-
-private:
-
- ObjectEntriesContainer mObjectEntries;
- bool mSignalsConnected:1;
-
-};
-
-} // namespace Internal
-
-inline Internal::LocalizedControlFactory& GetImpl(Dali::Toolkit::LocalizedControlFactory& obj)
-{
- DALI_ASSERT_ALWAYS(obj);
-
- Dali::BaseObject& handle = obj.GetBaseObject();
-
- return static_cast<Internal::LocalizedControlFactory&>(handle);
-}
-
-inline const Internal::LocalizedControlFactory& GetImpl(const Dali::Toolkit::LocalizedControlFactory& obj)
-{
- DALI_ASSERT_ALWAYS(obj);
-
- const Dali::BaseObject& handle = obj.GetBaseObject();
-
- return static_cast<const Internal::LocalizedControlFactory&>(handle);
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // __DALI_TOOLKIT_INTERNAL_LOCALIZED_CONTROL_FACTORY_H__
$(toolkit_base_src_dir)/controls/text-view/text-view-processor-dbg.cpp \
$(toolkit_base_src_dir)/controls/text-view/text-view-processor-helper-functions.cpp \
$(toolkit_base_src_dir)/controls/text-view/text-view-word-processor.cpp \
- $(toolkit_base_src_dir)/factory/localized-control-factory-impl.cpp \
$(toolkit_base_src_dir)/focus-manager/focus-manager-impl.cpp \
$(toolkit_base_src_dir)/focus-manager/keyboard-focus-manager-impl.cpp \
$(toolkit_base_src_dir)/focus-manager/keyinput-focus-manager-impl.cpp \
RequestDefaultTheme();
- if( Adaptor::IsAvailable() )
+ StyleMonitor styleMonitor( StyleMonitor::Get() );
+ if( styleMonitor )
{
- StyleMonitor::Get().StyleChangeSignal().Connect( this, &StyleManager::StyleMonitorChange );
+ styleMonitor.StyleChangeSignal().Connect( this, &StyleManager::StyleMonitorChange );
}
}
+++ /dev/null
-/*
- * 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 <dali-toolkit/public-api/factory/localized-control-factory.h>
-
-// EXTERNAL INCLUDES
-
-// INTERNAL INCLUDES
-
-#include <dali-toolkit/internal/factory/localized-control-factory-impl.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-Dali::Toolkit::TextView LocalizedControlFactory::CreateLocalizedTextView( const std::string& textID, const std::string& textDomain, const std::string& textViewTheme )
-{
- LocalizedControlFactory factory = Get();
- return GetImpl(factory).CreateLocalizedTextView(textID, textDomain, textViewTheme);
-}
-
-LocalizedControlFactory::LocalizedControlFactory()
-{
-}
-
-LocalizedControlFactory::~LocalizedControlFactory()
-{
-}
-
-LocalizedControlFactory LocalizedControlFactory::Get()
-{
- LocalizedControlFactory factory;
-
- // Check whether the focus factory is already created
- SingletonService singletonService( SingletonService::Get() );
- if ( singletonService )
- {
- Dali::BaseHandle handle = singletonService.GetSingleton(typeid(LocalizedControlFactory));
- if(handle)
- {
- // If so, downcast the handle of singleton to focus factory
- factory = LocalizedControlFactory(dynamic_cast<Internal::LocalizedControlFactory*>(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;
-}
-
-LocalizedControlFactory::LocalizedControlFactory(Internal::LocalizedControlFactory *impl)
- : BaseHandle(impl)
-{
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_TOOLKIT_LOCALIZED_CONTROL_FACTORY_H__
-#define __DALI_TOOLKIT_LOCALIZED_CONTROL_FACTORY_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 <dali-toolkit/public-api/controls/text-view/text-view.h>
-
-namespace Dali DALI_IMPORT_API
-{
-
-namespace Toolkit
-{
-
-namespace Internal DALI_INTERNAL
-{
-class LocalizedControlFactory;
-}
-
-/**
- * @brief This class provides functionality for creating controls which have localized text.
- *
- * This class keeps track of objects created using its factory methods, and updates them
- * when the system language changes.
- *
- * Warning: If the developer calls SetText on the object to overwrite the managed TextView,
- * then it leads to an inconsistent state where the object will be overwritten with the
- * localized text when language/locale changes.
- */
-
-class LocalizedControlFactory : public BaseHandle
-{
-public:
-
- /**
- * @brief Creates a localized TextView, which is automatically updated when the locale or language changes.
- *
- * @pre The LocalizedControlFactory has been initialized.
- *
- * @param textID The id of the localized text with which a platform request (gettext) for localized text can be made.
- * @param textDomain The text domain for the localized text. Eg "sys_string"
- * @param textViewTheme A string containing style info about various properties of TextView for different
- * locale/language.
- * @return handle to a new localized TextView
- */
- static Dali::Toolkit::TextView CreateLocalizedTextView( const std::string& textID, const std::string& textDomain = "sys_string", const std::string& textViewTheme = "{}" );
-
-
-private:
-
- /**
- * @brief Create a LocalizedControlFactory handle; this can be initialised with LocalizedControlFactory::New().
- *
- * Calling member functions with an uninitialised handle is not allowed.
- */
- LocalizedControlFactory();
-
- /**
- * @brief Destructor
- *
- * This is non-virtual since derived Handle types must not contain data or virtual methods.
- */
- ~LocalizedControlFactory();
-
- /**
- * @brief Get the singleton of LocalizedControlFactory object.
- *
- * @return A handle to the LocalizedControlFactory control.
- */
- static LocalizedControlFactory Get();
-
- /**
- * @brief Allows the creation of this Control from an Internal::LocalizedControlFactory pointer.
- *
- * @param[in] impl A pointer to the internal LocalizedControlFactory.
- */
- LocalizedControlFactory(Internal::LocalizedControlFactory *impl);
-}; // class LocalizedControlFactory
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // __DALI_TOOLKIT_LOCALIZED_CONTROL_FACTORY_H__
$(public_api_base_src_dir)/controls/table-view/table-view.cpp \
$(public_api_base_src_dir)/controls/text-input/text-input.cpp \
$(public_api_base_src_dir)/controls/text-view/text-view.cpp \
- $(public_api_base_src_dir)/factory/localized-control-factory.cpp \
$(public_api_base_src_dir)/focus-manager/focus-manager.cpp \
$(public_api_base_src_dir)/focus-manager/keyboard-focus-manager.cpp \
$(public_api_base_src_dir)/focus-manager/keyinput-focus-manager.cpp \
public_api_base_text_view_header_files = \
$(public_api_base_src_dir)/controls/text-view/text-view.h
-public_api_base_factory_header_files = \
- $(public_api_base_src_dir)/factory/localized-control-factory.h
-
public_api_base_focus_manager_header_files = \
$(public_api_base_src_dir)/focus-manager/keyinput-focus-manager.h \
$(public_api_base_src_dir)/focus-manager/focus-manager.h \
publicapibasetableview_HEADERS = $(public_api_base_table_view_header_files)
publicapibasetextview_HEADERS = $(public_api_base_text_view_header_files)
publicapibasetextinput_HEADERS = $(public_api_base_text_input_header_files)
-publicapibasefactory_HEADERS = $(public_api_base_factory_header_files)
publicapibasefocusmanager_HEADERS = $(public_api_base_focus_manager_header_files)
publicapibasemarkupprocessor_HEADERS = $(public_api_base_markup_processor_header_files)
publicapibaseshadereffects_HEADERS = $(public_api_base_shader_effects_header_files)
#include <dali-toolkit/public-api/controls/text-input/text-input.h>
#include <dali-toolkit/public-api/controls/text-view/text-view.h>
#include <dali-toolkit/public-api/enums.h>
-#include <dali-toolkit/public-api/factory/localized-control-factory.h>
#include <dali-toolkit/public-api/focus-manager/focus-manager.h>
#include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
#include <dali-toolkit/public-api/markup-processor/markup-processor.h>