add patch
[framework/osp/web.git] / src / controls / FWebCtrl_WebPopup.cpp
old mode 100644 (file)
new mode 100755 (executable)
index 099ac77..e1ca104
@@ -25,6 +25,7 @@
 #include <FUiCtrlPanel.h>
 #include <FUiVerticalBoxLayout.h>
 #include <FUi_ResourceManager.h>
+#include "FWebCtrl_WebManager.h"
 #include "FWebCtrl_WebPopup.h"
 
 
@@ -50,6 +51,10 @@ _WebPopup::_WebPopup(void)
 
 _WebPopup::~_WebPopup(void)
 {
+       if (IsModalPopup())
+       {
+               HidePopup();
+       }
        __pWebPopupData.reset();
 }
 
@@ -59,10 +64,18 @@ _WebPopup::Construct(bool hasTitle, const Dimension& popupDim)
 {
        VerticalBoxLayout layout;
 
+       Dimension dim(popupDim);
+       dim.height += __pWebPopupData->bottomMargin;
+
+       if (hasTitle)
+       {
+               dim.height += __pWebPopupData->titleHeight;
+       }
+
        result r = layout.Construct(VERTICAL_DIRECTION_DOWNWARD);
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
-       r = Popup::Construct(layout, layout, hasTitle, popupDim);
+       r = Popup::Construct(layout, layout, hasTitle, dim);
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        return E_SUCCESS;
@@ -91,6 +104,9 @@ _WebPopup::ShowPopup(void)
 {
        result r = E_SUCCESS;
 
+       _WebManager* pWebManager = _WebManager::GetInstance();
+       pWebManager->SetActivePopup(this);
+
        r = SetShowState(true);
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
@@ -109,6 +125,9 @@ _WebPopup::HidePopup(int modalResult)
        r = SetShowState(false);
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
+       _WebManager* pWebManager = _WebManager::GetInstance();
+       pWebManager->RemoveActivePopup(this);
+
        if (__isModal)
        {
                __modal = modalResult;
@@ -124,6 +143,9 @@ _WebPopup::HidePopup(int modalResult)
 result
 _WebPopup::ShowAndWait(int& modalResult)
 {
+       _WebManager* pWebManager = _WebManager::GetInstance();
+       pWebManager->SetActivePopup(this);
+
        __isModal = true;
 
        return DoModal(modalResult);
@@ -211,22 +233,22 @@ _WebPopup::GetPopupData(bool refresh)
        __pWebPopupData = std::unique_ptr<_WebPopupData> (new (std::nothrow) _WebPopupData());
        SysTryReturn(NID_WEB_CTRL, __pWebPopupData.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
-       _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
+       _ControlOrientation orientation = _CONTROL_ORIENTATION_PORTRAIT;
 
        GET_SHAPE_CONFIG(MESSAGEBOX::DEFAULT_WIDTH, orientation, __pWebPopupData->popupDim.width);
        GET_SHAPE_CONFIG(MESSAGEBOX::MAX_HEIGHT, orientation, __pWebPopupData->popupDim.height);
        GET_SHAPE_CONFIG(POPUP::SIDE_BORDER, orientation, __pWebPopupData->sideMargin);
+       GET_SHAPE_CONFIG(POPUP::BOTTOM_BORDER, orientation, __pWebPopupData->bottomMargin);
+       GET_SHAPE_CONFIG(POPUP::TITLE_HEIGHT, orientation, __pWebPopupData->titleHeight);
 
        GET_SHAPE_CONFIG(MESSAGEBOX::BUTTON_HEIGHT, orientation, __pWebPopupData->btnDim.height);
        GET_SHAPE_CONFIG(MESSAGEBOX::BUTTON_SIDE_MARGIN_02, orientation, __pWebPopupData->spacePad);
 
        GET_SHAPE_CONFIG(LABEL::TEXT_FONT_SIZE, orientation, __pWebPopupData->labelFontSize);
-       GET_SHAPE_CONFIG(CHECKBUTTON::MARK_BITMAP_HEIGHT, orientation, __pWebPopupData->checkDim.height);
-       GET_SHAPE_CONFIG(CHECKBUTTON::MARK_BITMAP_WIDTH, orientation, __pWebPopupData->checkDim.width);
+       GET_DIMENSION_CONFIG(CHECKBUTTON::MIN_DIMENSION, orientation, __pWebPopupData->checkDim);
 
        GET_DIMENSION_CONFIG(EDIT::MIN_SIZE, orientation, __pWebPopupData->editDim);
 
-       __pWebPopupData->popupDim.width -= 2*__pWebPopupData->sideMargin;
        __pWebPopupData->labelDim.width = __pWebPopupData->popupDim.width - 2*__pWebPopupData->sideMargin;
        __pWebPopupData->labelDim.height = 3*__pWebPopupData->labelFontSize;
 
@@ -234,4 +256,11 @@ _WebPopup::GetPopupData(bool refresh)
 }
 
 
+result
+_WebPopup::OnTerminating(void)
+{
+       return E_SUCCESS;
+}
+
+
 }}} // Tizen::Web::Controls