tizen2.1 code merge
[apps/osp/Call.git] / inc / CallActiveCallForm.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.1 (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                CallActiveCallForm.h
19  * @brief               This is the header file for the %ActiveCallForm class.
20  *
21  * This header file contains the declarations for %ActiveCallForm class.
22  */
23 #ifndef _PHN_ACTIVE_CALL_FORM_H_
24 #define _PHN_ACTIVE_CALL_FORM_H_
25
26 #include <FBase.h>
27 #include <FUi.h>
28 #include "CallBaseForm.h"
29 #include "CallIAppStateChangeListner.h"
30
31 class CallButtonsPanel;
32 class DtmfKeyPadPanel;
33 class AppCallInfo;
34
35 /**
36  * @class ActiveCallForm
37  * @brief This class presents a form based UI for dialing call, active call, conference call,
38  *      single active call, multiple active call scenarios.
39  *
40  */
41 class ActiveCallForm
42         : public BaseForm
43         , public IAppStateChangeListener
44         , public Tizen::Ui::Controls::IListViewItemEventListener
45         , public Tizen::Ui::Controls::IListViewItemProvider
46         , public Tizen::Ui::Scenes::ISceneEventListener
47         , public Tizen::Base::Runtime::ITimerEventListener
48         , public Tizen::Ui::IOrientationEventListener
49 {
50 public:
51         ActiveCallForm(FormType formType);
52         virtual ~ActiveCallForm(void);
53         //From BaseForm
54         virtual void Initialize(void);
55         void SetSwapInProgress(bool progress);
56
57 public:
58         virtual result OnInitializing(void);
59         virtual result OnTerminating(void);
60         virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
61
62         virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs);
63         virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId);
64
65         virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
66
67         // Handle the changes(e.g. participant ended) in conference call
68         void HandleConfCallChanged(void);
69         // Used to update multiple call screen
70         void UpdateMultipleCallScreen(Tizen::Base::Collection::IListT<AppCallInfo>& activeCallsList);
71
72         //From IOrientationEventListener
73         virtual void OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus);
74         //From IAppStateChangeListener
75         virtual void OnForeground(void);
76         virtual void OnBackground(void){};
77         virtual void OnScreenOff(void){};
78
79 private:
80         // Create the call buttons panel and add to form
81         result InitializeCallButtonsPanel(void);
82         // Set the correct bitmaps and action listeners for swap button
83         void InitializeSwapButton(void);
84         // Set the action listener for manage conf call button
85         void InitializeManageConfCallButton(void);
86         // Set the correct bitmaps and action listeners for hold button
87         void InitializeHoldButton(void);
88         // Set the state of the hold button according to call state
89         void SetHoldButtonStatus(bool toHoldCall);
90         // This function is used to fetch person details using phone number.
91         void ShowPersonDetails(const Tizen::Base::String& phoneNumber, const Tizen::Base::String& contactLblName, const Tizen::Base::String& nameLblName, bool isSecondCaller, AppCallInfo* pCallInfo);
92         // Method to show phone number on screen for all calls except conference call.
93         void ShowPhoneNumber(const Tizen::Base::String& phoneNumber, const Tizen::Base::String& contactLblName);
94         // Method to show caller name for all calls.
95         void ShowCallerName(const Tizen::Base::String& callerName, const Tizen::Base::String& nameLblName);
96         // This function draws the caller's photo onto screen.
97         void ShowCallerPhoto(Tizen::Graphics::Bitmap* pPhotoId, bool isSecondCaller);
98         //This function is used to show small Thumbnail size photo of caller.
99         void ShowCallersPhotoThumbnail(const Tizen::Graphics::Bitmap& pPhotoId);
100         // Method to show call duration/state(held) for call in progress
101         void ShowTimerInfo(const Tizen::Base::String& timerLblName, bool isOnHold, long long startTime = 0);
102         // Method to set the show state of all the labels when DTMF keypad is launched
103         void SetShowStateOnKeypad(bool showState);
104         // Method to populate the list shown on "More" option
105         void CreateMoreOptionsMenuList(void);
106         // Method to destroy the list shown on "More" option
107         void DestroyMoreOptionsMenuList(void);
108         //Used to Show DTMF keypad
109         void ShowDTMFKeypad(void);
110         //Used to hide DTMF Keypad
111         void HideDTMFKeypad(void);
112         //Used to show text in text field
113         void SetTextToDTMFTextField(const Tizen::Base::String& dtmfStr);
114         // Set hold button status
115         void SetHoldButtonShowState(bool showState);
116
117         //From IListViewItemEventListener
118         virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state);
119         virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status);
120         virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction);
121         virtual void OnListViewItemLongPressed(Tizen::Ui::Controls::ListView& listView, int index, int elementId, bool& invokeListViewItemCallback);
122
123         //From IListViewItemProvider
124         virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int index, int itemWidth);
125         virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth);
126         virtual int GetItemCount(void);
127         //Method to show thumbnail image
128         void ShowThumbnailImage(const Tizen::Graphics::Bitmap* pPhotoId,Tizen::Base::String& photoLabel);
129         //Check if swap in progress
130         bool IsSwapInProgress(void);
131
132 private:
133         //Start time for Active call
134         long long __activeCallStartTime;
135         //Timer used to show call time
136         Tizen::Base::Runtime::Timer* __pActiveCallTimer;
137         //Custom Buttons Panel
138         CallButtonsPanel* __pCallButtonsPanel;
139         DtmfKeyPadPanel* __pDTMFKeypad;
140         //Option Menu List for conference call
141         Tizen::Ui::Controls::ListView* __pMoreOptionsList;
142         Tizen::Ui::Controls::Label* __pMoreOptionsListAnchor;
143         Tizen::Ui::Controls::Label* __pSmallPhotoLabel;
144         Tizen::Base::String __DtmfString;
145         AppCallInfo* __pActiveCallInfo;
146         AppCallInfo* __pHeldCallInfo;
147         bool            __isSwapInProgress;
148 };
149
150 #endif  //_PHN_ACTIVE_CALL_FORM_H_