fix for plm [P130911-03977] giving webpopup similar look as ui messagebox
authorBINDUCHAITANYA TUMMALA <bc.tummala@samsung.com>
Mon, 30 Sep 2013 07:51:37 +0000 (13:21 +0530)
committerBINDUCHAITANYA TUMMALA <bc.tummala@samsung.com>
Mon, 30 Sep 2013 08:00:40 +0000 (13:30 +0530)
Change-Id: If842ed23bf77716a5f16a7ae8733cd2e91c8f116
Signed-off-by: BINDUCHAITANYA TUMMALA <bc.tummala@samsung.com>
src/controls/FWebCtrl_AuthConfirmPopup.cpp
src/controls/FWebCtrl_CertificateConfirmPopup.cpp
src/controls/FWebCtrl_PromptPopup.cpp
src/controls/FWebCtrl_SelectBox.cpp
src/controls/FWebCtrl_UserConfirmPopup.cpp
src/controls/FWebCtrl_WebPopup.cpp
src/controls/inc/FWebCtrl_WebPopup.h

index de447c4..756dc92 100755 (executable)
@@ -89,7 +89,7 @@ _AuthConfirmPopup::Construct(const String& host, const String& realm, Authentica
 
        Rectangle rect(0, 0, 0, 0);
        rect.width = pPopupData->popupDim.width;
-       rect.height = (2*pPopupData->spacePad) + (pPopupData->editDim.height*2) + pPopupData->btnDim.height + (2*pPopupData->labelDim.height);
+       rect.height = (2*pPopupData->spacePad) + (pPopupData->editDim.height*2) + pPopupData->panelHeight + (2*pPopupData->labelDim.height);
        r = _WebPopup::Construct(true, Dimension(rect.width, rect.height));
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
@@ -104,7 +104,6 @@ _AuthConfirmPopup::Construct(const String& host, const String& realm, Authentica
        String hostRealm(host);
        hostRealm.Append(L": \n ");
        hostRealm.Append(realm);
-       hostRealm.Append(L"\"");
        r = pLabel->Construct(rect, hostRealm);
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
@@ -177,7 +176,6 @@ _AuthConfirmPopup::Construct(const String& host, const String& realm, Authentica
        pLayout->SetHorizontalAlignment(*pHostLabel, LAYOUT_HORIZONTAL_ALIGN_CENTER);
        pLayout->SetHorizontalAlignment(*__pIdEditField, LAYOUT_HORIZONTAL_ALIGN_CENTER);
        pLayout->SetHorizontalAlignment(*__pPwdEditField, LAYOUT_HORIZONTAL_ALIGN_CENTER);
-       pLayout->SetHorizontalAlignment(*pButtonPanel, LAYOUT_HORIZONTAL_ALIGN_CENTER);
 
        pLayout->SetSpacing(*__pPwdEditField, pPopupData->spacePad);
        pLayout->SetSpacing(*pButtonPanel, pPopupData->spacePad);
index 20c4248..e30379a 100755 (executable)
@@ -117,7 +117,7 @@ _CertificateConfirmPopup::Construct(_CertificatePopupMode certPopupMode, Ewk_Cer
        if( __certPopupMode == CERTIFICATE_POPUP_MODE_VIEW )
        {
                titleText = pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_HEADER_SECURITY_CERTIFICATE_ABB");
-               popupMaxHeight = 4*pPopupData->labelDim.height + pPopupData->btnDim.height + 2*pPopupData->sideMargin;
+               popupMaxHeight = 4*pPopupData->labelDim.height + pPopupData->panelHeight;
 
                rect.height = 4*pPopupData->labelDim.height;
                rect.width = pPopupData->labelDim.width;
@@ -128,7 +128,7 @@ _CertificateConfirmPopup::Construct(_CertificatePopupMode certPopupMode, Ewk_Cer
        else    // CERTIFICATE_POPUP_MODE_CONFIRM
        {
                titleText = pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_HEADER_SECURITY_WARNING_ABB");
-               popupMaxHeight = 2*pPopupData->labelDim.height + pPopupData->btnDim.height + 2*pPopupData->sideMargin;
+               popupMaxHeight = 2*pPopupData->labelDim.height + pPopupData->panelHeight;
 
                rect.height = 2*pPopupData->labelDim.height;
                rect.width = pPopupData->labelDim.width;
@@ -204,11 +204,6 @@ _CertificateConfirmPopup::Construct(_CertificatePopupMode certPopupMode, Ewk_Cer
        r = CreateAndAddButtons(idList, titleList, pButtonPanel);
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
-       pLayout->SetHorizontalFitPolicy(*pButtonPanel, FIT_POLICY_PARENT);
-       pLayout->SetHorizontalAlignment(*pButtonPanel, LAYOUT_HORIZONTAL_ALIGN_CENTER);
-
-       pLayout->SetSpacing(*pButtonPanel, 2*pPopupData->sideMargin);
-
        SetPropagatedKeyEventListener(this);
 
        return E_SUCCESS;
index d877f51..9a6ab1a 100755 (executable)
@@ -86,7 +86,7 @@ _PromptPopup::Construct(const String& message, const String& defaultVale,  Evas_
        _WebPopupData* pPopupData = _WebPopup::GetPopupData();
        SysTryReturn(NID_WEB_CTRL, pPopupData, r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
 
-       popupHeight = pPopupData->editDim.height + pPopupData->labelDim.height  + pPopupData->btnDim.height + (2 * pPopupData->spacePad);
+       popupHeight = pPopupData->editDim.height + pPopupData->labelDim.height + pPopupData->panelHeight + (2 * pPopupData->spacePad);
 
        r = _WebPopup::Construct(true, Dimension(pPopupData->popupDim.width, popupHeight));
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
@@ -160,7 +160,6 @@ _PromptPopup::Construct(const String& message, const String& defaultVale,  Evas_
 
        pLayout->SetHorizontalAlignment(*pTmpTextBox, LAYOUT_HORIZONTAL_ALIGN_CENTER);
        pLayout->SetHorizontalAlignment(*__pEditField, LAYOUT_HORIZONTAL_ALIGN_CENTER);
-       pLayout->SetHorizontalAlignment(*pButtonPanel, LAYOUT_HORIZONTAL_ALIGN_CENTER);
 
        pLayout->SetSpacing(*__pEditField, pPopupData->spacePad);
        pLayout->SetSpacing(*pButtonPanel, pPopupData->spacePad);
index 057ebd7..7f38319 100755 (executable)
@@ -190,7 +190,7 @@ _SelectBox::Construct(Tizen::Web::Controls::_WebImpl* pImpl, bool isMultiSelect,
        _WebPopupData* pPopupData = _WebPopup::GetPopupData();
        SysTryReturn(NID_WEB_CTRL, pPopupData, r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
 
-       listMaxHeihgt = listCount * listItemHeight + pPopupData->btnDim.height + pPopupData->spacePad;
+       listMaxHeihgt = listCount * listItemHeight + pPopupData->panelHeight;
 
        rect.height = listMaxHeihgt;
        rect.width = pPopupData->popupDim.width;
@@ -256,11 +256,6 @@ _SelectBox::Construct(Tizen::Web::Controls::_WebImpl* pImpl, bool isMultiSelect,
        r = CreateAndAddButtons(idList, titleList, pButtonPanel);
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
-       std::unique_ptr<VerticalBoxLayout> pLayout(dynamic_cast< VerticalBoxLayout* >(GetLayoutN()));
-       SysTryReturn(NID_WEB_CTRL, pLayout.get(), r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
-
-       pLayout->SetSpacing(*pButtonPanel,  pPopupData->spacePad);
-
        SetPropagatedKeyEventListener(this);
        
        return r;
index ef242a3..9c99b70 100755 (executable)
@@ -110,7 +110,7 @@ _UserConfirmPopup::Construct(_UserConfirmMode userConfirmMode, void* pEventInfo,
        __isUserActionNeeded = true;
 
        bool hasTitle = true;
-       int popupMaxHeight = 2*pPopupData->labelDim.height + pPopupData->btnDim.height + 2*pPopupData->sideMargin;
+       int popupMaxHeight = 2*pPopupData->labelDim.height + pPopupData->panelHeight;
 
        __pImpl = pImpl;
        SysAssertf(__pImpl != null, "Failed to get _WebImpl");
@@ -122,7 +122,6 @@ _UserConfirmPopup::Construct(_UserConfirmMode userConfirmMode, void* pEventInfo,
 
        if (__userConfirmMode == USER_SCRIPT_ALERT)
        {
-               popupMaxHeight -=  2*pPopupData->sideMargin;
                hasTitle = false;
        }
 
@@ -279,16 +278,6 @@ _UserConfirmPopup::Construct(_UserConfirmMode userConfirmMode, void* pEventInfo,
        {
                pLayout->SetHorizontalAlignment(*__pCheckButton, LAYOUT_HORIZONTAL_ALIGN_CENTER);
        }
-       pLayout->SetHorizontalAlignment(*pButtonPanel, LAYOUT_HORIZONTAL_ALIGN_CENTER);
-
-       if ( __userConfirmMode == USER_SCRIPT_ALERT )
-       {
-               pLayout->SetSpacing(*pButtonPanel, pPopupData->sideMargin);
-       }
-       else
-       {
-               pLayout->SetSpacing(*pButtonPanel, 2*pPopupData->sideMargin);
-       }
 
        SetPropagatedKeyEventListener(this);
        return E_SUCCESS;
index 073f79e..c2f2f10 100755 (executable)
@@ -21,6 +21,7 @@
  */
 #include <FBaseColIList.h>
 #include <FBaseSysLog.h>
+#include <FGrpColor.h>
 #include <FUiCtrlButton.h>
 #include <FUiCtrlPanel.h>
 #include <FUiVerticalBoxLayout.h>
@@ -68,7 +69,6 @@ _WebPopup::Construct(bool hasTitle, const Dimension& popupDim)
        VerticalBoxLayout layout;
 
        Dimension dim(popupDim);
-       dim.height += __pWebPopupData->bottomMargin;
 
        if (hasTitle)
        {
@@ -123,11 +123,6 @@ _WebPopup::ShowPopup(void)
 result
 _WebPopup::HidePopup(int modalResult)
 {
-       result r = E_SUCCESS;
-
-       r = SetShowState(false);
-       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
-
        if (__isModal)
        {
                __modal = modalResult;
@@ -135,8 +130,15 @@ _WebPopup::HidePopup(int modalResult)
 
                return EndModal(__modal);
        }
+       else
+       {
+               result r = E_SUCCESS;
 
-       return E_SUCCESS;
+               r = SetShowState(false);
+               SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+               return E_SUCCESS;
+       }
 }
 
 
@@ -158,11 +160,15 @@ _WebPopup::CreateAndAddPanel(void)
        std::unique_ptr<Panel> pPanel(new (std::nothrow) Panel());
        SysTryReturn(NID_WEB_CTRL, pPanel.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
-       Rectangle panelRect(0, 0, __pWebPopupData->popupDim.width, __pWebPopupData->btnDim.height);
+       Rectangle panelRect(0, 0, __pWebPopupData->popupDim.width, __pWebPopupData->panelHeight);
 
-       result r = pPanel->Construct(panelRect);
+       result r = pPanel->Construct(panelRect, GROUP_STYLE_BOTTOM);
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
 
+       Color buttonBgColor(0x00000000);
+       GET_COLOR_CONFIG(MESSAGEBOX::BOTTOM_BG_NORMAL, buttonBgColor);
+       pPanel->SetBackgroundColor(buttonBgColor);
+
        r = AddControl(*pPanel);
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
 
@@ -184,8 +190,51 @@ _WebPopup::CreateAndAddButtons(const IList& buttonIds, const IList& buttonTitles
 
        int buttonMargin = __pWebPopupData->spacePad/2;
        int buttonWidth = (__pWebPopupData->popupDim.width - buttonMargin*(idCount+1)) / idCount;
+       int buttonTopMargin = (__pWebPopupData->panelHeight - __pWebPopupData->btnDim.height)/2;
 
        result r = E_SUCCESS;
+
+       //Button Colors
+       Color buttonColorNormal(0x00000000);
+       Color buttonColorPressed(0x00000000);
+       Color buttonColorDisabled(0x00000000);
+       Color buttonColorHighlighted(0x00000000);
+       Color buttonTextNormal(0x00000000);
+       Color buttonTextPressed(0x00000000);
+       Color buttonTextDisabled(0x00000000);
+       Color buttonTextHighlighted(0x00000000);
+
+       Bitmap* pComposedButtonBgNormal = null;
+       Bitmap* pComposedButtonBgPressed = null;
+       Bitmap* pComposedButtonBgDisabled = null;
+       Bitmap* pComposedButtonBgHighlighted = null;
+
+       GET_COLOR_CONFIG(MESSAGEBOX::BOTTOM_BUTTON_BG_NORMAL, buttonColorNormal);
+       GET_COLOR_CONFIG(MESSAGEBOX::BOTTOM_BUTTON_BG_PRESSED, buttonColorPressed);
+       GET_COLOR_CONFIG(MESSAGEBOX::BOTTOM_BUTTON_BG_DISABLED, buttonColorDisabled);
+       GET_COLOR_CONFIG(MESSAGEBOX::BOTTOM_BUTTON_BG_HIGHLIGHTED, buttonColorHighlighted);
+
+       GET_COLOR_CONFIG(MESSAGEBOX::BOTTOM_BUTTON_TEXT_NORMAL, buttonTextNormal);
+       GET_COLOR_CONFIG(MESSAGEBOX::BOTTOM_BUTTON_TEXT_PRESSED, buttonTextPressed);
+       GET_COLOR_CONFIG(MESSAGEBOX::BOTTOM_BUTTON_TEXT_DISABLED, buttonTextDisabled);
+       GET_COLOR_CONFIG(MESSAGEBOX::BOTTOM_BUTTON_TEXT_HIGHLIGHTED, buttonTextHighlighted);
+
+       r = GET_REPLACED_BITMAP_CONFIG_N(MESSAGEBOX::BOTTOM_BUTTON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, buttonColorNormal, pComposedButtonBgNormal);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+       std::unique_ptr< Bitmap > pComposedBtnBgNormal(pComposedButtonBgNormal);
+
+       r = GET_REPLACED_BITMAP_CONFIG_N(MESSAGEBOX::BOTTOM_BUTTON_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, buttonColorPressed, pComposedButtonBgPressed);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+       std::unique_ptr< Bitmap > pComposedBtnBgPressed(pComposedButtonBgPressed);
+
+       r = GET_REPLACED_BITMAP_CONFIG_N(MESSAGEBOX::BOTTOM_BUTTON_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, buttonColorDisabled, pComposedButtonBgDisabled);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+       std::unique_ptr< Bitmap > pComposedBtnBgDisabled(pComposedButtonBgDisabled);
+
+       r = GET_REPLACED_BITMAP_CONFIG_N(MESSAGEBOX::BOTTOM_BUTTON_BG_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, buttonColorHighlighted, pComposedButtonBgHighlighted);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+       std::unique_ptr< Bitmap > pComposedBtnBgHighlighted(pComposedButtonBgHighlighted);
+
        for (int i = 0; i < idCount; i++)
        {
                const Integer* pButtonId = static_cast<const Integer*>(buttonIds.GetAt(i));
@@ -196,11 +245,20 @@ _WebPopup::CreateAndAddButtons(const IList& buttonIds, const IList& buttonTitles
                std::unique_ptr<Button> pButton(new (std::nothrow) Button());
                SysTryReturnResult(NID_WEB_CTRL, pButton.get(), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory Allocation failed.");
 
-               r = pButton->Construct(Rectangle((buttonMargin*(i+1))+(buttonWidth*i), 0, buttonWidth, __pWebPopupData->btnDim.height), *pButtonTitle);
+               r = pButton->Construct(Rectangle((buttonMargin*(i+1))+(buttonWidth*i), buttonTopMargin, buttonWidth, __pWebPopupData->btnDim.height), *pButtonTitle);
                SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
                pButton->SetActionId(pButtonId->ToInt());
 
+               pButton->SetNormalBackgroundBitmap(*pComposedBtnBgNormal);
+               pButton->SetPressedBackgroundBitmap(*pComposedBtnBgPressed);
+               pButton->SetDisabledBackgroundBitmap(*pComposedBtnBgDisabled);
+               pButton->SetHighlightedBackgroundBitmap(*pComposedBtnBgHighlighted);
+               pButton->SetTextColor(buttonTextNormal);
+               pButton->SetPressedTextColor(buttonTextPressed);
+               pButton->SetDisabledTextColor(buttonTextDisabled);
+               pButton->SetHighlightedTextColor(buttonTextHighlighted);
+
                //Add button to panel
                r = pPanel->AddControl(*pButton);
                SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
@@ -243,6 +301,7 @@ _WebPopup::GetPopupData(bool refresh)
 
        GET_SHAPE_CONFIG(MESSAGEBOX::BUTTON_HEIGHT, orientation, __pWebPopupData->btnDim.height);
        GET_SHAPE_CONFIG(MESSAGEBOX::BUTTON_SIDE_MARGIN_02, orientation, __pWebPopupData->spacePad);
+       GET_SHAPE_CONFIG(MESSAGEBOX::BOTTOM_HEIGHT, orientation, __pWebPopupData->panelHeight);
 
        GET_SHAPE_CONFIG(LABEL::TEXT_FONT_SIZE, orientation, __pWebPopupData->labelFontSize);
        GET_DIMENSION_CONFIG(CHECKBUTTON::MIN_DIMENSION, orientation, __pWebPopupData->checkDim);
index 52f3deb..74c69f1 100755 (executable)
@@ -73,6 +73,7 @@ struct _WebPopupData
        int sideMargin;
        int titleHeight;
        int bottomMargin;
+       int panelHeight;
 };
 
 class _WebPopup