Tizen 2.0 Release
[apps/osp/Phone.git] / src / PhnCallButtonsPanel.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://floralicense.org/license/
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 /**
18  * @file        PhnCallButtonsPanel.cpp
19  * @brief       Base class for all Call forms
20  */
21 #include "PhnCallButtonsPanel.h"
22 #include "PhnAppUtility.h"
23 #include "PhnTypes.h"
24
25 using namespace Tizen::App;
26 using namespace Tizen::Base;
27 using namespace Tizen::Ui;
28 using namespace Tizen::Ui::Controls;
29 using namespace Tizen::Graphics;
30
31 //Constants - Scene name
32 const wchar_t* IDC_ADDJOINCALL_BUTTON = L"IDC_ADDJOINCALL_BUTTON";
33 const wchar_t* IDC_KEYPAD_BUTTON = L"IDC_KEYPAD_BUTTON";
34 const wchar_t* IDC_MUTE_BUTTON = L"IDC_MUTE_BUTTON";
35 const wchar_t* IDC_CONTACT_BUTTON = L"IDC_CONTACT_BUTTON";
36 const wchar_t* IDC_SPEAKER_BUTTON = L"IDC_SPEAKER_BUTTON";
37 const wchar_t* IDC_VOICECALL_BUTTON = L"IDC_VOICECALL_BUTTON";
38 const wchar_t* IDC_VIDEOCALL_BUTTON = L"IDC_VIDEOCALL_BUTTON";
39 const wchar_t* IDC_MSG_BUTTON = L"IDC_MSG_BUTTON";
40 const wchar_t* IDC_ENDCALL_BUTTON = L"IDC_ENDCALL_BUTTON";
41
42 //Button Dimensions
43 const int W_BG_BITMAP = 80;
44 const int H_BG_BITMAP = 80;
45 const int Y_BG_BITMAP_POS = 56;
46 const int IDI_TEXT_SIZE = 38;
47 const int IDI_VERTICAL_SPACE = 6;
48
49 CallButtonsPanel::CallButtonsPanel(void)
50 {
51 }
52
53 CallButtonsPanel::~CallButtonsPanel(void)
54 {
55         //Empty Implementation
56 }
57
58 bool
59 CallButtonsPanel::ConstructPanel(IActionEventListener* pEventListener, FormType parentFormType)
60 {
61         if (pEventListener == null)
62         {
63                 return false;
64         }
65
66         result r = E_SUCCESS;
67
68         //set action listener & save form state
69         __pActionListener = pEventListener;
70         __parentFormType = parentFormType;
71
72         switch (__parentFormType)
73         {
74         case FORMTYPE_ENDCALL:
75                 r = Construct(IDL_END_CALL_PANEL);
76                 break;
77
78         default:
79                 r = Construct(IDL_CALL_PANEL);
80                 break;
81         }
82
83         TryCatch(r == E_SUCCESS, , "CallButtonsPanel::Initialize() resource not found");
84
85         return true;
86 CATCH:
87         return false;
88 }
89
90 result
91 CallButtonsPanel::OnInitializing(void)
92 {
93         result r = E_FAILURE;
94
95         RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetParent()->GetLandscapeLayoutN());
96         if (pRelativeLayout != null)
97         {
98                 pRelativeLayout->SetHorizontalFitPolicy(*this, FIT_POLICY_PARENT);
99                 pRelativeLayout->SetRelation(*this, *GetParent(), RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
100                 delete pRelativeLayout;
101         }
102
103         pRelativeLayout = dynamic_cast<RelativeLayout*>(GetParent()->GetPortraitLayoutN());
104         if (pRelativeLayout != null)
105         {
106                 pRelativeLayout->SetHorizontalFitPolicy(*this, FIT_POLICY_PARENT);
107                 pRelativeLayout->SetRelation(*this, *GetParent(), RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
108                 delete pRelativeLayout;
109         }
110
111         //Set background bitmap
112         r = AddBackgroundBitmap();
113         if (IsFailed(r))
114         {
115                 return r;
116         }
117         //set buttons as child controls
118         switch (__parentFormType)
119         {
120         case FORMTYPE_ENDCALL:
121                 r = ConstructEndCallPanel();
122                 break;
123
124         default:
125                 r = ConstructActiveCallPanel();
126                 break;
127         }
128
129         if (IsFailed(r))
130         {
131                 return r;
132         }
133         SetButtonPosition();
134         Draw();
135         Show();
136         return r;
137 }
138
139 result
140 CallButtonsPanel::OnTerminating(void)
141 {
142         //remove all child controls...
143         RemoveAllControls();
144         return E_SUCCESS;
145 }
146
147 void
148 CallButtonsPanel::SetSpeakerButtonState(CommandIds cmdId)
149 {
150         //Speaker
151         String speakerButtonId(IDC_SPEAKER_BUTTON);
152         Button* pButton = static_cast<Button*>(GetControl(speakerButtonId));
153         //Check if Button exist and needs to change state.
154         if(pButton == null || pButton->GetActionId() == cmdId)
155         {
156                 return;
157         }
158
159         String btnName = AppUtility::GetResourceString(IDS_SPEAKER_BTN_NAME);
160         AddKeyPadActionListener(speakerButtonId, cmdId);
161         switch (cmdId)
162         {
163                 case IDA_SPEAKER:
164                 {
165                         SetBitmapsToButton(speakerButtonId, btnName, IDB_SPEAKER_OFF_ICON, BTN_NORMAL);
166                         SetBitmapsToButton(speakerButtonId, btnName, IDB_SPEAKER_OFF_PRESS_ICON, BTN_PRESS);
167                         SetBitmapsToButton(speakerButtonId, btnName, IDB_SPEAKER_OFF_DIM_ICON, BTN_DIM);
168                 }
169                 break;
170
171                 case IDA_SPEAKER_OFF:
172                 {
173                         SetBitmapsToButton(speakerButtonId, btnName, IDB_SPEAKER_ON_ICON, BTN_NORMAL);
174                         SetBitmapsToButton(speakerButtonId, btnName, IDB_SPEAKER_ON_PRESS_ICON, BTN_PRESS);
175                         SetBitmapsToButton(speakerButtonId, btnName, IDB_SPEAKER_ON_DIM_ICON, BTN_DIM);
176                 }
177                 break;
178
179                 default:
180                 break;
181         }
182 }
183
184 void
185 CallButtonsPanel::SetMuteButtonState(CommandIds cmdId)
186 {
187         String muteButtonId(IDC_MUTE_BUTTON);
188         Button* pButton = static_cast<Button*>(GetControl(muteButtonId));
189         //Check if Button exist and needs to change state.
190         if(pButton == null || pButton->GetActionId() == cmdId)
191         {
192                 return;
193         }
194
195         String btnName = AppUtility::GetResourceString(IDS_MUTE_BTN_NAME);
196         AddKeyPadActionListener(muteButtonId, cmdId);
197         switch(cmdId)
198         {
199                 case IDA_UNMUTE:
200                 {
201                         SetBitmapsToButton(muteButtonId, btnName, IDB_MUTE_ON_ICON, BTN_NORMAL);
202                         SetBitmapsToButton(muteButtonId, btnName, IDB_MUTE_ON_PRESS_ICON, BTN_PRESS);
203                         SetBitmapsToButton(muteButtonId, btnName, IDB_MUTE_ON_DIM_ICON, BTN_DIM);
204                 }
205                 break;
206
207                 case IDA_MUTE:
208                 {
209                         SetBitmapsToButton(muteButtonId, btnName, IDB_MUTE_OFF_ICON, BTN_NORMAL);
210                         SetBitmapsToButton(muteButtonId, btnName, IDB_MUTE_OFF_PRESS_ICON, BTN_PRESS);
211                         SetBitmapsToButton(muteButtonId, btnName, IDB_MUTE_OFF_DIM_ICON, BTN_DIM);
212                 }
213                 break;
214
215                 default:
216                 break;
217         }
218 }
219
220 void
221 CallButtonsPanel::SetKeypadButtonState(CommandIds cmdId)
222 {
223         String keypadButtonId(IDC_KEYPAD_BUTTON);
224         Button* pButton = static_cast<Button*>(GetControl(keypadButtonId));
225         //Check if Button exist and needs to change state.
226         if(pButton == null || pButton->GetActionId() == cmdId)
227         {
228                 return;
229         }
230
231         String btnName = AppUtility::GetResourceString(IDS_KEYPAD_BTN_NAME);
232         AddKeyPadActionListener(keypadButtonId, cmdId);
233         switch (cmdId)
234         {
235         case IDA_CLOSE_NUMKEYPAD:
236         {
237                 SetBitmapsToButton(keypadButtonId, btnName, IDB_HIDE_KEYPAD_ICON, BTN_NORMAL);
238                 SetBitmapsToButton(keypadButtonId, btnName, IDB_HIDE_KEYPAD_PRESS_ICON, BTN_PRESS);
239                 SetBitmapsToButton(keypadButtonId, btnName, IDB_HIDE_KEYPAD_DIM_ICON, BTN_DIM);
240         }
241         break;
242
243         case IDA_OPEN_NUMKEYPAD:
244         {
245                 SetBitmapsToButton(keypadButtonId, btnName, IDB_CLOSE_KEYPAD_ICON, BTN_NORMAL);
246                 SetBitmapsToButton(keypadButtonId, btnName, IDB_CLOSE_KEYPAD_PRESS_ICON, BTN_PRESS);
247                 SetBitmapsToButton(keypadButtonId, btnName, IDB_CLOSE_KEYPAD_DIM_ICON, BTN_DIM);
248         }
249         break;
250
251         default:
252         break;
253         }
254 }
255
256 result
257 CallButtonsPanel::AddBackgroundBitmap(void)
258 {
259         result r = E_FAILURE;
260
261         Rectangle panelRect = GetBounds();
262         //Set BackGround bitmap
263         Bitmap* pBgBitmap = null;
264         AppResource* pAppResource = AppResource::GetInstance();
265         if (pAppResource)
266         {
267                 pBgBitmap = pAppResource->GetBitmapN(IDB_BACKGROUND_BITMAP);
268                 if (pBgBitmap)
269                 {
270                         Label* pBackgroundLabel = new (std::nothrow) Label();
271                         pBackgroundLabel->Construct(Rectangle(0, 1, panelRect.width, panelRect.height), L"");
272                         pBackgroundLabel->SetBackgroundBitmap(*pBgBitmap);
273                         r = AddControl(*pBackgroundLabel);
274
275                         //always display in background
276                         SetControlAlwaysAtBottom(*pBackgroundLabel, true);
277
278                         delete pBgBitmap;
279                         pBgBitmap = null;
280                 }
281         }
282         return r;
283 }
284
285 result
286 CallButtonsPanel::ConstructEndCallPanel(void)
287 {
288         result r = E_SUCCESS;
289         Rectangle relativeCtrlRect = GetBounds();
290
291         //Voice Call
292         String voiceButtonId(IDC_VOICECALL_BUTTON);
293         String btnName = AppUtility::GetResourceString(IDS_VOICE_CALL_BTN_NAME);
294         SetBitmapsToButton(voiceButtonId, btnName, IDB_VOICE_CALL_ICON, BTN_NORMAL);
295         SetBitmapsToButton(voiceButtonId, btnName, IDB_VOICE_CALL_PRESS_ICON, BTN_PRESS);
296         SetBitmapsToButton(voiceButtonId, btnName, IDB_VOICE_CALL_DIM_ICON, BTN_DIM);
297         AddKeyPadActionListener(voiceButtonId, IDA_VOICE_CALL);
298
299         //Video Call
300         String videoButtonId(IDC_VIDEOCALL_BUTTON);
301         btnName = AppUtility::GetResourceString(IDS_VIDEO_CALL_BTN_NAME);
302         SetBitmapsToButton(videoButtonId, btnName, IDB_VIDEO_CALL_ICON, BTN_NORMAL);
303         SetBitmapsToButton(videoButtonId, btnName, IDB_VIDEO_CALL_PRESS_ICON, BTN_PRESS);
304         SetBitmapsToButton(videoButtonId, btnName, IDB_VIDEO_CALL_DIM_ICON, BTN_DIM);
305         AddKeyPadActionListener(videoButtonId, IDA_VIDEO_CALL);
306
307         //Message
308         String msgButtonId(IDC_MSG_BUTTON);
309         btnName = AppUtility::GetResourceString(IDS_MSG_BTN_NAME);
310         SetBitmapsToButton(msgButtonId, btnName, IDB_MESSAGE_ICON, BTN_NORMAL);
311         SetBitmapsToButton(msgButtonId, btnName, IDB_MESSAGE_PRESS_ICON, BTN_PRESS);
312         SetBitmapsToButton(msgButtonId, btnName, IDB_MESSAGE_DIM_ICON, BTN_DIM);
313         AddKeyPadActionListener(msgButtonId, IDA_MESSAGE);
314
315         return r;
316 }
317
318 result
319 CallButtonsPanel::ConstructActiveCallPanel(void)
320 {
321         result r = E_SUCCESS;
322
323         //End Call
324         String endButtonId(IDC_ENDCALL_BUTTON);
325         String btnName = AppUtility::GetResourceString(IDS_ENDCALL_BTN_NAME);
326         SetBitmapsToButton(endButtonId, btnName, IDB_END_CALL_ICON, BTN_NORMAL);
327         SetBitmapsToButton(endButtonId, btnName, IDB_END_CALL_PRESS_ICON, BTN_PRESS);
328         SetBitmapsToButton(endButtonId, btnName, IDB_END_CALL_DIM_ICON, BTN_DIM);
329
330         //Add or Join call based on form state
331         String addJoinButtonId(IDC_ADDJOINCALL_BUTTON);
332         switch (__parentFormType)
333         {
334         case FORMTYPE_OUTGOINGCALL:
335         case FORMTYPE_ACTIVECALL:
336         case FORMTYPE_EMERGENCYOUTGOINGCALL:
337         case FORMTYPE_EMERGENCYACTIVECALL:
338         {
339                 //End call listener
340                 AddKeyPadActionListener(endButtonId, IDA_END_CALL);
341                 //Add Call
342                 btnName = AppUtility::GetResourceString(IDS_ADDCALL_BTN_NAME);
343                 SetBitmapsToButton(addJoinButtonId, btnName, IDB_ADD_CALL_ICON, BTN_NORMAL);
344                 SetBitmapsToButton(addJoinButtonId, btnName, IDB_ADD_CALL_PRESS_ICON, BTN_PRESS);
345                 SetBitmapsToButton(addJoinButtonId, btnName, IDB_ADD_CALL_DIM_ICON, BTN_DIM);
346                 AddKeyPadActionListener(addJoinButtonId, IDA_ADD_CALL);
347         }
348         break;
349
350         case FORMTYPE_ACTIVECONFCALL:
351         {
352                 //End call listener
353                 AddKeyPadActionListener(endButtonId, IDA_END_CONF_CALL);
354                 //Add Call
355                 btnName = AppUtility::GetResourceString(IDS_ADDCALL_BTN_NAME);
356                 SetBitmapsToButton(addJoinButtonId, btnName, IDB_ADD_CALL_ICON, BTN_NORMAL);
357                 SetBitmapsToButton(addJoinButtonId, btnName, IDB_ADD_CALL_PRESS_ICON, BTN_PRESS);
358                 SetBitmapsToButton(addJoinButtonId, btnName, IDB_ADD_CALL_DIM_ICON, BTN_DIM);
359                 AddKeyPadActionListener(addJoinButtonId, IDA_ADD_CALL);
360         }
361         break;
362
363         case FORMTYPE_MULTIPLECALLS:
364         {
365                 //End call listener
366                 AddKeyPadActionListener(endButtonId, IDA_END_CALL);
367                 //Join Call
368                 btnName = AppUtility::GetResourceString(IDS_JOINCALL_BTN_NAME);
369                 SetBitmapsToButton(addJoinButtonId, btnName, IDB_JOIN_CALL_ICON, BTN_NORMAL);
370                 SetBitmapsToButton(addJoinButtonId, btnName, IDB_JOIN_CALL_PRESS_ICON, BTN_PRESS);
371                 SetBitmapsToButton(addJoinButtonId, btnName, IDB_JOIN_CALL_DIM_ICON, BTN_DIM);
372                 AddKeyPadActionListener(addJoinButtonId, IDA_JOIN_CALL);
373         }
374         break;
375
376         default:
377                 break;
378         }
379
380         //Keypad is closed, bt default
381         SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
382         //Speaker is off, by default
383         SetSpeakerButtonState(IDA_SPEAKER);
384         //Mute is off, by default
385         SetMuteButtonState(IDA_MUTE);
386         //Contact
387         String contactButtonId(IDC_CONTACT_BUTTON);
388         btnName = AppUtility::GetResourceString(IDS_CONTACT_BTN_NAME);
389         SetBitmapsToButton(contactButtonId, btnName, IDB_CONTACT_ICON, BTN_NORMAL);
390         SetBitmapsToButton(contactButtonId, btnName, IDB_CONTACT_PRESS_ICON, BTN_PRESS);
391         SetBitmapsToButton(contactButtonId, btnName, IDB_CONTACT_DIM_ICON, BTN_DIM);
392         AddKeyPadActionListener(contactButtonId, IDA_OPEN_CONTACTS);
393
394         //ToDO: For now disabling the contact button as there is no way to launch contact app control
395         // just for viewwing
396         Button* pButton = static_cast<Button*>(GetControl(IDC_CONTACT_BUTTON));
397         pButton->SetEnabled(false);
398         //disable all keys except 'Speaker' keys while dialing outgoing call
399         if (__parentFormType == FORMTYPE_OUTGOINGCALL || __parentFormType == FORMTYPE_EMERGENCYOUTGOINGCALL
400                         || __parentFormType == FORMTYPE_EMERGENCYACTIVECALL)
401         {
402                 DisableKeysForOutgoingCall();
403         }
404
405         return r;
406 }
407
408 void
409 CallButtonsPanel::SetBitmapsToButton(const String& buttonId, const String& buttonName, const String& imgPath, ButtonState state)
410 {
411         Button* pButton = static_cast<Button*>(GetControl(buttonId));
412         if (pButton != null)
413         {
414                 //Fetch Bitmap from resource
415                 Bitmap* pBitmap = AppUtility::GetBitmapFromResourcesN(imgPath,
416                                 W_BG_BITMAP, H_BG_BITMAP);
417
418                 //Create a new canvas
419                 Canvas* pCanvas = new (std::nothrow) Canvas;
420                 pCanvas->Construct(Rectangle(0, 0, pButton->GetBounds().width, pButton->GetBounds().height));
421
422                 //Set Text to Canvas
423                 Point bitmapPos(0, 0);
424                 bitmapPos.SetPosition(((pCanvas->GetBounds().width - pBitmap->GetWidth()) / 2), Y_BG_BITMAP_POS);
425                 SetEnrichedTextToButton(buttonName, pCanvas, state, (bitmapPos.y + pBitmap->GetHeight() + IDI_VERTICAL_SPACE));
426
427                 //set normal bitmap to canvas
428                 pCanvas->DrawBitmap(Rectangle(bitmapPos, Dimension(pBitmap->GetWidth(), pBitmap->GetHeight())), *pBitmap);
429
430                 //Set the final Bitmap to Button
431                 Bitmap* pActualBgBmp = new (std::nothrow) Bitmap();
432                 pActualBgBmp->Construct(*pCanvas, pCanvas->GetBounds());
433
434                 switch (state)
435                 {
436                 case BTN_NORMAL:
437                 {
438                         pButton->SetNormalBackgroundBitmap(*pActualBgBmp);
439                 }
440                 break;
441
442                 case BTN_PRESS:
443                 {
444                         Bitmap* highlightedBmp = AppUtility::GetBitmapFromResourcesN(L"C01-1_icon_button_press.png",236,237);
445                         if(highlightedBmp != null)
446                         {
447                                 pButton->SetHighlightedBackgroundBitmap(*highlightedBmp);
448                                 delete highlightedBmp;
449                                 highlightedBmp = null;
450                         }
451                         pButton->SetPressedBitmap(Point(0,0),*pActualBgBmp);
452                 }
453                 break;
454
455                 case BTN_DIM:
456                 {
457                         pButton->SetDisabledBitmap(Point(0, 0), *pActualBgBmp);
458                 }
459                 break;
460                 }
461                 pButton->Invalidate(true);
462
463                 delete pBitmap;
464                 delete pActualBgBmp;
465                 delete pCanvas;
466         }
467 }
468
469 void
470 CallButtonsPanel::SetEnrichedTextToButton(const String& buttonName, Canvas* pCanvas, ButtonState state, int verticalPos)
471 {
472         //find text color
473         Color textColor(255, 255, 255);
474         switch (state)
475         {
476         case BTN_NORMAL:
477                 textColor.SetAlpha(255);
478                 break;
479
480         case BTN_PRESS:
481                 textColor.SetAlpha(127);
482                 break;
483
484         case BTN_DIM:
485                 textColor.SetAlpha(77);
486                 break;
487         }
488
489         Font font;
490         font.Construct(FONT_STYLE_PLAIN, IDI_TEXT_SIZE);
491         Dimension textDimension;
492         font.GetTextExtent(buttonName, buttonName.GetLength(), textDimension);
493         textDimension.height = textDimension.height + font.GetDescender();
494         TextElement* pTextElement = new (std::nothrow) TextElement();
495         pTextElement->Construct(buttonName);
496         pTextElement->SetTextColor(textColor);
497         pTextElement->SetFont(font);
498
499         EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
500         pEnrichedText->Construct(textDimension);
501         pEnrichedText->Add(*pTextElement);
502
503         //Draw text
504         Point textPos(((pCanvas->GetBounds().width - pEnrichedText->GetWidth()) / 2), verticalPos);
505         pCanvas->DrawText(textPos, *pEnrichedText);
506
507         // Cleans up
508         pEnrichedText->RemoveAll(true);
509         delete pEnrichedText;
510 }
511
512 void
513 CallButtonsPanel::AddKeyPadActionListener(const String& buttonId, CommandIds cmdId)
514 {
515         Button* pButton = static_cast<Button*>(GetControl(buttonId));
516         if (pButton != null)
517         {
518                 pButton->SetActionId(cmdId);
519                 pButton->AddActionEventListener(*__pActionListener);
520         }
521 }
522
523 void
524 CallButtonsPanel::DisableKeysForOutgoingCall(void)
525 {
526         //add call
527         EnableAddCallButton(false);
528
529         //keypad
530         Button* pButton = static_cast<Button*>(GetControl(IDC_KEYPAD_BUTTON));
531         pButton->SetEnabled(false);
532
533         //mute
534         pButton = static_cast<Button*>(GetControl(IDC_MUTE_BUTTON));
535         pButton->SetEnabled(false);
536
537         //contact
538         pButton = static_cast<Button*>(GetControl(IDC_CONTACT_BUTTON));
539         pButton->SetEnabled(false);
540 }
541
542 void
543 CallButtonsPanel::SetEndCallPanelState(bool isEnabled)
544 {
545         //Voice Call
546         Button* pButton = static_cast<Button*>(GetControl(IDC_VOICECALL_BUTTON));
547         pButton->SetEnabled(isEnabled);
548
549         //Video Call
550         pButton = static_cast<Button*>(GetControl(IDC_VIDEOCALL_BUTTON));
551         pButton->SetEnabled(isEnabled);
552
553         //Message
554         pButton = static_cast<Button*>(GetControl(IDC_MSG_BUTTON));
555         pButton->SetEnabled(isEnabled);
556 }
557
558 void
559 CallButtonsPanel::EnableAddCallButton(bool enable)
560 {
561         //add call
562         Button* pButton = static_cast<Button*>(GetControl(IDC_ADDJOINCALL_BUTTON));
563         if(pButton != null && pButton->GetActionId() == IDA_ADD_CALL)
564         {
565                 pButton->SetEnabled(enable);
566         }
567 }
568
569 void
570 CallButtonsPanel::SetButtonPosition(void)
571 {
572         switch (__parentFormType)
573                 {
574                 case FORMTYPE_ENDCALL:
575                 {
576                         //Voice Call
577                         Button* pButton = static_cast<Button*>(GetControl(IDC_VOICECALL_BUTTON));
578                         SetControlAlwaysOnTop(*pButton,true);
579
580                         //Video Call
581                         pButton = static_cast<Button*>(GetControl(IDC_VIDEOCALL_BUTTON));
582                         SetControlAlwaysOnTop(*pButton,true);
583
584                         //Message
585                         pButton = static_cast<Button*>(GetControl(IDC_MSG_BUTTON));
586                         SetControlAlwaysOnTop(*pButton,true);
587                         Label* pLabel = static_cast<Label*>(GetControl(L"IDC_LABEL1"));
588                         SetControlAlwaysOnTop(*pLabel,true);
589                         pLabel = static_cast<Label*>(GetControl(L"IDC_LABEL5"));
590                         SetControlAlwaysOnTop(*pLabel,true);
591                         pLabel = static_cast<Label*>(GetControl(L"IDC_LABEL6"));
592                         SetControlAlwaysOnTop(*pLabel,true);
593                         pLabel = static_cast<Label*>(GetControl(L"IDC_LABEL7"));
594                         SetControlAlwaysOnTop(*pLabel,true);
595                         pLabel = static_cast<Label*>(GetControl(L"IDC_LABEL8"));
596                         SetControlAlwaysOnTop(*pLabel,true);
597                 }
598                         break;
599
600                 default:
601                 {
602                         //keypad
603                         Button* pButton = static_cast<Button*>(GetControl(IDC_KEYPAD_BUTTON));
604                         SetControlAlwaysOnTop(*pButton,true);
605                         //mute
606                         pButton = static_cast<Button*>(GetControl(IDC_MUTE_BUTTON));
607                         SetControlAlwaysOnTop(*pButton,true);
608                         //contact
609                         pButton = static_cast<Button*>(GetControl(IDC_CONTACT_BUTTON));
610                         SetControlAlwaysOnTop(*pButton,true);
611                         //Add or Join call based on form state
612                         pButton = static_cast<Button*>(GetControl(IDC_ADDJOINCALL_BUTTON));
613                         SetControlAlwaysOnTop(*pButton,true);
614                         //End call
615                         pButton = static_cast<Button*>(GetControl(IDC_ENDCALL_BUTTON));
616                         SetControlAlwaysOnTop(*pButton,true);
617                         //Speaker
618                         pButton = static_cast<Button*>(GetControl(IDC_SPEAKER_BUTTON));
619                         SetControlAlwaysOnTop(*pButton,true);
620                         Label* pLabel = static_cast<Label*>(GetControl(L"IDC_LABEL1"));
621                         SetControlAlwaysOnTop(*pLabel,true);
622                         pLabel = static_cast<Label*>(GetControl(L"IDC_LABEL1"));
623                         SetControlAlwaysOnTop(*pLabel,true);
624                         pLabel = static_cast<Label*>(GetControl(L"IDC_LABEL2"));
625                         SetControlAlwaysOnTop(*pLabel,true);
626                         pLabel = static_cast<Label*>(GetControl(L"IDC_LABEL4"));
627                         SetControlAlwaysOnTop(*pLabel,true);
628                         pLabel = static_cast<Label*>(GetControl(L"IDC_LABEL5"));
629                         SetControlAlwaysOnTop(*pLabel,true);
630                         pLabel = static_cast<Label*>(GetControl(L"IDC_LABEL6"));
631                         SetControlAlwaysOnTop(*pLabel,true);
632                         pLabel = static_cast<Label*>(GetControl(L"IDC_LABEL7"));
633                         SetControlAlwaysOnTop(*pLabel,true);
634                         pLabel = static_cast<Label*>(GetControl(L"IDC_LABEL8"));
635                         SetControlAlwaysOnTop(*pLabel,true);
636                         pLabel = static_cast<Label*>(GetControl(L"IDC_LABEL9"));
637                         SetControlAlwaysOnTop(*pLabel,true);
638                         pLabel = static_cast<Label*>(GetControl(L"IDC_LABEL10"));
639                         SetControlAlwaysOnTop(*pLabel,true);
640                         pLabel = static_cast<Label*>(GetControl(L"IDC_LABEL11"));
641                         SetControlAlwaysOnTop(*pLabel,true);
642                         pLabel = static_cast<Label*>(GetControl(L"IDC_LABEL12"));
643                         SetControlAlwaysOnTop(*pLabel,true);
644
645                 }
646                         break;
647                 }
648 }