Add package signature files generation code in spec file
[apps/osp/Call.git] / src / CallButtonsPanel.cpp
index ec50816..4b7c57b 100644 (file)
@@ -1,7 +1,7 @@
 //
 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
 //
-// Licensed under the Flora License, Version 1.0 (the License);
+// Licensed under the Flora License, Version 1.1 (the License);
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
@@ -267,7 +267,7 @@ CallButtonsPanel::AddBackgroundBitmap(void)
                        Label* pBackgroundLabel = new (std::nothrow) Label();
                        pBackgroundLabel->Construct(Rectangle(0, 1, panelRect.width, panelRect.height), L"");
                        pBackgroundLabel->SetBackgroundBitmap(*pBgBitmap);
-                       r = AddControl(*pBackgroundLabel);
+                       r = AddControl(pBackgroundLabel);
 
                        //always display in background
                        SetControlAlwaysAtBottom(*pBackgroundLabel, true);
@@ -315,33 +315,31 @@ CallButtonsPanel::ConstructEndCallPanel(void)
                AddKeyPadActionListener(IDC_ADD_TO_CONTACT_BUTTON,IDA_ADD_TO_CONTACTS);
        }
        //set initial show state to false. Correct state set on OnSceneActivatedN
-       SetViewContactButtonStatus(false);
+       SetEndCallPanelState(false);
 
        return r;
 }
 
 void
-CallButtonsPanel::SetViewContactButtonStatus(bool isAddToContactPresent)
+CallButtonsPanel::ShowViewContactButton(void)
 {
-
        //Present show View Contact else show Add to contact
-       if(isAddToContactPresent == false)
-       {
-               SetViewContacBitmapToButton(IDC_ADD_TO_CONTACT_BUTTON,AppUtility::GetResourceString(IDS_VIEW_CONTACT),
-                               IDB_VIEW_CONTACT_BG_ICON,IDB_VIEW_CONTACT_ICON,BTN_NORMAL);
+       SetViewContacBitmapToButton(IDC_ADD_TO_CONTACT_BUTTON,AppUtility::GetResourceString(IDS_VIEW_CONTACT),
+                       IDB_VIEW_CONTACT_BG_ICON,IDB_VIEW_CONTACT_ICON,BTN_NORMAL);
 
-               SetViewContacBitmapToButton(IDC_ADD_TO_CONTACT_BUTTON,AppUtility::GetResourceString(IDS_VIEW_CONTACT),
-                               IDB_VIEW_CONTACT_BG_PRESS_ICON,IDB_VIEW_CONTACT_PRESS_ICON,BTN_PRESS);
-       }
-       else
-       {
-               SetViewContacBitmapToButton(IDC_ADD_TO_CONTACT_BUTTON,AppUtility::GetResourceString(IDS_ADD_TO_CONTACTS),
-                               IDB_VIEW_CONTACT_BG_ICON,IDB_VIEW_CONTACT_ICON,BTN_NORMAL);
+       SetViewContacBitmapToButton(IDC_ADD_TO_CONTACT_BUTTON,AppUtility::GetResourceString(IDS_VIEW_CONTACT),
+                       IDB_VIEW_CONTACT_BG_PRESS_ICON,IDB_VIEW_CONTACT_PRESS_ICON,BTN_PRESS);
+}
 
-               SetViewContacBitmapToButton(IDC_ADD_TO_CONTACT_BUTTON,AppUtility::GetResourceString(IDS_ADD_TO_CONTACTS),
-                               IDB_VIEW_CONTACT_BG_PRESS_ICON,IDB_VIEW_CONTACT_PRESS_ICON,BTN_PRESS);
-       }
+void
+CallButtonsPanel::ShowAddContactButton(void)
+{
+       //Present show View Contact else show Add to contact
+       SetViewContacBitmapToButton(IDC_ADD_TO_CONTACT_BUTTON, AppUtility::GetResourceString(IDS_ADD_TO_CONTACTS),
+                       IDB_VIEW_CONTACT_BG_ICON, IDB_VIEW_CONTACT_ICON, BTN_NORMAL);
 
+       SetViewContacBitmapToButton(IDC_ADD_TO_CONTACT_BUTTON, AppUtility::GetResourceString(IDS_ADD_TO_CONTACTS),
+                       IDB_VIEW_CONTACT_BG_PRESS_ICON, IDB_VIEW_CONTACT_PRESS_ICON, BTN_PRESS);
 }
 
 result
@@ -442,7 +440,7 @@ CallButtonsPanel::SetBitmapsToButton(const String& buttonId, const String& butto
 
                //Create a new canvas
                Canvas* pCanvas = new (std::nothrow) Canvas;
-               pCanvas->Construct(Rectangle(0, 0, W_KEYPAD_BTN, H_KEYPAD_BTN));
+               pCanvas->Construct(Rectangle(0, 0, pButton->GetWidth(), pButton->GetHeight()));
 
                //Set Text to Canvas
                Point bitmapPos(0, 0);
@@ -475,7 +473,7 @@ CallButtonsPanel::SetBitmapsToButton(const String& buttonId, const String& butto
 
                case BTN_DIM:
                {
-                       pButton->SetDisabledBitmap(Point(0, 0), *pActualBgBmp);
+                       pButton->SetDisabledBackgroundBitmap(*pActualBgBmp);
                }
                break;
                }
@@ -572,7 +570,7 @@ CallButtonsPanel::SetEnrichedTextToButton(const String& buttonName, Canvas* pCan
 
        Font font;
        font.Construct(FONT_STYLE_PLAIN, IDI_TEXT_SIZE);
-       Dimension textDimension;
+       FloatDimension textDimension;
        font.GetTextExtent(buttonName, buttonName.GetLength(), textDimension);
        textDimension.height = textDimension.height + font.GetDescender();
        TextElement* pTextElement = new (std::nothrow) TextElement();
@@ -624,6 +622,13 @@ CallButtonsPanel::DisableKeysForOutgoingCall(void)
 }
 
 void
+CallButtonsPanel::ShowOrHideAddtoContactsButton(bool isEnabled)
+{
+       Button* pButton = static_cast<Button*>(GetControl(IDC_ADD_TO_CONTACT_BUTTON));
+       pButton->SetShowState(isEnabled);
+}
+
+void
 CallButtonsPanel::SetEndCallPanelState(bool isEnabled)
 {
        //Voice Call
@@ -637,6 +642,12 @@ CallButtonsPanel::SetEndCallPanelState(bool isEnabled)
        //Message
        pButton = static_cast<Button*>(GetControl(IDC_MSG_BUTTON));
        pButton->SetEnabled(isEnabled);
+
+       //AddToContact or Viewcontact button
+       pButton = static_cast<Button*>(GetControl(IDC_ADD_TO_CONTACT_BUTTON));
+       pButton->SetShowState(isEnabled);
+       pButton->SetEnabled(isEnabled);
+       /*pButton->Invalidate(true);*/
 }
 
 void