HeeJu Kang <mobum.kang at samsung dot com>
YoungIk Cho <youngik.cho at samsung dot com>
Jungmin Park <jungmin76.park at samsung dot com>
+Munseok Choi <ms47.choi at samsung dot com>
#include <FShellNotificationManager.h>
#include <FShellNotificationRequest.h>
+#include <FShellIBadgeEventListener.h>
#include <FShellQuickPanelFrame.h>
+#include <FShellLiveboxView.h>
+#include <FShellLiveboxManager.h>
+#include <FShellLiveboxProviderInfo.h>
+#include <FShellLiveboxSizeInfo.h>
+#include <FShellLiveboxProvider.h>
+#include <FShellILiveboxProviderFactory.h>
+#include <FShellLiveboxPopupProvider.h>
+#include <FShellILiveboxPopupProviderFactory.h>
+#include <FShellLiveboxProviderManager.h>
+#include <FShellLiveboxFrame.h>
+#include <FShellLiveboxPopup.h>
+#include <FShellILiveboxAddRequestListener.h>
+#include <FShellShortcutManager.h>
+#include <FShellIShortcutRequestListener.h>
+#include <FShellLockManager.h>
/**
* @namespace Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.1 (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.1
+//
+// 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 FShellIBadgeEventListener.h
+ * @brief This is the header file for the %IBadgeEventListener interface.
+ *
+ * This header file contains the declarations of the %IBadgeEventListener interface.
+ */
+
+#ifndef _FSHELL_IBADGE_EVENT_LISTENER_H_
+#define _FSHELL_IBADGE_EVENT_LISTENER_H_
+
+#include <FBaseRtIEventListener.h>
+#include <FAppTypes.h>
+
+namespace Tizen { namespace Shell
+{
+
+/**
+ * @interface IBadgeEventListener
+ * @brief This interface defines a listener for the Home screen that receives badge updated event.
+ *
+ * @since 2.1
+ *
+ * The %IBadgeEventListener interface defines a listener for for the Home screen that receives badge updated event.
+ */
+class _OSP_EXPORT_ IBadgeEventListener
+ : virtual public Tizen::Base::Runtime::IEventListener
+{
+public:
+ /**
+ * This polymorphic destructor should be overridden if required.
+ * This way, the destructors of the derived classes are called when the destructor of this interface is called.
+ *
+ * @since 2.1
+ */
+ virtual ~IBadgeEventListener(void) {}
+
+ /**
+ * Called when requested to add a shortcut @n
+ *
+ * @param[in] appId The application ID that badge number updated
+ * @param[in] badgeNumber Updated badge number
+ * @see NotificationManager::Notify()
+ */
+ virtual void OnBadgeUpdated(const Tizen::App::AppId& appId, int badgeNumber) = 0;
+
+protected:
+ //
+ // This method is for internal use only. Using this method can cause behavioral,
+ // security-related, and consistency-related issues in the application.
+ //
+ // @since 2.1
+ //
+ virtual void IBadgeEventListener_Reserved1(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral,
+ // security-related, and consistency-related issues in the application.
+ //
+ // @since 2.1
+ //
+ virtual void IBadgeEventListener_Reserved2(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral,
+ // security-related, and consistency-related issues in the application.
+ //
+ // @since 2.1
+ //
+ virtual void IBadgeEventListener_Reserved3(void) {}
+};
+
+}} // Tizen::Shell
+
+#endif /* _FSHELL_IBADGE_EVENT_LISTENER_H_ */
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShellILiveboxAddRequestListener.h
+ * @brief This is the header file for the %ILiveboxAddRequestListener interface.
+ *
+ * This header file contains the declarations of the %ILiveboxAddRequestListener interface.
+ */
+
+#ifndef _FSHELL_ILIVEBOX_ADD_REQUEST_LISTENER_H_
+#define _FSHELL_ILIVEBOX_ADD_REQUEST_LISTENER_H_
+
+#include <FBaseRtIEventListener.h>
+#include <FBaseString.h>
+#include <FAppTypes.h>
+
+namespace Tizen { namespace Shell
+{
+
+/**
+ * @interface ILiveboxAddRequestListener
+ * @brief This interface defines a listener for a Livebox viewer(eg, Home screen, Lock screen) that receives request to add Livebox
+ *
+ * @since 2.1
+ *
+ * The %ILiveboxAddRequestListener interface defines a listener for a Livebox viewer(eg, Home screen, Lock screen) that receives request to add Livebox
+ */
+class _OSP_EXPORT_ ILiveboxAddRequestListener
+ : virtual public Tizen::Base::Runtime::IEventListener
+{
+public:
+ /**
+ * This polymorphic destructor should be overridden if required.
+ * This way, the destructors of the derived classes are called when the destructor of this interface is called.
+ *
+ * @since 2.1
+ */
+ virtual ~ILiveboxAddRequestListener() {}
+
+ /**
+ * Called when requested to add a Livebox @n
+ * The Livebox viewer application such as the Home screen can get callback request to add a Livebox by implementing this listener. @n
+ *
+ * @param[in] appId The application ID of the application providing Livebox
+ * @param[in] providerName The name of Livebox provider to be added
+ * @param[in] text Alternative text for the Livebox
+ * @param[in] userInfo User information for the Livebox provider
+ * @see LiveboxManager::AddLivebox()
+ */
+ virtual void OnLiveboxAddRequested(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& text, const Tizen::Base::String& userInfo) = 0;
+
+protected:
+ //
+ // This method is for internal use only. Using this method can cause behavioral,
+ // security-related, and consistency-related issues in the application.
+ //
+ // @since 2.1
+ //
+ virtual void ILiveboxAddReqeustListener_Reserved1(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral,
+ // security-related, and consistency-related issues in the application.
+ //
+ // @since 2.1
+ //
+ virtual void ILiveboxAddReqeustListener_Reserved2(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral,
+ // security-related, and consistency-related issues in the application.
+ //
+ // @since 2.1
+ //
+ virtual void ILiveboxAddReqeustListener_Reserved3(void) {}
+
+};
+
+}} // Tizen::Shell
+
+#endif /* _FSHELL_ILIVEBOX_ADD_REQUEST_LISTENER_H_ */
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file FShellILiveboxPopupProvider.h
+ * @brief This is the header file for the %ILiveboxPopupProviderFactory interface.
+ *
+ * This header file contains the declarations of the %ILiveboxPopupProviderFactory interface.
+ */
+
+#ifndef _FSHELL_ILIVEBOX_POPUP_PROVIDER_FACTORY_H_
+#define _FSHELL_ILIVEBOX_POPUP_PROVIDER_FACTORY_H_
+
+#include <FBaseString.h>
+#include <FShellLiveboxPopupProvider.h>
+
+namespace Tizen { namespace Shell
+{
+
+class LiveboxPopupProvider;
+
+/**
+ * @interface ILiveboxPopupProviderFactory
+ * @brief This interface defines the factory for the %LiveboxPopupProvider creation
+ *
+ * @since 2.1
+ *
+ * The %ILiveboxPopupProviderFactory is the factory interface for creating the %LiveboxPopupProvider instance.
+ * The %LiveboxManager calls CreateInstance() when an instance of %ILiveboxPopupProvider is required.
+ *
+ * @see LiveboxManager
+ */
+class _OSP_EXPORT_ ILiveboxPopupProviderFactory
+{
+public:
+ /**
+ * This polymorphic destructor should be overridden if required.
+ * This way, the destructors of the derived classes are called when the destructor of this interface is called.
+ *
+ * @since 2.1
+ */
+ virtual ~ILiveboxPopupProviderFactory() {};
+
+ /**
+ * Creates a LiveboxPopupProvider instance@n
+ * Called when the LiveboxPopupProvider creation request is received from the livebox service. @n
+ * Applications that provide the Livebox functionality must implement this listener.
+ *
+ * @since 2.1
+ *
+ * @param[in] providerName The Livebox provider name
+ * @param[in] userInfo User information that specifed when the Livebox is added
+ */
+ virtual LiveboxPopupProvider* CreateInstance(const Tizen::Base::String& providerName, const Tizen::Base::String& userInfo) = 0;
+
+protected:
+ //
+ // This method is for internal use only. Using this method can cause behavioral,
+ // security-related, and consistency-related issues in the application.
+ //
+ // @since 2.1
+ //
+ virtual void ILiveboxPopupProvider_Reserved1(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral,
+ // security-related, and consistency-related issues in the application.
+ //
+ // @since 2.1
+ //
+ virtual void ILiveboxPopupProvider_Reserved2(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral,
+ // security-related, and consistency-related issues in the application.
+ //
+ // @since 2.1
+ //
+ virtual void ILiveboxPopupProvider_Reserved3(void) {}
+};
+
+}} // Tizen::Shell
+
+#endif /* _ILIVEBOX_POPUP_FACTORY_H_ */
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShellILiveboxProviderFactory.h
+ * @brief This is the header file for the %ILiveboxProviderFactory interface.
+ *
+ * This header file contains the declarations of the %ILiveboxProviderFactory interface.
+ */
+
+#ifndef _FSHELL_ILIVEBOX_PROVIDER_FACTORY_H_
+#define _FSHELL_ILIVEBOX_PROVIDER_FACTORY_H_
+
+#include <FBaseString.h>
+
+namespace Tizen { namespace Shell
+{
+
+class LiveboxProvider;
+
+/**
+ * @interface ILiveboxProviderFactory
+ * @brief This interface defines the factory for the %LiveboxProvider creation
+ *
+ * @since 2.1
+ *
+ * The %ILiveboxProviderFactory interface defines a factory for the %LiveboxProvider creation
+ * The %LiveboxManager calls CreateInstance() when an instance of %LiveboxProvider is required.
+ * Applications that provide the %LiveboxProvider functionality must implement this interface.
+ *
+ * @see LiveboxManager
+ */
+class _OSP_EXPORT_ ILiveboxProviderFactory
+{
+public:
+ /**
+ * This polymorphic destructor should be overridden if required.
+ * This way, the destructors of the derived classes are called when the destructor of this interface is called.
+ *
+ * @since 2.1
+ */
+ virtual ~ILiveboxProviderFactory() {};
+
+ /**
+ * Called when the LiveboxProvider creation request is received from the livebox service. @n
+ * Applications that provide the %LiveboxProvider functionality must implement this listener.
+ *
+ * @since 2.1
+ *
+ * @param[in] providerName The Livebox provider name
+ * @param[in] width The width of the Livebox
+ * @param[in] height The height of the Livebox
+ * @param[in] userInfo User information that specifed when the Livebox is added
+ */
+ virtual LiveboxProvider* CreateInstance(const Tizen::Base::String& providerName, float width, float height, const Tizen::Base::String& userInfo) = 0;
+
+protected:
+ //
+ // This method is for internal use only. Using this method can cause behavioral,
+ // security-related, and consistency-related issues in the application.
+ //
+ // @since 2.1
+ //
+ virtual void ILiveboxProviderFactory_Reserved1(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral,
+ // security-related, and consistency-related issues in the application.
+ //
+ // @since 2.1
+ //
+ virtual void ILiveboxProviderFactory_Reserved2(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral,
+ // security-related, and consistency-related issues in the application.
+ //
+ // @since 2.1
+ //
+ virtual void ILiveboxProviderFactory_Reserved3(void) {}
+};
+
+}} // Tizen::Shell
+
+#endif /* _FSHELL_ILIVEBOX_PROVIDER_FACTORY_H_ */
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2013 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.
+//
+
+/**
+ * @file FShellIShortcutRequestListener.h
+ * @brief This is the header file for the %IShortcutRequestListener interface.
+ *
+ * This header file contains the declarations of the %IShortcutRequestListener interface.
+ */
+
+#ifndef _FSHELL_ISHORTCUT_REQUEST_LISTENER_H_
+#define _FSHELL_ISHORTCUT_REQUEST_LISTENER_H_
+
+#include <FBaseString.h>
+#include <FAppTypes.h>
+#include <FBaseRtIEventListener.h>
+
+namespace Tizen { namespace Shell
+{
+
+/**
+ * @interface IShortcutRequestListener
+ * @brief This interface defines a listener for the Home application that receives request to add a shortcut.
+ *
+ * @since 2.1
+ *
+ * The %IShortcutRequestListener interface defines a listener for for the Home application that receives request to add a shortcut.
+
+ * The following example demonstrates how to starts the application when added shortcut is selected by user.
+ * @code
+#include <FShell.h>
+#include <FApp.h>
+
+using namespace Tizen::Shell;
+using namespace Tizen::App;
+
+ if( uriData.IsEmpty() )
+ {
+ AppManager::GetInstance()->LaunchApplication(appId, null);
+ }
+ else
+ {
+ AppControlpAc = AppManager::FindAppControlN(App::GetInstance()->GetAppId(), L"http://tizen.org/appcontrol/operation/view");
+ if( pAc )
+ {
+ pAc->Start(*uriData, null, null, null);
+ delete pAc;
+ }
+ }
+@endcode
+ */
+class _OSP_EXPORT_ IShortcutRequestListener
+ : virtual public Tizen::Base::Runtime::IEventListener
+{
+public:
+ /**
+ * This polymorphic destructor should be overridden if required.
+ * This way, the destructors of the derived classes are called when the destructor of this interface is called.
+ *
+ * @since 2.1
+ */
+ virtual ~IShortcutRequestListener(void) {}
+
+ /**
+ * Called when requested to add the shortcut @n
+ *
+ * @param[in] appId The application ID
+ * @param[in] displayName The display name of shortcut
+ * @param[in] iconFilePath The icon file path
+ * @param]in] uriData Uri that will be delivered by IAppControlProviderEventListener::OnAppControlRequestReceived(), when the application is started via shortcut.
+ * @see ShortcutManager::AddShortcut()
+ *
+ * @remarks If uriData is specified, application should be started by AppControl with http://tizen.org/appcontrol/operation/view operation, when it's launched from the Home application via shortcut.
+ * Or else application should be started by AppControl with default opertaion (http://tizen.org/appcontrol/operation/main).
+ * For more information on the AppControl class, see <a href="../org.tizen.native.appprogramming/html/guide/app/Fapp_controls.htm">Application Controls</a>, and <a href="../org.tizen.native.appprogramming/html/guide/app/delivering_launch_arguments.htm">Delivering Launch Arguments</a>.
+ */
+ virtual void OnShortcutAddRequested(const Tizen::App::AppId& appId, const Tizen::Base::String& displayName, const Tizen::Base::String& iconFilePath, const Tizen::Base::String& uriData) = 0;
+
+ /**
+ * Called when requested to remove the shortcut @n
+ *
+ * @param[in] appId The application ID
+ * @param[in] displayName The display name of shortcut
+ *
+ * @remarks If there are one more shortcuts with duplicated appId and displayName, all of them should be removed.
+ *
+ * @see ShortcutManager::RemoveShortcut()
+ */
+ virtual void OnShortcutRemoveRequested(const Tizen::App::AppId& appId, const Tizen::Base::String& displayName) = 0;
+
+protected:
+ //
+ // This method is for internal use only. Using this method can cause behavioral,
+ // security-related, and consistency-related issues in the application.
+ //
+ // @since 2.1
+ //
+ virtual void IShortcutReqeustListener_Reserved1(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral,
+ // security-related, and consistency-related issues in the application.
+ //
+ // @since 2.1
+ //
+ virtual void IShortcutReqeustListener_Reserved2(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral,
+ // security-related, and consistency-related issues in the application.
+ //
+ // @since 2.1
+ //
+ virtual void IShortcutReqeustListener_Reserved3(void) {}
+};
+
+}} // Tizen::Shell
+
+#endif /* _FSHELL_ISHORTCUT_REQUEST_LISTENER_H_ */
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShellLiveboxFrame.h
+ * @brief This is the header file for the %LiveboxFrame class.
+ *
+ * This header file contains the declarations of the %LiveboxFrame class.
+ */
+
+#ifndef _FSHELL_LIVEBOX_FRAME_H_
+#define _FSHELL_LIVEBOX_FRAME_H_
+
+#include <FUiWindow.h>
+
+namespace Tizen { namespace Shell
+{
+
+/**
+ * @class LiveboxFrame
+ * @brief This class provides the main frame window for a LiveboxProvider.
+ * @since 2.1
+ *
+ * The %LiveboxFrame is the root parent of all Livebox controls that are created by a LiveboxProvider.
+ *
+ */
+class _OSP_EXPORT_ LiveboxFrame
+ : public Tizen::Ui::Window
+{
+public:
+ /**
+ * The object is not fully constructed after this constructor is called.
+ * For full construction, the Construct() method must be called after calling this constructor.
+ *
+ * @since 2.1
+ */
+ LiveboxFrame(void);
+
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.1
+ */
+ virtual ~LiveboxFrame(void);
+
+ /**
+ * Initializes this instance of %LiveboxFrame with the specified parameter.
+ *
+ * @since 2.1
+ * @return An error code
+ * @param[in] size The new width and height
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG A specified input parameter is invalid.
+ * @see LiveboxProvider::OnLiveboxProviderInitialize()
+ */
+ result Construct(const Tizen::Graphics::FloatDimension& size);
+
+ /**
+ * Initializes this instance of %LiveboxFrame with the specified parameter.
+ *
+ * @since 2.1
+ * @return An error code
+ * @param[in] layout The layout for both the portrait and landscape mode
+ * @param[in] size The new width and height
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG A specified input parameter is invalid.
+ * @see LiveboxProvider::OnLiveboxProviderInitialize()
+ */
+ result Construct(const Tizen::Ui::Layout& layout, const Tizen::Graphics::FloatDimension& size);
+
+protected:
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related,
+ // and consistency-related issues in the application.
+ //
+ // Following method is reserved and may change its name at any time without prior notice.
+ //
+ virtual void LiveboxFrame_Reserved1(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related,
+ // and consistency-related issues in the application.
+ //
+ // Following method is reserved and may change its name at any time without prior notice.
+ //
+ virtual void LiveboxFrame_Reserved2(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related,
+ // and consistency-related issues in the application.
+ //
+ // Following method is reserved and may change its name at any time without prior notice.
+ //
+ virtual void LiveboxFrame_Reserved3(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related,
+ // and consistency-related issues in the application.
+ //
+ // Following method is reserved and may change its name at any time without prior notice.
+ //
+ virtual void LiveboxFrame_Reserved4(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related,
+ // and consistency-related issues in the application.
+ //
+ // Following method is reserved and may change its name at any time without prior notice.
+ //
+ virtual void LiveboxFrame_Reserved5(void) {}
+
+private:
+ //
+ // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ LiveboxFrame(const LiveboxFrame& rhs);
+
+ //
+ // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ LiveboxFrame& operator =(const LiveboxFrame& rhs);
+}; // LiveboxFrame
+
+}} // Tizen::Shell
+
+#endif // _FSHELL_LIVEBOX_FRAME_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShellLiveboxManager.h
+ * @brief This is the header file for the %LiveboxManager class.
+ *
+ * This header file contains the declarations of the %LiveboxManager class.
+ */
+
+#ifndef _FSHELL_LIVEBOX_MANAGER_H_
+#define _FSHELL_LIVEBOX_MANAGER_H_
+
+#include <unique_ptr.h>
+#include <FBaseString.h>
+#include <FAppTypes.h>
+
+namespace Tizen { namespace Base { namespace Collection { class IList; } } }
+namespace Tizen { namespace Shell
+{
+
+class LiveboxProviderInfo;
+class ILiveboxAddRequestListener;
+
+/**
+ * @class LiveboxManager
+ * @brief Manages static information of all the Liveboxes and provides APIs for Livebox viewer(Such as the Home screen).
+ *
+ * @since 2.1
+ *
+ * @final This class is not intended for extension.
+ *
+ * The %LiveboxManager class manages static information of all the Liveboxes and deliveries request to add Livebox.
+ */
+class _OSP_EXPORT_ LiveboxManager
+ : public Tizen::Base::Object
+{
+public:
+
+ /**
+ * Gets the Livebox manager instance.
+ *
+ * @since 2.1
+ *
+ * @return A pointer to the %LiveboxManager instance, @n
+ * else @c null if it fails
+ */
+ static LiveboxManager* GetInstance(void);
+
+ /**
+ * Gets a list of installed LiveboxProviderInfo
+ *
+ * @since 2.1
+ *
+ * @return A pointer to the array list that contains all LiveboxProviderInfo of installed LiveboxProvider@n
+ * else @c null if an error occurs
+ *
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ Tizen::Base::Collection::IList* GetLiveboxProviderInfoListN(void);
+
+ /**
+ * Gets a LiveboxProviderInfo of the specified Livebox provider.
+ *
+ * @since 2.1
+ *
+ * @param[in] appId The Id of the application that provides Livebox
+ * @param[in] providerName The name of the Livebox provider
+ * @return A pointer to the LiveboxProviderInfo of the specified LiveboxProvider@n
+ * else @c null if an error occurs
+ *
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_APP_NOT_INSTALLED The application is not installed.
+ * @exception E_OBJ_NOT_FOUND The specified Livebox provider is not found.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ LiveboxProviderInfo* GetLiveboxProviderInfoN(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName);
+
+ /**
+ * Gets the LiveboxProviderInfo of default Livebox provider in the package.
+ *
+ * @since 2.1
+ *
+ * @param[in] packageId The Id of the packageId that contains Livebox provider
+ * @return A pointer to the LiveboxProviderInfo of the default LiveboxProvider@n
+ * else @c null if there is no default Livebox provider or an error occurs
+ *
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_APP_NOT_INSTALLED The application is not installed.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ LiveboxProviderInfo* GetDefaultLiveboxProviderInfoN(const Tizen::App::PackageId& packageId);
+
+ /**
+ * Sets a Livebox request listener. @n
+ * The listener gets notified when the request is recieved. @n
+ * To unset the listener, pass a @c null value to the pListener parameter.
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @param[in] pListener The pointer to the listener to receive request to add Livebox
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ *
+ * @see ILiveboxAddRequestListener
+ * @remarks Platform does not have the ownership of this pointer, So caller should manage the listener object properly.
+ */
+ result SetLiveboxAddRequestListener(ILiveboxAddRequestListener* pListener);
+
+private:
+ //
+ // This default constructor is intentionally declared as private to implement the %Singleton semantic.
+ //
+ // @since 2.1
+ //
+ LiveboxManager(void);
+
+ //
+ // This destructor is intentionally declared as private to implement the %Singleton semantic.
+ //
+ // @since 2.1
+ //
+ virtual ~LiveboxManager(void);
+
+ //
+ // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @since 2.1
+ //
+ LiveboxManager(const LiveboxManager& rhs);
+
+ //
+ // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @since 2.1
+ //
+ LiveboxManager& operator =(const LiveboxManager& rhs);
+
+ //
+ // Constructs the instance of this class.
+ //
+ // @since 2.1
+ //
+ // @return An error code
+ // @exception E_SUCCESS The method is successful.
+ // @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ //
+ result Construct(void);
+
+ static void InitSingleton(void);\r
+ static void DestroySingleton(void);\r
+\r
+private:
+
+ static LiveboxManager* __pTheInstance;\r
+ class _LiveboxManagerImpl* __pLiveboxManagerImpl;
+ friend struct std::default_delete< LiveboxManager >;
+};
+
+}} // Tizen::Shell
+#endif /* _FSHELL_LIVEBOX_MANAGER_H_ */
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShellLiveboxPopup.h
+ * @brief This is the header file for the %LiveboxPopup class.
+ *
+ * This header file contains the declarations of the %LiveboxPopup class.
+ */
+
+#ifndef _FSHELL_LIVEBOX_POPUP_H_
+#define _FSHELL_LIVEBOX_POPUP_H_
+
+#include <FUiWindow.h>
+
+namespace Tizen { namespace Shell
+{
+
+/**
+ * @class LiveboxPopup
+ * @brief This class provides the popup for a LiveboxProvider.
+ * @since 2.1
+ *
+ * The %LiveboxPopup supports detailed screen for a LiveboxProvider.
+ *
+ */
+class _OSP_EXPORT_ LiveboxPopup
+ : public Tizen::Ui::Window
+{
+public:
+ /**
+ * The object is not fully constructed after this constructor is called.
+ * For full construction, the Construct() method must be called after calling this constructor.
+ *
+ * @since 2.1
+ */
+ LiveboxPopup(void);
+
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.1
+ */
+ virtual ~LiveboxPopup(void);
+
+ /**
+ * Initializes this instance of %LiveboxFrame with the specified parameter.
+ *
+ * @since 2.1
+ * @return An error code
+ * @param[in] size The new width and height
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG A specified input parameter is invalid.
+ * @see LiveboxProvider::OnLiveboxPopupProviderInitialize()
+ */
+ result Construct(const Tizen::Graphics::FloatDimension& size);
+
+ /**
+ * Initializes this instance of %LiveboxFrame with the specified parameter.
+ *
+ * @since 2.1
+ * @return An error code
+ * @param[in] layout The layout for both the portrait and landscape mode
+ * @param[in] size The new width and height
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG A specified input parameter is invalid.
+ * @see LiveboxProvider::OnLiveboxPopupProviderInitialize()
+ */
+ result Construct(const Tizen::Ui::Layout& layout, const Tizen::Graphics::FloatDimension& size);
+\r
+ /**\r
+ * Gets the bounds of the client area.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return The bounds of the client area in a FloatRectangle instance\r
+ */\r
+ Tizen::Graphics::FloatRectangle GetClientAreaBounds(void) const;
+\r
+ /**\r
+ * Creates and returns a graphics canvas whose bounds (position and size) are equal to the bounds of the client area of the %LiveboxPopup.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return The graphic canvas of the %LiveboxPopup, @n\r
+ * else @c null if an error occurs\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_RESOURCE_UNAVAILABLE The required resource is currently unavailable.\r
+ * @remarks The method allocates a Tizen::Graphics::Canvas whose bounds are equal to that of the client area of the % LiveboxPopup. @n\r
+ * It is the responsibility of the developers to deallocate the canvas after use.\r
+ * @remarks The canvas is valid only if the properties of the parent control of the canvas remain unchanged. @n\r
+ * Therefore, delete the previously allocated canvas and create a new canvas using the GetClientAreaCanvasN() method if the size or position of the
+ * control is changed.\r
+ * @remarks The specific error code can be accessed using the GetLastResult() method.\r
+ */\r
+ Tizen::Graphics::Canvas* GetClientAreaCanvasN(void) const;\r
+\r
+ /**\r
+ * Translates the specified position to the client coordinates.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return The float position in relative to the top-left corner of the client-area, @n\r
+ * else @c (-1.0f,-1.0f) if the instance is invalid\r
+ * @param[in] controlPosition The float position relative to the top-left corner of the %LiveboxPopup.
+ * @see TranslateToControlPosition()
+ */\r
+ Tizen::Graphics::FloatPoint TranslateToClientAreaPosition(const Tizen::Graphics::FloatPoint& controlPosition) const;
+\r
+ /**\r
+ * Translates the specified client position to the control coordinate.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return The float position in relative to the top-left corner of the %Popup control, @n\r
+ * else @c (-1.0f,-1.0f) if the instance is invalid\r
+ * @param[in] clientPosition The float position relative to the top-left corner of the client area\r
+ * @see TranslateToClientAreaPosition()
+ */\r
+ Tizen::Graphics::FloatPoint TranslateToControlPosition(const Tizen::Graphics::FloatPoint& clientPosition) const;
+
+protected:
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related,
+ // and consistency-related issues in the application.
+ //
+ // Following method is reserved and may change its name at any time without prior notice.
+ //
+ virtual void LiveboxPopup_Reserved1(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related,
+ // and consistency-related issues in the application.
+ //
+ // Following method is reserved and may change its name at any time without prior notice.
+ //
+ virtual void LiveboxPopup_Reserved2(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related,
+ // and consistency-related issues in the application.
+ //
+ // Following method is reserved and may change its name at any time without prior notice.
+ //
+ virtual void LiveboxPopup_Reserved3(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related,
+ // and consistency-related issues in the application.
+ //
+ // Following method is reserved and may change its name at any time without prior notice.
+ //
+ virtual void LiveboxPopup_Reserved4(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related,
+ // and consistency-related issues in the application.
+ //
+ // Following method is reserved and may change its name at any time without prior notice.
+ //
+ virtual void LiveboxPopup_Reserved5(void) {}
+
+private:
+ //
+ // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ LiveboxPopup(const LiveboxPopup& rhs);
+
+ //
+ // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ LiveboxPopup& operator =(const LiveboxPopup& rhs);
+}; // LiveboxPopup
+
+}} // Tizen::Shell
+
+#endif // _FSHELL_LIVEBOX_POPUP_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShellLiveboxPopupProvider.h
+ * @brief This is the header file for the LiveboxPopupProvider class.
+ *
+ * This header file contains the declarations of the %LiveboxPopupProvider class.
+ */
+
+#ifndef _FSHELL_LIVEBOX_POPUP_PROVIDER_H_
+#define _FSHELL_LIVEBOX_POPUP_PROVIDER_H_
+
+#include <FBaseObject.h>
+
+namespace Tizen { namespace Shell
+{
+
+class LiveboxPopup;
+
+/**
+ * @class LiveboxPopupProvider
+ * @brief This class is the abstract base class of all Livebox popup provider
+ *
+ * @since 2.1
+ *
+ * The %LiveboxPopupProvider class is a base class which represents a Livebox popup provider
+ */
+class _OSP_EXPORT_ LiveboxPopupProvider
+ : public Tizen::Base::Object
+{
+protected:
+ /**
+ * This is the default constructor for this class.
+ *
+ * @since 2.1
+ */
+ LiveboxPopupProvider(void);
+
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.1
+ */
+ virtual ~LiveboxPopupProvider(void);
+
+ /**
+ * Called when the Livebox popup provider is required to be created @n
+ *
+ * @since 2.1
+ *
+ * @param[in] userInfo User information that specifed when the Livebox is added
+ * @return @c true if the method is successful, @n
+ * else @c false\r
+ *
+ * @remarks LiveboxPopup should be created and set here
+ * @see SetLiveboxPopup
+ */
+ virtual bool OnLiveboxPopupProviderInitializing(const Tizen::Base::String& userInfo) = 0;
+
+ /**
+ * Called when the Livebox popup provider is required to be destroyed @n
+ *
+ * @since 2.1
+ */
+ virtual void OnLiveboxPopupProviderTerminating(void) = 0;
+
+ /**
+ * Sets the Livebox popup to the Livebox popup provider
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @param[in] pLiveboxPopup The pointer to LiveboxPopup instance to be set to the Livebox
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The pointer to the LiveboxFrame is null, or not constructed yet.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ *
+ * @remarks This function should be called only in OnLiveboxPopupProviderInitializing.
+ * @remarks LiveboxPopup instance ownership is transferred to platform. After LiveboxPopupProvider::OnLiveboxPopupProviderTerminating() is called, LiveboxPopup instance is removed automatically. LiveboxPopup instance reuse is not allowed.
+ */
+ result SetLiveboxPopup(Tizen::Shell::LiveboxPopup* pLiveboxPopup);
+
+ /**
+ * Gets the Livebox popup
+ *
+ * @since 2.1
+ *
+ * @return The LiveboxPopup instnace, or null if any LiveboxPopup is set yet.
+ */
+ Tizen::Shell::LiveboxPopup* GetLiveboxPopup(void);
+
+ /**
+ * Gets the Livebox popup from the Livebox
+ *
+ * @since 2.1
+ *
+ * @return The LiveboxPopup instnace, or null if any LiveboxPopup is set yet.
+ */
+ const Tizen::Shell::LiveboxPopup* GetLiveboxPopup(void) const;
+
+ /**
+ * Requests Livebox service to trigger specified Livebox update
+ *
+ * @since 2.1
+ *
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ */
+ result RequestUpdateToLivebox(void);
+
+protected:
+ //
+ // This method is for internal use only. Using this method can cause behavioral,
+ // security-related, and consistency-related issues in the application.
+ //
+ // @since 2.1
+ //
+ virtual void LiveboxPopupProvider_Reserved1(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral,
+ // security-related, and consistency-related issues in the application.
+ //
+ // @since 2.1
+ //
+ virtual void LiveboxPopupProvider_Reserved2(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral,
+ // security-related, and consistency-related issues in the application.
+ //
+ // @since 2.1
+ //
+ virtual void LiveboxPopupProvider_Reserved3(void) {}
+
+private:
+ //
+ // Initializes this instance of %LiveboxPopupProvider
+ //
+ // @since 2.1
+ //
+ result Construct(const Tizen::Base::String& instanceId, double x, double y);
+
+ //
+ // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @since 2.1
+ //
+ LiveboxPopupProvider(const LiveboxPopupProvider& rhs);
+
+ //
+ // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @since 2.1
+ //
+ LiveboxPopupProvider& operator =(const LiveboxPopupProvider& rhs);
+
+private:
+ class _LiveboxPopupProviderImpl* __pLiveboxPopupProviderImpl;
+
+ friend class _LiveboxProviderManagerImpl;
+
+}; // LiveboxPopupProvider
+
+}} // Tizen::Shell
+
+#endif /* _FSHELL_LIVEBOX_POPUP_PROVIDER_H_ */
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShellLiveboxProvider.h
+ * @brief This is the header file for the LiveboxProvider class.
+ *
+ * This header file contains the declarations of the %AppManager class.
+ */
+
+#ifndef _FSHELL_LIVEBOX_PROVIDER_H_
+#define _FSHELL_LIVEBOX_PROVIDER_H_
+
+#include <FBaseObject.h>
+
+namespace Tizen { namespace Shell
+{
+
+class LiveboxFrame;
+
+/**
+ * @class LiveboxProvider
+ * @brief This class is the abstract base class of all Livebox provider
+ *
+ * @since 2.1
+ *
+ * The %LiveboxProvider class is a base class which represents a Livebox provider
+ */
+class _OSP_EXPORT_ LiveboxProvider
+ : public Tizen::Base::Object
+{
+protected:
+
+ /**
+ * This is the default constructor for this class.
+ *
+ * @since 2.1
+ */
+ LiveboxProvider(void);
+
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.1
+ */
+ virtual ~LiveboxProvider(void);
+
+ /**
+ * Called when the Livebox provider is required to be created @n
+ *
+ * @since 2.1
+ *
+ * @param[in] width The width of the Livebox
+ * @param[in] height The height of the Livebox
+ * @param[in] userInfo User information that specifed when the Livebox is added
+ *
+ * @return @c true if the method is successful, @n
+ * else @c false
+ *
+ * @remarks LiveboxFrame should be created and set here
+ * @see SetLiveboxFrame
+ *
+ * The following example demonstrates how to initialize the %LiveboxProvider.
+ *
+ * @code
+ * #include <FShell.h>
+ *
+ * using namespace Tizen::Shell;
+ *
+ * void MyLiveboxProvider::OnLiveboxProviderInitializing(int width, int height, const String& userInfo)
+ * {
+ * LiveboxFrame* pFrame = new MyLiveboxProviderFrame();
+ * pFrame->Construct(Dimension(width, height));
+ * __pLabel = new Label();
+ *
+ * Rectangle bounds = GetBounds();
+ * __pLabel->Construct(bounds, L"TIZEN");
+ * AddControl(*__pLabel);
+ * this->SetLiveboxFrame(pFrame);
+ * pFrame->Show();
+ *
+ * return true;
+ * }
+ * @endcode
+ */
+ virtual bool OnLiveboxProviderInitializing(float width, float height, const Tizen::Base::String& userInfo) = 0;
+
+ /**
+ * Called when the Livebox provider is required to be destroyed @n
+ *
+ * @since 2.1
+ */
+ virtual void OnLiveboxProviderTerminating(void) = 0;
+
+ /**
+ * Called when the correspondent Livebox is removed from Livebox viewer application. (Home or Lock screen, etc)@n
+ * If you stored Livebox provider state to persistent storage such as registry or DB, you can destroy by implementing this pure virtual function.@n
+ *
+ *
+ * @since 2.1
+ *
+ * @remarks This function is called after OnLiveboxProviderTerminating called.
+ */
+ virtual void OnLiveboxProviderRemoved(void) = 0;
+
+ /**
+ * Called when the Livebox is required to be updated @n
+ * Your Livebox provider can be updated by implementing this pure virtual function.
+ *
+ * @since 2.1
+ *
+ * @param[in] userInfo User information to update the Livebox provider@n
+ * This parameter is delivered from LiveboxProvider::RequestUpdate()
+ *
+ * @return @c true if the method is successful, @n
+ * else @c false
+ *
+ * @remarks This function is called when UpdatePeriod timer is expired or LiveboxManager::RequestUpdate() is called.@n
+ */
+ virtual bool OnLiveboxProviderUpdating(const Tizen::Base::String& userInfo) = 0;
+
+ /**
+ * Sets the LiveboxFrame to the LiveboxProvider
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @param[in] pLiveboxFrame The LiveboxFrame to be set to the LiveboxProvider
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The pointer to the LiveboxFrame is null, or not constructed yet.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ *
+ * @remarks This function should be called only in OnLiveboxProviderInitializing.
+ * @remarks LiveboxFrame instance ownership is transferred to platform. After LiveboxProvider::OnLiveboxProviderTerminating() is called, LiveboxPopup instance is removed automatically. LiveboxFrame instance reuse is not allowed.
+ */
+ result SetLiveboxFrame(LiveboxFrame* pLiveboxFrame);
+
+ /**
+ * Get the LiveboxFrame from the LiveboxProvider
+ *
+ * @since 2.1
+ *
+ * @return the LiveboxFrame instnace, or null if any LiveboxFrame isn't set yet.
+ */
+ LiveboxFrame* GetLiveboxFrame(void);
+
+ /**
+ * Get the LiveboxFrame from the LiveboxProvider
+ *
+ * @since 2.1
+ *
+ * @return the LiveboxFrame instnace, or null if any LiveboxFrame isn't set yet.
+ */
+ const LiveboxFrame* GetLiveboxFrame(void) const;
+
+protected:
+ //
+ // This method is for internal use only. Using this method can cause behavioral,
+ // security-related, and consistency-related issues in the application.
+ //
+ // @since 2.1
+ //
+ virtual void LiveboxProvider_Reserved1(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral,
+ // security-related, and consistency-related issues in the application.
+ //
+ // @since 2.1
+ //
+ virtual void LiveboxProvider_Reserved2(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral,
+ // security-related, and consistency-related issues in the application.
+ //
+ // @since 2.1
+ //
+ virtual void LiveboxProvider_Reserved3(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral,
+ // security-related, and consistency-related issues in the application.
+ //
+ // @since 2.1
+ //
+ virtual void LiveboxProvider_Reserved4(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral,
+ // security-related, and consistency-related issues in the application.
+ //
+ // @since 2.1
+ //
+ virtual void LiveboxProvider_Reserved5(void) {}
+
+private:
+
+ //
+ // Initializes this instance of %LiveboxProvider
+ //
+ // @since 2.1
+ //
+ result Construct(const Tizen::Base::String& instanceId);
+
+ //
+ // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @since 2.1
+ //
+ LiveboxProvider(const LiveboxProvider& rhs);
+
+ //
+ // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @since 2.1
+ //
+ LiveboxProvider& operator =(const LiveboxProvider& rhs);
+
+
+private:
+ class _LiveboxProviderImpl* __pLiveboxProviderImpl;
+
+ friend class _LiveboxProviderManagerImpl;
+};
+
+}} // Tizen::Shell
+#endif /* _FSHELL_LIVEBOX_PROVIDER_H_ */
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShellLiveboxProviderInfo.h
+ * @brief This is the header file for the %LiveboxProviderInfo class.
+ *
+ * This header file contains the declarations of the %LiveboxProviderInfo class.
+ */
+
+#ifndef _FSHELL_LIVEBOX_PROVIDER_INFO_H_
+#define _FSHELL_LIVEBOX_PROVIDER_INFO_H_
+
+#include <FBaseString.h>
+#include <FAppTypes.h>
+
+namespace Tizen { namespace Base { namespace Collection { class IList; } } }
+
+namespace Tizen { namespace Shell
+{
+
+/**
+ * @class LiveboxProviderInfo
+ * @brief This class contains static Livebox information
+ *
+ * @since 2.1
+ *
+ * The %LiveboxProviderInfo class contains static Livebox information@n
+ */
+class _OSP_EXPORT_ LiveboxProviderInfo
+ : public Tizen::Base::Object
+{
+public:
+ /**
+ * Copying of objects using this copy constructor is allowed.
+ *
+ * @since 2.1
+ *
+ * @param[in] value An instance of %LiveboxProviderInfo
+ */
+ LiveboxProviderInfo(const LiveboxProviderInfo& rhs);
+
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.1
+ */
+ virtual ~LiveboxProviderInfo(void);
+
+ /**
+ * Gets the application ID.
+ *
+ * @since 2.1
+ *
+ * @return The application ID
+ */
+ Tizen::App::AppId GetAppId(void) const;
+
+ /**
+ * Gets the Livebox provider name
+ *
+ * @since 2.1
+ *
+ * @return The application ID
+ */
+ Tizen::Base::String GetName(void) const;
+
+ /**
+ * Gets the display name of the Livbox @n
+ * If the system language setting is changed, this method returns the localized application name.
+ * The display name is displayed in applications that showing Livebox like Launcher, and so on.
+ *
+ * @since 2.1
+ *
+ * @return The display name of the Livbox
+ */
+ Tizen::Base::String GetDisplayName(void) const;
+
+ /**
+ * Gets the icon path of the application.
+ *
+ * @since 2.1
+ *
+ * @return The icon path of the application, @n
+ * An empty string is returned if there is no value.
+ */
+ Tizen::Base::String GetIconPath(void) const;
+
+ /**
+ * Gets the Id of the application that exports AppContorl to configure the Livebox
+ *
+ * @since 2.1
+ *
+ * @return The Id of the application that exports AppContorl to configure the Livebox @n
+ * An empty string is returned if there is no value.
+ *
+ * The following example demonstrates how to start the application control that is exported for Livebox configuration
+ *
+ * @code
+ * #include <FShell.h>
+ *
+ * using namespace Tizen::Shell;
+ *
+ * LiveboxProviderInfo* pProviderInfo = LiveboxManager::GetInstance()->GetLiveboxProviderInfoN(appId, providerName);
+ * if( !pProviderInfo->GetConfigurationAppControlAppId().IsEmpty )
+ * {
+ * AppControl* pAc = AppManager::FindAppControlN(pProviderInfo->GetConfigurationAppControlAppId(), L"http://tizen.org/appcontrol/operation/livebox/configuration");
+ *
+ * HashMap map();
+ * map.Construct();
+ * String key = L"ProviderName";
+ * String value = pProviderInfo->GetName();
+ * map.Add(&key, &value );
+ *
+ * pAc->Start(null, null, &map, null);
+ * delete pAc;
+ * }
+ * delete pProviderInfo;
+ * @endcode
+ */
+ Tizen::Base::String GetConfigurationAppControlAppId(void) const;
+
+ /**
+ * Checks whether the Livebox provider is default or not.
+ *
+ * @since 2.1
+ *
+ * @return @c true if the Livebox is default @n
+ * else @c false
+ *
+ * @remarks Default Livebox provider providing Livebox that represents application.@n
+ * Home application can show Livebox instead of icon and text for applications that includes default Livebox provider.
+ */
+ bool IsDefault(void) const;
+
+ /**
+ * Gets a list of LiveboxSizeInfo of the Livebox
+ *
+ * @since 2.1
+ *
+ * @return A pointer to the array list that contains all LiveboxSizeInfo of the LiveboxProvider@n
+ * else @c null if an error occurs
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ Tizen::Base::Collection::IList* GetSizeInfoListN(void) const;
+
+private:
+
+ //
+ // This is the constructor that initializes an instance of %LiveboxProviderInfo with the specified values.
+ // This constructor is intentionally declared as private so that only the platform can create an instance.
+ //
+ // @since 2.1
+ //
+ // @param[in] appId The Id of the application that provides Livebox
+ // @param[in] name The name of the Livebox provider
+ //
+ LiveboxProviderInfo(const Tizen::App::AppId& appId, const Tizen::Base::String& name);
+
+ //
+ // This default constructor is intentionally declared as private so that only the platform can create an instance.
+ //
+ // @since 2.1
+ //
+ LiveboxProviderInfo(void);
+
+ //
+ // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @since 2.1
+ //
+ //
+ LiveboxProviderInfo& operator =(const LiveboxProviderInfo& rhs);
+
+private:
+ class _LiveboxProviderInfoImpl* __pLiveboxProviderInfoImpl;
+
+friend class _LiveboxProviderInfoImpl;
+};
+
+}} // Tizen::Shell
+#endif /* _FSHELL_LIVEBOX_PROVIDER_INFO_H_ */
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShellLiveboxProviderManager.h
+ * @brief This is the header file for the %LiveboxProviderManager class.
+ *
+ * This header file contains the declarations of the %LiveboxProviderManager class.
+ */
+
+#ifndef _FSHELL_LIVEBOX_PROVIDER_MANAGER_H_
+#define _FSHELL_LIVEBOX_PROVIDER_MANAGER_H_
+
+#include <unique_ptr.h>
+#include <FBaseString.h>
+#include <FAppTypes.h>
+
+namespace Tizen { namespace Base { namespace Collection { class IList; } } }
+namespace Tizen { namespace Shell
+{
+
+class ILiveboxProviderFactory;
+class ILiveboxPopupProviderFactory;
+
+/**
+ * @class LiveboxProviderManager
+ * @brief Manages all the Livebox providers.
+ *
+ * @since 2.1
+ *
+ * @final This class is not intended for extension.
+ *
+ * The %LiveboxProviderManager class manages all the Livebox providers.
+ * The livebox manager manages static and run time Livebox information.
+ */
+class _OSP_EXPORT_ LiveboxProviderManager
+ : public Tizen::Base::Object
+{
+public:
+
+ /**
+ * Gets the Livebox manager instance.
+ *
+ * @since 2.1
+ *
+ * @return A pointer to the %LiveboxProviderManager instance, @n
+ * else @c null if it fails
+ */
+ static LiveboxProviderManager* GetInstance(void);
+
+ /**
+ * Requests Livebox service to trigger specified Livebox update
+ *
+ * @since 2.1
+ *
+ * @param[in] appId The appId that provides Livebox
+ * @param[in] providerName The name of the Livebox provider
+ * @param[in] userInfo User information for the Livebox provider@n
+ * This parameter will be delivered as parameter of LiveboxProvider::OnLiveboxProviderUpdating()
+ *
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_APP_NOT_INSTALLED The application is not installed.
+ * @exception E_OBJ_NOT_FOUND The specified Livebox provider is not found.
+ * @exception E_CERTIFICATE_VERIFICATION_FAILED The application isn't permitted to request to update Livebox of other application package.@n
+ * To get permission, the target application is signed with the same certificate.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ *
+ * @see LiveboxProvider::OnLiveboxProviderUpdating()
+ */
+ result RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& userInfo = L"");
+
+ /**
+ * Requests a Livebox viewer(eg, Home screen, Lock screen) to add the specified Livebox.
+ *
+ * @since 2.1
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/liveboxmanager
+ *
+ * @param[in] providerAppId The ID of the application providing Livebox
+ * @param[in] providerName The name of Livebox provider to be added
+ * @param[in] alternateText Alternate text displayed in the LiveboxView while the LiveboxProvider is initializing or unavailable.
+ * @param[in] userInfo User information for the Livebox provider
+ *
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_APP_NOT_INSTALLED The application is not installed.
+ * @exception E_OBJ_NOT_FOUND The specified Livebox provider is not found.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_CERTIFICATE_VERIFICATION_FAILED The application isn't permitted to request add Livebox of other application package.
+ * To get permission, the target application is signed with the same certificate.
+ * @exception E_UNSUPPORTED_OPERATION The specified Livebox provider doesn't support this operation.@
+ * To request a Livebox viewer to add a Livebox, Livebox provider should support 1x1 size Livebox, but the specified Livebox provider doesn't support 1x1 size.
+ * @exception E_CONNECTION_FAILED The viewer application doesn't set a listener to receive this request.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ *
+ * @remarks Only Livebox provider that is packaged with the caller application can be added by this API.
+ * @see SetLiveboxAddRequestListener
+ */
+ result AddLivebox(const Tizen::App::AppId& providerAppId, const Tizen::Base::String& providerName, const Tizen::Base::String& alternateText, const Tizen::Base::String& userInfo);
+
+ /**
+ * Sets a LiveboxProvider factory. @n
+ * The factory is called when LiveboxProvider is need to be created.
+ * This function should be called in App::OnAppInitializing(), to receive event correctly.
+ * Implementing LiveboxProviderFactory is mandatory to provide Livebox functionality.
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @param[in] factory The factory to create concrete LiveboxProvider
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_OPERATION The application's attribute doesn't meet conditon to provide Livebox.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ * @see ILiveboxProviderFactory
+ */
+ result SetLiveboxProviderFactory(ILiveboxProviderFactory& factory);
+
+ /**
+ * Sets a LiveboxPopupProvider factory. @n
+ * The factory is called when LiveboxPopupProvider is need to be created.
+ * This function should be called in App::OnAppInitializing(), to receive event correctly.
+ * Implementing LiveboxPopupProviderFactory is mandatory to provide LiveboxPopup functionality.
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @param[in] factory The factory to create concrete LiveboxPopupProvider
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_OPERATION The application's attribute doesn't meet conditon to provide Livebox popup.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ * @see ILiveboxPopupProviderFactory
+ */
+ result SetLiveboxPopupProviderFactory(ILiveboxPopupProviderFactory& factory);
+
+
+private:
+ //
+ // This default constructor is intentionally declared as private to implement the %Singleton semantic.
+ //
+ // @since 2.1
+ //
+ LiveboxProviderManager(void);
+
+ //
+ // This destructor is intentionally declared as private to implement the %Singleton semantic.
+ //
+ // @since 2.1
+ //
+ virtual ~LiveboxProviderManager(void);
+
+ /**
+ * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ *
+ * @since 2.1
+ */
+ LiveboxProviderManager& operator =(const LiveboxProviderManager& rhs);
+
+ //
+ // Constructs the instance of this class.
+ //
+ // @since 2.1
+ //
+ // @return An error code
+ // @exception E_SUCCESS The method is successful.
+ // @exception E_SYSTEM A system error has occurred.
+ //
+ result Construct(void);
+
+
+ static void InitSingleton(void);
+ static void DestroySingleton(void);
+
+private:
+ static LiveboxProviderManager* __pTheInstance;
+ class _LiveboxProviderManagerImpl* __pLiveboxProviderManagerImpl;
+ friend struct std::default_delete< LiveboxProviderManager >;
+}; // LiveboxProviderManager
+
+}} // Tizen::Shell
+
+#endif /* _FSHELL_LIVEBOX_PROVIDER_MANAGER_H_ */
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShellLiveboxProviderInfo.h
+ * @brief This is the header file for the %LiveboxSizeInfo class.
+ *
+ * This header file contains the declarations of the %LiveboxSizeInfo class.
+ */
+
+#ifndef _FSHELL_LIVEBOX_SIZE_INFO_H_
+#define _FSHELL_LIVEBOX_SIZE_INFO_H_
+
+#include <FBaseString.h>
+#include <FAppTypes.h>
+#include <FGrpFloatDimension.h>
+
+namespace Tizen { namespace Shell
+{
+
+class _LiveboxSizeInfoImpl;
+
+/**
+ * @class LiveboxSizeInfo
+ * @brief This class contains size and preview image path for the size
+ *
+ * @since 2.1
+ */
+class _OSP_EXPORT_ LiveboxSizeInfo
+ : public Tizen::Base::Object
+{
+public:
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.1
+ */
+ virtual ~LiveboxSizeInfo(void);
+
+ /**
+ * Copying of objects using this copy constructor is allowed.
+ *
+ * @since 2.1
+ *
+ * @param[in] rhs An instance of %LiveboxSizeInfo
+ */
+ LiveboxSizeInfo(const LiveboxSizeInfo& rhs);
+
+ /**
+ * Gets the size
+ *
+ * @since 2.1
+ *
+ * @return A size
+ */
+ Tizen::Graphics::FloatDimension GetSize(void) const;
+
+ /**
+ * Gets the image path for preview
+ *
+ * @since 2.1
+ *
+ * @return The image path for preview
+ */
+ Tizen::Base::String GetPreviewImagePath(void) const;
+
+private:
+ //
+ // This is the constructor that initializes an instance of %LiveboxSizeInfo with the specified values.
+ // This constructor is intentionally declared as private so that only the platform can create an instance.
+ //
+ // @since 2.1
+ //
+ // @param[in] size One of the size that the Livebox provider supports.
+ // @param[in] previewImagePath The preview image path for the size.
+ //
+ LiveboxSizeInfo(Tizen::Graphics::FloatDimension size, const Tizen::Base::String& previewImagePath);
+
+ //
+ // This default constructor is intentionally declared as private so that only the platform can create an instance.
+ //
+ // @since 2.1
+ //
+ LiveboxSizeInfo(void);
+
+ //
+ // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @since 2.1
+ //
+ LiveboxSizeInfo& operator =(const LiveboxSizeInfo& rhs);
+
+private:
+ _LiveboxSizeInfoImpl* __pLiveboxSizeInfoImpl;
+
+friend class _LiveboxSizeInfoImpl;
+};
+
+
+}} // Tizen::Shell
+#endif /* _FSHELL_LIVEBOX_SIZE_INFO_H_ */
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShellLiveboxView.h
+ * @brief This is the header file for the %LiveboxView class.
+ *
+ * This header file contains the declarations of the %LiveboxView class.
+ */
+
+#ifndef _FSHELL_LIVEBOX_VIEW_H_
+#define _FSHELL_LIVEBOX_VIEW_H_
+
+#include <FAppTypes.h>
+#include <FUiContainer.h>
+
+namespace Tizen { namespace Base
+{
+class String;
+}} // Tizen::Base
+
+namespace Tizen { namespace Shell
+{
+
+/**
+ * @class LiveboxView
+ * @brief This class provides the view control for a LiveboxViewer.
+ * @since 2.1
+ *
+ * The %LiveboxView shows a drawn buffer by LiveboxProvider.
+ *
+ */
+class _OSP_EXPORT_ LiveboxView
+ : public Tizen::Ui::Container
+{
+public:
+ /**
+ * The object is not fully constructed after this constructor is called.
+ * For full construction, the Construct() method must be called after calling this constructor.
+ *
+ * @since 2.1
+ */
+ LiveboxView(void);
+
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.1
+ */
+ virtual ~LiveboxView(void);
+
+ /**
+ * Initializes this instance of %LiveboxView with the specified parameter.
+ *
+ * @since 2.1
+ * @return An error code
+ * @param[in] appId The AppId of the installed application
+ * @param[in] providerName The name of the Livebox provider
+ * @param[in] rect An instance of the FloatRectangle class @n\r
+ * This instance represents the x and y coordinates of the top-left corner @n\r
+ * of the created window along with its width and height. @n\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_ARG A specified input parameter is invalid.\r
+ * @exception E_APP_NOT_INSTALLED The application is not installed.\r
+ * @exception E_OBJ_NOT_FOUND The specified Livebox provider is not found.\r
+ */\r
+ result Construct(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Graphics::FloatRectangle& rect);
+
+ /**\r
+ * Initializes this instance of %LiveboxView with the specified parameter.\r
+ *\r
+ * @since 2.1\r
+ * @return An error code\r
+ * @param[in] appId The AppId of the installed application\r
+ * @param[in] providerName The name of the Livebox provider\r
+ * @param[in] rect An instance of the FloatRectangle class @n\r
+ * This instance represents the x and y coordinates of the top-left corner @n\r
+ * of the created window along with its width and height. @n\r
+ * @param[in] userInfo Extra data to be delivered to Livebox provider\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_ARG A specified input parameter is invalid.\r
+ * @exception E_APP_NOT_INSTALLED The application is not installed.\r
+ * @exception E_OBJ_NOT_FOUND The specified Livebox provider is not found.\r
+ */\r
+ result Construct(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Graphics::FloatRectangle& rect, const Tizen::Base::String& userInfo);
+
+protected:
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related,
+ // and consistency-related issues in the application.
+ //
+ // Following method is reserved and may change its name at any time without prior notice.
+ //
+ virtual void LiveboxView_Reserved1(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related,
+ // and consistency-related issues in the application.
+ //
+ // Following method is reserved and may change its name at any time without prior notice.
+ //
+ virtual void LiveboxView_Reserved2(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related,
+ // and consistency-related issues in the application.
+ //
+ // Following method is reserved and may change its name at any time without prior notice.
+ //
+ virtual void LiveboxView_Reserved3(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related,
+ // and consistency-related issues in the application.
+ //
+ // Following method is reserved and may change its name at any time without prior notice.
+ //
+ virtual void LiveboxView_Reserved4(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related,
+ // and consistency-related issues in the application.
+ //
+ // Following method is reserved and may change its name at any time without prior notice.
+ //
+ virtual void LiveboxView_Reserved5(void) {}
+
+private:
+ //
+ // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ LiveboxView(const LiveboxView& rhs);
+
+ //
+ // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ LiveboxView& operator =(const LiveboxView& rhs);
+}; // LiveboxView
+
+}} // Tizen::Shell
+
+#endif // _FSHELL_LIVEBOX_VIEW_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2013 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.
+//
+
+/**
+ * @file FShellLockManager.h
+ * @brief This is the header file for the LockManager class.
+ *
+ * This header file contains the declarations of the %LockManager class.
+ */
+
+#ifndef _FSHELL_LOCK_MANAGER_H_
+#define _FSHELL_LOCK_MANAGER_H_
+
+#include <unique_ptr.h>
+#include <FBaseObject.h>
+
+namespace Tizen { namespace Shell {
+
+/**
+ * @class LockManager
+ * @brief Manages state of lock screen.
+ *
+ * @since 2.1
+ *
+ * @final This class is not intended for extension.
+ *
+ * The %LockManager class manages information of lock screen.
+ */
+class _OSP_EXPORT_ LockManager
+ : public Tizen::Base::Object
+{
+public:
+ /**
+ * Gets the %LockManager instance.
+ *
+ * @since 2.1
+ *
+ * @return A pointer to the %LockManager instance, @n
+ * else @c null if it fails
+ *
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_MEMORY The memory is insufficient.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ static LockManager* GetInstance(void);
+
+ /**
+ * Checks whether the screen is locked.
+ *
+ * @since 2.1
+ *
+ * @return @c true if the screen is locked,
+ * else @c false
+ */
+ bool IsLocked(void) const;
+
+ /**
+ * Checks whether password lock screen is enabled by Settings.
+ *
+ * @since 2.1
+ *
+ * @return @c true if password lock screen is enabled,
+ * else @c false
+ */
+ bool IsSecureMode(void) const;
+
+ /**
+ * Unlocks current lock screen.
+
+ * @privlevel partner
+ * @privilege http://tizen.org/privilege/lockmanager
+ *
+ * @since 2.1
+ *
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_INVALID_OPERATION Can't unlock, because secure mode is enabled.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ *
+ * @remarks This API call has no effect while secure mode is enabled.
+ */
+ result Unlock(void);
+
+private:
+ //
+ // This default constructor is intentionally declared as private to implement the %Singleton semantic.
+ //
+ // @since 2.1
+ //
+ LockManager(void);
+
+ //
+ // This destructor is intentionally declared as private to implement the %Singleton semantic.
+ //
+ // @since 2.1
+ //
+ virtual ~LockManager(void);
+
+ //
+ // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @since 2.1
+ //
+ LockManager(const LockManager& rhs);
+
+ //
+ // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @since 2.1
+ //
+ LockManager& operator =(const LockManager& rhs);
+
+ //
+ // Constructs the instance of this class.
+ //
+ // @since 2.1
+ //
+ // @return An error code
+ // @exception E_SUCCESS The method is successful.
+ // @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ //
+ result Construct(void);
+
+ static void InitSingleton(void);\r
+ static void DestroySingleton(void);
+
+private:
+
+ static LockManager* __pTheInstance;\r
+ friend struct std::default_delete< LockManager >;
+ class _LockManagerImpl* __pLockManagerImpl;
+};
+
+}} // Tizen::Shell
+#endif /* _FSHELL_LOCK_MANAGER_H_ */
#include <FBase.h>
#include <FAppTypes.h>
+namespace Tizen { namespace Base
+{
+namespace Collection
+{
+class IMap;
+}
+} }
+
namespace Tizen { namespace Shell
{
class NotificationRequest;
+class IBadgeEventListener;
/**
* The maximum length of a notification message.
*/
enum OngoingActivityType
{
- ONGOING_ACTIVITY_TYPE_TEXT = 1, /**< The progress is indicated with a text */
- ONGOING_ACTIVITY_TYPE_PROGRESS_BYTE, /**< The progress is indicated with the number of bytes */
+ ONGOING_ACTIVITY_TYPE_TEXT = 1, /**< The progress is indicated with a text */
+ ONGOING_ACTIVITY_TYPE_PROGRESS_BYTE, /**< The progress is indicated with the number of bytes */
ONGOING_ACTIVITY_TYPE_PROGRESS_PERCENTAGE /**< The progress is indicated with percentage */
};
+/**
+ * @enum NotificationStyle
+ *
+ * Defines the notification style.
+ *
+ * @since 2.1
+ */
+enum NotificationStyle
+{
+ NOTIFICATION_STYLE_NORMAL = 1, /**< The notification is normal style */
+ NOTIFICATION_STYLE_THUMBNAIL /**< The notification is thumbnail style */
+};
+
/**
* @class NotificationManager
/**
* This is the default constructor for this class.
*
- * @since 2.0
+ * @since 2.0
*/
NotificationManager(void);
/**
* This destructor overrides Tizen::Base::Object::~Object().
*
- * @since 2.0
+ * @since 2.0
*/
virtual ~NotificationManager(void);
/**
* Initializes this instance of %NotificationManager.
*
- * @since 2.0
+ * @since 2.0
*
- * @return An error code
+ * @return An error code
* @exception E_SUCCESS The method is successful.
*/
result Construct(void);
/**
* Gets the current badge number of an application icon.
*
- * @since 2.0
- * @privilege %http://tizen.org/privilege/notification
+ * @since 2.0
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/notification
*
* @return The current badge number if the method is successful, @n
else @c -1 if the method fails
* @exception E_SUCCESS The method is successful.
* @exception E_OPERATION_FAILED The operation has failed.
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
- * @remarks The specific error code can be accessed using the GetLastResult() method.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
*
*/
int GetBadgeNumber(void);
/**
* Notifies the user who has @c badgeNumber as a badge number.
*
- * @since 2.0
- * @privilege %http://tizen.org/privilege/notification
+ * @since 2.0
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/notification
*
* @return An error code
* @param[in] badgeNumber The badge number
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_ARG The specified input parameter is invalid, or
- * the specified @c badgeNumber is less than @c 0.
+ * the specified @c badgeNumber is less than @c 0.
* @exception E_OPERATION_FAILED The operation has failed.
* @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
*/
/**
* Notifies the user with a message.
*
- * @since 2.0
- * @privilege %http://tizen.org/privilege/notification
+ * @since 2.0
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/notification
*
* @return An error code
* @param[in] messageText The notification message
* @exception E_INVALID_ARG The specified input parameter is invalid, or
* the length of @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH.
* @exception E_OPERATION_FAILED The operation has failed.
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
*/
result Notify(const Tizen::Base::String& messageText);
/**
* Notifies the user who has @c badgeNumber as badge number with a message.
*
- * @since 2.0
- * @privilege %http://tizen.org/privilege/notification
+ * @since 2.0
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/notification
*
* @return An error code
* @param[in] messageText The notification message
* @exception E_INVALID_ARG The specified @c badgeNumber is less than @c 0, or
* the length of @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH.
* @exception E_OPERATION_FAILED The operation has failed.
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
*/
result Notify(const Tizen::Base::String& messageText, int badgeNumber);
/**
* Notifies the user who has @c badgeNumber as badge number with a message. @n
* If the user selects this message, @c launchArguments is delivered to the application. @n
- * @c launchArguments is delivered as the value of the %http://tizen.org/appcontrol/data/notification key
+ * @c launchArguments is delivered as the value of the http://tizen.org/appcontrol/data/notification key
* for IAppControlProviderEventListener::OnAppControlRequestReceived().
*
- * @since 2.0
- * @privilege %http://tizen.org/privilege/notification
+ * @since 2.0
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/notification
*
* @return An error code
* @param[in] messageText The notification message
* - The length of the specified @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
* - The length of the specified @c launchArguments is greater than Shell::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
* @exception E_OPERATION_FAILED The operation has failed.
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
*/
result Notify(const Tizen::Base::String& messageText, int badgeNumber, const Tizen::Base::String& launchArguments);
* Notifies the user with a request message. @n
* The notification request may have various pieces of information such as alert text, title text, launch arguments, and so on.
*
- * @since 2.0
- * @privilege %http://tizen.org/privilege/notification
+ * @since 2.0
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/notification
*
* @return An error code
- * @param[in] request The notification request
- * @exception E_SUCCESS The method is successful.
+ * @param[in] request The notification request
+ * @exception E_SUCCESS The method is successful.
* @exception E_INVALID_ARG Either of the following conditions has occurred: @n
- * - The specified @c request does not have valid badge number value. @n
- * - The specified @c request does not have alert text. @n
- * - The specified @c request has invalid icon file path.
+ * - The specified @c request does not have valid badge number value in @c request. @n
+ * - The specified @c request does not have alert text in @c request. @n
+ * - The specified @c request has invalid icon file path in @c request.
* @exception E_OPERATION_FAILED The operation has failed.
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
*/
result Notify(const NotificationRequest& request);
/**
- * @if VISPARTNER
* The user who is identified with the @c appId is notified with a request message. @n
* The request may have various pieces of information such as alert text, title text, launch arguments, and so on.
*
- * @since 2.0
+ * @since 2.0
*
- * @visibility partner
- * @privilege %http://tizen.org/privilege/notificationmanager
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/notification
*
* @return An error code
* @param[in] appId The application ID
- * @param[in] request The notification request
- * @exception E_SUCCESS The method is successful.
+ * @param[in] request The notification request
+ * @exception E_SUCCESS The method is successful.
* @exception E_APP_NOT_INSTALLED The application is not installed.
* @exception E_INVALID_ARG Either of the following conditions has occurred: @n
- * - The specified @c request does not have valid badge number value. @n
- * - The specified @c request does not have alert text. @n
- * - The specified @c request has invalid icon file path.
+ * - The specified @c request does not have valid badge number value in @c request. @n
+ * - The specified @c request does not have alert text in @c request. @n
+ * - The specified @c request has invalid icon file path in @c request.
* @exception E_OPERATION_FAILED The operation has failed.
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
- * @endif
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
*/
result NotifyByAppId(const Tizen::App::AppId& appId, const NotificationRequest& request);
/**
* Removes the notification message.
*
- * @since 2.0
- * @privilege %http://tizen.org/privilege/notification
+ * @since 2.0
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/notification
*
* @return An error code
- * @exception E_SUCCESS The method is successful.
+ * @exception E_SUCCESS The method is successful.
* @exception E_OPERATION_FAILED The operation has failed.
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
- * @remarks This method returns @c E_SUCCESS when there is no outstanding notification.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @remarks This method returns @c E_SUCCESS when there is no outstanding notification.
*/
result RemoveNotification(void);
/**
- * @if VISPARTNER
* Removes the notification message on behalf of the specified application.
*
- * @since 2.0
+ * @since 2.0
*
- * @visibility partner
- * @privilege %http://tizen.org/privilege/notificationmanager
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/notification
*
* @return An error code
* @param[in] appId The application ID
* @exception E_SUCCESS The method is successful.
* @exception E_APP_NOT_INSTALLED The application is not installed.
* @exception E_OPERATION_FAILED The operation has failed.
- * @exception E_PRIVILEGE_DENIED The application did not have the privilege to call this method.
+ * @exception E_PRIVILEGE_DENIED The application did not have the privilege to call this method.
* @remarks Although there is no outstanding notification for the calling application, this method returns @c E_SUCCESS.
- * @endif
*/
result RemoveNotificationByAppId(const Tizen::App::AppId& appId);
/**
* Notifies the user about the ongoing activity using a message.
*
- * @since 2.0
- * @privilege %http://tizen.org/privilege/notification
+ * @since 2.0
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/notification
*
* @return An error code
* @param[in] messageText The notification message
* @exception E_INVALID_ARG The specified input parameter is invalid, or
* the length of @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH.
* @exception E_OPERATION_FAILED The operation has failed.
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
*/
result NotifyOngoingActivity(const Tizen::Base::String& messageText);
/**
* Notifies the user about the ongoing activity using a message. @n
* If the user selects the message, @c launchArguments is delivered to the application. @n
- * @c launchArguments is delivered as the value of the %http://tizen.org/appcontrol/data/notification key
+ * @c launchArguments is delivered as the value of the http://tizen.org/appcontrol/data/notification key
* for IAppControlProviderEventListener::OnAppControlRequestReceived().
*
- * @since 2.0
- * @privilege %http://tizen.org/privilege/notification
+ * @since 2.0
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/notification
*
* @return An error code
* @param[in] messageText The notification message
- * @param[in] launchArguments The launch arguments for the application
+ * @param[in] launchArguments The launch arguments for the application
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_ARG Either of the following conditions has occurred: @n
* - A specified input parameter is invalid. @n
* - The length of the specified @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
* - The length of the specified @c launchArguments is greater than Shell::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
* @exception E_OPERATION_FAILED The operation has failed.
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
*/
result NotifyOngoingActivity(const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments);
* Notifies the user about the ongoing activity using a request message. @n
* The request may have various pieces of information such as alert text, title text, launch arguments, and so on.
*
- * @since 2.0
- * @privilege %http://tizen.org/privilege/notification
+ * @since 2.0
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/notification
*
* @return An error code
- * @param[in] request The notification request
+ * @param[in] request The notification request
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_ARG Either of the following conditions has occurred: @n
- * - The specified @c request does not have either alert text or progress value. @n
- * - The specified @c request has invalid icon file path.
+ * - The specified @c request does not have either alert text or progress value in @c request. @n
+ * - The specified @c request has invalid icon file path in @c request.
* @exception E_OPERATION_FAILED The operation has failed.
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
*/
result NotifyOngoingActivity(const NotificationRequest& request);
/**
- * @if VISPARTNER
* Notifies the user about the ongoing activity using a request message. @n
* The request may have various information like alert text, title text, launch arguments, and so on.
*
- * @since 2.0
+ * @since 2.0
*
- * @visibility partner
- * @privilege %http://tizen.org/privilege/notificationmanager
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/notification
*
* @return An error code
* @param[in] appId The application ID
- * @param[in] request The notification request
+ * @param[in] request The notification request
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_ARG Either of the following conditions has occurred: @n
- * - The specified @c request does not have either alert text or progress value. @n
- * - The specified @c request has invalid icon file path.
+ * - The specified @c request does not have either alert text or progress value in @c request. @n
+ * - The specified @c request has invalid icon file path in @c request.
* @exception E_APP_NOT_INSTALLED The application is not installed.
* @exception E_OPERATION_FAILED The operation has failed.
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
- * @endif
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
*/
result NotifyOngoingActivityByAppId(const Tizen::App::AppId& appId, const NotificationRequest& request);
/**
* Removes the notification message for the ongoing activity.
*
- * @since 2.0
- * @privilege %http://tizen.org/privilege/notification
+ * @since 2.0
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/notification
*
* @return An error code
* @exception E_SUCCESS The method is successful.
* @exception E_OPERATION_FAILED The operation has failed.
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
- * @remarks This method returns @c E_SUCCESS when there is no outstanding notification.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @remarks This method returns @c E_SUCCESS when there is no outstanding notification.
*/
result RemoveOngoingActivityNotification(void);
/**
- * @if VISPARTNER
* Removes the notification message for ongoing activity on behalf of the specified application.
*
- * @since 2.0
+ * @since 2.0
*
- * @visibility partner
- * @privilege %http://tizen.org/privilege/notificationmanager
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/notification
*
* @return An error code
* @param[in] appId The application ID
* @exception E_SUCCESS The method is successful.
* @exception E_APP_NOT_INSTALLED The application is not installed.
* @exception E_OPERATION_FAILED The operation has failed.
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
* @remarks Although there is no outstanding notification for the calling application, this method returns @c E_SUCCESS.
- * @endif
*/
result RemoveOngoingActivityNotificationByAppId(const Tizen::App::AppId& appId);
/**
* Gets the badge number of the application icon mentioned in the @c appId.
*
- * @since 2.0
- * @privilege %http://tizen.org/privilege/notification
+ * @since 2.0
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/notification
*
* @return The current badge number if the method is successful, @n
else @c -1 if the method fails
* @param[in] appId The application ID
* @exception E_SUCCESS The method is successful.
* @exception E_OPERATION_FAILED The operation has failed.
- * @exception E_APP_NOT_INSTALLED The application is not installed.
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_APP_NOT_INSTALLED The application is not installed.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
* @remarks The specific error code can be accessed using the GetLastResult() method. @n
*
*/
int GetBadgeNumberByAppId(const Tizen::App::AppId& appId);
+ /**
+ * Notifies the user with a message. It will disappear in a few seconds.
+ *
+ * @since 2.1
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/notification
+ *
+ * @return An error code
+ * @param[in] messageText The notification message
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified input parameter is invalid.
+ * @exception E_OPERATION_FAILED The operation has failed.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @remarks Message is displayed in the status bar.
+ */
+ result NotifyTextMessage(const Tizen::Base::String& messageText);
+
+ /**
+ * Notifies the user using a request message and try implicit AppControl resolution when the user selects the message on the notification area. @n
+ * The request may have various information like alert text, title text, launch arguments, and so on.
+ *
+ * @since 2.1
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/notification
+ *
+ * @return An error code
+ * @param[in] operationId The operation ID
+ * @param[in] pUriData A pointer to the URI data
+ * @param[in] pDataType A pointer to the MIME type (RFC 2046) data
+ * @param[in] pExtraData A pointer to an argument map of key and value pair where the key is of type Tizen::Base::String and the value is of type Tizen::Base::String to deliver to the resolved application @n
+ * The maximum size is 16 kilo bytes.
+ * @param[in] request The notification request
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
+ * - The specified @c request does not have valid badge number value in @c request. @n
+ * - The specified @c request does not have alert text in @c request. @n
+ * - The specified @c request has invalid icon file path in @c request.
+ * @exception E_OPERATION_FAILED The operation has failed.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @remarks For more information on the implicit AppControl resolution, see <a href="../org.tizen.native.appprogramming/html/guide/app/resolving_appcontrols.htm">Resolving AppControls</a>.
+ *
+ */
+ result NotifyByAppControl(const Tizen::Base::String& operationId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pDataType,
+ const Tizen::Base::Collection::IMap* pExtraData, const NotificationRequest& request);
+
+ /**
+ * Notifies the user about the ongoing activity using a request message and try implicit AppControl resolution when the user selects the message on the notification area. @n
+ * The request may have various information like alert text, title text, launch arguments, and so on.
+ *
+ * @since 2.1
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/notification
+ *
+ * @return An error code
+ * @param[in] operationId The operation ID
+ * @param[in] pUriData A pointer to the URI data
+ * @param[in] pDataType A pointer to the MIME type (RFC 2046) data
+ * @param[in] pExtraData A pointer to an argument map of key and value pair where the key is of type Tizen::Base::String and the value is of type Tizen::Base::String to deliver to the resolved application @n
+ * The maximum size is 16 kilo bytes.
+ * @param[in] request The notification request
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
+ * - The specified @c request does not have either alert text or progress value in @c request. @n
+ * - The specified @c request has invalid icon file path in @c request.
+ * @exception E_OPERATION_FAILED The operation has failed.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @remarks For more information on the implicit AppControl resolution, see <a href="../org.tizen.native.appprogramming/html/guide/app/resolving_appcontrols.htm">Resolving AppControls</a>.
+ */
+ result NotifyOngoingActivityByAppControl(const Tizen::Base::String& operationId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pDataType,
+ const Tizen::Base::Collection::IMap* pExtraData, const NotificationRequest& request);
+
+ /**\r
+ * Adds an IBadgeEventListener event listener to the NotificationManager @n\r
+ * The listener gets notified when a badge number is updated. @n\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return An error code\r
+ * @param[in] listener The listener to be added.\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_OBJ_ALREADY_EXIST The listener is already added.\r
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.\r
+ *\r
+ * @see NotificationManager::Notify()\r
+ * @remarks Internally Platform does not have the ownership of this pointer, So caller should manage the listener object properly.\r
+ */\r
+ result AddBadgeEventListener(IBadgeEventListener& listener);\r
+\r
+ /**\r
+ * Removes an IBadgeEventListener event listener from the NotificationManager @n\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return An error code\r
+ * @param[in] listener The listener to be removed.\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_OBJ_NOT_FOUND The listner is not found.\r
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.\r
+ *\r
+ * @remarks Internally Platform does not have the ownership of this pointer, So caller should manage the listener object properly.\r
+ */\r
+ result RemoveBadgeEventListener(IBadgeEventListener& listener);
+
private:
/**
* The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
*/
result SetOngoingActivityProgress(int value);
+ /**
+ * Gets the style of a notification message.
+ *
+ * @since 2.1
+ *
+ * @return The notification style
+ */
+ NotificationStyle GetNotificationStyle(void) const;
+
+ /**
+ * Sets the style of a notification message.
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @param[in] style The notification style
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified @c style is not valid.
+ */
+ result SetNotificationStyle(NotificationStyle style);
+
+ /**
+ * Gets a list of message text for a notification message.
+ *
+ * @since 2.1
+ *
+ * @return A string list of detail information text
+ */
+ Tizen::Base::Collection::IList* GetMessageTextListN(void) const;
+
+ /**
+ * Sets a string list of message text for a notification message.
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @param[in] pTextList A list of detail information text
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified @c textList is empty or the length of individual text is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH.
+ * @remarks This information is only meaningful when the notification style is Shell::NOTIFICATION_STYLE_NORMAL. @n
+ * Use the tab(\\t) character to separate the columns.
+ *
+ */
+ result SetMessageTextList(const Tizen::Base::Collection::IList* pTextList);
+
+ /**
+ * Gets a list of the message thumbnail image absolute file path for a notification message.
+ *
+ * @since 2.1
+ *
+ * @return A string list of thumbnail image file path
+ */
+ Tizen::Base::Collection::IList* GetMessageThumbnailFilePathListN(void) const;
+
+ /**
+ * Sets a string list of the message thumbnail image absolute file path for a notification message.
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @param[in] pThumbnailPathList A list of the thumbnail image file path
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified path is invalid.
+ * @remarks This information is only meaningful when then notification style is Shell::NOTIFICATION_STYLE_THUMBNAIL.
+ */
+ result SetMessageThumbnailFilePathList(const Tizen::Base::Collection::IList* pThumbnailPathList);
+
+ /**
+ * Gets the notification count text of a notification message.
+ *
+ * @since 2.1
+ *
+ * @return The notification count text
+ */
+ Tizen::Base::String GetNotificationCountText(void) const;
+
+ /**
+ * Sets the notification count text of a notification message.
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @param[in] notificationCountText The event count text
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified @c eventCountText is empty or the length of @c eventCountText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH.
+ */
+ result SetNotificationCountText(const Tizen::Base::String& notificationCountText);
+
+ /**
+ * Gets the absolute file path of the background image for a notification message.
+ *
+ * @since 2.1
+ *
+ * @return The file path of a background image file
+ */
+ Tizen::Base::String GetBackgroundImageFilePath(void) const;
+
+ /**
+ * Sets the absolute file path of the background image for a notification message.
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @param[in] imagePath The file path of the background image
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified path is invalid.
+ */
+ result SetBackgroundImageFilePath(const Tizen::Base::String& imagePath);
+
+
private:
- class _NotificationRequestImpl * __pNotificationRequestImpl;
+ class _NotificationRequestImpl* __pNotificationRequestImpl;
friend class _NotificationRequestImpl;
}; // NotificationRequest
// http://floralicense.org/license/
//
// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
+// 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.
private:
static const int QUICK_PANEL_FRAME_HEIGHT = 102;
- Tizen::Shell QuickPanelFrame *__pQuickPanelFrame;
+ Tizen::Shell::QuickPanelFrame *__pQuickPanelFrame;
};
// Sample code for QuickPanelFrameSample.cpp
public:
/**
* The object is not fully constructed after this constructor is called.
- * Hence, the Construct() method must be called after calling this constructor.
+ * For full construction, the Construct() method must be called right after calling this constructor.
*
* @since 2.0
*/
*
* @since 2.0
*
+ * @privlevel public
* @privilege %http://tizen.org/privilege/notification
*
* @return An error code
*
* @since 2.0
*
+ * @privlevel public
* @privilege %http://tizen.org/privilege/notification
*
* @return An error code
*
* @since 2.0
*
+ * @privlevel public
* @privilege %http://tizen.org/privilege/notification
*
* @return An error code
*
* @since 2.0
*
+ * @privlevel public
* @privilege %http://tizen.org/privilege/notification
*
* @return An error code
*/
result Construct(const Tizen::Ui::Layout& portraitLayout, const Tizen::Ui::Layout& landscapeLayout, int height);
+ /*
+ * Initializes this instance of %QuickPanelFrame with the specified parameter.
+ *
+ * @since 2.1
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/notification
+ *
+ * @return An error code
+ * @param[in] height The height of %QuickPanelFrame
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_INVALID_ARG The @c height is less than or equal to @c 0.0f.
+ */
+ result Construct(float height);
+
+ /*
+ * Initializes this instance of %QuickPanelFrame with the specified parameters.
+ *
+ * @since 2.1
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/notification
+ *
+ * @return An error code
+ * @param[in] layout The layout for both the portrait and landscape mode
+ * @param[in] height The height of %QuickPanelFrame
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_INVALID_ARG The @c height is less than or equal to @c 0.0f.
+ */
+ result Construct(const Tizen::Ui::Layout& layout, float height);
+
+ /*
+ * Constructs and initializes an instance of %QuickPanelFrame with the specified parameters.
+ *
+ * @since 2.1
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/notification
+ *
+ * @return An error code
+ * @param[in] portraitLayout The layout for the portrait mode
+ * @param[in] landscapeLayout The layout for the landscape mode
+ * @param[in] height The height of %QuickPanelFrame
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_INVALID_ARG The @c height is less than or equal to @c 0.0f.
+ */
+ result Construct(const Tizen::Ui::Layout& portraitLayout, const Tizen::Ui::Layout& landscapeLayout, float height);
+
/**
* Adds an IOrientationEventListener instance. @n
* The added listener can listen to the orientation changed events that are fired when the orientation mode of the screen is changed.
*/
result SetHeight(int height);
+ /*
+ * Sets the height of the %QuickPanelFrame.
+ *
+ * @since 2.1
+ * @return An error code
+ * @param[in] height The height of %QuickPanelFrame
+ * @exception E_SUCCESS The method was successful.
+ * @exception E_INVALID_ARG The @c height is less than or equal to @c 0.0f.
+ */
+ result SetHeight(float height);
+
protected:
//
// This method is for internal use only. Using this method can cause behavioral, security-related,
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2013 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.
+//
+
+/**
+ * @file FShellShortcutManager.h
+ * @brief This is the header file for the %ShortcutManager class.
+ *
+ * This header file contains the declarations of the %ShortcutManager class.
+ */
+
+#ifndef _FSHELL_SHORTCUT_MANAGER_H_
+#define _FSHELL_SHORTCUT_MANAGER_H_
+
+#include <FBaseObject.h>
+#include <FBaseString.h>
+#include <FAppTypes.h>
+
+
+namespace Tizen { namespace Shell
+{
+
+class IShortcutRequestListener;
+
+/*
+ * @class ShortcutManager
+ * @brief Helps an application can add its shortcut to the Home app.
+ *
+ * @since 2.1
+ *
+ * @final This class is not intended for extension.
+ *
+ * The %ShortcutManager class helps an application can add its shortcut to the Home app.
+ */
+class _OSP_EXPORT_ ShortcutManager
+ : public Tizen::Base::Object
+{
+public:
+
+ /**
+ * Gets the %ShortcutManager instance.
+ *
+ * @since 2.1
+ *
+ * @return A pointer to the %ShortcutManager instance, @n
+ * else @c null if it fails
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_OUT_OF_MEMORY The memory is insufficient.\r
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.\r
+ * @remarks The specific error code can be accessed using the GetLastResult() method.\r
+ */
+ static ShortcutManager* GetInstance(void);
+
+ /**
+ * Request the Home app to add the spefied shortcut.
+ *
+ * @privlevel public
+ * @privilege http::tizen.org/privilege/shortcut
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @param[in] appId The application ID
+ * @param[in] displayName The display name of shortcut
+ * @param[in] iconPath The icon file path
+ * @param[in] uriData Uri that will be delivered by IAppControlProviderEventListener::OnAppControlRequestReceived(), when the application is started via shortcut.
+ * @param[in] allowDuplication Flag to allow duplicate shortcut.
+ *
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_APP_NOT_INSTALLED The application is not installed.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ *
+ * @remarks Icon file should be placed in sub directory of 'shared/res' to be used by the Home app.
+ * For more information on shared directory, see <a href="../org.tizen.native.appprogramming/html/basics_tizen_programming/io_overview.htm">I/O Overview</a>.
+ * For more information on icon file, see <a href="../org.tizen.native.appprogramming/html/app_dev_process/manifest_general.htm">General Information</a>.
+ *
+ * If uriData is specified, application will be started by AppControl with http://tizen.org/appcontrol/operation/view operation, when it's launched from the Home app via shortcut.
+ * Or else application will be started by AppControl with default operation(http://tizen.org/appcontrol/operation/main).
+ *
+ * @see IAppControlEventListener::OnAppControlRequestReceived()
+ * @see IShortcutRequestListener::OnShortcutAddRequested()
+ *
+ * The following example demonstrates how to add shortcut.
+ *
+ * @code
+ * #include <FApp.h>
+ * #include <FShell.h>
+ *
+ * using namespace Tizen::App;
+ * using namespace Tizen::Shell;
+ *
+ * String appId = App::GetInstance()->GetAppId();
+ * String iconPath = AppManager::GetInstance()->GetAppSharedPath(appId) + L"res/my_icons/my_icon.png";
+ * ShortcutManager::GetInstance()->AddShortcut(appId, L"MyApp", iconPath , L"myapp://mydata/myitem");
+ * @endcode
+ */
+ result AddShortcut(const Tizen::App::AppId& appId, const Tizen::Base::String& displayName, const Tizen::Base::String& iconPath, const Tizen::Base::String& uriData, bool allowDuplication = true );
+
+ /**
+ * Requests the Home app to remove the specified shortcut.
+ *
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/shortcut
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @param[in] appId The application ID
+ * @param[in] displayName The display name of shortcut
+ *
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_APP_NOT_INSTALLED The application is not installed.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ *
+ * @remarks If there are one more shortcuts with duplicated appId and displayName in the Home app, All of them will be removed.
+ *
+ * @see IShortcutRequestListener::OnShortcutRemoveRequested()
+ */
+ result RemoveShortcut(const Tizen::App::AppId& appId, const Tizen::Base::String& displayName);
+
+ /**
+ * Adds an IShortcutRequestListener to the %ShortcutManager. @n
+ * The listener gets notified when requested to add a shortcut.
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @param[in] listener The event listener
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_ALREADY_EXIST The listener is already added.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ */
+ result AddShortcutRequestListener(IShortcutRequestListener& listener);
+
+ /**
+ * Removes an IShortcutRequestListener from the %ShortcutManager. @n
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @param[in] listener The event listener
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_NOT_FOUND The listner is not found.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ */
+ result RemoveShortcutRequestListener(IShortcutRequestListener& listener);
+
+private:
+ //
+ // This default constructor is intentionally declared as private to implement the %Singleton semantic.
+ //
+ // @since 2.1
+ //
+ ShortcutManager(void);
+
+ //
+ // This destructor is intentionally declared as private to implement the %Singleton semantic.
+ //
+ // @since 2.1
+ //
+ virtual ~ShortcutManager(void);
+
+ //
+ // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @since 2.1
+ //
+ ShortcutManager& operator =(const ShortcutManager& rhs);
+
+ //
+ // Constructs the instance of this class.
+ //
+ // @since 2.1
+ //
+ // @return An error code
+ // @exception E_SUCCESS The method is successful.
+ // @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ //
+ result Construct(void);
+
+ static void InitSingleton(void);\r
+ static void DestroySingleton(void);
+
+private:
+ static ShortcutManager* __pTheInstance;\r
+ friend struct std::default_delete< ShortcutManager >;
+ class _ShortcutManagerImpl* __pShortcutManagerImpl;
+};
+
+}} // Tizen::Shell
+#endif /* _FSHELL_SHORTCUT_MANAGER_H_ */
Name: osp-shell
Summary: The Shell library of OSP
-Version: 1.2.0.0
-Release: 13
+Version: 1.2.1.0
+Release: 12
Group: TO_BE/FILLED_IN
License: Apache License, Version 2.0 or Flora
Source0: %{name}-%{version}.tar.gz
BuildRequires: pkgconfig(osp-uifw)
BuildRequires: pkgconfig(evas)
BuildRequires: pkgconfig(ecore)
+BuildRequires: pkgconfig(elementary)
BuildRequires: pkgconfig(notification)
BuildRequires: pkgconfig(appsvc)
BuildRequires: pkgconfig(pkgmgr)
BuildRequires: pkgconfig(minicontrol-provider)
+BuildRequires: pkgconfig(x11)
+BuildRequires: pkgconfig(xext)
+BuildRequires: pkgconfig(xfixes)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(provider)
+BuildRequires: pkgconfig(livebox-viewer)
+BuildRequires: pkgconfig(livebox-service)
+BuildRequires: pkgconfig(libdri2)
+BuildRequires: pkgconfig(libdrm)
+BuildRequires: pkgconfig(libdrm_slp)
+BuildRequires: pkgconfig(shortcut)
+BuildRequires: pkgconfig(osp-image-core)
+BuildRequires: pkgconfig(osp-media)
+BuildRequires: pkgconfig(osp-net)
+BuildRequires: pkgconfig(vconf)
+BuildRequires: osp-image-core-internal-devel
BuildRequires: osp-appfw-internal-devel
BuildRequires: osp-uifw-internal-devel
+BuildRequires: boost-devel
+BuildRequires: pkgconfig(badge)
+
# runtime requires
Requires: chromium
/usr/include/dlog
/usr/include/dbus-1.0
/usr/include/dri2
- #/usr/include/libdrm
+ /usr/include/libdrm
/usr/include/notification
/usr/lib/dbus-1.0/include
/usr/include/e_dbus-1
/usr/include/pixman-1
/usr/include/system
/usr/include/vconf
+ /usr/include/shortcut
+ /usr/include/provider
+ /usr/include/livebox-service
+ /usr/include/livebox-viewer
+ /usr/include/osp/media
)
SET (${this_target}_SOURCE_FILES
FShell_QuickPanelFrame.cpp
FShell_QuickPanelFrameImpl.cpp
FShell_QuickPanelFramePresenter.cpp
+ FShell_LiveboxProviderImpl.cpp
+ FShell_LiveboxPopupProviderImpl.cpp
+ FShell_LiveboxProviderInfoImpl.cpp
+ FShell_LiveboxSizeInfoImpl.cpp
+ FShell_LiveboxManagerImpl.cpp
+ FShell_LiveboxProviderManagerImpl.cpp
+ FShell_LiveboxManagerProxy.cpp
+ FShellLiveboxProvider.cpp
+ FShellLiveboxPopupProvider.cpp
+ FShellLiveboxProviderInfo.cpp
+ FShellLiveboxSizeInfo.cpp
+ FShellLiveboxManager.cpp
+ FShellLiveboxProviderManager.cpp
+ FShell_LiveboxManagerIpcMessage.cpp
+ FShell_LiveboxFrame.cpp
+ FShell_LiveboxFrameImpl.cpp
+ FShell_LiveboxFrameModel.cpp
+ FShell_LiveboxFramePresenter.cpp
+ FShell_LiveboxLayer.cpp
+ FShell_LiveboxPopup.cpp
+ FShell_LiveboxPopupImpl.cpp
+ FShell_LiveboxPopupModel.cpp
+ FShell_LiveboxPopupPresenter.cpp
+ FShell_LiveboxPopupView.cpp
+ FShell_LiveboxPopupViewEvent.cpp
+ FShell_LiveboxPopupViewPresenter.cpp
+ FShell_LiveboxView.cpp
+ FShell_LiveboxViewImpl.cpp
+ FShell_LiveboxViewManager.cpp
+ FShell_LiveboxViewModel.cpp
+ FShell_LiveboxViewPresenter.cpp
+ FShellLiveboxFrame.cpp
+ FShellLiveboxPopup.cpp
+ FShellLiveboxView.cpp
)
## Definitions
## SET LINKER FLAGS
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined -Wl,--as-needed")
+TARGET_LINK_LIBRARIES(${this_target} "-lpthread" )
TARGET_LINK_LIBRARIES(${this_target} "-lchromium" )
TARGET_LINK_LIBRARIES(${this_target} "-L/usr/lib/osp -losp-appfw" )
TARGET_LINK_LIBRARIES(${this_target} "-L/usr/lib/osp -losp-uifw" )
+TARGET_LINK_LIBRARIES(${this_target} "-L/usr/lib/osp -losp-image-core" )
+TARGET_LINK_LIBRARIES(${this_target} "-L/usr/lib/osp -losp-shell-core" )
TARGET_LINK_LIBRARIES(${this_target} "-lcapi-appfw-application" )
TARGET_LINK_LIBRARIES(${this_target} "-lcapi-appfw-app-manager" )
TARGET_LINK_LIBRARIES(${this_target} "-lnotification" )
TARGET_LINK_LIBRARIES(${this_target} "-levas" )
TARGET_LINK_LIBRARIES(${this_target} "-leina" )
TARGET_LINK_LIBRARIES(${this_target} "-lecore_evas" )
+TARGET_LINK_LIBRARIES(${this_target} "-lelementary" )
TARGET_LINK_LIBRARIES(${this_target} "-lminicontrol-provider" )
#TARGET_LINK_LIBRARIES(${this_target} "-lcapi-system-runtime-info")
+TARGET_LINK_LIBRARIES(${this_target} "-lX11" )
+TARGET_LINK_LIBRARIES(${this_target} "-lXext" )
+TARGET_LINK_LIBRARIES(${this_target} "-lecore_x" )
+TARGET_LINK_LIBRARIES(${this_target} "-llivebox-viewer" )
+TARGET_LINK_LIBRARIES(${this_target} "-llivebox-service" )
+TARGET_LINK_LIBRARIES(${this_target} "-lprovider" )
+TARGET_LINK_LIBRARIES(${this_target} "-lshortcut" )
+IF (NOT OSP_EMUL)
+TARGET_LINK_LIBRARIES(${this_target} "-ldri2" )
+TARGET_LINK_LIBRARIES(${this_target} "-ldrm" )
+TARGET_LINK_LIBRARIES(${this_target} "-ldrm_slp" )
+ENDIF (NOT OSP_EMUL)
SET_TARGET_PROPERTIES(${this_target}
PROPERTIES
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShellLiveboxFrame.cpp
+ * @brief This is the implementation for the LiveboxFrame class.
+ */
+
+#include <unique_ptr.h>
+#include <FBaseSysLog.h>
+#include <FShellLiveboxFrame.h>
+#include "FShell_LiveboxFrameImpl.h"
+
+using namespace std;
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui;
+
+namespace Tizen { namespace Shell
+{
+
+LiveboxFrame::LiveboxFrame(void)
+{
+}
+
+LiveboxFrame::~LiveboxFrame(void)
+{
+}
+
+result
+LiveboxFrame::Construct(const FloatDimension& size)
+{
+ SysAssertf(_pControlImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
+ unique_ptr<_LiveboxFrameImpl> pImpl(_LiveboxFrameImpl::CreateLiveboxFrameImplN(*this, null, null));
+ result r = GetLastResult();
+ SysTryReturn(NID_UI_CTRL, pImpl, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pImpl->Initialize(size);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ _pControlImpl = pImpl.release();
+
+ return r;
+}
+
+result
+LiveboxFrame::Construct(const Layout& layout, const FloatDimension& size)
+{
+ SysAssertf(_pControlImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
+
+ unique_ptr<_LiveboxFrameImpl> pImpl(_LiveboxFrameImpl::CreateLiveboxFrameImplN(*this, &layout, &layout));
+ result r = GetLastResult();
+ SysTryReturn(NID_UI_CTRL, pImpl, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pImpl->Initialize(size);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ _pControlImpl = pImpl.release();
+
+ return r;
+}
+
+}} // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShellLiveboxManager.cpp
+ * @brief This is the implementation for the LiveboxManager class.
+ */
+
+#include <cstdlib>
+#include <unique_ptr.h>
+
+#include <shortcut.h>
+#include <livebox-service/livebox-service.h>
+
+#include <FBaseSysLog.h>
+#include <FBaseCol.h>
+#include <FGraphics.h>
+#include <FApp.h>
+#include <FAppPkgPackageInfo.h>
+#include <FApp_Types.h>
+#include <FApp_AppInfo.h>
+
+
+#include <FShellLiveboxManager.h>
+#include <FShellLiveboxProviderInfo.h>
+#include <FShellILiveboxAddRequestListener.h>
+#include "FShell_LiveboxManagerImpl.h"
+
+using namespace std;
+using namespace Tizen::App;
+using namespace Tizen::App::Package;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Graphics;
+
+
+namespace Tizen { namespace Shell
+{
+
+LiveboxManager* LiveboxManager::__pTheInstance = null;\r
+
+LiveboxManager::LiveboxManager()
+ :__pLiveboxManagerImpl(null)
+{
+
+}
+
+LiveboxManager::~LiveboxManager()
+{
+}
+\r
+void\r
+LiveboxManager::InitSingleton(void)\r
+{\r
+ std::unique_ptr<LiveboxManager> pInst(new (std::nothrow) LiveboxManager());\r
+ SysTryReturnVoidResult(NID_APP, pInst, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));\r
+\r
+ result r = pInst->Construct();\r
+ SysTryReturnVoidResult(NID_APP, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ __pTheInstance = pInst.release();\r
+ std::atexit(DestroySingleton);\r
+}\r
+\r
+void\r
+LiveboxManager::DestroySingleton(void)\r
+{\r
+ delete __pTheInstance;\r
+}\r
+\r
+LiveboxManager*\r
+LiveboxManager::GetInstance(void)\r
+{\r
+ static pthread_once_t onceBlock = PTHREAD_ONCE_INIT;\r
+ if (__pTheInstance == null)\r
+ {\r
+ ClearLastResult();\r
+ pthread_once(&onceBlock, InitSingleton);\r
+ result r = GetLastResult();\r
+ if (IsFailed(r))\r
+ {\r
+ onceBlock = PTHREAD_ONCE_INIT;\r
+ }\r
+ }\r
+ return __pTheInstance;\r
+}\r
+
+result
+LiveboxManager::Construct()
+{
+ SysAssert(__pLiveboxManagerImpl == null);
+
+ SysLog(NID_APP, "Enter.");
+ __pLiveboxManagerImpl = _LiveboxManagerImpl::GetInstance();
+ SysAssertf(__pLiveboxManagerImpl, "Failed to construct _LiveboxManagerImpl!!");
+
+ SysLog(NID_APP, "Exit.");
+
+ return E_SUCCESS;
+}
+
+Tizen::Base::Collection::IList*
+LiveboxManager::GetLiveboxProviderInfoListN()
+{
+ return __pLiveboxManagerImpl->GetLiveboxProviderInfoListN();
+}
+
+LiveboxProviderInfo*
+LiveboxManager::GetLiveboxProviderInfoN(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName)
+{
+ return __pLiveboxManagerImpl->GetLiveboxProviderInfoN(appId, providerName);
+}
+
+LiveboxProviderInfo*
+LiveboxManager::GetDefaultLiveboxProviderInfoN(const Tizen::App::PackageId& packageId)
+{
+ return __pLiveboxManagerImpl->GetDefaultLiveboxProviderInfoN(packageId);
+}
+
+result
+LiveboxManager::SetLiveboxAddRequestListener(ILiveboxAddRequestListener* pListener)
+{
+ return __pLiveboxManagerImpl->SetLiveboxAddRequestListener(pListener);
+}
+
+
+}} // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShellLiveboxPopup.cpp
+ * @brief This is the implementation for the LiveboxPopup class.
+ */
+
+#include <unique_ptr.h>
+#include <FBaseSysLog.h>
+#include <FShellLiveboxPopup.h>
+#include "FShell_LiveboxPopupImpl.h"
+
+using namespace std;
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui;
+
+namespace Tizen { namespace Shell
+{
+
+LiveboxPopup::LiveboxPopup(void)
+{
+}
+
+LiveboxPopup::~LiveboxPopup(void)
+{
+}
+
+result
+LiveboxPopup::Construct(const FloatDimension& size)
+{
+ SysAssertf(_pControlImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
+
+ unique_ptr<_LiveboxPopupImpl> pImpl(_LiveboxPopupImpl::CreateLiveboxPopupImplN(*this, null, null));
+ result r = GetLastResult();
+ SysTryReturn(NID_UI_CTRL, pImpl, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pImpl->Initialize(size);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ _pControlImpl = pImpl.release();
+
+ return r;
+}
+
+result
+LiveboxPopup::Construct(const Layout& layout, const FloatDimension& size)
+{
+ SysAssertf(_pControlImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
+
+ unique_ptr<_LiveboxPopupImpl> pImpl(_LiveboxPopupImpl::CreateLiveboxPopupImplN(*this, &layout, &layout));
+ result r = GetLastResult();
+ SysTryReturn(NID_UI_CTRL, pImpl, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pImpl->Initialize(size);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ _pControlImpl = pImpl.release();
+
+ return r;
+}
+
+FloatRectangle
+LiveboxPopup::GetClientAreaBounds(void) const\r
+{\r
+ const _LiveboxPopupImpl* pImpl = _LiveboxPopupImpl::GetInstance(*this);
+ SysAssertf(pImpl != null, "Not yet constructed. Construct() should be called before use.");\r
+\r
+ return pImpl->GetClientAreaBounds();\r
+}\r
+\r
+Canvas*\r
+LiveboxPopup::GetClientAreaCanvasN(void) const\r
+{\r
+ const _LiveboxPopupImpl* pImpl = _LiveboxPopupImpl::GetInstance(*this);
+ SysAssertf(pImpl != null, "Not yet constructed. Construct() should be called before use.");\r
+\r
+ Canvas* pCanvas = pImpl->GetClientAreaCanvasN();\r
+ result r = GetLastResult();\r
+ SysTryReturn(NID_UI_CTRL, pCanvas, null, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ return pCanvas;\r
+}\r
+\r
+FloatPoint\r
+LiveboxPopup::TranslateToClientAreaPosition(const FloatPoint& controlPosition) const
+{\r
+ const _LiveboxPopupImpl* pImpl = _LiveboxPopupImpl::GetInstance(*this);
+ SysAssertf(pImpl != null, "Not yet constructed. Construct() should be called before use.");\r
+\r
+ return pImpl->TranslateToClientAreaPosition(controlPosition);
+}\r
+\r
+FloatPoint
+LiveboxPopup::TranslateToControlPosition(const FloatPoint& clientPosition) const
+{
+ const _LiveboxPopupImpl* pImpl = _LiveboxPopupImpl::GetInstance(*this);
+ SysAssertf(pImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return pImpl->TranslateToControlPosition(clientPosition);
+}
+
+}} // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file .cpp
+ * @brief This is the implementation for the Livebox class.
+ */
+
+#include <FBaseSysLog.h>
+#include <FShellLiveboxFrame.h>
+#include <FShellLiveboxPopup.h>
+#include <FShellLiveboxPopupProvider.h>
+
+#include "FShell_LiveboxPopupProviderImpl.h"
+#include "FShell_LiveboxPopupImpl.h"
+
+namespace Tizen { namespace Shell
+{
+
+using namespace Tizen::Base;
+
+
+
+LiveboxPopupProvider::LiveboxPopupProvider()
+{
+ SysLog(NID_APP, "");
+}
+
+LiveboxPopupProvider::~LiveboxPopupProvider()
+{
+ SysLog(NID_APP, "LiveboxPopupProvider is destroyed.");
+}
+
+result
+LiveboxPopupProvider::Construct(const String& instanceId, double x, double y)
+{
+ __pLiveboxPopupProviderImpl = new (std::nothrow) _LiveboxPopupProviderImpl(instanceId, x, y);
+ SysTryReturnResult(NID_APP, __pLiveboxPopupProviderImpl, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
+
+ SysLog(NID_APP, "LiveboxPopupProvider is constructed.");
+ return E_SUCCESS;
+}
+
+/*String
+LiveboxPopupProvider::GetId() const
+{
+ return __pLiveboxPopupProviderImpl->GetId();
+}*/
+
+result
+LiveboxPopupProvider::SetLiveboxPopup(LiveboxPopup* pLiveboxPopup)
+{
+ return __pLiveboxPopupProviderImpl->SetLiveboxPopup(pLiveboxPopup);
+}
+
+LiveboxPopup*
+LiveboxPopupProvider::GetLiveboxPopup()
+{
+ return __pLiveboxPopupProviderImpl->GetLiveboxPopup();
+}
+
+const LiveboxPopup*
+LiveboxPopupProvider::GetLiveboxPopup() const
+{
+ return const_cast<const LiveboxPopup*>(__pLiveboxPopupProviderImpl->GetLiveboxPopup());
+}
+
+result
+LiveboxPopupProvider::RequestUpdateToLivebox()
+{
+ return __pLiveboxPopupProviderImpl->RequestUpdateToLivebox();
+}
+
+}} // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShellLivebox.cpp
+ * @brief This is the implementation for the LiveboxProvider class.
+ */
+
+#include <FBaseSysLog.h>
+#include <FShellLiveboxFrame.h>
+#include <FShellLiveboxPopup.h>
+
+#include "FShell_LiveboxProviderImpl.h"
+#include "FShellLiveboxProvider.h"
+
+namespace Tizen { namespace Shell
+{
+
+using namespace Tizen::Base;
+
+LiveboxProvider::LiveboxProvider()
+{
+}
+
+LiveboxProvider::~LiveboxProvider()
+{
+ SysLog(NID_APP, "LiveboxProvider is destroyed.");
+}
+
+result
+LiveboxProvider::Construct(const String& instanceId)
+{
+ __pLiveboxProviderImpl = new (std::nothrow) _LiveboxProviderImpl(instanceId);
+ SysTryReturnResult(NID_APP, __pLiveboxProviderImpl, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
+
+ SysLog(NID_APP, "LiveboxProvider is constructed.");
+
+ return E_SUCCESS;
+}
+
+/*String
+LiveboxProvider::GetId() const
+{
+ return __pLiveboxProviderImpl->GetId();
+}*/
+
+result
+LiveboxProvider::SetLiveboxFrame(LiveboxFrame* pLiveboxFrame)
+{
+ return __pLiveboxProviderImpl->SetLiveboxFrame(pLiveboxFrame);
+}
+
+LiveboxFrame*
+LiveboxProvider::GetLiveboxFrame()
+{
+ return __pLiveboxProviderImpl->GetLiveboxFrame();
+}
+
+const LiveboxFrame*
+LiveboxProvider::GetLiveboxFrame() const
+{
+ return const_cast<const LiveboxFrame*>(__pLiveboxProviderImpl->GetLiveboxFrame());
+}
+
+}} // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShellLiveboxInfo.cpp
+ * @brief This is the implementation for the LiveboxInfo class.
+ */
+
+#include <unique_ptr.h>
+
+#include <livebox-service/livebox-service.h>
+
+#include <FBase.h>
+#include <FBaseSysLog.h>
+#include <FBase_StringConverter.h>
+#include <FShellLiveboxProviderInfo.h>
+#include <FShellLiveboxSizeInfo.h>
+
+#include "FShell_LiveboxProviderInfoImpl.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Graphics;
+
+namespace Tizen { namespace Shell
+{
+
+
+LiveboxProviderInfo::LiveboxProviderInfo(const Tizen::App::AppId& appId, const Tizen::Base::String& name)
+{
+ __pLiveboxProviderInfoImpl = new (std::nothrow) _LiveboxProviderInfoImpl(appId, name);
+}
+
+LiveboxProviderInfo::LiveboxProviderInfo(const LiveboxProviderInfo& rhs)
+{
+ SysAssert(rhs.__pLiveboxProviderInfoImpl);
+ __pLiveboxProviderInfoImpl = new (std::nothrow) _LiveboxProviderInfoImpl(rhs.__pLiveboxProviderInfoImpl->__appId, rhs.__pLiveboxProviderInfoImpl->__name);
+}
+
+LiveboxProviderInfo::~LiveboxProviderInfo()
+{
+ delete __pLiveboxProviderInfoImpl;
+}
+
+Tizen::App::AppId
+LiveboxProviderInfo::GetAppId() const
+{
+ SysAssert(__pLiveboxProviderInfoImpl);
+ return __pLiveboxProviderInfoImpl->GetAppId();
+}
+
+Tizen::Base::String
+LiveboxProviderInfo::GetName() const
+{
+ SysAssert(__pLiveboxProviderInfoImpl);
+ return __pLiveboxProviderInfoImpl->GetName();
+}
+
+Tizen::Base::String
+LiveboxProviderInfo::GetDisplayName() const
+{
+ SysAssert(__pLiveboxProviderInfoImpl);
+ return __pLiveboxProviderInfoImpl->GetDisplayName();
+}
+
+Tizen::Base::String
+LiveboxProviderInfo::GetIconPath() const
+{
+ SysAssert(__pLiveboxProviderInfoImpl);
+ return __pLiveboxProviderInfoImpl->GetIconPath();
+}
+
+Tizen::Base::String
+LiveboxProviderInfo::GetConfigurationAppControlAppId() const
+{
+ return __pLiveboxProviderInfoImpl->GetConfigurationAppControlAppId();
+}
+
+Tizen::Base::Collection::IList*
+LiveboxProviderInfo::GetSizeInfoListN() const
+{
+ SysAssert(__pLiveboxProviderInfoImpl);
+ return __pLiveboxProviderInfoImpl->GetSizeInfoListN();
+}
+
+bool
+LiveboxProviderInfo::IsDefault() const
+{
+ SysAssert(__pLiveboxProviderInfoImpl);
+ return __pLiveboxProviderInfoImpl->IsDefault();
+}
+
+}} // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShellLiveboxProviderManager.cpp
+ * @brief This is the implementation for the LiveboxProviderManager class.
+ */
+
+#include <unique_ptr.h>
+
+#include <shortcut.h>
+#include <livebox-service/livebox-service.h>
+
+#include <FBaseSysLog.h>
+#include <FBaseCol.h>
+#include <FGraphics.h>
+#include <FApp.h>
+#include <FAppPkgPackageInfo.h>
+#include <FShellLiveboxProviderManager.h>
+#include <FShellLiveboxProviderInfo.h>
+#include <FShellILiveboxProviderFactory.h>
+#include <FShellILiveboxPopupProviderFactory.h>
+
+#include <FApp_Types.h>
+#include <FApp_AppInfo.h>
+#include <FAppPkg_PackageManagerImpl.h>
+#include <FBase_StringConverter.h>
+
+#include "FShell_LiveboxProviderManagerImpl.h"
+
+using namespace std;
+using namespace Tizen::App;
+using namespace Tizen::App::Package;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Graphics;
+
+
+namespace Tizen { namespace Shell
+{
+
+LiveboxProviderManager::LiveboxProviderManager()
+ :__pLiveboxProviderManagerImpl(null)
+{
+
+}
+
+LiveboxProviderManager::~LiveboxProviderManager()
+{
+ SysLog(NID_APP, "LiveboxProviderManager is destroyed.");
+}
+
+LiveboxProviderManager*
+LiveboxProviderManager::GetInstance()
+{
+ static LiveboxProviderManager* pLiveboxManager = null;
+ if( pLiveboxManager == null)
+ {
+ pLiveboxManager = new (std::nothrow) LiveboxProviderManager;
+ SysTryReturn(NID_APP, pLiveboxManager, null, E_OUT_OF_MEMORY, "E_OUT_OF_MEMORY" );
+
+ result r = pLiveboxManager->Construct();
+// SysTryReturn(NID_APP, !IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r));
+ SysAssertf(!IsFailed(r), "Failed to construct LiveboxProviderManager!!");
+ }
+
+ return pLiveboxManager;
+}
+
+result
+LiveboxProviderManager::Construct()
+{
+ SysAssert(__pLiveboxProviderManagerImpl == null);
+
+ __pLiveboxProviderManagerImpl = _LiveboxProviderManagerImpl::GetInstance();
+ SysAssertf(__pLiveboxProviderManagerImpl, "Failed to construct _LiveboxProviderManagerImpl!!");
+
+ SysLog(NID_APP, "LiveboxProviderManager instance is constructed.");
+ return E_SUCCESS;
+}
+
+result
+LiveboxProviderManager::SetLiveboxProviderFactory(ILiveboxProviderFactory& factory)
+{
+ return __pLiveboxProviderManagerImpl->SetLiveboxProviderFactory(factory);
+}
+
+result
+LiveboxProviderManager::SetLiveboxPopupProviderFactory(ILiveboxPopupProviderFactory& factory)
+{
+ return __pLiveboxProviderManagerImpl->SetLiveboxPopupProviderFactory(factory);
+}
+
+result
+LiveboxProviderManager::RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument)
+{
+ SysLog(NID_APP, "Enter.");
+ return __pLiveboxProviderManagerImpl->RequestUpdate(appId, providerName, argument);
+}
+
+result
+LiveboxProviderManager::AddLivebox(const Tizen::App::AppId& providerAppId, const Tizen::Base::String& providerName, const Tizen::Base::String& text, const Tizen::Base::String& userInfo)
+{
+ return __pLiveboxProviderManagerImpl->AddLivebox(providerAppId, providerName, text, userInfo);
+}
+
+}} // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShellLiveboxInfo.cpp
+ * @brief This is the implementation for the LiveboxInfo class.
+ */
+
+#include <unique_ptr.h>
+#include <livebox-service/livebox-service.h>
+#include <FBase.h>
+#include <FBaseSysLog.h>
+#include <FBase_StringConverter.h>
+#include <FShellLiveboxSizeInfo.h>
+
+#include "FShell_LiveboxSizeInfoImpl.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Graphics;
+
+namespace Tizen { namespace Shell
+{
+
+LiveboxSizeInfo::LiveboxSizeInfo(FloatDimension size, const String& previewImagePath)
+{
+ __pLiveboxSizeInfoImpl = new (std::nothrow) _LiveboxSizeInfoImpl(size, previewImagePath);
+}
+
+LiveboxSizeInfo::LiveboxSizeInfo(const LiveboxSizeInfo& rhs)
+{
+ *__pLiveboxSizeInfoImpl = *rhs.__pLiveboxSizeInfoImpl;
+}
+
+LiveboxSizeInfo&
+LiveboxSizeInfo::operator =(const LiveboxSizeInfo& rhs)
+{
+ *__pLiveboxSizeInfoImpl = *rhs.__pLiveboxSizeInfoImpl;
+
+ return *this;
+}
+
+LiveboxSizeInfo::~LiveboxSizeInfo()
+{
+}
+
+FloatDimension
+LiveboxSizeInfo::GetSize() const
+{
+ return __pLiveboxSizeInfoImpl->GetSize();
+}
+
+Tizen::Base::String
+LiveboxSizeInfo::GetPreviewImagePath() const
+{
+ return __pLiveboxSizeInfoImpl->GetPreviewImagePath();
+}
+
+}} // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShellLiveboxView.cpp
+ * @brief This is the implementation for the LiveboxView class.
+ */
+
+#include <unique_ptr.h>
+#include <FBaseSysLog.h>
+#include <FBaseString.h>
+#include <FGrpPoint.h>
+#include <FShellLiveboxView.h>
+#include <FApp_Aul.h>
+#include "FShell_LiveboxViewImpl.h"
+
+using namespace std;
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+
+namespace Tizen { namespace Shell
+{
+
+LiveboxView::LiveboxView(void)
+{
+}
+
+LiveboxView::~LiveboxView(void)
+{
+}
+
+result
+LiveboxView::Construct(const AppId& appId, const String& providerName, const FloatRectangle& rect)
+{
+ return Construct(appId, providerName, rect, L"");
+}
+
+result
+LiveboxView::Construct(const AppId& appId, const String& providerName, const FloatRectangle& rect, const String& userInfo)
+{
+ SysTryReturnResult(NID_UI_CTRL, _Aul::IsInstalled(appId) == true, E_APP_NOT_INSTALLED, "The application is not installed.");
+
+ SysAssertf(_pControlImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
+
+ unique_ptr<_LiveboxViewImpl> pImpl(_LiveboxViewImpl::CreateLiveboxViewImplN(*this));
+ result r = GetLastResult();
+ SysTryReturn(NID_UI_CTRL, pImpl, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pImpl->Initialize(appId, providerName, rect, userInfo);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ _pControlImpl = pImpl.release();
+
+ return r;
+}
+
+}} // Tizen::Shell
// http://floralicense.org/license/
//
// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
+// 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.
QuickPanelFrame::Construct(int height)
{
result r = _AccessController::CheckUserPrivilege(_PRV_NOTIFICATION);
- SysTryReturnResult(NID_LOC, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+ SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
SysAssertf(_pControlImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
_QuickPanelFrameImpl* pImpl = _QuickPanelFrameImpl::CreateQuickPanelFrameImplN(*this, null, null);
_pControlImpl = pImpl;
- r = pImpl->Initialize(height);
+ float heightF = static_cast<float>(height);
+ r = pImpl->Initialize(heightF);
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
return r;
{
ClearLastResult();
- result r = _AccessController::CheckUserPrivilege(_PRV_NOTIFICATION);
- SysTryReturnResult(NID_LOC, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+ result r = _AccessController::CheckUserPrivilege(_PRV_NOTIFICATION);
+ SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
// Parse UiBuilder XML file
- unique_ptr<_UiBuilder> pBuilder(new _UiBuilder());
+ unique_ptr<_UiBuilder> pBuilder(new (std::nothrow) _UiBuilder());
SysTryReturn(NID_UI_CTRL, pBuilder, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
r = pBuilder->Construct(resourceId, this);
SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
QuickPanelFrame::Construct(const Layout& layout, int height)
{
result r = _AccessController::CheckUserPrivilege(_PRV_NOTIFICATION);
- SysTryReturnResult(NID_LOC, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+ SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
r = Construct(layout, layout, height);
SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
QuickPanelFrame::Construct(const Layout& portraitLayout, const Layout& landscapeLayout, int height)
{
result r = _AccessController::CheckUserPrivilege(_PRV_NOTIFICATION);
- SysTryReturnResult(NID_LOC, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+ SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+
+ SysAssertf(_pControlImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
+ _QuickPanelFrameImpl* pImpl = _QuickPanelFrameImpl::CreateQuickPanelFrameImplN(*this, &portraitLayout, &landscapeLayout);
+ r = GetLastResult();
+ SysTryReturn(NID_UI_CTRL, pImpl, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ _pControlImpl = pImpl;
+
+ float heightF = static_cast<float>(height);
+ r = pImpl->Initialize(heightF);
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+
+CATCH:
+ delete pImpl;
+ _pControlImpl = null;
+
+ return r;
+}
+
+result
+QuickPanelFrame::Construct(float height)
+{
+ result r = _AccessController::CheckUserPrivilege(_PRV_NOTIFICATION);
+ SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+
+ SysAssertf(_pControlImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
+ _QuickPanelFrameImpl* pImpl = _QuickPanelFrameImpl::CreateQuickPanelFrameImplN(*this, null, null);
+ r = GetLastResult();
+ SysTryReturn(NID_UI_CTRL, pImpl, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ _pControlImpl = pImpl;
+
+ r = pImpl->Initialize(height);
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+
+CATCH:
+ delete pImpl;
+ _pControlImpl = null;
+
+ return r;
+}
+
+result
+QuickPanelFrame::Construct(const Layout& layout, float height)
+{
+ result r = _AccessController::CheckUserPrivilege(_PRV_NOTIFICATION);
+ SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+
+ r = Construct(layout, layout, height);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
+result
+QuickPanelFrame::Construct(const Layout& portraitLayout, const Layout& landscapeLayout, float height)
+{
+ result r = _AccessController::CheckUserPrivilege(_PRV_NOTIFICATION);
+ SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
SysAssertf(_pControlImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
_QuickPanelFrameImpl* pImpl = _QuickPanelFrameImpl::CreateQuickPanelFrameImplN(*this, &portraitLayout, &landscapeLayout);
_QuickPanelFrameImpl* pImpl = _QuickPanelFrameImpl::GetInstance(*this);
SysAssertf(pImpl != null, "Not yet constructed. Construct() should be called before use.");
+ float heightF = static_cast<float>(height);
+ result r = pImpl->SetHeight(heightF);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
+result
+QuickPanelFrame::SetHeight(float height)
+{
+ _QuickPanelFrameImpl* pImpl = _QuickPanelFrameImpl::GetInstance(*this);
+ SysAssertf(pImpl != null, "Not yet constructed. Construct() should be called before use.");
+
result r = pImpl->SetHeight(height);
SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file FShell_ILiveboxPopupViewEventListener.h
+ * @brief This is the header file for the _ILiveboxPopupViewEventListener interface.
+ *
+ * This header file contains the declarations of the _ILiveboxPopupViewEventListener interface.
+ */
+#ifndef _FSHELL_INTERNAL_ILIVEBOX_POPUP_VIEW_EVENT_LISTENER_H_
+#define _FSHELL_INTERNAL_ILIVEBOX_POPUP_VIEW_EVENT_LISTENER_H_
+
+#include <FBaseRtIEventListener.h>
+
+namespace Tizen { namespace Shell
+{
+
+/**
+ * @interface _ILiveboxPopupViewEventListener
+ * @brief This interface implements the listener for keypad events.
+ * @since 2.1
+ *
+ * The _ILiveboxPopupViewEventListener interface enables the implementer to receive the
+ * software keypad related events.
+ */
+class _ILiveboxPopupViewEventListener
+ : virtual public Tizen::Base::Runtime::IEventListener
+{
+public:
+ /**
+ * This is the destructor for this class.
+ * @since 2.1
+ */
+ virtual ~_ILiveboxPopupViewEventListener(void) {}
+
+public:
+ virtual void OnLiveboxPopupViewOpened(void) = 0;
+ virtual void OnLiveboxPopupViewClosed(void) = 0;
+}; // _ILiveboxPopupViewEventListener
+
+}} // Tizen::Shell
+
+#endif // _FSHELL_INTERNAL_ILIVEBOX_POPUP_VIEW_EVENT_LISTENER_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file FShell_LiveboxFrame.cpp
+ * @brief This is the implementation file for the _LiveboxFrame class.
+ */
+
+#include <new>
+#include <FBaseSysLog.h>
+#include <FBase_StringConverter.h>
+#include "FUi_UiKeyEvent.h"
+#include "FUi_IUiEventManager.h"
+#include "FUi_UiEventManager.h"
+#include "FUiAnim_DisplayManager.h"
+#include "FUiAnim_RootVisualElement.h"
+#include "FShell_LiveboxFrame.h"
+#include "FShell_LiveboxFramePresenter.h"
+#include "FShell_LiveboxLayer.h"
+
+using namespace std;
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Animations;
+
+namespace Tizen { namespace Shell
+{
+
+_LiveboxFrame::_LiveboxFrame(void)
+ : __pLiveboxFramePresenter(new (std::nothrow) _LiveboxFramePresenter(*this))
+ , __pLiveboxLayer(null)
+ , __pLiveboxFrameRootVisualElement(null)
+ , __pEventManager(null)
+{
+ SysTryReturnVoidResult(NID_UI_CTRL, __pLiveboxFramePresenter, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ _UiEventManager* pEventManager = _UiEventManager::GetInstance();
+ SysTryReturnVoidResult(NID_UI_CTRL, pEventManager, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ __pEventManager = pEventManager->GetEventManager();
+ SysTryReturnVoidResult(NID_UI_CTRL, __pEventManager, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+}
+
+_LiveboxFrame::~_LiveboxFrame(void)
+{
+ if (__pEventManager)
+ {
+ __pEventManager->UnregisterTouchEventHandler(*this);
+ }
+
+ __pLiveboxLayer = null;
+ __pLiveboxFrameRootVisualElement = null;
+}
+
+_LiveboxFrame*
+_LiveboxFrame::CreateLiveboxFrameN(void)
+{
+ unique_ptr<_LiveboxFrame> pLiveboxFrame(new (std::nothrow) _LiveboxFrame());
+ SysTryReturn(NID_UI_CTRL, pLiveboxFrame, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ result r = GetLastResult();
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pLiveboxFrame->AcquireHandle();
+
+ SetLastResult(E_SUCCESS);
+
+ return pLiveboxFrame.release();
+}
+
+result
+_LiveboxFrame::Initialize(const FloatDimension& size)
+{
+ result r = E_SUCCESS;
+
+ const float DEFAULT_WIDTH = 172.0f;
+ const float DEFAULT_HEIGHT = 172.0f;
+
+ FloatDimension liveboxSize(size);
+ if (liveboxSize.width <= 0 )
+ {
+ liveboxSize.width = DEFAULT_WIDTH;
+ }
+
+ if (liveboxSize.height <= 0 )
+ {
+ liveboxSize.height = DEFAULT_HEIGHT;
+ }
+
+ SetSystemWindow(true);
+
+ __liveboxSize = size;
+
+ r = CreateRootVisualElement();
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ FloatRectangle bounds(0.0f, 0.0f, liveboxSize.width, liveboxSize.height);
+ r = SetBounds(bounds);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = __pLiveboxFramePresenter->Initialize();
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pLiveboxLayer->SetLayerBounds(bounds);
+ __pLiveboxLayer->SetShowState(false);
+
+ __pLiveboxFrameRootVisualElement->SetImplicitAnimationEnabled(false);
+ __pLiveboxFrameRootVisualElement->SetName(L"_LiveboxFrame");
+ __pLiveboxFrameRootVisualElement->SetBounds(bounds);
+ __pLiveboxFrameRootVisualElement->SetShowState(false);
+
+ SetBackgroundColor(Color(0, 0, 0, 0));
+
+ r = __pEventManager->RegisterTouchEventHandler(*this);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
+result
+_LiveboxFrame::SetProviderId(const String& providerId)
+{
+ __pLiveboxFramePresenter->SetProviderId(providerId);
+
+ result r = __pLiveboxLayer->SetProviderId(providerId);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
+String
+_LiveboxFrame::GetProviderId(void) const
+{
+ return __pLiveboxFramePresenter->GetProviderId();
+}
+
+result
+_LiveboxFrame::SetLayerShowState(bool showState)
+{
+ result r = E_SUCCESS;
+
+ if (__pLiveboxFrameRootVisualElement)
+ {
+ _LiveboxLayer* pLayer = dynamic_cast<_LiveboxLayer*>(__pLiveboxFrameRootVisualElement->GetNativeLayer());
+ SysTryReturn(NID_UI_CTRL, pLayer, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
+
+ r = pLayer->SetShowState(showState);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pLiveboxFrameRootVisualElement->SetShowState(showState);
+ }
+
+ return r;
+}
+
+result
+_LiveboxFrame::SetLayerBounds(const FloatRectangle& bounds)
+{
+ result r = E_SUCCESS;
+
+ if (__pLiveboxFrameRootVisualElement)
+ {
+ _LiveboxLayer* pLayer = dynamic_cast<_LiveboxLayer*>(__pLiveboxFrameRootVisualElement->GetNativeLayer());
+ r = GetLastResult();
+ SysTryReturn(NID_UI_CTRL, pLayer, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pLayer->SetLayerBounds(bounds);
+ __pLiveboxFrameRootVisualElement->SetBounds(bounds);
+ }
+
+ return r;
+}
+
+result
+_LiveboxFrame::CreateLayer(void)
+{
+ unique_ptr<_LiveboxLayer> pLayer(new (std::nothrow) _LiveboxLayer(__liveboxSize));
+ SysTryReturn(NID_UI_CTRL, pLayer, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ result r = pLayer->Construct();
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pLiveboxLayer = pLayer.release();
+ __pLiveboxFrameRootVisualElement = __pLiveboxLayer->GetRootVisualElement();
+
+ SetLayer(*__pLiveboxLayer);
+ SetRootVisualElement(*__pLiveboxFrameRootVisualElement);
+
+ return r;
+}
+
+void
+_LiveboxFrame::OnActivated(void)
+{
+ result r = SetLayerShowState(true);
+ SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+}
+
+void
+_LiveboxFrame::OnDeactivated(void)
+{
+}
+
+void
+_LiveboxFrame::OnBoundsChanged(void)
+{
+ FloatRectangle bounds = GetBoundsF();
+
+ SetLayerBounds(GetBoundsF());
+}
+
+void
+_LiveboxFrame::OnDraw(void)
+{
+ if (__pLiveboxFramePresenter)
+ {
+ __pLiveboxFramePresenter->Draw();
+ }
+}
+
+}} // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file FShell_LiveboxFrame.h
+ * @brief This is the header file for the _LiveboxFrame class.
+ *
+ * This header file contains the declarations of the %_LiveboxFrame class.
+ */
+#ifndef _FSHELL_INTERNAL_LIVEBOX_FRAME_H_
+#define _FSHELL_INTERNAL_LIVEBOX_FRAME_H_
+
+#include <unique_ptr.h>
+#include <FBaseString.h>
+#include "FUi_Window.h"
+
+namespace Tizen { namespace Ui
+{
+class _IUiEventManager;
+}} // Tizen::Ui
+
+namespace Tizen { namespace Ui { namespace Animations
+{
+class _RootVisualElement;
+}}} // Tizen::Ui::Animations
+
+namespace Tizen { namespace Shell
+{
+
+class _LiveboxFramePresenter;
+class _LiveboxLayer;
+
+/**
+ * @class _LiveboxFrame
+ * @brief
+ * @since 2.1
+ */
+class _LiveboxFrame
+ : public Tizen::Ui::_Window
+{
+public:
+ static _LiveboxFrame* CreateLiveboxFrameN(void);
+ virtual ~_LiveboxFrame(void);
+
+ result Initialize(const Tizen::Graphics::FloatDimension& size);
+ result SetProviderId(const Tizen::Base::String& providerId);
+ Tizen::Base::String GetProviderId(void) const;
+
+protected:
+ _LiveboxFrame(void);
+
+private:
+ _LiveboxFrame(const _LiveboxFrame& rhs);
+ _LiveboxFrame& operator =(const _LiveboxFrame& rhs);
+
+ result SetLayerShowState(bool showState);
+ result SetLayerBounds(const Tizen::Graphics::FloatRectangle& bounds);
+
+ virtual result CreateLayer(void);
+
+ virtual void OnActivated(void);
+ virtual void OnDeactivated(void);
+ virtual void OnBoundsChanged(void);
+ virtual void OnDraw(void);
+
+private:
+ std::unique_ptr<_LiveboxFramePresenter> __pLiveboxFramePresenter;
+ _LiveboxLayer* __pLiveboxLayer;
+ Tizen::Ui::Animations::_RootVisualElement* __pLiveboxFrameRootVisualElement;
+ Tizen::Ui::_IUiEventManager* __pEventManager;
+ Tizen::Graphics::FloatDimension __liveboxSize;
+}; // _LiveboxFrame
+
+}} // Tizen::Shell
+
+#endif // _FSHELL_INTERNAL_LIVEBOX_FRAME_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <new>
+#include <unique_ptr.h>
+#include <FBaseSysLog.h>
+#include "FShell_LiveboxFrameImpl.h"
+
+using namespace std;
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui;
+
+namespace Tizen { namespace Shell
+{
+
+const _LiveboxFrameImpl*
+_LiveboxFrameImpl::GetInstance(const LiveboxFrame& liveboxFrame)
+{
+ return static_cast<const _LiveboxFrameImpl*>(_ControlImpl::GetInstance(liveboxFrame));
+}
+
+_LiveboxFrameImpl*
+_LiveboxFrameImpl::GetInstance(LiveboxFrame& liveboxFrame)
+{
+ return static_cast<_LiveboxFrameImpl*>(_ControlImpl::GetInstance(liveboxFrame));
+}
+
+_LiveboxFrameImpl*
+_LiveboxFrameImpl::CreateLiveboxFrameImplN(LiveboxFrame& liveboxFrame, const Layout* pPortraitLayout, const Layout* pLandscapeLayout)
+{
+ unique_ptr<_LiveboxFrame> pCore(_LiveboxFrame::CreateLiveboxFrameN());
+ result r = GetLastResult();
+ SysTryReturn(NID_UI_CTRL, pCore, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ unique_ptr<_LiveboxFrameImpl> pImpl(new (std::nothrow) _LiveboxFrameImpl(&liveboxFrame, pCore.get(), pPortraitLayout, pLandscapeLayout));
+ SysTryReturn(NID_UI_CTRL, pImpl, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ pCore.release();
+
+ r = GetLastResult();
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return pImpl.release();
+}
+
+_LiveboxFrameImpl::_LiveboxFrameImpl(LiveboxFrame* pPublic, _LiveboxFrame* pCore, const Layout* pPortraitLayout, const Layout* pLandscapeLayout)
+ : _WindowImpl(pPublic, pCore, pPortraitLayout, pLandscapeLayout)
+{
+}
+
+_LiveboxFrameImpl::~_LiveboxFrameImpl(void)
+{
+}
+
+const char*
+_LiveboxFrameImpl::GetPublicClassName(void) const
+{
+ return "Tizen::Shell::LiveboxFrame";
+}
+
+const LiveboxFrame&
+_LiveboxFrameImpl::GetPublic(void) const
+{
+ return static_cast<const LiveboxFrame&>(_ControlImpl::GetPublic());
+}
+
+LiveboxFrame&
+_LiveboxFrameImpl::GetPublic(void)
+{
+ return static_cast<LiveboxFrame&>(_ControlImpl::GetPublic());
+}
+
+const _LiveboxFrame&
+_LiveboxFrameImpl::GetCore(void) const
+{
+ return static_cast<const _LiveboxFrame&>(_ControlImpl::GetCore());
+}
+
+_LiveboxFrame&
+_LiveboxFrameImpl::GetCore(void)
+{
+ return static_cast<_LiveboxFrame&>(_ControlImpl::GetCore());
+}
+
+result
+_LiveboxFrameImpl::Initialize(const FloatDimension& size)
+{
+ result r = GetCore().Initialize(size);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
+result
+_LiveboxFrameImpl::SetProviderId(const String& providerId)
+{
+ result r = GetCore().SetProviderId(providerId);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
+}} // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef _FSHELL_INTERNAL_LIVEBOX_FRAME_IMPL_H_
+#define _FSHELL_INTERNAL_LIVEBOX_FRAME_IMPL_H_
+
+#include <FShellLiveboxFrame.h>
+#include "FUi_WindowImpl.h"
+#include "FShell_LiveboxFrame.h"
+
+namespace Tizen { namespace Ui
+{
+class Layout;
+}} // Tizen::Ui
+
+namespace Tizen { namespace Shell
+{
+
+class _LiveboxFrameImpl
+ : public Tizen::Ui::_WindowImpl
+{
+public:
+ static _LiveboxFrameImpl* CreateLiveboxFrameImplN(LiveboxFrame& liveboxFrame, const Tizen::Ui::Layout* pPortraitLayout, const Tizen::Ui::Layout* pLandscapeLayout);
+ static const _LiveboxFrameImpl* GetInstance(const LiveboxFrame& liveboxFrame);
+ static _LiveboxFrameImpl* GetInstance(LiveboxFrame& liveboxFrame);
+
+ virtual ~_LiveboxFrameImpl(void);
+
+ virtual const char* GetPublicClassName(void) const;
+ virtual const LiveboxFrame& GetPublic(void) const;
+ virtual LiveboxFrame& GetPublic(void);
+ virtual const _LiveboxFrame& GetCore(void) const;
+ virtual _LiveboxFrame& GetCore(void);
+
+ result Initialize(const Tizen::Graphics::FloatDimension& size);
+ result SetProviderId(const Tizen::Base::String& providerId);
+
+protected:
+ _LiveboxFrameImpl(LiveboxFrame* pPublic, _LiveboxFrame* pCore, const Tizen::Ui::Layout* pPortraitLayout, const Tizen::Ui::Layout* pLandscapeLayout);
+
+private:
+ _LiveboxFrameImpl(const _LiveboxFrameImpl& rhs);
+ _LiveboxFrameImpl& operator =(const _LiveboxFrameImpl& rhs);
+}; // _LiveboxFrameImpl
+
+}} // Tizen::Shell::Ui::Controls
+
+#endif // _FSHELL_INTERNAL_LIVEBOX_FRAME_IMPL_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file FShell_LiveboxFrameModel.cpp
+ * @brief This is the implementation file for the _LiveboxFrameModel class.
+ */
+
+#include <FBaseSysLog.h>
+#include "FShell_LiveboxFrameModel.h"
+
+using namespace Tizen::Base;
+
+namespace Tizen { namespace Shell
+{
+
+_LiveboxFrameModel::_LiveboxFrameModel(void)
+{
+}
+
+_LiveboxFrameModel::~_LiveboxFrameModel(void)
+{
+}
+
+void
+_LiveboxFrameModel::SetProviderId(const String& providerId)
+{
+ __providerId = providerId;
+}
+
+String
+_LiveboxFrameModel::GetProviderId(void) const
+{
+ return __providerId;
+}
+
+}} // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file FShell_LiveboxFrameModel.h
+ * @brief This is the header file for the _LiveboxFrameModel class.
+ *
+ * This header file contains the declarations of the %_LiveboxFrameModel class.
+ */
+#ifndef _FSHELL_INTERNAL_LIVEBOX_FRAME_MODEL_H_
+#define _FSHELL_INTERNAL_LIVEBOX_FRAME_MODEL_H_
+
+#include <FBaseObject.h>
+#include <FBaseString.h>
+
+namespace Tizen { namespace Shell
+{
+
+class _LiveboxFrameModel
+ : public Tizen::Base::Object
+{
+public:
+ _LiveboxFrameModel(void);
+ virtual ~_LiveboxFrameModel(void);
+
+public:
+ void SetProviderId(const Tizen::Base::String& providerId);
+ Tizen::Base::String GetProviderId(void) const;
+
+private:
+ _LiveboxFrameModel(const _LiveboxFrameModel& rhs);
+ _LiveboxFrameModel& operator =(const _LiveboxFrameModel& rhs);
+
+private:
+ Tizen::Base::String __providerId;
+}; // _LiveboxFrameModel
+
+}} // Tizen::Shell
+
+#endif // _FSHELL_INTERNAL_LIVEBOX_FRAME_MODEL_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file FShell_LiveboxFramePresenter.cpp
+ * @brief This is the implementation file for the _LiveboxFramePresenter class.
+ */
+
+#include <new>
+#include <FBaseSysLog.h>
+#include "FShell_LiveboxFramePresenter.h"
+#include "FShell_LiveboxFrame.h"
+#include "FShell_LiveboxFrameModel.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+
+namespace Tizen { namespace Shell
+{
+
+_LiveboxFramePresenter::_LiveboxFramePresenter(const _LiveboxFrame& liveboxFrame)
+ : __pLiveboxFrame(null)
+ , __pLiveboxFrameModel(new (std::nothrow) _LiveboxFrameModel)
+{
+ __pLiveboxFrame = const_cast <_LiveboxFrame*>(&liveboxFrame);
+}
+
+_LiveboxFramePresenter::~_LiveboxFramePresenter(void)
+{
+ __pLiveboxFrame = null;
+}
+
+result
+_LiveboxFramePresenter::Initialize(void)
+{
+ result r = E_SUCCESS;
+
+ return r;
+}
+
+void
+_LiveboxFramePresenter::SetProviderId(const String& providerId)
+{
+ __pLiveboxFrameModel->SetProviderId(providerId);
+}
+
+String
+_LiveboxFramePresenter::GetProviderId(void) const
+{
+ return __pLiveboxFrameModel->GetProviderId();
+}
+
+void
+_LiveboxFramePresenter::Draw(void)
+{
+}
+
+}} // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file FShell_LiveboxFramePresenter.h
+ * @brief This is the header file for the _LiveboxFramePresenter class.
+ *
+ * This header file contains the declarations of the %_LiveboxFramePresenter class.
+ */
+#ifndef _FSHELL_INTERNAL_LIVEBOX_FRAME_PRESENTER_H_
+#define _FSHELL_INTERNAL_LIVEBOX_FRAME_PRESENTER_H_
+
+#include <unique_ptr.h>
+
+namespace Tizen { namespace Shell
+{
+
+class _LiveboxFrame;
+class _LiveboxFrameModel;
+
+class _LiveboxFramePresenter
+{
+public:
+ _LiveboxFramePresenter(const _LiveboxFrame& liveboxFrame);
+ virtual ~_LiveboxFramePresenter(void);
+
+ result Initialize(void);
+ void SetProviderId(const Tizen::Base::String& providerId);
+ Tizen::Base::String GetProviderId(void) const;
+ void Draw(void);
+
+private:
+ _LiveboxFramePresenter(const _LiveboxFramePresenter& rhs);
+ _LiveboxFramePresenter& operator =(const _LiveboxFramePresenter& rhs);
+
+private:
+ _LiveboxFrame* __pLiveboxFrame;
+ std::unique_ptr<_LiveboxFrameModel> __pLiveboxFrameModel;
+}; // _LiveboxFramePresenter
+
+}} // Tizen::Shell
+
+#endif // _FSHELL_INTERNAL_LIVEBOX_FRAME_PRESENTER_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file FShell_LiveboxLayer.cpp
+ * @brief This is the implementation file for the _LiveboxLayer class.
+ */
+
+#include <new>
+#include <sys/shm.h>
+#include <X11/Xlib.h>
+#include <X11/extensions/XShm.h>
+#include <X11/Xutil.h>
+#include <Evas.h>
+#include <Ecore_X.h>
+#include <provider.h>
+#include <provider_buffer.h>
+#include <FBaseSysLog.h>
+#include <FBase_StringConverter.h>
+#include <FGrpRectangle.h>
+#include "FUi_Window.h"
+#include "FShell_LiveboxLayer.h"
+#include "FShell_LiveboxProviderManagerImpl.h"
+
+using namespace std;
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui::Animations;
+using namespace Tizen::Ui;
+using namespace Tizen::Shell;
+
+namespace
+{
+
+void*
+AllocRenderBuffer(void* pData, int size)
+{
+ _LiveboxLayer* pLiveboxLayer = static_cast<_LiveboxLayer*>(pData);
+ SysTryReturn(NID_UI_CTRL, pLiveboxLayer, null, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+
+ return pLiveboxLayer->AllocCanvas(size);
+}
+
+void
+FreeRenderBuffer(void* pData, void* pCanvas)
+{
+ SysTryReturnVoidResult(NID_UI_CTRL, pCanvas, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+
+ _LiveboxLayer* pLiveboxLayer = static_cast<_LiveboxLayer*>(pData);
+ SysTryReturnVoidResult(NID_UI_CTRL, pLiveboxLayer, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+
+ pLiveboxLayer->FreeCanvas(pCanvas);
+}
+
+void
+PostRender(void* pData, Evas* pEvas, void* pEventInfo)
+{
+ _LiveboxLayer* pLiveboxLayer = static_cast<_LiveboxLayer*>(pData);
+ SysTryReturnVoidResult(NID_UI_CTRL, pLiveboxLayer, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+
+ pLiveboxLayer->OnRendered();
+}
+
+}
+
+namespace Tizen { namespace Shell
+{
+
+_LiveboxLayer::_LiveboxLayer(const FloatDimension& size)
+ : __isReleased(false)
+ , __size(size)
+ , __pEcoreEvas(null)
+ , __pEvasObject(null)
+ , __providerId(L"")
+ , __pRenderBuffer(null)
+ , __bufferSize(0)
+ , __pixmapId(-1)
+{
+}
+
+_LiveboxLayer::~_LiveboxLayer(void)
+{
+ __pRenderBuffer = null;
+ __pixmapId = -1;
+}
+
+result
+_LiveboxLayer::OnConstructed(void)
+{
+ result r = E_SUCCESS;
+
+ unique_ptr<Ecore_Evas, _EcoreEvasDeleter> pEcoreEvas(ecore_evas_buffer_allocfunc_new(__size.width, __size.height, AllocRenderBuffer, FreeRenderBuffer, this));
+ SysTryReturn(NID_UI_CTRL, pEcoreEvas, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ ecore_evas_alpha_set(pEcoreEvas.get(), EINA_TRUE);
+ ecore_evas_manual_render_set(pEcoreEvas.get(), EINA_FALSE);
+ ecore_evas_resize(pEcoreEvas.get(), __size.width, __size.height);
+ ecore_evas_activate(pEcoreEvas.get());
+
+ Evas* pEvas = ecore_evas_get(pEcoreEvas.get());
+ SysTryReturn(NID_UI_CTRL, pEvas, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ evas_event_callback_add(pEvas, EVAS_CALLBACK_RENDER_FLUSH_POST, PostRender, this);
+
+ unique_ptr<Evas_Object, _EvasObjectDeleter> pEvasObject(evas_object_rectangle_add(pEvas));
+ SysTryReturn(NID_UI_CTRL, pEvasObject, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ evas_object_resize(pEvasObject.get(), __size.width, __size.height);
+ evas_object_color_set(pEvasObject.get(), 0, 0, 0, 255);
+
+ r = Initialize(pEvasObject.get());
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pEcoreEvas = move(pEcoreEvas);
+ __pEvasObject = move(pEvasObject);
+
+ ecore_evas_alpha_set(__pEcoreEvas.get(), EINA_TRUE);
+ evas_object_color_set(__pEvasObject.get(), 0, 0, 0, 0);
+
+ return r;
+}
+
+result
+_LiveboxLayer::SetProviderId(const String& providerId)
+{
+ __providerId = providerId;
+
+ __pixmapId = AcquirePixmap();
+ SysTryReturn(NID_UI_CTRL, __pixmapId != -1, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ SysLog(NID_UI_CTRL, "pixmapId (%d)", __pixmapId);
+
+ result r = RegisterTouchEventListener();
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
+String
+_LiveboxLayer::GetProviderId(void) const
+{
+ return __providerId;
+}
+
+int
+_LiveboxLayer::GetPixmapId(void) const
+{
+ return __pixmapId;
+}
+
+void
+_LiveboxLayer::SetLayerBounds(const FloatRectangle& bounds)
+{
+ __size = FloatDimension(bounds.width, bounds.height);
+
+ ecore_evas_resize(__pEcoreEvas.get(), __size.width, __size.height);
+
+// FloatRectangle fBounds(static_cast<float>(bounds.x), static_cast<float>(bounds.y), static_cast<float>(bounds.width), static_cast<float>(bounds.height));
+ SetBounds(bounds);
+}
+
+void*
+_LiveboxLayer::AllocCanvas(int size)
+{
+ SysTryReturn(NID_UI_CTRL, size > 0, null, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+
+ __bufferSize = size;
+ void* pBuffer = malloc(__bufferSize);
+ SysTryReturn(NID_UI_CTRL, pBuffer, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ __pRenderBuffer = pBuffer;
+
+ SysLog(NID_UI_CTRL, "buffer (0x%x) size (%d)", pBuffer, __bufferSize);
+
+ __isReleased = false;
+
+ return __pRenderBuffer;
+}
+
+void
+_LiveboxLayer::FreeCanvas(void* pCanvas)
+{
+ if (!__isReleased)
+ {
+ ReleasePixmap();
+ __isReleased = true;
+ }
+
+ if (pCanvas)
+ {
+ free(pCanvas);
+ }
+
+ __pixmapId = -1;
+ __pRenderBuffer = null;
+}
+
+result
+_LiveboxLayer::SyncPixmap(const FloatDimension& size)
+{
+ SysTryReturn(NID_UI_CTRL, __pRenderBuffer, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ SysLog(NID_UI_CTRL, "buffer (0x%x) size (%d) pixmapId (%d)", __pRenderBuffer, __bufferSize, __pixmapId);
+
+ Display* pDisplay = static_cast<Display*>(ecore_x_display_get());
+ SysTryReturn(NID_UI_CTRL, pDisplay, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ result r = E_SUCCESS;
+ XShmSegmentInfo xShmSegmentInfo;
+ XImage* pXImage = null;
+ GC gc;
+ Screen* pScreen = null;
+ Visual* pVisual = null;
+
+ xShmSegmentInfo.shmid = shmget(IPC_PRIVATE, __bufferSize, IPC_CREAT | 0666);
+ SysTryReturn(NID_UI_CTRL, xShmSegmentInfo.shmid >= 0, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ xShmSegmentInfo.readOnly = False;
+ xShmSegmentInfo.shmaddr = static_cast<char*>(shmat(xShmSegmentInfo.shmid, null, 0));
+ SysTryCatch(NID_UI_CTRL, xShmSegmentInfo.shmaddr != (void *)-1, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ pScreen = DefaultScreenOfDisplay(pDisplay);
+ SysTryCatch(NID_UI_CTRL, pScreen, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ pVisual = DefaultVisualOfScreen(pScreen);
+ SysTryCatch(NID_UI_CTRL, pVisual, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ // XCreatePixmap can only uses 24 bits depth only.
+ pXImage = XShmCreateImage(pDisplay, pVisual, 24, ZPixmap, null, &xShmSegmentInfo, size.width, size.height);
+ SysTryCatch(NID_UI_CTRL, pXImage, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ pXImage->data = xShmSegmentInfo.shmaddr;
+ XShmAttach(pDisplay, &xShmSegmentInfo);
+ XSync(pDisplay, False);
+
+ gc = XCreateGC(pDisplay, static_cast<Pixmap>(__pixmapId), 0, null);
+ SysTryCatch(NID_UI_CTRL, gc, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ memcpy(pXImage->data, __pRenderBuffer, __bufferSize);
+
+ // Do not send the event. Instead of X event, master will send the updated event to the viewer
+ XShmPutImage(pDisplay, static_cast<Pixmap>(__pixmapId), gc, pXImage, 0, 0, 0, 0, size.width, size.height, False);
+ XSync(pDisplay, False);
+
+ XFreeGC(pDisplay, gc);
+ XShmDetach(pDisplay, &xShmSegmentInfo);
+ XDestroyImage(pXImage);
+
+ if (xShmSegmentInfo.shmaddr != (void *)-1)
+ {
+ shmdt(xShmSegmentInfo.shmaddr);
+ }
+
+ if (xShmSegmentInfo.shmid >= 0)
+ {
+ shmctl(xShmSegmentInfo.shmid, IPC_RMID, 0);
+ }
+
+ return r;
+
+CATCH:
+
+ if (pDisplay)
+ {
+ XShmDetach(pDisplay, &xShmSegmentInfo);
+ }
+
+ if (pXImage)
+ {
+ XDestroyImage(pXImage);
+ }
+
+ if (xShmSegmentInfo.shmaddr != (void *)-1)
+ {
+ shmdt(xShmSegmentInfo.shmaddr);
+ }
+
+ if (xShmSegmentInfo.shmid >= 0)
+ {
+ shmctl(xShmSegmentInfo.shmid, IPC_RMID, 0);
+ }
+
+ return E_OUT_OF_MEMORY;
+}
+
+void
+_LiveboxLayer::OnRendered(void)
+{
+ if (__pixmapId == -1)
+ {
+ __pixmapId = AcquirePixmap();
+ SysTryReturnVoidResult(NID_UI_CTRL, __pixmapId >= 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+ }
+
+ result r = SyncPixmap(__size);
+ SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = Sync(__size);
+ SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+}
+
+result
+_LiveboxLayer::RegisterTouchEventListener(void)
+{
+ result r = _LiveboxProviderManagerImpl::GetInstance()->SetLiveboxTouchEventListener(__providerId, *this);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
+int
+_LiveboxLayer::AcquirePixmap(void)
+{
+ SysTryReturn(NID_UI_CTRL, !__providerId.IsEmpty(), -1, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+
+ int pixmapId = -1;
+
+ result r = _LiveboxProviderManagerImpl::GetInstance()->RequestSharedMemoryId(__providerId, __size.width, __size.height, pixmapId);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ SysLog(NID_UI_CTRL, "pixmapId(%d) size(%d %d)", pixmapId, __size.width, __size.height);
+
+ return pixmapId;
+}
+
+result
+_LiveboxLayer::Sync(const FloatDimension& size)
+{
+ SysTryReturn(NID_UI_CTRL, !__providerId.IsEmpty(), E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+
+ result r = _LiveboxProviderManagerImpl::GetInstance()->RequestSyncSharedMemory(__providerId, size.width, size.height);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
+void
+_LiveboxLayer::ReleasePixmap(void)
+{
+ SysTryReturnVoidResult(NID_UI_CTRL, !__providerId.IsEmpty(), E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+
+ _LiveboxProviderManagerImpl::GetInstance()->RequestReleaseSharedMemory(__providerId);
+}
+
+int
+_LiveboxLayer::OnTouchEventRecevied(int eventType, double timestamp, double x, double y)
+{
+ int xPos = __size.width * x;
+ int yPos = __size.height * y;
+
+ Evas* pEvas = ecore_evas_get(__pEcoreEvas.get());
+ SysTryReturn(NID_UI_CTRL, pEvas, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ switch (eventType)
+ {
+ case BUFFER_EVENT_ENTER:
+ evas_event_feed_mouse_in(pEvas, timestamp, null);
+ break;
+
+ case BUFFER_EVENT_LEAVE:
+ evas_event_feed_mouse_out(pEvas, timestamp, null);
+ break;
+
+ case BUFFER_EVENT_DOWN:
+ evas_event_feed_mouse_in(pEvas, timestamp, null);
+ evas_event_feed_mouse_move(pEvas, xPos, yPos, timestamp + 0.01f, null);
+ evas_event_feed_mouse_down(pEvas, 1, EVAS_BUTTON_NONE, timestamp + 0.02f, null);
+ break;
+
+ case BUFFER_EVENT_MOVE:
+ evas_event_feed_mouse_move(pEvas, xPos, yPos, timestamp, null);
+ break;
+
+ case BUFFER_EVENT_UP:
+ evas_event_feed_mouse_up(pEvas, 1, EVAS_BUTTON_NONE, timestamp, null);
+ evas_event_feed_mouse_out(pEvas, timestamp + 0.01f, null);
+ break;
+
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+
+}} // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file FShell_LiveboxFrame.h
+ * @brief This is the header file for the _LiveboxLayer class.
+ *
+ * This header file contains the declarations of the %_LiveboxLayer class.
+ */
+#ifndef _FSHELL_INTERNAL_LIVEBOX_LAYER_H_
+#define _FSHELL_INTERNAL_LIVEBOX_LAYER_H_
+
+#include <unique_ptr.h>
+#include <Ecore_Evas.h>
+#include <FBaseString.h>
+#include "FUiAnim_EflLayer.h"
+#include "FShell_ILiveboxTouchEventListener.h"
+
+namespace Tizen { namespace Ui
+{
+class _Window;
+}} // Tizen::Ui
+
+namespace Tizen { namespace Shell
+{
+
+/**
+ * @class _LiveboxLayer
+ * @brief
+ * @since 2.1
+ */
+class _LiveboxLayer
+ : public Tizen::Ui::Animations::_EflLayer
+ , public Tizen::Shell::_ILiveboxTouchEventListener
+{
+public:
+ _LiveboxLayer(const Tizen::Graphics::FloatDimension& size);
+ virtual ~_LiveboxLayer(void);
+
+ virtual result OnConstructed(void);
+
+ result SetProviderId(const Tizen::Base::String& providerId);
+ Tizen::Base::String GetProviderId(void) const;
+ int GetPixmapId(void) const;
+ void SetLayerBounds(const Tizen::Graphics::FloatRectangle& bounds);
+ void* AllocCanvas(int size);
+ void FreeCanvas(void* pCanvas);
+ int EventHandler(int eventType, double timestamp, double x, double y);
+ result SyncPixmap(const Tizen::Graphics::FloatDimension& size);
+ void OnRendered(void);
+
+ virtual result RegisterTouchEventListener(void);
+ virtual int AcquirePixmap(void);
+ virtual result Sync(const Tizen::Graphics::FloatDimension& size);
+ virtual void ReleasePixmap(void);
+ virtual int OnTouchEventRecevied(int eventType, double timestamp, double x, double y);
+
+private:
+ _LiveboxLayer(const _LiveboxLayer& rhs);
+ _LiveboxLayer& operator =(const _LiveboxLayer& rhs);
+
+protected:
+ bool __isReleased;
+ Tizen::Graphics::FloatDimension __size;
+
+private:
+ struct _EcoreEvasDeleter
+ {
+ void operator()(Ecore_Evas* pEcoreEvas)
+ {
+ ecore_evas_free(pEcoreEvas);
+ }
+ };
+
+ struct _EvasObjectDeleter
+ {
+ void operator()(Evas_Object* pEvasObject)
+ {
+ evas_object_del(pEvasObject);
+ }
+ };
+
+ std::unique_ptr<Ecore_Evas, _EcoreEvasDeleter> __pEcoreEvas;
+ std::unique_ptr<Evas_Object, _EvasObjectDeleter> __pEvasObject;
+ Tizen::Base::String __providerId;
+ void* __pRenderBuffer;
+ int __bufferSize;
+ int __pixmapId;
+};
+
+}} // Tizen::Shell
+
+#endif // _FSHELL_INTERNAL_LIVEBOX_LAYER_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShell_LiveboxManagerImpl.cpp
+ * @brief This is the implementation for the _LiveboxManagerImpl class.
+ */
+
+#include <unique_ptr.h>
+
+#include <shortcut.h>
+#include <livebox-service/livebox-service.h>
+
+#include <FBaseSysLog.h>
+#include <FBase.h>
+#include <FApp.h>
+#include <FGrpDimension.h>
+#include <FApp_AppImpl.h>
+#include <FBase_StringConverter.h>
+
+#include <FShellLiveboxProviderInfo.h>
+#include <FShellLiveboxProvider.h>
+#include <FShellLiveboxPopupProvider.h>
+#include <FShellLiveboxFrame.h>
+#include <FShellLiveboxPopup.h>
+
+#include <FShellILiveboxAddRequestListener.h>
+#include <FShellILiveboxProviderFactory.h>
+#include <FShellILiveboxPopupProviderFactory.h>
+
+#include <FShell_ILiveboxTouchEventListener.h>
+#include <FShell_TemplateUtil.h>
+
+#include "FShell_ShortcutManagerImpl.h"
+#include "FShell_LiveboxManagerProxy.h"
+#include "FShell_LiveboxManagerImpl.h"
+#include "FShell_LiveboxProviderInfoImpl.h"
+
+namespace Tizen { namespace Shell
+{
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::App;
+using namespace Tizen::Graphics;
+
+_LiveboxManagerImpl::_LiveboxManagerImpl()
+ :__pLiveboxRequestEventListener(null)
+{
+ SysLog(NID_APP, "");
+}
+
+_LiveboxManagerImpl::~_LiveboxManagerImpl()
+{
+ SysLog(NID_APP, "");
+ livebox_service_fini();
+}
+
+_LiveboxManagerImpl*
+_LiveboxManagerImpl::GetInstance()
+{
+ static _LiveboxManagerImpl* __pLiveboxManagerImpl = null;
+ if( __pLiveboxManagerImpl == null)
+ {
+ __pLiveboxManagerImpl = new (std::nothrow)_LiveboxManagerImpl;
+ SysTryReturn(NID_APP, __pLiveboxManagerImpl, null, E_OUT_OF_MEMORY, "Allocating new _LiveboxManagerProxy failed.");
+
+ result r = __pLiveboxManagerImpl->Construct();
+ SysTryReturn(NID_APP, !IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ return __pLiveboxManagerImpl;
+}
+
+result
+_LiveboxManagerImpl::Construct()
+{
+ SysLog(NID_APP, "Enter.");
+
+ int ret = livebox_service_init();
+ SysTryReturnResult(NID_APP, ret == 0, E_SYSTEM, "[E_SYSTEM] Failed to invoke livebox_service_init, ret (%d)", ret);
+
+ SysLog(NID_APP, "Exit.");
+ return E_SUCCESS;
+}
+
+// c style callback for livebox_service_get_pkglist
+int GetLiveboxProviderInfoCallback(const char *packageId, const char *pProviderId, int is_prime, void *data)
+{
+ SysLog(NID_APP, "%s, %s", packageId, pProviderId);
+
+ IList* pLiveboxProviderInfos = static_cast<IList*>(data);
+ SysTryReturn(NID_APP, pLiveboxProviderInfos, 0, E_SYSTEM, "[E_SYSTEM] system error.");
+
+ String providerId(pProviderId);
+ String appId;
+ String providerName;
+ _LiveboxManagerImpl::ExtractAppIdAndProviderName(providerId, appId, providerName);
+
+ LiveboxProviderInfo* pInfo = _LiveboxProviderInfoImpl::GetLiveboxProviderInfoN(appId, providerName, is_prime);
+ pLiveboxProviderInfos->Add(*pInfo);
+
+ return 0;
+}
+
+Tizen::Base::Collection::IList*
+_LiveboxManagerImpl::GetLiveboxProviderInfoListN()
+{
+ std::unique_ptr<ArrayList> pLiveboxProviders(new (std::nothrow) ArrayList());
+ SysTryReturn(NID_APP, pLiveboxProviders.get(), null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
+
+ pLiveboxProviders->Construct();
+ int ret = livebox_service_get_pkglist(GetLiveboxProviderInfoCallback, pLiveboxProviders.get());
+ if (ret < 0)
+ {
+ SysLog(NID_APP, "Failed to invoke livebox_service_get_pkglist, ret (%d)", ret);
+ }
+
+ if (pLiveboxProviders->GetCount() <= 0)
+ {
+ return null;
+ }
+
+ return pLiveboxProviders.release();
+}
+
+LiveboxProviderInfo*
+_LiveboxManagerImpl::GetLiveboxProviderInfoN(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName)
+{
+ return _LiveboxProviderInfoImpl::GetLiveboxProviderInfoN(appId, providerName);
+}
+
+const int PROVIDER_NAME_MAX = 256;
+char __tempDefaultProviderResult[PROVIDER_NAME_MAX];
+
+// c style callback for livebox_service_get_pkglist
+int GetDefaultLiveboxProviderInfoCallback(const char *packageId, const char *pProviderId, int is_prime, void *data)
+{
+ SysLog(NID_APP, "%s, %s", packageId, pProviderId);
+ char* pInputProviderId = static_cast<char*>(data);
+ SysTryReturn(NID_APP, pInputProviderId, 0, E_SYSTEM, "[E_SYSTEM] system error.");
+
+ if( strncmp(packageId, pInputProviderId, PROVIDER_NAME_MAX) == 0)
+ {
+ strncpy(__tempDefaultProviderResult, pProviderId, PROVIDER_NAME_MAX);
+ return -1;
+ }
+
+ return 0;
+}
+
+LiveboxProviderInfo*
+_LiveboxManagerImpl::GetDefaultLiveboxProviderInfoN(const Tizen::App::PackageId& packageId)
+{
+ memset(__tempDefaultProviderResult, 0, sizeof(__tempDefaultProviderResult));
+
+ LiveboxProviderInfo* pInfo = null;
+ std::unique_ptr<char[]> pPackageId(_StringConverter::CopyToCharArrayN(packageId));
+
+ int ret = livebox_service_get_pkglist(GetDefaultLiveboxProviderInfoCallback, pPackageId.get());
+ if (ret < 0)
+ {
+ SysLog(NID_APP, "There is no Livebox provider specifed, or It's failed to invoke livebox_service_get_pkglist, ret (%d)", ret);
+ return null;
+ }
+
+ String defaultProvider(__tempDefaultProviderResult);
+ if( !defaultProvider.IsEmpty())
+ {
+ String appId;
+ String providerName;
+ _LiveboxManagerImpl::ExtractAppIdAndProviderName(__tempDefaultProviderResult, appId, providerName);
+
+ pInfo = _LiveboxProviderInfoImpl::GetLiveboxProviderInfoN(appId, providerName, true);
+ }
+ return pInfo;
+}
+
+
+bool __isDefault;
+// c style callback for livebox_service_get_pkglist
+int IsLiveboxProviderDefaultInfoCallback(const char *packageId, const char *pProviderId, int is_prime, void *data)
+{
+ __isDefault = false;
+ SysLog(NID_APP, "%s, %s", packageId, pProviderId);
+ char* pInputProviderId = static_cast<char*>(data);
+ SysTryReturn(NID_APP, pInputProviderId, 0, E_SYSTEM, "[E_SYSTEM] system error.");
+
+ if( strncmp(packageId, pInputProviderId, 256) == 0)
+ {
+ __isDefault = is_prime;
+ return -1;
+ }
+
+ return 0;
+}
+
+bool
+_LiveboxManagerImpl::IsLiveboxProviderDefault(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName)
+{
+ __isDefault = false;
+
+ std::unique_ptr<char[]> pPackageId(_StringConverter::CopyToCharArrayN(_LiveboxManagerImpl::MakeProviderName(appId, providerName)));
+
+ int ret = livebox_service_get_pkglist(IsLiveboxProviderDefaultInfoCallback, pPackageId.get());
+ if (ret < 0)
+ {
+ SysLog(NID_APP, "Failed to invoke livebox_service_get_pkglist, ret (%d)", ret);
+ }
+
+ return __isDefault;
+}
+
+// c - style callback for shortcut_set_request_cb
+int LiveboxRequestHandlerCallback(const char* providerId, const char* text, int type, const char* content_info, const char* icon, int pid, double period, void *data)
+{
+ SysLog(NID_APP, "Enter");
+ SysTryReturn(NID_APP, providerId, 0, E_SYSTEM, "[E_SYSTEM] providerId is null!");
+
+ _LiveboxManagerImpl* pLiveboxManager = static_cast<_LiveboxManagerImpl*>(data);
+ SysTryReturn(NID_APP, pLiveboxManager, 0, E_SYSTEM, "[E_SYSTEM] pLiveboxManager is null!");
+
+ String appId;
+ String providerName;
+ _LiveboxManagerImpl::ExtractAppIdAndProviderName(providerId, appId, providerName);
+
+ ILiveboxAddRequestListener* pListener = _LiveboxManagerImpl::GetInstance()->GetAddRequestListener();
+ SysTryReturn(NID_APP, pLiveboxManager, 0, E_SYSTEM, "[E_SYSTEM] pListener is null!");
+ pListener->OnLiveboxAddRequested(appId, providerName, text, content_info);
+ return 0;
+}
+
+result
+_LiveboxManagerImpl::SetLiveboxAddRequestListener(ILiveboxAddRequestListener* pListener)
+{
+// int ret = shortcut_set_request_cb(LiveboxRequestHandlerCallback, this );
+// SysTryReturnResult(NID_APP, ret == 0, E_SYSTEM, "failed to shortcut_set_request_cb (%d)", ret);
+ _ShortcutManagerImpl::GetInstance()->SetLiveboxRequestHandlerCallback(LiveboxRequestHandlerCallback);
+
+ __pLiveboxRequestEventListener = pListener;
+ return E_SUCCESS;
+}
+
+ILiveboxAddRequestListener*
+_LiveboxManagerImpl::GetAddRequestListener()
+{
+ return __pLiveboxRequestEventListener;
+}
+
+// helper
+result
+_LiveboxManagerImpl::ExtractAppIdAndProviderName(const Tizen::Base::String& providerId, Tizen::App::AppId& appId, Tizen::Base::String& providerName)
+{
+ if( providerId.StartsWith("com.samsung", 0) == true)// for core livebox (plugin)
+ {
+ appId = providerId;
+ providerName = L"";
+ }
+ else
+ {
+ int index = 0;
+
+ providerId.IndexOf(".", 11, index);
+ providerId.SubString(0, index, appId);
+ providerId.SubString(index+1, providerName);
+ }
+
+ return E_SUCCESS;
+}
+
+String
+_LiveboxManagerImpl::MakeProviderName(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName)
+{
+ String providerId;
+
+ if( appId.StartsWith("com.samsung", 0) == true)// for core livebox (plugin)
+ {
+ // or providerName.IsEmpty()
+ providerId = appId;
+ }
+ else
+ {
+ // for web
+ if (appId.IsEmpty())
+ {
+ providerId.Format(128, L"%ls", providerName.GetPointer() );
+ }
+ else
+ {
+ providerId.Format(128, L"%ls.%ls", appId.GetPointer(), providerName.GetPointer() );
+ }
+ }
+
+ return providerId;
+}
+
+}} // Tizen::Shell
//
// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
//
-// Licensed under the Apache License, Version 2.0 (the License);
+// Licensed under the Flora License, Version 1.0 (the License);
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
-// http://www.apache.org/licenses/LICENSE-2.0
+// http://floralicense.org/license/
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
//
/**
- * @file FShell_NotificationManagerIpcMessages.cpp
+ * @file FShell_LiveboxManagerIpcMessage.cpp
* @brief This file contains IPC message class generated by macros.
*/
#define IPC_MESSAGE_IMPL
-#include "FShell_NotificationManagerIpcMessages.h"
+#include "FShell_LiveboxManagerIpcMessage.h"
// Generate constructors.
#include "ipc/struct_constructor_macros.h"
-#include "FShell_NotificationManagerIpcMessages.h"
+#include "FShell_LiveboxManagerIpcMessage.h"
// Generate destructors.
#include "ipc/struct_destructor_macros.h"
-#include "FShell_NotificationManagerIpcMessages.h"
+#include "FShell_LiveboxManagerIpcMessage.h"
// Generate param traits write methods.
#include "ipc/param_traits_write_macros.h"
namespace IPC
{
-#include "FShell_NotificationManagerIpcMessages.h"
+#include "FShell_LiveboxManagerIpcMessage.h"
} // namespace IPC
// Generate param traits read methods.
#include "ipc/param_traits_read_macros.h"
namespace IPC
{
-#include "FShell_NotificationManagerIpcMessages.h"
+#include "FShell_LiveboxManagerIpcMessage.h"
} // namespace IPC
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShell_LiveboxManagerProxy.cpp
+ * @brief This is the implementation for the _LiveboxManagerProxy class.
+ */
+
+#include <FIo_IpcClient.h>
+#include <FShell_LiveboxManagerIpcMessage.h>
+#include "FShell_LiveboxProviderManagerImpl.h"
+#include "FShell_LiveboxManagerProxy.h"
+
+namespace Tizen { namespace Shell {
+
+namespace
+{
+const char IPC_SERVER_NAME[] = "osp.shell.ipcserver.liveboxmanager";
+};
+
+using namespace Tizen::Io;
+
+
+_LiveboxManagerProxy::_LiveboxManagerProxy()
+ : __pIpcClient(null)
+{
+ SysLog(NID_APP, "");
+}
+
+_LiveboxManagerProxy::~_LiveboxManagerProxy()
+{
+ delete __pIpcClient;
+}
+
+_LiveboxManagerProxy*
+_LiveboxManagerProxy::GetInstance()
+{
+ static std::unique_ptr<_LiveboxManagerProxy> __pLiveboxProxy(null);
+ if( __pLiveboxProxy.get() == null)
+ {
+ std::unique_ptr<_LiveboxManagerProxy> pLiveboxProxy(new (std::nothrow)_LiveboxManagerProxy);
+ SysTryReturn(NID_APP, pLiveboxProxy.get(), null, E_OUT_OF_MEMORY, "Allocating new _LiveboxManagerProxy failed!");
+
+ result r = pLiveboxProxy->Construct();
+ SysTryReturn(NID_APP, !IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pLiveboxProxy = std::move(pLiveboxProxy);
+ }
+
+ return __pLiveboxProxy.get();
+}
+
+result
+_LiveboxManagerProxy::Construct(void)
+{
+ SysLog(NID_APP, "Enter.");
+
+ __pIpcClient = new (std::nothrow) _IpcClient();
+ SysTryReturnResult(NID_APP, __pIpcClient != null, E_OUT_OF_MEMORY, "_IpcClient creation failed.");
+
+ result r = __pIpcClient->Construct(IPC_SERVER_NAME, this);
+ SysTryReturn(NID_APP, !IsFailed(r), r, r, "_IpcClient constructing faliied [%s].", GetErrorMessage(r));
+
+ SysLog(NID_APP, "Exit.");
+ return E_SUCCESS;
+}
+
+result
+_LiveboxManagerProxy::RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument)
+{
+ SysTryReturnResult(NID_APP, __pIpcClient != null, E_INVALID_STATE, "__pIpcClient instance must not be null.");
+ SysLog(NID_APP, "Enter.");
+// String providerId;
+// if( providerName.IsEmpty() == true)
+// {
+// providerId = appId;
+// }
+// else
+// {
+// providerId = appId + "." + providerName;
+// }
+
+ result ret = E_SUCCESS;
+ std::auto_ptr<IPC::Message> pMsg (new (std::nothrow) LiveboxManager_RequestUpdate(appId, providerName, argument, &ret));
+ result r = __pIpcClient->SendRequest(*pMsg.get());
+ SysTryReturn(NID_APP, !IsFailed(r), r, r, "SendRequest is failed.");
+
+ return ret;
+}
+
+result
+_LiveboxManagerProxy::RequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument)
+{
+ SysTryReturnResult(NID_APP, __pIpcClient != null, E_INVALID_STATE, "__pIpcClient instance must not be null.");
+ SysLog(NID_APP, "Enter.");
+
+ result ret = E_SUCCESS;
+ std::auto_ptr<IPC::Message> pMsg (new (std::nothrow) LiveboxManager_RequestUpdateInstance(instanceId, argument, &ret));
+ result r = __pIpcClient->SendRequest(*pMsg.get());
+ SysTryReturn(NID_APP, !IsFailed(r), r, r, "SendRequest is failed.");
+
+ return ret;
+}
+
+result
+_LiveboxManagerProxy::RequestSharedMemoryId(const Tizen::Base::String& instanceId, int width, int height, int& shmId )
+{
+ SysTryReturnResult(NID_APP, __pIpcClient != null, E_INVALID_STATE, "__pIpcClient instance must not be null.");
+
+ std::auto_ptr<IPC::Message> pMsg (new (std::nothrow) LiveboxManager_RequestSharedMemoryId(instanceId, width, height, &shmId));
+ result r = __pIpcClient->SendRequest(*pMsg.get());
+ SysTryReturn(NID_APP, !IsFailed(r), r, r, "SendRequest is failed.");
+ SysLog(NID_APP, "shmId(%d) is retrieved from livebox-service", shmId);
+
+ return E_SUCCESS;
+}
+
+result
+_LiveboxManagerProxy::RequestSharedMemoryIdForPD(const Tizen::Base::String& instanceId, int width, int height, int& shmId )
+{
+ SysTryReturnResult(NID_APP, __pIpcClient != null, E_INVALID_STATE, "__pIpcClient instance must not be null.");
+
+ std::auto_ptr<IPC::Message> pMsg (new (std::nothrow) LiveboxManager_RequestSharedMemoryIdForPD(instanceId, width, height, &shmId));
+ result r = __pIpcClient->SendRequest(*pMsg.get());
+ SysTryReturn(NID_APP, !IsFailed(r), r, r, "SendRequest is failed.");
+ SysLog(NID_APP, "shmId(%d) is retrieved from livebox-service", shmId);
+
+ return E_SUCCESS;
+}
+
+result
+_LiveboxManagerProxy::RequestSyncSharedMemory(const Tizen::Base::String& instanceId, int width, int height)
+{
+ SysTryReturnResult(NID_APP, __pIpcClient != null, E_INVALID_STATE, "__pIpcClient instance must not be null.");
+ SysLog(NID_APP, "");
+
+ result ret = E_FAILURE;
+ std::auto_ptr<IPC::Message> pMsg (new (std::nothrow) LiveboxManager_RequestSyncSharedMemory(instanceId, width, height, &ret));
+ result r = __pIpcClient->SendRequest(*pMsg.get());
+ SysTryReturn(NID_APP, !IsFailed(r), r, r, "SendRequest is failed.");
+ return E_SUCCESS;
+}
+
+result
+_LiveboxManagerProxy::RequestSyncSharedMemoryForPD(const Tizen::Base::String& instanceId)
+{
+ SysTryReturnResult(NID_APP, __pIpcClient != null, E_INVALID_STATE, "__pIpcClient instance must not be null.");
+ SysLog(NID_APP, "");
+
+ result ret = E_FAILURE;
+ std::auto_ptr<IPC::Message> pMsg (new (std::nothrow) LiveboxManager_RequestSyncSharedMemoryForPD(instanceId, &ret));
+ result r = __pIpcClient->SendRequest(*pMsg.get());
+ SysTryReturn(NID_APP, !IsFailed(r), r, r, "SendRequest is failed.");
+ return E_SUCCESS;
+}
+
+result
+_LiveboxManagerProxy::RequestReleaseSharedMemory(const Tizen::Base::String& instanceId)
+{
+ SysTryReturnResult(NID_APP, __pIpcClient != null, E_INVALID_STATE, "__pIpcClient instance must not be null.");
+ SysLog(NID_APP, "");
+
+ result ret = E_FAILURE;
+ std::auto_ptr<IPC::Message> pMsg (new (std::nothrow) LiveboxManager_RequestReleaseSharedMemory(instanceId, &ret));
+ result r = __pIpcClient->SendRequest(*pMsg.get());
+ SysTryReturn(NID_APP, !IsFailed(r), r, r, "SendRequest is failed.");
+ return E_SUCCESS;
+}
+
+result
+_LiveboxManagerProxy::RequestReleaseSharedMemoryForPD(const Tizen::Base::String& instanceId)
+{
+ SysTryReturnResult(NID_APP, __pIpcClient != null, E_INVALID_STATE, "__pIpcClient instance must not be null.");
+ SysLog(NID_APP, "");
+
+ result ret = E_FAILURE;
+ std::auto_ptr<IPC::Message> pMsg (new (std::nothrow) LiveboxManager_RequestReleaseSharedMemoryForPD(instanceId, &ret));
+ result r = __pIpcClient->SendRequest(*pMsg.get());
+ SysTryReturn(NID_APP, !IsFailed(r), r, r, "SendRequest is failed.");
+ return E_SUCCESS;
+}
+
+
+result
+_LiveboxManagerProxy::OnTouchEventReceived(const Tizen::Base::String& instanceId, int eventType, double timeStamp, double x, double y )
+{
+ return _LiveboxProviderManagerImpl::GetInstance()->ForwardTouchEvent(instanceId, eventType, timeStamp, x, y);
+}
+
+result
+_LiveboxManagerProxy::OnTouchEventReceivedForPD(const Tizen::Base::String& instanceId, int eventType, double timeStamp, double x, double y )
+{
+ return _LiveboxProviderManagerImpl::GetInstance()->ForwardTouchEventForPD(instanceId, eventType, timeStamp, x, y);
+}
+
+void
+_LiveboxManagerProxy::OnIpcResponseReceived(_IpcClient& client, const IPC::Message& message)
+{
+ SysLog(NID_APP, "Enter.");
+ IPC_BEGIN_MESSAGE_MAP(_LiveboxManagerProxy, message)
+ IPC_MESSAGE_HANDLER_EX(LiveboxManager_SendTouchEvent, &client, OnTouchEventReceived )
+ IPC_MESSAGE_HANDLER_EX(LiveboxManager_SendTouchEventForPD, &client, OnTouchEventReceivedForPD )
+ IPC_END_MESSAGE_MAP()
+
+ SysLog(NID_APP, "Exit.");
+}
+
+}} // Tizen::Shell
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Flora License, Version 1.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://floralicense.org/license/\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+/**\r
+ * @file FShell_LiveboxPopup.cpp\r
+ * @brief This is the implementation file for the _LiveboxPopup class.\r
+ */\r
+\r
+#include <new>\r
+#include <Evas.h>\r
+#include <Ecore_Evas.h>\r
+#include <provider.h>\r
+#include <provider_buffer.h>\r
+#include <FBaseSysLog.h>\r
+#include <FSysSystemTime.h>\r
+#include <FBase_StringConverter.h>\r
+#include "FUi_UiKeyEvent.h"\r
+#include "FUi_IUiEventManager.h"\r
+#include "FUi_UiEventManager.h"\r
+#include "FUi_ResourceManager.h"\r
+#include "FUiAnim_DisplayManager.h"\r
+#include "FUiAnim_RootVisualElement.h"\r
+#include "FShell_LiveboxLayer.h"\r
+#include "FShell_LiveboxPopup.h"\r
+#include "FShell_LiveboxPopupPresenter.h"\r
+#include "FShell_LiveboxProviderManagerImpl.h"\r
+\r
+using namespace std;\r
+using namespace Tizen::Base;\r
+using namespace Tizen::Graphics;\r
+using namespace Tizen::System;\r
+using namespace Tizen::Ui;\r
+using namespace Tizen::Ui::Animations;\r
+using namespace Tizen::Ui::Controls;\r
+\r
+namespace Tizen { namespace Shell\r
+{\r
+\r
+class _LiveboxPopupLayer\r
+ : public _LiveboxLayer\r
+{\r
+public:\r
+ _LiveboxPopupLayer(const FloatDimension& size);\r
+ virtual ~_LiveboxPopupLayer(void);\r
+\r
+private:\r
+ _LiveboxPopupLayer(const _LiveboxPopupLayer& rhs);\r
+ _LiveboxPopupLayer& operator =(const _LiveboxPopupLayer& rhs);\r
+\r
+ virtual result RegisterTouchEventListener(void);\r
+ virtual int AcquirePixmap(void);\r
+ virtual result Sync(const FloatDimension& size);\r
+ virtual void ReleasePixmap(void);\r
+};\r
+\r
+_LiveboxPopupLayer::_LiveboxPopupLayer(const FloatDimension& size)\r
+ : _LiveboxLayer(size)\r
+{\r
+}\r
+\r
+_LiveboxPopupLayer::~_LiveboxPopupLayer(void)\r
+{\r
+ if (!__isReleased)\r
+ {\r
+ ReleasePixmap();\r
+ __isReleased = true;\r
+ }\r
+}\r
+\r
+result\r
+_LiveboxPopupLayer::RegisterTouchEventListener(void)\r
+{\r
+ result r = _LiveboxProviderManagerImpl::GetInstance()->SetLiveboxPopupEventListener(*this);\r
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ return r;\r
+}\r
+\r
+int\r
+_LiveboxPopupLayer::AcquirePixmap(void)\r
+{\r
+ long long ticks = 0;\r
+ SystemTime::GetTicks(ticks);\r
+ SysLog(NID_UI_CTRL, "%lld", ticks);\r
+\r
+ int pixmapId = -1;\r
+\r
+ result r = _LiveboxProviderManagerImpl::GetInstance()->RequestSharedMemoryIdForPD(GetProviderId(), __size.width, __size.height, pixmapId);\r
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ SystemTime::GetTicks(ticks);\r
+ SysLog(NID_UI_CTRL, "%lld", ticks);\r
+\r
+ SysLog(NID_UI_CTRL, "pixmapId(%d) size(%d %d)", pixmapId, __size.width, __size.height);\r
+\r
+ return pixmapId;\r
+}\r
+\r
+result\r
+_LiveboxPopupLayer::Sync(const FloatDimension& size)\r
+{\r
+ result r = _LiveboxProviderManagerImpl::GetInstance()->RequestSyncSharedMemoryForPD(GetProviderId());\r
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ return r;\r
+}\r
+\r
+void\r
+_LiveboxPopupLayer::ReleasePixmap(void)\r
+{\r
+ _LiveboxProviderManagerImpl::GetInstance()->RequestReleaseSharedMemoryForPD(GetProviderId());\r
+}\r
+\r
+_LiveboxPopup::_LiveboxPopup(void)\r
+ : __pLiveboxPopupPresenter(new (std::nothrow) _LiveboxPopupPresenter(*this))\r
+ , __pLiveboxPopupLayer(null)\r
+ , __pLiveboxPopupRootVisualElement(null)\r
+ , __pEventManager(null)\r
+{\r
+ SysTryReturnVoidResult(NID_UI_CTRL, __pLiveboxPopupPresenter, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");\r
+\r
+ _UiEventManager* pEventManager = _UiEventManager::GetInstance();\r
+ SysTryReturnVoidResult(NID_UI_CTRL, pEventManager, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");\r
+\r
+ __pEventManager = pEventManager->GetEventManager();\r
+ SysTryReturnVoidResult(NID_UI_CTRL, __pEventManager, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");\r
+}\r
+\r
+_LiveboxPopup::~_LiveboxPopup(void)\r
+{\r
+ if (__pEventManager)\r
+ {\r
+ __pEventManager->UnregisterTouchEventHandler(*this);\r
+ }\r
+\r
+ __pLiveboxPopupLayer = null;\r
+ __pLiveboxPopupRootVisualElement = null;\r
+}\r
+\r
+_LiveboxPopup*\r
+_LiveboxPopup::CreateLiveboxPopupN(void)\r
+{\r
+ unique_ptr<_LiveboxPopup> pLiveboxPopup(new (std::nothrow) _LiveboxPopup());\r
+ SysTryReturn(NID_UI_CTRL, pLiveboxPopup, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");\r
+\r
+ result r = GetLastResult();\r
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ pLiveboxPopup->AcquireHandle();\r
+\r
+ SetLastResult(E_SUCCESS);\r
+\r
+ return pLiveboxPopup.release();\r
+}\r
+\r
+result\r
+_LiveboxPopup::Initialize(const FloatDimension& size)\r
+{\r
+ long long ticks = 0;\r
+ SystemTime::GetTicks(ticks);\r
+\r
+ SysLog(NID_UI_CTRL, "(%d %d) %lld", size.width, size.height, ticks);\r
+\r
+ result r = E_SUCCESS;\r
+\r
+ __liveboxSize = size;\r
+\r
+ SetSystemWindow(true);\r
+\r
+ r = CreateRootVisualElement();\r
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ FloatRectangle bounds(0.0f, 0.0f, size.width, size.height);\r
+ r = SetBounds(bounds);\r
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ r = __pLiveboxPopupPresenter->Initialize();\r
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ __pLiveboxPopupLayer->SetLayerBounds(bounds);\r
+ __pLiveboxPopupLayer->SetShowState(false);\r
+\r
+ __pLiveboxPopupRootVisualElement->SetImplicitAnimationEnabled(false);\r
+ __pLiveboxPopupRootVisualElement->SetName(L"_LiveboxPopup");\r
+ __pLiveboxPopupRootVisualElement->SetBounds(bounds);\r
+ __pLiveboxPopupRootVisualElement->SetShowState(false);\r
+\r
+ SetBackgroundColor(Color(0, 0, 0, 0));\r
+\r
+ __pEventManager->RegisterTouchEventHandler(*this);\r
+ r = GetLastResult();\r
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ return r;\r
+}\r
+\r
+result\r
+_LiveboxPopup::SetProviderId(const String& providerId)\r
+{\r
+ __pLiveboxPopupPresenter->SetProviderId(providerId);\r
+\r
+ result r = __pLiveboxPopupLayer->SetProviderId(providerId);\r
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ return r;\r
+}\r
+\r
+String\r
+_LiveboxPopup::GetProviderId(void) const\r
+{\r
+ return __pLiveboxPopupPresenter->GetProviderId();\r
+}\r
+\r
+void\r
+_LiveboxPopup::SetAnchorPosition(const FloatPoint& position)\r
+{\r
+ return __pLiveboxPopupPresenter->SetAnchorPosition(position);\r
+}\r
+\r
+FloatPoint\r
+_LiveboxPopup::GetAnchorPosition(void) const\r
+{\r
+ return __pLiveboxPopupPresenter->GetAnchorPosition();\r
+}\r
+\r
+Canvas*\r
+_LiveboxPopup::GetClientAreaCanvasN(void) const\r
+{\r
+ Canvas* pCanvas = GetCanvasN(GetClientBoundsF());\r
+ result r = GetLastResult();\r
+ SysTryReturn(NID_UI_CTRL, pCanvas, null, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ return pCanvas;\r
+}\r
+\r
+FloatPoint\r
+_LiveboxPopup::TranslateToClientAreaPosition(const FloatPoint& controlPosition) const\r
+{\r
+ FloatRectangle leftTop = GetClientBoundsF();\r
+\r
+ return FloatPoint(controlPosition.x - leftTop.x, controlPosition.y - leftTop.y);\r
+}\r
+\r
+FloatPoint\r
+_LiveboxPopup::TranslateToControlPosition(const FloatPoint& clientPosition) const\r
+{\r
+ FloatRectangle leftTop = GetClientBoundsF();\r
+\r
+ return FloatPoint(clientPosition.x + leftTop.x, clientPosition.y + leftTop.y);\r
+}\r
+\r
+result\r
+_LiveboxPopup::SetLayerShowState(bool showState)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ if (__pLiveboxPopupRootVisualElement)\r
+ {\r
+ _LiveboxPopupLayer* pLayer = dynamic_cast<_LiveboxPopupLayer*>(__pLiveboxPopupRootVisualElement->GetNativeLayer());\r
+ SysTryReturn(NID_UI_CTRL, pLayer, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");\r
+\r
+ r = pLayer->SetShowState(showState);\r
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ __pLiveboxPopupRootVisualElement->SetShowState(showState);\r
+ }\r
+\r
+ return r;\r
+}\r
+\r
+result\r
+_LiveboxPopup::SetLayerBounds(const FloatRectangle& bounds)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ if (__pLiveboxPopupRootVisualElement)\r
+ {\r
+ _LiveboxPopupLayer* pLayer = dynamic_cast<_LiveboxPopupLayer*>(__pLiveboxPopupRootVisualElement->GetNativeLayer());\r
+ r = GetLastResult();\r
+ SysTryReturn(NID_UI_CTRL, pLayer, r, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ pLayer->SetLayerBounds(bounds);\r
+ __pLiveboxPopupRootVisualElement->SetBounds(bounds);\r
+ }\r
+\r
+ return r;\r
+}\r
+\r
+FloatRectangle\r
+_LiveboxPopup::GetLiveboxPopupClientBounds(void) const\r
+{\r
+ int leftMargin = 0;\r
+ int rightMargin = 0;\r
+ int topMargin = 0;\r
+ int bottomMargin = 0;\r
+ _ControlOrientation orientation = GetOrientation();\r
+\r
+ GET_SHAPE_CONFIG(LIVEBOX::POPUP_LEFT_MARGIN, orientation, leftMargin);\r
+ GET_SHAPE_CONFIG(LIVEBOX::POPUP_RIGHT_MARGIN, orientation, rightMargin);\r
+ GET_SHAPE_CONFIG(LIVEBOX::POPUP_TOP_MARGIN, orientation, topMargin);\r
+ GET_SHAPE_CONFIG(LIVEBOX::POPUP_BOTTOM_MARGIN, orientation, bottomMargin);\r
+\r
+ FloatRectangle bounds = GetBoundsF();\r
+\r
+ FloatRectangle clientBounds(bounds.x + leftMargin, bounds.y + topMargin, bounds.width - leftMargin - rightMargin, bounds.height - topMargin - bottomMargin);\r
+\r
+ SysLog(NID_UI_CTRL, "[%d %d %d %d]", clientBounds.x, clientBounds.y, clientBounds.width, clientBounds.height);\r
+\r
+ return clientBounds;\r
+}\r
+\r
+result\r
+_LiveboxPopup::CreateLayer(void)\r
+{\r
+ unique_ptr<_LiveboxPopupLayer> pLayer(new (std::nothrow) _LiveboxPopupLayer(__liveboxSize));\r
+ SysTryReturn(NID_UI_CTRL, pLayer, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");\r
+\r
+ result r = pLayer->Construct();\r
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ __pLiveboxPopupLayer = pLayer.release();\r
+ __pLiveboxPopupRootVisualElement = __pLiveboxPopupLayer->GetRootVisualElement();\r
+\r
+ SetLayer(*__pLiveboxPopupLayer);\r
+ SetRootVisualElement(*__pLiveboxPopupRootVisualElement);\r
+\r
+ return r;\r
+}\r
+\r
+void\r
+_LiveboxPopup::OnActivated(void)\r
+{\r
+ result r = SetLayerShowState(true);\r
+ SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));\r
+}\r
+\r
+void\r
+_LiveboxPopup::OnBoundsChanged(void)\r
+{\r
+ SetLayerBounds(GetBoundsF());\r
+\r
+ SetClientBounds(GetLiveboxPopupClientBounds());\r
+}\r
+\r
+void\r
+_LiveboxPopup::OnDraw(void)\r
+{\r
+ if (__pLiveboxPopupPresenter)\r
+ {\r
+ __pLiveboxPopupPresenter->Draw();\r
+ }\r
+}\r
+\r
+}} // Tizen::Shell\r
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file FShell_LiveboxPopup.h
+ * @brief This is the header file for the _LiveboxPopup class.
+ *
+ * This header file contains the declarations of the %_LiveboxPopup class.
+ */
+#ifndef _FSHELL_INTERNAL_LIVEBOX_POPUP_H_
+#define _FSHELL_INTERNAL_LIVEBOX_POPUP_H_
+
+#include <unique_ptr.h>
+#include <FBaseString.h>
+#include "FUi_Window.h"
+
+namespace Tizen { namespace Graphics
+{
+class Dimension;
+class FloatDimension;
+class FloatPoint;
+}} // Tizen::Graphics
+
+namespace Tizen { namespace Ui
+{
+class _IUiEventManager;
+}} // Tizen::Ui
+
+namespace Tizen { namespace Ui { namespace Animations
+{
+class _RootVisualElement;
+}}} // Tizen::Ui::Animations
+
+namespace Tizen { namespace Shell
+{
+
+class _LiveboxPopupPresenter;
+class _LiveboxPopupLayer;
+
+/**
+ * @class _LiveboxPopup
+ * @brief
+ * @since 2.1
+ */
+class _LiveboxPopup
+ : public Tizen::Ui::_Window
+{
+public:
+ static _LiveboxPopup* CreateLiveboxPopupN(void);
+ virtual ~_LiveboxPopup(void);
+
+ result Initialize(const Tizen::Graphics::FloatDimension& size);
+ result SetProviderId(const Tizen::Base::String& providerId);
+ Tizen::Base::String GetProviderId(void) const;
+ void SetAnchorPosition(const Tizen::Graphics::FloatPoint& position);
+ Tizen::Graphics::FloatPoint GetAnchorPosition(void) const;
+ Tizen::Graphics::Canvas* GetClientAreaCanvasN(void) const;\r
+ Tizen::Graphics::FloatPoint TranslateToClientAreaPosition(const Tizen::Graphics::FloatPoint& controlPosition) const;
+ Tizen::Graphics::FloatPoint TranslateToControlPosition(const Tizen::Graphics::FloatPoint& clientPosition) const;
+
+protected:
+ _LiveboxPopup(void);
+
+private:
+ _LiveboxPopup(const _LiveboxPopup& rhs);
+ _LiveboxPopup& operator =(const _LiveboxPopup& rhs);
+
+ result SetLayerShowState(bool showState);
+ result SetLayerBounds(const Tizen::Graphics::FloatRectangle& bounds);
+ Tizen::Graphics::FloatRectangle GetLiveboxPopupClientBounds(void) const;
+
+ virtual result CreateLayer(void);
+
+ virtual void OnActivated(void);
+ virtual void OnBoundsChanged(void);
+ virtual void OnDraw(void);
+
+private:
+ std::unique_ptr<_LiveboxPopupPresenter> __pLiveboxPopupPresenter;
+ _LiveboxPopupLayer* __pLiveboxPopupLayer;
+ Tizen::Ui::Animations::_RootVisualElement* __pLiveboxPopupRootVisualElement;
+ Tizen::Ui::_IUiEventManager* __pEventManager;
+ Tizen::Graphics::FloatDimension __liveboxSize;
+}; // _LiveboxPopup
+
+}} // Tizen::Shell
+
+#endif // _FSHELL_INTERNAL_LIVEBOX_POPUP_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <new>
+#include <unique_ptr.h>
+#include <FBaseSysLog.h>
+#include "FShell_LiveboxPopupImpl.h"
+
+using namespace std;
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui;
+
+namespace Tizen { namespace Shell
+{
+
+const _LiveboxPopupImpl*
+_LiveboxPopupImpl::GetInstance(const LiveboxPopup& liveboxPopup)
+{
+ return static_cast<const _LiveboxPopupImpl*>(_ControlImpl::GetInstance(liveboxPopup));
+}
+
+_LiveboxPopupImpl*
+_LiveboxPopupImpl::GetInstance(LiveboxPopup& liveboxPopup)
+{
+ return static_cast<_LiveboxPopupImpl*>(_ControlImpl::GetInstance(liveboxPopup));
+}
+
+_LiveboxPopupImpl*
+_LiveboxPopupImpl::CreateLiveboxPopupImplN(LiveboxPopup& liveboxPopup, const Layout* pPortraitLayout, const Layout* pLandscapeLayout)
+{
+ unique_ptr<_LiveboxPopup> pCore(_LiveboxPopup::CreateLiveboxPopupN());
+ result r = GetLastResult();
+ SysTryReturn(NID_UI_CTRL, pCore, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ unique_ptr<_LiveboxPopupImpl> pImpl(new (std::nothrow) _LiveboxPopupImpl(&liveboxPopup, pCore.get(), pPortraitLayout, pLandscapeLayout));
+ SysTryReturn(NID_UI_CTRL, pImpl, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ pCore.release();
+
+ r = GetLastResult();
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return pImpl.release();
+}
+
+_LiveboxPopupImpl::_LiveboxPopupImpl(LiveboxPopup* pPublic, _LiveboxPopup* pCore, const Layout* pPortraitLayout, const Layout* pLandscapeLayout)
+ : _WindowImpl(pPublic, pCore, pPortraitLayout, pLandscapeLayout)
+{
+}
+
+_LiveboxPopupImpl::~_LiveboxPopupImpl(void)
+{
+}
+
+const char*
+_LiveboxPopupImpl::GetPublicClassName(void) const
+{
+ return "Tizen::Shell::LiveboxPopup";
+}
+
+const LiveboxPopup&
+_LiveboxPopupImpl::GetPublic(void) const
+{
+ return static_cast<const LiveboxPopup&>(_ControlImpl::GetPublic());
+}
+
+LiveboxPopup&
+_LiveboxPopupImpl::GetPublic(void)
+{
+ return static_cast<LiveboxPopup&>(_ControlImpl::GetPublic());
+}
+
+const _LiveboxPopup&
+_LiveboxPopupImpl::GetCore(void) const
+{
+ return static_cast<const _LiveboxPopup&>(_ControlImpl::GetCore());
+}
+
+_LiveboxPopup&
+_LiveboxPopupImpl::GetCore(void)
+{
+ return static_cast<_LiveboxPopup&>(_ControlImpl::GetCore());
+}
+
+result
+_LiveboxPopupImpl::Initialize(const FloatDimension& size)
+{
+ result r = GetCore().Initialize(size);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
+result
+_LiveboxPopupImpl::SetProviderId(const String& providerId)
+{
+ result r = GetCore().SetProviderId(providerId);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
+String
+_LiveboxPopupImpl::GetProviderId(void) const
+{
+ return GetCore().GetProviderId();
+}
+
+void
+_LiveboxPopupImpl::SetAnchorPosition(const FloatPoint& position)
+{
+ GetCore().SetAnchorPosition(position);
+}
+
+FloatPoint
+_LiveboxPopupImpl::GetAnchorPosition(void) const
+{
+ return GetCore().GetAnchorPosition();
+}
+
+FloatRectangle\r
+_LiveboxPopupImpl::GetClientAreaBounds(void) const\r
+{\r
+ return GetClientBoundsF();\r
+}\r
+\r
+Canvas*\r
+_LiveboxPopupImpl::GetClientAreaCanvasN(void) const\r
+{\r
+ return GetCore().GetClientAreaCanvasN();\r
+}\r
+\r
+FloatPoint\r
+_LiveboxPopupImpl::TranslateToClientAreaPosition(const FloatPoint& controlPosition) const
+{\r
+ return GetCore().TranslateToClientAreaPosition(controlPosition);
+}\r
+\r
+FloatPoint
+_LiveboxPopupImpl::TranslateToControlPosition(const FloatPoint& clientPosition) const
+{
+ return GetCore().TranslateToControlPosition(clientPosition);
+}
+
+}} // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef _FSHELL_INTERNAL_LIVEBOX_POPUP_IMPL_H_
+#define _FSHELL_INTERNAL_LIVEBOX_POPUP_IMPL_H_
+
+#include <FShellLiveboxPopup.h>
+#include "FUi_WindowImpl.h"
+#include "FShell_LiveboxPopup.h"
+
+namespace Tizen { namespace Graphics
+{
+class Dimension;
+class FloatDimension;
+class FloatPoint;
+}} // Tizen::Graphics
+
+namespace Tizen { namespace Shell
+{
+
+class _LiveboxPopupImpl
+ : public Tizen::Ui::_WindowImpl
+{
+public:
+ static _LiveboxPopupImpl* CreateLiveboxPopupImplN(LiveboxPopup& liveboxPopup, const Tizen::Ui::Layout* pPortraitLayout, const Tizen::Ui::Layout* pLandscapeLayout);
+ static const _LiveboxPopupImpl* GetInstance(const LiveboxPopup& liveboxPopup);
+ static _LiveboxPopupImpl* GetInstance(LiveboxPopup& liveboxPopup);
+
+ virtual ~_LiveboxPopupImpl(void);
+
+ virtual const char* GetPublicClassName(void) const;
+ virtual const LiveboxPopup& GetPublic(void) const;
+ virtual LiveboxPopup& GetPublic(void);
+ virtual const _LiveboxPopup& GetCore(void) const;
+ virtual _LiveboxPopup& GetCore(void);
+
+ result Initialize(const Tizen::Graphics::FloatDimension& size);
+ result SetProviderId(const Tizen::Base::String& providerId);
+ Tizen::Base::String GetProviderId(void) const;
+ void SetAnchorPosition(const Tizen::Graphics::FloatPoint& position);
+ Tizen::Graphics::FloatPoint GetAnchorPosition(void) const;\r
+ Tizen::Graphics::FloatRectangle GetClientAreaBounds(void) const;\r
+ Tizen::Graphics::Canvas* GetClientAreaCanvasN(void) const;\r
+ Tizen::Graphics::FloatPoint TranslateToClientAreaPosition(const Tizen::Graphics::FloatPoint& controlPosition) const;
+ Tizen::Graphics::FloatPoint TranslateToControlPosition(const Tizen::Graphics::FloatPoint& clientPosition) const;
+
+protected:
+ _LiveboxPopupImpl(LiveboxPopup* pPublic, _LiveboxPopup* pCore, const Tizen::Ui::Layout* pPortraitLayout, const Tizen::Ui::Layout* pLandscapeLayout);
+
+private:
+ _LiveboxPopupImpl(const _LiveboxPopupImpl& rhs);
+ _LiveboxPopupImpl& operator =(const _LiveboxPopupImpl& rhs);
+}; // _LiveboxPopupImpl
+
+}} // Tizen::Shell::Ui::Controls
+
+#endif // _FSHELL_INTERNAL_LIVEBOX_POPUP_IMPL_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file FShell_LiveboxPopupModel.cpp
+ * @brief This is the implementation file for the _LiveboxPopupModel class.
+ */
+
+#include <FBaseSysLog.h>
+#include "FShell_LiveboxPopupModel.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+
+namespace Tizen { namespace Shell
+{
+
+_LiveboxPopupModel::_LiveboxPopupModel(void)
+{
+}
+
+_LiveboxPopupModel::~_LiveboxPopupModel(void)
+{
+}
+
+void
+_LiveboxPopupModel::SetProviderId(const String& providerId)
+{
+ __providerId = providerId;
+}
+
+String
+_LiveboxPopupModel::GetProviderId(void) const
+{
+ return __providerId;
+}
+
+void
+_LiveboxPopupModel::SetAnchorPosition(const Tizen::Graphics::FloatPoint& position)
+{
+ __anchorPosition = position;
+}
+
+FloatPoint
+_LiveboxPopupModel::GetAnchorPosition(void) const
+{
+ return __anchorPosition;
+}
+
+}} // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file FShell_LiveboxPopupModel.h
+ * @brief This is the header file for the _LiveboxPopupModel class.
+ *
+ * This header file contains the declarations of the %_LiveboxPopupModel class.
+ */
+#ifndef _FSHELL_INTERNAL_LIVEBOX_POPUP_MODEL_H_
+#define _FSHELL_INTERNAL_LIVEBOX_POPUP_MODEL_H_
+
+#include <FBaseObject.h>
+#include <FBaseString.h>
+#include <FGrpFloatPoint.h>
+
+namespace Tizen { namespace Shell
+{
+
+class _LiveboxPopupModel
+ : public Tizen::Base::Object
+{
+public:
+ _LiveboxPopupModel(void);
+ virtual ~_LiveboxPopupModel(void);
+
+public:
+ void SetProviderId(const Tizen::Base::String& providerId);
+ Tizen::Base::String GetProviderId(void) const;
+ void SetAnchorPosition(const Tizen::Graphics::FloatPoint& position);
+ Tizen::Graphics::FloatPoint GetAnchorPosition(void) const;
+
+private:
+ _LiveboxPopupModel(const _LiveboxPopupModel& rhs);
+ _LiveboxPopupModel& operator =(const _LiveboxPopupModel& rhs);
+
+private:
+ Tizen::Base::String __providerId;\r
+ Tizen::Graphics::FloatPoint __anchorPosition;\r
+
+}; // _LiveboxPopupModel
+
+}} // Tizen::Shell
+
+#endif // _FSHELL_INTERNAL_LIVEBOX_POPUP_MODEL_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file FShell_LiveboxPopupPresenter.cpp
+ * @brief This is the implementation file for the _LiveboxPopupPresenter class.
+ */
+
+#include <new>
+#include <FBaseSysLog.h>
+#include "FShell_LiveboxPopupPresenter.h"
+#include "FShell_LiveboxPopup.h"
+#include "FShell_LiveboxPopupModel.h"
+#include "FUi_ResourceManager.h"
+
+using namespace std;
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui;
+
+namespace Tizen { namespace Shell
+{
+
+_LiveboxPopupPresenter::_LiveboxPopupPresenter(const _LiveboxPopup& liveBoxPopup)
+ : __pLiveboxPopup(const_cast<_LiveboxPopup*>(&liveBoxPopup))
+ , __pLiveboxPopupModel(new (std::nothrow) _LiveboxPopupModel)
+{
+}
+
+_LiveboxPopupPresenter::~_LiveboxPopupPresenter(void)
+{
+ __pLiveboxPopup = null;
+}
+
+result
+_LiveboxPopupPresenter::Initialize(void)
+{
+ Bitmap* pBitmap = null;
+
+ result r = GET_BITMAP_CONFIG_N(LIVEBOX::POPUP_BG, BITMAP_PIXEL_FORMAT_ARGB8888, pBitmap);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ std::unique_ptr<Bitmap> pBackgroundBitmap(pBitmap);
+
+ r = GET_BITMAP_CONFIG_N(LIVEBOX::POPUP_BG_ARROW_UP, BITMAP_PIXEL_FORMAT_ARGB8888, pBitmap);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ std::unique_ptr<Bitmap> pArrowUpBitmap(pBitmap);
+
+ r = GET_BITMAP_CONFIG_N(LIVEBOX::POPUP_BG_ARROW_DOWN, BITMAP_PIXEL_FORMAT_ARGB8888, pBitmap);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pBackgroundBitmap = move(pBackgroundBitmap);
+ __pArrowUpBitmap = move(pArrowUpBitmap);
+ __pArrowDownBitmap.reset(pBitmap);
+
+ return r;
+}
+
+void
+_LiveboxPopupPresenter::SetProviderId(const String& providerId)
+{
+ __pLiveboxPopupModel->SetProviderId(providerId);
+}
+
+String
+_LiveboxPopupPresenter::GetProviderId(void) const
+{
+ return __pLiveboxPopupModel->GetProviderId();
+}
+
+void
+_LiveboxPopupPresenter::SetAnchorPosition(const Tizen::Graphics::FloatPoint& position)
+{
+ return __pLiveboxPopupModel->SetAnchorPosition(position);
+}
+
+FloatPoint
+_LiveboxPopupPresenter::GetAnchorPosition(void) const
+{
+ return __pLiveboxPopupModel->GetAnchorPosition();
+}
+
+void
+_LiveboxPopupPresenter::Draw(void)
+{
+ unique_ptr<Canvas> pCanvas(__pLiveboxPopup->GetCanvasN());
+ SysTryReturnVoidResult(NID_UI_CTRL, pCanvas, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ DrawBackground(*pCanvas);
+ DrawAnchor(*pCanvas);
+}
+
+void
+_LiveboxPopupPresenter::DrawBackground(Canvas& canvas)
+{
+ Rectangle bounds = __pLiveboxPopup->GetBounds();
+ bounds.x = 0;
+ bounds.y = 0;
+
+ if (__pBackgroundBitmap->IsNinePatchedBitmap())
+ {
+ canvas.DrawNinePatchedBitmap(bounds, *__pBackgroundBitmap);
+ }
+ else
+ {
+ canvas.DrawBitmap(bounds, *__pBackgroundBitmap, Rectangle(0, 0, __pBackgroundBitmap->GetWidth(), __pBackgroundBitmap->GetHeight()));
+ }
+}
+
+void
+_LiveboxPopupPresenter::DrawAnchor(Canvas& canvas)
+{
+ Rectangle popupBounds = __pLiveboxPopup->GetBounds();
+ FloatPoint anchorF = GetAnchorPosition();
+ Bitmap* pArrowBitmap = null;
+
+ Dimension screenSize = _ControlManager::GetInstance()->GetScreenSize();
+ Point anchor(0, 0);
+
+ if (anchorF.y < 0.5f)
+ {
+ pArrowBitmap = __pArrowUpBitmap.get();
+ }
+ else
+ {
+ pArrowBitmap = __pArrowDownBitmap.get();
+ anchor.y = popupBounds.height - pArrowBitmap->GetHeight();
+ }
+
+ anchor.x = (anchorF.x * screenSize.width) - (pArrowBitmap->GetWidth() / 2);
+
+ Rectangle bounds(anchor.x, anchor.y, pArrowBitmap->GetWidth(), pArrowBitmap->GetHeight());
+
+ if (pArrowBitmap->IsNinePatchedBitmap())
+ {
+ canvas.DrawNinePatchedBitmap(bounds, *pArrowBitmap);
+ }
+ else
+ {
+ canvas.DrawBitmap(bounds, *pArrowBitmap, Rectangle(0, 0, pArrowBitmap->GetWidth(), pArrowBitmap->GetHeight()));
+ }
+}
+
+}} // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file FShell_LiveboxPopupPresenter.h
+ * @brief This is the header file for the _LiveboxPopupPresenter class.
+ *
+ * This header file contains the declarations of the %_LiveboxPopupPresenter class.
+ */
+#ifndef _FSHELL_INTERNAL_LIVEBOX_POPUP_PRESENTER_H_
+#define _FSHELL_INTERNAL_LIVEBOX_POPUP_PRESENTER_H_
+
+#include <unique_ptr.h>
+#include <FBaseString.h>
+
+namespace Tizen { namespace Graphics
+{
+class Bitmap;
+class Canvas;
+class FloatPoint;
+}} // Tizen::Graphics
+
+namespace Tizen { namespace Shell
+{
+
+class _LiveboxPopup;
+class _LiveboxPopupModel;
+
+class _LiveboxPopupPresenter
+{
+public:
+ _LiveboxPopupPresenter(const _LiveboxPopup& liveBoxPopup);
+ virtual ~_LiveboxPopupPresenter(void);
+
+ result Initialize(void);
+ void SetProviderId(const Tizen::Base::String& providerId);
+ Tizen::Base::String GetProviderId(void) const;
+ void SetAnchorPosition(const Tizen::Graphics::FloatPoint& position);
+ Tizen::Graphics::FloatPoint GetAnchorPosition(void) const;
+ void Draw(void);
+ void DrawBackground(Tizen::Graphics::Canvas& canvas);
+ void DrawAnchor(Tizen::Graphics::Canvas& canvas);
+
+private:
+ _LiveboxPopupPresenter(const _LiveboxPopupPresenter& rhs);
+ _LiveboxPopupPresenter& operator =(const _LiveboxPopupPresenter& rhs);
+
+private:
+ _LiveboxPopup* __pLiveboxPopup;
+ std::unique_ptr<_LiveboxPopupModel> __pLiveboxPopupModel;
+ std::unique_ptr<Tizen::Graphics::Bitmap> __pBackgroundBitmap;
+ std::unique_ptr<Tizen::Graphics::Bitmap> __pArrowUpBitmap;
+ std::unique_ptr<Tizen::Graphics::Bitmap> __pArrowDownBitmap;
+}; // _LiveboxPopupPresenter
+
+}} // Tizen::Shell
+
+#endif // _FSHELL_INTERNAL_LIVEBOX_POPUP_PRESENTER_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file .cpp
+ * @brief This is the implementation for the Livebox class.
+ */
+
+#include <FBaseSysLog.h>
+#include <FShellLiveboxPopup.h>
+
+#include "FShell_LiveboxProviderManagerImpl.h"
+#include "FShell_LiveboxPopupProviderImpl.h"
+#include "FShell_LiveboxPopupImpl.h"
+
+namespace Tizen { namespace Shell
+{
+
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+
+_LiveboxPopupProviderImpl::_LiveboxPopupProviderImpl(const String& instanceId, double x, double y)
+ :__instanceId(instanceId)
+ ,__pLiveboxPopup(null)
+ ,__x(x)
+ ,__y(y)
+ ,__width(0)
+ ,__height(0)
+{
+
+}
+
+_LiveboxPopupProviderImpl::~_LiveboxPopupProviderImpl()
+{
+ delete __pLiveboxPopup;
+}
+
+const String&
+_LiveboxPopupProviderImpl::GetInstanceId() const
+{
+ return __instanceId;
+}
+
+result
+_LiveboxPopupProviderImpl::SetLiveboxPopup(LiveboxPopup* pLiveboxPopup)
+{
+ if( __pLiveboxPopup == pLiveboxPopup)
+ {
+ return E_SUCCESS;
+ }
+
+ __pLiveboxPopup = pLiveboxPopup;
+
+ if( pLiveboxPopup == null)
+ {
+ return E_SUCCESS;
+ }
+
+ _LiveboxPopupImpl* pLiveboxPopupImpl = _LiveboxPopupImpl::GetInstance(*pLiveboxPopup);
+ SysTryReturnResult(NID_APP, pLiveboxPopupImpl, E_INVALID_OPERATION, "Not-yet constructed! LiveboxPopup::Construct() should be called before use.");
+
+ pLiveboxPopupImpl->SetAnchorPosition(FloatPoint(__x, __y));
+ pLiveboxPopupImpl->SetProviderId(GetInstanceId());
+
+ return E_SUCCESS;
+}
+
+LiveboxPopup*
+_LiveboxPopupProviderImpl::GetLiveboxPopup() const
+{
+ return __pLiveboxPopup;
+}
+
+result
+_LiveboxPopupProviderImpl::RequestUpdateToLivebox()
+{
+ return _LiveboxProviderManagerImpl::GetInstance()->RequestUpdateInstance(__instanceId);
+}
+
+}} // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file FShell_LiveboxPopupView.cpp
+ * @brief This is the implementation file for the _LiveboxPopupView class.
+ */
+
+#include <new>
+#include <Ecore.h>
+#include <Ecore_X.h>
+#include <livebox.h>
+#include <FBaseSysLog.h>
+#include <FBaseString.h>
+#include <FGrpDimension.h>
+#include <FGrpPoint.h>
+#include <FGrpRectangle.h>
+#include <FMediaImageTypes.h>
+#include <FSysSystemTime.h>
+#include <FUiAnimVisualElementAnimation.h>
+#include <FUiAnimVisualElementAnimationGroup.h>
+#include <FUiAnimVisualElementPropertyAnimation.h>
+#include <FBase_StringConverter.h>
+#include <FGrp_BitmapImpl.h>
+#include <FMedia_ImageDecoder.h>
+#include "FShell_LiveboxPopupView.h"
+#include "FShell_LiveboxPopupViewPresenter.h"
+#include "FShell_LiveboxPopupViewEvent.h"
+#include "FShell_LiveboxView.h"
+#include "FShell_ILiveboxPopupViewEventListener.h"
+#include "FUi_ControlManager.h"
+#include "FUiAnim_EflNode.h"
+#include "FUiAnim_VisualElement.h"
+#include "FUiAnim_VisualElementImpl.h"
+#include "FUiAnim_VisualElementSurfaceImpl.h"
+#include "FUi_CoordinateSystemUtils.h"
+
+using namespace std;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Runtime;
+using namespace Tizen::Graphics;
+using namespace Tizen::System;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Animations;
+
+namespace Tizen { namespace Shell
+{
+
+const wchar_t* OPEN_ANIMATION = L"Open";
+const wchar_t* CLOSE_ANIMATION = L"Close";
+
+_LiveboxPopupView::_LiveboxPopupView(_LiveboxView& liveBoxView)
+ : __pLiveboxPopupViewPresenter(new (std::nothrow) _LiveboxPopupViewPresenter(*this))
+ , __pLiveboxView(&liveBoxView)
+ , __pLiveboxPopupViewEvent(_LiveboxPopupViewEvent::CreateInstanceN(*this))
+ , __firstUpdated(false)
+ , __pixmap(-1)
+{
+}
+
+_LiveboxPopupView::~_LiveboxPopupView(void)
+{
+ if (livebox_has_pd(__pLiveboxView->__pLivebox))
+ {
+ livebox_destroy_pd(__pLiveboxView->__pLivebox, OnLiveboxPopupDestroyed, this);
+ }
+
+ __pLiveboxView = null;
+}
+
+_LiveboxPopupView*
+_LiveboxPopupView::CreateLiveboxPopupN(_LiveboxView& liveBoxView)
+{
+ SysTryReturn(NID_UI_CTRL, livebox_has_pd(liveBoxView.__pLivebox), null, E_SYSTEM, "[E_SYSTEM] A system error occured.");
+
+ unique_ptr<_LiveboxPopupView> pLiveboxPopup(new (std::nothrow) _LiveboxPopupView(liveBoxView));
+ SysTryReturn(NID_UI_CTRL, pLiveboxPopup, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ result r = GetLastResult();
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pLiveboxPopup->CreateRootVisualElement();
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pLiveboxPopup->AcquireHandle();
+
+ SetLastResult(E_SUCCESS);
+
+ return pLiveboxPopup.release();
+}
+
+result
+_LiveboxPopupView::Initialize(const FloatRectangle& bounds)
+{
+ FloatDimension screenSize = _ControlManager::GetInstance()->GetScreenSizeF();
+
+ FloatRectangle viewAbsoluteBounds = __pLiveboxView->GetAbsoluteBoundsF();
+ double x = (static_cast<double>(viewAbsoluteBounds.x) + static_cast<double>((viewAbsoluteBounds.width) / 2)) / static_cast<double>(screenSize.width);
+ double y = 0.0f;
+
+ int lower = 0;
+ int upper = 0;
+ __pLiveboxView->GetRemainingSpace(lower, upper);
+
+ if (lower > upper)
+ {
+ y = 1.0f;
+ }
+
+ SysLog(NID_UI_CTRL, "[%f %f %f %f]", bounds.x, bounds.y, bounds.width, bounds.height);
+ SysLog(NID_UI_CTRL, "[%f %f %f %f]", viewAbsoluteBounds.x, viewAbsoluteBounds.y, viewAbsoluteBounds.width, viewAbsoluteBounds.height);
+ SysLog(NID_UI_CTRL, "[%f %f]", x, y);
+
+ int ret = livebox_create_pd_with_position(__pLiveboxView->__pLivebox, x, y, OnLiveboxPopupCreated, this);
+ SysTryReturn(NID_UI_CTRL, ret == 0, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
+
+ result r = SetBounds(bounds);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
+result
+_LiveboxPopupView::AddLiveboxPopupEventListener(const _ILiveboxPopupViewEventListener& listener)
+{
+ result r = __pLiveboxPopupViewEvent->AddListener(listener);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
+result
+_LiveboxPopupView::RemoveLiveboxPopupEventListener(const _ILiveboxPopupViewEventListener& listener)
+{
+ result r = __pLiveboxPopupViewEvent->RemoveListener(listener);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
+Bitmap*
+_LiveboxPopupView::GetBitmap(void) const
+{
+ return __pBitmap.get();
+}
+
+void
+_LiveboxPopupView::SetPopupBounds(const FloatDimension& size)
+{
+ FloatRectangle absoluteViewBounds = __pLiveboxView->GetAbsoluteBoundsF();
+ FloatRectangle popupBounds(0, 0, size.width, size.height);
+
+ int lower = 0;
+ int upper = 0;
+
+ FloatDimension anchorSize = __pLiveboxView->GetAnchorSize();
+ __pLiveboxView->GetRemainingSpace(lower, upper);
+
+ if (lower > upper)
+ {
+ popupBounds.y = absoluteViewBounds.y - size.height + anchorSize.height;
+ }
+ else
+ {
+ popupBounds.y = absoluteViewBounds.y + absoluteViewBounds.height - anchorSize.height;
+ }
+
+ SetBounds(popupBounds);
+
+ SysLog(NID_UI_CTRL, "[%f %f %f %f]", popupBounds.x, popupBounds.y, popupBounds.width, popupBounds.height);
+}
+
+void
+_LiveboxPopupView::FireLiveboxPopupEvent(bool open)
+{
+ if (__pLiveboxPopupViewEvent)
+ {
+ IEventArg* pEventArg = _LiveboxPopupViewEvent::CreateLiveboxPopupViewEventArgN(open);
+ result r = GetLastResult();
+ SysTryReturnVoidResult(NID_UI_CTRL, pEventArg != null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pLiveboxPopupViewEvent->Fire(*pEventArg);
+ }
+}
+
+void
+_LiveboxPopupView::GetTouchPostion(const Tizen::Graphics::FloatPoint& point, double& x, double& y) const
+{
+ FloatRectangle bounds = GetBoundsF();
+
+ x = static_cast<double>(point.x) / static_cast<double>(bounds.width);
+ y = static_cast<double>(point.y) / static_cast<double>(bounds.height);
+}
+
+void
+_LiveboxPopupView::PlayAnimation(bool open)
+{
+ const int ANIMATION1_DURATION = 100;
+// const int ANIMATION2_DURATION = 300;
+
+ _VisualElement* pVisualElement = GetVisualElement();
+ result r = GetLastResult();
+ SysTryReturnVoidResult(NID_UI_CTRL, pVisualElement, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ VisualElementAnimationGroup animationGroup;
+ animationGroup.SetVisualElementAnimationStatusEventListener(this);
+
+ FloatRectangle bounds = GetBoundsF();
+ bounds.x = 0.0f;
+ bounds.y = 0.0f;
+
+ FloatRectangle startBounds(bounds.x, bounds.y, bounds.width, 0.0f);
+ FloatRectangle endBounds(bounds);
+ if (!open)
+ {
+ startBounds = bounds;
+ endBounds = FloatRectangle(bounds.x, bounds.y, bounds.width, 0.0f);
+ }
+
+ VisualElementPropertyAnimation animation1;
+ animation1.SetPropertyName(L"bounds");
+ animation1.SetStartValue(Variant(startBounds));
+ animation1.SetEndValue(Variant(endBounds));
+ animation1.SetDuration(ANIMATION1_DURATION);
+
+ animationGroup.AddAnimation(animation1);
+/*
+ float startOpacity = 0.0f;
+ float endOpacity = 1.0f;
+ if (!open)
+ {
+ startOpacity = 1.0f;
+ endOpacity = 0.0f;
+ }
+
+ VisualElementPropertyAnimation animation2;
+ animation2.SetPropertyName(L"opacity");
+ animation2.SetStartValue(Variant(startOpacity));
+ animation2.SetEndValue(Variant(endOpacity));
+ animation2.SetDuration(ANIMATION2_DURATION);
+
+ animationGroup.AddAnimation(animation2);
+*/
+ String keyName = (open) ? OPEN_ANIMATION : CLOSE_ANIMATION;
+ pVisualElement->AddAnimation(keyName, animationGroup);
+}
+
+result
+_LiveboxPopupView::OnAttached(void)
+{
+ if (__firstUpdated)
+ {
+ if (__pPixmapObject)
+ {
+ _VisualElement* pVisualElement = GetVisualElement();
+ SysTryReturn(NID_UI_CTRL, pVisualElement, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
+
+ _EflNode* pEflNode = dynamic_cast<_EflNode*>(pVisualElement->GetNativeNode());
+ SysTryReturn(NID_UI_CTRL, pEflNode, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
+
+ Evas_Object* pSmartObject = (Evas_Object*)pEflNode->GetGroupContainer();
+ SysTryReturn(NID_UI_CTRL, pSmartObject, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
+
+ Evas* pEvas = evas_object_evas_get(pSmartObject);
+ SysTryReturn(NID_UI_CTRL, pEvas, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
+
+ pEflNode->AddNativeSmartObject(*pVisualElement, __pPixmapObject.get());
+
+ }
+
+ PlayAnimation(true);
+ }
+
+ return E_SUCCESS;
+}
+
+void
+_LiveboxPopupView::OnActivated(void)
+{
+ SetTouchCapture();
+}
+
+void
+_LiveboxPopupView::OnDeactivated(void)
+{
+ ReleaseTouchCapture();
+}
+
+bool
+_LiveboxPopupView::OnTouchPressed(const _Control& source, const _TouchInfo& touchInfo)
+{
+ double x = 0.0;
+ double y = 0.0;
+
+ Point position = _CoordinateSystemUtils::ConvertToInteger(touchInfo.GetCurrentPosition());
+ GetTouchPostion(FloatPoint(static_cast<float>(position.x), static_cast<float>(position.y)), x, y);
+
+ livebox_content_event(__pLiveboxView->__pLivebox, PD_MOUSE_DOWN, x, y);
+
+ return false;
+}
+
+bool
+_LiveboxPopupView::OnTouchReleased(const _Control& source, const _TouchInfo& touchInfo)
+{
+ FloatRectangle clientBounds(GetClientBoundsF());
+
+ Point position = _CoordinateSystemUtils::ConvertToInteger(touchInfo.GetCurrentPosition());
+ FloatPoint floatPosition(static_cast<float>(position.x), static_cast<float>(position.y));
+
+ if (!clientBounds.Contains(floatPosition))
+ {
+ PlayAnimation(false);
+ }
+
+ double x = 0.0;
+ double y = 0.0;
+
+ GetTouchPostion(floatPosition, x, y);
+
+ livebox_content_event(__pLiveboxView->__pLivebox, PD_MOUSE_UP, x, y);
+
+ return false;
+}
+
+bool
+_LiveboxPopupView::OnTouchMoved(const _Control& source, const _TouchInfo& touchInfo)
+{
+ double x = 0.0;
+ double y = 0.0;
+
+ Point position = _CoordinateSystemUtils::ConvertToInteger(touchInfo.GetCurrentPosition());
+ GetTouchPostion(FloatPoint(static_cast<float>(position.x), static_cast<float>(position.y)), x, y);
+
+ livebox_content_event(__pLiveboxView->__pLivebox, PD_MOUSE_MOVE, x, y);
+
+ return false;
+}
+
+void
+_LiveboxPopupView::OnBoundsChanged(void)
+{
+}
+
+void
+_LiveboxPopupView::OnVisualElementAnimationStarted(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target)
+{
+}
+
+void
+_LiveboxPopupView::OnVisualElementAnimationFinished(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, bool completedNormally)
+{
+ if (keyName == CLOSE_ANIMATION)
+ {
+ SysLog(NID_UI_CTRL, "Close LiveboxPopup");
+ Close();
+ FireLiveboxPopupEvent(false);
+ }
+}
+
+void
+_LiveboxPopupView::OnVisualElementAnimationRepeated(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, long currentRepeatCount)
+{
+}
+
+void
+_LiveboxPopupView::OnDraw(void)
+{
+ __pLiveboxPopupViewPresenter->Draw();
+}
+
+void
+_LiveboxPopupView::OnLiveboxUpdated(const Tizen::Graphics::Bitmap& bitmap, const Tizen::Graphics::FloatDimension& size)
+{
+ long long ticks = 0;
+ SystemTime::GetTicks(ticks);
+
+ SysLog(NID_UI_CTRL, "(%f %f) %lld", size.width, size.height, ticks);
+
+ if (size != GetSizeF())
+ {
+ SetPopupBounds(size);
+ }
+
+ __pBitmap.reset(const_cast<Bitmap*>(&bitmap));
+
+ if (!__firstUpdated)
+ {
+ PlayAnimation(true);
+ __firstUpdated = true;
+ }
+ else
+ {
+ Invalidate(false);
+ }
+}
+
+void
+_LiveboxPopupView::OnLiveboxUpdated(int pixmap)
+{
+ int x = 0;
+ int y = 0;
+ int width = 0;
+ int height = 0;
+
+ ecore_x_pixmap_geometry_get(pixmap, &x, &y, &width, &height);
+ SysTryReturnVoidResult(NID_UI_CTRL, (width > 0) && (height > 0), E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid [0x%x %d %d].", pixmap, width , height);
+
+ if (__pixmap != pixmap )
+ {
+ SetBackgroundColor(Color(0, 0, 0, 0));
+
+ _VisualElement* pVisualElement = GetVisualElement();
+// _VisualElement* pVisualElement = __pLiveboxView->GetVisualElement();
+ SysTryReturnVoidResult(NID_UI_CTRL, pVisualElement, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
+
+ _EflNode* pEflNode = dynamic_cast<_EflNode*>(pVisualElement->GetNativeNode());
+ SysTryReturnVoidResult(NID_UI_CTRL, pEflNode, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
+
+ Evas_Object* pSmartObject = (Evas_Object*)pEflNode->GetGroupContainer();
+ SysTryReturnVoidResult(NID_UI_CTRL, pSmartObject, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
+
+ Evas* pEvas = evas_object_evas_get(pSmartObject);
+ SysTryReturnVoidResult(NID_UI_CTRL, pEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
+
+ __pPixmapObject.reset(evas_object_image_filled_add(pEvas));
+ SysTryReturnVoidResult(NID_UI_CTRL, __pPixmapObject.get(), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ pEflNode->AddNativeSmartObject(*pVisualElement, __pPixmapObject.get());
+
+ evas_object_image_size_set(__pPixmapObject.get(), width, height);
+ evas_object_image_colorspace_set(__pPixmapObject.get(), EVAS_COLORSPACE_ARGB8888);
+ evas_object_image_alpha_set(__pPixmapObject.get(), EINA_TRUE);
+
+ evas_object_move(__pPixmapObject.get(), 0, 0);
+ evas_object_show(__pPixmapObject.get());
+
+ Evas_Native_Surface surface;
+
+ surface.version = EVAS_NATIVE_SURFACE_VERSION;
+ surface.type = EVAS_NATIVE_SURFACE_X11;
+ surface.data.x11.visual = ecore_x_default_visual_get(ecore_x_display_get(), ecore_x_default_screen_get());
+ surface.data.x11.pixmap = pixmap;
+
+ evas_object_image_native_surface_set(__pPixmapObject.get(), &surface);
+
+ /*__pixmapDamage.reset(ecore_x_damage_new(pixmap, ECORE_X_DAMAGE_REPORT_RAW_RECTANGLES));
+ SysTryReturnVoidResult(NID_UI_CTRL, __pixmapDamage.get() != 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ __pPixmapEventHandler.reset(ecore_event_handler_add(ECORE_X_EVENT_DAMAGE_NOTIFY, OnPixmapDamaged, (void*)this));
+ SysTryReturnVoidResult(NID_UI_CTRL, __pPixmapEventHandler, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");*/
+
+ SysLog(NID_UI_CTRL, "[0x%x]", surface.data.x11.pixmap);
+ }
+
+ SysLog(NID_UI_CTRL, "[%d %d %d %d]", x, y, width, height);
+
+ evas_object_image_size_set(__pPixmapObject.get(), width, height);
+ evas_object_image_pixels_dirty_set(__pPixmapObject.get(), EINA_TRUE);
+ evas_object_image_fill_set(__pPixmapObject.get(), 0, 0, width, height);
+ evas_object_image_data_update_add(__pPixmapObject.get(), 0, 0, width, height);
+ evas_object_resize(__pPixmapObject.get(), width, height);
+
+ FloatDimension size(width, height);
+ if (size != GetSizeF())
+ {
+ SetPopupBounds(size);
+ }
+
+ if (!__firstUpdated)
+ {
+ PlayAnimation(true);
+ __firstUpdated = true;
+ }
+
+ __pixmap = pixmap;
+}
+
+void
+_LiveboxPopupView::OnLiveboxPopupCreated(struct livebox *pLivebox, int ret, void* pData)
+{
+ SysTryReturnVoidResult(NID_UI_CTRL, pLivebox, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+ SysTryReturnVoidResult(NID_UI_CTRL, ret == 0, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+
+ _LiveboxPopupView* pLiveboxViewManager = static_cast<_LiveboxPopupView*>(pData);
+ SysTryReturnVoidResult(NID_UI_CTRL, pLiveboxViewManager, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+}
+
+void
+_LiveboxPopupView::OnLiveboxPopupDestroyed(struct livebox *pLivebox, int ret, void* pData)
+{
+ SysTryReturnVoidResult(NID_UI_CTRL, pLivebox, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+ SysTryReturnVoidResult(NID_UI_CTRL, ret == 0, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+
+ _LiveboxPopupView* pLiveboxViewManager = static_cast<_LiveboxPopupView*>(pData);
+ SysTryReturnVoidResult(NID_UI_CTRL, pLiveboxViewManager, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+}
+
+Eina_Bool
+_LiveboxPopupView::OnPixmapDamaged(void* pData, int type, void* pEvent)
+{
+ _LiveboxPopupView* pPopupView = static_cast<_LiveboxPopupView*>(pData);
+ SysTryReturn(NID_UI_CTRL, pPopupView != null, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[[E_INVALID_ARG] The argument is invalid.");
+
+ Ecore_X_Event_Damage* pDamageEvent = static_cast<Ecore_X_Event_Damage*>(pEvent);
+ SysTryReturn(NID_UI_CTRL, pDamageEvent != null, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+
+ int pixmap = pPopupView->__pixmap;
+ SysTryReturn(NID_UI_CTRL, pDamageEvent->drawable == pixmap, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid [%d %d].", pDamageEvent->drawable, pixmap);
+
+ int x = 0;
+ int y = 0;
+ int width = 0;
+ int height = 0;
+
+ ecore_x_pixmap_geometry_get(pixmap, &x, &y, &width, &height);
+ SysTryReturn(NID_UI_CTRL, (width > 0) && (height > 0), ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid [0x%x %d %d].", pixmap, width , height);
+
+ Evas_Object* pPixmapObject = pPopupView->__pPixmapObject.get();
+ SysTryReturn(NID_UI_CTRL, pPixmapObject, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+
+ evas_object_image_pixels_dirty_set(pPixmapObject, EINA_TRUE);
+ evas_object_image_fill_set(pPixmapObject, 0, 0, width, height);
+ evas_object_image_data_update_add(pPixmapObject, 0, 0, width, height);
+
+ SysLog(NID_UI_CTRL, "[%d %d %d]", pixmap, width, height);
+
+ return ECORE_CALLBACK_DONE;
+}
+
+}} // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file FShell_LiveboxPopupView.h
+ * @brief This is the header file for the _LiveboxPopupView class.
+ *
+ * This header file contains the declarations of the %_LiveboxPopupView class.
+ */
+#ifndef _FSHELL_INTERNAL_LIVEBOX_POPUP_VIEW_H_
+#define _FSHELL_INTERNAL_LIVEBOX_POPUP_VIEW_H_
+
+#include <unique_ptr.h>
+#include <Evas.h>
+#include <Ecore.h>
+#include <Ecore_X.h>
+#include <FUiAnimIVisualElementAnimationStatusEventListener.h>
+#include "FUi_Window.h"
+
+namespace Tizen { namespace Base
+{
+class String;
+}} // Tizen::Base
+
+namespace Tizen { namespace Graphics
+{
+class Bitmap;
+class FloatDimension;
+class FloatPoint;
+}} // Tizen::Graphics
+
+namespace Tizen { namespace Ui { namespace Animations
+{
+class VisualElementAnimation;
+class VisualElement;
+}}} // Tizen::Ui::Animations
+
+namespace Tizen { namespace Shell
+{
+
+class _LiveboxPopupViewPresenter;
+class _LiveboxPopupViewEvent;
+class _LiveboxView;
+class _ILiveboxPopupViewEventListener;
+
+/**
+ * @class _LiveboxPopupView
+ * @brief
+ * @since 2.1
+ */
+class _LiveboxPopupView
+ : public Tizen::Ui::_Window
+ , public Tizen::Ui::Animations::IVisualElementAnimationStatusEventListener
+{
+public:
+ static _LiveboxPopupView* CreateLiveboxPopupN(_LiveboxView& liveBoxView);
+ virtual ~_LiveboxPopupView(void);
+
+ result Initialize(const Tizen::Graphics::FloatRectangle& bounds);
+ result AddLiveboxPopupEventListener(const _ILiveboxPopupViewEventListener& listener);
+ result RemoveLiveboxPopupEventListener(const _ILiveboxPopupViewEventListener& listener);
+ Tizen::Graphics::Bitmap* GetBitmap(void) const;
+
+protected:
+ _LiveboxPopupView(_LiveboxView& liveBoxView);
+
+private:
+ _LiveboxPopupView(const _LiveboxPopupView& rhs);
+ _LiveboxPopupView& operator =(const _LiveboxPopupView& rhs);
+
+ void SetPopupBounds(const Tizen::Graphics::FloatDimension& size);
+ void FireLiveboxPopupEvent(bool open);
+ void GetTouchPostion(const Tizen::Graphics::FloatPoint& point, double& x, double& y) const;
+ void PlayAnimation(bool open);
+
+ virtual result OnAttached(void);
+ virtual void OnActivated(void);
+ virtual void OnDeactivated(void);
+ virtual bool OnTouchPressed(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchInfo);
+ virtual bool OnTouchReleased(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchInfo);
+ virtual bool OnTouchMoved(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchInfo);
+ virtual void OnBoundsChanged(void);
+ virtual void OnVisualElementAnimationStarted(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target);
+ virtual void OnVisualElementAnimationFinished(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, bool completedNormally);
+ virtual void OnVisualElementAnimationRepeated(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, long currentRepeatCount);
+ virtual void OnDraw(void);
+
+ void OnLiveboxUpdated(const Tizen::Graphics::Bitmap& bitmap, const Tizen::Graphics::FloatDimension& size);
+ void OnLiveboxUpdated(int pixmap);
+
+ static void OnLiveboxPopupCreated(struct livebox *pLivebox, int ret, void* pData);
+ static void OnLiveboxPopupDestroyed(struct livebox *pLivebox, int ret, void* pData);
+ static Eina_Bool OnPixmapDamaged(void* pData, int type, void* pEvent);
+
+private:
+ friend class _LiveboxViewManager;
+ std::unique_ptr<_LiveboxPopupViewPresenter> __pLiveboxPopupViewPresenter;
+ std::unique_ptr<Tizen::Graphics::Bitmap> __pBitmap;
+ _LiveboxView* __pLiveboxView;
+ std::unique_ptr<_LiveboxPopupViewEvent> __pLiveboxPopupViewEvent;
+ bool __firstUpdated;
+ int __pixmap;
+
+ struct _EvasObjectDeleter
+ {
+ void operator()(Evas_Object* pEvasObject)
+ {
+ evas_object_del(pEvasObject);
+ }
+ };
+ std::unique_ptr<Evas_Object, _EvasObjectDeleter> __pPixmapObject;
+
+ struct _EcoreXDamageDeleter
+ {
+ typedef Ecore_X_Damage pointer;
+
+ void operator()(Ecore_X_Damage ecoreXDamage)
+ {
+ ecore_x_damage_free(ecoreXDamage);
+ }
+ };
+ std::unique_ptr<Ecore_X_Damage, _EcoreXDamageDeleter> __pixmapDamage;
+
+ struct _EcoreEventHandlerDeleter
+ {
+ void operator()(Ecore_Event_Handler* pEcoreEventHandler)
+ {
+ ecore_event_handler_del(pEcoreEventHandler);
+ }
+ };
+ std::unique_ptr<Ecore_Event_Handler, _EcoreEventHandlerDeleter> __pPixmapEventHandler;
+}; // _LiveboxPopupView
+
+}} // Tizen::Shell
+
+#endif // _FSHELL_INTERNAL_LIVEBOX_POPUP_VIEW_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+* @file FShell_LiveboxPopupViewEvent.cpp
+* @brief This is the implementation for the _LiveboxPopupViewEvent class.
+*/
+
+#include <new>
+#include <FBaseErrors.h>
+#include <FBaseSysLog.h>
+#include "FShell_ILiveboxPopupViewEventListener.h"
+#include "FShell_LiveboxPopupViewEvent.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Runtime;
+using namespace Tizen::Ui;
+
+namespace Tizen { namespace Shell
+{
+
+class _LiveboxPopupEventArg
+ : public Object
+ , public IEventArg
+{
+public:
+ _LiveboxPopupEventArg(bool open);
+ virtual ~_LiveboxPopupEventArg(void);
+
+ bool IsOpened(void) const;
+
+private:
+ bool __opened;
+
+}; // _LiveboxPopupEventArg
+
+_LiveboxPopupEventArg::_LiveboxPopupEventArg(bool open)
+ : __opened(open)
+{
+}
+
+_LiveboxPopupEventArg::~_LiveboxPopupEventArg(void)
+{
+}
+
+bool
+_LiveboxPopupEventArg::IsOpened(void) const
+{
+ return __opened;
+}
+
+_LiveboxPopupViewEvent::_LiveboxPopupViewEvent(const _Control& source)
+ : __pSource(null)
+{
+ result r = _Event::Initialize();
+ SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pSource = &source;
+ SetLastResult(E_SUCCESS);
+}
+
+_LiveboxPopupViewEvent::~_LiveboxPopupViewEvent(void)
+{
+}
+
+_LiveboxPopupViewEvent*
+_LiveboxPopupViewEvent::CreateInstanceN(const _Control& source)
+{
+ _LiveboxPopupViewEvent* pLiveboxPopupEvent = new (std::nothrow) _LiveboxPopupViewEvent(source);
+ SysTryReturn(NID_UI_CTRL, pLiveboxPopupEvent, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
+
+ return pLiveboxPopupEvent;
+}
+
+const _Control*
+_LiveboxPopupViewEvent::GetSource(void) const
+{
+ return __pSource;
+}
+
+void
+_LiveboxPopupViewEvent::FireImpl(IEventListener& pListener, const IEventArg& arg)
+{
+ _ILiveboxPopupViewEventListener* pLiveboxPopupViewEventListener = dynamic_cast<_ILiveboxPopupViewEventListener*>(&pListener);
+ SysTryReturnVoidResult(NID_UI_CTRL, pLiveboxPopupViewEventListener, E_INVALID_ARG, "[E_INVALID_ARG] The invalid listener was given.\n");
+
+ const _LiveboxPopupEventArg* pLiveboxPopupEventArg = dynamic_cast <const _LiveboxPopupEventArg*>(&arg);
+ SysTryReturnVoidResult(NID_UI_CTRL, pLiveboxPopupEventArg, E_INVALID_ARG, "[E_INVALID_ARG] The invalid Event Argument was given.\n");
+
+ if ( pLiveboxPopupEventArg->IsOpened() )
+ {
+ pLiveboxPopupViewEventListener->OnLiveboxPopupViewOpened();
+ }
+ else
+ {
+ pLiveboxPopupViewEventListener->OnLiveboxPopupViewClosed();
+ }
+}
+
+IEventArg*
+_LiveboxPopupViewEvent::CreateLiveboxPopupViewEventArgN(bool open)
+{
+ _LiveboxPopupEventArg* pEventArg = new (std::nothrow) _LiveboxPopupEventArg(open);
+ SysTryReturn(NID_UI_CTRL, pEventArg != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
+
+ return pEventArg;
+}
+
+}} // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file FShell_LiveboxPopupViewEvent.h
+ * @brief This is the header file for _LiveboxPopupViewEvent class.
+ *
+ */
+#ifndef _FSHELL_INTERNAL_LIVEBOX_POPUP_VIEW_EVENT_H_
+#define _FSHELL_INTERNAL_LIVEBOX_POPUP_VIEW_EVENT_H_
+
+#include <FBaseResult.h>
+#include <FBaseRt_Event.h>
+
+namespace Tizen { namespace Ui
+{
+class _Control;
+}} // Tizen::Ui
+
+
+namespace Tizen { namespace Shell
+{
+
+class _LiveboxPopupViewEvent
+ : public Tizen::Base::Runtime::_Event
+{
+public:
+ _LiveboxPopupViewEvent(const Tizen::Ui::_Control& source);
+ virtual ~_LiveboxPopupViewEvent(void);
+
+ static _LiveboxPopupViewEvent* CreateInstanceN(const Tizen::Ui::_Control& source);
+
+public:
+ const Tizen::Ui::_Control* GetSource(void) const;
+
+ static Tizen::Base::Runtime::IEventArg* CreateLiveboxPopupViewEventArgN(bool open);
+
+protected:
+ virtual void FireImpl(Tizen::Base::Runtime::IEventListener& pListener, const Tizen::Base::Runtime::IEventArg& arg);
+
+private:
+ _LiveboxPopupViewEvent(const _LiveboxPopupViewEvent& rhs);
+ _LiveboxPopupViewEvent& operator=(const _LiveboxPopupViewEvent& rhs);
+
+private:
+ const Tizen::Ui::_Control* __pSource;
+}; // _LiveboxPopupViewEvent
+
+}} // Tizen::Shell
+
+
+#endif // _FSHELL_INTERNAL_LIVEBOX_POPUP_VIEW_EVENT_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file FShell_LiveboxPopupViewPresenter.cpp
+ * @brief This is the implementation file for the _LiveboxPopupViewPresenter class.
+ */
+
+#include <unique_ptr.h>
+#include <FBaseSysLog.h>
+#include "FShell_LiveboxPopupViewPresenter.h"
+#include "FShell_LiveboxPopupView.h"
+
+using namespace std;
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+
+namespace Tizen { namespace Shell
+{
+
+_LiveboxPopupViewPresenter::_LiveboxPopupViewPresenter(const _LiveboxPopupView& liveboxPopupView)
+ : __pLiveboxPopupView(null)
+{
+ __pLiveboxPopupView = const_cast <_LiveboxPopupView*>(&liveboxPopupView);
+}
+
+_LiveboxPopupViewPresenter::~_LiveboxPopupViewPresenter(void)
+{
+ __pLiveboxPopupView = null;
+}
+
+void
+_LiveboxPopupViewPresenter::Draw(void)
+{
+ Bitmap* pBitmap = __pLiveboxPopupView->GetBitmap();
+ SysTryReturnVoidResult(NID_UI_CTRL, pBitmap, E_SYSTEM, "Bitmap is invalid.");
+
+ unique_ptr<Canvas> pCanvas(__pLiveboxPopupView->GetCanvasN());
+ SysTryReturnVoidResult(NID_UI_CTRL, pCanvas, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
+ pCanvas->Clear();
+
+ pCanvas->DrawBitmap(Point(0, 0), *pBitmap);
+}
+
+}} // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file FShell_LiveboxPopupViewPresenter.h
+ * @brief This is the header file for the _LiveboxPopupViewPresenter class.
+ *
+ * This header file contains the declarations of the %_LiveboxPopupViewPresenter class.
+ */
+#ifndef _FSHELL_INTERNAL_LIVEBOX_POPUP_VIEW_PRESENTER_H_
+#define _FSHELL_INTERNAL_LIVEBOX_POPUP_VIEW_PRESENTER_H_
+
+namespace Tizen { namespace Shell
+{
+
+class _LiveboxPopupView;
+
+class _LiveboxPopupViewPresenter
+{
+public:
+ _LiveboxPopupViewPresenter(const _LiveboxPopupView& liveboxPopupView);
+ virtual ~_LiveboxPopupViewPresenter(void);
+
+ void Draw(void);
+
+private:
+ _LiveboxPopupViewPresenter(const _LiveboxPopupViewPresenter& rhs);
+ _LiveboxPopupViewPresenter& operator =(const _LiveboxPopupViewPresenter& rhs);
+
+private:
+ _LiveboxPopupView* __pLiveboxPopupView;
+}; // _LiveboxPopupViewPresenter
+
+}} // Tizen::Shell
+
+#endif // _FSHELL_INTERNAL_LIVEBOX_POPUP_VIEW_PRESENTER_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShell_LiveboxProviderImpl.cpp
+ * @brief This is the implementation for the _LiveboxProviderImpl class.
+ */
+
+#include <FBase.h>
+#include <FShellLiveboxFrame.h>
+
+#include "FShell_LiveboxProviderImpl.h"
+#include "FShell_LiveboxFrameImpl.h"
+
+namespace Tizen { namespace Shell
+{
+
+using namespace Tizen::Base;
+
+_LiveboxProviderImpl::_LiveboxProviderImpl(const String& instanceId)
+ :__instanceId(instanceId)
+ ,__pLiveboxFrame(null)
+{
+
+}
+
+_LiveboxProviderImpl::~_LiveboxProviderImpl()
+{
+ delete __pLiveboxFrame;
+}
+
+const String&
+_LiveboxProviderImpl::GetInstanceId() const
+{
+ return __instanceId;
+}
+
+result
+_LiveboxProviderImpl::SetLiveboxFrame(LiveboxFrame* pLiveboxFrame)
+{
+ if( __pLiveboxFrame == pLiveboxFrame)
+ {
+ return E_SUCCESS;
+ }
+
+ __pLiveboxFrame = pLiveboxFrame;
+
+ if( pLiveboxFrame == null)
+ {
+ return E_SUCCESS;
+ }
+
+ _LiveboxFrameImpl* pLiveboxFrameImpl = _LiveboxFrameImpl::GetInstance(*pLiveboxFrame);
+// SysAssertf(pLiveboxFrameImpl != null, "Not-yet constructed! Construct() should be called before use.");
+ SysTryReturnResult(NID_APP, pLiveboxFrameImpl, E_INVALID_OPERATION, "Not-yet constructed! LiveboxFrame::Construct() should be called before use.");
+
+ result r = pLiveboxFrameImpl->SetProviderId(GetInstanceId());
+ SysTryReturnResult(NID_APP, !IsFailed(r), E_SYSTEM, "Failed to invoke _LiveboxFrameImpl::SetProviderId.");
+
+ return E_SUCCESS;
+}
+
+LiveboxFrame*
+_LiveboxProviderImpl::GetLiveboxFrame() const
+{
+ return __pLiveboxFrame;
+}
+
+}} // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShell_LiveboxInfoImpl.cpp
+ * @brief This is the implementation for the _LiveboxInfoImpl class.
+ */
+
+#include <unique_ptr.h>
+#include <livebox-service/livebox-service.h>
+#include <FBase.h>
+#include <FBaseSysLog.h>
+#include <FBase_StringConverter.h>
+#include <FShellLiveboxProviderInfo.h>
+#include <FShellLiveboxSizeInfo.h>
+#include "FShell_LiveboxManagerImpl.h"
+#include "FShell_LiveboxProviderInfoImpl.h"
+#include "FShell_LiveboxSizeInfoImpl.h"
+
+namespace Tizen { namespace Shell {
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Graphics;
+
+
+_LiveboxProviderInfoImpl::_LiveboxProviderInfoImpl(const Tizen::App::AppId& appId, const Tizen::Base::String& name)
+ :__appId(appId)
+ ,__name(name)
+ ,__isDefault(false)
+{
+ __providerId = _LiveboxManagerImpl::MakeProviderName(appId, name);
+
+ std::unique_ptr<char[]> pProviderId(_StringConverter::CopyToCharArrayN(__providerId));
+ __displayName = livebox_service_i18n_name(pProviderId.get(), null);
+ __configurationAppControlAppId = livebox_service_setup_appid(pProviderId.get());
+
+ SysLog(NID_APP, "%ls.%ls, displayName(%ls), configuration(%ls)", appId.GetPointer(), name.GetPointer(), __displayName.GetPointer(), __configurationAppControlAppId.GetPointer() );
+}
+
+/*_LiveboxProviderInfoImpl::_LiveboxProviderInfoImpl(const _LiveboxProviderInfoImpl& rhs)
+{
+ __appId = rhs.__appId;
+ __name = rhs.__name;
+ __providerId = rhs.__providerId;
+}
+
+_LiveboxProviderInfoImpl&
+_LiveboxProviderInfoImpl::operator =(const _LiveboxProviderInfoImpl& rhs)
+{
+ __appId = rhs.__appId;
+ __name = rhs.__name;
+ __providerId = rhs.__providerId;
+
+ return *this;
+}*/
+
+_LiveboxProviderInfoImpl::~_LiveboxProviderInfoImpl()
+{
+}
+
+Tizen::App::AppId
+_LiveboxProviderInfoImpl::GetAppId() const
+{
+ return __appId;
+}
+
+Tizen::Base::String
+_LiveboxProviderInfoImpl::GetName() const
+{
+ return __name;
+}
+
+Tizen::Base::String
+_LiveboxProviderInfoImpl::GetDisplayName() const
+{
+/* std::unique_ptr<char[]> pPackageId(_StringConverter::CopyToCharArrayN(__providerId));
+ __displayName = livebox_service_i18n_name(pPackageId.get(), null);*/
+ return __displayName;
+}
+
+Tizen::Base::String
+_LiveboxProviderInfoImpl::GetIconPath() const
+{
+ std::unique_ptr<char[]> pPackageId(_StringConverter::CopyToCharArrayN(__providerId));
+ String iconPath = livebox_service_i18n_icon(pPackageId.get(), null);
+
+ return iconPath;
+}
+
+Tizen::Base::String
+_LiveboxProviderInfoImpl::GetConfigurationAppControlAppId() const
+{
+ return __configurationAppControlAppId;
+}
+
+bool
+_LiveboxProviderInfoImpl::IsDefault() const
+{
+ return __isDefault;
+}
+
+Tizen::Base::Collection::IList*
+_LiveboxProviderInfoImpl::GetSizeInfoListN() const
+{
+ const int SUPPORTED_SIZE_TYPE_MAX = 6;
+
+ int supportedSizeCount = SUPPORTED_SIZE_TYPE_MAX;
+ int widthArray[SUPPORTED_SIZE_TYPE_MAX];
+ int heightArray[SUPPORTED_SIZE_TYPE_MAX];
+
+ std::unique_ptr<char[]> pPackageId(_StringConverter::CopyToCharArrayN(__providerId));
+ livebox_service_get_supported_sizes(pPackageId.get(), &supportedSizeCount , widthArray, heightArray);
+
+ SysTryReturn(NID_APP, supportedSizeCount > 0, null, E_INVALID_ARG, "[E_INVALID_ARG] There is no livebox of provider(%ls)",__providerId.GetPointer() );
+
+ std::unique_ptr<ArrayList> pSizes(new (std::nothrow) ArrayList);
+ SysTryReturn(NID_APP, pSizes, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to allocate memory for ArrayList." );
+
+ pSizes->Construct();
+ FloatDimension size(0, 0);
+ String previewImagePath;
+
+ for(int i = 0; i < supportedSizeCount; i++)
+ {
+ size.SetSize(widthArray[i], heightArray[i]);
+ previewImagePath = livebox_service_preview(pPackageId.get(), livebox_service_size_type(static_cast<int>(size.width), static_cast<int>(size.height) ) );
+ std::unique_ptr<LiveboxSizeInfo> pLiveboxSizeInfo(_LiveboxSizeInfoImpl::CreateLiveboxSizeInfo(size, previewImagePath) );
+ SysTryReturn(NID_APP, pLiveboxSizeInfo, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to allocate memory for LiveboxSizeInfo." );
+ pSizes->Add( *pLiveboxSizeInfo.release() );
+ }
+ return pSizes.release();
+}
+
+LiveboxProviderInfo*
+_LiveboxProviderInfoImpl::GetLiveboxProviderInfoN(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName)
+{
+ return new (std::nothrow) LiveboxProviderInfo(appId, providerName);
+}
+
+LiveboxProviderInfo*
+_LiveboxProviderInfoImpl::GetLiveboxProviderInfoN(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, bool isDefault)
+{
+ LiveboxProviderInfo* pInfo = new (std::nothrow) LiveboxProviderInfo(appId, providerName);
+ SysTryReturn(NID_APP, pInfo, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to allocate memory for LiveboxProviderInfo." );
+
+ _LiveboxProviderInfoImpl::GetImpl(*pInfo)->__isDefault = isDefault;
+
+ return pInfo;
+}
+
+_LiveboxProviderInfoImpl*
+_LiveboxProviderInfoImpl::GetImpl(const LiveboxProviderInfo& liveboxProviderInfo)
+{
+ return static_cast<_LiveboxProviderInfoImpl*>(liveboxProviderInfo.__pLiveboxProviderInfoImpl);
+}
+
+} /* namespace Livebox */
+} /* namespace Samsung */
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShell_LiveboxManagerImpl.cpp
+ * @brief This is the implementation for the _LiveboxManagerImpl class.
+ */
+
+#include <unique_ptr.h>
+#include <errno.h>
+#include <string.h>
+#include <shortcut.h>
+
+#include <FBaseSysLog.h>
+#include <FBase.h>
+#include <FApp.h>
+#include <FGrpDimension.h>
+
+#include <FApp_Aul.h>
+#include <FApp_AppInfo.h>
+#include <FApp_AppImpl.h>
+#include <FApp_ServiceAppImpl.h>
+#include <FAppPkg_PackageManagerImpl.h>
+#include <FBase_StringConverter.h>
+
+#include <FShellLiveboxProviderInfo.h>
+#include <FShellLiveboxProvider.h>
+#include <FShellLiveboxPopupProvider.h>
+#include <FShellLiveboxFrame.h>
+#include <FShellLiveboxPopup.h>
+
+#include <FShellILiveboxProviderFactory.h>
+#include <FShellILiveboxPopupProviderFactory.h>
+
+#include <FShell_ILiveboxTouchEventListener.h>
+#include <FShell_TemplateUtil.h>
+
+#include "FShell_LiveboxManagerProxy.h"
+#include "FShell_LiveboxProviderManagerImpl.h"
+
+#include "FShell_LiveboxProviderInfoImpl.h"
+
+namespace Tizen { namespace Shell
+{
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::App;
+using namespace Tizen::App::Package;
+using namespace Tizen::Graphics;
+
+
+namespace
+{
+const char LIVEBOX_ON_ADD[] = "Livebox='event=add'";
+const char LIVEBOX_ON_REMOVE[] = "Livebox='event=remove'";
+const char LIVEBOX_ON_UPDATE[] = "Livebox='event=update'";
+const char LIVEBOX_ON_RESIZE[] = "Livebox='event=resize'";
+const char LIVEBOX_ON_TOUCH[] = "Livebox='event=touch'";
+const char LIVEBOX_TRAY_ON_CREATE[] = "LiveboxTray='event=create'";
+const char LIVEBOX_TRAY_ON_DESTROY[] = "LiveboxTray='event=destroy'";
+const char LIVEBOX_TRAY_ON_TOUCH[] = "LiveboxTray='event=touch'";
+
+const String ARG_KEY_INSTANCE_ID = L"_InstanceId";
+const String ARG_KEY_PROVIDER_NAME = L"_ProviderName";
+const String ARG_KEY_USER_INFO = L"_UserInfo";
+const String ARG_KEY_WIDTH = L"_Width";
+const String ARG_KEY_HEIGHT = L"_Height";
+const String ARG_KEY_ARGUMENT = L"_Argument";
+const String ARG_KEY_EVENT_TYPE = L"_EventType";
+const String ARG_KEY_TIME_STAMP = L"_TimeStamp";
+const String ARG_KEY_X = L"_X";
+const String ARG_KEY_Y = L"_Y";
+}
+
+_LiveboxProviderManagerImpl::_LiveboxProviderManagerImpl()
+ :__pLiveboxFactory(null)
+ ,__pLiveboxPopupProviderFactory(null)
+ ,__pLiveboxPopupProvider(null)
+ ,__LiveboxPopupTouchEventListener(null)
+// ,__messageReceived(false)
+{
+ SysLog(NID_APP, "");
+}
+
+_LiveboxProviderManagerImpl::~_LiveboxProviderManagerImpl()
+{
+ SysLog(NID_APP, "");
+}
+
+
+_LiveboxProviderManagerImpl*
+_LiveboxProviderManagerImpl::GetInstance()
+{
+ static _LiveboxProviderManagerImpl* __pLiveboxManagerImpl = null;
+ if( __pLiveboxManagerImpl == null)
+ {
+ __pLiveboxManagerImpl = new (std::nothrow)_LiveboxProviderManagerImpl;
+ SysTryReturn(NID_APP, __pLiveboxManagerImpl, null, E_OUT_OF_MEMORY, "Allocating new _LiveboxManagerProxy failed.");
+
+ result r = __pLiveboxManagerImpl->Construct();
+ SysTryReturn(NID_APP, !IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ return __pLiveboxManagerImpl;
+}
+
+result
+_LiveboxProviderManagerImpl::Construct()
+{
+ SysLog(NID_APP, "Enter.");
+
+ __liveboxProviders.Construct();
+ __touchEventListeners.Construct();
+
+ Tizen::App::_AppImpl::GetInstance()->SetAppControlProviderInternalEventListener(this);
+
+ SysLog(NID_APP, "Exit.");
+ return E_SUCCESS;
+}
+
+result
+_LiveboxProviderManagerImpl::SetLiveboxProviderFactory(ILiveboxProviderFactory& factory)
+{
+ result r = ValidateApplicationAttributeForLivebox();
+ SysTryReturnResult(NID_APP, !IsFailed(r), E_INVALID_OPERATION, "This application can't export Livebox provider.");
+
+ __pLiveboxFactory = &factory;
+ return E_SUCCESS;
+}
+
+const wchar_t USE_UI_KEY[] = L"UseUi";
+const wchar_t USE_UI_VAL_TRUE[] = L"True";
+const wchar_t LIFE_DURATION_KEY[] = L"LifeDuration";
+const int LIFE_DURATION_MIN = 30000;
+
+result
+_LiveboxProviderManagerImpl::ValidateApplicationAttributeForLivebox(void)
+{
+ HashMapT<String, _AppFeatureInfoImpl*>* pInfo = _PackageManagerImpl::GetInstance()->GetPackageAppFeatureMapN(_AppInfo::GetPackageId(), _AppInfo::GetAppExecutableName());
+ SysTryReturnResult(NID_APP, pInfo, E_SYSTEM, "Failed to invoke _PackageManagerImpl::GetPackageAppFeatureMapN()");
+
+ _AppFeatureInfoImpl* pFeature = null;
+
+ result r = pInfo->GetValue(USE_UI_KEY, pFeature);
+ SysTryReturnResult(NID_APP, !IsFailed(r), E_INVALID_OPERATION, "Can't find %ls attribute for the ServiceApp in package information.", USE_UI_KEY );
+
+ const String& useUi = pFeature->GetValue();
+ SysTryReturnResult(NID_APP, useUi == USE_UI_VAL_TRUE, E_INVALID_OPERATION, "%ls attribute value should be '%ls' to be an application that providing Livebox, but value is %ls", USE_UI_KEY, USE_UI_VAL_TRUE, useUi.GetPointer() );
+
+ r = pInfo->GetValue(LIFE_DURATION_KEY, pFeature);
+ SysTryReturnResult(NID_APP, !IsFailed(r), E_INVALID_OPERATION, "Can't find %ls attribute for the ServiceApp in package information.", LIFE_DURATION_KEY );
+
+ const String& lifeDurationValue = pFeature->GetValue();
+ int lifeDuration = 0;
+ r = Tizen::Base::Integer::Parse(lifeDurationValue, lifeDuration);
+ SysTryReturnResult(NID_APP, !IsFailed(r), E_INVALID_OPERATION, "Failed to parse %ls attribute for the ServiceApp in package information.", LIFE_DURATION_KEY );
+// SysTryReturnResult(NID_APP, lifeDuration <= LIFE_DURATION_MIN, E_INVALID_OPERATION, "%ls attribute value should be less than '%d' to be an application that providing Livebox, but value is %d", LIFE_DURATION_KEY, LIFE_DURATION_MIN, lifeDuration );
+
+ return E_SUCCESS;
+}
+
+result
+_LiveboxProviderManagerImpl::SetLiveboxPopupProviderFactory(ILiveboxPopupProviderFactory& factory)
+{
+ result r = ValidateApplicationAttributeForLivebox();
+ SysTryReturnResult(NID_APP, !IsFailed(r), E_INVALID_OPERATION, "This application can't export Livebox provider.");
+
+ __pLiveboxPopupProviderFactory = &factory;
+ return E_SUCCESS;
+}
+
+result
+_LiveboxProviderManagerImpl::SetLiveboxTouchEventListener(const String& instanceId, _ILiveboxTouchEventListener& listener)
+{
+ return __touchEventListeners.Add(instanceId, &listener);
+}
+
+result
+_LiveboxProviderManagerImpl::SetLiveboxPopupEventListener(_ILiveboxTouchEventListener& listener)
+{
+ __LiveboxPopupTouchEventListener = &listener;
+
+ return E_SUCCESS;
+}
+
+result
+_LiveboxProviderManagerImpl::RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument)
+{
+
+ SysLog(NID_APP, "Enter.");
+ /*if( appId == App::App::GetInstance()->GetAppId())
+ {
+ //TODO: optimizing for local request
+ }
+ else*/
+ {
+ _LiveboxManagerProxy* pProxy = _LiveboxManagerProxy::GetInstance();
+ SysTryReturnResult(NID_APP, pProxy, E_SYSTEM, "Failed to get proxy instance!");
+
+ return pProxy->RequestUpdate(appId, providerName, argument);
+ }
+
+}
+
+result
+_LiveboxProviderManagerImpl::RequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument)
+{
+ if(ContainsLivebox(instanceId))
+ {
+ LiveboxProvider* pLiveboxProvider = null;
+ __liveboxProviders.GetValue(instanceId, pLiveboxProvider);
+
+ LiveboxFrame* pLiveBoxFrame = pLiveboxProvider->GetLiveboxFrame();
+ SysTryReturnResult(NID_APP, pLiveBoxFrame, E_SYSTEM, "Failed to GetLiveboxFrame");
+
+ pLiveboxProvider->OnLiveboxProviderUpdating(argument);
+ }
+ else
+ {
+ _LiveboxManagerProxy* pProxy = _LiveboxManagerProxy::GetInstance();
+ SysTryReturnResult(NID_APP, pProxy, E_SYSTEM, "Failed to get proxy instance!");
+
+ return pProxy->RequestUpdateInstance(instanceId, argument);
+ }
+
+ return E_SUCCESS;
+}
+
+namespace
+{
+int AddLiveboxCallback(int ret, int pid, void *data)
+{
+ if( ret != 0)
+ {
+ SysLog(NID_APP, "Error.(%d)", ret);
+ }
+
+ return 0;
+}
+}
+
+result
+_LiveboxProviderManagerImpl::AddLivebox(const Tizen::App::AppId& providerAppId, const Tizen::Base::String& providerName, const Tizen::Base::String& text, const Tizen::Base::String& userInfo)
+{
+ SysTryReturnResult(NID_APP, providerAppId.IsEmpty()==false, E_INVALID_ARG, "The providerAppId is empty.");
+ SysTryReturnResult(NID_APP, providerAppId.GetLength() < NATIVE_APP_MAX_APPID_LENGTH, E_INVALID_ARG, "The providerAppId is too long (Maximum %d bytes).", NATIVE_APP_MAX_APPID_LENGTH);
+ SysTryReturnResult(NID_APP, Tizen::App::_Aul::IsInstalled(providerAppId) == true, E_APP_NOT_INSTALLED, "The application(%ls) is not installed.", providerAppId.GetPointer());
+
+ //TODO :: check privilege
+ String providerId;
+ if( providerAppId.StartsWith(L"com.samsung", 0) == true )
+ {
+ SysLog(NID_APP, "[E_INVALID_OPERATION] but allowed to test");
+ //TODO:return E_INVALID_OPERATION
+ providerId = providerAppId;
+ }
+ else
+ {
+ String localPackageId = _PackageManagerImpl::GetPackageIdByAppId(Tizen::App::App::GetInstance()->GetAppId());
+ String liveboxProviderPackageId = _PackageManagerImpl::GetPackageIdByAppId(providerAppId);
+ if( localPackageId != liveboxProviderPackageId)
+ {
+ SysLog(NID_APP, "[E_INVALID_OPERATION] but allowed to test");
+ //TODO:return E_INVALID_OPERATION
+ }
+ providerId = providerAppId + "." + providerName;
+ }
+
+
+ result r = E_SUCCESS;
+
+ PackageAppInfo* pPackageInfo = _PackageManagerImpl::GetInstance()->GetPackageAppInfoN(providerAppId);
+ SysTryReturn(NID_APP, pPackageInfo != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ String iconPath = pPackageInfo->GetAppMenuIconPath();
+ delete pPackageInfo;
+
+ std::unique_ptr<char[]> pProviderId(_StringConverter::CopyToCharArrayN(providerId));
+ std::unique_ptr<char[]> pName(_StringConverter::CopyToCharArrayN(text));
+ std::unique_ptr<char[]> pContent(_StringConverter::CopyToCharArrayN(userInfo));
+ std::unique_ptr<char[]> pIcon(_StringConverter::CopyToCharArrayN(iconPath));
+
+ int ret = add_to_home_livebox(pProviderId.get(), pName.get(), LIVEBOX_TYPE_DEFAULT, pContent.get(), pIcon.get(), -1.0l, AddLiveboxCallback, this);
+ SysTryReturnResult(NID_APP, ret != -ENOTCONN, E_CONNECTION_FAILED, "[E_CONNECTION_FAILED] failed to add_to_home_livebox");
+ SysTryReturnResult(NID_APP, ret == 0, E_SYSTEM, "[E_SYSTEM] failed to add_to_home_livebox (%s)", strerror(r));
+
+ return E_SUCCESS;
+}
+
+bool
+_LiveboxProviderManagerImpl::ContainsLivebox(const String& instanceId) const
+{
+ bool contains = false;
+ __liveboxProviders.ContainsKey(instanceId, contains);
+
+ return contains;
+}
+
+//void
+//_LiveboxProviderManagerImpl::TerminateAppIfInvalidState()
+//{
+// if( __messageReceived == false )
+// {
+// Tizen::App::App::GetInstance()->Terminate();
+// }
+//}
+
+void
+_LiveboxProviderManagerImpl::OnAppControlRequestReceived(RequestId reqId, const String& operationId, const String* pUri, const String* pMimeType, const IMap* pArgs)
+{
+ SysAssertf( pArgs, "[E_SYSTEN] pArgs should not be null.");
+ SysAssertf( pArgs->GetCount() > 0, "[E_SYSTEN] pArgs should have one more key-values.");
+
+// __messageReceived = true;
+
+ SysLog(NID_APP, "operationId(%ls), argc(%d)", operationId.GetPointer(), pArgs->GetCount());
+
+ const String* pInstanceId = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_INSTANCE_ID));
+ SysTryReturnVoidResult(NID_APP, pInstanceId, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_INSTANCE_ID.GetPointer() );
+
+ const String* pName = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_PROVIDER_NAME));
+ SysTryReturnVoidResult(NID_APP, pName, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_PROVIDER_NAME.GetPointer() );
+
+ const String* pParam = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_USER_INFO));
+ SysTryReturnVoidResult(NID_APP, pParam, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_USER_INFO.GetPointer() );
+
+ SysLog(NID_APP, "id(%ls), name(%ls), param(%ls)", pInstanceId->GetPointer(), pName->GetPointer(), pParam->GetPointer());
+
+ if(operationId.StartsWith(L"LiveboxTray", 0) == true)
+ {
+ SysTryReturnVoidResult(NID_APP, __pLiveboxPopupProviderFactory, E_FAILURE, "[E_FAILURE] __pLiveboxPopupProviderFactory is null");
+ HandleLiveboxPopupRequest(operationId, pArgs);
+ }
+ else
+ {
+ if(this->ContainsLivebox(*pInstanceId) == false)
+ {
+ SysLog(NID_APP, "no livebox instance, creating..");
+
+ int width = 0;
+ const String* pValue = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_WIDTH));
+ SysTryReturnVoidResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_WIDTH.GetPointer() );
+ Integer::Parse(*pValue, width);
+
+ int height = 0;
+ pValue = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_HEIGHT));
+ SysTryReturnVoidResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_HEIGHT.GetPointer() );
+ Integer::Parse(*pValue, height);
+
+ this->CreateLivebox( *pName, *pInstanceId, width, height, *pParam);
+
+ if(operationId == LIVEBOX_ON_RESIZE)
+ {
+ SysLog(NID_APP, "operation is resize, but livebox is already recreated with new size, so OnSize won't be called.");
+ return;
+ }
+ }
+
+ SysTryReturnVoidResult(NID_APP, __pLiveboxFactory, E_FAILURE, "[E_FAILURE] __pLiveboxFactory is null");
+ HandleLiveboxRequest(operationId, pArgs);
+ }
+ SysLog(NID_APP, "Exit");
+}
+
+result
+_LiveboxProviderManagerImpl::HandleLiveboxRequest(const Tizen::Base::String& operationId, const Tizen::Base::Collection::IMap* pArgs)
+{
+ if( pArgs == null || pArgs->GetCount() < 3)
+ {
+ SysAssertf(pArgs, "[E_SYSTEN] pArgs should not be null.");
+ return E_SYSTEM;
+ }
+
+ SysLog(NID_APP, "operationId(%ls), argc(%d)", operationId.GetPointer(), pArgs->GetCount());
+
+ const String* pInstanceId = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_INSTANCE_ID));
+ SysTryReturnResult(NID_APP, pInstanceId, E_FAILURE, "[E_FAILURE] pId is null.");
+
+ /*String *pName = dynamic_cast<String*>(pArgs->GetAt(1));
+ SysTryReturnResult(NID_APP, pInstanceId, E_FAILURE, "[E_FAILURE] pName is null");
+
+ String *pParam = dynamic_cast<String*>(pArgs->GetAt(2));
+ SysTryReturnResult(NID_APP, pParam, E_FAILURE, "[E_FAILURE] pName is null");
+
+ SysLog(NID_APP, "id(%ls), name(%d)", pInstanceId->GetPointer(), pName->GetPointer());*/
+
+ /*if( operationId == LIVEBOX_ON_ADD )
+ {
+ int w = 0;
+ int h = 0;
+ String* pValue = dynamic_cast<String*>(pArgs->GetAt(2));
+ SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]");
+ Integer::Parse(*pValue, w);
+
+ pValue = dynamic_cast<String*>(pArgs->GetAt(3));
+ SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]");
+ Integer::Parse(*pValue, h);
+
+ this->__pLiveboxEventListener->OnLiveboxAdded(*pId, width, height, pArgs);
+ }*/
+
+ if (operationId == LIVEBOX_ON_RESIZE)
+ {
+ int width = 0;
+ int height = 0;
+ const String* pValue = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_WIDTH));
+ SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_WIDTH.GetPointer() );
+ Integer::Parse(*pValue, width);
+
+ pValue = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_HEIGHT));
+ SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_HEIGHT.GetPointer() );
+ Integer::Parse(*pValue, height);
+
+ this->ResizeLivebox(*pInstanceId, width, height);
+ }
+ else if (operationId == LIVEBOX_ON_UPDATE)
+ {
+ int width = 0;
+ int height = 0;
+ const String* pValue = dynamic_cast<const String*>( pArgs->GetValue(ARG_KEY_WIDTH));
+ SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_WIDTH.GetPointer() );
+ Integer::Parse(*pValue, width);
+
+ pValue = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_HEIGHT));
+ SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_HEIGHT.GetPointer() );
+ Integer::Parse(*pValue, height);
+
+ pValue = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_ARGUMENT));
+ SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_ARGUMENT.GetPointer() );
+
+ this->UpdateLivebox(*pInstanceId, width, height, *pValue);
+ }
+ else if (operationId == LIVEBOX_ON_REMOVE)
+ {
+ this->RemoveLivebox(*pInstanceId, true);
+ }
+ else if (operationId == LIVEBOX_ON_TOUCH)
+ {
+ int eventType = 0;
+ double timeStamp = 0.0f;
+ double x = 0.0f;
+ double y = 0.0f;
+
+ const String* pValue = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_EVENT_TYPE));
+ SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_EVENT_TYPE.GetPointer() );
+ Integer::Parse(*pValue, eventType);
+
+ pValue = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_TIME_STAMP));
+ SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_TIME_STAMP.GetPointer() );
+ Double::Parse(*pValue, timeStamp);
+
+ pValue = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_X));
+ SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_X.GetPointer() );
+ Double::Parse(*pValue, x);
+
+ pValue = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_Y));
+ SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_Y.GetPointer() );
+ Double::Parse(*pValue, y);
+
+ this->ForwardTouchEvent(*pInstanceId, eventType, timeStamp, x, y);
+ }
+ SysLog(NID_APP, "Exit");
+ return E_SUCCESS;
+}
+
+result
+_LiveboxProviderManagerImpl::HandleLiveboxPopupRequest(const Tizen::Base::String& operationId, const Tizen::Base::Collection::IMap* pArgs)
+{
+ SysTryReturnResult(NID_APP, __pLiveboxPopupProviderFactory, E_FAILURE, "[E_FAILURE] __pLiveboxPopupProviderFactory is null");
+ if( pArgs == null || pArgs->GetCount() < 3)
+ {
+ SysAssertf(pArgs, "[E_SYSTEN] pArgs should not be null.");
+ return E_SYSTEM;
+ }
+
+ const String* pInstanceId = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_INSTANCE_ID));
+ SysTryReturnResult(NID_APP, pInstanceId, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_INSTANCE_ID.GetPointer() );
+
+ if (operationId == LIVEBOX_TRAY_ON_CREATE)
+ {
+ double x = 0;
+ double y = 0;
+ int width = 0;
+ int height = 0;
+
+ const String* pName = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_PROVIDER_NAME));
+ SysTryReturnResult(NID_APP, pName, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_PROVIDER_NAME.GetPointer() );
+
+ const String* pUserInfo = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_USER_INFO));
+ SysTryReturnResult(NID_APP, pUserInfo, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_USER_INFO.GetPointer() );
+
+ const String* pValue = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_X));
+ SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_X.GetPointer() );
+ Double::Parse(*pValue, x);
+
+ pValue = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_Y));;
+ SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_Y.GetPointer() );
+ Double::Parse(*pValue, y);
+
+ pValue = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_WIDTH));
+ SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_WIDTH.GetPointer() );
+ Integer::Parse(*pValue, width);
+
+ pValue = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_HEIGHT));;
+ SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_HEIGHT.GetPointer() );
+ Integer::Parse(*pValue, height);
+
+ this->CreateLiveboxPopupProvider(*pInstanceId, *pName, *pUserInfo, x, y, width, height);
+ return E_SUCCESS;
+ }
+ else if (operationId == LIVEBOX_TRAY_ON_DESTROY)
+ {
+ this->DestroyLiveboxPopupProvider(*pInstanceId);
+ return E_SUCCESS;
+ }
+ else if (operationId == LIVEBOX_TRAY_ON_TOUCH)
+ {
+ SysAssertf(pArgs->GetCount() == 6, "invalid argc(%d)", pArgs->GetCount() );
+
+ int eventType = 0;
+ double timeStamp = 0.0f;
+ double x = 0.0f;
+ double y = 0.0f;
+
+ const String* pValue = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_EVENT_TYPE));
+ SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_EVENT_TYPE.GetPointer() );
+ Integer::Parse(*pValue, eventType);
+
+ pValue = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_TIME_STAMP));
+ SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_TIME_STAMP.GetPointer() );
+ Double::Parse(*pValue, timeStamp);
+
+ pValue = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_X));
+ SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_X.GetPointer() );
+ Double::Parse(*pValue, x);
+
+ pValue = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_Y));
+ SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_Y.GetPointer() );
+ Double::Parse(*pValue, y);
+
+ ForwardTouchEventForPD(*pInstanceId, eventType, timeStamp, x, y);
+ }
+ else
+ {
+ SysLog(NID_APP, "unexpected case(%ls)", operationId.GetPointer() );
+ }
+
+ return E_SUCCESS;
+}
+
+result
+_LiveboxProviderManagerImpl::CreateLivebox(const String& name, const String& instanceId, int width, int height, const String& userInfo)
+{
+ SysLog(NID_APP, "instanceId(%ls), w:%d, h:%d, userInfo:%ls", instanceId.GetPointer(), width, height, userInfo.GetPointer());
+ SysTryReturnResult(NID_APP, __pLiveboxFactory, E_FAILURE, "[E_INVALID_OPERATION] __pLiveboxFactory should not be null");
+
+ if( ContainsLivebox(instanceId))
+ {
+ SysLog(NID_APP, "CreateLivebox invoke is duplicated!!");
+ RemoveLivebox(instanceId, false);
+ }
+
+ LiveboxProvider* pLivebox = __pLiveboxFactory->CreateInstance(name, width, height, userInfo);
+ SysTryReturnResult(NID_APP, pLivebox, E_INVALID_OPERATION, "[E_INVALID_OPERATION]");
+
+ pLivebox->Construct(instanceId);
+ __liveboxProviders.Add(instanceId, pLivebox);
+
+ pLivebox->OnLiveboxProviderInitializing(width, height, userInfo);
+
+ SysTryReturnResult(NID_APP, pLivebox->GetLiveboxFrame(), E_INVALID_OPERATION, "[E_INVALID_OPERATION]");
+
+ return E_SUCCESS;
+}
+
+result
+_LiveboxProviderManagerImpl::UpdateLivebox(const String& instanceId, int width, int height, const String& argument)
+{
+ SysLog(NID_APP, "instanceId(%ls), w:%d, h:%d, argument:%ls", instanceId.GetPointer(), width, height, argument.GetPointer() );
+
+ LiveboxProvider* pLivebox = null;
+ __liveboxProviders.GetValue(instanceId, pLivebox);
+ SysTryReturnResult(NID_APP, pLivebox, E_SYSTEM, "Can't find the Livebox provider");
+
+ pLivebox->OnLiveboxProviderUpdating(argument);
+
+ return E_SUCCESS;
+}
+
+result
+_LiveboxProviderManagerImpl::ResizeLivebox(const String& instanceId, int width, int height)
+{
+ SysLog(NID_APP, "instanceId(%ls), w:%d, h:%d", instanceId.GetPointer(), width, height);
+
+ LiveboxProvider* pLivebox = null;
+ __liveboxProviders.GetValue(instanceId, pLivebox);
+ SysTryReturnResult(NID_APP, pLivebox, E_SYSTEM, "Can't find the Livebox provider");
+
+ LiveboxFrame* pLiveBoxFrame = pLivebox->GetLiveboxFrame();
+ SysTryReturnResult(NID_APP, pLiveBoxFrame, E_SYSTEM, "GetLiveboxFrame() returns 'null'.");
+
+ return pLiveBoxFrame->SetSize(Dimension(width, height));
+}
+
+result
+_LiveboxProviderManagerImpl::RemoveLivebox(const String& instanceId, bool terminateIfFinished)
+{
+ SysLog(NID_APP, "instanceId(%ls), terminateIfFinished(%s)", instanceId.GetPointer(), (terminateIfFinished)? "true":"false" );
+// __pLiveboxEventListener->OnLiveboxRemoved(instanceId);
+
+ LiveboxProvider* pLiveboxProvider = null;
+ __liveboxProviders.GetValue(instanceId, pLiveboxProvider);
+ result r = __liveboxProviders.Remove(instanceId);
+ SysLog(NID_APP, "%s", GetErrorMessage(r) );
+
+ if( pLiveboxProvider != null)
+ {
+ delete pLiveboxProvider;
+ }
+
+ SysLog(NID_APP, "(%d) provider(s) remains.", __liveboxProviders.GetCount() );
+
+ if( terminateIfFinished && this->__liveboxProviders.GetCount() == 0)
+ {
+ Tizen::App::App::GetInstance()->Terminate();
+ }
+
+ return E_SUCCESS;
+}
+
+result
+_LiveboxProviderManagerImpl::CreateLiveboxPopupProvider(const String& instanceId, const String& providerName, const String& userInfo, double x, double y, int width, int height)
+{
+ SysLog(NID_APP, "instanceId(%ls), providerName(%ls), userInfo(%ls), rect(%f, %f, %d, %d)", instanceId.GetPointer(), providerName.GetPointer(), userInfo.GetPointer(), x, y, width, height );
+ SysTryReturnResult(NID_APP, __pLiveboxPopupProviderFactory, E_FAILURE, "[E_INVALID_OPERATION] __pLiveboxPopupProviderFactory should not be null");
+
+ LiveboxPopupProvider* pPd = __pLiveboxPopupProviderFactory->CreateInstance(providerName, userInfo);
+ __pLiveboxPopupProvider = pPd;
+
+ __pLiveboxPopupProvider->Construct(instanceId, x, y);
+ __pLiveboxPopupProvider->OnLiveboxPopupProviderInitializing(userInfo);
+
+ LiveboxPopup* pLiveBoxFrame = pPd->GetLiveboxPopup();
+ SysTryReturnResult(NID_APP, pLiveBoxFrame, E_INVALID_OPERATION, "[E_INVALID_OPERATION] LiveboxPopup should be set using LiveboxPopupProvider::SetLiveboxPopup()");
+
+ return E_SUCCESS;
+}
+
+result
+_LiveboxProviderManagerImpl::DestroyLiveboxPopupProvider(const String& instanceId)
+{
+ SysLog(NID_APP, "instanceId(%ls)", instanceId.GetPointer());
+
+ if( __pLiveboxPopupProvider != null)
+ {
+ __pLiveboxPopupProvider->OnLiveboxPopupProviderTerminating();
+ delete __pLiveboxPopupProvider;
+ __pLiveboxPopupProvider = null;
+ }
+
+ return E_SUCCESS;
+}
+
+result
+_LiveboxProviderManagerImpl::ForwardTouchEvent(const String& instanceId, int eventType, double timeStamp, double x, double y)
+{
+ SysLog(NID_APP, "instanceId(%ls), eventType(%d), timeStamp(%f), x(%f), y(%f)", instanceId.GetPointer(), eventType, timeStamp, x, y);
+
+ _ILiveboxTouchEventListener* pTouchEventListener = null;
+ __touchEventListeners.GetValue(instanceId, pTouchEventListener);
+ SysTryReturnResult(NID_APP, pTouchEventListener, E_INVALID_STATE, "[E_INVALID_STATE]");
+
+ pTouchEventListener->OnTouchEventRecevied(eventType, timeStamp, x, y);
+
+ return E_SUCCESS;
+}
+
+result
+_LiveboxProviderManagerImpl::ForwardTouchEventForPD(const String& instanceId, int eventType, double timeStamp, double x, double y)
+{
+ SysTryReturnResult(NID_APP, __LiveboxPopupTouchEventListener, E_INVALID_STATE, "[E_INVALID_STATE]");
+ __LiveboxPopupTouchEventListener->OnTouchEventRecevied(eventType, timeStamp, x, y);
+
+ return E_SUCCESS;
+}
+//////////////////////////////////////////////////////////////////////////
+// buffer APIs
+//////////////////////////////////////////////////////////////////////////
+
+result
+_LiveboxProviderManagerImpl::RequestSharedMemoryId(const Tizen::Base::String& instanceId, int width, int height, int& shmId)
+{
+ _LiveboxManagerProxy* pProxy = _LiveboxManagerProxy::GetInstance();
+ SysTryReturnResult(NID_APP, pProxy, E_SYSTEM, "Failed to get proxy instance!");
+
+ return pProxy->RequestSharedMemoryId(instanceId, width, height, shmId);
+}
+
+result
+_LiveboxProviderManagerImpl::RequestSharedMemoryIdForPD(const Tizen::Base::String& instanceId, int width, int height, int& shmId)
+{
+ _LiveboxManagerProxy* pProxy = _LiveboxManagerProxy::GetInstance();
+ SysTryReturnResult(NID_APP, pProxy, E_SYSTEM, "Failed to get proxy instance!");
+
+ return pProxy->RequestSharedMemoryIdForPD(instanceId, width, height, shmId);
+}
+
+result
+_LiveboxProviderManagerImpl::RequestReleaseSharedMemory(const Tizen::Base::String& instanceId)
+{
+ _LiveboxManagerProxy* pProxy = _LiveboxManagerProxy::GetInstance();
+ SysTryReturnResult(NID_APP, pProxy, E_SYSTEM, "Failed to get proxy instance!");
+
+ return pProxy->RequestReleaseSharedMemory(instanceId);
+}
+
+result
+_LiveboxProviderManagerImpl::RequestReleaseSharedMemoryForPD(const Tizen::Base::String& instanceId)
+{
+ _LiveboxManagerProxy* pProxy = _LiveboxManagerProxy::GetInstance();
+ SysTryReturnResult(NID_APP, pProxy, E_SYSTEM, "Failed to get proxy instance!");
+
+ return pProxy->RequestReleaseSharedMemoryForPD(instanceId);
+}
+
+result
+_LiveboxProviderManagerImpl::RequestSyncSharedMemory(const Tizen::Base::String& instanceId, int width, int height)
+{
+ _LiveboxManagerProxy* pProxy = _LiveboxManagerProxy::GetInstance();
+ SysTryReturnResult(NID_APP, pProxy, E_SYSTEM, "Failed to get proxy instance!");
+
+ return pProxy->RequestSyncSharedMemory(instanceId, width, height);
+}
+
+result
+_LiveboxProviderManagerImpl::RequestSyncSharedMemoryForPD(const Tizen::Base::String& instanceId)
+{
+ _LiveboxManagerProxy* pProxy = _LiveboxManagerProxy::GetInstance();
+ SysTryReturnResult(NID_APP, pProxy, E_SYSTEM, "Failed to get proxy instance!");
+
+ return pProxy->RequestSyncSharedMemoryForPD(instanceId);
+}
+
+}} // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShell_LiveboxSizeInfoImpl.cpp
+ * @brief This is the implementation for the _LiveboxSizeInfoImpl class.
+ */
+
+#include <unique_ptr.h>
+#include <livebox-service/livebox-service.h>
+#include <FBase.h>
+#include <FBaseSysLog.h>
+#include <FBase_StringConverter.h>
+#include <FShellLiveboxProviderInfo.h>
+#include <FShellLiveboxSizeInfo.h>
+
+#include "FShell_LiveboxProviderInfoImpl.h"
+#include "FShell_LiveboxSizeInfoImpl.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Graphics;
+
+namespace Tizen { namespace Shell
+{
+
+_LiveboxSizeInfoImpl::_LiveboxSizeInfoImpl(FloatDimension size, const String& previewImagePath)
+{
+ __size = size;
+ __previewImagePath = previewImagePath;
+}
+
+_LiveboxSizeInfoImpl::_LiveboxSizeInfoImpl(const _LiveboxSizeInfoImpl& rhs)
+{
+ __size = rhs.__size;
+ __previewImagePath = rhs.__previewImagePath;
+}
+
+_LiveboxSizeInfoImpl&
+_LiveboxSizeInfoImpl::operator =(const _LiveboxSizeInfoImpl& rhs)
+{
+ __size = rhs.__size;
+ __previewImagePath = rhs.__previewImagePath;
+
+ return *this;
+}
+
+_LiveboxSizeInfoImpl::~_LiveboxSizeInfoImpl()
+{
+}
+
+LiveboxSizeInfo*
+_LiveboxSizeInfoImpl::CreateLiveboxSizeInfo(Tizen::Graphics::FloatDimension size, const Tizen::Base::String& previewImagePath)
+{
+ return new (std::nothrow) LiveboxSizeInfo(size, previewImagePath);
+}
+
+FloatDimension
+_LiveboxSizeInfoImpl::GetSize() const
+{
+ return __size;
+}
+
+Tizen::Base::String
+_LiveboxSizeInfoImpl::GetPreviewImagePath() const
+{
+ return __previewImagePath;
+}
+
+}} // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file FShell_LiveboxView.cpp
+ * @brief This is the implementation file for the _LiveboxView class.
+ */
+
+#include <new>
+#include <livebox.h>
+#include <FBaseSysLog.h>
+#include <FBaseString.h>
+#include <FGrpBitmap.h>
+#include <FGrpCanvas.h>
+#include <FGrpDimension.h>
+#include <FGrpPoint.h>
+#include <FGrpRectangle.h>
+#include <FUiAnimVisualElementPropertyAnimation.h>
+#include <FGrp_BitmapImpl.h>
+#include <FMedia_ImageDecoder.h>
+#include "FUi_TouchFlickGestureDetector.h"
+#include "FShell_LiveboxView.h"
+#include "FShell_LiveboxViewPresenter.h"
+#include "FShell_LiveboxPopupView.h"
+#include "FShell_LiveboxViewManager.h"
+#include "FUi_ResourceManager.h"
+#include "FUiAnim_EflNode.h"
+#include "FUiAnim_VisualElementImpl.h"
+#include "FUiAnim_VisualElementSurfaceImpl.h"
+#include "FUi_CoordinateSystemUtils.h"
+
+using namespace std;
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Animations;
+using namespace Tizen::Media;
+
+namespace Tizen { namespace Shell
+{
+
+const int ANIMATION_DURATION = 150;
+
+_LiveboxView::_LiveboxView(void)
+ : __pLiveboxViewPresenter(new (std::nothrow) _LiveboxViewPresenter(*this))
+ , __pLivebox(null)
+ , __pLiveboxViewManager(null)
+ , __resizeFromRemote(false)
+ , __updated(false)
+ , __pixmap(-1)
+{
+ __pLiveboxViewManager = _LiveboxViewManager::GetInstance();
+ SysTryReturnVoidResult(NID_UI_CTRL, __pLiveboxViewManager, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
+}
+
+_LiveboxView::~_LiveboxView(void)
+{
+ __pLiveboxViewManager->RemoveLiveboxView(this);
+
+ if (__pLiveboxPopupView)
+ {
+ __pLiveboxPopupView->RemoveLiveboxPopupEventListener(*this);
+ }
+
+ if (__pTouchFlickGestureDetector)
+ {
+ RemoveGestureDetector(*__pTouchFlickGestureDetector);
+ }
+}
+
+_LiveboxView*
+_LiveboxView::CreateLiveboxViewN(void)
+{
+ unique_ptr<_LiveboxView> pLiveboxView(new (std::nothrow) _LiveboxView());
+ SysTryReturn(NID_UI_CTRL, pLiveboxView, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ result r = GetLastResult();
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pLiveboxView->AcquireHandle();
+
+ SetLastResult(E_SUCCESS);
+
+ return pLiveboxView.release();
+}
+
+result
+_LiveboxView::Initialize(const AppId& appId, const Tizen::Base::String& providerName, const Tizen::Graphics::FloatRectangle& rect, const String& userInfo)
+{
+ SysLog(NID_UI_CTRL, "appId [%ls]", appId.GetPointer());
+ SysLog(NID_UI_CTRL, "providerName [%ls]", providerName.GetPointer());
+ SysLog(NID_UI_CTRL, "[%d %d %d %d]", rect.x, rect.y, rect.width, rect.height);
+ SysLog(NID_UI_CTRL, "userInfo [%ls]", userInfo.GetPointer());
+
+ result r = SetBounds(rect);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = __pLiveboxViewPresenter->Initialize(appId, providerName);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ int width = 0;
+ int height = 0;
+
+ unique_ptr<ByteBuffer> pByteBuffer(_ImageDecoder::DecodeToBufferN(__pLiveboxViewPresenter->GetAppIconPath(), MEDIA_PIXEL_FORMAT_BGRA8888, width, height));
+ unique_ptr<Bitmap> pBitmap(_BitmapImpl::GetNonScaledBitmapN(*pByteBuffer.get(), Dimension(width, height), BITMAP_PIXEL_FORMAT_ARGB8888));
+
+ __pAppIconBitmap = move(pBitmap);
+
+ unique_ptr<_TouchFlickGestureDetector> pTouchFlickGestureDetector(new (std::nothrow) _TouchFlickGestureDetector());
+ SysTryReturn(NID_UI_CTRL, pTouchFlickGestureDetector, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ pTouchFlickGestureDetector->SetDelayTouchEventEnabled(true);
+ pTouchFlickGestureDetector->SetCancelTouchEventOnSuccessEnabled(true);
+
+ r = AddGestureDetector(*pTouchFlickGestureDetector.get());
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pTouchFlickGestureDetector->AddGestureListener(*this);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pTouchFlickGestureDetector = move(pTouchFlickGestureDetector);
+
+ __pLivebox = __pLiveboxViewManager->AddLiveboxView(this, userInfo);
+ r = GetLastResult();
+ SysTryReturn(NID_UI_CTRL, __pLivebox, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ Bitmap* pResourceBitmap = null;
+
+ r = GET_BITMAP_CONFIG_N(LIVEBOX::POPUP_BG_ARROW_UP, BITMAP_PIXEL_FORMAT_ARGB8888, pResourceBitmap);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ std::unique_ptr<Bitmap> pArrowUpBitmap(pResourceBitmap);
+
+ r = GET_BITMAP_CONFIG_N(LIVEBOX::POPUP_BG_ARROW_DOWN, BITMAP_PIXEL_FORMAT_ARGB8888, pResourceBitmap);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pArrowUpBitmap = move(pArrowUpBitmap);
+ __pArrowDownBitmap.reset(pResourceBitmap);
+
+ return r;
+}
+
+_LiveboxPopupView*
+_LiveboxView::GetLiveboxPopup(void) const
+{
+ return __pLiveboxPopupView.get();
+}
+
+String
+_LiveboxView::GetAppId(void) const
+{
+ return __pLiveboxViewPresenter->GetAppId();
+}
+
+String
+_LiveboxView::GetLiveboxId(void) const
+{
+ return __pLiveboxViewPresenter->GetLiveboxId();
+}
+
+Bitmap*
+_LiveboxView::GetAppIconBitmap(void) const
+{
+ return __pAppIconBitmap.get();
+}
+
+Bitmap*
+_LiveboxView::GetBitmap(void) const
+{
+ return __pBitmap.get();
+}
+
+bool
+_LiveboxView::IsUpdated(void) const
+{
+ return __updated;
+}
+
+FloatDimension
+_LiveboxView::GetAnchorSize(void) const
+{
+ Bitmap* pArrowBitmap = null;
+ int lower = 0;
+ int upper = 0;
+
+ GetRemainingSpace(lower, upper);
+
+ if (lower > upper)
+ {
+ pArrowBitmap = __pArrowDownBitmap.get();
+ }
+ else
+ {
+ pArrowBitmap = __pArrowUpBitmap.get();
+ }
+
+ return FloatDimension(pArrowBitmap->GetWidth(), pArrowBitmap->GetHeight());
+}
+
+livebox*
+_LiveboxView::GetNativeLivebox(void) const
+{
+ return __pLivebox;
+}
+
+result
+_LiveboxView::OpenLiveboxPopup(void)
+{
+ result r = E_SUCCESS;
+
+ const _Control* pParent = GetParent();
+ r = GetLastResult();
+ SysTryReturn(NID_UI_CTRL, pParent, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ FloatDimension size = __pLiveboxViewManager->GetLiveboxPopupSize(__pLivebox);
+ FloatRectangle popupBounds(0, 0, size.width, size.height);
+ FloatRectangle bounds = GetBoundsF();
+ FloatRectangle absoluteBounds = GetAbsoluteBoundsF();
+
+ int lower = 0;
+ int upper = 0;
+
+ FloatDimension anchorSize = GetAnchorSize();
+ GetRemainingSpace(lower, upper);
+
+ if (lower > upper)
+ {
+ popupBounds.y = absoluteBounds.y - size.height + anchorSize.height;
+ }
+ else
+ {
+ popupBounds.y = absoluteBounds.y + absoluteBounds.height - anchorSize.height;
+ }
+
+ SysLog(NID_UI_CTRL, "[%d %d]", popupBounds.y, size.height);
+
+ if (!__pLiveboxPopupView)
+ {
+ unique_ptr<_LiveboxPopupView> pLiveboxPopupView(_LiveboxPopupView::CreateLiveboxPopupN(*this));
+ r = GetLastResult();
+ SysTryReturn(NID_UI_CTRL, pLiveboxPopupView, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pLiveboxPopupView->Initialize(popupBounds);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pLiveboxPopupView->AddLiveboxPopupEventListener(*this);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pLiveboxPopupView = move(pLiveboxPopupView);
+ }
+
+ __pLiveboxPopupView->SetOwner(this);
+
+ r = __pLiveboxPopupView->Open();
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
+void
+_LiveboxView::GetTouchPostion(const FloatPoint& point, double& x, double& y) const
+{
+ FloatRectangle bounds = GetBoundsF();
+
+ x = static_cast<double>(point.x) / static_cast<double>(bounds.width);
+ y = static_cast<double>(point.y) / static_cast<double>(bounds.height);
+}
+
+void
+_LiveboxView::PlayClickAnimation(void)
+{
+ VisualElementPropertyAnimation animation;
+ animation.SetPropertyName(L"transform.scale.xy");
+ animation.SetEndValue(Variant(FloatPoint(0.8f, 0.8f)));
+ animation.SetDuration(ANIMATION_DURATION);
+ animation.SetAutoReverseEnabled(true);
+
+ _VisualElement* pVisualElement = GetVisualElement();
+ result r = GetLastResult();
+ SysTryReturnVoidResult(NID_UI_CTRL, pVisualElement, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pVisualElement->AddAnimation(L"Scale", animation);
+}
+
+void
+_LiveboxView::PlayFlickAnimation(void)
+{
+ const int DISTANCE = 30;
+
+ _VisualElement* pVisualElement = GetVisualElement();
+ result r = GetLastResult();
+ SysTryReturnVoidResult(NID_UI_CTRL, pVisualElement, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ FloatRectangle startBounds(pVisualElement->GetBounds());
+ FloatRectangle endBounds(startBounds);
+ endBounds.y = startBounds.y + DISTANCE;
+
+ VisualElementPropertyAnimation animation;
+ animation.SetPropertyName(L"bounds");
+ animation.SetStartValue(Variant(startBounds));
+ animation.SetEndValue(Variant(endBounds));
+ animation.SetDuration(ANIMATION_DURATION);
+ animation.SetAutoReverseEnabled(true);
+
+ pVisualElement->AddAnimation(L"Scale", animation);
+}
+
+void
+_LiveboxView::GetRemainingSpace(int& lower, int& upper) const
+{
+ const _Control* pParent = GetParent();
+ result r = GetLastResult();
+ SysTryReturnVoidResult(NID_UI_CTRL, pParent, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ FloatRectangle parentClientBounds = pParent->GetClientBoundsF();
+ FloatRectangle viewBounds = GetBoundsF();
+
+ lower = viewBounds.y;
+ upper = parentClientBounds.height - viewBounds.y - viewBounds.height;
+
+ SysLog(NID_UI_CTRL, "[%d %d]", lower, upper);
+}
+
+result
+_LiveboxView::OnAttachedToMainTree(void)
+{
+ result r = E_SUCCESS;
+
+ return r;
+}
+
+result
+_LiveboxView::OnDetachingFromMainTree(void)
+{
+ result r = E_SUCCESS;
+
+ return r;
+}
+
+bool
+_LiveboxView::OnFlickGestureDetected(_TouchFlickGestureDetector& gesture)
+{
+ _FlickDirection direction = gesture.GetDirection();
+ if (direction == _FLICK_DIRECTION_DOWN)
+ {
+ PlayFlickAnimation();
+ OpenLiveboxPopup();
+ }
+
+ return false;
+}
+
+bool
+_LiveboxView::OnFlickGestureCanceled(_TouchFlickGestureDetector& gesture)
+{
+ return false;
+}
+
+void
+_LiveboxView::OnBoundsChanged(void)
+{
+ FloatDimension size(GetSizeF());
+
+ if (!__resizeFromRemote)
+ {
+ __pLiveboxViewManager->SetLiveboxSize(*this, size);
+ __updated = false;
+ }
+}
+
+bool
+_LiveboxView::OnTouchPressed(const _Control& source, const _TouchInfo& touchInfo)
+{
+ int type = livebox_lb_type(__pLivebox);
+ if ((type == LB_TYPE_BUFFER) || (type == LB_TYPE_PIXMAP))
+ {
+ double x = 0.0;
+ double y = 0.0;
+
+ Point position = _CoordinateSystemUtils::ConvertToInteger(touchInfo.GetCurrentPosition());
+ GetTouchPostion(FloatPoint(static_cast<float>(position.x), static_cast<float>(position.y)), x, y);
+
+ livebox_content_event(__pLivebox, LB_MOUSE_DOWN, x, y);
+ }
+
+ return false;
+}
+
+bool
+_LiveboxView::OnTouchReleased(const _Control& source, const _TouchInfo& touchInfo)
+{
+ FloatRectangle clientBounds(GetClientBoundsF());
+ Point position(_CoordinateSystemUtils::ConvertToInteger(touchInfo.GetCurrentPosition()));
+ FloatPoint floatPosition(static_cast<float>(position.x), static_cast<float>(position.y));
+
+ if (clientBounds.Contains(floatPosition))
+ {
+ PlayClickAnimation();
+ }
+
+ double x = 0.0;
+ double y = 0.0;
+ GetTouchPostion(floatPosition, x, y);
+
+ int type = livebox_lb_type(__pLivebox);
+ if ((type == LB_TYPE_BUFFER) || (type == LB_TYPE_PIXMAP))
+ {
+ livebox_content_event(__pLivebox, LB_MOUSE_UP, x, y);
+ }
+
+ livebox_click(__pLivebox, x, y);
+
+ return false;
+}
+
+bool
+_LiveboxView::OnTouchMoved(const _Control& source, const _TouchInfo& touchInfo)
+{
+ int type = livebox_lb_type(__pLivebox);
+ if ((type == LB_TYPE_BUFFER) || (type == LB_TYPE_PIXMAP))
+ {
+ double x = 0.0;
+ double y = 0.0;
+
+ Point position = _CoordinateSystemUtils::ConvertToInteger(touchInfo.GetCurrentPosition());
+ GetTouchPostion(FloatPoint(static_cast<float>(position.x), static_cast<float>(position.y)), x, y);
+
+ livebox_content_event(__pLivebox, LB_MOUSE_MOVE, x, y);
+ }
+
+ return false;
+}
+
+void
+_LiveboxView::OnLiveboxPopupViewOpened(void)
+{
+}
+
+void
+_LiveboxView::OnLiveboxPopupViewClosed(void)
+{
+ __pLiveboxPopupView.reset(null);
+}
+
+void
+_LiveboxView::OnDraw(void)
+{
+ __pLiveboxViewPresenter->Draw();
+}
+
+void
+_LiveboxView::OnLiveboxUpdated(const Bitmap& bitmap, const FloatDimension& size)
+{
+ __resizeFromRemote = true;
+ SetSize(size);
+ __resizeFromRemote = false;
+ __updated = true;
+
+ __pBitmap.reset(const_cast<Bitmap*>(&bitmap));
+
+ Invalidate(false);
+}
+
+void
+_LiveboxView::OnLiveboxUpdated(int pixmap)
+{
+ int x = 0;
+ int y = 0;
+ int width = 0;
+ int height = 0;
+
+ ecore_x_pixmap_geometry_get(pixmap, &x, &y, &width, &height);
+ SysTryReturnVoidResult(NID_UI_CTRL, (width > 0) && (height > 0), E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid [0x%x %d %d].", pixmap, width , height);
+
+ if (__pixmap != pixmap )
+ {
+ SetBackgroundColor(Color(0, 0, 0, 0));
+
+ _VisualElement* pVisualElement = GetVisualElement();
+ SysTryReturnVoidResult(NID_UI_CTRL, pVisualElement, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
+
+ _EflNode* pEflNode = dynamic_cast<_EflNode*>(pVisualElement->GetNativeNode());
+ SysTryReturnVoidResult(NID_UI_CTRL, pEflNode, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
+
+ Evas_Object* pSmartObject = (Evas_Object*)pEflNode->GetGroupContainer();
+ SysTryReturnVoidResult(NID_UI_CTRL, pSmartObject, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
+
+ Evas* pEvas = evas_object_evas_get(pSmartObject);
+ SysTryReturnVoidResult(NID_UI_CTRL, pEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
+
+ __pPixmapObject.reset(evas_object_image_filled_add(pEvas));
+ SysTryReturnVoidResult(NID_UI_CTRL, __pPixmapObject, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ pEflNode->AddNativeSmartObject(*pVisualElement, __pPixmapObject.get());
+
+ evas_object_image_size_set(__pPixmapObject.get(), width, height);
+ evas_object_image_colorspace_set(__pPixmapObject.get(), EVAS_COLORSPACE_ARGB8888);
+ evas_object_image_alpha_set(__pPixmapObject.get(), EINA_TRUE);
+ evas_object_raise(__pPixmapObject.get());
+
+ FloatRectangle absoluteBounds = GetAbsoluteBoundsF();
+
+ evas_object_move(__pPixmapObject.get(), absoluteBounds.x, absoluteBounds.y);
+ evas_object_show(__pPixmapObject.get());
+
+ Evas_Native_Surface surface;
+
+ surface.version = EVAS_NATIVE_SURFACE_VERSION;
+ surface.type = EVAS_NATIVE_SURFACE_X11;
+ surface.data.x11.visual = ecore_x_default_visual_get(ecore_x_display_get(), ecore_x_default_screen_get());
+ surface.data.x11.pixmap = pixmap;
+
+ evas_object_image_native_surface_set(__pPixmapObject.get(), &surface);
+/*
+ __pixmapDamage.reset(ecore_x_damage_new(pixmap, ECORE_X_DAMAGE_REPORT_RAW_RECTANGLES));
+ SysTryReturnVoidResult(NID_UI_CTRL, __pixmapDamage.get() != 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ __pPixmapEventHandler.reset(ecore_event_handler_add(ECORE_X_EVENT_DAMAGE_NOTIFY, OnPixmapDamaged, (void*)this));
+ SysTryReturnVoidResult(NID_UI_CTRL, __pPixmapEventHandler, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+*/
+ SysLog(NID_UI_CTRL, "[0x%x][%d %d]", surface.data.x11.pixmap, absoluteBounds.x, absoluteBounds.y);
+ }
+
+ SysLog(NID_UI_CTRL, "[%d %d %d %d]", x, y, width, height);
+
+ evas_object_image_size_set(__pPixmapObject.get(), width, height);
+ evas_object_image_pixels_dirty_set(__pPixmapObject.get(), EINA_TRUE);
+ evas_object_image_fill_set(__pPixmapObject.get(), 0, 0, width, height);
+ evas_object_image_data_update_add(__pPixmapObject.get(), 0, 0, width, height);
+ evas_object_resize(__pPixmapObject.get(), width, height);
+
+ __resizeFromRemote = true;
+ SetSize(FloatDimension(static_cast<float>(width), static_cast<float>(height)));
+ __resizeFromRemote = false;
+ __updated = true;
+
+ __pixmap = pixmap;
+}
+
+Eina_Bool
+_LiveboxView::OnPixmapDamaged(void* pData, int type, void* pEvent)
+{
+ _LiveboxView* pLiveboxView = static_cast<_LiveboxView*>(pData);
+ SysTryReturn(NID_UI_CTRL, pLiveboxView != null, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[[E_INVALID_ARG] The argument is invalid.");
+
+ Ecore_X_Event_Damage* pDamageEvent = static_cast<Ecore_X_Event_Damage*>(pEvent);
+ SysTryReturn(NID_UI_CTRL, pDamageEvent != null, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+
+ int pixmap = pLiveboxView->__pixmap;
+ SysTryReturn(NID_UI_CTRL, pDamageEvent->drawable == pixmap, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid [%d %d].", pDamageEvent->drawable, pixmap);
+
+ int x = 0;
+ int y = 0;
+ int width = 0;
+ int height = 0;
+
+ ecore_x_pixmap_geometry_get(pixmap, &x, &y, &width, &height);
+ SysTryReturn(NID_UI_CTRL, (width > 0) && (height > 0), ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid [0x%x %d %d].", pixmap, width , height);
+
+ Evas_Object* pPixmapObject = pLiveboxView->__pPixmapObject.get();
+ SysTryReturn(NID_UI_CTRL, pPixmapObject, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+
+ evas_object_image_pixels_dirty_set(pPixmapObject, EINA_TRUE);
+ evas_object_image_fill_set(pPixmapObject, 0, 0, width, height);
+ evas_object_image_data_update_add(pPixmapObject, 0, 0, width, height);
+
+ SysLog(NID_UI_CTRL, "[%d %d %d]", pixmap, width, height);
+
+ return ECORE_CALLBACK_DONE;
+}
+
+}} // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file FShell_LiveboxView.h
+ * @brief This is the header file for the _LiveboxView class.
+ *
+ * This header file contains the declarations of the %_LiveboxView class.
+ */
+#ifndef _FSHELL_INTERNAL_LIVEBOX_VIEW_H_
+#define _FSHELL_INTERNAL_LIVEBOX_VIEW_H_
+
+#include <unique_ptr.h>
+#include <Evas.h>
+#include <Ecore.h>
+#include <Ecore_X.h>
+#include <FAppTypes.h>
+#include "FUi_Control.h"
+#include "FUi_ITouchFlickGestureEventListener.h"
+#include "FUiAnim_VisualElement.h"
+#include "FShell_ILiveboxPopupViewEventListener.h"
+
+namespace Tizen { namespace Base
+{
+class String;
+}} // Tizen::Base
+
+namespace Tizen { namespace Graphics
+{
+class Bitmap;
+class FloatDimension;
+class Point;
+}} // Tizen::Graphics
+
+namespace Tizen { namespace Ui
+{
+class _TouchFlickGestureDetector;
+}} // Tizen::Ui
+
+namespace Tizen { namespace Shell
+{
+
+class _LiveboxViewPresenter;
+class _LiveboxPopupView;
+
+/**
+ * @class _LiveboxView
+ * @brief
+ * @since 2.1
+ */
+class _LiveboxView
+ : public Tizen::Ui::_Control
+ , public Tizen::Ui::_ITouchFlickGestureEventListener
+ , public _ILiveboxPopupViewEventListener
+{
+public:
+ static _LiveboxView* CreateLiveboxViewN(void);
+ virtual ~_LiveboxView(void);
+
+ result Initialize(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Graphics::FloatRectangle& rect, const Tizen::Base::String& userInfo);
+ _LiveboxPopupView* GetLiveboxPopup(void) const;
+ Tizen::Base::String GetAppId(void) const;
+ Tizen::Base::String GetLiveboxId(void) const;
+ Tizen::Graphics::Bitmap* GetAppIconBitmap(void) const;
+ Tizen::Graphics::Bitmap* GetBitmap(void) const;
+ bool IsUpdated(void) const;
+ Tizen::Graphics::FloatDimension GetAnchorSize(void) const;
+
+protected:
+ _LiveboxView(void);
+
+private:
+ _LiveboxView(const _LiveboxView& rhs);
+ _LiveboxView& operator =(const _LiveboxView& rhs);
+
+ struct livebox* GetNativeLivebox(void) const;
+ result OpenLiveboxPopup(void);
+ void GetTouchPostion(const Tizen::Graphics::FloatPoint& point, double& x, double& y) const;
+ void PlayClickAnimation(void);
+ void PlayFlickAnimation(void);
+ void GetRemainingSpace(int& lower, int& upper) const;
+
+ virtual result OnAttachedToMainTree(void);
+ virtual result OnDetachingFromMainTree(void);
+ virtual bool OnFlickGestureDetected(Tizen::Ui::_TouchFlickGestureDetector& gesture);
+ virtual bool OnFlickGestureCanceled(Tizen::Ui::_TouchFlickGestureDetector& gesture);
+ virtual void OnBoundsChanged(void);
+ virtual bool OnTouchPressed(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchInfo);
+ virtual bool OnTouchReleased(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchInfo);
+ virtual bool OnTouchMoved(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchInfo);
+ virtual void OnLiveboxPopupViewOpened(void);
+ virtual void OnLiveboxPopupViewClosed(void);
+ virtual void OnDraw(void);
+
+ void OnLiveboxUpdated(const Tizen::Graphics::Bitmap& bitmap, const Tizen::Graphics::FloatDimension& size);
+ void OnLiveboxUpdated(int pixmap);
+
+ static Eina_Bool OnPixmapDamaged(void* pData, int type, void* pEvent);
+
+private:
+ std::unique_ptr<_LiveboxViewPresenter> __pLiveboxViewPresenter;
+ std::unique_ptr<Tizen::Graphics::Bitmap> __pBitmap;
+ std::unique_ptr<Tizen::Graphics::Bitmap> __pAppIconBitmap;
+ std::unique_ptr<Tizen::Graphics::Bitmap> __pArrowUpBitmap;
+ std::unique_ptr<Tizen::Graphics::Bitmap> __pArrowDownBitmap;
+ struct livebox* __pLivebox;
+ friend class _LiveboxViewManager;
+ class _LiveboxViewManager* __pLiveboxViewManager;
+ friend class _LiveboxPopupView;
+ std::unique_ptr<_LiveboxPopupView> __pLiveboxPopupView;
+ std::unique_ptr<Tizen::Ui::_TouchFlickGestureDetector> __pTouchFlickGestureDetector;
+ bool __resizeFromRemote;
+ bool __updated;
+ int __pixmap;
+
+ struct _EvasObjectDeleter
+ {
+ void operator()(Evas_Object* pEvasObject)
+ {
+ evas_object_del(pEvasObject);
+ }
+ };
+ std::unique_ptr<Evas_Object, _EvasObjectDeleter> __pPixmapObject;
+
+ struct _EcoreXDamageDeleter
+ {
+ typedef Ecore_X_Damage pointer;
+
+ void operator()(Ecore_X_Damage ecoreXDamage)
+ {
+ ecore_x_damage_free(ecoreXDamage);
+ }
+ };
+ std::unique_ptr<Ecore_X_Damage, _EcoreXDamageDeleter> __pixmapDamage;
+
+ struct _EcoreEventHandlerDeleter
+ {
+ void operator()(Ecore_Event_Handler* pEcoreEventHandler)
+ {
+ ecore_event_handler_del(pEcoreEventHandler);
+ }
+ };
+ std::unique_ptr<Ecore_Event_Handler, _EcoreEventHandlerDeleter> __pPixmapEventHandler;
+}; // _LiveboxView
+
+}} // Tizen::Shell
+
+#endif // _FSHELL_INTERNAL_LIVEBOX_VIEW_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <new>
+#include <unique_ptr.h>
+#include <FBaseSysLog.h>
+#include <FBaseString.h>
+#include <FGrpPoint.h>
+#include "FShell_LiveboxViewImpl.h"
+
+using namespace std;
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+
+namespace Tizen { namespace Shell
+{
+
+const _LiveboxViewImpl*
+_LiveboxViewImpl::GetInstance(const LiveboxView& liveBoxView)
+{
+ return static_cast<const _LiveboxViewImpl*>(_ControlImpl::GetInstance(liveBoxView));
+}
+
+_LiveboxViewImpl*
+_LiveboxViewImpl::GetInstance(LiveboxView& liveBoxView)
+{
+ return static_cast<_LiveboxViewImpl*>(_ControlImpl::GetInstance(liveBoxView));
+}
+
+_LiveboxViewImpl*
+_LiveboxViewImpl::CreateLiveboxViewImplN(LiveboxView& liveBoxView)
+{
+ unique_ptr<_LiveboxView> pCore(_LiveboxView::CreateLiveboxViewN());
+ result r = GetLastResult();
+ SysTryReturn(NID_UI_CTRL, pCore, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ unique_ptr<_LiveboxViewImpl> pImpl(new (std::nothrow) _LiveboxViewImpl(&liveBoxView, pCore.get()));
+ SysTryReturn(NID_UI_CTRL, pImpl, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ pCore.release();
+
+ r = GetLastResult();
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return pImpl.release();
+}
+
+_LiveboxViewImpl::_LiveboxViewImpl(LiveboxView* pPublic, _LiveboxView* pCore)
+ : _ContainerImpl(pPublic, pCore)
+{
+}
+
+_LiveboxViewImpl::~_LiveboxViewImpl(void)
+{
+}
+
+const char*
+_LiveboxViewImpl::GetPublicClassName(void) const
+{
+ return "Tizen::Shell::LiveboxView";
+}
+
+const LiveboxView&
+_LiveboxViewImpl::GetPublic(void) const
+{
+ return static_cast<const LiveboxView&>(_ControlImpl::GetPublic());
+}
+
+LiveboxView&
+_LiveboxViewImpl::GetPublic(void)
+{
+ return static_cast<LiveboxView&>(_ControlImpl::GetPublic());
+}
+
+const _LiveboxView&
+_LiveboxViewImpl::GetCore(void) const
+{
+ return static_cast<const _LiveboxView&>(_ControlImpl::GetCore());
+}
+
+_LiveboxView&
+_LiveboxViewImpl::GetCore(void)
+{
+ return static_cast<_LiveboxView&>(_ControlImpl::GetCore());
+}
+
+result
+_LiveboxViewImpl::Initialize(const AppId& appId, const Tizen::Base::String& providerName, const Tizen::Graphics::FloatRectangle& rect, const String& userInfo)
+{
+ result r = GetCore().Initialize(appId, providerName, rect, userInfo);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
+}} // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef _FSHELL_INTERNAL_LIVEBOX_VIEW_IMPL_H_
+#define _FSHELL_INTERNAL_LIVEBOX_VIEW_IMPL_H_
+
+#include <FAppTypes.h>
+#include <FShellLiveboxView.h>
+#include "FUi_ContainerImpl.h"
+#include "FShell_LiveboxView.h"
+
+namespace Tizen { namespace Base
+{
+class String;
+}}
+
+namespace Tizen { namespace Graphics
+{
+class Point;
+class FloatRectangle;
+}}
+
+namespace Tizen { namespace Shell
+{
+
+class _LiveboxViewImpl
+ : public Tizen::Ui::_ContainerImpl
+{
+public:
+ static _LiveboxViewImpl* CreateLiveboxViewImplN(LiveboxView& liveBoxView);
+ static const _LiveboxViewImpl* GetInstance(const LiveboxView& liveBoxView);
+ static _LiveboxViewImpl* GetInstance(LiveboxView& liveBoxView);
+
+ virtual ~_LiveboxViewImpl(void);
+
+ virtual const char* GetPublicClassName(void) const;
+ virtual const LiveboxView& GetPublic(void) const;
+ virtual LiveboxView& GetPublic(void);
+ virtual const _LiveboxView& GetCore(void) const;
+ virtual _LiveboxView& GetCore(void);
+
+ result Initialize(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Graphics::FloatRectangle& rect, const Tizen::Base::String& userInfo);
+
+protected:
+ _LiveboxViewImpl(LiveboxView* pPublic, _LiveboxView* pCore);
+
+private:
+ _LiveboxViewImpl(const _LiveboxViewImpl& rhs);
+ _LiveboxViewImpl& operator =(const _LiveboxViewImpl& rhs);
+}; // _LiveboxViewImpl
+
+}} // Tizen::Shell
+
+#endif // _FSHELL_INTERNAL_LIVEBOX_VIEW_IMPL_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file FShell_LiveboxViewManager.cpp
+ * @brief This is the implementation file for the _LiveboxView class.
+ */
+
+#include <new>
+#include <Ecore_X.h>
+#include <Evas.h>
+extern "C"
+{
+#include <elm_config.h>
+}
+#include <livebox-service.h>
+#include <livebox.h>
+#include <FBaseColHashMapT.h>
+#include <FBaseSysLog.h>
+#include <FBaseString.h>
+#include <FGrpBufferInfo.h>
+#include <FGrpBitmap.h>
+#include <FGrpCanvas.h>
+#include <FGrpDimension.h>
+#include <FGrpPixelFormat.h>
+#include <FGrpPoint.h>
+#include <FGrpRectangle.h>
+#include <FMediaImageTypes.h>
+#include <FBase_StringConverter.h>
+#include <FGrp_BitmapImpl.h>
+#include <FGrp_CoordinateSystem.h>
+#include <FMedia_ImageDecoder.h>
+#include "FShell_LiveboxViewManager.h"
+#include "FShell_LiveboxView.h"
+#include "FShell_LiveboxPopupView.h"
+
+//#define _PIXMAP_TEST
+
+#if defined(_PIXMAP_TEST)
+extern "C"
+{
+#include <stdio.h>
+#include <stdlib.h>
+#include <X11/Xproto.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <dri2.h>
+#define virtual UICTRL_INTERNAL_VIRTUAL_REDEFINE
+#define private UICTRL_INTERNAL_PRIVATE_REDEFINE
+#include <libdrm/drm_slp_bufmgr.h>
+#undef virtual
+#undef private
+}
+#endif // _PIXMAP_TEST
+
+using namespace std;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Graphics;
+using namespace Tizen::Media;
+
+namespace
+{
+
+#if defined(_PIXMAP_TEST)
+
+drm_slp_bufmgr __bufMgr = null;
+int __FileCount = 0;
+
+void
+dump_bmp(const char* pFileName, const void* pData, int width, int height)
+{
+ int i = 0;
+
+ struct
+ {
+ unsigned char magic[2];
+ } bmpfile_magic = { {'B', 'M'} };
+
+ struct
+ {
+ unsigned int filesz;
+ unsigned short creator1;
+ unsigned short creator2;
+ unsigned int bmp_offset;
+ } bmpfile_header = { 0, 0, 0, 0x36 };
+
+ struct
+ {
+ unsigned int header_sz;
+ unsigned int width;
+ unsigned int height;
+ unsigned short nplanes;
+ unsigned short bitspp;
+ unsigned int compress_type;
+ unsigned int bmp_bytesz;
+ unsigned int hres;
+ unsigned int vres;
+ unsigned int ncolors;
+ unsigned int nimpcolors;
+ } bmp_dib_v3_header_t = { 0x28, 0, 0, 1, 24, 0, 0, 0, 0, 0, 0 };
+
+ unsigned int* pBlocks = null;
+
+ FILE* pFile = fopen(pFileName, "w+");
+ if (pFile == null)
+ {
+ SysLog(NID_UI_CTRL, "failed to fopen [%s]", pFileName);
+ return;
+ }
+ else
+ {
+ bmpfile_header.filesz = sizeof(bmpfile_magic) + sizeof(bmpfile_header) + sizeof(bmp_dib_v3_header_t) + width * height * 3;
+ bmp_dib_v3_header_t.header_sz = sizeof(bmp_dib_v3_header_t);
+ bmp_dib_v3_header_t.width = width;
+ bmp_dib_v3_header_t.height = -height;
+ bmp_dib_v3_header_t.nplanes = 1;
+ bmp_dib_v3_header_t.bmp_bytesz = width * height * 3;
+
+ fwrite(&bmpfile_magic, sizeof(bmpfile_magic), 1, pFile);
+ fwrite(&bmpfile_header, sizeof(bmpfile_header), 1, pFile);
+ fwrite(&bmp_dib_v3_header_t, sizeof(bmp_dib_v3_header_t), 1, pFile);
+
+ pBlocks = (unsigned int*)pData;
+ for (i = 0; i < (height * width); i++)
+ fwrite(&pBlocks[i], 3, 1, pFile);
+
+ fclose(pFile);
+ }
+
+ return;
+}
+
+drm_slp_bufmgr
+bufmgr_get(Display* pDisplay, Pixmap pixmap)
+{
+ int screen;
+ int drm_fd;
+ drm_slp_bufmgr bufmgr;
+ int eventBase, errorBase;
+ int dri2Major, dri2Minor;
+ char* pDriverName, *pDeviceName;
+ drm_magic_t magic;
+
+ screen = DefaultScreen(pDisplay);
+
+ /* DRI2 */
+ if (!DRI2QueryExtension (pDisplay, &eventBase, &errorBase))
+ {
+ SysLog(NID_UI_CTRL, "!!Error : DRI2QueryExtension !!\n");
+ return null;
+ }
+
+ if (!DRI2QueryVersion (pDisplay, &dri2Major, &dri2Minor))
+ {
+ SysLog(NID_UI_CTRL, "!!Error : DRI2QueryVersion !!\n");
+ return null;
+ }
+
+ if (!DRI2Connect (pDisplay, RootWindow(pDisplay, screen), &pDriverName, &pDeviceName))
+ {
+ SysLog(NID_UI_CTRL, "!!Error : DRI2Connect !!\n");
+ return null;
+ }
+
+ SysLog(NID_UI_CTRL, "Open drm device : %s\n", pDeviceName);
+
+ /* get the drm_fd though opening the deviceName */
+ drm_fd = open (pDeviceName, O_RDWR);
+ if (drm_fd < 0)
+ {
+ SysLog(NID_UI_CTRL, "!!Error : cannot open drm device (%s)\n", pDeviceName);
+ return null;
+ }
+
+ /* get the drm magic */
+ drmGetMagic(drm_fd, &magic);
+ printf("drm magic = %d \n", magic);
+
+ if (!DRI2Authenticate(pDisplay, RootWindow(pDisplay, screen), magic))
+ {
+ SysLog(NID_UI_CTRL, "!!Error : DRI2Authenticate !!\n");
+ close (drm_fd);
+ return null;
+ }
+
+ /* drm slp buffer manager init */
+ bufmgr = drm_slp_bufmgr_init (drm_fd, null);
+ if (!bufmgr)
+ {
+ SysLog(NID_UI_CTRL, "!!Error : failed to init buffer manager \n");
+ close (drm_fd);
+ return null;
+ }
+
+ DRI2CreateDrawable (pDisplay, pixmap);
+
+ return bufmgr;
+}
+
+void
+pixmap_update(Display* pDisplay, drm_slp_bufmgr bufmgr, Pixmap pixmap, int x, int y, int width, int height)
+{
+ DRI2Buffer* pDri2_buffers = null;
+ unsigned int attachments[1];
+ int dri2_count, dri2_out_count;
+ int dri2_width, dri2_height, dri2_stride;
+ drm_slp_bo bo;
+ int opt;
+ void* pVirtualBuf = null;
+ char imgFile[100] = {0,};
+
+ attachments[0] = DRI2BufferFrontLeft;
+ dri2_count = 1;
+ pDri2_buffers = DRI2GetBuffers (pDisplay, pixmap, &dri2_width, &dri2_height,
+ attachments, dri2_count, &dri2_out_count);
+
+ if (!pDri2_buffers)
+ {
+ SysLog(NID_UI_CTRL, "[Error] : failed to get buffers\n");
+ goto update_done;
+ }
+
+ if (!pDri2_buffers[0].name)
+ {
+ SysLog(NID_UI_CTRL, "[Error] : a handle of the dri2 buffer is null \n ");
+ goto update_done;
+ }
+
+ SysLog(NID_UI_CTRL, "pDri2_buffers[0].name : %d", pDri2_buffers[0].name);
+
+ bo = drm_slp_bo_import(bufmgr, pDri2_buffers[0].name);
+ if (!bo)
+ {
+ SysLog(NID_UI_CTRL, "[Error] : cannot import bo (key:%d)\n", pDri2_buffers[0].name);
+ goto update_done;
+ }
+
+ dri2_stride = pDri2_buffers[0].pitch;
+
+ opt = DRM_SLP_OPTION_READ|DRM_SLP_OPTION_WRITE;
+ pVirtualBuf = (void*)drm_slp_bo_map (bo, DRM_SLP_DEVICE_CPU, opt);
+ if (!pVirtualBuf)
+ {
+ SysLog(NID_UI_CTRL, "[Error] : failed to map \n");
+ goto update_done;
+ }
+
+ memset(imgFile, 0, sizeof(imgFile));
+ sprintf(imgFile,"./dump%d.bmp", __FileCount++);
+ dump_bmp(imgFile, pVirtualBuf, dri2_width, dri2_height);
+
+update_done:
+ if (pVirtualBuf)
+ drm_slp_bo_unmap(bo, DRM_SLP_DEVICE_CPU);
+ if (bo)
+ drm_slp_bo_unref(bo);
+ if (pDri2_buffers)
+ free(pDri2_buffers);
+}
+
+void
+DumpPixmap(int pixmap)
+{
+ int x = 0;
+ int y = 0;
+ int width = 0;
+ int height = 0;
+
+ ecore_x_pixmap_geometry_get(pixmap, &x, &y, &width, &height);
+ SysTryReturnVoidResult(NID_UI_CTRL, (width > 0) && (height > 0), E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid [0x%x %d %d].", pixmap, width , height);
+
+ if (__bufMgr)
+ {
+ drm_slp_bufmgr_destroy(__bufMgr);
+ __bufMgr = null;
+ }
+
+ if (__bufMgr == null)
+ __bufMgr = bufmgr_get((Display*)ecore_x_display_get(), pixmap);
+
+ if (__bufMgr != null)
+ {
+ pixmap_update((Display*)ecore_x_display_get(), __bufMgr, pixmap, 0, 0, width, height);
+ }
+ else
+ SysLog(NID_UI_CTRL, "can't get pixmap __bufMgr");
+
+ SysLog(NID_UI_CTRL, "dump pixmap [%d]", pixmap);
+}
+
+#endif // _PIXMAP_TEST
+
+}
+
+namespace Tizen { namespace Graphics
+{
+result _CreateCoordinateTransformer(_ICoordinateSystemTransformer*&, _LogicalResolution, _BaseScreenSize, _PhysicalResolution, _BaseScreenSize);
+} } // Tizen::Graphics
+
+namespace Tizen { namespace Shell
+{
+
+const int LIVEBOX_SIZE_1 = 175;
+const int LIVEBOX_SIZE_2 = 354;
+const int LIVEBOX_SIZE_4 = 712;
+
+struct _LiveboxSizeInfo
+{
+ int type;
+ int width;
+ int height;
+};
+
+const _LiveboxSizeInfo LIVEBOX_SIZE_INFO[] =
+{
+ { LB_SIZE_TYPE_1x1, LIVEBOX_SIZE_1, LIVEBOX_SIZE_1 },
+ { LB_SIZE_TYPE_2x1, LIVEBOX_SIZE_2, LIVEBOX_SIZE_1 },
+ { LB_SIZE_TYPE_2x2, LIVEBOX_SIZE_2, LIVEBOX_SIZE_2 },
+ { LB_SIZE_TYPE_4x1, LIVEBOX_SIZE_4, LIVEBOX_SIZE_1 },
+ { LB_SIZE_TYPE_4x2, LIVEBOX_SIZE_4, LIVEBOX_SIZE_2 },
+ { LB_SIZE_TYPE_4x4, LIVEBOX_SIZE_4, LIVEBOX_SIZE_4 }
+
+};
+
+_LiveboxViewManager*
+_LiveboxViewManager::GetInstance(void)
+{
+ static _LiveboxViewManager instance;
+ return &instance;
+}
+
+livebox*
+_LiveboxViewManager::AddLiveboxView(_LiveboxView* pLiveboxView, const String& userInfo)
+{
+ SysTryReturn(NID_UI_CTRL, pLiveboxView, null, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+
+ unique_ptr<char[]> pLiveboxId(_StringConverter::CopyToCharArrayN(pLiveboxView->GetLiveboxId()));
+ SysTryReturn(NID_UI_CTRL, pLiveboxId, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ unique_ptr<char[]> pContent(_StringConverter::CopyToCharArrayN(userInfo));
+ SysTryReturn(NID_UI_CTRL, pContent, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ const char* pCluster = "user,created";
+ const char* pCategory = "default";
+ double period = 1.0f;
+ int sizeType = GetLiveboxSizeType(pLiveboxView->GetSizeF());
+
+ livebox* pLivebox = livebox_add_with_size(pLiveboxId.get(), pContent.get(), pCluster, pCategory, period, sizeType, OnLiveboxAdded, this);
+ SysTryReturn(NID_UI_CTRL, pLivebox, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ __pViewMap->Add(pLivebox, pLiveboxView);
+
+ return pLivebox;
+}
+
+void
+_LiveboxViewManager::RemoveLiveboxView(_LiveboxView* pLiveboxView)
+{
+ SysTryReturnVoidResult(NID_UI_CTRL, pLiveboxView, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+
+ livebox* pLivebox = pLiveboxView->GetNativeLivebox();
+ SysTryReturnVoidResult(NID_UI_CTRL, pLivebox, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+
+ __pViewMap->Remove(pLivebox);
+
+ livebox_del(pLivebox, OnLiveboxDeleted, this);
+
+ __pViewMap->Remove(pLivebox);
+}
+
+_LiveboxView*
+_LiveboxViewManager::GetLiveboxView(livebox* pLivebox) const
+{
+ _LiveboxView* pLiveboxView = null;
+ __pViewMap->GetValue(pLivebox, pLiveboxView);
+
+ return pLiveboxView;
+}
+
+FloatDimension
+_LiveboxViewManager::GetLiveboxSize(livebox* pLivebox) const
+{
+ SysTryReturn(NID_UI_CTRL, pLivebox, FloatDimension(0, 0), E_SYSTEM, "[E_SYSTEM] A system error occurred.");
+
+ int width = 0;
+ int height = 0;
+
+ int type = livebox_size(pLivebox);
+ livebox_service_get_size(type, &width, &height);
+
+// SysLog(NID_UI_CTRL, "size [%d %d]", width, height);
+
+ return FloatDimension(width, height);
+}
+
+FloatDimension
+_LiveboxViewManager::GetLiveboxPopupSize(livebox* pLivebox) const
+{
+ SysTryReturn(NID_UI_CTRL, pLivebox, FloatDimension(0, 0), E_SYSTEM, "[E_SYSTEM] A system error occurred.");
+
+ int width = 0;
+ int height = 0;
+
+ livebox_get_pdsize(pLivebox, &width, &height);
+
+// SysLog(NID_UI_CTRL, "size [%d %d]", width, height);
+
+ return FloatDimension(width, height);
+}
+
+void
+_LiveboxViewManager::SetLiveboxSize(const _LiveboxView& liveboxView, const FloatDimension& size)
+{
+ livebox* pLivebox = liveboxView.GetNativeLivebox();
+ SysTryReturnVoidResult(NID_UI_CTRL, pLivebox, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+
+ int sizeType = GetLiveboxSizeType(size);
+
+ livebox_resize(pLivebox, sizeType, OnLiveboxResized, this);
+}
+
+_LiveboxViewManager::_LiveboxViewManager(void)
+ : __glMode(false)
+{
+// _LogicalResolution sourceResolution = RESOLUTION_LOGICAL_720;
+// _PhysicalResolution destResolution = _CoordinateSystem::GetInstance()->GetPhysicalResolution();
+
+ livebox_init(ecore_x_display_get());
+ livebox_subscribe_group("*", "*");
+
+ __eventHandler.reset(livebox_set_event_handler(OnLiveboxEventReceived, this));
+ SysTryReturnVoidResult(NID_UI_CTRL, __eventHandler == 0, E_SYSTEM, "[E_SYSTEM] A system error occured.");
+
+ __faultEventHandler.reset(livebox_set_fault_handler(OnLiveboxFaultReceived, this));
+ SysTryReturnVoidResult(NID_UI_CTRL, __faultEventHandler == 0, E_SYSTEM, "[E_SYSTEM] A system error occured.");
+
+ unique_ptr<HashMapT<livebox*, _LiveboxView*> > pViewMap(new (std::nothrow) HashMapT<livebox*, _LiveboxView*>);
+ SysTryReturnVoidResult(NID_UI_CTRL, pViewMap, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ result r = pViewMap->Construct();
+ SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pViewMap = move(pViewMap);
+ __glMode = IsGlMode();
+
+// r = _CreateCoordinateTransformer(__pCoordinateTransformer, sourceResolution, BASE_SCREEN_SIZE_NORMAL, destResolution, BASE_SCREEN_SIZE_NORMAL);
+// SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+}
+
+_LiveboxViewManager::~_LiveboxViewManager(void)
+{
+}
+
+int
+_LiveboxViewManager::GetLiveboxSizeType(const Tizen::Graphics::FloatDimension& size) const
+{
+ int sizeType = LB_SIZE_TYPE_UNKNOWN;
+
+ int sizetypeCount = sizeof(LIVEBOX_SIZE_INFO) / sizeof(_LiveboxSizeInfo);
+ for ( int i = 0; i < sizetypeCount; ++ i)
+ {
+ if (size.width <= LIVEBOX_SIZE_INFO[i].width && size.height <= LIVEBOX_SIZE_INFO[i].height)
+ {
+ sizeType = LIVEBOX_SIZE_INFO[i].type;
+ break;
+ }
+ }
+
+ SysLog(NID_UI_CTRL, "[%d %d] type [%d][%d]", size.width, size.height, sizeType, sizetypeCount);
+
+ return sizeType;
+}
+
+MediaPixelFormat
+_LiveboxViewManager::GetPixelFormat(BitmapPixelFormat format) const
+{
+ MediaPixelFormat mediaPixelFormat = MEDIA_PIXEL_FORMAT_NONE;
+
+ switch(format)
+ {
+ case BITMAP_PIXEL_FORMAT_RGB565:
+ mediaPixelFormat = MEDIA_PIXEL_FORMAT_RGB565LE;
+ break;
+
+ case BITMAP_PIXEL_FORMAT_ARGB8888:
+ mediaPixelFormat = MEDIA_PIXEL_FORMAT_BGRA8888;
+ break;
+
+ case BITMAP_PIXEL_FORMAT_R8G8B8A8:
+ mediaPixelFormat = MEDIA_PIXEL_FORMAT_RGBA8888;
+ break;
+
+ default:
+ break;
+ }
+
+ return mediaPixelFormat;
+}
+
+Bitmap*
+_LiveboxViewManager::GetBitmapN(const String& fileName) const
+{
+ int width = 0;
+ int height = 0;
+
+ MediaPixelFormat format = GetPixelFormat(BITMAP_PIXEL_FORMAT_ARGB8888);
+
+ unique_ptr<ByteBuffer> pByteBuffer(_ImageDecoder::DecodeToBufferN(fileName, format, width, height));
+ SysTryReturn(NID_UI_CTRL, pByteBuffer, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ unique_ptr<Bitmap> pBitmap(_BitmapImpl::GetNonScaledBitmapN(*pByteBuffer, Dimension(width, height), BITMAP_PIXEL_FORMAT_ARGB8888));
+ SysTryReturn(NID_UI_CTRL, pBitmap, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ return pBitmap.release();
+}
+
+Bitmap*
+_LiveboxViewManager::GetBitmapN(void* pBuffer, const FloatDimension& size) const
+{
+ SysTryReturn(NID_UI_CTRL, pBuffer, null, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+
+ byte* pTempBuffer = static_cast<byte*>(pBuffer);
+ const int BITS_PER_PIXEL = 32;
+ int length = size.width * size.height * BITS_PER_PIXEL / 8;
+
+ unique_ptr<ByteBuffer> pByteBuffer(new (std::nothrow) ByteBuffer());
+ SysTryReturn(NID_UI_CTRL, pByteBuffer, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ result r = pByteBuffer->Construct(pTempBuffer, 0, length, length);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ unique_ptr<Bitmap> pBitmap(_BitmapImpl::GetNonScaledBitmapN(*pByteBuffer.get(), Dimension(size.width, size.height), BITMAP_PIXEL_FORMAT_ARGB8888));
+ SysTryReturn(NID_UI_CTRL, pBitmap, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ return pBitmap.release();
+}
+
+bool
+_LiveboxViewManager::IsGlMode(void) const
+{
+ int mode = 0;
+ bool glMode = false;
+ String preferred(elm_config_preferred_engine_get());
+ if(preferred == L"opengl_x11")
+ {
+ glMode = true;
+ mode = 1;
+ }
+ else if(preferred == L"software_x11")
+ {
+ glMode = false;
+ mode = 2;
+ }
+ else
+ {
+ String engineConfig(elm_config_engine_get());
+ if(engineConfig == L"opengl_x11")
+ {
+ glMode = true;
+ mode = 3;
+ }
+ }
+
+ SysLog(NID_UI_CTRL, "[%d %d]", mode, glMode);
+
+ return glMode;
+}
+
+void
+_LiveboxViewManager::OnLiveboxCreated(livebox* pLivebox)
+{
+}
+
+void
+_LiveboxViewManager::OnLiveboxUpdated(livebox* pLivebox)
+{
+ _LiveboxView* pLiveboxView = GetLiveboxView(pLivebox);
+ SysTryReturnVoidResult(NID_UI_CTRL, pLiveboxView, E_SYSTEM, "[E_SYSTEM] A system error occured.");
+
+ int type = livebox_lb_type(pLivebox);
+
+// SysLog(NID_UI_CTRL, "type (%d)", type);
+
+ switch (type)
+ {
+ case LB_TYPE_IMAGE:
+ {
+ unique_ptr<Bitmap> pBitmap(GetBitmapN(livebox_filename(pLivebox)));
+ SysTryReturnVoidResult(NID_UI_CTRL, pBitmap, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ pLiveboxView->OnLiveboxUpdated(*pBitmap.get(), GetLiveboxSize(pLivebox));
+ pBitmap.release();
+ }
+ break;
+
+ case LB_TYPE_BUFFER:
+ {
+ void* pBuffer = livebox_acquire_fb(pLivebox);
+ SysTryReturnVoidResult(NID_UI_CTRL, pBuffer, E_SYSTEM, "[E_SYSTEM] A system error occured.");
+
+ FloatDimension sourceSize = GetLiveboxSize(pLivebox);
+ SysLog(NID_UI_CTRL, "size [%d %d]", sourceSize.width, sourceSize.height);
+
+ unique_ptr<Bitmap> pBitmap(GetBitmapN(pBuffer, sourceSize));
+ SysTryReturnVoidResult(NID_UI_CTRL, pBitmap, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ pLiveboxView->OnLiveboxUpdated(*pBitmap.get(), sourceSize);
+ livebox_release_fb(pBuffer);
+ pBitmap.release();
+ }
+ break;
+
+ case LB_TYPE_PIXMAP:
+ if (__glMode)
+ {
+ pLiveboxView->OnLiveboxUpdated(livebox_lb_pixmap(pLivebox));
+
+#if defined(_PIXMAP_TEST)
+ DumpPixmap(livebox_lb_pixmap(pLivebox));
+#endif // _PIXMAP_TEST
+ }
+ else
+ {
+ void* pBuffer = livebox_acquire_fb(pLivebox);
+ SysTryReturnVoidResult(NID_UI_CTRL, pBuffer, E_SYSTEM, "[E_SYSTEM] A system error occured.");
+
+ FloatDimension sourceSize = GetLiveboxSize(pLivebox);
+
+ unique_ptr<Bitmap> pBitmap(GetBitmapN(pBuffer, sourceSize));
+ SysTryReturnVoidResult(NID_UI_CTRL, pBitmap, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ pLiveboxView->OnLiveboxUpdated(*pBitmap.get(), sourceSize);
+ livebox_release_fb(pBuffer);
+ pBitmap.release();
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+void
+_LiveboxViewManager::OnLiveboxDeleted(livebox* pLivebox)
+{
+}
+
+void
+_LiveboxViewManager::OnLiveboxPinUpChanged(livebox* pLivebox)
+{
+}
+
+void
+_LiveboxViewManager::OnLiveboxPopupUpdated(livebox* pLivebox)
+{
+ _LiveboxView* pLiveboxView = GetLiveboxView(pLivebox);
+ SysTryReturnVoidResult(NID_UI_CTRL, pLiveboxView, E_SYSTEM, "[E_SYSTEM] A system error occured.");
+
+ _LiveboxPopupView* pLiveboxPopupView = pLiveboxView->GetLiveboxPopup();
+ SysTryReturnVoidResult(NID_UI_CTRL, pLiveboxPopupView, E_SYSTEM, "[E_SYSTEM] A system error occured.");
+
+ int type = livebox_pd_type(pLivebox);
+
+// SysLog(NID_UI_CTRL, "type (%d)", type);
+
+ switch (type)
+ {
+ case PD_TYPE_BUFFER:
+ {
+ void* pBuffer = livebox_acquire_pdfb(pLivebox);
+ SysTryReturnVoidResult(NID_UI_CTRL, pBuffer, E_SYSTEM, "[E_SYSTEM] A system error occured.");
+
+ FloatDimension sourceSize = GetLiveboxPopupSize(pLivebox);
+
+ unique_ptr<Bitmap> pBitmap(GetBitmapN(pBuffer, sourceSize));
+ SysTryReturnVoidResult(NID_UI_CTRL, pBitmap, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ pLiveboxPopupView->OnLiveboxUpdated(*pBitmap.get(), sourceSize);
+ livebox_release_pdfb(pBuffer);
+ pBitmap.release();
+ }
+ break;
+
+ case PD_TYPE_PIXMAP:
+ if (__glMode)
+ {
+ pLiveboxPopupView->OnLiveboxUpdated(livebox_pd_pixmap(pLivebox));
+#if defined(_PIXMAP_TEST)
+ DumpPixmap(livebox_pd_pixmap(pLivebox));
+#endif // _PIXMAP_TEST
+ }
+ else
+ {
+ void* pBuffer = livebox_acquire_pdfb(pLivebox);
+ SysTryReturnVoidResult(NID_UI_CTRL, pBuffer, E_SYSTEM, "[E_SYSTEM] A system error occured.");
+
+ FloatDimension sourceSize = GetLiveboxPopupSize(pLivebox);
+
+ unique_ptr<Bitmap> pBitmap(GetBitmapN(pBuffer, sourceSize));
+ SysTryReturnVoidResult(NID_UI_CTRL, pBitmap, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ pLiveboxPopupView->OnLiveboxUpdated(*pBitmap.get(), sourceSize);
+ livebox_release_pdfb(pBuffer);
+ pBitmap.release();
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+int
+_LiveboxViewManager::OnLiveboxEventReceived(livebox* pLivebox, livebox_event_type eventType, void* pData)
+{
+ SysTryReturn(NID_UI_CTRL, pLivebox, EXIT_SUCCESS, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+
+ _LiveboxViewManager* pLiveboxViewManager = static_cast<_LiveboxViewManager*>(pData);
+ SysTryReturn(NID_UI_CTRL, pLiveboxViewManager, EXIT_SUCCESS, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+
+ switch (eventType)
+ {
+ case LB_EVENT_LB_UPDATED:
+ pLiveboxViewManager->OnLiveboxUpdated(pLivebox);
+ break;
+
+ case LB_EVENT_PD_UPDATED:
+ pLiveboxViewManager->OnLiveboxPopupUpdated(pLivebox);
+ break;
+
+ case LB_EVENT_CREATED:
+ pLiveboxViewManager->OnLiveboxCreated(pLivebox);
+ break;
+
+ case LB_EVENT_DELETED:
+ pLiveboxViewManager->OnLiveboxDeleted(pLivebox);
+ break;
+
+ case LB_EVENT_GROUP_CHANGED:
+ break;
+
+ case LB_EVENT_PINUP_CHANGED:
+ pLiveboxViewManager->OnLiveboxPinUpChanged(pLivebox);
+ break;
+
+ case LB_EVENT_PERIOD_CHANGED:
+ break;
+
+ default:
+ SysLog(NID_UI_CTRL, "Not supported event type: %d", eventType);
+ break;
+ }
+
+ return EXIT_SUCCESS;
+}
+
+int
+_LiveboxViewManager::OnLiveboxFaultReceived(livebox_fault_type faultType, const char* pLiveboxId, const char* pFilename, const char* pFuncName, void* pData)
+{
+ if (faultType == LB_FAULT_DEACTIVATED)
+ {
+ SysLog(NID_UI_CTRL, "type (%d) packageName (%s) fileName (%s) funcName (%s)", faultType, pLiveboxId, pFilename, pFuncName);
+ livebox_activate(pLiveboxId, OnLiveboxActivated, pData);
+ }
+
+ return EXIT_SUCCESS;
+}
+
+void
+_LiveboxViewManager::OnLiveboxActivated(livebox* pLivebox, int ret, void* pData)
+{
+ SysTryReturnVoidResult(NID_UI_CTRL, pLivebox, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+ SysTryReturnVoidResult(NID_UI_CTRL, ret == 0, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+
+ _LiveboxViewManager* pLiveboxViewManager = static_cast<_LiveboxViewManager*>(pData);
+ SysTryReturnVoidResult(NID_UI_CTRL, pLiveboxViewManager, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+}
+
+void
+_LiveboxViewManager::OnLiveboxAdded(livebox* pLivebox, int ret, void* pData)
+{
+ SysTryReturnVoidResult(NID_UI_CTRL, pLivebox, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+ SysTryReturnVoidResult(NID_UI_CTRL, ret == 0, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+
+ _LiveboxViewManager* pLiveboxViewManager = static_cast<_LiveboxViewManager*>(pData);
+ SysTryReturnVoidResult(NID_UI_CTRL, pLiveboxViewManager, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+}
+
+void
+_LiveboxViewManager::OnLiveboxDeleted(livebox* pLivebox, int ret, void* pData)
+{
+ SysTryReturnVoidResult(NID_UI_CTRL, pLivebox, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+ SysTryReturnVoidResult(NID_UI_CTRL, ret == 0, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+
+ _LiveboxViewManager* pLiveboxViewManager = static_cast<_LiveboxViewManager*>(pData);
+ SysTryReturnVoidResult(NID_UI_CTRL, pLiveboxViewManager, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+}
+
+void
+_LiveboxViewManager::OnLiveboxResized(livebox* pLivebox, int ret, void* pData)
+{
+ SysTryReturnVoidResult(NID_UI_CTRL, pLivebox, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+ SysTryReturnVoidResult(NID_UI_CTRL, ret == 0, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+
+ _LiveboxViewManager* pLiveboxViewManager = static_cast<_LiveboxViewManager*>(pData);
+ SysTryReturnVoidResult(NID_UI_CTRL, pLiveboxViewManager, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+
+ pLiveboxViewManager->OnLiveboxUpdated(pLivebox);
+}
+
+}} // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file FShell_LiveboxViewManager.h
+ * @brief This is the header file for the _LiveboxViewManager class.
+ *
+ * This header file contains the declarations of the %_LiveboxViewManager class.
+ */
+#ifndef _FSHELL_INTERNAL_LIVEBOX_VIEW_MANAGER_H_
+#define _FSHELL_INTERNAL_LIVEBOX_VIEW_MANAGER_H_
+
+#include <unique_ptr.h>
+#include <FGrpBitmapCommon.h>
+#include <FMediaImageTypes.h>
+
+struct livebox;
+
+namespace Tizen { namespace Base
+{
+class String;
+}}
+
+namespace Tizen { namespace Base { namespace Collection
+{
+template<class KeyType, class ValueType> class HashMapT;
+}}}
+
+namespace Tizen { namespace Graphics
+{
+class Bitmap;
+class FloatDimension;
+class _ICoordinateSystemTransformer;
+}} // Tizen::Graphics
+
+namespace Tizen { namespace Shell
+{
+class _LiveboxView;
+
+/**
+ * @class _LiveboxViewManager
+ * @brief
+ * @since 2.1
+ */
+class _LiveboxViewManager
+{
+public:
+ static _LiveboxViewManager* GetInstance(void);
+ livebox* AddLiveboxView(_LiveboxView* pLiveboxView, const Tizen::Base::String& userInfo);
+ void RemoveLiveboxView(_LiveboxView* pLiveboxView);
+ _LiveboxView* GetLiveboxView(livebox* pLivebox) const;
+ Tizen::Graphics::FloatDimension GetLiveboxSize(livebox* pLivebox) const;
+ Tizen::Graphics::FloatDimension GetLiveboxPopupSize(livebox* pLivebox) const;
+ void SetLiveboxSize(const _LiveboxView& liveboxView, const Tizen::Graphics::FloatDimension& size);
+
+private:
+ _LiveboxViewManager(void);
+ ~_LiveboxViewManager(void);
+ _LiveboxViewManager(const _LiveboxViewManager& rhs);
+ _LiveboxViewManager& operator =(const _LiveboxViewManager& rhs);
+
+ int GetLiveboxSizeType(const Tizen::Graphics::FloatDimension& size) const;
+ Tizen::Media::MediaPixelFormat GetPixelFormat(Tizen::Graphics::BitmapPixelFormat format) const;
+ Tizen::Graphics::Bitmap* GetBitmapN(const Tizen::Base::String& fileName) const;
+ Tizen::Graphics::Bitmap* GetBitmapN(void* pBuffer, const Tizen::Graphics::FloatDimension& size) const;
+ bool IsGlMode(void) const;
+
+ void OnLiveboxCreated(livebox* pLivebox);
+ void OnLiveboxUpdated(livebox* pLivebox);
+ void OnLiveboxDeleted(livebox* pLivebox);
+ void OnLiveboxPinUpChanged(livebox* pLivebox);
+ void OnLiveboxPopupUpdated(livebox* pLivebox);
+
+ static int OnLiveboxEventReceived(livebox* pLivebox, livebox_event_type eventType, void* pData);
+ static int OnLiveboxFaultReceived(livebox_fault_type faultType, const char* pAppId, const char* pFilename, const char *pFuncName, void* pData);
+ static void OnLiveboxActivated(livebox* pLivebox, int ret, void* pData);
+ static void OnLiveboxAdded(livebox* pLivebox, int ret, void* pData);
+ static void OnLiveboxDeleted(livebox *pLivebox, int ret, void* pData);
+ static void OnLiveboxResized(livebox* pLivebox, int ret, void* pData);
+
+private:
+ struct _EventHandlerDeleter
+ {
+ typedef int pointer;
+
+ void operator()(int)
+ {
+ livebox_unset_event_handler(OnLiveboxEventReceived);
+ }
+ };
+
+ struct _FaultEventHandlerDeleter
+ {
+ typedef int pointer;
+
+ void operator()(int)
+ {
+ livebox_unset_fault_handler(OnLiveboxFaultReceived);
+ }
+ };
+
+ std::unique_ptr<Tizen::Base::Collection::HashMapT<livebox*, _LiveboxView*> > __pViewMap;
+ std::unique_ptr<Tizen::Graphics::_ICoordinateSystemTransformer> __pCoordinateTransformer;
+ std::unique_ptr<int, _EventHandlerDeleter> __eventHandler;
+ std::unique_ptr<int, _FaultEventHandlerDeleter> __faultEventHandler;
+ bool __glMode;
+};
+
+}} // Tizen::Shell
+
+#endif // _FSHELL_INTERNAL_LIVEBOX_VIEW_MANAGER_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file FShell_LiveboxViewModel.cpp
+ * @brief This is the implementation file for the _LiveboxViewModel class.
+ */
+
+#include <FBaseSysLog.h>
+#include <FShellLiveboxManager.h>
+#include <FShellLiveboxProviderInfo.h>
+#include <FBase_StringConverter.h>
+#include "FShell_LiveboxViewModel.h"
+
+using namespace std;
+using namespace Tizen::App;
+using namespace Tizen::Base;
+
+namespace Tizen { namespace Shell
+{
+
+_LiveboxViewModel::_LiveboxViewModel(void)
+{
+}
+
+_LiveboxViewModel::~_LiveboxViewModel(void)
+{
+}
+
+void
+_LiveboxViewModel::Initialize(const AppId& appId, const Tizen::Base::String& providerName)
+{
+ __appId = appId;
+ __providerName = providerName;
+
+ // todo : _LiveboxManagerImpl::MakeProviderName
+ if (providerName.IsEmpty())
+ {
+ __liveboxId = __appId;
+ }
+ else
+ {
+ if (appId.IsEmpty())
+ {
+ __liveboxId = providerName;
+ }
+ else
+ {
+ __liveboxId = appId + L"." + providerName;
+ }
+ }
+
+ SysLog(NID_UI_CTRL, "(%ls %ls %ls)", __appId.GetPointer(), __providerName.GetPointer(), __liveboxId.GetPointer());
+
+ LiveboxProviderInfo* pLiveboxProviderInfo = LiveboxManager::GetInstance()->GetLiveboxProviderInfoN(appId, providerName);
+ SysTryReturnVoidResult(NID_UI_CTRL, pLiveboxProviderInfo, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ __pLiveboxProviderInfo.reset(pLiveboxProviderInfo);
+
+ SysLog(NID_UI_CTRL, "(%ls %ls)", __appId.GetPointer(), __providerName.GetPointer());
+
+ SysLog(NID_UI_CTRL, "ProviderInfo(%ls %ls %ls %ls)", __pLiveboxProviderInfo->GetName().GetPointer(), __pLiveboxProviderInfo->GetDisplayName().GetPointer(),
+ __pLiveboxProviderInfo->GetIconPath().GetPointer(), __pLiveboxProviderInfo->GetConfigurationAppControlAppId().GetPointer());
+
+}
+
+AppId
+_LiveboxViewModel::GetAppId(void) const
+{
+ return __appId;
+}
+
+String
+_LiveboxViewModel::GetLiveboxId(void) const
+{
+ return __liveboxId;
+}
+
+Tizen::Base::String
+_LiveboxViewModel::GetProviderName(void) const
+{
+ return __providerName;
+}
+
+String
+_LiveboxViewModel::GetDisplayName(void) const
+{
+ return __pLiveboxProviderInfo->GetDisplayName();
+}
+
+String
+_LiveboxViewModel::GetAppIconPath(void) const
+{
+ return __pLiveboxProviderInfo->GetIconPath();
+}
+
+}} // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file FShell_LiveboxViewModel.h
+ * @brief This is the header file for the _LiveboxViewModel class.
+ *
+ * This header file contains the declarations of the %_LiveboxViewModel class.
+ */
+#ifndef _FSHELL_INTERNAL_LIVEBOX_VIEW_MODEL_H_
+#define _FSHELL_INTERNAL_LIVEBOX_VIEW_MODEL_H_
+
+#include <unique_ptr.h>
+#include <FAppTypes.h>
+#include <FBaseObject.h>
+#include <FBaseString.h>
+
+namespace Tizen { namespace Shell
+{
+
+class LiveboxProviderInfo;
+
+class _LiveboxViewModel
+ : public Tizen::Base::Object
+{
+public:
+ _LiveboxViewModel(void);
+ virtual ~_LiveboxViewModel(void);
+
+public:
+ void Initialize(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName);
+ Tizen::App::AppId GetAppId(void) const;
+ Tizen::Base::String GetLiveboxId(void) const;
+ Tizen::Base::String GetProviderName(void) const;
+ Tizen::Base::String GetDisplayName(void) const;
+ Tizen::Base::String GetAppIconPath(void) const;
+
+private:
+ _LiveboxViewModel(const _LiveboxViewModel& rhs);
+ _LiveboxViewModel& operator =(const _LiveboxViewModel& rhs);
+
+private:
+ Tizen::Base::String __appId;
+ Tizen::Base::String __liveboxId;
+ Tizen::Base::String __providerName;
+ std::unique_ptr<LiveboxProviderInfo> __pLiveboxProviderInfo;
+}; // _LiveboxViewModel
+
+}} // Tizen::Shell
+
+#endif // _FSHELL_INTERNAL_LIVEBOX_VIEW_MODEL_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file FShell_LiveboxViewPresenter.cpp
+ * @brief This is the implementation file for the _LiveboxViewPresenter class.
+ */
+
+#include <new>
+#include <FBaseSysLog.h>
+#include <FGrpDimension.h>
+#include <FGrpFont.h>
+#include <FGrpPoint.h>
+#include <FGrp_CanvasImpl.h>
+#include <FGrp_TextTextObject.h>
+#include <FGrp_TextTextSimple.h>
+#include "FShell_LiveboxViewPresenter.h"
+#include "FShell_LiveboxView.h"
+#include "FShell_LiveboxViewModel.h"
+
+using namespace std;
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+using namespace Tizen::Graphics::_Text;
+
+namespace Tizen { namespace Shell
+{
+
+_LiveboxViewPresenter::_LiveboxViewPresenter(const _LiveboxView& liveBoxView)
+ : __pLiveboxView(const_cast <_LiveboxView*>(&liveBoxView))
+ , __pLiveboxViewModel(new (std::nothrow) _LiveboxViewModel())
+ , __pSimpleText(null)
+{
+ SysTryReturnVoidResult(NID_UI_CTRL, __pLiveboxViewModel, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+}
+
+_LiveboxViewPresenter::~_LiveboxViewPresenter(void)
+{
+ __pLiveboxView = null;
+}
+
+result
+_LiveboxViewPresenter::Initialize(const AppId& appId, const Tizen::Base::String& providerName)
+{
+ const int FONT_SIZE = 20;
+
+ __pLiveboxViewModel->Initialize(appId, providerName);
+
+ unique_ptr<Font> pFont(new (std::nothrow) Font());
+ SysTryReturn(NID_UI_CTRL, pFont, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ result r = pFont->Construct(FONT_STYLE_BOLD, FONT_SIZE);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ std::unique_ptr<TextObject> pTextObject(new (std::nothrow) TextObject());
+ SysTryReturn(NID_UI_CTRL, pTextObject, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ r = pTextObject->Construct();
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pTextObject->SetWrap(TEXT_OBJECT_WRAP_TYPE_WORD);
+ pTextObject->SetAction(TEXT_OBJECT_ACTION_TYPE_ABBREV);
+
+ __pFont = move(pFont);
+ __pTextObject = move(pTextObject);
+
+ return r;
+}
+
+AppId
+_LiveboxViewPresenter::GetAppId(void) const
+{
+ return __pLiveboxViewModel->GetAppId();
+}
+
+String
+_LiveboxViewPresenter::GetLiveboxId(void) const
+{
+ return __pLiveboxViewModel->GetLiveboxId();
+}
+
+
+String
+_LiveboxViewPresenter::GetDisplayName(void) const
+{
+ return __pLiveboxViewModel->GetDisplayName();
+}
+
+String
+_LiveboxViewPresenter::GetAppIconPath(void) const
+{
+ return __pLiveboxViewModel->GetAppIconPath();
+}
+
+void
+_LiveboxViewPresenter::Draw(void)
+{
+ Bitmap* pBitmap = __pLiveboxView->GetBitmap();
+ bool imageDone = false;
+
+ if (pBitmap)
+ {
+ imageDone = true;
+ }
+ else
+ {
+ pBitmap = __pLiveboxView->GetAppIconBitmap();
+ }
+
+ SysTryReturnVoidResult(NID_UI_CTRL, pBitmap, E_SYSTEM, "Bitmap is invalid (%d).", imageDone);
+
+ Dimension liveboxSize = __pLiveboxView->GetSize();
+ int bitmapWidth = pBitmap->GetWidth();
+ int bitmapHeight = pBitmap->GetHeight();
+
+ Point point(0, 0);
+
+ if (!imageDone)
+ {
+ if (liveboxSize.width != bitmapWidth)
+ {
+ point.x = (liveboxSize.width / 2) - (bitmapWidth / 2);
+ }
+
+ if (liveboxSize.height != bitmapHeight)
+ {
+ point.y = (liveboxSize.height / 2) - (bitmapHeight / 2);
+ }
+ }
+
+ unique_ptr<Canvas> pCanvas(__pLiveboxView->GetCanvasN());
+ SysTryReturnVoidResult(NID_UI_CTRL, pCanvas, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
+ pCanvas->Clear();
+
+ if (!imageDone)
+ {
+ pCanvas->DrawBitmap(point, *pBitmap);
+ }
+ else
+ {
+ Rectangle rect = __pLiveboxView->GetBounds();
+ rect.x = 0;
+ rect.y = 0;
+
+ pCanvas->DrawBitmap(rect, *pBitmap);
+ }
+
+ if (!imageDone)
+ {
+ DrawText(*pCanvas);
+ }
+}
+
+void
+_LiveboxViewPresenter::DrawText(Canvas& canvas)
+{
+ const int TEXT_OBJECT_HEIGHT = 25;
+ result r = E_SUCCESS;
+ String appName(GetDisplayName());
+
+ if (!__pSimpleText)
+ {
+ unique_ptr<TextSimple> pSimpleText(new (std::nothrow) TextSimple(appName.GetPointer(), appName.GetLength()));
+ SysTryReturnVoidResult(NID_UI_CTRL, pSimpleText, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+ r = __pTextObject->AppendElement(*pSimpleText);
+ SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pSimpleText = pSimpleText.release();
+ }
+
+ Rectangle liveboxBounds(__pLiveboxView->GetBounds());
+
+ __pTextObject->SetBounds(Rectangle(0, liveboxBounds.height - TEXT_OBJECT_HEIGHT, liveboxBounds.width, TEXT_OBJECT_HEIGHT));
+ __pTextObject->SetAlignment(TEXT_OBJECT_ALIGNMENT_CENTER | TEXT_OBJECT_ALIGNMENT_MIDDLE);
+ __pTextObject->SetFont(__pFont.get(), 0, __pTextObject->GetTextLength());
+
+ r = __pTextObject->Compose();
+ SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = __pTextObject->Draw(*_CanvasImpl::GetInstance(canvas));
+ SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+}
+
+}} // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file FShell_LiveboxViewPresenter.h
+ * @brief This is the header file for the _LiveboxViewPresenter class.
+ *
+ * This header file contains the declarations of the %_LiveboxViewPresenter class.
+ */
+#ifndef _FSHELL_INTERNAL_LIVEBOX_VIEW_PRESENTER_H_
+#define _FSHELL_INTERNAL_LIVEBOX_VIEW_PRESENTER_H_
+
+#include <unique_ptr.h>
+#include <FAppTypes.h>
+
+namespace Tizen { namespace Graphics
+{
+class Font;
+class Canvas;
+}} // Tizen::Graphics
+
+namespace Tizen { namespace Graphics { namespace _Text
+{
+class TextObject;
+class TextSimple;
+}}} // Tizen::Graphics::_Text
+
+namespace Tizen { namespace Shell
+{
+
+class _LiveboxView;
+class _LiveboxViewModel;
+
+class _LiveboxViewPresenter
+{
+public:
+ _LiveboxViewPresenter(const _LiveboxView& liveBoxView);
+ virtual ~_LiveboxViewPresenter(void);
+
+ result Initialize(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName);
+ Tizen::App::AppId GetAppId(void) const;
+ Tizen::Base::String GetLiveboxId(void) const;
+ Tizen::Base::String GetDisplayName(void) const;
+ Tizen::Base::String GetAppIconPath(void) const;
+
+ void Draw(void);
+ void DrawText(Tizen::Graphics::Canvas& canvas);
+
+private:
+ _LiveboxViewPresenter(const _LiveboxViewPresenter& rhs);
+ _LiveboxViewPresenter& operator =(const _LiveboxViewPresenter& rhs);
+
+private:
+ _LiveboxView* __pLiveboxView;
+ std::unique_ptr<_LiveboxViewModel> __pLiveboxViewModel;
+ std::unique_ptr<Tizen::Graphics::Font> __pFont;
+ std::unique_ptr<Tizen::Graphics::_Text::TextObject> __pTextObject;
+ Tizen::Graphics::_Text::TextSimple* __pSimpleText;
+}; // _LiveboxViewPresenter
+
+}} // Tizen::Shell
+
+#endif // _FSHELL_INTERNAL_LIVEBOX_VIEW_PRESENTER_H_
// http://floralicense.org/license/
//
// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
+// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
*/
#include <new>
-#include <Evas.h>
extern "C" {
#include <minicontrol-provider.h>
}
#include <FGrpDimension.h>
+#include <FGrpFloatDimension.h>
#include <FBaseSysLog.h>
#include <FBase_StringConverter.h>
#include "FUi_CoordinateSystemUtils.h"
char* pName = _StringConverter::CopyToCharArrayN(name);
SysTryReturnResult(NID_UI_CTRL, pName, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
- Evas_Object* pWindow = minicontrol_win_add((const char*)pName);
+ pWindow = minicontrol_win_add((const char*)pName);
SysTryCatch(NID_UI_CTRL, pWindow, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
r = Initialize(pWindow);
return r;
}
+ Evas_Object* GetWindow(void)
+ {
+ return pWindow;
+ }
+
+ Evas_Object* pWindow;
+
+
+
private:
_QuickPanelFrameLayer(const _QuickPanelFrameLayer& rhs);
_QuickPanelFrameLayer& operator =(const _QuickPanelFrameLayer& rhs);
_QuickPanelFrame::_QuickPanelFrame(void)
: __pQuickPanelFramePresenter(null)
-#if !defined(MULTI_WINDOW)
- , __pQuickPanelFrameLayer(null)
- , __pQuickPanelFrameRootVisualElement(null)
-#endif
, __pEventManager(null)
{
_UiEventManager* pEventManager = null;
result r = E_SUCCESS;
-#if !defined(MULTI_WINDOW)
- __pQuickPanelFrameLayer = new (std::nothrow) _QuickPanelFrameLayer;
- r = __pQuickPanelFrameLayer->Construct();
- SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-
-
- __pQuickPanelFrameRootVisualElement = __pQuickPanelFrameLayer->GetRootVisualElement();
-#endif
-
pEventManager = _UiEventManager::GetInstance();
SysTryCatch(NID_UI_CTRL, pEventManager, , r, "[%s] Propagating.", GetErrorMessage(r));
delete __pQuickPanelFramePresenter;
__pQuickPanelFramePresenter = null;
}
-
-#if !defined(MULTI_WINDOW)
- if( __pQuickPanelFrameLayer )
- {
- delete __pQuickPanelFrameLayer;
- }
- __pQuickPanelFrameRootVisualElement = NULL;
-#endif
}
_QuickPanelFrame::~_QuickPanelFrame(void)
delete __pQuickPanelFramePresenter;
__pQuickPanelFramePresenter = null;
}
-
-#if !defined(MULTI_WINDOW)
- if (__pQuickPanelFrameRootVisualElement)
- {
- _VisualElement* pVisualElement = GetVisualElement();
- if (pVisualElement)
- {
- __pQuickPanelFrameRootVisualElement->DetachChild(*pVisualElement);
- }
-
- }
-
- if( __pQuickPanelFrameLayer )
- {
- delete __pQuickPanelFrameLayer;
- __pQuickPanelFrameLayer = NULL;
- }
- __pQuickPanelFrameRootVisualElement = NULL;
-#endif
}
_QuickPanelFrame*
result r = GetLastResult();
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-#if defined(MULTI_WINDOW)
r = pQuickPanelFrame->CreateRootVisualElement();
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-#endif
-
pQuickPanelFrame->AcquireHandle();
SetLastResult(E_SUCCESS);
}
result
-_QuickPanelFrame::Initialize(int height)
+_QuickPanelFrame::Initialize(float height)
{
SysTryReturn(NID_UI_CTRL, height >= 0, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The height %d is out of height range(0 ~ ).", height);
Dimension size = pControlManager->GetScreenSize();
- size.width -= 20;
- size.height = height;
+ FloatDimension sizeF(static_cast<float>(size.width), height);
-#if !defined(MULTI_WINDOW)
- _QuickPanelFrameLayer* pLayer = dynamic_cast<_QuickPanelFrameLayer*>(__pQuickPanelFrameRootVisualElement->GetNativeLayer());
-#else
_RootVisualElement* pRootVE = GetRootVisualElement();
SysAssert(pRootVE);
- _QuickPanelFrameLayer* pLayer = dynamic_cast<_QuickPanelFrameLayer*>(pRootVE->GetNativeLayer());
-#endif
+ __pLayer = dynamic_cast<_QuickPanelFrameLayer*>(pRootVE->GetNativeLayer());
r = GetLastResult();
- SysTryReturn(NID_UI_CTRL, pLayer, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturn(NID_UI_CTRL, __pLayer, r, r, "[%s] Propagating.", GetErrorMessage(r));
- Dimension phySize = _CoordinateSystemUtils::Transform(size);
- FloatRectangle fPhyBounds(0.0f, 0.0f, static_cast<float>(phySize.width), static_cast<float>(phySize.height));
+ FloatDimension phySize = _CoordinateSystemUtils::Transform(sizeF);
+ FloatRectangle fPhyBounds(0.0f, 0.0f, phySize.width, phySize.height);
- pLayer->SetBounds(fPhyBounds);
- pLayer->SetShowState(false);
+ __pLayer->SetBounds(fPhyBounds);
+ __pLayer->SetShowState(false);
- FloatRectangle fBounds(0.0f, 0.0f, static_cast<float>(size.width), static_cast<float>(size.height));
+ FloatRectangle fBounds(0.0f, 0.0f, sizeF.width, sizeF.height);
-#if !defined(MULTI_WINDOW)
- __pQuickPanelFrameRootVisualElement->SetImplicitAnimationEnabled(false);
- __pQuickPanelFrameRootVisualElement->SetBounds(fBounds);
- __pQuickPanelFrameRootVisualElement->SetShowState(true);
-
-#else
pRootVE->SetImplicitAnimationEnabled(false);
pRootVE->SetBounds(fBounds);
pRootVE->SetShowState(true);
-#endif
_VisualElement* pVisualElement = GetVisualElement();
r = GetLastResult();
SysTryReturn(NID_UI_CTRL, pVisualElement, r, r, "[%s] Propagating.", GetErrorMessage(r));
-#if !defined(MULTI_WINDOW)
- __pQuickPanelFrameRootVisualElement->AttachChild(*pVisualElement);
- pVisualElement->SetClipChildrenEnabled(false);
-
-#endif
pVisualElement->SetShowState(true);
SetBackgroundColor(Color(0x00000000));
r = GetLastResult();
SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
- r = SetBounds(Rectangle(0, 0, size.width, size.height));
+ r = SetBounds(FloatRectangle(0.0f, 0.0f, sizeF.width, sizeF.height));
SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
SetMovable(false);
}
result
-_QuickPanelFrame::SetHeight(int height)
+_QuickPanelFrame::SetHeight(float height)
{
SysTryReturn(NID_UI_CTRL, height >= 0, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The height %d is out of height range(0 ~ ).", height);
SetMovable(true);
SetResizable(true);
- Rectangle rect = GetBounds();
+ FloatRectangle rect = GetBoundsF();
rect.height = height;
SetBounds(rect);
return r;
}
-#if !defined(MULTI_WINDOW)
-_RootVisualElement*
-_QuickPanelFrame::GetRootVisualElement(void) const
-{
- return __pQuickPanelFrameRootVisualElement;
-}
-#endif
-
-#if defined(MULTI_WINDOW)
result
_QuickPanelFrame::CreateLayer(void)
{
result r = pLayer->Construct();
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage );
- //SetLayer(*pLayer);
+ SetLayer(*pLayer);
SetRootVisualElement(*(pLayer->GetRootVisualElement()));
pEflLayer = static_cast<_EflLayer*>(pLayer);
return r;
}
-#endif
-
-#if !defined(MULTI_WINDOW)
-result
-_QuickPanelFrame::SetLayerShowState(bool showState)
-{
- result r = E_SUCCESS;
-
- _QuickPanelFrameLayer* pLayer = dynamic_cast<_QuickPanelFrameLayer*>(__pQuickPanelFrameRootVisualElement->GetNativeLayer());
- SysTryReturn(NID_UI_CTRL, pLayer, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
-
- r = pLayer->SetShowState(showState);
- SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
-
- __pQuickPanelFrameRootVisualElement->SetShowState(showState);
-
- return r;
-}
-
-result
-_QuickPanelFrame::SetLayerBounds(const Rectangle& bounds)
-{
- _QuickPanelFrameLayer* pLayer = dynamic_cast<_QuickPanelFrameLayer*>(__pQuickPanelFrameRootVisualElement->GetNativeLayer());
- result r = GetLastResult();
- SysTryReturn(NID_UI_CTRL, pLayer, r, r, "[%s] Propagating.", GetErrorMessage(r));
-
- FloatRectangle fBounds(static_cast<float>(bounds.x), static_cast<float>(bounds.y), static_cast<float>(bounds.width), static_cast<float>(bounds.height));
-
- pLayer->SetBounds(fBounds);
- __pQuickPanelFrameRootVisualElement->SetBounds(fBounds);
-
- return r;
-}
-
-void
-_QuickPanelFrame::OnActivated(void)
-{
- result r = SetLayerShowState(true);
- SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
-}
-
-void
-_QuickPanelFrame::OnDeactivated(void)
-{
- result r = SetLayerShowState(false);
- SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
-}
-
-void
-_QuickPanelFrame::OnBoundsChanged(void)
-{
- Rectangle bounds = GetBounds();
- bounds = _CoordinateSystemUtils::Transform(bounds);
-
- SetLayerBounds(bounds);
-}
-
-void
-_QuickPanelFrame::OnVisibleStateChanged(void)
-{
- result r = SetLayerShowState(GetVisibleState());
- SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
-}
-#endif
void
_QuickPanelFrame::OnDraw(void)
// http://floralicense.org/license/
//
// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
+// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <new>
#include <FGrpDimension.h>
+#include <FGrpFloatDimension.h>
#include <FBaseSysLog.h>
#include <FBaseInteger.h>
#include <FBaseRtIEventArg.h>
#include "FUi_TouchManager.h"
#include "FUi_UiBuilder.h"
#include "FShell_QuickPanelFrameImpl.h"
+#include "FUi_LayoutLayoutMaker.h"
using namespace Tizen::Base::Runtime;
using namespace Tizen::Graphics;
}
result
-_QuickPanelFrameImpl::Initialize(int height)
+_QuickPanelFrameImpl::Initialize(float height)
{
result r = GetCore().Initialize(height);
SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
}
result
-_QuickPanelFrameImpl::SetHeight(int height)
+_QuickPanelFrameImpl::SetHeight(float height)
{
result r = GetCore().SetHeight(height);
SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
return r;
}
-#if !defined(MULTI_WINDOW)
-void
-_QuickPanelFrameImpl::Rotate(_ControlRotation rotation)
-{
- if (__rotation == rotation)
- {
- return;
- }
-
- __rotation = rotation;
- _ControlOrientation orientation = _CONTROL_ORIENTATION_PORTRAIT;
- switch (__rotation)
- {
- case _CONTROL_ROTATION_0:
- case _CONTROL_ROTATION_180:
- orientation = _CONTROL_ORIENTATION_PORTRAIT;
- break;
- case _CONTROL_ROTATION_270:
- case _CONTROL_ROTATION_90:
- orientation = _CONTROL_ORIENTATION_LANDSCAPE;
- break;
-
- default:
- return;
- break;
- }
-
- GetCore().ChangeLayout(orientation);
-
- GetCore().UpdateLayout();
-
- FireEvent(rotation);
-
- RotateScreen(__rotation);
-}
-#else
void
_QuickPanelFrameImpl::OnRotated(_ControlRotation rotation)
{
RotateScreen(__rotation);
}
-#endif
void
_QuickPanelFrameImpl::OnChangeLayout(_ControlOrientation orientation)
bool resizable = IsResizable();
SetResizable(true);
+ bool movable = IsMovable();
+ SetMovable(true);
+
_ControlManager* pControlManager = _ControlManager::GetInstance();
SysAssert(pControlManager);
const Dimension& screenSize = pControlManager->GetScreenSize();
- Dimension size = GetSize();
-
+ FloatDimension size = GetSizeF();
if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
{
- size.width = screenSize.width - 20;
+ size.width = static_cast<float>(screenSize.width);
}
else
{
- size.width = screenSize.height - 20;
+ size.width = static_cast<float>(screenSize.height);
}
SetSize(size);
-
SetResizable(resizable);
+ SetMovable(movable);
}
_ControlRotation
result r = E_SYSTEM;
_UiBuilderControlLayout* pControlProperty = null;
Tizen::Base::String elementString;
- int notificationFrameHeight =0;
+ float quickpanelFrameHeight = 0.0f;
QuickPanelFrame* pQuickPanelFrame = dynamic_cast <QuickPanelFrame*>(GetContainer());
SysTryReturn(NID_UI_CTRL, pQuickPanelFrame != null, null, E_SYSTEM, "[E_SYSTEM] This instance is not constructed.");
if (pControlProperty->GetLayoutElement(L"height", elementString))
{
- Integer::Parse(elementString, notificationFrameHeight);
+ Float::Parse(elementString, quickpanelFrameHeight);
}
_UiBuilderLayoutType layoutType = UIBUILDER_LAYOUT_NONE;
- GetLayoutType(pControlProperty, layoutType);
+ __pLayoutMaker->GetLayoutType(pControlProperty, layoutType);
if (layoutType == UIBUILDER_LAYOUT_NONE)
{
- r = pQuickPanelFrame->Construct(notificationFrameHeight);
+ r = pQuickPanelFrame->Construct(quickpanelFrameHeight);
}
else
{
Layout* pLandscapeLayout = null;
result tempResult = E_SUCCESS;
- tempResult = GetLayoutN(pControl, pPortraitLayout, pLandscapeLayout);
+ tempResult = __pLayoutMaker->GetLayoutN(pControl, pPortraitLayout, pLandscapeLayout);
if (E_SUCCESS == tempResult)
{
- r = pQuickPanelFrame->Construct(*pPortraitLayout, *pLandscapeLayout, notificationFrameHeight);
+ r = pQuickPanelFrame->Construct(*pPortraitLayout, *pLandscapeLayout, quickpanelFrameHeight);
}
else
{
_UiBuilderLayoutType layoutType = UIBUILDER_LAYOUT_NONE;
- if (GetLayoutType(pControlProperty, layoutType) == false)
+ if (__pLayoutMaker->GetLayoutType(pControlProperty, layoutType) == false)
{
return null;
}
{
pGridLayout = dynamic_cast<GridLayout*>(pLandscapeLayout);
}
- SetGridLayoutContainerProperty(pGridLayout, pControlProperty);
+ __pLayoutMaker->SetGridLayoutContainerProperty(pGridLayout, pControlProperty);
}
}
// http://floralicense.org/license/
//
// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
+// 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.
/usr/include/appfw
/usr/include/glib-2.0
/usr/lib/glib-2.0/include
- /usr/include/cairo
/usr/include/chromium
/usr/include/dlog
/usr/include/dbus-1.0
- /usr/include/dri2
- #/usr/include/libdrm
/usr/include/notification
+ /usr/include/shortcut
/usr/lib/dbus-1.0/include
- /usr/include/e_dbus-1
- /usr/include/elementary-1
- /usr/include/efreet-1
- /usr/include/ecore-1
- /usr/include/edje-1
- /usr/include/evas-1
- /usr/include/eet-1
- /usr/include/eina-1
- /usr/include/eina-1/eina
- /usr/include/ethumb-1
- /usr/include/freetype2
- /usr/include/fribidi
- /usr/include/harfbuzz
/usr/include/libxml2
- /usr/include/minizip
- /usr/include/minicontrol
- /usr/include/pango-1.0
- /usr/include/pixman-1
/usr/include/system
/usr/include/vconf
+ /usr/include/badge
)
SET (${this_target}_SOURCE_FILES
FShell_NotificationManagerImpl.cpp
FShellNotificationRequest.cpp
FShell_NotificationRequestImpl.cpp
- FShell_NotificationManagerProxy.cpp
- FShell_NotificationManagerIpcMessages.cpp
+ FShellShortcutManager.cpp
+ FShell_ShortcutManagerImpl.cpp
+ FShellLockManager.cpp
+ FShell_LockManagerImpl.cpp
)
## Definitions
## SET LINKER FLAGS
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined -Wl,--as-needed")
+TARGET_LINK_LIBRARIES(${this_target} "-lpthread" )
TARGET_LINK_LIBRARIES(${this_target} "-lchromium" )
TARGET_LINK_LIBRARIES(${this_target} "-L/usr/lib/osp -losp-appfw" )
TARGET_LINK_LIBRARIES(${this_target} "-lcapi-appfw-application" )
TARGET_LINK_LIBRARIES(${this_target} "-levas" )
TARGET_LINK_LIBRARIES(${this_target} "-leina" )
TARGET_LINK_LIBRARIES(${this_target} "-lecore_evas" )
-TARGET_LINK_LIBRARIES(${this_target} "-lminicontrol-provider" )
-#TARGET_LINK_LIBRARIES(${this_target} "-lcapi-system-runtime-info")
+TARGET_LINK_LIBRARIES(${this_target} "-lshortcut" )
+TARGET_LINK_LIBRARIES(${this_target} "-lvconf" )
+TARGET_LINK_LIBRARIES(${this_target} "-lbadge" )
SET_TARGET_PROPERTIES(${this_target}
PROPERTIES
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShellLiveboxManager.cpp
+ * @brief This is the implementation for the LockManager class.
+ */
+
+#include <cstdlib>
+//#include <pthread.h>
+#include <unique_ptr.h>
+
+#include <FBaseLog.h>
+#include <FBaseSysLog.h>
+#include <FShellLockManager.h>
+#include <FShell_LockManagerImpl.h>
+
+namespace Tizen { namespace Shell {
+
+LockManager* LockManager::__pTheInstance = null;
+
+LockManager::LockManager()
+ :__pLockManagerImpl(null)
+{
+}
+
+LockManager::~LockManager()
+{
+}
+
+void
+LockManager::InitSingleton(void)
+{
+ SysLog(NID_APP, "Enter.");
+
+ std::unique_ptr<LockManager> pInst(new (std::nothrow) LockManager());
+ SysTryReturnVoidResult(NID_APP, pInst, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ result r = pInst->Construct();
+ SysTryReturnVoidResult(NID_APP, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pTheInstance = pInst.release();
+ std::atexit(DestroySingleton);
+
+ SysLog(NID_APP, "Exit.");
+}
+
+void
+LockManager::DestroySingleton(void)
+{
+ delete __pTheInstance;
+}
+
+LockManager*
+LockManager::GetInstance(void)
+{
+ static pthread_once_t onceBlock = PTHREAD_ONCE_INIT;
+ if (__pTheInstance == null)
+ {
+ SysLog(NID_APP, "Enter.");
+ ClearLastResult();
+ pthread_once(&onceBlock, InitSingleton);
+ result r = GetLastResult();
+ if (IsFailed(r))
+ {
+ onceBlock = PTHREAD_ONCE_INIT;
+ }
+ SysLog(NID_APP, "Exit.");
+ }
+ return __pTheInstance;
+}
+
+result
+LockManager::Construct(void)
+{
+ SysAssert(__pLockManagerImpl == null);
+
+ __pLockManagerImpl = _LockManagerImpl::GetInstance();
+
+ SysAssertf(__pLockManagerImpl, "Failed to construct _LockManagerImpl!!");
+ SysLog(NID_APP, "Successed.");
+ return E_SUCCESS;
+}
+
+bool
+LockManager::IsLocked(void) const
+{
+ return __pLockManagerImpl->IsLocked();
+}
+
+bool
+LockManager::IsSecureMode(void) const
+{
+ return __pLockManagerImpl->IsSecureMode();
+}
+
+result
+LockManager::Unlock(void)
+{
+ return __pLockManagerImpl->Unlock();
+}
+
+
+}} // Tizen::Shell
#include <new>
-#include <FAppTypes.h>
-#include <FShellNotificationManager.h>
-
#include <FBaseSysLog.h>
+#include <FShellNotificationManager.h>
+#include <FShellIBadgeEventListener.h>
#include <FSec_AccessController.h>
#include "FShell_NotificationManagerImpl.h"
{
SysAssertf(__pNotificationManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
- result r = _AccessController::CheckUserPrivilege(_PRV_NOTIFICATIONMANAGER);
+ result r = _AccessController::CheckUserPrivilege(_PRV_NOTIFICATION, _PRV_NOTIFICATIONMANAGER);
SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
return __pNotificationManagerImpl->NotifyMessageImpl(appId, notiMessage);
{
SysAssertf(__pNotificationManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
- result r = _AccessController::CheckUserPrivilege(_PRV_NOTIFICATIONMANAGER);
+ result r = _AccessController::CheckUserPrivilege(_PRV_NOTIFICATION, _PRV_NOTIFICATIONMANAGER);
SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
return __pNotificationManagerImpl->NotifyMessageImpl(appId, notiMessage, true);
{
SysAssertf(__pNotificationManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
- result r = _AccessController::CheckUserPrivilege(_PRV_NOTIFICATIONMANAGER);
+ result r = _AccessController::CheckUserPrivilege(_PRV_NOTIFICATION, _PRV_NOTIFICATIONMANAGER);
SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
return __pNotificationManagerImpl->RemoveOngoingActivityNotificationByAppId(appId);
{
SysAssertf(__pNotificationManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
- result r = _AccessController::CheckUserPrivilege(_PRV_NOTIFICATIONMANAGER);
+ result r = _AccessController::CheckUserPrivilege(_PRV_NOTIFICATION, _PRV_NOTIFICATIONMANAGER);
SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
return __pNotificationManagerImpl->RemoveNotificationByAppId(appId);
}
-};
-}; // Tizen::Shell
+
+result
+NotificationManager::NotifyTextMessage(const String& messageText)
+{
+ SysAssertf(__pNotificationManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ result r = _AccessController::CheckUserPrivilege(_PRV_NOTIFICATION);
+ SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+
+ return __pNotificationManagerImpl->NotifyTextMessage(messageText);
+}
+
+result
+NotificationManager::NotifyByAppControl(const Tizen::Base::String& operationId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pDataType,
+ const Tizen::Base::Collection::IMap* pExtraData, const NotificationRequest& request)
+{
+ SysAssertf(__pNotificationManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ result r = _AccessController::CheckUserPrivilege(_PRV_NOTIFICATION);
+ SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+
+ return __pNotificationManagerImpl->NotifyByAppControl(operationId, pUriData, pDataType, pExtraData, request);
+}
+
+result
+NotificationManager::NotifyOngoingActivityByAppControl(const Tizen::Base::String& operationId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pDataType,
+ const Tizen::Base::Collection::IMap* pExtraData, const NotificationRequest& request)
+{
+ SysAssertf(__pNotificationManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ result r = _AccessController::CheckUserPrivilege(_PRV_NOTIFICATION);
+ SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+
+ return __pNotificationManagerImpl->NotifyOngoingActivityByAppControl(operationId, pUriData, pDataType, pExtraData, request);
+}
+
+result
+NotificationManager::AddBadgeEventListener(IBadgeEventListener& listener)
+{
+ return __pNotificationManagerImpl->AddBadgeEventListener(listener);
+}
+
+result
+NotificationManager::RemoveBadgeEventListener(IBadgeEventListener& listener)
+{
+ return __pNotificationManagerImpl->RemoveBadgeEventListener(listener);
+}
+
+} } // Tizen::Shell
}
NotificationRequest::NotificationRequest(const NotificationRequest& rhs)
+ : __pNotificationRequestImpl(null)
{
__pNotificationRequestImpl = new (std::nothrow) _NotificationRequestImpl(*rhs.__pNotificationRequestImpl);
SysTryReturnVoidResult(NID_APP, __pNotificationRequestImpl, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
return __pNotificationRequestImpl->SetOngoingActivityProgress(progressValue);
}
-};
-}; // Tizen::Shell
+
+NotificationStyle
+NotificationRequest::GetNotificationStyle(void) const
+{
+ SysAssertf(__pNotificationRequestImpl != null, "Instance is not constructed properly.");
+ return __pNotificationRequestImpl->GetNotificationStyle();
+}
+
+result
+NotificationRequest::SetNotificationStyle(NotificationStyle style)
+{
+ SysAssertf(__pNotificationRequestImpl != null, "Instance is not constructed properly.");
+ return __pNotificationRequestImpl->SetNotificationStyle(style);
+}
+
+
+Tizen::Base::Collection::IList*
+NotificationRequest::GetMessageTextListN(void) const
+{
+ SysAssertf(__pNotificationRequestImpl != null, "Instance is not constructed properly.");
+ return __pNotificationRequestImpl->GetMessageTextListN();
+}
+
+
+result
+NotificationRequest::SetMessageTextList(const Tizen::Base::Collection::IList* pTextList)
+{
+ SysAssertf(__pNotificationRequestImpl != null, "Instance is not constructed properly.");
+ return __pNotificationRequestImpl->SetMessageTextList(pTextList);
+}
+
+
+Tizen::Base::Collection::IList*
+NotificationRequest::GetMessageThumbnailFilePathListN(void) const
+{
+ SysAssertf(__pNotificationRequestImpl != null, "Instance is not constructed properly.");
+ return __pNotificationRequestImpl->GetMessageThumbnailFilePathListN();
+}
+
+
+result
+NotificationRequest::SetMessageThumbnailFilePathList(const Tizen::Base::Collection::IList* pThumbnailPathList)
+{
+ SysAssertf(__pNotificationRequestImpl != null, "Instance is not constructed properly.");
+ return __pNotificationRequestImpl->SetMessageThumbnailFilePathList(pThumbnailPathList);
+}
+
+
+Tizen::Base::String
+NotificationRequest::GetNotificationCountText(void) const
+{
+ SysAssertf(__pNotificationRequestImpl != null, "Instance is not constructed properly.");
+ return __pNotificationRequestImpl->GetNotificationCountText();
+}
+
+
+result
+NotificationRequest::SetNotificationCountText(const Tizen::Base::String& notificationCountText)
+{
+ SysAssertf(__pNotificationRequestImpl != null, "Instance is not constructed properly.");
+ return __pNotificationRequestImpl->SetNotificationCountText(notificationCountText);
+}
+
+
+Tizen::Base::String
+NotificationRequest::GetBackgroundImageFilePath(void) const
+{
+ SysAssertf(__pNotificationRequestImpl != null, "Instance is not constructed properly.");
+ return __pNotificationRequestImpl->GetBackgroundImageFilePath();
+}
+
+
+result
+NotificationRequest::SetBackgroundImageFilePath(const Tizen::Base::String& imagePath)
+{
+ SysAssertf(__pNotificationRequestImpl != null, "Instance is not constructed properly.");
+ return __pNotificationRequestImpl->SetBackgroundImageFilePath(imagePath);
+}
+
+} } // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2013 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.
+//
+
+/**
+ * @file FShellShortcutManager.cpp
+ * @brief This is the implementation for the ShortcutManager class.
+ */
+
+#include <unique_ptr.h>
+
+#include <shortcut.h>
+
+#include <FBaseSysLog.h>
+#include <FShellShortcutManager.h>
+#include <FShellIShortcutRequestListener.h>
+
+#include <FApp_Types.h>
+#include <FApp_AppInfo.h>
+#include <FBase_StringConverter.h>
+#include <FShell_ShortcutManagerImpl.h>
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+
+
+namespace Tizen { namespace Shell
+{
+
+ShortcutManager::ShortcutManager()
+ :__pShortcutManagerImpl(null)
+{
+}
+
+ShortcutManager::~ShortcutManager()
+{
+}
+
+ShortcutManager*
+ShortcutManager::GetInstance()
+{
+ static ShortcutManager* pShortcutManager = null;
+ if( pShortcutManager == null)
+ {
+ pShortcutManager = new (std::nothrow) ShortcutManager;
+ SysTryReturn(NID_APP, pShortcutManager, null, E_OUT_OF_MEMORY, "E_OUT_OF_MEMORY" );
+
+ result r = pShortcutManager->Construct();
+// SysTryReturn(NID_APP, !IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r));
+ SysAssertf(!IsFailed(r), "Failed to construct ShortcutManager!!");
+ }
+
+ return pShortcutManager;
+}
+
+result
+ShortcutManager::Construct()
+{
+ __pShortcutManagerImpl = _ShortcutManagerImpl::GetInstance();
+ return E_SUCCESS;
+}
+
+result
+ShortcutManager::AddShortcut(const AppId& appId, const String& displayName, const String& iconFilePath, const String& uriData, bool allowDuplication)
+{
+ if( allowDuplication )
+ {
+ SysLog(NID_APP, "This feature(allowDuplication) is not yet implemented!");
+ }
+
+ std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId));
+ std::unique_ptr<char[]> pIcon(_StringConverter::CopyToCharArrayN(iconFilePath));
+ std::unique_ptr<char[]> pName(_StringConverter::CopyToCharArrayN(displayName));
+ std::unique_ptr<char[]> pUriData(_StringConverter::CopyToCharArrayN(uriData));
+
+ int type = (uriData.IsEmpty())? LAUNCH_BY_PACKAGE : LAUNCH_BY_URI;
+ int ret = add_to_home_shortcut(pAppId.get(), pName.get(), type, pUriData.get(), pIcon.get(), NULL, this);
+ SysTryReturnResult(NID_APP, ret == 0, E_SYSTEM, "Failed to add_to_home_shortcut");
+
+ return E_SUCCESS;
+}
+
+result
+ShortcutManager::AddShortcutRequestListener(IShortcutRequestListener& listener)
+{
+ return __pShortcutManagerImpl->AddShortcutRequestListener(listener);
+}
+
+result
+ShortcutManager::RemoveShortcutRequestListener(IShortcutRequestListener& listener)
+{
+ return __pShortcutManagerImpl->RemoveShortcutRequestListener(listener);
+}
+
+
+}} // Tizen::Shell
--- /dev/null
+/*
+ * FShell_LockManagerImpl.cpp
+ *
+ * Created on: Feb 15, 2013
+ * Author: jungmin76park
+ */
+
+#include <vconf.h>
+#include <FBaseLog.h>
+#include <FBaseSysLog.h>
+#include <FShell_LockManagerImpl.h>
+
+namespace Tizen { namespace Shell {
+
+#define VCONFKEY_IDLE_LOCK_STATE "memory/idle_lock/state"
+#define VCONFKEY_SETAPPL_PREFIX "db/setting"
+#define VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT VCONFKEY_SETAPPL_PREFIX"/screen_lock_type"
+
+enum
+{
+ VCONFKEY_IDLE_UNLOCK = 0x00,
+ VCONFKEY_IDLE_LOCK
+};
+
+enum
+{
+ SETTING_SCREEN_LOCK_TYPE_SWIPE = 0,
+ SETTING_SCREEN_LOCK_TYPE_MOTION,
+ SETTING_SCREEN_LOCK_TYPE_FACE_AND_VOICE,
+ SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD,
+ SETTING_SCREEN_LOCK_TYPE_PASSWORD,
+ SETTING_SCREEN_LOCK_TYPE_OTHER,
+ SETTING_SCREEN_LOCK_TYPE_MAX
+};
+
+
+
+
+_LockManagerImpl::_LockManagerImpl()
+{
+}
+
+_LockManagerImpl::~_LockManagerImpl()
+{
+}
+
+_LockManagerImpl*
+_LockManagerImpl::GetInstance()
+{
+ static _LockManagerImpl* pLockManagerImpl = null;
+ if( pLockManagerImpl == null )
+ {
+ pLockManagerImpl = new (std::nothrow) _LockManagerImpl();
+ }
+
+ return pLockManagerImpl;
+}
+
+bool
+_LockManagerImpl::IsLocked(void) const
+{
+ int idleLockState = 0;
+ vconf_get_int(VCONFKEY_IDLE_LOCK_STATE, &idleLockState);
+ return (idleLockState == VCONFKEY_IDLE_LOCK);
+}
+
+bool
+_LockManagerImpl::IsSecureMode(void) const
+{
+ int screenLockType = 0;
+ vconf_get_int(VCONFKEY_IDLE_LOCK_STATE, &screenLockType);
+
+ switch(screenLockType)
+ {
+ case SETTING_SCREEN_LOCK_TYPE_SWIPE:
+ case SETTING_SCREEN_LOCK_TYPE_MOTION:
+ return false;
+
+ case SETTING_SCREEN_LOCK_TYPE_FACE_AND_VOICE:
+ case SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD:
+ case SETTING_SCREEN_LOCK_TYPE_PASSWORD:
+ case SETTING_SCREEN_LOCK_TYPE_OTHER:
+ return true;
+
+ default:
+ SysAssert(false);
+ }
+
+ return false;
+}
+
+result
+_LockManagerImpl::Unlock(void)
+{
+ if( IsLocked() == false )
+ {
+ return E_SUCCESS;
+ }
+
+// SysTryReturnResult(NID_APP, !IsSecureMode(), E_INVALID_OPERATION, "Secured lock screen can't be unlocked.");
+
+ int errorCode = -1;
+ errorCode = vconf_set_int(VCONFKEY_IDLE_LOCK_STATE, VCONFKEY_IDLE_UNLOCK);
+ SysTryReturnResult(NID_SYS, errorCode == 0, E_SYSTEM, "Failed to set on VCONFKEY_REGIONFORMAT_TIME1224 vconf");
+
+ return E_SUCCESS;
+}
+
+
+}} // Tizen::Shell
#include <appfw/app.h>
#include <appfw/app_manager.h>
#include <appfw/app_ui_notification.h>
+#include <badge.h>
#include <FBaseSysLog.h>
-#include <FAppTypes.h>
+#include <FApp.h>
+
#include <FShellNotificationManager.h>
#include <FShellNotificationRequest.h>
+#include <FShellIBadgeEventListener.h>
-#include <FBaseInternalTypes.h>
+//#include <FBaseInternalTypes.h>
#include <FBase_StringConverter.h>
#include "FApp_AppInfo.h"
#include "FApp_Aul.h"
+#include "FIoFile.h"
#include "FAppPkg_PackageManagerImpl.h"
#include "FApp_AppArg.h"
+#include "FAppPkgPackageAppInfo.h"
+#include "FAppPkg_PackageAppInfoImpl.h"
#include "FShell_NotificationManagerImpl.h"
-#include "FShell_NotificationManagerProxy.h"
+#include "FShell_NotificationRequestImpl.h"
using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
using namespace Tizen::App;
using namespace Tizen::App::Package;
+using namespace Tizen::Io;
using namespace Tizen::Shell;
extern "C" int service_create_request(bundle *data, service_h *service);
return pStruct->posted;
}
-}
+} // namespace
+
namespace Tizen { namespace Shell
{
-_NotificationManagerImpl::_NotificationManagerImpl(void)
-: __pNotificationManager(null)
+///////////////////////////////////////////////////////////////////
+// _BadgeManagerImpl
+///////////////////////////////////////////////////////////////////
+void
+BadgeChangedCallback(unsigned int action, const char *pkgname, unsigned int count, void *data)
{
+ Tizen::Base::Collection::LinkedListT<Tizen::Shell::IBadgeEventListener*>* pBadgeEventListenerList = static_cast<Tizen::Base::Collection::LinkedListT<Tizen::Shell::IBadgeEventListener*>*>(data);
+ SysAssert(pBadgeEventListenerList);
+
+ std::unique_ptr<IEnumeratorT<Tizen::Shell::IBadgeEventListener* > > pEnum(pBadgeEventListenerList->GetEnumeratorN());
+ SysTryReturnVoidResult(NID_APP, pEnum.get(), E_OUT_OF_MEMORY, "Failed to GetEnumeratorN()!");
+
+ IBadgeEventListener* pListener;
+ while (pEnum->MoveNext() == E_SUCCESS)
+ {
+ pListener = null;
+ pEnum->GetCurrent(pListener);
+ if( !pListener)
+ {
+ SysLog(NID_APP, "pListener is null!");
+ continue;
+ }
+
+ pListener->OnBadgeUpdated(pkgname, count);
+ }
}
-_NotificationManagerImpl::~_NotificationManagerImpl(void)
+_BadgeManagerImpl*
+_BadgeManagerImpl::GetInstance(void)
{
+ static _BadgeManagerImpl* pTheInstance = null;
+ if( pTheInstance == null)
+ {
+ pTheInstance = new (std::nothrow) _BadgeManagerImpl;
+ pTheInstance->Construct();
+ }
+ return pTheInstance;
}
result
-_NotificationManagerImpl::Construct(void)
+_BadgeManagerImpl::Construct(void)
{
- result r = E_SUCCESS;
+ return E_SUCCESS;
+}
- __pNotificationManager = new (std::nothrow) _NotificationManagerProxy;
- SysTryReturnResult(NID_APP, __pNotificationManager != null, E_OUT_OF_MEMORY, "__pNotificationManagerProxy creation failed.");
+result
+_BadgeManagerImpl::AddPrimaryBadgeEventListener(IBadgeEventListener& primaryListener)
+{
+ if( __primaryBadgeEventListenerList.GetCount() == 0)
+ {
+ int ret = badge_register_changed_cb(BadgeChangedCallback, &__primaryBadgeEventListenerList);
+ SysTryReturnResult(NID_APP, ret == BADGE_ERROR_NONE, E_SYSTEM, "Failed to badge_unregister_changed_cb, (%d)", ret);
+ }
- r = __pNotificationManager->Construct();
- SysTryCatch(NID_APP, !IsFailed(r), , r, "__pNotificationManager->Construct() failed [%s].", GetErrorMessage(r));
+ return __primaryBadgeEventListenerList.Add(&primaryListener);
+}
+result
+_BadgeManagerImpl::RemovePrimaryBadgeEventListener(IBadgeEventListener& primaryListener)
+{
+ __primaryBadgeEventListenerList.Remove(&primaryListener);
+ if( __primaryBadgeEventListenerList.GetCount() == 0)
+ {
+ int ret = badge_unregister_changed_cb(BadgeChangedCallback);
+ SysTryReturnResult(NID_APP, ret == BADGE_ERROR_NONE, E_SYSTEM, "Failed to badge_unregister_changed_cb, (%d)", ret);
+ }
return E_SUCCESS;
+}
-CATCH:
- delete __pNotificationManager;
- __pNotificationManager = null;
- return r;
+///////////////////////////////////////////////////////////////////
+// _NotificationManagerImpl
+///////////////////////////////////////////////////////////////////
+_NotificationManagerImpl::_NotificationManagerImpl(void)
+ : __notifyPrivitId(-1)
+ , __notifyPrivitIdForOngoing(-1)
+{
+}
+
+_NotificationManagerImpl::~_NotificationManagerImpl(void)
+{
+ bool isListeningBadgeEvent = (__badgeEventListenerList.GetCount() > 0)? true : false;
+ if( isListeningBadgeEvent == true )
+ {
+ _BadgeManagerImpl::GetInstance()->RemovePrimaryBadgeEventListener(*this);
+ }
+}
+
+result
+_NotificationManagerImpl::Construct(void)
+{
+ return E_SUCCESS;
}
const _NotificationManagerImpl*
int
_NotificationManagerImpl::GetBadgeNumber(void) const
{
- int count = -1;
- notification_get_badge(NULL, NOTIFICATION_GROUP_ID_NONE, &count);
+ Tizen::App::App* pApp = Tizen::App::App::GetInstance();
+ std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(pApp->GetAppId()));
+
+ int count = GetBadgeCount(pAppId.get());
+ SysTryReturn(NID_APP, count != -1, count, E_OPERATION_FAILED, "[%s] The operation has failed. Badge may not exist.",
+ GetErrorMessage(E_OPERATION_FAILED));
+
+ ClearLastResult();
return count;
}
result
-_NotificationManagerImpl::OngoingImpl(const String& messageText, const String& launchArguments) const
+_NotificationManagerImpl::NotifyMessageImpl(const NotificationRequest& notiMessage, bool isOngoing)
{
- return NotifyImpl(messageText, -1, launchArguments, true);
+ return NotifyMessage(NOTIFY_TYPE_SIMPLE, isOngoing, notiMessage);
}
result
-_NotificationManagerImpl::OngoingImpl(const AppId& appId, const String& messageText, const String& launchArguments) const
+_NotificationManagerImpl::NotifyMessageImpl(const AppId& appId, const NotificationRequest& notiMessage, bool isOngoing)
{
-
- return NotifyImpl(appId, messageText, -1, launchArguments, true);
+ return NotifyMessage(NOTIFY_TYPE_APP_ID, isOngoing, notiMessage, &appId);
}
+
result
-_NotificationManagerImpl::NotifyImpl(const String& messageText, int badgeNumber,
- const String& launchArguments,
- bool isOngoing) const
+_NotificationManagerImpl::Notify(int badgeNumber)
{
- result r = E_SUCCESS;
- char* pMsg = null;
- notification_h core = NULL;
- char* pkgname = NULL;
- bundle* pKb = NULL;
- bundle* service_data = NULL;
- service_h svc = NULL;
- _AppArg arg;
+ SysTryReturnResult(NID_APP, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0.");
- if (!messageText.IsEmpty())
+ if (badgeNumber > MAX_NOTIFICATION_BADGE_NUMBER)
{
- SysTryReturnResult(NID_APP,
- messageText.GetLength() <= MAX_NOTIFICATION_MESSAGE_LENGTH, E_INVALID_ARG,
- "MessageText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
+ badgeNumber = MAX_NOTIFICATION_BADGE_NUMBER;
+ }
- if (isOngoing)
- {
- core = notification_new(NOTIFICATION_TYPE_ONGOING, NOTIFICATION_GROUP_ID_DEFAULT, NOTIFICATION_PRIV_ID_NONE);
- SysTryReturnResult(NID_APP, core!= NULL , E_SYSTEM, "Notification creation failed ");
- }
- else
- {
- core = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_DEFAULT, NOTIFICATION_PRIV_ID_NONE);
- SysTryReturnResult(NID_APP, core!= NULL , E_SYSTEM, "Notification creation failed ");
- }
+ Tizen::App::App* pApp = Tizen::App::App::GetInstance();
+ std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(pApp->GetAppId()));
- pMsg = _StringConverter::CopyToCharArrayN(messageText);
- notification_set_text(core, NOTIFICATION_TEXT_TYPE_CONTENT, pMsg, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ if (badgeNumber == 0)
+ {
+ RemoveBadge(pAppId.get());
+ }
+ else
+ if (badgeNumber > 0)
+ {
+ SetBadgeCount(pAppId.get(), badgeNumber);
+ }
- app_get_package(&pkgname);
- SysTryCatch(NID_APP, pkgname != NULL, r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Cannot acquire package name for current application.");
+ return E_SUCCESS;
+}
- r = arg.Construct(launchArguments);
- SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Propagating.", GetErrorMessage(r));
+result
+_NotificationManagerImpl::Notify(const String& messageText)
+{
+ SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
- pKb = arg.GetBundle();
- service_create_request(pKb, &svc);
- service_set_package(svc, pkgname);
+ NotificationRequest request;
+ request.SetAlertText(messageText);
+ request.SetAppMessage(L"");
- if (service_to_bundle(svc, &service_data) == SERVICE_ERROR_NONE)
- {
- notification_set_property(core, 0);
- notification_set_execute_option(core, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, service_data);
- SysLog(NID_APP, "Sending notification[%ls] for package %s.", messageText.GetPointer(), pkgname);
- }
+ return NotifyMessage(NOTIFY_TYPE_SIMPLE, false, request);
+}
- r = ConvertNotificationResult(notification_insert(core, NULL));
- SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r));
- }
+result
+_NotificationManagerImpl::Notify(const String& messageText, int badgeNumber)
+{
+ SysTryReturnResult(NID_APP, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0.");
+ SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
- if (badgeNumber >= 0)
+ if (badgeNumber > MAX_NOTIFICATION_BADGE_NUMBER)
{
- notification_set_badge(NULL, NOTIFICATION_GROUP_ID_NONE, badgeNumber);
- SysLog(NID_APP, "Badge number is set to %d.", badgeNumber);
+ badgeNumber = MAX_NOTIFICATION_BADGE_NUMBER;
}
-CATCH:
- delete[] pMsg;
- if (pkgname)
- {
- free(pkgname);
- }
+ NotificationRequest request;
+ request.SetAlertText(messageText);
+ request.SetBadgeNumber(badgeNumber);
+ request.SetAppMessage(L"");
- if (core)
+ return NotifyMessage(NOTIFY_TYPE_SIMPLE, false, request);
+}
+
+result
+_NotificationManagerImpl::Notify(const String& messageText, int badgeNumber, const String& launchArguments)
+{
+ SysTryReturnResult(NID_APP, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0.");
+ SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
+ SysTryReturnResult(NID_APP, launchArguments != null && launchArguments.GetLength() > 0, E_INVALID_ARG,
+ "launchArguments is less than 0.");
+
+ SysTryReturnResult(NID_APP, launchArguments.GetLength() <= MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH, E_INVALID_ARG,
+ "launchArguments is greater than MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.");
+
+ if (badgeNumber > MAX_NOTIFICATION_BADGE_NUMBER)
{
- notification_free(core);
+ badgeNumber = MAX_NOTIFICATION_BADGE_NUMBER;
}
- service_destroy(svc);
- return r;
+
+ NotificationRequest request;
+ request.SetAlertText(messageText);
+ request.SetBadgeNumber(badgeNumber);
+ request.SetAppMessage(launchArguments);
+
+ return NotifyMessage(NOTIFY_TYPE_SIMPLE, false, request);
+}
+
+int
+_NotificationManagerImpl::GetBadgeNumber(const AppId& appId) const
+{
+ bool b = _Aul::IsInstalled(appId);
+ SysTryReturn(NID_APP, b == true, -1, E_APP_NOT_INSTALLED, "[E_OBJ_NOT_FOUND] The application %ls is not installed",
+ appId.GetPointer());
+ std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId));
+ int count = GetBadgeCount(pAppId.get());
+
+ SysTryReturn(NID_APP, count != -1, count, E_OPERATION_FAILED, "[%s] The operation has failed. Badge may not exist.",
+ GetErrorMessage(E_OPERATION_FAILED));
+ ClearLastResult();
+
+ return count;
}
result
-_NotificationManagerImpl::NotifyImpl(const AppId& appId, const String& messageText, int badgeNumber,
- const String& launchArguments,
- bool isOngoing) const
+_NotificationManagerImpl::NotifyOngoingActivity(const String& messageText)
{
- result r = E_SUCCESS;
- char* pMsg = null;
- char* pIcon = NULL;
- char* pName = NULL;
- notification_h core = NULL;
- char buffer[256];
- bundle* pKb = NULL;
- bundle* service_data = NULL;
- service_h svc = NULL;
- _AppArg arg;
+ SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
- memset(buffer, 0, 256);
+ NotificationRequest request;
+ request.SetAlertText(messageText);
- bool b = _Aul::IsInstalled(appId);
- SysTryReturnResult(NID_APP, b == true, E_APP_NOT_INSTALLED, "The application %ls is not installed", appId.GetPointer());
+ return NotifyMessage(NOTIFY_TYPE_SIMPLE, true, request);
+}
- if (isOngoing || !messageText.IsEmpty())
- {
- SysTryReturnResult(NID_APP,
- messageText.GetLength() <= MAX_NOTIFICATION_MESSAGE_LENGTH, E_INVALID_ARG,
- "MessageText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
+result
+_NotificationManagerImpl::NotifyOngoingActivity(const String& messageText, const String& launchArguments)
+{
+ SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
+ SysTryReturnResult(NID_APP, launchArguments.GetLength() > 0, E_INVALID_ARG, "launchArguments is less than 0.");
+ SysTryReturnResult(NID_APP, launchArguments.GetLength() <= MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH, E_INVALID_ARG,
+ "launchArguments is greater than MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.");
- if (isOngoing)
- {
- core = notification_new(NOTIFICATION_TYPE_ONGOING, NOTIFICATION_GROUP_ID_DEFAULT, NOTIFICATION_PRIV_ID_NONE);
- SysTryReturnResult(NID_APP, core!= NULL , E_SYSTEM, "Notification creation failed ");
- }
- else
- {
- core = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_DEFAULT, NOTIFICATION_PRIV_ID_NONE);
- SysTryReturnResult(NID_APP, core!= NULL , E_SYSTEM, "Notification creation failed ");
- }
-
- pMsg = _StringConverter::CopyToCharArrayN(messageText);
- notification_set_text(core, NOTIFICATION_TEXT_TYPE_CONTENT, pMsg, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
-
- snprintf(buffer, 256, "%ls", appId.GetPointer());
-
- app_manager_get_app_icon_path(buffer, &pIcon);
- r = ConvertNotificationResult(notification_set_image(core, NOTIFICATION_IMAGE_TYPE_ICON, pIcon));
- SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification set icon failed.", GetErrorMessage(r));
-
- app_manager_get_app_name(buffer, &pName);
- r = ConvertNotificationResult(notification_set_text(core, NOTIFICATION_TEXT_TYPE_TITLE, pName, NULL, NOTIFICATION_VARIABLE_TYPE_NONE));
- SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification set title text failed.", GetErrorMessage(r));
-
- r = arg.Construct(launchArguments);
- SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Propagating.", GetErrorMessage(r));
-
- pKb = arg.GetBundle();
- service_create_request(pKb, &svc);
- service_set_app_id(svc, buffer);
-
- if (service_to_bundle(svc, &service_data) == SERVICE_ERROR_NONE)
- {
- notification_set_property(core, 0);
- notification_set_execute_option(core, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, service_data);
- SysLog(NID_APP, "Sending notification[%ls] for package %s.", messageText.GetPointer(), buffer);
- }
-
- r = ConvertNotificationResult(notification_insert(core,NULL));
- SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r));
- }
+ NotificationRequest request;
+ request.SetAlertText(messageText);
+ request.SetAppMessage(launchArguments);
- if (badgeNumber >= 0)
- {
- notification_set_badge(buffer, NOTIFICATION_GROUP_ID_NONE, badgeNumber);
- SysLog(NID_APP, "Badge number is set to %d.", badgeNumber);
- }
+ return NotifyMessage(NOTIFY_TYPE_SIMPLE, true, request);
+}
-CATCH:
- delete[] pMsg;
+result
+_NotificationManagerImpl::RemoveOngoingActivityNotificationByAppId(const AppId& appId)
+{
+ return RemoveNotificationByAppId(appId, true);
+}
- if (core)
- {
- notification_free(core);
- }
- if (pIcon)
- {
- free(pIcon);
- }
+result
+_NotificationManagerImpl::RemoveNotificationByAppId(const AppId& appId)
+{
+ return RemoveNotificationByAppId(appId, false);
+}
- if (pName)
+result
+_NotificationManagerImpl::NotifyTextMessage(const String& messageText) const
+{
+ SysTryReturnResult(NID_APP, !messageText.IsEmpty(), E_INVALID_ARG, "MessageText is less than 0.");
+
+ std::unique_ptr<char[]> pMsg(_StringConverter::CopyToCharArrayN(messageText));
+ int res = notification_status_message_post(pMsg.get());
+
+ result r = E_SUCCESS;
+ switch (res)
{
- free(pName);
+ case NOTIFICATION_ERROR_NONE:
+ // success
+ break;
+ case NOTIFICATION_ERROR_INVALID_DATA:
+ r = E_INVALID_ARG;
+ break;
+ case NOTIFICATION_ERROR_IO:
+ r = E_SYSTEM;
+ break;
+ default:
+ r = E_SYSTEM;
+ break;
}
- service_destroy(svc);
+
+ SysLog(NID_APP, "[%s] %ls posted.", GetErrorMessage(r), messageText.GetPointer());
return r;
}
+result
+_NotificationManagerImpl::NotifyByAppControl(const Tizen::Base::String& operationId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pDataType,
+ const Tizen::Base::Collection::IMap* pExtraData, const NotificationRequest& request)
+{
+ result r = E_SUCCESS;
+
+ r = NotifyMessage(NOTIFY_TYPE_APP_CONTROL, false, request, null, &operationId, pUriData, pDataType, pExtraData);
+ return r;
+}
result
-_NotificationManagerImpl::NotifyMessageImpl(const NotificationRequest& notiMessage, bool isOngoing)
+_NotificationManagerImpl::NotifyOngoingActivityByAppControl(const Tizen::Base::String& operationId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pDataType,
+ const Tizen::Base::Collection::IMap* pExtraData, const NotificationRequest& request)
{
result r = E_SUCCESS;
- int progress = -1;
- notification_h core = NULL;
- char* pkgname = NULL;
- char* pTitleText = NULL;
- char* pIconPath = NULL;
- char* pSoundPath = NULL;
- bundle* pKb = NULL;
- bundle* service_data = NULL;
- service_h svc = NULL;
- _AppArg arg;
- const String& messageText = notiMessage.GetAlertText();
- const String& launchArguments = notiMessage.GetAppMessage();
- const String& titleText = notiMessage.GetTitleText();
- const String& iconPath = notiMessage.GetIconFilePath();
- const String& soundPath = notiMessage.GetSoundFilePath();
- const int badgeNumber = notiMessage.GetBadgeNumber();
- const int badgeOffset = notiMessage.GetBadgeOffset();
+ r = NotifyMessage(NOTIFY_TYPE_APP_CONTROL, true, request, null, &operationId, pUriData, pDataType, pExtraData);
+ return r;
+}
- if (isOngoing || !messageText.IsEmpty())
- {
- SysTryReturnResult(NID_APP,
- messageText.GetLength() <= MAX_NOTIFICATION_MESSAGE_LENGTH, E_INVALID_ARG,
- "MessageText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
- if (isOngoing)
- {
- core = notification_new(NOTIFICATION_TYPE_ONGOING, NOTIFICATION_GROUP_ID_DEFAULT, NOTIFICATION_PRIV_ID_NONE);
- SysTryReturnResult(NID_APP, core!= NULL , E_SYSTEM, "Notification creation failed ");
- }
- else
- {
- core = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_DEFAULT, NOTIFICATION_PRIV_ID_NONE);
- SysTryReturnResult(NID_APP, core!= NULL , E_SYSTEM, "Notification creation failed ");
- }
-
- std::unique_ptr<char[]> pMsg(_StringConverter::CopyToCharArrayN(messageText));
-
- if (pMsg)
- {
- r = ConvertNotificationResult(notification_set_text(core, NOTIFICATION_TEXT_TYPE_CONTENT, pMsg.get(), NULL, NOTIFICATION_VARIABLE_TYPE_NONE));
- SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification set title text failed.", GetErrorMessage(r));
- }
+result
+_NotificationManagerImpl::NotifyMessage(_NotifyType notifyType, bool isOngoing, const NotificationRequest& notifyRequest, const AppId* pAppId,
+ const Tizen::Base::String* pOperationId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pDataType, const Tizen::Base::Collection::IMap* pExtraData)
+{
+ result r = E_SUCCESS;
+ std::unique_ptr<char[]> pAppIdChar(null);
+ const _NotificationRequestImpl* pRequestImpl = _NotificationRequestImpl::GetInstance(notifyRequest);
+ SysTryReturnResult(NID_APP, pRequestImpl != null, E_INVALID_ARG, "Invalid argument is used.");
+
+ // Set pAppIdChar
+ if ((notifyType == NOTIFY_TYPE_SIMPLE) || (notifyType == NOTIFY_TYPE_APP_CONTROL))
+ {
+// char* pkgname = null;
+// app_get_id(&pkgname); // AppId. (Not package Id)
+// SysTryReturnResult(NID_APP, pkgname != NULL, E_OBJ_NOT_FOUND,"Cannot acquire package name for current application.");
+// const String currentAppId(pkgname);
+// free(pkgname);
+ Tizen::App::App* pApp = Tizen::App::App::GetInstance();
+ const String currentAppId = pApp->GetAppId();
+ std::unique_ptr<char[]> pAppIdTemp(_StringConverter::CopyToCharArrayN(currentAppId));
+ pAppIdChar = std::move(pAppIdTemp);
+ SysLog(NID_APP, "app_get_id: %ls", currentAppId.GetPointer());
+ }
+ else
+ if (notifyType == NOTIFY_TYPE_APP_ID)
+ {
+ bool isAppInstalled = _Aul::IsInstalled(*pAppId);
+ SysTryReturnResult(NID_APP, isAppInstalled == true, E_APP_NOT_INSTALLED, "The application %ls is not installed", pAppId->GetPointer());
+ std::unique_ptr<char[]> pAppIdTemp(_StringConverter::CopyToCharArrayN(*pAppId));
+ pAppIdChar = std::move(pAppIdTemp);
+ }
+ else
+ {
+ SysTryReturnResult(NID_APP, false, E_INVALID_ARG, "Invalid argument is used.");
+ }
- if (!titleText.IsEmpty())
+ const int badgeNumber = notifyRequest.GetBadgeNumber();
+ const int badgeOffset = notifyRequest.GetBadgeOffset();
+ const String& contentText = notifyRequest.GetAlertText();
+ // Allow change the badge without other properties.
+ if (badgeNumber != -1 || badgeOffset != -1)
+ {
+ // Set - Badge
+ if (badgeOffset != 0)
{
- pTitleText = _StringConverter::CopyToCharArrayN(titleText);
- r = ConvertNotificationResult(notification_set_text(core, NOTIFICATION_TEXT_TYPE_TITLE, pTitleText, NULL, NOTIFICATION_VARIABLE_TYPE_NONE));
- SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification set title text failed.", GetErrorMessage(r));
+ int badgeNumber = GetBadgeCount(pAppIdChar.get());
+ if (badgeNumber <= 0)
+ {
+ SetBadgeCount(pAppIdChar.get(), badgeOffset);
+ }
+ else
+ {
+ SetBadgeCount(pAppIdChar.get(), badgeNumber + badgeOffset);
+ }
}
-
- if (!iconPath.IsEmpty())
+ else
{
- pIconPath = _StringConverter::CopyToCharArrayN(iconPath);
- r = ConvertNotificationResult(notification_set_image(core, NOTIFICATION_IMAGE_TYPE_ICON, pIconPath));
- SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification set icon failed.", GetErrorMessage(r));
+ if (badgeNumber == 0)
+ {
+ RemoveBadge(pAppIdChar.get());
+ }
+ else
+ if (badgeNumber > 0)
+ {
+ SetBadgeCount(pAppIdChar.get(), badgeNumber);
+ }
}
-
- if (!soundPath.IsEmpty())
+ if (!(isOngoing || !contentText.IsEmpty()))
{
- pSoundPath = _StringConverter::CopyToCharArrayN(soundPath);
- r = ConvertNotificationResult(notification_set_sound(core, NOTIFICATION_SOUND_TYPE_USER_DATA, pSoundPath));
- SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification set sound failed.", GetErrorMessage(r));
+ SysLog(NID_APP, "No valid for Notification, just for set a badgeNumber update.");
+ return E_SUCCESS;
}
+ }
+ SysTryReturnResult(NID_APP, (isOngoing || !contentText.IsEmpty()), E_INVALID_ARG, "Invalid argument is used. MessageText is Empty");
+
+ const String& titleText = notifyRequest.GetTitleText();
+ const String& launchArguments = notifyRequest.GetAppMessage();
+ const String& iconPath = notifyRequest.GetIconFilePath();
+ const String& soundPath = notifyRequest.GetSoundFilePath();
+ const notification_type_e notiType = isOngoing ? NOTIFICATION_TYPE_ONGOING : NOTIFICATION_TYPE_NOTI;
+ int notiPrivateId = isOngoing ? __notifyPrivitIdForOngoing : __notifyPrivitId;
+ notification_h notiHandle = null;
+ bundle* pBundle = null;
+ bool needUpdate = false;
+ bundle* service_data = null;
+ _AppArg arg;
+ service_h hSvc = null;
+ notification_ly_type_e layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE;
- app_get_id(&pkgname);
- SysTryCatch(NID_APP, pkgname != NULL, r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Cannot acquire package name for current application.");
-
- r = arg.Construct(launchArguments);
- SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Propagating.", GetErrorMessage(r));
+ // Notification creation
+ if (notiPrivateId != -1)
+ {
+ notiHandle = notification_load(pAppIdChar.get(), notiPrivateId);
+ SysTryLog(NID_APP, notiHandle != null, "Get notiHandle(%d) from notiPrivateId(%d).", notiHandle, notiPrivateId);
+ }
- pKb = arg.GetBundle();
- service_create_request(pKb, &svc);
- service_set_app_id(svc, pkgname);
+ if (notiHandle == null)
+ {
+ SysLog(NID_APP, "Previous notification(%d) no more valid - create new notification", notiPrivateId);
+ notiPrivateId = -1; // reset
+ notiHandle = notification_create(notiType);
+ }
+ else
+ {
+ needUpdate = true; // No need to notification_insert.
+ }
+ SysTryReturnResult(NID_APP, notiHandle != null , E_SYSTEM, "A system error has been occurred. Notification creation/load failed ");
- if (service_to_bundle(svc, &service_data) == SERVICE_ERROR_NONE)
- {
- notification_set_property(core, 0);
- notification_set_execute_option(core, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, service_data);
- SysLog(NID_APP, "Sending notification[%ls] for package %s.", messageText.GetPointer(), pkgname);
- }
+ // Content text(Alert text)
+ std::unique_ptr<char[]> pMsg(_StringConverter::CopyToCharArrayN(contentText));
- if (isOngoing)
+ // Title text
+ std::unique_ptr<char[]> pTitleText(null);
+ if (!titleText.IsEmpty())
+ {
+ std::unique_ptr<char[]> pTitleTextTemp(_StringConverter::CopyToCharArrayN(titleText));
+ pTitleText = std::move(pTitleTextTemp);
+ }
+ else
+ {
+ char* pAppName = null;
+ app_manager_get_app_name(pAppIdChar.get(), &pAppName);
+ if (pAppName)
{
- OngoingActivityType activityType = notiMessage.GetOngoingActivityType();
- progress = notiMessage.GetOngoingActivityProgress();
- switch (activityType)
- {
- case ONGOING_ACTIVITY_TYPE_PROGRESS_PERCENTAGE:
- r = ConvertNotificationResult(notification_insert(core,NULL));
- SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r));
- r = ConvertNotificationResult(notification_update_progress(core, NOTIFICATION_PRIV_ID_NONE, progress/100.));
- SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification update failure.", GetErrorMessage(r));
- break;
- case ONGOING_ACTIVITY_TYPE_PROGRESS_BYTE:
- r = ConvertNotificationResult(notification_insert(core,NULL));
- SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r));
- r = ConvertNotificationResult(notification_update_size(core, NOTIFICATION_PRIV_ID_NONE, progress));
- SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification update failure.", GetErrorMessage(r));
- break;
- case ONGOING_ACTIVITY_TYPE_TEXT:
- r = ConvertNotificationResult(notification_insert(core,NULL));
- SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r));
- break;
- default:
- r = E_OPERATION_FAILED;
- // ui_notification_set_content() is done already
- break;
- }
+ String appName(pAppName);
+ std::unique_ptr<char[]> pTitleTextTemp(_StringConverter::CopyToCharArrayN(appName));
+ pTitleText = std::move(pTitleTextTemp);
+ free(pAppName);
+ //SysLog(NID_APP, "Application Id is %ls.", appName.GetPointer());
}
else
{
- r = ConvertNotificationResult(notification_insert(core,NULL));
- SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r));
+ SysTryLog(NID_APP, pTitleText, "Failed to get title from app_manager_get_app_name for default setting.");
}
}
- else
+ // Icon file path
+ std::unique_ptr<char[]> pIconPath(null);
+ if (!iconPath.IsEmpty())
{
- SysTryReturnResult(NID_APP, 0, E_INVALID_ARG, "MessageText is Empty");
+ std::unique_ptr<char[]> pIconPathTemp(_StringConverter::CopyToCharArrayN(iconPath));
+ pIconPath = std::move(pIconPathTemp);
}
-
- if (badgeNumber >= 0)
- {
- notification_set_badge(NULL, NOTIFICATION_GROUP_ID_NONE, badgeNumber);
- SysLog(NID_APP, "Badge number is set to %d.", badgeNumber);
- }
-
- if (badgeOffset != 0)
+ else
{
- // badge offset is exclusive to badge number
+ std::unique_ptr<PackageAppInfo> pPackageAppInfo(_PackageManagerImpl::GetInstance()->GetPackageAppInfoN(pAppIdChar.get()));
+ const String& appIconPath(_PackageAppInfoImpl::GetInstance(pPackageAppInfo.get())->GetAppNotificationIconPath());
- int count = 0;
- notification_error_e noti_err = notification_get_badge(NULL, NOTIFICATION_GROUP_ID_NONE, &count);
- if (noti_err == NOTIFICATION_ERROR_NONE)
+ if (!appIconPath.IsEmpty() && File::IsFileExist(appIconPath))
{
- count += badgeOffset;
- if (count > 0)
+ std::unique_ptr<char[]> pIconPathTemp(_StringConverter::CopyToCharArrayN(appIconPath));
+ pIconPath = std::move(pIconPathTemp);
+ }
+ else
+ {
+ char* pDefaultIconPath = null;
+ app_manager_get_app_icon_path(pAppIdChar.get(), &pDefaultIconPath);
+ if (pDefaultIconPath)
{
- notification_set_badge(NULL, NOTIFICATION_GROUP_ID_NONE, count);
- SysLog(NID_APP, "Badge number is set to %d.", count);
+ String iconPath(pDefaultIconPath);
+ std::unique_ptr<char[]> pIconPathTemp(_StringConverter::CopyToCharArrayN(iconPath));
+ pIconPath = std::move(pIconPathTemp);
+ free(pDefaultIconPath);
}
+ SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification Set icon path failed.", GetErrorMessage(r));
}
}
-
-CATCH:
- delete[] pIconPath;
- delete[] pTitleText;
- delete[] pSoundPath;
- if (pkgname)
+ // Sound file path
+ std::unique_ptr<char[]> pSoundPath(null);
+ if (!soundPath.IsEmpty())
{
- free(pkgname);
+ std::unique_ptr<char[]> pSoundPathTemp(_StringConverter::CopyToCharArrayN(soundPath));
+ pSoundPath = std::move(pSoundPathTemp);
}
- if (core)
+ // Set - AppId
+ if (notifyType == NOTIFY_TYPE_APP_ID)
{
- notification_free(core);
+ r = ConvertNotificationResult(notification_set_pkgname(notiHandle, pAppIdChar.get()));
+ SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification Set Package name failed.", GetErrorMessage(r));
}
- service_destroy(svc);
- return r;
-}
-
-result
-_NotificationManagerImpl::NotifyMessageImpl(const AppId& appId, const NotificationRequest& notiMessage, bool isOngoing)
-{
- return __pNotificationManager->NotifyMessage(appId, notiMessage, isOngoing);
-}
-
-
-result
-_NotificationManagerImpl::Notify(int badgeNumber) const
-{
- SysTryReturnResult(NID_APP, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0.");
-
- if (badgeNumber > MAX_NOTIFICATION_BADGE_NUMBER)
+ // Set - title text
+ if (pTitleText.get())
{
- badgeNumber = MAX_NOTIFICATION_BADGE_NUMBER;
+ r = ConvertNotificationResult(notification_set_text(notiHandle, NOTIFICATION_TEXT_TYPE_TITLE, pTitleText.get(), NULL, NOTIFICATION_VARIABLE_TYPE_NONE));
+ SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification Set Title Text failed.", GetErrorMessage(r));
}
-
- String messageText = String(L"");
- String appMessage = String(L"");
-
- return NotifyImpl(messageText, badgeNumber, appMessage, false);
-}
-
-result
-_NotificationManagerImpl::Notify(const String& messageText) const
-{
- SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
-
- String appMessage = String(L"");
-
- return NotifyImpl(messageText, -1, appMessage, false);
-}
-
-result
-_NotificationManagerImpl::Notify(const String& messageText, int badgeNumber) const
-{
- SysTryReturnResult(NID_APP, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0.");
- SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
-
- if (badgeNumber > MAX_NOTIFICATION_BADGE_NUMBER)
+ // Set - content text
+ if (pMsg.get())
{
- badgeNumber = MAX_NOTIFICATION_BADGE_NUMBER;
+ r = notification_set_text(notiHandle, NOTIFICATION_TEXT_TYPE_CONTENT, pMsg.get(), NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification Set Title Text failed.", GetErrorMessage(r));
}
-
- String appMessage = String(L"");
-
- return NotifyImpl(messageText, badgeNumber, appMessage, false);
-}
-
-result
-_NotificationManagerImpl::Notify(const String& messageText, int badgeNumber, const String& launchArguments) const
-{
- SysTryReturnResult(NID_APP, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0.");
- SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
- SysTryReturnResult(NID_APP,
- launchArguments != null && launchArguments.GetLength() > 0, E_INVALID_ARG,
- "launchArguments is less than 0.");
-
- SysTryReturnResult(NID_APP,
- launchArguments.GetLength() <= MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH, E_INVALID_ARG,
- "launchArguments is greater than MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.");
-
- if (badgeNumber > MAX_NOTIFICATION_BADGE_NUMBER)
+ // Set - icon file path
+ r = ConvertNotificationResult(notification_set_image(notiHandle, NOTIFICATION_IMAGE_TYPE_ICON, pIconPath.get()));
+ SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification Set icon path failed.", GetErrorMessage(r));
+ // Set - sound file path
+ r = ConvertNotificationResult(notification_set_sound(notiHandle, NOTIFICATION_SOUND_TYPE_USER_DATA, pSoundPath.get()));
+ SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification Set sound failed.", GetErrorMessage(r));
+
+ // Set extended - text, thumbnail and background image
+ if (!isOngoing)
{
- badgeNumber = MAX_NOTIFICATION_BADGE_NUMBER;
- }
-
- return NotifyImpl(messageText, badgeNumber, launchArguments, false);
-}
-
-int
-_NotificationManagerImpl::GetBadgeNumber(const AppId& appId) const
-{
- bool b = _Aul::IsInstalled(appId);
- SysTryReturn(NID_APP, b == true, -1, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The application %ls is not installed",
- appId.GetPointer());
+ // Extended style set
+ String countText = notifyRequest.GetNotificationCountText();
+ NotificationStyle notiStyle= notifyRequest.GetNotificationStyle();
+ if (notiStyle == NOTIFICATION_STYLE_THUMBNAIL)
+ {
+ layout = NOTIFICATION_LY_NOTI_THUMBNAIL;
+ }
+ else
+ if (notiStyle == NOTIFICATION_STYLE_NORMAL && !countText.IsEmpty())
+ {
+ layout = NOTIFICATION_LY_NOTI_EVENT_MULTIPLE;
+ }
- char buffer[256];
- int count = -1;
+ if (!countText.IsEmpty())
+ {
+ std::unique_ptr<char[]> text(_StringConverter::CopyToCharArrayN(countText));
+ r = ConvertNotificationResult(notification_set_text(notiHandle, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, text.get(),
+ NULL, NOTIFICATION_VARIABLE_TYPE_NONE));
+ }
- memset(buffer, 0, 256);
+ String bgImageFilePath = notifyRequest.GetBackgroundImageFilePath();
+ if (!bgImageFilePath.IsEmpty() && File::IsFileExist(bgImageFilePath))
+ {
+ std::unique_ptr<char[]> pBgImageFilePath(_StringConverter::CopyToCharArrayN(bgImageFilePath));
+ r = ConvertNotificationResult(notification_set_image(notiHandle, NOTIFICATION_IMAGE_TYPE_BACKGROUND, pBgImageFilePath.get()));
+ SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification Set Background image path failed.", GetErrorMessage(r));
+ }
- snprintf(buffer, 256, "%ls", appId.GetPointer());
- notification_get_badge(buffer, NOTIFICATION_GROUP_ID_NONE, &count);
+ if (notiStyle == NOTIFICATION_STYLE_THUMBNAIL)
+ {
+ const IList* pThumbnailList = pRequestImpl->GetMessageThumbnailFilePathList();
+ if (pThumbnailList)
+ {
+ const static notification_image_type_e thumbnailListEnum[] = {NOTIFICATION_IMAGE_TYPE_LIST_1, NOTIFICATION_IMAGE_TYPE_LIST_2,
+ NOTIFICATION_IMAGE_TYPE_LIST_3, NOTIFICATION_IMAGE_TYPE_LIST_4, NOTIFICATION_IMAGE_TYPE_LIST_5 };
+ int itemCount = pThumbnailList->GetCount();
+ const int maxCount = sizeof(thumbnailListEnum)/sizeof(thumbnailListEnum[0]);
+ if (itemCount > maxCount)
+ {
+ itemCount = maxCount;
+ }
+ for (int i = 0; i < itemCount; i++)
+ {
+ const String* pThumbnailPath = static_cast<const String*>(pThumbnailList->GetAt(i));
+ // TODO: check pThumbnailPath
+ std::unique_ptr<char[]> filePath(_StringConverter::CopyToCharArrayN(*pThumbnailPath));
+ r = ConvertNotificationResult(notification_set_image(notiHandle, thumbnailListEnum[i], filePath.get()));
+ SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification Set thumnail path failed.", GetErrorMessage(r));
+ }
+ }
+ }
+ else
+ {
+ // TODO: Check the valid
+ const IList* pMessageTextList = pRequestImpl->GetMessageTextList();
+ if (pMessageTextList && pMessageTextList->GetCount())
+ {
+ const String* pText1 = static_cast<const String*>(pMessageTextList->GetAt(0));
+ if (pText1)
+ {
+ int matchIndex;
+ if (E_SUCCESS == pText1->IndexOf(L'\t', 0, matchIndex))
+ {
+ // Make two token
+ String subText;
+ pText1->SubString(0, matchIndex+1, subText);
+ std::unique_ptr<char[]> leftText(_StringConverter::CopyToCharArrayN(subText));
+ r = ConvertNotificationResult(notification_set_text(notiHandle, NOTIFICATION_TEXT_TYPE_INFO_1, leftText.get(),
+ NULL, NOTIFICATION_VARIABLE_TYPE_NONE));
+ SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification Set Info1 Text failed.", GetErrorMessage(r));
+ subText.Clear();
+ if (E_SUCCESS == pText1->SubString(matchIndex+1, subText))
+ {
+ std::unique_ptr<char[]> rightText(_StringConverter::CopyToCharArrayN(subText));
+ r = ConvertNotificationResult(notification_set_text(notiHandle, NOTIFICATION_TEXT_TYPE_INFO_SUB_1, rightText.get(),
+ NULL, NOTIFICATION_VARIABLE_TYPE_NONE));
+ SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification Set Info1 Sub Text failed.", GetErrorMessage(r));
+ }
+ }
+ else
+ {
+ std::unique_ptr<char[]> leftText(_StringConverter::CopyToCharArrayN(*pText1));
+ r = ConvertNotificationResult(notification_set_text(notiHandle, NOTIFICATION_TEXT_TYPE_INFO_1, leftText.get(),
+ NULL, NOTIFICATION_VARIABLE_TYPE_NONE));
+ SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification Set Info1 Text failed.", GetErrorMessage(r));
+ }
+ }
+ const String* pText2 = static_cast<const String*>(pMessageTextList->GetAt(1));
+ if (pText2)
+ {
+ int matchIndex;
+ // 2.1: Multiple layout has single line text for 2nd information text.
+ if ((layout == NOTIFICATION_LY_NOTI_EVENT_MULTIPLE && E_SUCCESS) == (pText2->IndexOf(L'\t', 0, matchIndex)))
+ {
+ // Make two token
+ String subText;
+ pText2->SubString(0, matchIndex+1, subText);
+ std::unique_ptr<char[]> leftText(_StringConverter::CopyToCharArrayN(subText));
+ r = ConvertNotificationResult(notification_set_text(notiHandle, NOTIFICATION_TEXT_TYPE_INFO_2, leftText.get(),
+ NULL, NOTIFICATION_VARIABLE_TYPE_NONE));
+ SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification Set Info1 Text failed.", GetErrorMessage(r));
+ subText.Clear();
+ if (E_SUCCESS == pText2->SubString(matchIndex+1, subText))
+ {
+ std::unique_ptr<char[]> rightText(_StringConverter::CopyToCharArrayN(subText));
+ r = ConvertNotificationResult(notification_set_text(notiHandle, NOTIFICATION_TEXT_TYPE_INFO_SUB_2, rightText.get(),
+ NULL, NOTIFICATION_VARIABLE_TYPE_NONE));
+ SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification Set Info1 Sub Text failed.", GetErrorMessage(r));
+ }
+ }
+ else
+ {
+ std::unique_ptr<char[]> leftText(_StringConverter::CopyToCharArrayN(*pText2));
+ r = ConvertNotificationResult(notification_set_text(notiHandle, NOTIFICATION_TEXT_TYPE_INFO_2, leftText.get(),
+ NULL, NOTIFICATION_VARIABLE_TYPE_NONE));
+ SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification Set Info1 Text failed.", GetErrorMessage(r));
+ }
+ }
+ }
+ else
+ if (needUpdate)
+ { // Reset text for update case. also must be check the previous text with get_text
+ char* pRetStr = null;
+ notification_get_text(notiHandle, NOTIFICATION_TEXT_TYPE_INFO_1, &pRetStr);
+ if (pRetStr)
+ {
+ const static notification_text_type_e infoTextEnums[] = { NOTIFICATION_TEXT_TYPE_INFO_1, NOTIFICATION_TEXT_TYPE_INFO_SUB_1,
+ NOTIFICATION_TEXT_TYPE_INFO_2, NOTIFICATION_TEXT_TYPE_INFO_SUB_2 };
+ for (unsigned int i = 0; i < sizeof(infoTextEnums)/sizeof(infoTextEnums[0]); i++)
+ {
+ notification_set_text(notiHandle, infoTextEnums[i], null, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ }
+ }
+ }
+ }
+ }
- return count;
-}
+ // Set - service
+ r = arg.Construct(launchArguments);
+ SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Propagated.", GetErrorMessage(r));
+ pBundle = arg.GetBundle();
-result
-_NotificationManagerImpl::NotifyByAppId(const AppId& appId, int badgeNumber) const
-{
- SysTryReturnResult(NID_APP, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0.");
+ service_create_request(pBundle, &hSvc);
+ SysTryCatch(NID_APP, hSvc != null, r = E_SYSTEM, r, "[%s] A system error has been occurred. service_create_request failed.", GetErrorMessage(E_SYSTEM));
- String messageText = String(L"");
- String appMessage = String(L"");
- return NotifyImpl(appId, messageText, badgeNumber, appMessage);
-}
+ if (notifyType == NOTIFY_TYPE_SIMPLE || notifyType == NOTIFY_TYPE_APP_ID)
+ {
+ service_set_app_id(hSvc, pRequestImpl->IsAppBinding() ? pAppIdChar.get() : null);
+ }
+ else
+ if (notifyType == NOTIFY_TYPE_APP_CONTROL)
+ {
-result
-_NotificationManagerImpl::NotifyByAppId(const AppId& appId, const String& messageText) const
-{
- SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
+ std::unique_ptr<char[]> pOperationIdChar(_StringConverter::CopyToCharArrayN(*pOperationId));
+ service_set_operation(hSvc, pOperationIdChar.get());
+ if (pUriData)
+ {
+ std::unique_ptr<char[]> pUri(_StringConverter::CopyToCharArrayN(*pUriData));
+ service_set_uri(hSvc, pUri.get());
+ }
+ if (pDataType)
+ {
+ std::unique_ptr<char[]> pMime(_StringConverter::CopyToCharArrayN(*pDataType));
+ service_set_mime(hSvc, pMime.get());
+ }
+ if (pExtraData)
+ {
+ std::unique_ptr<Tizen::Base::Collection::IMapEnumerator> pMapEnum(pExtraData->GetMapEnumeratorN());
+ if (pMapEnum)
+ {
+ while (pMapEnum->MoveNext() == E_SUCCESS)
+ {
+ String* pKey = static_cast<String* > (pMapEnum->GetKey());
+ String* pValue = static_cast<String* > (pMapEnum->GetValue());
+ if (pKey && pValue)
+ {
+ std::unique_ptr<char[]> pKeyString(_StringConverter::CopyToCharArrayN(*pKey));
+ std::unique_ptr<char[]> pValueString(_StringConverter::CopyToCharArrayN(*pValue));
+ service_add_extra_data(hSvc, pKeyString.get(), pValueString.get());
+ }
+ else
+ {
+ SysLog(NID_APP, "pKey or pValue is ivalid.");
+ }
+ }
+ }
+ }
+ }
- return NotifyImpl(appId, messageText, -1, String(L""));
-}
+ if (service_to_bundle(hSvc, &service_data) == SERVICE_ERROR_NONE)
+ {
+ notification_set_property(notiHandle, 0);
+ notification_set_execute_option(notiHandle, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, service_data);
+ }
+ else
+ {
+ SysLog(NID_APP, "service_to_bundle failed");
+ }
-result
-_NotificationManagerImpl::NotifyByAppId(const AppId& appId, const String& messageText, int badgeNumber) const
-{
- SysTryReturnResult(NID_APP, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0.");
- SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
+ // Set layout
+ if (isOngoing)
+ {
+ OngoingActivityType activityType = notifyRequest.GetOngoingActivityType();
+ if (activityType == ONGOING_ACTIVITY_TYPE_TEXT)
+ {
+ layout = NOTIFICATION_LY_ONGOING_EVENT;
+ }
+ else
+ {
+ layout = NOTIFICATION_LY_ONGOING_PROGRESS;
+ }
+ }
+ notification_set_layout(notiHandle, layout);
- return NotifyImpl(appId, messageText, badgeNumber, String(L""));
-}
+ // For ongoing
+ if (isOngoing)
+ {
+ OngoingActivityType activityType = notifyRequest.GetOngoingActivityType();
+ int progress = notifyRequest.GetOngoingActivityProgress();
-result
-_NotificationManagerImpl::NotifyByAppId(const AppId& appId, const String& messageText, const String& launchArguments) const
-{
- SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
- SysTryReturnResult(NID_APP, launchArguments.GetLength() > 0, E_INVALID_ARG, "launchArguments is less than 0.");
- SysTryReturnResult(NID_APP,
- launchArguments.GetLength() <= MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH, E_INVALID_ARG,
- "launchArguments is greater than MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.");
+ switch (activityType)
+ {
+ case ONGOING_ACTIVITY_TYPE_PROGRESS_PERCENTAGE:
+ if (needUpdate)
+ {
+ r = ConvertNotificationResult(notification_update_progress(notiHandle, notiPrivateId, progress/100.));
+ }
+ else
+ {
+ r = ConvertNotificationResult(notification_set_progress(notiHandle, progress/100.));
+ }
+ SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification update failure.", GetErrorMessage(r));
+ break;
- return NotifyImpl(appId, messageText, -1, launchArguments);
-}
+ case ONGOING_ACTIVITY_TYPE_PROGRESS_BYTE:
+ if (needUpdate)
+ {
+ r = ConvertNotificationResult(notification_update_size(notiHandle, notiPrivateId, progress));
+ }
+ else
+ {
+ r = ConvertNotificationResult(notification_set_size(notiHandle, progress));
+ }
+ SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification update failure.", GetErrorMessage(r));
+ break;
-result
-_NotificationManagerImpl::NotifyByAppId(const AppId& appId, const String& messageText, int badgeNumber,
- const String& launchArguments) const
-{
- SysTryReturnResult(NID_APP, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0.");
- SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
- SysTryReturnResult(NID_APP, launchArguments.GetLength() > 0, E_INVALID_ARG, "launchArguments is less than 0.");
- SysTryReturnResult(NID_APP,
- launchArguments.GetLength() <= MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH, E_INVALID_ARG,
- "launchArguments is greater than MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.");
+ case ONGOING_ACTIVITY_TYPE_TEXT:
+ // Do nothing
+ break;
- return NotifyImpl(appId, messageText, badgeNumber, launchArguments);
-}
+ default:
+ r = E_OPERATION_FAILED;
+ break;
+ }
+ if (needUpdate)
+ {
+ r = ConvertNotificationResult(notification_update_content(notiHandle, notiPrivateId, pMsg.get()));
+ }
+ SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification update failure.", GetErrorMessage(r));
+ }
-result
-_NotificationManagerImpl::NotifyOngoingActivity(const String& messageText) const
-{
- SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
+ // insert for new notification
+ if (!needUpdate)
+ { // new
+ r = ConvertNotificationResult(notification_insert(notiHandle, ¬iPrivateId));
+ SysLog(NID_APP, "Insert notification and get new notiPrivateId(%d)", notiPrivateId);
+ SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r));
+ if (isOngoing)
+ {
+ __notifyPrivitIdForOngoing = notiPrivateId;
+ }
+ else
+ {
+ __notifyPrivitId = notiPrivateId;
+ }
+ }
- return OngoingImpl(messageText, String(L""));
-}
+ // notification_update just for non ongoing and text type ongoing only.
+ if (needUpdate && !isOngoing)
+ {
+ notification_update(notiHandle);
+ SysLog(NID_APP, "Notification update from notiPrivateId(%d)", notiPrivateId);
+ }
-result
-_NotificationManagerImpl::NotifyOngoingActivity(const String& messageText, const String& launchArguments) const
-{
- SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
- SysTryReturnResult(NID_APP, launchArguments.GetLength() > 0, E_INVALID_ARG, "launchArguments is less than 0.");
- SysTryReturnResult(NID_APP,
- launchArguments.GetLength() <= MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH, E_INVALID_ARG,
- "launchArguments is greater than MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.");
- return OngoingImpl(messageText, launchArguments);
+CATCH:
+ service_destroy(hSvc);
+ notification_free(notiHandle);
+ return r;
}
result
-_NotificationManagerImpl::NotifyOngoingActivityByAppId(const AppId& appId, const String& messageText) const
+_NotificationManagerImpl::RemoveNotification(void)
{
- SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
-
- return OngoingImpl(appId, messageText, String(L""));
+ return RemoveNotification(false);
}
result
-_NotificationManagerImpl::NotifyOngoingActivityByAppId(const AppId& appId, const String& messageText,
- const String& launchArguments) const
+_NotificationManagerImpl::RemoveOngoingActivityNotification(void)
{
- SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0.");
- SysTryReturnResult(NID_APP, launchArguments.GetLength() > 0, E_INVALID_ARG, "launchArguments is less than 0.");
- SysTryReturnResult(NID_APP,
- launchArguments.GetLength() <= MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH, E_INVALID_ARG,
- "launchArguments is greater than MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.");
-
- return OngoingImpl(appId, messageText, launchArguments);
+ return RemoveNotification(true);
}
result
-_NotificationManagerImpl::RemoveOngoingActivityNotification(void)
+_NotificationManagerImpl::RemoveNotification(bool onGoing)
{
result r = E_SUCCESS;
+ notification_error_e err = NOTIFICATION_ERROR_NONE;
+ const notification_type_e notiType = onGoing ? NOTIFICATION_TYPE_ONGOING : NOTIFICATION_TYPE_NOTI;
+ const int notiPrivateId = onGoing ? __notifyPrivitIdForOngoing : __notifyPrivitId;
+
+ if (notiPrivateId != -1)
+ {
+ notification_h notiHandle = notification_load(null, notiPrivateId);
+ if (notiHandle)
+ {
+ err = notification_delete(notiHandle);
+ SysLog(NID_APP, "Notification deleted.");
+ }
+ else
+ {
+ SysLog(NID_APP, "Notification already deleted.");
+ }
+ notification_free(notiHandle);
+ }
+ else
+ {
+ err = notification_delete_all_by_type(null, notiType);
+ SysLog(NID_APP, "All [%s] notification deleted.", onGoing ? "Ongoing" : "Normal");
+ }
- notification_error_e err = notification_delete_all_by_type(NULL, NOTIFICATION_TYPE_ONGOING);
switch (err)
{
case NOTIFICATION_ERROR_NONE:
break;
default:
- r = E_OPERATION_FAILED;
+ r = E_SYSTEM;
break;
}
}
result
-_NotificationManagerImpl::RemoveOngoingActivityNotificationByAppId(const AppId& appId)
-{
- return __pNotificationManager->RemoveNotification(appId, true);
-}
-
-result
-_NotificationManagerImpl::RemoveNotification(void)
+_NotificationManagerImpl::RemoveNotificationByAppId(const Tizen::App::AppId& appId, bool onGoing)
{
result r = E_SUCCESS;
+ notification_error_e err = NOTIFICATION_ERROR_NONE;
+ bool isValidAppId = _Aul::IsInstalled(appId);
+ SysTryReturnResult(NID_APP, isValidAppId == true, E_APP_NOT_INSTALLED, "The application %ls is not installed", appId.GetPointer());
+
+ std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId));
+ const notification_type_e notiType = onGoing ? NOTIFICATION_TYPE_ONGOING : NOTIFICATION_TYPE_NOTI;
+ const int notiPrivateId = onGoing ? __notifyPrivitIdForOngoing : __notifyPrivitId;
+
+ if (notiPrivateId != -1)
+ {
+ notification_h notiHandle = notification_load(pAppId.get(), notiPrivateId);
+ if (notiHandle)
+ {
+ err = notification_delete(notiHandle);
+ SysLog(NID_APP, "Notification deleted.");
+ }
+ else
+ {
+ SysLog(NID_APP, "Notification already deleted.");
+ }
+ notification_free(notiHandle);
+ }
+ else
+ {
+ err = notification_delete_all_by_type(pAppId.get(), notiType);
+ SysLog(NID_APP, "All [%s] notification deleted.", onGoing ? "Ongoing" : "Normal");
+ }
- notification_error_e err = notification_delete_all_by_type(NULL, NOTIFICATION_TYPE_NOTI);
switch (err)
{
case NOTIFICATION_ERROR_NONE:
break;
default:
- r = E_OPERATION_FAILED;
+ r = E_SYSTEM;
break;
}
return r;
}
+void
+_NotificationManagerImpl::RemoveBadge(const char* pkgName) const
+{
+ bool badgeExist = false;
+ badge_error_e badgeError = badge_is_existing(pkgName, &badgeExist);
+ SysLog(NID_APP, "badge_is_existing: exitst= %d, error= %d.", badgeExist, badgeError); //#####
+ if (badgeExist)
+ {
+ badgeError = badge_remove(pkgName);
+ SysLog(NID_APP, "badge_remove: error= %d.", badgeError); //#####
+ }
+ SysLog(NID_APP, "Badge removed.");
+}
+
+void
+_NotificationManagerImpl::SetBadgeCount(const char* pkgName, int badgeCount) const
+{
+ bool badgeExist;
+ badge_error_e badgeError = badge_is_existing(pkgName, &badgeExist);
+ SysLog(NID_APP, "badge_is_existing: error= %d.", badgeError); //#####
+ if (!badgeExist)
+ {
+ badgeError = badge_create(pkgName, pkgName);
+ SysLog(NID_APP, "badge_create: error= %d.", badgeError); //#####
+ }
+
+ badge_set_count(pkgName, badgeCount);
+ SysLog(NID_APP, "badge_set_count: badgeNumber= %d.", badgeCount);
+}
+
+int
+_NotificationManagerImpl::GetBadgeCount(const char* pkgName) const
+{
+ unsigned int count = 0;
+
+ badge_error_e badgeError = badge_get_count(pkgName, &count);
+ if (badgeError == BADGE_ERROR_NONE)
+ {
+ SysLog(NID_APP, "badge_get_count: ret= %d.", count);
+ return count;
+ }
+ else
+ {
+ SysLog(NID_APP, "badge_get_count: error= %d.", badgeError);
+ return -1;
+ }
+}
+
result
-_NotificationManagerImpl::RemoveNotificationByAppId(const AppId& appId)
+_NotificationManagerImpl::AddBadgeEventListener(IBadgeEventListener& listener)
{
- return __pNotificationManager->RemoveNotification(appId,false);
+ SysTryReturnResult(NID_APP, !__badgeEventListenerList.Contains(&listener), E_OBJ_ALREADY_EXIST, "The listener is already added.");
+ SysLog(NID_APP, "(%x)", &listener);
+
+ result r = _BadgeManagerImpl::GetInstance()->AddPrimaryBadgeEventListener(*this);
+ SysTryReturnResult(NID_APP, !IsFailed(r), E_SYSTEM, "Failed to AddPrimaryBadgeEventListener with reason (%s)", GetErrorMessage(r) );
+
+ return __badgeEventListenerList.Add(&listener);
+}
+
+result
+_NotificationManagerImpl::RemoveBadgeEventListener(IBadgeEventListener& listener)
+{
+ SysLog(NID_APP, "(%x)", &listener);
+ result r = __badgeEventListenerList.Remove(&listener);
+ SysTryReturn(NID_APP, !IsFailed(r), r, r, "Failed to RemoveBadgeEventListener with reason (%s)", GetErrorMessage(r) );
+
+ return _BadgeManagerImpl::GetInstance()->RemovePrimaryBadgeEventListener(*this);
+}
+
+void
+_NotificationManagerImpl::OnBadgeUpdated(const Tizen::App::AppId& appId, int badgeNumber)
+{
+ std::unique_ptr<IEnumeratorT<Tizen::Shell::IBadgeEventListener* > > pEnum(__badgeEventListenerList.GetEnumeratorN());
+ SysTryReturnVoidResult(NID_APP, pEnum.get(), E_OUT_OF_MEMORY, "Failed to GetEnumeratorN()!");
+
+ IBadgeEventListener* pListener;
+ while (pEnum->MoveNext() == E_SUCCESS)
+ {
+ pListener = null;
+ pEnum->GetCurrent(pListener);
+ if( !pListener)
+ {
+ SysLog(NID_APP, "pListener is null!");
+ continue;
+ }
+ pListener->OnBadgeUpdated(appId, badgeNumber);
+ }
}
-};
-}; // Tizen::Shell
+} } // Tizen::Shell
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 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.
-//
-
-/**
- * @file FShell_NotificationManagerProxy.cpp
- * @brief This is the implementation for the _NotificationManagerProxy.cpp class.
- */
-
-#include <new>
-#include <memory>
-
-#include <FAppTypes.h>
-#include <FBaseErrors.h>
-#include <FBaseSysLog.h>
-#include <FShellNotificationRequest.h>
-
-#include <FIo_IpcClient.h>
-
-#include "FShell_NotificationManagerIpcMessages.h"
-#include "FShell_NotificationManagerEventParamTraits.h"
-#include "FShell_NotificationManagerProxy.h"
-
-using namespace Tizen::Base;
-using namespace Tizen::App;
-
-namespace Tizen { namespace Shell
-{
-
-_NotificationManagerProxy::_NotificationManagerProxy(void)
- : __pIpcClient(null)
-{
-}
-
-_NotificationManagerProxy::~_NotificationManagerProxy(void)
-{
-}
-
-result
-_NotificationManagerProxy::Construct()
-{
- __pIpcClient = new (std::nothrow) Tizen::Io::_IpcClient();
- SysTryReturnResult(NID_APP, __pIpcClient != null, E_OUT_OF_MEMORY, "_IpcClient creation failed.");
-
- result r = __pIpcClient->Construct("osp.app.ipcserver.notificationmanager");
- SysTryReturn(NID_APP, !IsFailed(r), r, r, "_IpcClient constructing failed [%s].", GetErrorMessage(r));
-
- return E_SUCCESS;
-}
-
-result
-_NotificationManagerProxy::NotifyMessage(const AppId& appId, const NotificationRequest& notiMessage, bool Ongoing)
-{
- SysTryReturnResult(NID_APP, __pIpcClient != null, E_INVALID_STATE, "__pIpcClient instance must not be null.");
-
- result response = E_SUCCESS;
- std::auto_ptr<IPC::Message> pMsg (new (std::nothrow) NotificationManager_NotifyMessage(appId, notiMessage, Ongoing, &response));
- result r = __pIpcClient->SendRequest(*pMsg.get());
-
- SysTryReturn(NID_APP, !IsFailed(r), r, r, "__pIpcClient->SendRequest is failed. (%s)", GetErrorMessage(r));
-
- return response;
-}
-
-result
-_NotificationManagerProxy::RemoveNotification(const AppId& appId, bool Ongoing)
-{
- SysTryReturnResult(NID_APP, __pIpcClient != null, E_INVALID_STATE, "__pIpcClient instance must not be null.");
-
- result response = E_SUCCESS;
- std::auto_ptr<IPC::Message> pMsg (new (std::nothrow) NotificationManager_RemoveNotification(appId, Ongoing, &response));
- result r = __pIpcClient->SendRequest(*pMsg.get());
-
- SysTryReturn(NID_APP, !IsFailed(r), r, r, "__pIpcClient->SendRequest is failed. (%s)", GetErrorMessage(r));
-
- return response;
-}
-
-} } // Tizen::Shell
* @brief This is the placeholder for _NotificationRequestImpl class.
*/
+#include <new>
+#include <unique_ptr.h>
#include <FBaseBoolean.h>
#include <FBaseInteger.h>
#include <FBaseSysLog.h>
using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
using namespace Tizen::Io;
namespace Tizen { namespace Shell
{
_NotificationRequestImpl::_NotificationRequestImpl(bool appBinding)
- : __appBinding(true)
+ : __appBinding(appBinding)
, __badgeNumber(-1)
, __badgeOffset(0)
, __progressValue(-1)
, __activityType(ONGOING_ACTIVITY_TYPE_TEXT)
+ , __notificationStyle(NOTIFICATION_STYLE_NORMAL)
+ , __pTextList(null)
+ , __pThumbnailPathList(null)
{
}
, __titleText(notificationMessage.__titleText)
, __iconFilePath(notificationMessage.__iconFilePath)
, __soundFilePath(notificationMessage.__soundFilePath)
+ , __notificationStyle(notificationMessage.__notificationStyle)
+ , __pTextList(notificationMessage.__pTextList)
+ , __pThumbnailPathList(notificationMessage.__pThumbnailPathList)
+ , __notificationCountText(notificationMessage.__notificationCountText)
+ , __backgroundImagePath(notificationMessage.__backgroundImagePath)
{
}
__titleText = notificationMessage.__titleText;
__iconFilePath = notificationMessage.__iconFilePath;
__soundFilePath = notificationMessage.__soundFilePath;
+
+ __notificationStyle = notificationMessage.__notificationStyle;
+ __pTextList = notificationMessage.__pTextList;
+ __pThumbnailPathList = notificationMessage.__pThumbnailPathList;
+ __notificationCountText = notificationMessage.__notificationCountText;
+ __backgroundImagePath = notificationMessage.__backgroundImagePath;
}
return *this;
}
return false;
}
- if (__soundFilePath != __soundFilePath)
+ if (__soundFilePath != pMsgImpl->__soundFilePath)
+ {
+ return false;
+ }
+
+ if (__notificationStyle != pMsgImpl->__notificationStyle)
+ {
+ return false;
+ }
+ if (__pTextList != pMsgImpl->__pTextList)
+ {
+ return false;
+ }
+ if (__pThumbnailPathList != pMsgImpl->__pThumbnailPathList)
+ {
+ return false;
+ }
+ if (__notificationCountText != pMsgImpl->__notificationCountText)
+ {
+ return false;
+ }
+ if (__backgroundImagePath != pMsgImpl->__backgroundImagePath)
{
return false;
}
^ __appMessage.GetHashCode()
^ __titleText.GetHashCode()
^ __iconFilePath.GetHashCode()
- ^ __soundFilePath.GetHashCode();
+ ^ __soundFilePath.GetHashCode()
+ ^ Integer(__notificationStyle).GetHashCode()
+ ^ reinterpret_cast<int>(__pTextList)
+ ^ reinterpret_cast<int>(__pThumbnailPathList)
+ ^ __notificationCountText.GetHashCode()
+ ^ __backgroundImagePath.GetHashCode()
+ ;
}
int
{
result r = E_SUCCESS;
SysTryReturnResult(NID_APP, badgeNumber >= 0 && badgeNumber <= MAX_NOTIFICATION_BADGE_NUMBER, E_INVALID_ARG,
- "BadgeNumber is less than 0 or greater than MAX_NOTIFICATION_BADGE_NUMBER.");
+ "BadgeNumber is less than 0 or greater than MAX_NOTIFICATION_BADGE_NUMBER.");
__badgeOffset = 0;
__badgeNumber = badgeNumber;
{
result r = E_SUCCESS;
SysTryReturnResult(NID_APP, badgeOffset >= 0 && badgeOffset <= MAX_NOTIFICATION_BADGE_NUMBER, E_INVALID_ARG,
- "BadgeOffset is less than 0 or greater than MAX_NOTIFICATION_BADGE_NUMBER.");
+ "BadgeOffset is less than 0 or greater than MAX_NOTIFICATION_BADGE_NUMBER.");
__badgeNumber = -1;
__badgeOffset = badgeOffset;
result
_NotificationRequestImpl::SetAlertText(const String& alertText)
{
- result r = E_SUCCESS;
SysTryReturnResult(NID_APP, alertText.GetLength() > 0 && alertText.GetLength() <= MAX_NOTIFICATION_MESSAGE_LENGTH, E_INVALID_ARG,
- "AlertText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
+ "AlertText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
__alertText = alertText;
- return r;
+ return E_SUCCESS;
}
String
result
_NotificationRequestImpl::SetAppMessage(const String& appMessage)
{
- result r = E_SUCCESS;
SysTryReturnResult(NID_APP, appMessage.GetLength() <= MAX_NOTIFICATION_MESSAGE_LENGTH, E_INVALID_ARG,
- "AppMessage is greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
+ "AppMessage is greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
SysTryReturnResult(NID_APP, __appBinding, E_INVALID_OPERATION,
- "The Notification instance is not bound to Application");
+ "The Notification instance is not bound to Application");
__appMessage = appMessage;
- return r;
+ return E_SUCCESS;
}
String
result
_NotificationRequestImpl::SetTitleText(const String& titleText)
{
- result r = E_SUCCESS;
SysTryReturnResult(NID_APP, titleText.GetLength() <= MAX_NOTIFICATION_MESSAGE_LENGTH, E_INVALID_ARG,
- "TitleText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
+ "TitleText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
__titleText = titleText;
- return r;
+ return E_SUCCESS;
}
String
result
_NotificationRequestImpl::SetIconFilePath(const String& iconFilePath)
{
- result r = E_SUCCESS;
- bool isExist = false;
-
- isExist = File::IsFileExist(iconFilePath);
- SysTryReturnResult(NID_APP, isExist, E_INVALID_ARG,"The Specified File is Invalid");
+ bool isExist = File::IsFileExist(iconFilePath);
+ SysTryReturnResult(NID_APP, isExist, E_INVALID_ARG, "The Specified File is Invalid");
__iconFilePath = iconFilePath;
- return r;
+ return E_SUCCESS;
}
String
result
_NotificationRequestImpl::SetSoundFilePath(const String& soundFilePath)
{
- result r = E_SUCCESS;
- bool isExist = false;
-
- isExist = File::IsFileExist(soundFilePath);
- SysTryReturnResult(NID_APP, isExist, E_INVALID_ARG,"The Specified File is Invalid");
+ bool isExist = File::IsFileExist(soundFilePath);
+ SysTryReturnResult(NID_APP, isExist, E_INVALID_ARG, "The Specified File is Invalid");
__soundFilePath = soundFilePath;
- return r;
+ return E_SUCCESS;
}
OngoingActivityType
result
_NotificationRequestImpl::SetOngoingActivityType(OngoingActivityType activityType)
{
- result r = E_SUCCESS;
-
// to prevent weired gcc optimization for enum type
int type = static_cast<int>(activityType);
{
case ONGOING_ACTIVITY_TYPE_TEXT:
break;
+
case ONGOING_ACTIVITY_TYPE_PROGRESS_PERCENTAGE:
- SysTryReturnResult(NID_APP, __progressValue == -1 || (__progressValue >= 0 && __progressValue <= 100), E_INVALID_STATE, "Incompatible progress value %d.", __progressValue);
+ SysTryReturnResult(NID_APP, __progressValue == -1 || (__progressValue >= 0 && __progressValue <= 100),
+ E_INVALID_OPERATION, "Incompatible progress value %d.", __progressValue);
break;
+
case ONGOING_ACTIVITY_TYPE_PROGRESS_BYTE:
break;
+
default:
- SetLastResult(E_INVALID_STATE);
- SysLogException(NID_APP, E_INVALID_STATE, "Invalid activity type %d.", type);
- return E_INVALID_STATE;
+ SetLastResult(E_INVALID_OPERATION);
+ SysLogException(NID_APP, E_INVALID_OPERATION, "Invalid activity type %d.", type);
+ return E_INVALID_OPERATION;
}
__activityType = activityType;
- return r;
+ return E_SUCCESS;
}
int
result
_NotificationRequestImpl::SetOngoingActivityProgress(int progressValue)
{
- result r = E_SUCCESS;
- SysTryReturnResult(NID_APP, progressValue >= 0, E_INVALID_ARG,"The progress value is less than 0");
+ SysTryReturnResult(NID_APP, progressValue >= 0, E_INVALID_ARG, "The progress value is less than 0");
// use int type instead of OngoingActivityType to evade weired gcc optimization
int activitytype = static_cast<int>(GetOngoingActivityType());
SysTryReturnResult(NID_APP, activitytype >= ONGOING_ACTIVITY_TYPE_TEXT && activitytype <= ONGOING_ACTIVITY_TYPE_PROGRESS_PERCENTAGE,
- E_INVALID_STATE,"Invalid activity Type %d.", activitytype);
+ E_INVALID_OPERATION,"Invalid activity Type %d.", activitytype);
if (activitytype == ONGOING_ACTIVITY_TYPE_PROGRESS_PERCENTAGE)
{
SysTryReturnResult(NID_APP, progressValue <= 100, E_INVALID_ARG,"Invalid Progress value");
}
__progressValue = progressValue;
- return r;
+ return E_SUCCESS;
}
bool
return __appBinding;
}
-};
-}; // Tizen::Shell
+
+NotificationStyle
+_NotificationRequestImpl::GetNotificationStyle(void) const
+{
+ return static_cast<NotificationStyle>(__notificationStyle);
+}
+
+result
+_NotificationRequestImpl::SetNotificationStyle(NotificationStyle style)
+{
+ SysTryReturnResult(NID_APP, NOTIFICATION_STYLE_NORMAL <= style && style <= NOTIFICATION_STYLE_THUMBNAIL,
+ E_INVALID_ARG,"Invalid NotificationStyle %d.", style);
+
+ __notificationStyle = style;
+ return E_SUCCESS;
+}
+
+Tizen::Base::Collection::IList*
+_NotificationRequestImpl::GetMessageTextListN(void) const
+{
+ std::unique_ptr<ArrayList> pStringList(new (std::nothrow) ArrayList);
+ SysTryReturn(NID_APP, pStringList != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
+ GetErrorMessage(E_OUT_OF_MEMORY));
+ pStringList->Construct();
+
+ if (__pTextList)
+ {
+ for (int i=0; i<__pTextList->GetCount(); i++)
+ {
+ std::unique_ptr<String> pString(new String(*static_cast<String*>(__pTextList->GetAt(i))));
+ SysTryReturn(NID_APP, pString != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
+ GetErrorMessage(E_OUT_OF_MEMORY));
+ pStringList->Add(*pString.release());
+ }
+ }
+
+ return pStringList.release();
+}
+
+
+result
+_NotificationRequestImpl::SetMessageTextList(const Tizen::Base::Collection::IList* pTextList)
+{
+ __pTextList = const_cast<IList*>(pTextList);
+ if (__pTextList)
+ {
+ for (int i=0; i<__pTextList->GetCount(); i++)
+ {
+ String* pText = static_cast<String*>(__pTextList->GetAt(i));
+ if (pText)
+ {
+ SysTryReturnResult(NID_APP, pText->GetLength() <= MAX_NOTIFICATION_MESSAGE_LENGTH, E_INVALID_ARG,
+ "Invalid argument is used. MessageText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
+ }
+ }
+ }
+
+ return E_SUCCESS;
+}
+
+
+Tizen::Base::Collection::IList*
+_NotificationRequestImpl::GetMessageThumbnailFilePathListN(void) const
+{
+ std::unique_ptr<ArrayList> pStringList(new (std::nothrow) ArrayList);
+ SysTryReturn(NID_APP, pStringList != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
+ GetErrorMessage(E_OUT_OF_MEMORY));
+ pStringList->Construct();
+
+ if (__pThumbnailPathList)
+ {
+ for (int i=0; i<__pThumbnailPathList->GetCount(); i++)
+ {
+ std::unique_ptr<String> pString(new String(*static_cast<String*>(__pThumbnailPathList->GetAt(i))));
+ SysTryReturn(NID_APP, pString != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
+ GetErrorMessage(E_OUT_OF_MEMORY));
+ pStringList->Add(*pString.release());
+ }
+ }
+
+ return pStringList.release();
+}
+
+
+result
+_NotificationRequestImpl::SetMessageThumbnailFilePathList(const Tizen::Base::Collection::IList* pThumbnailPathList)
+{
+ __pThumbnailPathList = const_cast<IList*>(pThumbnailPathList);
+ if (__pThumbnailPathList)
+ {
+ for (int i=0; i<__pThumbnailPathList->GetCount(); i++)
+ {
+ String* pFilePath = static_cast<String*>(__pThumbnailPathList->GetAt(i));
+ if (pFilePath)
+ {
+ bool isExist = File::IsFileExist(*pFilePath);
+ SysTryReturnResult(NID_APP, isExist, E_INVALID_ARG,"Invalid argument is used. The Specified File path is Invalid.");
+ }
+ }
+ }
+
+ return E_SUCCESS;
+}
+
+
+Tizen::Base::String
+_NotificationRequestImpl::GetNotificationCountText(void) const
+{
+ return __notificationCountText;
+}
+
+
+result
+_NotificationRequestImpl::SetNotificationCountText(const Tizen::Base::String& notificationCountText)
+{
+ SysTryReturnResult(NID_APP, notificationCountText.GetLength() <= MAX_NOTIFICATION_MESSAGE_LENGTH, E_INVALID_ARG,
+ "Invalid argument is used. CountText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
+ __notificationCountText = notificationCountText;
+ return E_SUCCESS;
+}
+
+
+Tizen::Base::String
+_NotificationRequestImpl::GetBackgroundImageFilePath(void) const
+{
+ return __backgroundImagePath;
+}
+
+
+result
+_NotificationRequestImpl::SetBackgroundImageFilePath(const Tizen::Base::String& imagePath)
+{
+ bool fileExist = File::IsFileExist(imagePath);
+ SysTryReturnResult(NID_APP, fileExist, E_INVALID_ARG,
+ "Invalid argument is used. The Specified File is Invalid. %ls", imagePath.GetPointer());
+ __backgroundImagePath = imagePath;
+ return E_SUCCESS;
+}
+
+const Tizen::Base::Collection::IList*
+_NotificationRequestImpl::GetMessageTextList() const
+{
+ return __pTextList;
+}
+
+const Tizen::Base::Collection::IList*
+_NotificationRequestImpl::GetMessageThumbnailFilePathList() const
+{
+ return __pThumbnailPathList;
+}
+
+_NotificationRequestImpl*
+_NotificationRequestImpl::GetInstance(NotificationRequest& request)
+{
+ return request.__pNotificationRequestImpl;
+}
+
+const _NotificationRequestImpl*
+_NotificationRequestImpl::GetInstance(const NotificationRequest& request)
+{
+ return request.__pNotificationRequestImpl;
+}
+
+} } // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2013 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.
+//
+
+/**
+ * @file FShell_ShortcutManagerImpl.cpp
+ * @brief This is the implementation for the _ShortcutManagerImpl class.
+ */
+
+#include <unique_ptr.h>
+
+#include <shortcut.h>
+
+#include <FBaseSysLog.h>
+#include <FBase.h>
+#include <FApp.h>
+#include "FShell_ShortcutManagerImpl.h"
+
+namespace Tizen { namespace Shell
+{
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::App;
+
+request_cb_t __pLiveboxRequestHandlerCallback = null;
+
+_ShortcutManagerImpl::_ShortcutManagerImpl()
+{
+}
+
+_ShortcutManagerImpl::~_ShortcutManagerImpl()
+{
+}
+
+
+_ShortcutManagerImpl*
+_ShortcutManagerImpl::GetInstance()
+{
+ static _ShortcutManagerImpl* __pShortcutManagerImpl = null;
+ if( __pShortcutManagerImpl == null)
+ {
+ __pShortcutManagerImpl = new (std::nothrow)_ShortcutManagerImpl;
+ SysTryReturn(NID_APP, __pShortcutManagerImpl, null, E_OUT_OF_MEMORY, "Allocating new _LiveboxManagerProxy failed.");
+
+ result r = __pShortcutManagerImpl->Construct();
+ SysTryReturn(NID_APP, !IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ return __pShortcutManagerImpl;
+}
+
+int ShortcutRequestEventHandlerCB(const char* appId, const char* text, int type, const char* content_info, const char* icon, int pid, double period, void *data)
+{
+ SysTryReturn(NID_APP, appId, 0, E_SYSTEM, "[E_SYSTEM] appId is null!");
+ SysLog(NID_APP, "Tizen::Shell::ShortcutManager - Shortcut request received.");
+
+ _ShortcutManagerImpl* pShortcutManager = static_cast<_ShortcutManagerImpl*>(data);
+ SysTryReturn(NID_APP, pShortcutManager, 0, E_SYSTEM, "[E_SYSTEM] pShortcutManager is null!");
+
+ const ArrayListT<IShortcutRequestListener*>* pListenerList = pShortcutManager->GetShortcutRequestListenerList();
+ IShortcutRequestListener* pListener;
+
+ SysLog(NID_APP, "There is(are) %d request handler(s).", pListenerList->GetCount());
+ for(int i = 0; i < pListenerList->GetCount(); i ++)
+ {
+ pListener = null;
+ pListenerList->GetAt(i, pListener);
+ if( pListener != null)
+ {
+ pListener->OnShortcutAddRequested(appId, text, icon, content_info);
+ }
+ }
+
+ SysLog(NID_APP, "Successed.");
+ return 0;
+}
+
+// c - style callback for shortcut_set_request_cb
+int ShortcutRequestEventReceiverCB(const char* appId, const char* text, int type, const char* content_info, const char* icon, int pid, double period, void *data)
+{
+ SysTryReturn(NID_APP, appId, 0, E_SYSTEM, "[E_SYSTEM] providerId is null!");
+
+ if( type == SHORTCUT_PACKAGE
+ || type == SHORTCUT_DATA
+ || type == SHORTCUT_DATA)
+ {
+ ShortcutRequestEventHandlerCB(appId, text, type, content_info, icon, pid, period, data);
+ }
+ else
+ {
+ if( __pLiveboxRequestHandlerCallback != null)
+ {
+ SysLog(NID_APP, "Invoking livebox request handler.");
+ __pLiveboxRequestHandlerCallback(appId, text, type, content_info, icon, pid, period, data);
+ }
+ }
+
+ SysLog(NID_APP, "Successed.");
+ return 0;
+}
+
+result
+_ShortcutManagerImpl::Construct()
+{
+ int ret = shortcut_set_request_cb(ShortcutRequestEventReceiverCB, this );
+ SysTryReturnResult(NID_APP, ret == 0, E_SYSTEM, "failed to shortcut_set_request_cb (%d)", ret);
+
+ __shortcutRequestListenerList.Construct();
+ SysLog(NID_APP, "Successed.");
+
+ return E_SUCCESS;
+}
+
+
+result
+_ShortcutManagerImpl::AddShortcutRequestListener(IShortcutRequestListener& listener)
+{
+ SysTryReturnResult(NID_APP, !__shortcutRequestListenerList.Contains(&listener), E_OBJ_ALREADY_EXIST, "The listener is already added.");
+ SysLog(NID_APP, "(%x)", &listener);
+ return __shortcutRequestListenerList.Add(&listener);
+}
+
+result
+_ShortcutManagerImpl::RemoveShortcutRequestListener(IShortcutRequestListener& listener)
+{
+ SysLog(NID_APP, "(%x)", &listener);
+ return __shortcutRequestListenerList.Remove(&listener);
+}
+
+const Tizen::Base::Collection::ArrayListT<IShortcutRequestListener*>*
+_ShortcutManagerImpl::GetShortcutRequestListenerList(void) const
+{
+ return &__shortcutRequestListenerList;
+}
+
+void
+_ShortcutManagerImpl::SetLiveboxRequestHandlerCallback(request_cb_t pLiveboxRequestHandlerFn)
+{
+ __pLiveboxRequestHandlerCallback = pLiveboxRequestHandlerFn;
+}
+
+
+}} // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShell_ILiveboxTouchEventListener.h
+ * @brief This is the header file for the _ILiveboxTouchEventListener interface.
+ *
+ * This header file contains the declarations of the _ILiveboxTouchEventListener interface.
+ */
+
+#ifndef _FSHELL_ILIVEBOX_TOUCH_EVENT_LISTENER_H_
+#define _FSHELL_ILIVEBOX_TOUCH_EVENT_LISTENER_H_
+
+#include <FBaseRtIEventListener.h>
+
+namespace Tizen { namespace Shell
+{
+
+class _ILiveboxTouchEventListener
+: public Tizen::Base::Runtime::IEventListener
+{
+public:
+ virtual ~_ILiveboxTouchEventListener() {};
+
+ virtual int OnTouchEventRecevied(int eventType, double timestamp, double x, double y) = 0;
+};
+
+}} // Tizen::Shell
+
+#endif /* _FSHELL_ILIVEBOX_TOUCH_EVENT_LISTENER_H_ */
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShell_LiveboxManagerImpl.h
+ * @brief This is the header file for the _LiveboxManagerImpl class.
+ *
+ * This header file contains the declarations of the _LiveboxManagerImpl class.
+ */
+
+#ifndef _FSHELL_INTERNAL_LIVEBOX_MANAGERIMPL_H_
+#define _FSHELL_INTERNAL_LIVEBOX_MANAGERIMPL_H_
+
+#include <unique_ptr.h>
+#include <FBaseObject.h>
+#include <FBaseColHashMapT.h>
+#include <FBaseColIListT.h>
+#include <FAppTypes.h>
+#include <FAppIAppControlProviderEventListener.h>
+#include <FShellLiveboxManager.h>
+
+
+namespace Tizen { namespace Shell {
+
+class LiveboxProviderInfo;
+
+class _OSP_EXPORT_ _LiveboxManagerImpl
+ : public Tizen::Base::Object
+{
+public:
+ static _LiveboxManagerImpl* GetInstance();
+
+ // API impl
+ Tizen::Base::Collection::IList* GetLiveboxProviderInfoListN();
+ LiveboxProviderInfo* GetLiveboxProviderInfoN(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName);
+ LiveboxProviderInfo* GetDefaultLiveboxProviderInfoN(const Tizen::App::PackageId& packageId);
+ result SetLiveboxAddRequestListener(ILiveboxAddRequestListener* pListener);
+
+ // internal
+ ILiveboxAddRequestListener* GetAddRequestListener();
+ static bool IsLiveboxProviderDefault(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName);// temp
+
+ // helper
+ static result ExtractAppIdAndProviderName(const Tizen::Base::String& providerId, Tizen::App::AppId& appId, Tizen::Base::String& providerName);
+ static Tizen::Base::String MakeProviderName(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName);
+
+private:
+ _LiveboxManagerImpl();
+ virtual ~_LiveboxManagerImpl();
+ result Construct();
+
+private:
+ ILiveboxAddRequestListener* __pLiveboxRequestEventListener;
+
+};
+
+}} // Tizen::Shell
+#endif /* _FSHELL_INTERNAL_LIVEBOX_MANAGERIMPL_H_ */
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShell_LiveboxManagerIpcMessage.h
+ * @brief This is the header file for the LiveboxManagerService Ipc message types.
+ */
+
+#include <FAppTypes.h>
+#include <FSystem.h>
+
+#include "ipc/ipc_message_macros.h"
+#include "FIo_IpcCommonParamTraits.h"
+#include "FIo_IpcMessageStart.h"
+
+
+#define IPC_MESSAGE_START LiveboxManagerServiceStart
+
+// Message to service
+IPC_SYNC_MESSAGE_CONTROL3_1(LiveboxManager_RequestUpdate, Tizen::Base::String, Tizen::Base::String, Tizen::Base::String, result)
+IPC_SYNC_MESSAGE_CONTROL2_1(LiveboxManager_RequestUpdateInstance, Tizen::Base::String, Tizen::Base::String, result)
+
+IPC_SYNC_MESSAGE_CONTROL3_1(LiveboxManager_RequestSharedMemoryId, Tizen::Base::String, int, int, int)
+IPC_SYNC_MESSAGE_CONTROL3_1(LiveboxManager_RequestSharedMemoryIdForPD, Tizen::Base::String, int, int, int)
+IPC_SYNC_MESSAGE_CONTROL3_1(LiveboxManager_RequestSyncSharedMemory, Tizen::Base::String, int, int, result)
+IPC_SYNC_MESSAGE_CONTROL1_1(LiveboxManager_RequestSyncSharedMemoryForPD, Tizen::Base::String, result)
+IPC_SYNC_MESSAGE_CONTROL1_1(LiveboxManager_RequestReleaseSharedMemory, Tizen::Base::String, result)
+IPC_SYNC_MESSAGE_CONTROL1_1(LiveboxManager_RequestReleaseSharedMemoryForPD, Tizen::Base::String, result)
+
+// Message from service
+IPC_MESSAGE_CONTROL5(LiveboxManager_SendTouchEvent, Tizen::Base::String, int, double, double, double)
+IPC_MESSAGE_CONTROL5(LiveboxManager_SendTouchEventForPD, Tizen::Base::String, int, double, double, double)
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file FShell_LiveboxManagerProxy.h
+ * @brief This is the header file for the _LiveboxManagerProxy class.
+ *
+ * This header file contains the declarations of the _LiveboxManagerProxy class.
+ */
+
+#ifndef _FSHELL_LIVEBOXMANAGERPROXY_H_
+#define _FSHELL_LIVEBOXMANAGERPROXY_H_
+
+#include <FBaseObject.h>
+#include <FIo_IIpcClientEventListener.h>
+#include <FIo_IpcClient.h>
+
+namespace Tizen { namespace Shell {
+
+class _LiveboxManagerProxy
+ : public Tizen::Io::_IIpcClientEventListener
+ , public Tizen::Base::Object
+{
+public:
+ _LiveboxManagerProxy();
+ virtual ~_LiveboxManagerProxy();
+
+ static _LiveboxManagerProxy* GetInstance();
+ result Construct(void);
+
+ result RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument);
+ result RequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument);
+
+ result RequestSharedMemoryId(const Tizen::Base::String& instanceId, int w, int h, int& shmId);
+ result RequestSharedMemoryIdForPD(const Tizen::Base::String& instanceId, int w, int h, int& shmId);
+ result RequestSyncSharedMemory(const Tizen::Base::String& instanceId, int width, int height);
+ result RequestSyncSharedMemoryForPD(const Tizen::Base::String& instanceId);
+ result RequestReleaseSharedMemory(const Tizen::Base::String& instanceId);
+ result RequestReleaseSharedMemoryForPD(const Tizen::Base::String& instanceId);
+
+ result OnTouchEventReceived(const Tizen::Base::String& instanceId, int eventType, double timeStamp, double x, double y );
+ result OnTouchEventReceivedForPD(const Tizen::Base::String& instanceId, int eventType, double timeStamp, double x, double y );
+
+private:
+ virtual void OnIpcResponseReceived(Tizen::Io::_IpcClient& client, const IPC::Message& message);
+
+private:
+ Tizen::Io::_IpcClient* __pIpcClient;
+};
+
+}} // Tizen::Shell
+
+#endif /* _FSHELL_LIVEBOXMANAGERPROXY_H_ */
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShell_LiveboxPopupProviderImpl.h
+ * @brief This is the header file for the _LiveboxPopupProviderImpl class.
+ *
+ * This header file contains the declarations of the %_LiveboxPopupProviderImpl class.
+ */
+
+#ifndef _FSHELL_INTERNAL_LIVEBOX_POPUP_PROVIDER_IMPL_H_
+#define _FSHELL_INTERNAL_LIVEBOX_POPUP_PROVIDER_IMPL_H_
+
+#include <FBaseObject.h>
+#include <FBaseString.h>
+
+namespace Tizen { namespace Shell
+{
+
+class LiveboxPopup;
+
+class _OSP_EXPORT_ _LiveboxPopupProviderImpl
+: public Tizen::Base::Object
+{
+public:
+ _LiveboxPopupProviderImpl(const Tizen::Base::String& instanceId, double x, double y);
+ virtual ~_LiveboxPopupProviderImpl();
+
+ const Tizen::Base::String& GetInstanceId() const;
+ result SetLiveboxPopup(Tizen::Shell::LiveboxPopup* pLiveboxPopup);
+ Tizen::Shell::LiveboxPopup* GetLiveboxPopup() const;
+ result RequestUpdateToLivebox();
+
+private:
+ _LiveboxPopupProviderImpl();
+ _LiveboxPopupProviderImpl(const _LiveboxPopupProviderImpl& rhs);
+ _LiveboxPopupProviderImpl& operator =(const _LiveboxPopupProviderImpl& rhs);
+
+private:
+ Tizen::Base::String __instanceId;
+ LiveboxPopup* __pLiveboxPopup;
+ double __x;
+ double __y;
+ int __width;
+ int __height;
+};
+
+} /* namespace Livebox */
+}
+#endif /* _FSHELL_INTERNAL_LIVEBOX_POPUP_PROVIDER_IMPL_H_ */
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShell_LiveboxProviderImpl.h
+ * @brief This is the header file for the _LiveboxProviderImpl class.
+ *
+ * This header file contains the declarations of the _LiveboxProviderImpl class.
+ */
+
+#ifndef _FSHELL_LIVEBOXPROVIDER_IMPL_H_
+#define _FSHELL_LIVEBOXPROVIDER_IMPL_H_
+
+#include <FBaseObject.h>
+#include <FBaseString.h>
+
+namespace Tizen { namespace Shell
+{
+
+class LiveboxFrame;
+
+class _LiveboxProviderImpl
+ : public Tizen::Base::Object
+{
+public:
+ _LiveboxProviderImpl(const Tizen::Base::String& instanceId);
+ virtual ~_LiveboxProviderImpl();
+
+ const Tizen::Base::String& GetInstanceId() const;
+ result SetLiveboxFrame(LiveboxFrame* pLiveboxFrame);
+ LiveboxFrame* GetLiveboxFrame() const;
+
+private:
+ Tizen::Base::String __instanceId;
+ LiveboxFrame* __pLiveboxFrame;
+};
+
+}} // Tizen::Shell
+
+#endif /* _FSHELL_LIVEBOXPROVIDER_IMPL_H_ */
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShell_LiveboxProviderInfoImpl.h
+ * @brief This is the header file for the _LiveboxInfoImpl class.
+ *
+ * This header file contains the declarations of the _LiveboxInfoImpl class.
+ */
+
+#ifndef _FSHELL_INTERNAL_LIVEBOX_PROVIDER_INFO_IMPL_H_
+#define _FSHELL_INTERNAL_LIVEBOX_PROVIDER_INFO_IMPL_H_
+
+#include <FBaseCol.h>
+#include <FAppTypes.h>
+#include <FGrpDimension.h>
+
+namespace Tizen { namespace Shell {
+
+class _OSP_EXPORT_ _LiveboxProviderInfoImpl
+ : public Tizen::Base::Object
+{
+public:
+
+ /**
+ * This is the constructor that initializes an instance of %LiveboxProviderInfo with the specified values.
+ *
+ * @since 2.1
+ */
+ _LiveboxProviderInfoImpl(const Tizen::App::AppId& appId, const Tizen::Base::String& name);
+
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.1
+ */
+ virtual ~_LiveboxProviderInfoImpl();
+
+ /**
+ * Gets the application ID.
+ *
+ * @since 2.1
+ *
+ * @return The application ID
+ */
+ Tizen::App::AppId GetAppId() const;
+
+ /**
+ * Gets the Livebox provider name
+ *
+ * @since 2.1
+ *
+ * @return The application ID
+ */
+ Tizen::Base::String GetName() const;
+
+ /**
+ * Gets the display name of the Livbox @n
+ * If the system language setting is changed, this method returns the localized application name.
+ * The display name is displayed in applications that showing Livebox like Launcher, and so on.
+ *
+ * @since 2.1
+ *
+ * @return The display name of the Livbox
+ */
+ Tizen::Base::String GetDisplayName() const;
+
+ /**
+ * Gets the icon path of the application.
+ *
+ * @since 2.1
+ *
+ * @return The icon path of the application, @n
+ * An empty string is returned if there is no value.
+ */
+ Tizen::Base::String GetIconPath() const;
+
+ Tizen::Base::String GetConfigurationAppControlAppId() const;
+
+ bool IsDefault() const;
+
+ /**
+ * Gets a list of LiveboxSizeInfo of the Livebox
+ *
+ * @since 2.1
+ *
+ * @return A pointer to the array list that contains all LiveboxSizeInfo of the LiveboxProvider@n
+ * else @c null if an error occurs
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_SYSTEM A system error has occurred.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ Tizen::Base::Collection::IList* GetSizeInfoListN() const;
+
+
+ // internal
+ static LiveboxProviderInfo* GetLiveboxProviderInfoN(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName);
+ static LiveboxProviderInfo* GetLiveboxProviderInfoN(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, bool isDefault);
+
+ static _LiveboxProviderInfoImpl* GetImpl(const LiveboxProviderInfo& liveboxProviderInfo);
+
+private:
+ /**
+ * This is the default constructor for this class.
+ *
+ * @since 2.1
+ */
+ _LiveboxProviderInfoImpl();
+
+ /**
+ * This is the copy constructor for the %LiveboxProviderInfo class.
+ *
+ * @since 2.1
+ *
+ * @param[in] value An instance of %LiveboxProviderInfo
+ */
+ _LiveboxProviderInfoImpl(const _LiveboxProviderInfoImpl& rhs);
+
+ /**
+ * Assigns the value of the specified instance of %LiveboxProviderInfo to the current instance of %LiveboxProviderInfo.
+ *
+ * @since 2.1
+ *
+ * @param[in] rhs An instance of %LiveboxProviderInfo
+ */
+ _LiveboxProviderInfoImpl& operator =(const _LiveboxProviderInfoImpl& rhs);
+
+private:
+ Tizen::Base::String __appId;
+ Tizen::Base::String __name;
+ bool __isDefault;
+ Tizen::Base::String __providerId;
+ Tizen::Base::String __displayName; //TODO:temporary public
+ Tizen::Base::String __configurationAppControlAppId; //TODO:temporary public
+
+// Tizen::Base::String __iconPath;
+ Tizen::Base::Collection::ArrayList __sizeInfos;
+
+ friend class LiveboxProviderInfo;
+// friend class _LiveboxManagerImpl;
+};
+
+}} // Tizen::Shell
+#endif // _FSHELL_INTERNAL_LIVEBOX_PROVIDER_INFO_IMPL_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShell_LiveboxManagerImpl.h
+ * @brief This is the header file for the _LiveboxProviderManagerImpl class.
+ *
+ * This header file contains the declarations of the _LiveboxProviderManagerImpl class.
+ */
+
+#ifndef FShell_LIVEBOX_PROVIDER_MANAGERIMPL_H_
+#define FShell_LIVEBOX_PROVIDER_MANAGERIMPL_H_
+
+#include <unique_ptr.h>
+#include <FBaseObject.h>
+#include <FBaseColHashMapT.h>
+#include <FBaseColIMap.h>
+#include <FAppTypes.h>
+#include <FAppIAppControlProviderEventListener.h>
+
+
+namespace Tizen { namespace Shell {
+
+class LiveboxFrame;
+class LiveboxPopup;
+
+class ILiveboxProviderFactory;
+class ILiveboxPopupProviderFactory;
+class LiveboxProvider;
+class LiveboxPopupProvider;
+class _ILiveboxTouchEventListener;
+class _LiveboxManagerProxy;
+
+
+class _OSP_EXPORT_ _LiveboxProviderManagerImpl
+ : public Tizen::App::IAppControlProviderEventListener
+ , public Tizen::Base::Object
+{
+public:
+ static _LiveboxProviderManagerImpl* GetInstance();
+
+ // public APIs
+ result SetLiveboxProviderFactory(ILiveboxProviderFactory& factory);
+ result SetLiveboxPopupProviderFactory(ILiveboxPopupProviderFactory& factory);
+ result RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument);
+ result AddLivebox(const Tizen::App::AppId& providerAppId, const Tizen::Base::String& providerName, const Tizen::Base::String& text, const Tizen::Base::String& userInfo);
+
+ // internal APIs
+ result RequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument = L"");
+
+ result RequestSharedMemoryId(const Tizen::Base::String& instanceId, int width, int height, int& shmId);
+ result RequestSharedMemoryIdForPD(const Tizen::Base::String& instanceId, int width, int height, int& shmId);
+ result RequestSyncSharedMemory(const Tizen::Base::String& instanceId, int width, int height);
+ result RequestSyncSharedMemoryForPD(const Tizen::Base::String& instanceId);
+ result RequestReleaseSharedMemory(const Tizen::Base::String& instanceId);
+ result RequestReleaseSharedMemoryForPD(const Tizen::Base::String& instanceId);
+
+ // internal
+ result SetLiveboxTouchEventListener(const Tizen::Base::String& instanceId, _ILiveboxTouchEventListener& listener);
+ result SetLiveboxPopupEventListener(_ILiveboxTouchEventListener& listener);
+
+ result ForwardTouchEvent(const Tizen::Base::String& instanceId, int eventType, double timeStamp, double x, double y);
+ result ForwardTouchEventForPD(const Tizen::Base::String& instanceId, int eventType, double timeStamp, double x, double y);
+
+ // helper
+// static result ExtractAppIdAndProviderName(const Tizen::Base::String& providerId, Tizen::App::AppId& appId, Tizen::Base::String& providerName);
+ result ValidateApplicationAttributeForLivebox(void);
+
+ void TerminateAppIfInvalidState();
+
+private:
+ _LiveboxProviderManagerImpl();
+ virtual ~_LiveboxProviderManagerImpl();
+ result Construct();
+
+ result CreateLivebox(const Tizen::Base::String& name, const Tizen::Base::String& instanceId, int width, int height, const Tizen::Base::String& userInfo);
+ result UpdateLivebox(const Tizen::Base::String& instanceId, int width, int height, const Tizen::Base::String& argument);
+ result ResizeLivebox(const Tizen::Base::String& instanceId, int width, int height);
+ result RemoveLivebox(const Tizen::Base::String& instanceId, bool terminateIfFinished);
+ result CreateLiveboxPopupProvider(const Tizen::Base::String& instanceId, const Tizen::Base::String& providerName, const Tizen::Base::String& userInfo, double x, double y, int width, int height);
+ result DestroyLiveboxPopupProvider(const Tizen::Base::String& instanceId);
+
+ bool ContainsLivebox(const Tizen::Base::String& instanceId) const;
+
+ virtual void OnAppControlRequestReceived(RequestId reqId, const Tizen::Base::String& operationId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pMimeType, const Tizen::Base::Collection::IMap* pExtraData);
+
+ result HandleLiveboxRequest(const Tizen::Base::String& operationId, const Tizen::Base::Collection::IMap* pArgs);
+ result HandleLiveboxPopupRequest(const Tizen::Base::String& operationId, const Tizen::Base::Collection::IMap* pArgs);
+
+private:
+ // for Livebox
+ ILiveboxProviderFactory* __pLiveboxFactory;
+ Tizen::Base::Collection::HashMapT<Tizen::Base::String, LiveboxProvider*> __liveboxProviders;
+ Tizen::Base::Collection::HashMapT<Tizen::Base::String, _ILiveboxTouchEventListener*> __touchEventListeners;
+
+ // for LiveboxPopup
+ ILiveboxPopupProviderFactory* __pLiveboxPopupProviderFactory;
+ LiveboxPopupProvider* __pLiveboxPopupProvider;
+ _ILiveboxTouchEventListener* __LiveboxPopupTouchEventListener;
+
+// bool __messageReceived;
+};
+
+}} // Tizen::Shell
+#endif /* FShell_LIVEBOX_PROVIDER_MANAGERIMPL_H_ */
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShell_LiveboxSizeInfoImpl.h
+ * @brief This is the header file for the %_LiveboxSizeInfoImpl class.
+ *
+ * This header file contains the declarations of the %_LiveboxSizeInfoImpl class.
+ */
+
+#ifndef _FSHELL_LIVEBOX_SIZE_INFO_IMPL_H_
+#define _FSHELL_LIVEBOX_SIZE_INFO_IMPL_H_
+
+#include <FBaseString.h>
+#include <FBaseCol.h>
+#include <FGrpFloatDimension.h>
+#include <FAppTypes.h>
+
+namespace Tizen { namespace Shell
+{
+
+class LiveboxSizeInfo;
+/**
+ * @class _LiveboxSizeInfoImpl
+ * @brief This class contains size and preview image path for the size
+ *
+ * @since 2.1
+ */
+class _OSP_EXPORT_ _LiveboxSizeInfoImpl
+ : public Tizen::Base::Object
+{
+public:
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.1
+ */
+ virtual ~_LiveboxSizeInfoImpl();
+
+ /**
+ * This is the copy constructor for the %LiveboxSizeInfo class.
+ *
+ * @since 2.1
+ *
+ * @param[in] rhs An instance of %LiveboxSizeInfo
+ */
+ _LiveboxSizeInfoImpl(const _LiveboxSizeInfoImpl& rhs);
+
+ /**
+ * Assigns the value of the specified instance of %LiveboxSizeInfo to the current instance of %LiveboxSizeInfo.
+ *
+ * @since 2.1
+ *
+ * @param[in] rhs An instance of %LiveboxSizeInfo
+ */
+ _LiveboxSizeInfoImpl& operator =(const _LiveboxSizeInfoImpl& rhs);
+
+ /**
+ * Gets the size
+ *
+ * @since 2.1
+ *
+ * @return A size
+ */
+ Tizen::Graphics::FloatDimension GetSize() const;
+
+ /**
+ * Gets the image path for preview
+ *
+ * @since 2.1
+ *
+ * @return The image path for preview
+ */
+ Tizen::Base::String GetPreviewImagePath() const;
+
+ static LiveboxSizeInfo* CreateLiveboxSizeInfo(Tizen::Graphics::FloatDimension size, const Tizen::Base::String& previewImagePath);
+
+private:
+ /**
+ * This is the default constructor for this class.
+ *
+ * @since 2.1
+ */
+ _LiveboxSizeInfoImpl();
+
+ /**
+ * This is the constructor that initializes an instance of %_LiveboxSizeInfoImpl with the specified values.
+ *
+ * @since 2.1
+ */
+ _LiveboxSizeInfoImpl(Tizen::Graphics::FloatDimension size, const Tizen::Base::String& previewImagePath);
+
+private:
+ Tizen::Graphics::FloatDimension __size;
+ Tizen::Base::String __previewImagePath;
+
+friend class LiveboxSizeInfo;
+};
+
+}} // Tizen::Shell
+#endif /* _FSHELL_LIVEBOX_SIZE_INFO_IMPL_H_ */
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2013 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.
+//
+
+/**
+ * @file FShell_LockManagerImpl.h
+ * @brief This is the header file for the _LockManagerImpl class.
+ *
+ * This header file contains the declarations of the %_LockManagerImpl class.
+ */
+
+#ifndef _FSHELL_INTERNAL_LOCK_MANAGER_IMPL_H_
+#define _FSHELL_INTERNAL_LOCK_MANAGER_IMPL_H_
+
+#include <FBaseObject.h>
+
+namespace Tizen { namespace Shell {
+
+/**
+ * @class _LockManagerImpl
+ * @brief Manages state of lock screen.
+ *
+ * @since 2.1
+ *
+ * @final This class is not intended for extension.
+ *
+ * The %_LockManagerImpl class manages information of lock screen.
+ */
+class _OSP_EXPORT_ _LockManagerImpl
+ : public Tizen::Base::Object
+{
+public:
+ /**
+ * Gets the %_LockManagerImpl instance.
+ *
+ * @since 2.1
+ *
+ * @return A pointer to the %_LockManagerImpl instance, @n
+ * else @c null if it fails
+ *
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_MEMORY The memory is insufficient.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ static _LockManagerImpl* GetInstance(void);
+
+ /**
+ * Checks whether the screen is locked.
+ *
+ * @since 2.1
+ *
+ * @return @c true if the screen is locked,
+ * else @c false
+ */
+ bool IsLocked(void) const;
+
+ /**
+ * Checks whether password lock screen is enabled by Settings.
+ *
+ * @since 2.1
+ *
+ * @return @c true if password lock screen is enabled,
+ * else @c false
+ */
+ bool IsSecureMode(void) const;
+
+ /**
+ * Unlocks current lock screen.
+
+ * @privlevel partner
+ * @privilege http://tizen.org/privilege/lockmanager
+ *
+ * @since 2.1
+ *
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_INVALID_OPERATION Can't unlock, because secure mode is enabled.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ *
+ * @remark This API call has no effect while secure mode is enabled.
+ */
+ result Unlock(void);
+
+private:
+ //
+ // This default constructor is intentionally declared as private to implement the %Singleton semantic.
+ //
+ // @since 2.1
+ //
+ _LockManagerImpl(void);
+
+ //
+ // This destructor is intentionally declared as private to implement the %Singleton semantic.
+ //
+ // @since 2.1
+ //
+ virtual ~_LockManagerImpl(void);
+
+ //
+ // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @since 2.1
+ //
+ _LockManagerImpl(const _LockManagerImpl& rhs);
+
+ //
+ // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @since 2.1
+ //
+ _LockManagerImpl& operator =(const _LockManagerImpl& rhs);
+
+ //
+ // Constructs the instance of this class.
+ //
+ // @since 2.1
+ //
+ // @return An error code
+ // @exception E_SUCCESS The method is successful.
+ // @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ //
+ result Construct(void);
+};
+
+}} // Tizen::Shell
+
+#endif /* _FSHELL_INTERNAL_LOCK_MANAGER_IMPL_H_ */
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 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.
-//
-
-/**
- * @file FShell_NotificationManagerEventParamTraits.h
- * @brief This is the header file for NotificationManagerEvent param traits.
- */
-
-#ifndef _FSHELL_INTERNAL_NOTIFICATION_MANAGER_EVENT_ARG_PARAM_TRAITS_H_
-#define _FSHELL_INTERNAL_NOTIFICATION_MANAGER_EVENT_ARG_PARAM_TRAITS_H_
-
-#include "FBaseString.h"
-#include "FBaseColIList.h"
-#include "FBaseColArrayList.h"
-#include "FIo_IpcCommonDataTypes.h"
-
-#include "base/tuple.h"
-#include "ipc/ipc_param_traits.h"
-
-#include "FShellNotificationRequest.h"
-
-
-namespace IPC
-{
-template <>
-struct ParamTraits<Tizen::Shell::NotificationRequest>
-{
- typedef Tizen::Shell::NotificationRequest param_type;
-
- static void Write(Message* m, const param_type& p)
- {
- WriteParam(m, p.GetAlertText());
- WriteParam(m, p.GetAppMessage());
- WriteParam(m, p.GetTitleText());
- WriteParam(m, p.GetIconFilePath());
- WriteParam(m, p.GetSoundFilePath());
-
- m->WriteInt(p.GetBadgeNumber());
- m->WriteInt(p.GetBadgeOffset());
- m->WriteInt((Tizen::Shell::OngoingActivityType)p.GetOngoingActivityType());
- m->WriteInt(p.GetOngoingActivityProgress());
- }
-
- static bool Read(const Message* m, void** iter, param_type* r)
- {
- Tizen::Base::String alertText;
- Tizen::Base::String appMessage;
- Tizen::Base::String titleText;
- Tizen::Base::String iconFilePath;
- Tizen::Base::String soundFilePath;
-
- int badgeNo = -1;
- int badgeOffset = 0;
- int activityType = Tizen::Shell::ONGOING_ACTIVITY_TYPE_TEXT;
- int progressValue = -1;
-
-
- if (!ReadParam(m, iter, &alertText))
- {
- return false;
- }
- if (!ReadParam(m, iter, &appMessage))
- {
- return false;
- }
- if (!ReadParam(m, iter, &titleText))
- {
- return false;
- }
- if (!ReadParam(m, iter, &iconFilePath))
- {
- return false;
- }
- if (!ReadParam(m, iter, &soundFilePath))
- {
- return false;
- }
- m->ReadInt(iter, &badgeNo);
- m->ReadInt(iter, &badgeOffset);
- m->ReadInt(iter, &activityType);
- m->ReadInt(iter, &progressValue);
-
-
- Tizen::Shell::NotificationRequest notimessage;
- notimessage.SetAlertText(alertText);
- notimessage.SetAppMessage(appMessage);
- notimessage.SetTitleText(titleText);
- notimessage.SetIconFilePath(iconFilePath);
- notimessage.SetSoundFilePath(soundFilePath);
-
- notimessage.SetBadgeNumber(badgeNo);
- notimessage.SetBadgeOffset(badgeOffset);
- notimessage.SetOngoingActivityType((Tizen::Shell::OngoingActivityType)activityType);
- notimessage.SetOngoingActivityProgress(progressValue);
-
-
- *r = notimessage;
-
- return true;
- }
- static void Log(const param_type& p, std::string* l)
- {
- }
-
-};
-}
-
-#endif //_FSHELL_INTERNAL_NOTIFICATION_MANAGER_EVENT_ARG_PARAM_TRAITS_H_
#ifndef _FSHELL_INTERNAL_NOTIFICATION_MANAGER_IMPL_H_
#define _FSHELL_INTERNAL_NOTIFICATION_MANAGER_IMPL_H_
-#include <FBaseObject.h>
#include <FOspConfig.h>
+#include <FBaseObject.h>
namespace Tizen { namespace Shell
{
class NotificationManager;
-class _NotificationManagerProxy;
+
+enum _NotifyType
+{
+ NOTIFY_TYPE_SIMPLE, // Simple(Self)
+ NOTIFY_TYPE_APP_ID, // Specific AppId
+ NOTIFY_TYPE_APP_CONTROL // AppControl
+};
class _OSP_EXPORT_ _NotificationManagerImpl
: public Tizen::Base::Object
+ , virtual public Tizen::Shell::IBadgeEventListener
{
public:
/**
* This is the default constructor for this class.
- *
- * @since 1.0
*/
_NotificationManagerImpl(void);
/**
* This is the destructor for this class.
- *
- * @since 1.0
*/
virtual ~_NotificationManagerImpl(void);
/**
* Initializes this instance of %_NotificationManagerImpl.
*
- * @since 1.0
* @return An error code
* @exception E_SUCCESS The method is successful.
* @exception E_SYSTEM A system error has occurred.
- * @exception E_OUT_OF_MEMORY The memory is insufficient.
*/
result Construct(void);
/**
* Gets the badge number of the application icon.
*
- * @since 1.0
- *
* @return The current badge number
* @exception E_SUCCESS The method is successful.
* @exception E_SYSTEM A system error has occurred.
/**
* Notifies the user using a badge number.
*
- * @since 1.0
- *
* @return An error code
* @param[in] badgeNumber The badge number
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_STATE This instance is in an invalid state. @n
* The Construct() method is not called.
*/
- result Notify(int badgeNumber) const;
+ result Notify(int badgeNumber);
/**
* Notifies the user using a message.
*
- * @since 1.0
- *
* @return An error code
* @param[in] messageText The notification message
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_STATE This instance is in an invalid state. @n
* The Construct() method is not called.
*/
- result Notify(const Tizen::Base::String& messageText) const;
+ result Notify(const Tizen::Base::String& messageText);
/**
* Notifies the user using a message and badge number.
*
- * @since 1.0
- *
* @return An error code
* @param[in] messageText The notification message
* @param[in] badgeNumber The badge number
* @exception E_INVALID_STATE This instance is in an invalid state. @n
* The Construct() method is not called.
*/
- result Notify(const Tizen::Base::String& messageText, int badgeNumber) const;
+ result Notify(const Tizen::Base::String& messageText, int badgeNumber);
/**
* Notifies the user using a message and badge number. @n
* @c launchArguments is specified as input parameter for Application::OnUserEventReceivedN() or can be obtained by
* invoking Application::GetAppArgumentListN(), especially within Application::OnAppInitializing().
*
- * @since 1.0
- *
* @return An error code
* @param[in] messageText The notification message
* @param[in] badgeNumber The badge number
* The Construct() method is not called.
* @see Application::OnUserEventReceivedN(), Application::GetAppArgumentListN()
*/
- result Notify(const Tizen::Base::String& messageText, int badgeNumber, const Tizen::Base::String& launchArguments) const;
+ result Notify(const Tizen::Base::String& messageText, int badgeNumber, const Tizen::Base::String& launchArguments);
/**
* Notifies the user using a message. @n
* The message may have various information like alert text, title text, launch arguments, and so on.
*
- * @since 2.1
- *
* @return An error code
* @param[in] message The notification message
* @param[in] isOngoing Ongoing Notification
* Notifies the user using a message. @n
* The message may have various information like alert text, title text, launch arguments, and so on.
*
- * @since 2.1
- *
* @return An error code
* @param[in] appId The Application ID
* @param[in] message The notification message
/**
* Removes the notification message.
*
- * @since 2.0
- *
* @return An error code
* @exception E_SUCCESS The method was successful.
* @exception E_SYSTEM A system error occurred.
/**
* Notifies the user about the ongoing activity using a message.
*
- * @since 2.0
- *
* @return An error code
* @param[in] messageText The notification message
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_STATE This instance is in an invalid state. @n
* The Construct() method is not called.
*/
- result NotifyOngoingActivity(const Tizen::Base::String& messageText) const;
+ result NotifyOngoingActivity(const Tizen::Base::String& messageText);
/**
* Notifies the user about the ongoing activity using a message. @n
* @c launchArguments is specified as input parameter for Application::OnUserEventReceivedN() or can be obtained by
* invoking Application::GetAppArgumentListN(), especially within Application::OnAppInitializing().
*
- * @since 2.0
- *
* @return An error code
* @param[in] messageText The notification message
* @param[in] launchArguments The launch arguments for the application
* The Construct() method is not called.
* @see Application::OnUserEventReceivedN(), Application::GetAppArgumentListN()
*/
- result NotifyOngoingActivity(const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments) const;
+ result NotifyOngoingActivity(const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments);
/**
* Removes the notification message for the ongoing activity.
*
- * @since 2.0
- *
* @return An error code
* @exception E_SUCCESS The method is successful.
* @exception E_SYSTEM A system error has occurred.
/**
* Gets the badge number of the application icon.
*
- * @since 1.0
- *
* @return The current badge number
* @param[in] appId The application ID
* @exception E_SUCCESS The method is successful.
/**
* Notifies the user using a badge number on behalf of the specified application.
*
- * @since 1.0
- *
* @return An error code
* @param[in] appId The application ID
* @param[in] badgeNumber The badge number
/**
* Notifies the user using a message on behalf of the specified application.
*
- * @since 1.0
- *
* @return An error code
* @param[in] appId The application ID
* @param[in] messageText The notification message
/**
* Notifies the user using a message and badge number on behalf of the specified application.
*
- * @since 1.0
- *
* @return An error code
* @param[in] appId The application ID
* @param[in] messageText The notification message
* Notifies the user using a message and badge number on behalf of the specified application. @n
* If the user checks the message, the @c launchArguments is delivered to the application.
*
- * @since 2.0
- *
* @return An error code
* @param[in] appId The application ID
* @param[in] messageText The notification message
* Notifies the user using a message and badge number on behalf of the specified application. @n
* If the user checks the message, the @c launchArguments is delivered to the application.
*
- * @since 2.0
- *
* @return An error code
* @param[in] appId The application ID
* @param[in] messageText The notification message
/**
* Notifies the user about the ongoing activity using a message on behalf of the specified application.
*
- * @since 2.0
- *
* @return An error code
* @param[in] appId The application ID
* @param[in] messageText The notification message
/**
* Notifies the user about the ongoing activity using a message on behalf of the specified application.
*
- * @since 2.0
- *
* @return An error code
* @param[in] appId The application ID
* @param[in] messageText The notification message
/**
* Removes the notification message for ongoing activity on behalf of the specified application.
*
- * @since 2.0
- *
* @return An error code
* @param[in] appId The application ID
* @exception E_SUCCESS The method is successful.
/**
* Removes the notification message on behalf of the specified application.
*
- * @since 2.0
- *
* @return An error code
* @param[in] appId The application ID
* @exception E_SUCCESS The method was successful.
*/
result RemoveNotificationByAppId(const Tizen::App::AppId& appId);
- static const _NotificationManagerImpl* GetInstance(const NotificationManager& notiMgr);
+ /**
+ * Notifies the user using a message.
+ *
+ * @return An error code
+ * @param[in] messageText The notification message
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified input parameter is invalid, or
+ * the length of @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH.
+ * @exception E_SYSTEM A system error has occurred.
+ * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the Tizen platform policy.
+ * @exception E_INVALID_STATE This instance is in an invalid state. @n
+ * The Construct() method is not called.
+ */
+ result NotifyTextMessage(const Tizen::Base::String& messageText) const;
- static _NotificationManagerImpl* GetInstance(NotificationManager& notiMgr);
+ result NotifyByAppControl(const Tizen::Base::String& operationId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pDataType,
+ const Tizen::Base::Collection::IMap* pExtraData, const NotificationRequest& request);
-private:
- result NotifyImpl(const Tizen::Base::String& messageText, int badgeNumber, const Tizen::Base::String& launchArguments, bool isOngoing = false) const;
+ result NotifyOngoingActivityByAppControl(const Tizen::Base::String& operationId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pDataType,
+ const Tizen::Base::Collection::IMap* pExtraData, const NotificationRequest& request);
- result NotifyImpl(const Tizen::App::AppId& appId, const Tizen::Base::String& messageText, int badgeNumber, const Tizen::Base::String& launchArguments, bool isOngoing = false) const;
+ /**
+ * Adds an IBadgeEventListener event listener to the NotificationManager @n
+ * The listener gets notified when a badge number is updated. @n
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @param[in] listener The listener to be added.
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_ALREADY_EXIST The listener is already added.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ *
+ * @see NotificationManager::Notify()
+ * @remarks Internally Platform does not have the ownership of this pointer, So caller should manage the listener object properly.
+ */
+ result AddBadgeEventListener(IBadgeEventListener& listener);
- inline result OngoingImpl(const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments) const;
+ /**
+ * Removes an IBadgeEventListener event listener from the NotificationManager @n
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @param[in] listener The listener to be removed.
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_NOT_FOUND The listner is not found.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ *
+ * @remarks Internally Platform does not have the ownership of this pointer, So caller should manage the listener object properly.
+ */
+ result RemoveBadgeEventListener(IBadgeEventListener& listener);
- inline result OngoingImpl(const Tizen::App::AppId& appId, const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments) const;
+ virtual void OnBadgeUpdated(const Tizen::App::AppId& appId, int badgeNumber);
+
+ static const _NotificationManagerImpl* GetInstance(const NotificationManager& notiMgr);
+
+ static _NotificationManagerImpl* GetInstance(NotificationManager& notiMgr);
- _NotificationManagerImpl(const _NotificationManagerImpl& rhs);
+private:
+ result NotifyMessage(_NotifyType notifyType, bool isOngoing, const NotificationRequest& notifyRequest, const Tizen::App::AppId* pAppId = null,
+ const Tizen::Base::String* pOperationId = null, const Tizen::Base::String* pUriData = null, const Tizen::Base::String* pDataType = null, const Tizen::Base::Collection::IMap* pExtraData = null);
+ result RemoveNotification(bool onGoing);
+ result RemoveNotificationByAppId(const Tizen::App::AppId& appId, bool onGoing);
+ //result NotifyImpl(const Tizen::Base::String& messageText, int badgeNumber, const Tizen::Base::String& launchArguments, bool isOngoing = false) const;
+ //result NotifyImpl(const Tizen::App::AppId& appId, const Tizen::Base::String& messageText, int badgeNumber, const Tizen::Base::String& launchArguments, bool isOngoing = false) const;
+ //inline result OngoingImpl(const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments) const;
+ //inline result OngoingImpl(const Tizen::App::AppId& appId, const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments) const;
+ _NotificationManagerImpl(const _NotificationManagerImpl& rhs);
_NotificationManagerImpl& operator =(const _NotificationManagerImpl& rhs);
+ void RemoveBadge(const char* pkgName) const;
+ void SetBadgeCount(const char* pkgName, int badgeCount) const;
+ int GetBadgeCount(const char* pkgName) const;
+
private:
- _NotificationManagerProxy* __pNotificationManager;
+ int __notifyPrivitId;
+ int __notifyPrivitIdForOngoing;
+ Tizen::Base::Collection::LinkedListT<IBadgeEventListener*> __badgeEventListenerList;
}; //_NotificationManagerImpl
+
+class _BadgeManagerImpl
+ : public Tizen::Base::Object
+{
+public:
+ static _BadgeManagerImpl* GetInstance(void);
+ result Construct(void);
+ result AddPrimaryBadgeEventListener(IBadgeEventListener& item);
+ result RemovePrimaryBadgeEventListener(IBadgeEventListener& item);
+
+private:
+ Tizen::Base::Collection::LinkedListT<Tizen::Shell::IBadgeEventListener*> __primaryBadgeEventListenerList;// Each NotificaitonManager is a IBadgeEventListener, and has it's own IBadgeEventListener list again.
+
+};
+
} } // Tizen::Shell
#endif // _FSHELL_INTERNAL_NOTIFICATION_MANAGER_IMPL_H_
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 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.
-//
-
-/**
- * @file FShell_NotificationManagerIpcMessages.h
- * @brief This is the header file for the NotificationManager Ipc message types.
- */
-
-#include <FAppTypes.h>
-#include <FShellNotificationRequest.h>
-
-#include "ipc/ipc_message_macros.h"
-#include "FIo_IpcCommonParamTraits.h"
-#include "FIo_IpcMessageStart.h"
-#include "FShell_NotificationManagerEventParamTraits.h"
-
-#define IPC_MESSAGE_START NotificationManagerServiceStart
-
-IPC_SYNC_MESSAGE_CONTROL3_1(NotificationManager_NotifyMessage, Tizen::App::AppId, Tizen::Shell::NotificationRequest, bool, result)
-IPC_SYNC_MESSAGE_CONTROL2_1(NotificationManager_RemoveNotification, Tizen::App::AppId, bool, result)
-
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 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.
-//
-
-/**
- * @file FShell_NotificationManagerProxy.h
- * @brief This is the header file of the _NotificationManagerProxy class.
- */
-
-#ifndef _FSHELL_INTERNAL_NOTIFICATION_MANAGER_PROXY_H_
-#define _FSHELL_INTERNAL_NOTIFICATION_MANAGER_PROXY_H_
-
-#include <FBaseObject.h>
-#include <FBaseString.h>
-#include <FAppTypes.h>
-
-namespace Tizen { namespace Io { class _IpcClient; } }
-
-namespace Tizen { namespace Shell
-{
-
-class NotificationRequest;
-
-/**
- * @class _NotificationManagerProxy
- * @brief
- * @since 2.1
- */
-class _NotificationManagerProxy
- : public Tizen::Base::Object
-{
-public:
- _NotificationManagerProxy(void);
- virtual ~_NotificationManagerProxy(void);
-
- result Construct(void);
-
- result NotifyMessage(const Tizen::App::AppId& appId, const NotificationRequest& message, bool Ongoing);
- result RemoveNotification(const Tizen::App::AppId& appId, bool Ongoing);
-
-
-private:
- _NotificationManagerProxy(const _NotificationManagerProxy& rhs);
-
- _NotificationManagerProxy& operator =(const _NotificationManagerProxy& rhs);
-
-private:
- Tizen::Io::_IpcClient* __pIpcClient;
-
-}; // _NotificationManagerProxy
-
-} } // Tizen::Shell
-
-#endif // _FSHELL_INTERNAL_NOTIFICATION_MANAGER_PROXY_H_
*/
bool IsAppBinding() const;
+ /**
+ * Gets the style of a notification message.
+ *
+ * @since 2.1
+ *
+ * @return The notification style
+ */
+ NotificationStyle GetNotificationStyle(void) const;
+
+ /**
+ * Sets the style of a notification message.
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @param[in] style The notification style
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified @c style is not valid.
+ */
+ result SetNotificationStyle(NotificationStyle style);
+
+ /**
+ * Gets a list of message text for a notification message.
+ *
+ * @since 2.1
+ *
+ * @return A string list of detail information text
+ */
+ Tizen::Base::Collection::IList* GetMessageTextListN(void) const;
+
+ /**
+ * Sets a string list of message text for a notification message.
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @param[in] pTextList A list of detail information text
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified @c textList is empty or the length of individual text is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH.
+ * @remarks This information is only meaningful when the notification style is Shell::NOTIFICATION_STYLE_NORMAL. @n
+ * Use the tab(\\t) character to separate the columns.
+ *
+ */
+ result SetMessageTextList(const Tizen::Base::Collection::IList* pTextList);
+
+ /**
+ * Gets a list of the message thumbnail image absolute file path for a notification message.
+ *
+ * @since 2.1
+ *
+ * @return A string list of thumbnail image file path
+ */
+ Tizen::Base::Collection::IList* GetMessageThumbnailFilePathListN(void) const;
+
+ /**
+ * Sets a string list of the message image absolute file path for a notification message.
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @param[in] pImagePathList A list of the thumbnail image file path
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified path is invalid.
+ * @remarks This information is only meaningful when then notification style is Shell::NOTIFICATION_STYLE_THUMBNAIL.
+ */
+ result SetMessageThumbnailFilePathList(const Tizen::Base::Collection::IList* pThumbnailPathList);
+
+ /**
+ * Gets the notification count of a notification message.
+ *
+ * @since 2.1
+ *
+ * @return The notification count text
+ */
+ Tizen::Base::String GetNotificationCountText(void) const;
+
+ /**
+ * Sets the notification count of a notification message.
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @param[in] notificationCount The event count text
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified @c eventCountText is empty or the length of @c eventCountText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH.
+ */
+ result SetNotificationCountText(const Tizen::Base::String& notificationCountText);
+
+ /**
+ * Gets the absolute file path of the background image for a notification message.
+ *
+ * @since 2.1
+ *
+ * @return The file path of a background image file
+ */
+ Tizen::Base::String GetBackgroundImageFilePath(void) const;
+
+ /**
+ * Sets the absolute file path of the background image for a notification message.
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @param[in] imagePath The file path of the background image
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified path is invalid.
+ */
+ result SetBackgroundImageFilePath(const Tizen::Base::String& imagePath);
+
+
+ /*
+ * Get internal pointer of TextList for internal reference
+ */
+ const Tizen::Base::Collection::IList* GetMessageTextList() const;
+
+ /*
+ * Get internal pointer of ThumbnailPathList for internal reference
+ */
+ const Tizen::Base::Collection::IList* GetMessageThumbnailFilePathList() const;
+
+ //
+ // Gets the implementation.
+ //
+ // @return The implementation
+ // @param[in] The interface instance pointer
+ // @since 2.1
+ //
+ static _NotificationRequestImpl* GetInstance(NotificationRequest& request);
+
+ //
+ // Gets the implementation.
+ //
+ // @return The implementation
+ // @param[in] The interface instance pointer
+ // @since 2.1
+ //
+ static const _NotificationRequestImpl* GetInstance(const NotificationRequest& request);
+
private:
bool __appBinding;
int __badgeNumber;
Tizen::Base::String __titleText;
Tizen::Base::String __iconFilePath;
Tizen::Base::String __soundFilePath;
+ // 2.1
+ int __notificationStyle;
+ Tizen::Base::Collection::IList* __pTextList;
+ Tizen::Base::Collection::IList* __pThumbnailPathList;
+ Tizen::Base::String __notificationCountText;
+ Tizen::Base::String __backgroundImagePath;
}; //_NotificationRequestImpl
// http://floralicense.org/license/
//
// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
+// 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.
#ifndef _FSHELL_INTERNAL_QUICKPANEL_FRAME_H_
#define _FSHELL_INTERNAL_QUICKPANEL_FRAME_H_
-#include "FUi_Window.h"
+#include <Evas.h>
+
+#include "FUi_Window.h"
+#include "FUi_UiEventTypes.h"
namespace Tizen { namespace Graphics {
class Dimension;
static _QuickPanelFrame* CreateQuickPanelFrameN(void);
virtual ~_QuickPanelFrame(void);
- result Initialize(int height);
- result SetHeight(int height);
-
-#if !defined(MULTI_WINDOW)
- Tizen::Ui::Animations::_RootVisualElement* GetRootVisualElement(void) const;
-#endif
+ result Initialize(float height);
+ result SetHeight(float height);
-#if defined(MULTI_WINDOW)
virtual result CreateLayer(void);
-#endif
protected:
_QuickPanelFrame(void);
_QuickPanelFrame(const _QuickPanelFrame& rhs);
_QuickPanelFrame& operator =(const _QuickPanelFrame& rhs);
-#if !defined(MULTI_WINDOW)
- result SetLayerShowState(bool showState);
- result SetLayerBounds(const Tizen::Graphics::Rectangle& bounds);
-
- virtual void OnActivated(void);
- virtual void OnDeactivated(void);
- virtual void OnBoundsChanged(void);
- virtual void OnVisibleStateChanged(void);
-
-#endif
virtual void OnDraw(void);
private:
_QuickPanelFramePresenter* __pQuickPanelFramePresenter;
-#if !defined(MULTI_WINDOW)
- _QuickPanelFrameLayer* __pQuickPanelFrameLayer;
- Tizen::Ui::Animations::_RootVisualElement* __pQuickPanelFrameRootVisualElement;
-
-#endif
Tizen::Ui::_IUiEventManager* __pEventManager;
+ _QuickPanelFrameLayer* __pLayer;
+ Evas_Object* pminicontrol;
}; // _QuickPanelFrame
}}// Tizen::Shell
// http://floralicense.org/license/
//
// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
+// 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.
virtual const _QuickPanelFrame& GetCore(void) const;
virtual _QuickPanelFrame& GetCore(void);
- result Initialize(int height);
+ result Initialize(float height);
+
result AddOrientationEventListener(Tizen::Ui::IOrientationEventListener& listener);
result RemoveOrientationEventListener(Tizen::Ui::IOrientationEventListener& listener);
- result SetHeight(int height);
-#if !defined(MULTI_WINDOW)
- void Rotate(Tizen::Ui::_ControlRotation rotation);
-#else
+ result SetHeight(float height);
+
virtual void OnRotated(Tizen::Ui::_ControlRotation rotation);
-#endif
protected:
_QuickPanelFrameImpl(QuickPanelFrame* pPublic, _QuickPanelFrame* pCore, const Tizen::Ui::Layout* pPortraitLayout, const Tizen::Ui::Layout* pLandscapeLayout);
// http://floralicense.org/license/
//
// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
+// 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.
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2013 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.
+//
+
+/**
+ * @file FShell_ShortcutManagerImpl.h
+ * @brief This is the header file for the _ShortcutManagerImpl class.
+ *
+ * This header file contains the declarations of the _ShortcutManagerImpl class.
+ */
+
+#ifndef _FSHELL_INTERNAL_SHORTCUT_MANAGERIMPL_H_
+#define _FSHELL_INTERNAL_SHORTCUT_MANAGERIMPL_H_
+
+#include <unique_ptr.h>
+#include <FBaseColArrayListT.h>
+#include <FShellIShortcutRequestListener.h>
+
+namespace Tizen { namespace Shell {
+
+
+class _OSP_EXPORT_ _ShortcutManagerImpl
+ : public Tizen::Base::Object
+{
+public:
+ static _ShortcutManagerImpl* GetInstance(void);
+
+ /**
+ * Request the Home app to add the spefied shortcut.
+ *
+ * @privlevel public
+ * @privilege http::tizen.org/privilege/shortcut
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @param[in] appId The application ID
+ * @param[in] displayName The display name of shortcut
+ * @param[in] iconPath The icon file path
+ * @param[in] uriData Uri that will be delivered by IAppControlProviderEventListener::OnAppControlRequestReceived(), when the application is started via shortcut.
+ * @param[in] allowDuplication Flag to allow duplicate shortcut.
+ *
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_APP_NOT_INSTALLED The application is not installed.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ *
+ * @remark Icon file should be placed in sub directory of 'shared/res' to be used by the Home app.
+ * For more information on shared directory, see <a href="../org.tizen.native.appprogramming/html/basics_tizen_programming/io_overview.htm">I/O Overview</a>.
+ * For more information on icon file, see <a href="../org.tizen.native.appprogramming/html/app_dev_process/manifest_general.htm">General Information</a>.
+ *
+ * If uriData is specified, application will be started by AppControl with http://tizen.org/appcontrol/operation/view operation, when it's launched from the Home app via shortcut.
+ * Or else application will be started by AppControl with default operation(http://tizen.org/appcontrol/operation/main).
+ *
+ * @see IAppControlEventListener::OnAppControlRequestReceived()
+ * @see IShortcutRequestListener::OnShortcutAddRequested()
+ *
+ * The following example demonstrates how to add shortcut.
+ *
+ * @code
+ * #include <FApp.h>
+ * #include <FShell.h>
+ *
+ * using namespace Tizen::App;
+ * using namespace Tizen::Shell;
+ *
+ * String appId = App::GetInstance()->GetAppId();
+ * String iconPath = AppManager::GetInstance()->GetAppSharedPath(appId) + L"res/my_icons/my_icon.png";
+ * ShortcutManager::GetInstance()->AddShortcut(appId, L"MyApp", iconPath , L"myapp://mydata/myitem");
+ * @endcode
+ */
+ result AddShortcut(const Tizen::App::AppId& appId, const Tizen::Base::String& displayName, const Tizen::Base::String& iconPath, const Tizen::Base::String& uriData, bool allowDuplication = true );
+
+ /**
+ * Requests the Home app to remove the specified shortcut.
+ *
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/shortcut
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @param[in] appId The application ID
+ * @param[in] displayName The display name of shortcut
+ *
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_APP_NOT_INSTALLED The application is not installed.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ *
+ * @remark If there are one more shortcuts with duplicated appId and displayName in the Home app, All of them will be removed.
+ *
+ * @see IShortcutRequestListener::OnShortcutRemoveRequested()
+ */
+ result RemoveShortcut(const Tizen::App::AppId& appId, const Tizen::Base::String& displayName);
+
+ result AddShortcutRequestListener(IShortcutRequestListener& listener);
+ result RemoveShortcutRequestListener(IShortcutRequestListener& listener);
+
+ // internal
+ void SetLiveboxRequestHandlerCallback(int(*PShortcutRequestCallback)(const char *appid, const char *name, int type, const char *content_info, const char *icon, int pid, double period, void *data));
+ const Tizen::Base::Collection::ArrayListT<IShortcutRequestListener*>* GetShortcutRequestListenerList(void) const;
+
+private:
+ _ShortcutManagerImpl(void);
+ virtual ~_ShortcutManagerImpl(void);
+ result Construct(void);
+
+private:
+ Tizen::Base::Collection::ArrayListT<IShortcutRequestListener*> __shortcutRequestListenerList;
+};
+
+}} // Tizen::Shell
+#endif /* _FSHELL_INTERNAL_SHORTCUT_MANAGERIMPL_H_ */
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 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.
+//
+
+/**
+ * @file FShell_TemplateUtil.h
+ * @brief This is the header file for the internap Tizen::Shell utilities.
+ *
+ * This header file contains the declarations of the %AppManager class.
+ */
+
+#ifndef FSHELL_INTERNAL_STRINGKEY_TEMPLATE_UTIL_H_
+#define FSHELL_INTERNAL_STRINGKEY_TEMPLATE_UTIL_H_
+
+
+#include <FBaseString.h>
+#include <FBaseColICollectionT.h>
+#include <FBaseColIEnumeratorT.h>
+
+namespace Tizen { namespace Shell
+{
+
+template<class Type> void
+_DeleteCollection(Tizen::Base::Collection::ICollectionT<Type*>& col)
+{
+ Tizen::Base::Collection::IEnumeratorT<Type*>* pEnum = col.GetEnumeratorN();
+
+ if (pEnum)
+ {
+ while (pEnum->MoveNext() == E_SUCCESS)
+ {
+ Type* pElem = null;
+ pEnum->GetCurrent(pElem);
+
+ delete pElem;
+ }
+
+ delete pEnum;
+ }
+}
+
+template<class KeyType, class ValueType> void
+_DeleteCollectionMapValue(Tizen::Base::Collection::IMapT<KeyType, ValueType*>& col)
+{
+ Tizen::Base::Collection::IMapEnumeratorT<KeyType, ValueType*>* pEnum = col.GetMapEnumeratorN();
+
+ if (pEnum)
+ {
+ while (pEnum->MoveNext() == E_SUCCESS)
+ {
+ ValueType* pValue = null;
+ pEnum->GetValue(pValue);
+
+ delete pValue;
+ }
+
+ delete pEnum;
+ }
+}
+
+template<class KeyType, class ValueType> void
+_DeleteCollectionMapValue(Tizen::Base::Collection::IMultiMapT<KeyType, ValueType*>& col)
+{
+ Tizen::Base::Collection::IMapEnumeratorT<KeyType, ValueType*>* pEnum = col.GetMapEnumeratorN();
+
+ if (pEnum)
+ {
+ while (pEnum->MoveNext() == E_SUCCESS)
+ {
+ ValueType* pValue = null;
+ pEnum->GetValue(pValue);
+
+ delete pValue;
+ }
+
+ delete pEnum;
+ }
+}
+
+/*// custom deleter of Collection
+struct CollectionAllElementDeleter
+{
+ template<typename Collection>
+ void operator() (Collection* c)
+ {
+ c->RemoveAll(true);
+ delete c;
+ }
+};*/
+
+}} // Tizen::Shell
+
+
+namespace Tizen { namespace Base
+{
+
+//template<>
+//class ComparerT<String>
+//: public virtual Tizen::Base::Collection::IComparerT<String>
+//, public Object
+//{
+//public:
+// ComparerT(void) {}
+//
+// virtual ~ComparerT(void) {}
+//
+// virtual result Compare(const String& obj1, const String& obj2, int& cmp) const
+// {
+// cmp = String::Compare(obj1, obj2);
+// return E_SUCCESS;
+// }
+//
+//private:
+// ComparerT(const ComparerT& rhs);
+//
+// ComparerT& operator =(const ComparerT& rhs);
+//};
+
+namespace Collection
+{
+
+template <>
+class __HashMapDefaultProviderT<String>
+: public IHashCodeProviderT<String>
+, public Object
+{
+ public:
+ __HashMapDefaultProviderT(void) {}
+
+ virtual ~__HashMapDefaultProviderT(void) {}
+
+ virtual int GetHashCode(const String& obj) const
+ {
+ return obj.GetHashCode();
+ }
+};
+
+template<>
+class __MultiHashMapDefaultProviderT<String>
+: public IHashCodeProviderT<String>
+, public Object
+{
+ public:
+ __MultiHashMapDefaultProviderT(void) {}
+
+ virtual ~__MultiHashMapDefaultProviderT(void) {}
+
+ virtual int GetHashCode(const String& obj) const
+ {
+ return obj.GetHashCode();
+ }
+};
+
+
+} // Collection
+
+}} // Tizen::Base
+
+
+
+#endif // FSHELL_INTERNAL_STRINGKEY_TEMPLATE_UTIL_H_