Add floating function in QuickPanelFrame
authorJaeHwan Lee <jael.lee@samsung.com>
Wed, 27 Feb 2013 07:45:39 +0000 (16:45 +0900)
committerJaeHwan Lee <jael.lee@samsung.com>
Thu, 28 Feb 2013 04:23:47 +0000 (13:23 +0900)
Change-Id: Ie2f4a516c2b602a46cf04c6a1c87d69b473345e8
Signed-off-by: JaeHwan Lee <jael.lee@samsung.com>
inc/FShellQuickPanelFrame.h
src/FShellQuickPanelFrame.cpp
src/FShell_QuickPanelFrame.cpp
src/FShell_QuickPanelFrameImpl.cpp
src/inc/FShell_QuickPanelFrame.h
src/inc/FShell_QuickPanelFrameImpl.h

index 223a58c..b2cf0e9 100644 (file)
@@ -138,6 +138,7 @@ public:
         *
         * @since       2.0
         *
+        * @privlevel        public
         * @privilege   %http://tizen.org/privilege/notification
         *
         * @return      An error code
@@ -157,6 +158,7 @@ public:
         *
         * @since       2.0
         *
+        * @privlevel        public
         * @privilege   %http://tizen.org/privilege/notification
         *
         * @return             An error code
@@ -174,6 +176,7 @@ public:
         *
         * @since       2.0
         *
+        * @privlevel        public
         * @privilege   %http://tizen.org/privilege/notification
         *
         * @return      An error code
@@ -190,6 +193,7 @@ public:
         *
         * @since       2.0
         *
+        * @privlevel        public
         * @privilege   %http://tizen.org/privilege/notification
         *
         * @return      An error code
@@ -203,6 +207,57 @@ public:
         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 ConstructF(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 ConstructF(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 ConstructF(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.
         *
@@ -241,6 +296,17 @@ public:
         */
         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 SetHeightF(float height);
+
 protected:
         //
         // This method is for internal use only. Using this method can cause behavioral, security-related,
index 3257161..b23eaea 100644 (file)
@@ -55,7 +55,8 @@ QuickPanelFrame::Construct(int height)
 
        _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;
@@ -111,6 +112,69 @@ QuickPanelFrame::Construct(const Layout& portraitLayout, const Layout& landscape
 
        _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::ConstructF(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::ConstructF(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 = ConstructF(layout, layout, height);
+       SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       return r;
+}
+
+result
+QuickPanelFrame::ConstructF(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);
+       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));
 
@@ -153,6 +217,19 @@ QuickPanelFrame::SetHeight(int height)
        _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::SetHeightF(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));
 
index bfb020a..9c3aa7e 100644 (file)
  */
 
 #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"
@@ -71,7 +71,7 @@ public:
                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);
@@ -95,6 +95,15 @@ public:
                return r;
        }
 
+       Evas_Object* GetWindow(void)
+       {
+               return pWindow;
+       }
+
+       Evas_Object* pWindow;
+
+       
+
 private:
        _QuickPanelFrameLayer(const _QuickPanelFrameLayer& rhs);
        _QuickPanelFrameLayer& operator =(const _QuickPanelFrameLayer&  rhs);
@@ -212,7 +221,7 @@ CATCH:
 }
 
 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);
 
@@ -224,26 +233,26 @@ _QuickPanelFrame::Initialize(int height)
 
        Dimension size = pControlManager->GetScreenSize();
 
-       size.height = height;
+       FloatDimension sizeF(static_cast<float>(size.width), height);
 
 #if !defined(MULTI_WINDOW)
-       _QuickPanelFrameLayer* pLayer = dynamic_cast<_QuickPanelFrameLayer*>(__pQuickPanelFrameRootVisualElement->GetNativeLayer());
+       __pLayer = dynamic_cast<_QuickPanelFrameLayer*>(__pQuickPanelFrameRootVisualElement->GetNativeLayer());
 #else
        _RootVisualElement* pRootVE = GetRootVisualElement();
        SysAssert(pRootVE);
 
-       _QuickPanelFrameLayer* pLayer = dynamic_cast<_QuickPanelFrameLayer*>(pRootVE->GetNativeLayer());
+       __pLayer = dynamic_cast<_QuickPanelFrameLayer*>(pRootVE->GetNativeLayer());
 #endif
        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);
@@ -273,7 +282,7 @@ _QuickPanelFrame::Initialize(int height)
        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 = SetBoundsF(FloatRectangle(0.0f, 0.0f, sizeF.width, sizeF.height));
        SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        SetMovable(false);
@@ -283,7 +292,7 @@ _QuickPanelFrame::Initialize(int height)
 }
 
 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);
 
