Add defense code for window deleting when the application is terminated, Update Contr...
authorJaewon Cho <jaewon7.cho@samsung.com>
Mon, 9 Sep 2013 05:26:33 +0000 (14:26 +0900)
committerJaewon Cho <jaewon7.cho@samsung.com>
Mon, 9 Sep 2013 05:26:33 +0000 (14:26 +0900)
Change-Id: I676e4bcfda755f1b2844a1acaa86bea421125240
Signed-off-by: Jaewon Cho <jaewon7.cho@samsung.com>
inc/FUiControl.h
src/ui/FUi_ControlManager.cpp
src/ui/controls/FUiCtrl_Frame.cpp

index b2b5f43..fce347e 100644 (file)
@@ -261,7 +261,7 @@ public:
        /**
         * Overrides this method to provide user-specific initialization code before the control is added to a container. @n
         * The %OnInitializing() method is called when the control is about to be added to a container.
-        * To cancel adding the control to the parent, return @c E_FAILURE in this method.
+        * To cancel adding the control to the parent, return any exception other than @c E_SUCCESS.
         *
         * @since               2.0
         *
@@ -671,7 +671,6 @@ public:
         * @exception   E_UNSUPPORTED_OPERATION This control is neither movable nor resizable.
         * @exception   E_INVALID_ARG                   The specified input parameter is invalid.
         * @exception   E_SYSTEM                                A system error has occurred.
-        * @remarks             Do not override this method.
         * @see                 IsMovable()
         * @see                 IsResizable()
         * @see                 GetMinimumSize()
@@ -694,7 +693,6 @@ public:
         * @exception   E_UNSUPPORTED_OPERATION This control is neither movable nor resizable.
         * @exception   E_INVALID_ARG                   The specified input parameter is invalid.
         * @exception   E_SYSTEM                                A system error has occurred.
-        * @remarks             Do not override this method.
         * @see                 IsMovable()
         * @see                 IsResizable()
         * @see                 GetMinimumSize()
@@ -725,7 +723,6 @@ public:
         * @exception   E_UNSUPPORTED_OPERATION This control is neither movable nor resizable.
         * @exception   E_INVALID_ARG                   A specified input parameter is invalid.
         * @exception   E_SYSTEM                                A system error has occurred.
-        * @remarks             Do not override this method.
         * @see                 IsMovable()
         * @see                 IsResizable()
         * @see                 GetMinimumSize()
@@ -756,7 +753,6 @@ public:
         * @exception   E_UNSUPPORTED_OPERATION This control is neither movable nor resizable.
         * @exception   E_INVALID_ARG                   A specified input parameter is invalid.
         * @exception   E_SYSTEM                                A system error has occurred.
-        * @remarks             Do not override this method.
         * @see                 IsMovable()
         * @see                 IsResizable()
         * @see                 GetMinimumSize()
@@ -778,7 +774,6 @@ public:
         * @exception   E_INVALID_OPERATION             The control has not been constructed as yet.
         * @exception   E_UNSUPPORTED_OPERATION This control is not movable.
         * @exception   E_SYSTEM                                A system error has occurred.
-        * @remarks             Do not override this method.
         * @see                 IsMovable()
         * @see                 SetBounds()
         */
@@ -796,7 +791,6 @@ public:
         * @exception   E_INVALID_OPERATION             The control has not been constructed as yet.
         * @exception   E_UNSUPPORTED_OPERATION This control is not movable.
         * @exception   E_SYSTEM                                A system error has occurred.
-        * @remarks             Do not override this method.
         * @see                 IsMovable()
         * @see                 SetBounds()
         */
@@ -815,7 +809,6 @@ public:
         * @exception   E_INVALID_OPERATION             The control has not been constructed as yet.
         * @exception   E_UNSUPPORTED_OPERATION This control is not movable.
         * @exception   E_SYSTEM                                A system error has occurred.
-        * @remarks             Do not override this method.
         * @see                 IsMovable()
         * @see                 SetBounds()
         */
@@ -834,7 +827,6 @@ public:
         * @exception   E_INVALID_OPERATION             The control has not been constructed as yet.
         * @exception   E_UNSUPPORTED_OPERATION This control is not movable.
         * @exception   E_SYSTEM                                A system error has occurred.
-        * @remarks             Do not override this method.
         * @see                 IsMovable()
         * @see                 SetBounds()
         */
@@ -853,7 +845,6 @@ public:
         * @exception   E_UNSUPPORTED_OPERATION This control is not resizable.
         * @exception   E_INVALID_ARG                   The specified input parameter is invalid.
         * @exception   E_SYSTEM                                A system error has occurred.
-        * @remarks             Do not override this method.
         * @see                 IsResizable()
         * @see                 GetMinimumSize()
         * @see                 GetMaximumSize()
@@ -874,7 +865,6 @@ public:
         * @exception   E_UNSUPPORTED_OPERATION This control is not resizable.
         * @exception   E_INVALID_ARG                   The specified input parameter is invalid.
         * @exception   E_SYSTEM                                A system error has occurred.
-        * @remarks             Do not override this method.
         * @see                 IsResizable()
         * @see                 GetMinimumSize()
         * @see                 GetMaximumSize()
