From 7d4d219267ef76f5ed94469d4e800de763c20116 Mon Sep 17 00:00:00 2001 From: Lukasz Marek Date: Wed, 12 Dec 2012 18:04:19 +0100 Subject: [PATCH] Removal of popup implementation [Issue#] N/A. [Bug] N/A [Cause] N/A [Solution] Removal of unused popup API. [Verification] Build all repositories (security-server is also advised) and optionally run any widget. Change-Id: I6da11f153656b9e590eb825828833798c0a8e897 --- CMakeLists.txt | 1 - build/CMakeLists.txt | 1 - build/popup/CMakeLists.txt | 70 --- build/popup/dpl-popup-efl.pc.in | 11 - modules/CMakeLists.txt | 1 - modules/popup/DESCRIPTION | 2 - modules/popup/config.cmake | 42 -- modules/popup/include/dpl/popup/evas_object.h | 661 --------------------- modules/popup/include/dpl/popup/popup.h | 71 --- modules/popup/include/dpl/popup/popup_controller.h | 214 ------- modules/popup/include/dpl/popup/popup_manager.h | 117 ---- modules/popup/include/dpl/popup/popup_object.h | 175 ------ modules/popup/include/dpl/popup/popup_renderer.h | 127 ---- modules/popup/src/evas_object.cpp | 240 -------- modules/popup/src/popup_controller.cpp | 110 ---- modules/popup/src/popup_manager.cpp | 57 -- modules/popup/src/popup_renderer.cpp | 415 ------------- 17 files changed, 2315 deletions(-) delete mode 100644 build/popup/CMakeLists.txt delete mode 100644 build/popup/dpl-popup-efl.pc.in delete mode 100644 modules/popup/DESCRIPTION delete mode 100644 modules/popup/config.cmake delete mode 100644 modules/popup/include/dpl/popup/evas_object.h delete mode 100644 modules/popup/include/dpl/popup/popup.h delete mode 100644 modules/popup/include/dpl/popup/popup_controller.h delete mode 100644 modules/popup/include/dpl/popup/popup_manager.h delete mode 100644 modules/popup/include/dpl/popup/popup_object.h delete mode 100644 modules/popup/include/dpl/popup/popup_renderer.h delete mode 100644 modules/popup/src/evas_object.cpp delete mode 100644 modules/popup/src/popup_controller.cpp delete mode 100644 modules/popup/src/popup_manager.cpp delete mode 100644 modules/popup/src/popup_renderer.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 084e4c2..64704d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -182,7 +182,6 @@ SET(TARGET_DPL_SOCKET_EFL "lib${PROJECT_NAME}-socket-efl") SET(TARGET_DPL_RPC_EFL "lib${PROJECT_NAME}-rpc-efl") SET(TARGET_DPL_TEST_ENGINE_EFL "lib${PROJECT_NAME}-test-efl") SET(TARGET_DPL_LOG_EFL "lib${PROJECT_NAME}-log-efl") -SET(TARGET_DPL_POPUP "lib${PROJECT_NAME}-popup-efl") SET(TARGET_WRT_DAO_RW_LIB "dpl-wrt-dao-rw") SET(TARGET_WRT_DAO_RO_LIB "dpl-wrt-dao-ro") SET(TARGET_AUTO_SAVE_DAO_LIB "wrt-commons-auto-save-dao") diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt index e11b0e9..b27d01f 100644 --- a/build/CMakeLists.txt +++ b/build/CMakeLists.txt @@ -30,7 +30,6 @@ ADD_SUBDIRECTORY(widget_dao) ADD_SUBDIRECTORY(auto_save_dao) ADD_SUBDIRECTORY(security_origin_dao) ADD_SUBDIRECTORY(custom_handler_dao) -ADD_SUBDIRECTORY(popup) ADD_SUBDIRECTORY(utils) ADD_SUBDIRECTORY(support) ADD_SUBDIRECTORY(encryption) diff --git a/build/popup/CMakeLists.txt b/build/popup/CMakeLists.txt deleted file mode 100644 index 07425a3..0000000 --- a/build/popup/CMakeLists.txt +++ /dev/null @@ -1,70 +0,0 @@ -# Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved -# -# 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. -# -# @file CMakeLists.txt -# @author Pawel Sikorski (p.sikorski@samsung.com) -# @version 1.0 -# @brief -# - -# Check required modules -INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(SYS_POPUP - elementary - REQUIRED) - -# Add core include directories -INCLUDE_DIRECTORIES( - ${DPL_LOG_INCLUDE_DIR} - ${DPL_CORE_INCLUDE_DIR} - ${DPL_POPUP_INCLUDE_DIR} - ${DPL_EVENT_INCLUDE_DIR} -) - -INCLUDE_DIRECTORIES(SYSTEM ${SYS_EFL_INCLUDE_DIRS}) -INCLUDE_DIRECTORIES(SYSTEM ${SYS_POPUP_INCLUDE_DIRS}) - -LINK_DIRECTORIES( - ${SYS_POPUP_LIBRARY_DIRS} -) - -# Base EFL based DPL library -SET(DPL_POPUP_LIBRARY "${PROJECT_NAME}-popup-efl") - -# Build shared library - -ADD_LIBRARY(${TARGET_DPL_POPUP} SHARED ${DPL_POPUP_SOURCES}) - -TARGET_LINK_LIBRARIES(${TARGET_DPL_POPUP} - ${SYS_POPUP_LIBRARIES} - ${TARGET_DPL_EFL} -) - -# Target library properties -SET_TARGET_PROPERTIES(${TARGET_DPL_POPUP} PROPERTIES - SOVERSION ${API_VERSION} - VERSION ${VERSION} - CLEAN_DIRECT_OUTPUT 1 - OUTPUT_NAME ${DPL_POPUP_LIBRARY}) - -# Install libraries -INSTALL(TARGETS ${TARGET_DPL_POPUP} - DESTINATION lib) - -# Install detail headers -INSTALL(FILES ${DPL_POPUP_HEADERS} - DESTINATION include/dpl-efl/dpl/popup) - -# Install pkgconfig script -configure_and_install_pkg(dpl-popup-efl.pc) diff --git a/build/popup/dpl-popup-efl.pc.in b/build/popup/dpl-popup-efl.pc.in deleted file mode 100644 index 98dfdf4..0000000 --- a/build/popup/dpl-popup-efl.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=/usr -exec_prefix=${prefix} -libdir=${prefix}/lib -includedir=${prefix}/include - -Name: dpl-popup-efl -Description: DPL Popup functionality - EFL based -Version: @VERSION@ -Requires: dpl-efl -Libs: -L${libdir} -ldpl-popup-efl -Cflags: -I${includedir}/dpl-efl diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index 587ba94..4d39189 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -31,7 +31,6 @@ ADD_SUBDIRECTORY(widget_dao) ADD_SUBDIRECTORY(auto_save_dao) ADD_SUBDIRECTORY(security_origin_dao) ADD_SUBDIRECTORY(custom_handler_dao) -include(popup/config.cmake) include(utils/config.cmake) include(localization/config.cmake) include(support/config.cmake) diff --git a/modules/popup/DESCRIPTION b/modules/popup/DESCRIPTION deleted file mode 100644 index 665e43e..0000000 --- a/modules/popup/DESCRIPTION +++ /dev/null @@ -1,2 +0,0 @@ -!!!options!!! stop -UI module for displaying all kinds of pop-up dialogs diff --git a/modules/popup/config.cmake b/modules/popup/config.cmake deleted file mode 100644 index 7a304d9..0000000 --- a/modules/popup/config.cmake +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved -# -# 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. -# -# -# @file CMakeLists.txt -# @author Pawel Sikorski (p.sikorski@samsung.com) -# @version 1.0 -# - -SET(DPL_POPUP_SOURCES - ${PROJECT_SOURCE_DIR}/modules/popup/src/popup_manager.cpp - ${PROJECT_SOURCE_DIR}/modules/popup/src/evas_object.cpp - ${PROJECT_SOURCE_DIR}/modules/popup/src/popup_renderer.cpp - ${PROJECT_SOURCE_DIR}/modules/popup/src/popup_controller.cpp - PARENT_SCOPE - ) - -SET(DPL_POPUP_HEADERS - ${PROJECT_SOURCE_DIR}/modules/popup/include/dpl/popup/popup.h - ${PROJECT_SOURCE_DIR}/modules/popup/include/dpl/popup/evas_object.h - ${PROJECT_SOURCE_DIR}/modules/popup/include/dpl/popup/popup_controller.h - ${PROJECT_SOURCE_DIR}/modules/popup/include/dpl/popup/popup_manager.h - ${PROJECT_SOURCE_DIR}/modules/popup/include/dpl/popup/popup_object.h - ${PROJECT_SOURCE_DIR}/modules/popup/include/dpl/popup/popup_renderer.h - PARENT_SCOPE - ) - -SET(DPL_POPUP_INCLUDE_DIR - ${PROJECT_SOURCE_DIR}/modules/popup/include - PARENT_SCOPE -) \ No newline at end of file diff --git a/modules/popup/include/dpl/popup/evas_object.h b/modules/popup/include/dpl/popup/evas_object.h deleted file mode 100644 index 25d7a66..0000000 --- a/modules/popup/include/dpl/popup/evas_object.h +++ /dev/null @@ -1,661 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * 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. - */ -/* - * @file evas_object.h - * @author Lukasz Wrzosek (l.wrzosel@samsung.com) - * @version 1.0 - * @brief This file is the header for Evas_Object wrapper from Efl. - */ -#ifndef WRT_SRC_DOMAIN_EFL_EVAS_OBJECT_H -#define WRT_SRC_DOMAIN_EFL_EVAS_OBJECT_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -namespace DPL { -namespace Popup { - -class EvasObject -{ - class EvasObjectShared; - typedef std::shared_ptr EvasObjectSharedPtr; - - public: - class IConnection - { - public: - Evas_Object* GetEvasObject(); - void Disconnect(); - - private: - IConnection(EvasObjectShared* object); - virtual ~IConnection() - { - } - virtual void Call(void* /*event_info*/) = 0; - - static void SmartCallbackWrapper(void* data, - Evas_Object* /*object*/, - void* event_info); - static void EvasCallbackWrapper(void* data, - Evas* /*evas*/, - Evas_Object* /*object*/, - void* event_info); - - virtual void ConnectPrv() = 0; - virtual void DisconnectPrv() = 0; - - friend class EvasObjectShared; - - EvasObjectShared* m_object; - }; - - private: - class EvasObjectShared : DPL::Noncopyable - { - public: - friend class IConnection; - Evas_Object* GetObject(); - - typedef std::set IConnectionsSet; - - class SmartConnectionBase : public IConnection - { - public: - SmartConnectionBase(const std::string& name, - EvasObjectShared* object); - - virtual void ConnectPrv(); - virtual void DisconnectPrv(); - std::string m_callbackName; - }; - - template - class SmartConnection : public SmartConnectionBase - { - public: - typedef void (*CbType)(IConnection* connection, - void* event_info, - Args ... args); - - SmartConnection(const std::string& name, - CbType callback, - EvasObjectShared* object, - Args ... args) : - SmartConnectionBase(name, object), - m_callback(callback), - m_args(args ...) - { - } - - virtual ~SmartConnection() - { - } - - virtual void Call(void* event_info) - { - DPL::Apply(m_callback, - m_args, - this, - event_info); - } - - private: - CbType m_callback; - std::tuple m_args; - }; - - template - class SmartMemberConnection1 : public SmartConnectionBase - { - public: - typedef void (ThisType::*CbType)(IConnection* connection, - void* event_info, ArgType1 *arg1); - - SmartMemberConnection1(const std::string& name, - CbType callback, - ThisType* callee, - ArgType1* arg1, - EvasObjectShared* object) : - SmartConnectionBase(name, object), - m_callback(callback), - m_callee(callee), - m_arg1(arg1) - { - } - - virtual ~SmartMemberConnection1() - { - } - - virtual void Call(void* event_info) - { - (m_callee->*m_callback)(this, event_info, m_arg1); - } - - private: - CbType m_callback; - ThisType* m_callee; - ArgType1* m_arg1; - }; - - template - class SmartMemberConnection2 : public SmartConnectionBase - { - public: - typedef void (ThisType::*CbType)(IConnection* connection, - void* event_info, ArgType1 *arg1, - ArgType2* arg2); - - SmartMemberConnection2(const std::string& name, - CbType callback, - ThisType* callee, - ArgType1* arg1, - ArgType2* arg2, - EvasObjectShared* object) : - SmartConnectionBase(name, object), - m_callback(callback), - m_callee(callee), - m_arg1(arg1), - m_arg2(arg2) - { - } - - virtual ~SmartMemberConnection2() - { - } - - virtual void Call(void* event_info) - { - (m_callee->*m_callback)(this, event_info, m_arg1, m_arg2); - } - - private: - CbType m_callback; - ThisType* m_callee; - ArgType1* m_arg1; - ArgType2* m_arg2; - }; - - class EvasConnectionBase : public IConnection - { - public: - EvasConnectionBase(Evas_Callback_Type type, - EvasObjectShared* object); - - virtual void ConnectPrv(); - virtual void DisconnectPrv(); - - Evas_Callback_Type m_callbackType; - }; - - template - class EvasConnection1 : public EvasConnectionBase - { - public: - typedef void (*CbType)(IConnection* connection, void* event_info, - ArgType1 *arg1); - - EvasConnection1(Evas_Callback_Type type, - CbType callback, - ArgType1* arg1, - EvasObjectShared* object) : - EvasConnectionBase(type, object), - m_callback(callback), - m_arg1(arg1) - { - } - - virtual ~EvasConnection1() - { - } - - virtual void Call(void* event_info) - { - m_callback(this, event_info, m_arg1); - } - - private: - CbType m_callback; - ArgType1* m_arg1; - }; - - template - class EvasConnection2 : public EvasConnectionBase - { - public: - typedef void (*CbType)(IConnection* connection, void* event_info, - ArgType1 *arg1, ArgType2 *arg2); - - EvasConnection2(Evas_Callback_Type type, - CbType callback, - ArgType1* arg1, - ArgType2* arg2, - EvasObjectShared* object) : - EvasConnectionBase(type, object), - m_callback(callback), - m_arg1(arg1), - m_arg2(arg2) - { - } - - virtual ~EvasConnection2() - { - } - - virtual void Call(void* event_info) - { - m_callback(this, event_info, m_arg1, m_arg2); - } - - private: - CbType m_callback; - ArgType1* m_arg1; - ArgType2* m_arg2; - }; - - template - class EvasMemberConnection1 : public EvasConnectionBase - { - public: - typedef void (ThisType::*CbType)(IConnection* connection, - void* event_info, ArgType1 *arg1); - - EvasMemberConnection1(Evas_Callback_Type type, - CbType callback, - ThisType* callee, - ArgType1* arg1, - EvasObjectShared* object) : - EvasConnectionBase(type, object), - m_callback(callback), - m_callee(callee), - m_arg1(arg1) - { - } - - virtual ~EvasMemberConnection1() - { - } - - virtual void Call(void* event_info) - { - (m_callee->*m_callback)(this, event_info, m_arg1); - } - - private: - CbType m_callback; - ThisType* m_callee; - ArgType1* m_arg1; - }; - - template - class EvasMemberConnection2 : public EvasConnectionBase - { - public: - typedef void (ThisType::*CbType)(IConnection* connection, - void* event_info, ArgType1* arg1, - ArgType2* arg2); - - EvasMemberConnection2(Evas_Callback_Type type, - CbType callback, - ThisType* callee, - ArgType1* arg1, - ArgType2* arg2, - EvasObjectShared* object) : - EvasConnectionBase(type, object), - m_callback(callback), - m_callee(callee), - m_arg1(arg1), - m_arg2(arg2) - { - } - - virtual ~EvasMemberConnection2() - { - } - - virtual void Call(void* event_info) - { - (m_callee->*m_callback)(this, event_info, m_arg1, m_arg2); - } - - private: - CbType m_callback; - ThisType* m_callee; - ArgType1* m_arg1; - ArgType2* m_arg2; - }; - - EvasObjectShared(); - explicit EvasObjectShared(Evas_Object* object); - void SetObject(Evas_Object* object); - ~EvasObjectShared(); - - template - IConnection* ConnectSmartCallback(const char* callbackName, - typename SmartConnection::CbType callback, - Args ... args) - { - Assert(m_object); - Assert(callbackName); - Assert(callback); - IConnection* connection = new SmartConnection( - callbackName, - callback, - this, - args ...); - m_connections.insert(connection); - connection->ConnectPrv(); - return connection; - } - - template - IConnection* ConnectMemberSmartCallback( - const char* callbackName, - typename SmartMemberConnection2::CbType callback, - ThisType* callee, - ArgType1* arg1, - ArgType2* arg2) - { - Assert(m_object); - Assert(callee); - Assert(callbackName); - Assert(callback); - IConnection* connection = - new SmartMemberConnection2( - callbackName, - callback, - callee, - arg1, - arg2, - this); - m_connections.insert(connection); - connection->ConnectPrv(); - return connection; - } - - template - IConnection* ConnectMemberSmartCallback( - const char* callbackName, - typename SmartMemberConnection1::CbType callback, - ThisType* callee, - ArgType1* arg1) - { - Assert(m_object); - Assert(callee); - Assert(callbackName); - Assert(callback); - IConnection* connection = - new SmartMemberConnection1(callbackName, - callback, - callee, - arg1, - this); - m_connections.insert(connection); - connection->ConnectPrv(); - return connection; - } - - template - IConnection* ConnectEvasCallback(Evas_Callback_Type callbackType, - typename EvasConnection2::CbType callback, - ArgType1* arg1, - ArgType2* arg2) - { - Assert(m_object); - Assert(callbackType); - Assert(callback); - IConnection* connection = new EvasConnection2( - callbackType, - callback, - arg1, - arg2, - this); - m_connections.insert(connection); - connection->ConnectPrv(); - return connection; - } - - template - IConnection* ConnectEvasCallback(Evas_Callback_Type callbackType, - typename EvasConnection1::CbType callback, - ArgType1* arg1) - { - Assert(m_object); - Assert(callbackType); - Assert(callback); - IConnection* connection = new EvasConnection1( - callbackType, - callback, - arg1, - this); - m_connections.insert(connection); - connection->ConnectPrv(); - return connection; - } - - template - IConnection* ConnectMemberEvasCallback( - Evas_Callback_Type callbackType, - typename EvasMemberConnection2::CbType callback, - ThisType* callee, - ArgType1* arg1, - ArgType2* arg2) - { - Assert(m_object); - Assert(callee); - Assert(callbackType); - Assert(callback); - IConnection* connection = - new EvasMemberConnection2( - callbackType, - callback, - callee, - arg1, - arg2, - this); - m_connections.insert(connection); - connection->ConnectPrv(); - return connection; - } - - template - IConnection* ConnectMemberEvasCallback( - Evas_Callback_Type callbackType, - typename EvasMemberConnection1::CbType callback, - ThisType* callee, - ArgType1* arg1) - { - Assert(m_object); - Assert(callee); - Assert(callbackType); - Assert(callback); - IConnection* connection = - new EvasMemberConnection1(callbackType, - callback, - callee, - arg1, - this); - m_connections.insert(connection); - connection->ConnectPrv(); - return connection; - } - - bool DisconnectCallback(IConnection* connection); - void DisconnectAll(); - - static void StaticOnDelEvent(void* data, - Evas* /*e*/, - Evas_Object* /*o*/, - void* /*ev*/); - - IConnectionsSet m_connections; - Evas_Object* m_object; - }; - - public: - EvasObject(); - explicit EvasObject(Evas_Object* object); - EvasObject(const EvasObject& other); - ~EvasObject(); - - EvasObject& operator=(const EvasObject& other); - EvasObject* operator=(Evas_Object* object); - - operator Evas_Object *(); - - bool IsValid() const - { - Assert(m_object); - return m_object->GetObject() != NULL; - } - - bool DisconnectCallback(IConnection* connection); - void DisconnectAll(); - - template - IConnection* ConnectSmartCallback( - const char* callbackName, - typename EvasObjectShared::SmartConnection::CbType - callback, - Args ... args) - { - Assert(m_object); - return m_object->ConnectSmartCallback(callbackName, callback, args ...); - } - - template - IConnection* ConnectMemberSmartCallback( - const char* callbackName, - typename EvasObjectShared::SmartMemberConnection2::CbType - callback, - ThisType* callee, - ArgType1* arg1, - ArgType2* arg2) - { - Assert(m_object); - Assert(callee); - Assert(callback); - return m_object->ConnectMemberSmartCallback(callbackName, - callback, - callee, - arg1, - arg2); - } - - template - IConnection* ConnectMemberSmartCallback( - const char* callbackName, - typename EvasObjectShared::SmartMemberConnection1::CbType - callback, - ThisType* callee, - ArgType1* arg1) - { - Assert(m_object); - Assert(callee); - Assert(callback); - return m_object->ConnectMemberSmartCallback(callbackName, - callback, - callee, - arg1); - } - - template - IConnection* ConnectEvasCallback( - Evas_Callback_Type callbackType, - typename EvasObjectShared::EvasConnection1::CbType - callback, - ArgType1* arg1, - ArgType2* arg2) - { - Assert(m_object); - return m_object->ConnectEvasCallback(callbackType, callback, arg1, arg2); - } - - template - IConnection* ConnectEvasCallback( - Evas_Callback_Type callbackType, - typename EvasObjectShared::EvasConnection1::CbType - callback, - ArgType1* arg1) - { - Assert(m_object); - return m_object->ConnectEvasCallback(callbackType, callback, arg1); - } - - template - IConnection* ConnectMemberEvasCallback( - Evas_Callback_Type callbackType, - typename EvasObjectShared::EvasMemberConnection1::CbType - callback, - ThisType* callee, - ArgType1* arg1) - { - Assert(m_object); - Assert(callee); - Assert(callback); - return m_object->ConnectMemberEvasCallback(callbackType, - callback, - callee, - arg1); - } - - template - IConnection* ConnectMemberEvasCallback( - Evas_Callback_Type callbackType, - typename EvasObjectShared::EvasMemberConnection2::CbType - callback, - ThisType* callee, - ArgType1* arg1, - ArgType2* arg2) - { - Assert(m_object); - Assert(callee); - Assert(callback); - return m_object->ConnectMemberEvasCallback(callbackType, - callback, - callee, - arg1, - arg2); - } - - private: - EvasObjectSharedPtr m_object; -}; - -}//namespace -}//namespace - - -#endif //WRT_SRC_DOMAIN_EFL_EVAS_OBJECT_H - diff --git a/modules/popup/include/dpl/popup/popup.h b/modules/popup/include/dpl/popup/popup.h deleted file mode 100644 index 84c2c4e..0000000 --- a/modules/popup/include/dpl/popup/popup.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * 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. - */ -/* - * @file popup.h - * @author Lukasz Wrzosek (l.wrzosek@samsung.com) - * @version 1.0 - * @brief This is popup inteface declaration - */ - -#ifndef WRT_SRC_POPUP_POPUP_H_ -#define WRT_SRC_POPUP_POPUP_H_ - -#include -#include -#include -#include -#include -#include - -namespace DPL { -namespace Popup { - -struct AnswerCallbackData -{ - int buttonAnswer; - DPL::Optional password; - bool chackState; -}; - -class PopupManager; -class IPopup; -typedef std::shared_ptr IPopupPtr; - -class IPopup : public std::enable_shared_from_this -{ - public: - virtual void SetTitle(const std::string &title) = 0; - /*The object is deleted automatically after rendered */ - virtual void Append(PopupObject::IPopupObject *object) = 0; - - protected: - typedef void (*PopupCallbackType)(const AnswerCallbackData& answer, - void *data); - virtual void Show(PopupCallbackType callback, - void* data) = 0; - virtual ~IPopup() - { - } - - private: - friend class PopupManager; - friend class std::shared_ptr; -}; - -} // namespace Popup -} // namespace DPL - -#endif //WRT_SRC_POPUP_POPUP_H_ diff --git a/modules/popup/include/dpl/popup/popup_controller.h b/modules/popup/include/dpl/popup/popup_controller.h deleted file mode 100644 index 5f2938a..0000000 --- a/modules/popup/include/dpl/popup/popup_controller.h +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * 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. - */ -/** - * @file popup_controller.h - * @author Lukasz Wrzosek (l.wrzosek@samsung.com) - * @version 1.0 - * @bref Header file for popup controller - */ - -/** - * To display a popup from a given class: - * - **class ABC - **{ - * void AskUser() - * { - * } - * - * void DoSomeLogicWithAnswer() - * { - * } - **}; - * - * ... update the class to something simmilar: - * - **class ABC : Popup::PopupControllerUser - **{ - * void AskUser() { - * using namespace Popup; - * CtrlPopupPtr popup = - * PopupControllerSingletion::Instance().CreatePopup(); - * popup->SetTitle("Title"); - * popup->SetContent("Content"); - * popup->AddButton("name1", 1); - * popup->AddButton("name2", 2); - * ListenForAnswer(popup); - * ShowPopupEvent event(popup, - * MakeAnswerCallback(this, - * &ABC::DoSomeLogicWithAnswer)); - * CONTROLLER_POST_EVENT(PopupController, event); - * } - * - * void DoSomeLogicWithAnswer(Popup::LabelId answer) { - * if (answer == 1) - * ;//name1 pressed - * else if (answer == 2) - * ;//name2 pressed - * } - **}; - **/ - -#ifndef WRT_SRC_POPUP_CONTROLLER_POPUP_CONTROLLER_H_ -#define WRT_SRC_POPUP_CONTROLLER_POPUP_CONTROLLER_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace DPL { -namespace Popup { -typedef int LabelId; - -struct PopupAnswerCallback -{ - typedef void (PopupAnswerCallback::*MemberPtr)(); - - void* callee; - MemberPtr member; - void (*callTranslator)(PopupAnswerCallback* callData, - const AnswerCallbackData& answer); - - void Call(const AnswerCallbackData& answer) - { - callTranslator(this, answer); - } -}; - -class PopupController; -class CtrlPopup; - -typedef std::shared_ptr CtrlPopupPtr; - -DECLARE_GENERIC_EVENT_3(PopupAnswerEvent, - CtrlPopupPtr, - PopupAnswerCallback, - AnswerCallbackData) - -DECLARE_GENERIC_EVENT_2(ShowPopupEventShort, - CtrlPopupPtr, - PopupAnswerCallback) - -class CtrlPopup : public DPL::Event::EventSupport, - public std::enable_shared_from_this -{ - public: - void SetTitle(const std::string &title); - void Append(PopupObject::IPopupObject *object); - - ~CtrlPopup(); - private: - friend class PopupController; - friend class std::shared_ptr; - - explicit CtrlPopup(IPopupPtr popup); - void EmitAnswer(const AnswerCallbackData& answer); - - IPopupPtr m_popup; - PopupAnswerCallback m_callback; -}; - -class PopupController : - public DPL::Event::Controller::Type> -{ - public: - CtrlPopupPtr CreatePopup() const; - - void setExternalCanvas(void* canvas) - { - m_canvas = canvas; - } - void* getExternalCanvas() const - { - return m_canvas; - } - void* m_canvas; - - protected: - virtual void OnEventReceived(const ShowPopupEventShort& event); - PopupController(); - - private: - static void StaticOnAnswerReceived(const AnswerCallbackData& answer, - CtrlPopupPtr* popup); -}; - -class PopupControllerUser : DPL::Event::EventListener -{ - template - struct PopupAnswerCallbackCreator - { - typedef void (Type::*MemberPtr)(const AnswerCallbackData& answer); - union Caster - { - MemberPtr specific; - PopupAnswerCallback::MemberPtr generic; - }; - - static PopupAnswerCallback Create(Type* callee, - MemberPtr callback) - { - PopupAnswerCallback callData; - - callData.callee = callee; - - Caster caster; - caster.specific = callback; - callData.member = caster.generic; - - callData.callTranslator = - &PopupAnswerCallbackCreator::MemberCallbackTranslator; - - return callData; - } - - static void MemberCallbackTranslator(PopupAnswerCallback* callData, - const AnswerCallbackData& answer) - { - Type* typedThis = static_cast(callData->callee); - Caster caster; - caster.generic = callData->member; - MemberPtr typedCallback = caster.specific; - (typedThis->*typedCallback)(answer); - } - }; - - protected: - virtual void OnEventReceived(const PopupAnswerEvent& event); - void ListenForAnswer(CtrlPopupPtr popup); - - template - PopupAnswerCallback MakeAnswerCallback(Type* This, - void (Type::*callback) - (const AnswerCallbackData &)) - { - return PopupAnswerCallbackCreator::Create(This, callback); - } -}; - -typedef DPL::Singleton PopupControllerSingleton; - -} //namespace Popup -} //namespace DPL - -#endif //WRT_SRC_POPUP_CONTROLLER_POPUP_CONTROLLER_H_ diff --git a/modules/popup/include/dpl/popup/popup_manager.h b/modules/popup/include/dpl/popup/popup_manager.h deleted file mode 100644 index 42a4de5..0000000 --- a/modules/popup/include/dpl/popup/popup_manager.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * 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. - */ -/* - * @file popup_manager.h - * @author Lukasz Wrzosek (l.wrzosek@samsung.com) - * @version 1.0 - * @brief This is popup_manager declaration file - */ - -#ifndef WRT_SRC_POPUP_POPUP_MANAGER_H_ -#define WRT_SRC_POPUP_POPUP_MANAGER_H_ - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace DPL { -namespace Popup { - -class PopupManager : DPL::Noncopyable -{ - template - struct TemplatedPopupCallback - { - typedef void (*Type)(const AnswerCallbackData& answer, ArgType* data); - }; - - public: - PopupManager() : m_initialized(false) {} - ~PopupManager() - { - if (m_initialized) { - LogError("Destroyed without Deinitialize"); - } - } - void Initialize (PopupRendererPtr creator); - void Deinitialize(); - void SetPopupRenderer (PopupRendererPtr creator); - IPopupPtr CreatePopup(); - - template - void RunAsyncWithArgType(IPopupPtr popup, - typename TemplatedPopupCallback::Type callback, - ArgType* argument) - { - Assert(callback); - WrapCbAndArg* wrapped = - new WrapCbAndArg(callback, argument); - popup->Show(&CallbackArgTypeTranslator, wrapped); - } - - void Show(IPopupPtr popup, - IPopup::PopupCallbackType callback, - void* userdata) - { - popup->Show(callback, userdata); - } - - void setExternalCanvas(void* externalCanvas) - { - Assert(m_initialized && "Manger should be initialized"); - m_popupRenderer->setExternalCanvas(externalCanvas); - } - - private: - template - struct WrapCbAndArg - { - WrapCbAndArg(typename TemplatedPopupCallback::Type cb, - ArgType* arg) : - callback(cb), - argument(arg) - { - } - - typename TemplatedPopupCallback::Type callback; - ArgType* argument; - }; - - template - static void CallbackArgTypeTranslator(const AnswerCallbackData & answer, - void* data) - { - WrapCbAndArg* wrapped = - static_cast< WrapCbAndArg* >(data); - wrapped->callback(answer, wrapped->argument); - delete wrapped; - } - - bool m_initialized; - PopupRendererPtr m_popupRenderer; -}; - -typedef DPL::Singleton PopupManagerSingleton; - -} // namespace Popup -} // namespace DPL - -#endif //WRT_SRC_POPUP_POPUP_MANAGER_H_ diff --git a/modules/popup/include/dpl/popup/popup_object.h b/modules/popup/include/dpl/popup/popup_object.h deleted file mode 100644 index 5eddc49..0000000 --- a/modules/popup/include/dpl/popup/popup_object.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * 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. - */ -/* - * @file popup_object.h - * @author Justyna Mejzner (j.mejzner@samsung.com) - * @version 1.0 - * @brief This is declaration file of PopupObject - */ - -#ifndef WRT_SRC_POPUP_POPUPOBJECT_H_ -#define WRT_SRC_POPUP_POPUPOBJECT_H_ - -#include - -#include -#include - -namespace DPL { -namespace Popup { - -namespace PopupObject { -class IPopupObject; -class PopupObjectBase; -class Button; -class Label; -class Check; - -typedef std::list PopupObjects; - -enum PopupType -{ - BUTTON, - LABEL, - CHECK -}; - -class IPopupObject -{ - public: - virtual Button* asButton() = 0; - virtual Label* asLabel() = 0; - virtual Check* asCheck() = 0; - virtual PopupType getType() const = 0; - virtual ~IPopupObject() - { - } -}; - -class PopupObjectBase : public IPopupObject -{ - public: - virtual Button* asButton() - { - Assert("wrong type"); - return NULL; - } - virtual Label* asLabel() - { - Assert("wrong type"); - return NULL; - } - virtual Check* asCheck() - { - Assert("wrong type"); - return NULL; - } - - PopupType getType() const - { - return m_type; - } - - protected: - PopupObjectBase(PopupType type) : m_type(type) - { - } - - PopupType m_type; -}; - -class Button : public PopupObjectBase -{ - public: - Button(const std::string& label, - int labelId) : - PopupObjectBase(BUTTON), - m_label(label), - m_labelId(labelId) - { - } - - Button* asButton() - { - return this; - } - - const std::string& getLabel() const - { - return m_label; - } - - int getLabelId() const - { - return m_labelId; - } - - private: - std::string m_label; - int m_labelId; -}; - -class Label : public PopupObjectBase -{ - public: - Label(const std::string &label) : - PopupObjectBase(LABEL), - m_label(label) - { - } - - Label* asLabel() - { - return this; - } - - const std::string& getLabel() const - { - return m_label; - } - - private: - std::string m_label; -}; - -class Check : public PopupObjectBase -{ - public: - Check(const std::string &label) : - PopupObjectBase(CHECK), - m_checkLabel(label) - { - } - - Check* asCheck() - { - return this; - } - - const std::string& getCheckLabel() const - { - return m_checkLabel; - } - - private: - std::string m_checkLabel; -}; -} /*PopupObject*/ - -}//namespace Popup -}//namespace DPL - -#endif //WRT_SRC_POPUP_POPUPOBJECT_H_ diff --git a/modules/popup/include/dpl/popup/popup_renderer.h b/modules/popup/include/dpl/popup/popup_renderer.h deleted file mode 100644 index 18d2aab..0000000 --- a/modules/popup/include/dpl/popup/popup_renderer.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * 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. - */ -/* - * @file popup_renderer.h - * @author Lukasz Wrzosek (l.wrzosek@samsung.com) - * @version 1.0 - * @brief This is declaration file of PopupRenderer - */ - -#ifndef WRT_SRC_POPUP_POPUP_RENDERER_H_ -#define WRT_SRC_POPUP_POPUP_RENDERER_H_ - -#include -#include -#include - -#include -#include -#include -#include -#include - -namespace DPL { -namespace Popup { - -class PopupRenderer : public std::enable_shared_from_this -{ - public: - PopupRenderer(); - ~PopupRenderer(); - void Initialize(); - void Deinitialize(); - IPopupPtr CreatePopup(); - virtual void setExternalCanvas(void* externalCanvas); - protected: - class Popup; - typedef std::shared_ptr PopupPtr; - - class Popup : public IPopup - { - public: - typedef std::map ButtonMap; - virtual void SetTitle(const std::string &title) - { - LogDebug(title); - Assert(m_title.empty()); - m_title = title; - } - - virtual void Append(PopupObject::IPopupObject *object) - { - m_popupObjectList.push_back(object); - } - - virtual void Show(IPopup::PopupCallbackType callback, - void* data) - { - Assert(callback); - m_data = data; - m_callback = callback; - m_renderer->Render(std::static_pointer_cast(shared_from_this())); - } - - const std::string& GetTitle() const - { - return m_title; - } - - PopupObject::PopupObjects& GetPopupObjects() - { - return m_popupObjectList; - } - - virtual ~Popup() - { - FOREACH(it, m_popupObjectList) { - delete *it; - } - } - - private: - friend class PopupRenderer; - friend class std::shared_ptr; - friend class PopupObjectTheme; - - Popup(std::shared_ptr renderer) : m_renderer(renderer) - { - } - - void ForwardAnswer(const AnswerCallbackData & answer) const - { - m_callback(answer, m_data); - } - - std::string m_title; - void* m_data; - IPopup::PopupCallbackType m_callback; - PopupObject::PopupObjects m_popupObjectList; - std::shared_ptr m_renderer; - }; - - private: - void Render (PopupPtr popup); - - class Impl; - Impl* m_impl; -}; - -typedef std::shared_ptr PopupRendererPtr; - -} // namespace Popup -} // namespace DPL - -#endif //WRT_SRC_POPUP_POPUP_RENDERER_H_ diff --git a/modules/popup/src/evas_object.cpp b/modules/popup/src/evas_object.cpp deleted file mode 100644 index f95e13b..0000000 --- a/modules/popup/src/evas_object.cpp +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * 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. - */ -/* - * @file evas_object.cpp - * @author Lukasz Wrzosek (l.wrzosel@samsung.com) - * @version 1.0 - * @brief This file is the implementation for Evas_Object wrapper from Efl. - */ -#include -#include -#include - -namespace DPL { -namespace Popup { - -Evas_Object* EvasObject::IConnection::GetEvasObject() -{ - return m_object->GetObject(); -} - -void EvasObject::IConnection::Disconnect() -{ - m_object->DisconnectCallback(this); -} - -EvasObject::IConnection::IConnection(EvasObject::EvasObjectShared* object) : - m_object(object) -{ -} - -void EvasObject::IConnection::SmartCallbackWrapper(void* data, - Evas_Object* /*object*/, - void* event_info) -{ - Assert(data); - IConnection* Calle = static_cast(data); - Calle->Call(event_info); -} - -void EvasObject::IConnection::EvasCallbackWrapper(void* data, - Evas* /*evas*/, - Evas_Object* /*object*/, - void* event_info) -{ - Assert(data); - IConnection* Calle = static_cast(data); - Calle->Call(event_info); -} - -Evas_Object* EvasObject::EvasObjectShared::GetObject() -{ - return m_object; -} - -EvasObject::EvasObjectShared::SmartConnectionBase::SmartConnectionBase( - const std::string& name, - EvasObject::EvasObjectShared* object) : - IConnection(object), - m_callbackName(name) -{ -} - -void EvasObject::EvasObjectShared::SmartConnectionBase::ConnectPrv() -{ - evas_object_smart_callback_add(GetEvasObject(), - m_callbackName.c_str(), - &IConnection::SmartCallbackWrapper, this); -} - -void EvasObject::EvasObjectShared::SmartConnectionBase::DisconnectPrv() -{ - evas_object_smart_callback_del(GetEvasObject(), - m_callbackName.c_str(), - &IConnection::SmartCallbackWrapper); -} - -EvasObject::EvasObjectShared::EvasConnectionBase::EvasConnectionBase( - Evas_Callback_Type type, - EvasObject::EvasObjectShared* object) : - IConnection(object), - m_callbackType(type) -{ -} - -void EvasObject::EvasObjectShared::EvasConnectionBase::ConnectPrv() -{ - evas_object_event_callback_add( - GetEvasObject(), m_callbackType, &IConnection::EvasCallbackWrapper, - this); -} - -void EvasObject::EvasObjectShared::EvasConnectionBase::DisconnectPrv() -{ - evas_object_event_callback_del_full( - GetEvasObject(), m_callbackType, &IConnection::EvasCallbackWrapper, - this); -} - -EvasObject::EvasObjectShared::EvasObjectShared() : - m_object(NULL) -{ -} - -EvasObject::EvasObjectShared::EvasObjectShared(Evas_Object* object) : - m_object(object) -{ - Assert(m_object); - evas_object_event_callback_add(m_object, - EVAS_CALLBACK_DEL, - &StaticOnDelEvent, - this); -} - -void EvasObject::EvasObjectShared::SetObject(Evas_Object* object) -{ - Assert(m_object == NULL); - Assert(object != NULL); - m_object = object; - evas_object_event_callback_add(m_object, - EVAS_CALLBACK_DEL, - &StaticOnDelEvent, - this); -} - -EvasObject::EvasObjectShared::~EvasObjectShared() -{ - if (m_object) { - DisconnectAll(); - evas_object_event_callback_del(m_object, - EVAS_CALLBACK_DEL, - &StaticOnDelEvent); - m_object = NULL; - } -} - -bool EvasObject::EvasObjectShared::DisconnectCallback(IConnection* connection) -{ - IConnectionsSet::iterator it = m_connections.find(connection); - if (it != m_connections.end()) { - (*it)->DisconnectPrv(); - delete connection; - m_connections.erase(it); - return true; - } - return false; -} - -void EvasObject::EvasObjectShared::DisconnectAll() -{ - FOREACH(it, m_connections) - { - (*it)->DisconnectPrv(); - delete *it; - } - m_connections.clear(); -} - -void EvasObject::EvasObjectShared::StaticOnDelEvent(void* data, - Evas* /*e*/, - Evas_Object* /*o*/, - void* /*ev*/) -{ - Assert(data); - EvasObjectShared* This = static_cast(data); - if (This->m_object) { - evas_object_event_callback_del(This->m_object, - EVAS_CALLBACK_DEL, - &StaticOnDelEvent); - This->DisconnectAll(); - This->m_object = NULL; - } -} - -EvasObject::EvasObject() : - m_object(new EvasObjectShared()) -{ -} - -EvasObject::EvasObject(Evas_Object* object) : - m_object(new EvasObjectShared(object)) -{ -} - -EvasObject::EvasObject(const EvasObject& other) : - m_object(other.m_object) -{ -} - -//this destructor must be here to let pimpl with shared_ptr work without warning -EvasObject::~EvasObject() -{ -} - -EvasObject& EvasObject::operator=(const EvasObject& other) -{ - Assert(m_object); - m_object = other.m_object; - return *this; -} - -EvasObject* EvasObject::operator=(Evas_Object* object) -{ - Assert(m_object); - m_object->SetObject(object); - return this; -} - -bool EvasObject::DisconnectCallback(IConnection* connection) -{ - Assert(m_object); - return m_object->DisconnectCallback(connection); -} - -void EvasObject::DisconnectAll() -{ - Assert(m_object); - m_object->DisconnectAll(); -} - -EvasObject::operator Evas_Object *() -{ - Assert(m_object); - return m_object->GetObject(); -} - -} // namespace DPL -} // namespace Popup diff --git a/modules/popup/src/popup_controller.cpp b/modules/popup/src/popup_controller.cpp deleted file mode 100644 index 5bd1cf1..0000000 --- a/modules/popup/src/popup_controller.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * 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. - */ -/** - * @file popup_controller.cpp - * @author Lukasz Wrzosek (l.wrzosek@samsung.com) - * @version 1.0 - * @bref Implementation file for popup controller - */ -#include -#include - -#include -#include -#include -IMPLEMENT_SINGLETON(DPL::Popup::PopupController) - -namespace DPL { -namespace Popup { - -void CtrlPopup::SetTitle(const std::string &title) -{ - Assert(m_popup); - m_popup->SetTitle(title); -} - -void CtrlPopup::Append(PopupObject::IPopupObject *object) -{ - Assert(m_popup); - m_popup->Append(object); -} - -CtrlPopup::CtrlPopup(IPopupPtr popup) : - m_popup(popup), - m_callback() -{ - Assert(m_popup); -} - -CtrlPopup::~CtrlPopup() -{ -} - -void CtrlPopup::EmitAnswer(const AnswerCallbackData & answer) -{ - AnswerCallbackData l_answer = answer; - PopupAnswerEvent event(shared_from_this(), m_callback, l_answer); - DPL::Event::EventSupport::EmitEvent(event); -} - -PopupController::PopupController() : m_canvas(NULL) -{ -} - -CtrlPopupPtr PopupController::CreatePopup() const -{ - return CtrlPopupPtr( - new CtrlPopup(PopupManagerSingleton::Instance().CreatePopup())); -} - -void PopupController::OnEventReceived(const ShowPopupEventShort& event) -{ - CtrlPopupPtr popup = event.GetArg0(); - popup->m_callback = event.GetArg1(); - - //pass canvas from controller to manager - //canvas is not passed earlier because value wasn't set properly - PopupManagerSingleton::Instance().setExternalCanvas(getExternalCanvas()); - - PopupManagerSingleton::Instance().RunAsyncWithArgType( - popup->m_popup, - &PopupController::StaticOnAnswerReceived, - new CtrlPopupPtr(popup)); -} - -void PopupController::StaticOnAnswerReceived(const AnswerCallbackData & answer, - CtrlPopupPtr* popup) -{ - Assert(popup != NULL); - (*popup)->EmitAnswer(answer); - delete popup; // Just SharedPtr is destroyed, not the popup itself -} - -void PopupControllerUser::OnEventReceived(const PopupAnswerEvent& event) -{ - //Here we are in a proper context to call the callback - PopupAnswerCallback answerCall = event.GetArg1(); - AnswerCallbackData answer = event.GetArg2(); - answerCall.Call(answer); - event.GetArg0()->DPL::Event::EventSupport::RemoveListener(this); -} - -void PopupControllerUser::ListenForAnswer(CtrlPopupPtr popup) -{ - popup->DPL::Event::EventSupport::AddListener(this); -} -} //namespace Popup -} //namespace DPL diff --git a/modules/popup/src/popup_manager.cpp b/modules/popup/src/popup_manager.cpp deleted file mode 100644 index a6fa465..0000000 --- a/modules/popup/src/popup_manager.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * 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. - */ -/* - * @file popup_manager.cpp - * @author Lukasz Wrzosek (l.wrzosek@samsung.com) - * @version 1.0 - * @brief This is popup_manager implementation file - */ -#include -#include -#include -#include -#include -#include - -IMPLEMENT_SINGLETON(DPL::Popup::PopupManager) - -namespace DPL { -namespace Popup { - -void PopupManager::Initialize(PopupRendererPtr renderer) -{ - Assert(!m_initialized); - m_popupRenderer = renderer; - m_popupRenderer->Initialize(); - m_initialized = true; -} - -void PopupManager::Deinitialize() -{ - m_popupRenderer->Deinitialize(); - Assert(m_initialized); - m_popupRenderer.reset(); - m_initialized = false; -} - -IPopupPtr PopupManager::CreatePopup() -{ - Assert(m_initialized); - return m_popupRenderer->CreatePopup(); -} - -} // namespace Popup -} // namespace DPL diff --git a/modules/popup/src/popup_renderer.cpp b/modules/popup/src/popup_renderer.cpp deleted file mode 100644 index 411c709..0000000 --- a/modules/popup/src/popup_renderer.cpp +++ /dev/null @@ -1,415 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * 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. - */ -/* - * @file popup_renderer.cpp - * @author Lukasz Wrzosek (l.wrzosek@samsung.com) - * @version 1.0 - * @brief This is efl specific implementation for PopupRenderer - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace DPL { - -namespace { -using namespace Popup; -const char* EDJ_NAME = "/usr/share/edje/ace/generic_popup.edj"; -const char* POPUP_LAYOUT1 = "popup_layout1"; -const char* POPUP_LAYOUT2 = "popup_layout2"; -const char* POPUP_PART_TITLE = "title,text"; -const char* POPUP_PART_BUTTON1 = "button1"; -const char* POPUP_PART_BUTTON2 = "button2"; -const char* POPUP_PART_BUTTON3 = "button3"; -const char* BUTTON_CLICKED_CALLBACK_NAME = "clicked"; -const char* CHANGED_CALLBACK_NAME = "changed"; -const unsigned int MAX_NUMBER_OF_VERTICAL = 2; - -Evas_Object* create_layout_main(Evas_Object* parent, int totalV) -{ - Evas_Object *layout = elm_layout_add(parent); - - if (totalV == 1) { - elm_layout_file_set(layout, EDJ_NAME, POPUP_LAYOUT1); - } else if (totalV == 2) { - elm_layout_file_set(layout, EDJ_NAME, POPUP_LAYOUT2); - } else { - Assert("popup needs define new group in the edc"); - } - - evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - return layout; -} -} //namespace - -namespace Popup { -class PopupRenderer::Impl -{ - public: - Impl() : - m_popupsToRender(), - m_current(), - m_initialized(false) - { - } - - ~Impl() - { - if (m_initialized) { - LogError("Destroyed without Deinitialize"); - } - } - - void Initialize() - { - Assert(!m_initialized); - m_initialized = true; - } - - void Deinitialize() - { - Assert(m_initialized); - m_current.reset(); - while (!m_popupsToRender.empty()) { - m_popupsToRender.pop(); - } - m_initialized = false; - } - - void ButtonCallback(EvasObject::IConnection* /*connection*/, - void* /*event_info*/, - void* data) - { - LogInfo("ButtonCallback"); - Assert(m_initialized); - AnswerCallbackData answerData; - - answerData.buttonAnswer = reinterpret_cast(data); - answerData.chackState = m_checkState; - answerData.password = m_password; - m_current->ForwardAnswer(answerData); - m_current.reset(); - - FOREACH(it, m_createdObjects) - { - if (it->IsValid()) { - evas_object_del(*it); - } - } - m_createdObjects.clear(); - m_checkState = false; - DoRender(); - } - - void CheckCallback(EvasObject::IConnection* connection, - void* /*event_info*/, - void* /* unused */) - { - m_checkState = - elm_check_state_get(connection->GetEvasObject()); - } - - void Render (PopupPtr popup) - { - Assert(m_initialized); - m_popupsToRender.push(popup); - DoRender(); - } - - void DoRender(const PopupObject::Label& object, - EvasObject& parent, - EvasObject& layout, - int themeIndex) - { - EvasObject label(elm_label_add(parent)); - - elm_object_style_set(label, "popup_description/default"); - elm_label_line_wrap_set(label, ELM_WRAP_WORD); - elm_object_text_set(label, object.getLabel().c_str()); - evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0); - evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_show(label); - - elm_object_part_content_set( - layout, - DPL::lexical_cast(themeIndex).c_str(), - label); - m_createdObjects.push_back(label); - } - - void DoRender(const PopupObject::Check& object, - EvasObject& parent, - EvasObject& layout, - int themeIndex) - { - EvasObject check(elm_check_add(parent)); - - evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, 0.0); - elm_object_text_set(check, - object.getCheckLabel().c_str()); - elm_object_part_content_set( - layout, - DPL::lexical_cast(themeIndex).c_str(), - check); - - check.ConnectMemberSmartCallback(CHANGED_CALLBACK_NAME, - &Impl::CheckCallback, - this, - static_cast(NULL)); - evas_object_show(check); - m_createdObjects.push_back(check); - } - - void DoRender(const PopupObject::Button& object, - EvasObject &parent) - { - EvasObject btn(elm_button_add(parent)); - - elm_object_text_set(btn, object.getLabel().c_str()); - elm_object_part_content_set(parent, POPUP_PART_BUTTON1, btn); - btn.ConnectMemberSmartCallback(BUTTON_CLICKED_CALLBACK_NAME, - &Impl::ButtonCallback, - this, - reinterpret_cast(object.getLabelId())); - m_createdObjects.push_back(btn); - } - - void DoRender(const PopupObject::Button& object1, - const PopupObject::Button& object2, - EvasObject &parent) - { - DoRender(object1, parent); - - EvasObject btn2(elm_button_add(parent)); - - elm_object_text_set(btn2, object2.getLabel().c_str()); - elm_object_part_content_set(parent, POPUP_PART_BUTTON2, btn2); - btn2.ConnectMemberSmartCallback(BUTTON_CLICKED_CALLBACK_NAME, - &Impl::ButtonCallback, - this, - reinterpret_cast(object2.getLabelId())); - m_createdObjects.push_back(btn2); - } - - void DoRender(const PopupObject::Button& object1, - const PopupObject::Button& object2, - const PopupObject::Button& object3, - EvasObject &parent) - { - DoRender(object1, object2, parent); - - EvasObject btn3(elm_button_add(parent)); - - elm_object_text_set(btn3, object3.getLabel().c_str()); - elm_object_part_content_set(parent, POPUP_PART_BUTTON3, btn3); - btn3.ConnectMemberSmartCallback(BUTTON_CLICKED_CALLBACK_NAME, - &Impl::ButtonCallback, - this, - reinterpret_cast(object3.getLabelId())); - m_createdObjects.push_back(btn3); - } - - EvasObject getBaseObject() - { - if (getExternalCanvas() == NULL) { - LogInfo("Create old style popup"); - EvasObject win(elm_win_add(NULL, "Popup", ELM_WIN_DIALOG_BASIC)); - elm_win_borderless_set(win, EINA_TRUE); - elm_win_alpha_set(win, EINA_TRUE); - elm_win_raise(win); - { - int w, h, x, y; - ecore_x_window_geometry_get(ecore_x_window_root_first_get(), - &x, - &y, - &w, - &h); - evas_object_resize(win, w, h); - evas_object_move(win, x, y); - } - m_createdObjects.push_back(win); - evas_object_show(win); - return win; - } else { - LogInfo("Create new style popup"); - EvasObject win(getExternalCanvas()); - evas_object_show(win); - return win; - } - } - - void DoRender() - { - if (!m_current && !m_popupsToRender.empty()) { - m_current = m_popupsToRender.front(); - m_popupsToRender.pop(); - - m_themeIndexV = 0; - - // preprocessing - std::vector countPopupObjects = {0 /* PopupObject::BUTTON */, - 0 /* PopupObject::LABEL */, - 0 /* PopupObject::CHECK */}; - FOREACH(it, m_current->GetPopupObjects()) { - Assert((*it)->getType() < countPopupObjects.size() && - "Wrong PopupObject assigned"); - countPopupObjects[(*it)->getType()]++; - } - int needsIndexV = countPopupObjects[PopupObject::LABEL] + - countPopupObjects[PopupObject::CHECK]; - - EvasObject win = getBaseObject(); - EvasObject main(elm_popup_add(win)); - - evas_object_size_hint_weight_set(main, - EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - elm_object_part_text_set(main, - POPUP_PART_TITLE, - m_current->GetTitle().c_str()); - - m_createdObjects.push_back(main); - std::vector buttonObjectList; - EvasObject layout(create_layout_main(main, needsIndexV)); - m_createdObjects.push_back(layout); - - FOREACH(it, m_current->GetPopupObjects()) { - switch ((*it)->getType()) { - case PopupObject::BUTTON: - buttonObjectList.push_back(*(*it)->asButton()); - break; - case PopupObject::LABEL: - DoRender(*(*it)->asLabel(), - main, - layout, - m_themeIndexV++); - break; - case PopupObject::CHECK: - DoRender(*(*it)->asCheck(), - main, - layout, - m_themeIndexV++); - break; - default: - Assert("incorrect type"); - } - Assert(m_themeIndexV <= MAX_NUMBER_OF_VERTICAL); - } - elm_object_content_set(main, - layout); - - // show buution - switch(buttonObjectList.size()) { - case 0: - LogInfo("no button"); - break; - case 1: - DoRender(buttonObjectList.at(0), - main); - break; - case 2: - DoRender(buttonObjectList.at(0), - buttonObjectList.at(1), - main); - break; - case 3: - DoRender(buttonObjectList.at(0), - buttonObjectList.at(1), - buttonObjectList.at(2), - main); - break; - default: - Assert("incorrect button number"); - break; - } - - evas_object_show(main); - } - } - - void setExternalCanvas(void* externalCanvas) - { - m_externalCanvas = static_cast(externalCanvas); - } - - Evas_Object* getExternalCanvas() const - { - return m_externalCanvas; - } - - std::queue m_popupsToRender; - std::list m_createdObjects; - PopupPtr m_current; - bool m_initialized; - bool m_checkState; - DPL::Optional m_password; - unsigned int m_themeIndexV; - - private: - Evas_Object* m_externalCanvas; -}; - -PopupRenderer::PopupRenderer() -{ - m_impl = new PopupRenderer::Impl(); -} - -PopupRenderer::~PopupRenderer() -{ - delete m_impl; -} - -void PopupRenderer::Initialize() -{ - Assert(m_impl); - m_impl->Initialize(); -} - -void PopupRenderer::Deinitialize() -{ - Assert(m_impl); - m_impl->Deinitialize(); -} - -IPopupPtr PopupRenderer::CreatePopup() -{ - return std::static_pointer_cast(IPopupPtr - (new Popup(shared_from_this()))); -} - -void PopupRenderer::Render(PopupPtr popup) -{ - m_impl->Render(popup); -} - -void PopupRenderer::setExternalCanvas(void* externalCanvas) -{ - m_impl->setExternalCanvas(externalCanvas); -} - -} // namespace Popup -} // namespace DPL -- 2.7.4