@@ -295,10 +304,10 @@ _QuickPanelFrame::SetHeight(int height)
        SetMovable(true);
        SetResizable(true);
 
-       Rectangle rect = GetBounds();
+       FloatRectangle rect = GetBoundsF();
 
        rect.height = height;
-       SetBounds(rect);
+       SetBoundsF(rect);
 
        SetMovable(movable);
        SetResizable(resizable);
@@ -359,13 +368,13 @@ _QuickPanelFrame::SetLayerShowState(bool showState)
 }
 
 result
-_QuickPanelFrame::SetLayerBounds(const Rectangle& bounds)
+_QuickPanelFrame::SetLayerBounds(const FloatRectangle& 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));
+       FloatRectangle fBounds(bounds.x, bounds.y, bounds.width, bounds.height);
 
        pLayer->SetBounds(fBounds);
        __pQuickPanelFrameRootVisualElement->SetBounds(fBounds);
@@ -373,6 +382,7 @@ _QuickPanelFrame::SetLayerBounds(const Rectangle& bounds)
        return r;
 }
 
+
 void
 _QuickPanelFrame::OnActivated(void)
 {
@@ -397,6 +407,15 @@ _QuickPanelFrame::OnBoundsChanged(void)
 }
 
 void
+_QuickPanelFrame::OnBoundsChangedF(void)
+{
+       FloatRectangle boundsF = GetBoundsF();
+       boundsF = _CoordinateSystemUtils::Transform(boundsF); 
+
+       SetLayerBoundsF(boundsF);
+}
+
+void
 _QuickPanelFrame::OnVisibleStateChanged(void)
 {
        result r = SetLayerShowState(GetVisibleState());
index 668d944..6b9a61e 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <new>
 #include <FGrpDimension.h>
+#include <FGrpFloatDimension.h>
 #include <FBaseSysLog.h>
 #include <FBaseInteger.h>
 #include <FBaseRtIEventArg.h>
@@ -128,7 +129,7 @@ _QuickPanelFrameImpl::GetCore(void)
 }
 
 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));
@@ -155,7 +156,7 @@ _QuickPanelFrameImpl::RemoveOrientationEventListener(IOrientationEventListener&
 }
 
 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));
@@ -191,7 +192,6 @@ _QuickPanelFrameImpl::Rotate(_ControlRotation rotation)
        }
 
        GetCore().ChangeLayout(orientation);
-
        GetCore().UpdateLayout();
 
        FireEvent(rotation);
@@ -252,18 +252,18 @@ _QuickPanelFrameImpl::OnChangeLayout(_ControlOrientation orientation)
        SysAssert(pControlManager);
        const Dimension& screenSize = pControlManager->GetScreenSize();
 
-       Dimension size = GetSize();
+       FloatDimension size = GetSizeF();
 
        if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
        {
-               size.width = screenSize.width;
+               size.width = static_cast<float>(screenSize.width);
        }
        else
        {
-               size.width = screenSize.height;
+               size.width = static_cast<float>(screenSize.height);
        }
 
-       SetSize(size);
+       SetSizeF(size);
        SetResizable(resizable);
        SetMovable(movable);
 }
index b95672a..2452224 100644 (file)
 #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;
@@ -58,8 +61,8 @@ public:
        static _QuickPanelFrame* CreateQuickPanelFrameN(void);
        virtual ~_QuickPanelFrame(void);
 
-       result Initialize(int height);
-       result SetHeight(int height);
+       result Initialize(float height);
+       result SetHeight(float height);
 
 #if !defined(MULTI_WINDOW)
        Tizen::Ui::Animations::_RootVisualElement* GetRootVisualElement(void) const;
@@ -78,11 +81,15 @@ private:
 
 #if !defined(MULTI_WINDOW)
        result SetLayerShowState(bool showState);
-       result SetLayerBounds(const Tizen::Graphics::Rectangle& bounds);
+       result SetLayerBounds(const Tizen::Graphics::FloatRectangle& bounds);
 
        virtual void OnActivated(void);
        virtual void OnDeactivated(void);
+
+       // Callback
        virtual void OnBoundsChanged(void);
+       virtual void OnBoundsChangedF(void);
+
        virtual void OnVisibleStateChanged(void);
 
 #endif
@@ -96,6 +103,8 @@ private:
 
 #endif
        Tizen::Ui::_IUiEventManager* __pEventManager;
+       _QuickPanelFrameLayer* __pLayer;
+       Evas_Object* pminicontrol;
 }; // _QuickPanelFrame
 
 }}// Tizen::Shell
index e3477ea..43653f0 100644 (file)
@@ -48,10 +48,12 @@ public:
        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);
+
+       result SetHeight(float height);
 
 #if !defined(MULTI_WINDOW)
        void Rotate(Tizen::Ui::_ControlRotation rotation);