@@ -897,7 +887,6 @@ public:
         * @exception   E_UNSUPPORTED_OPERATION This control is not resizable.
         * @exception   E_INVALID_ARG                   A specified input parameter is invalid.
         * @exception   E_SYSTEM                                A system error has occurred.
-        * @remarks             Do not override this method.
         * @see                 IsResizable()
         * @see                 GetMinimumSize()
         * @see                 GetMaximumSize()
@@ -920,7 +909,6 @@ public:
         * @exception   E_UNSUPPORTED_OPERATION This control is not resizable.
         * @exception   E_INVALID_ARG                   A specified input parameter is invalid.
         * @exception   E_SYSTEM                                A system error has occurred.
-        * @remarks             Do not override this method.
         * @see                 IsResizable()
         * @see                 GetMinimumSize()
         * @see                 GetMaximumSize()
@@ -1284,11 +1272,9 @@ public:
         *     if (pCanvas != null)
         *     {
         *         // adds your drawing code here
-        *     }
-        *     if (pCanvas)
-        *     {
+        *
         *         delete pCanvas;
-        *      }
+        *     }
         *     // Do not call Show(). It will be called automatically after OnDraw() callback.
         *     return r;
         * }
@@ -1420,8 +1406,9 @@ public:
         *
         * @since               2.0
         *
-        * @return              @c true if the control is currently visible on the screen, @n
-        *                              else @c false either this method is called before the control is added to a parent or the control is not visible on the screen
+        * @return              @c true if the show states of the specified control and tis ancestor controls are set to @c true, @n
+        *                              else @c false if this method is called before the control is added to a parent or the show state
+        *                              of the specified control or its parent control is set to @c false.
         * @see                 GetShowState()
         * @see                 SetShowState()
         */
@@ -1451,7 +1438,6 @@ public:
         *                                                                      Note: This control cannot be displayed.
         * @exception   E_SYSTEM                        A system error has occurred.
         * @remarks             
-        *                              - Do not override this method.
         *                              - Even if this method is invoked, the control is not drawn or shown. @n
         *                              To display the control, use the Invalidate() methods. @n
         *                              Once the control's show state is set to @c false,
@@ -1551,7 +1537,6 @@ public:
         * @exception   E_INVALID_OPERATION     The current state of the instance prohibits the execution of the specified operation.
         *                                                                      Note: This control cannot be displayed.
         * @exception   E_INVALID_CONDITION     The control is not contained in, or is not the top z-order frame or form.
-        * @remarks             Do not override this method.
         */
        result SetFocus(void);
 
@@ -1577,7 +1562,6 @@ public:
         * @exception   E_SUCCESS                       The method is successful.
         * @exception   E_INVALID_OPERATION     The current state of the instance prohibits the execution of the specified operation.
         * @exception   E_SYSTEM                        A system error has occurred.
-        * @remarks             Do not override this method.
         */
        result SetEnabled(bool enable);
 
@@ -1785,6 +1769,7 @@ public:
         * @since                    2.1
         *
         * @param[in]    rect      The bounds of the content area
+        * @remarks             The content area can be used for the fitting policy of layout is ::FIT_POLICY_CONTENT.
         * @see                      GetContentAreaBounds()
         */
        void SetContentAreaBounds(const Tizen::Graphics::Rectangle& rect);
@@ -1795,6 +1780,7 @@ public:
         * @since                    2.1
         *
         * @param[in]    rect      The bounds of the content area
+        * @remarks             The content area can be used for the fitting policy of layout is ::FIT_POLICY_CONTENT.
         * @see                      GetContentAreaBoundsF()
         */
        void SetContentAreaBounds(const Tizen::Graphics::FloatRectangle& rect);
index ca8baaf..de6ecc8 100644 (file)
@@ -891,10 +891,31 @@ _ControlManager::CloseWindow(_Window& window) // [ToDo] exception check.
                                SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
                        }
                }
+       }
+
+       if (dynamic_cast <_Frame*>(pNewTopWindow) != null)
+       {
+               __pCurrentFrame = pNewTopWindow;
+       }
+       else
+       {
+               bool findFrame = false;
+               int count = GetWindowCount();
+               for (int i = 0; i < count; i++)
+               {
+                       _Window* pWindow = GetWindow((count-1) - i);
+                       _Frame* pFrame = dynamic_cast<_Frame*>(pWindow);
+                       if (pFrame)
+                       {
+                               __pCurrentFrame = pFrame;
+                               findFrame = true;
+                               break;
+                       }
+               }
 
-               if (dynamic_cast <_Frame*>(pNewTopWindow) != null)
+               if (!findFrame)
                {
-                       __pCurrentFrame = pNewTopWindow;
+                       __pCurrentFrame = null;
                }
        }
 
index 17bc308..9aca731 100644 (file)
@@ -455,7 +455,13 @@ _Frame::AddFrameEventListener(const _IFrameEventListener& listener)
 void
 _Frame::RemoveFrameEventListener(const _IFrameEventListener& listener)
 {
-       result r = __pFrameEvent->RemoveListener(listener);
+       result r = E_SUCCESS;
+
+       if (__pFrameEvent)
+       {
+               r = __pFrameEvent->RemoveListener(listener);
+       }
+
        SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
 }