Initialize Tizen 2.3
[apps/osp/Call.git] / inc / CallCommonUtils.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   CallCommonUtils.h
19  *  @brief      This is the header file for the %DialUtil class.
20  *
21  *  This header file contains the declarations for commonly used functions.
22  */
23 #ifndef _PHN_COMMON_UTILS_H_
24 #define _PHN_COMMON_UTILS_H_
25
26 #include <FUi.h>
27 #include <FBase.h>
28
29 enum DialerFontStyle
30 {
31         FONT_CALLING_TEXT,
32         FONT_KEYPAD_NUMBER,
33         FONT_KEYPAD_TEXT,
34         FONT_KEYPAD_P,
35         FONT_KEYPAD_PLUS,
36         FONT_KEYPAD_CANCEL,
37         FONT_SUGGESTION_NAME,
38         FONT_SUGGESTION_MOBILE,
39         FONT_SUGGESTION_NUMBER,
40         FONT_SUGGESTION_LIST_NUMBER,
41         FONT_HIGHLIGHT_SEARCH_KEYWORD
42 };
43
44 //Command Ids used in Dialer tab. Always append new command ids at bottom.
45 enum DialCommandIds
46 {
47         NUM_KEY1 = 1,
48         NUM_KEY2,
49         NUM_KEY3,
50         NUM_KEY4,
51         NUM_KEY5,
52         NUM_KEY6,
53         NUM_KEY7,
54         NUM_KEY8,
55         NUM_KEY9,
56         PAUSE_KEY,
57         NUM_KEY0,
58         HASH_KEY,
59         VIDEOCALL_KEY,
60         CALL_KEY,
61         CLEAR_KEY,
62         CANCEL_KEY,
63         DIAL_CMD_TOTAL_COUNT,
64 };
65
66 enum LogContextActionIds
67 {
68         IDA_LIST_ELEMENT_CALL = 105,
69         IDA_LIST_ELEMENT_VIDEO_CALL,
70         IDA_LIST_ELEMENT_MESSAGE,
71         IDA_LIST_ELEMENT_DELETE,
72
73 };
74
75
76 extern const int ID_NAME_STRING;
77 extern const int ID_NUMBER_STRING;
78 extern const int ID_TIME_STRING;
79 extern const int ID_CONTACT_BITMAP;
80 extern const int ID_CALLTYPE_BITMAP;
81
82
83 extern const int X_TEXT_LINE1_ITEM;
84 extern const int Y_TEXT_LINE1_ITEM;
85 extern const int H_TEXT_LINE1_ITEM;
86 extern const int W_TEXT_LINE1_ITEM;
87
88 extern const int X_TEXT_LINE2_ITEM;
89 extern const int Y_TEXT_LINE2_ITEM;
90 extern const int H_TEXT_LINE2_ITEM;
91 extern const int W_TEXT_LINE2_ITEM;
92
93 extern const int X_TEXT_TIME_ITEM;
94 extern const int Y_TEXT_TIME_ITEM;
95 extern const int H_TEXT_TIME_ITEM;
96 extern const int W_TEXT_TIME_ITEM;
97
98 extern const int X_CONTACT_BITMAP_ITEM;
99 extern const int Y_CONTACT_BITMAP_ITEM;
100 extern const int H_CONTACT_BITMAP_ITEM;
101 extern const int W_CONTACT_BITMAP_ITEM;
102
103 extern const int X_CALLTYPE_BITMAP_ITEM;
104 extern const int Y_CALLTYPE_BITMAP_ITEM;
105 extern const int H_CALLTYPE_BITMAP_ITEM;
106 extern const int W_CALLTYPE_BITMAP_ITEM;
107
108 extern const int X_DIALER_BTN_TXT;
109 extern const int W_DIALER_BTN_NUM_TXT;
110 extern const int W_DIALER_BTN_ALPHA_TXT;
111
112 /**
113  * @class DialUtil
114  * @brief This class provides static public utility functions to dialer module.
115  *
116  */
117 class DialUtil
118 {
119 private:
120         DialUtil(void){};
121         DialUtil(const DialUtil& obj){};
122         virtual ~DialUtil(void){};
123
124 public:
125         //used to get text font for button in dialer tab.
126         static Tizen::Graphics::Font* GetTextFontN(int textFontStyle);
127         //used to get text color for button in dialer tab.
128         static Tizen::Graphics::Color* GetTextColorN(int textColor, int buttonStatus);
129         //Function to check if keyword is numeric. This function assumes that a string starting with digit will be numeric.
130         //If needed, it might be implemented in  more generic way to check all characters for digits.
131         static bool IsNumericString(Tizen::Base::String& keyWord);
132         //Sets the 'bgImg' image to 'pCanvas' Canvas, if image is a 9-patch image.
133         static void Draw9PatchToCanvas(Tizen::Graphics::Canvas& pCanvas, const Tizen::Base::String& bgImg);
134         //Used to set image to canvas.
135         static void DrawImageToCanvas(const Tizen::Base::String& image, Tizen::Graphics::Dimension imageDimention, Tizen::Graphics::Canvas& pCanvas, int pos);
136         //Used to convert text to Enriched text and set it to canvas.
137         static void DrawTextToCanvas(const Tizen::Base::String& buttonText1, int fontSize, Tizen::Graphics::Canvas& pCanvas, int pos, int buttonStatus);
138         //Used to set nnormal, pressed image to button.
139         static void DrawCanvasToButton(Tizen::Graphics::Canvas* pCanvasNormal, Tizen::Graphics::Canvas* pCanvasPressed, Tizen::Ui::Controls::Button* pButton);
140         //Used to convert provided digit to its equivalent String instance.
141         static Tizen::Base::String ConvertDialedNumberToString(int dialNumber);
142         //Function used to fetch a list of possible names mapped to 'nextCharPos'.
143         static Tizen::Base::Collection::IList* FetchPossibleNamesListN(const Tizen::Base::String& prevSearchStr, int nextCharPos);
144         //Function used to convert substring of 'name' to keys typed, eg. Ani -> 264
145         static void ConvertNameToNumericKeys(Tizen::Base::String& subContactName, Tizen::Base::String& possibleKeysTyped);
146 };
147
148 #endif /* _PHN_COMMON_UTILS_H_ */