1.Landscape support for incoming call
[apps/osp/Call.git] / src / CallIncomingCallForm.cpp
index ad4175f..52de617 100644 (file)
@@ -119,6 +119,11 @@ static const wchar_t* IDC_MSG_TABLEVIEW = L"IDC_MSG_TABLEVIEW";
 static const wchar_t* IDC_CALLER_LABEL = L"IDC_CALLER_LABEL";
 static const wchar_t* IDC_NUMBER_LABEL = L"IDC_NUMBER_LABEL";
 static const wchar_t* IDC_BIG_PHOTO_LABEL = L"IDC_BIG_PHOTO_LABEL";
+static const wchar_t* IDC_CALLHANDEL_PANEL = L"IDC_CALLHANDEL_PANEL";
+static const wchar_t* IDC_ACCEPT_LABEL = L"IDC_ACCEPT_LABEL";
+static const wchar_t* IDC_REJECT_LEBEL = L"IDC_REJECT_LEBEL";
+static const wchar_t* IDC_ACCEPT_ARROW = L"IDC_ACCEPT_ARROW_";
+static const wchar_t* IDC_REJECT_ARROW = L"IDC_REJECT_ARROW_";
 const wchar_t* IDS_REJECT_MESSAGE_BTN = L"IDS_REJECT_MESSAGE_BTN";
 const wchar_t* IDS_LIST_SEND_BUTTON = L"IDS_LIST_SEND_BUTTON";
 const wchar_t* IDS_NO_MESSAGE_STR = L"IDS_NO_MESSAGE_STR";
@@ -195,7 +200,7 @@ IncomingCallForm::OnInitializing(void)
 
        VisualElement* pFormVisElem = new (std::nothrow) VisualElement();
        r = pFormVisElem->Construct();
-       pFormVisElem->SetBounds(FloatRectangle(GetClientAreaBounds().x, GetClientAreaBounds().y, GetClientAreaBounds().width, GetClientAreaBounds().height));
+       pFormVisElem->SetBounds(FloatRectangle(GetBounds().x, GetBounds().y, GetBounds().width, GetBounds().height));
        pFormVisElem->SetShowState(true);
        pFormVisElem->SetOpacity(1.0f);
        pFormVisElem->SetName(IDI_FORM_VISUAL_ELE_NAME);
@@ -206,7 +211,7 @@ IncomingCallForm::OnInitializing(void)
                pCanvas->Clear();
                pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
                pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
-               pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(GetClientAreaBounds().x, GetClientAreaBounds().y, GetClientAreaBounds().width, GetClientAreaBounds().height));
+               pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(GetBounds().x, GetBounds().y, GetBounds().width, GetBounds().height));
                delete pCanvas;
                pCanvas = null;
        }
@@ -249,14 +254,12 @@ IncomingCallForm::OnInitializing(void)
        Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL, true));
         int yPos = pPhotoLbl->GetX()+pPhotoLbl->GetHeight()+ Y_CALL_PANEL;
 
-       __pCallHandlePanel = new (std::nothrow) Panel();
-       r = __pCallHandlePanel->Construct(Rectangle(X_CALL_PANEL, yPos, GetClientAreaBounds().width - X_CALL_PANEL, H_CALL_PANEL), GROUP_STYLE_NONE);
+       __pCallHandlePanel = static_cast<Panel*>(GetControl(IDC_CALLHANDEL_PANEL, true));
        __pCallHandlePanel->AddTouchEventListener(*this);
-       AddControl(*__pCallHandlePanel);
        __pCallHandlePanel->SetBackgroundColor(COLOR_SWIPE_PANEL);
        VisualElement* pCallPanelVisElem = new (std::nothrow) VisualElement();
        r = pCallPanelVisElem->Construct();
-       pCallPanelVisElem->SetBounds(FloatRectangle(X_CALL_PANEL, yPos, GetClientAreaBounds().width, H_CALL_PANEL));
+       pCallPanelVisElem->SetBounds(FloatRectangle(__pCallHandlePanel->GetBoundsF()));
        pCallPanelVisElem->SetShowState(true);
        pCallPanelVisElem->SetOpacity(1.0f);
        pCallPanelVisElem->SetName(IDI_PANEL_VISUAL_ELE_NAME);
@@ -273,15 +276,13 @@ IncomingCallForm::OnInitializing(void)
                pCanvas = null;
        }
        //Lock Label for animation
-       __pAcceptLabel = new (std::nothrow) Label();
-       r = __pAcceptLabel->Construct(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), L"");
+       __pAcceptLabel = static_cast<Label*>(GetControl(IDC_ACCEPT_LABEL, true));
        __pAcceptLabel->SetBackgroundColor(COLOR_SWIPE_PANEL);
        __pAcceptLabel->AddTouchEventListener(*this);
-       __pCallHandlePanel->AddControl(*__pAcceptLabel);
        //left dial icon
        __pAcceptVisElem = new (std::nothrow) VisualElement();
        r = __pAcceptVisElem->Construct();
-       __pAcceptVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
+       __pAcceptVisElem->SetBounds(FloatRectangle(0, 0, __pAcceptLabel->GetWidth(), __pAcceptLabel->GetHeight()));
        __pAcceptVisElem->SetShowState(true);
        __pAcceptVisElem->SetOpacity(1.0f);
        __pAcceptVisElem->SetName(IDI_ACCEPT_VISUAL_ELE_NAME);
@@ -300,10 +301,8 @@ IncomingCallForm::OnInitializing(void)
                pCanvas = null;
        }
        //UnLock Label for animation
-       __pRejectLabel = new (std::nothrow) Label();
-       r = __pRejectLabel->Construct(Rectangle(REJECT_LABEL_X_OFFSET, 0, W_DIAL_LABEL, H_DIAL_LABEL), L"");
+       __pRejectLabel = static_cast<Label*>(GetControl(IDC_REJECT_LEBEL, true));
        __pRejectLabel->AddTouchEventListener(*this);
-       __pCallHandlePanel->AddControl(*__pRejectLabel);
        __pRejectLabel->SetBackgroundColor(COLOR_SWIPE_PANEL);
        SetControlAlwaysAtBottom(*__pCallHandlePanel, true);
 
@@ -337,10 +336,10 @@ IncomingCallForm::OnInitializing(void)
        int x = X_ARROW_LABEL_STARTPOS;
        for (int index = 0; index < COUNT_ARROW_ELEMENTS; index++)
        {
-               __pAcceptArrowLabel = new (std::nothrow) Label();
-               r = __pAcceptArrowLabel->Construct(Rectangle(x, Y_ARROW_LABEL, W_ARROW_LABEL, H_ARROW_LABEL), L"");
+               String LabelName(IDC_ACCEPT_ARROW);
+               LabelName.Append(index+1);
+               __pAcceptArrowLabel = static_cast<Label*>(GetControl(LabelName, true));
                __pAcceptArrowLabel->AddTouchEventListener(*this);
-               __pCallHandlePanel->AddControl(*__pAcceptArrowLabel);
                __pAcceptArrowLabelsList->Add(*__pAcceptArrowLabel);
                __pAcceptArrowVisElem = new (std::nothrow) VisualElement();
                r = __pAcceptArrowVisElem->Construct();
@@ -373,10 +372,10 @@ IncomingCallForm::OnInitializing(void)
        x = X_ARROW_REJECT_LABEL_STARTPOS;
        for (int index = 0; index < COUNT_ARROW_ELEMENTS; index++)
        {
-               __pRejectArrowLabel = new (std::nothrow) Label();
-               r = __pRejectArrowLabel->Construct(Rectangle(x, Y_ARROW_LABEL, W_ARROW_LABEL, H_ARROW_LABEL), L"");
+               String LabelName(IDC_REJECT_ARROW);
+               LabelName.Append(index+1);
+               __pRejectArrowLabel = static_cast<Label*>(GetControl(LabelName, true));
                __pRejectArrowLabel->AddTouchEventListener(*this);
-               __pCallHandlePanel->AddControl(*__pRejectArrowLabel);
                __pRejectArrowLabelsList->Add(*__pRejectArrowLabel);
                __pRejectArrowVisElem = new (std::nothrow) VisualElement();
                r = __pRejectArrowVisElem->Construct();
@@ -432,6 +431,7 @@ IncomingCallForm::ShowRejectMessageFooter(void)
        Footer* pFooter = GetFooter();
        if(pFooter != null)
        {
+               AppLogDebug("SetShowState");
                pFooter->SetShowState(true);
 
        }
@@ -726,6 +726,7 @@ IncomingCallForm::OnActionPerformed(const Control& source, int actionId)
 void
 IncomingCallForm::OnSceneActivatedN(const SceneId& previousSceneId,    const SceneId& currentSceneId, IList* pArgs)
 {
+       AddOrientationEventListener(*this);
        if(__pCallPresentor == null)
        {
                __pCallPresentor = CallPresentationModel::GetInstance();
@@ -824,6 +825,7 @@ IncomingCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneI
 void
 IncomingCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
 {
+       RemoveOrientationEventListener(*this);
        if (__pSmallPhotoLabel != null)
        {
                RemoveControl(*__pSmallPhotoLabel);
@@ -1556,3 +1558,17 @@ IncomingCallForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
        RequestRedraw(true);
 
 }
+
+void
+IncomingCallForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
+{
+       Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
+       if (pButtonRejectMessage)
+       {
+               SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
+                                                                          IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, false);
+               SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
+                                                                          IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, true);
+       }
+
+}