Applied latest source code
[apps/native/preloaded/Phone.git] / inc / PhnAppUtility.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                PhnAppUtility.h
19  * @brief               This is the header file for the %AppUtility class.
20  *
21  * This header file contains the declarations for %AppUtility class.
22  */
23 #ifndef _PHN_APP_UTILITY_H_
24 #define _PHN_APP_UTILITY_H_
25
26 #include <FBase.h>
27 #include <FUi.h>
28 #include <FMedia.h>
29
30 enum KeypadTextPosition
31 {
32         POSITION_LEFT,
33         POSITION_RIGHT,
34         POSITION_CENTER,
35         POSITION_TOP_LEFT,
36         POSITION_TOP_CENTER,
37         POSITION_BOTTOM_LEFT,
38         POSITION_BOTTOM_CENTER,
39         POSITION_SUGGESTION_NAME,
40         POSITION_SUGGESTION_NUMBER
41 };
42
43 enum TableViewItemPos
44 {
45         TABLEVIEWITEMPOS_SINGLE_ITEM,
46         TABLEVIEWITEMPOS_TOP,
47         TABLEVIEWITEMPOS_CENTER,
48         TABLEVIEWITEMPOS_BOTTOM,
49 };
50
51 enum TableViewItemType
52 {
53         TABLEVIEWITEMTYPE_SINGLE_TXT,
54         TABLEVIEWITEMTYPE_MAIN_TXT,
55         TABLEVIEWITEMTYPE_SUB_TXT,
56 };
57
58 /**
59  * @class AppUtility
60  * @brief This class provides common functionalities across application through static member functions.
61  * Its instance cannot needed.
62  *
63  */
64 class AppUtility
65 {
66 private:
67         AppUtility(void);
68         AppUtility(const AppUtility& obj);
69         virtual ~AppUtility(void);
70
71 public:
72         /**
73          * Fetches the String from resources based on
74          * resource id provided by "stringId".
75          */
76         static Tizen::Base::String GetResourceString(const Tizen::Base::String& stringId);
77
78         /**
79          * Fetches the Bitmap from resources and
80          * scales it to specified width and height, if provided.
81          */
82         static Tizen::Graphics::Bitmap* GetBitmapFromResourcesN(const Tizen::Base::String& imagePath, int imgWidth = 0, int imgHeight = 0);
83
84         //Function used to set backgorund bitmap to table item based on its position in GroupedTableView.
85         static void SetBackgroundBitmapToTableItem(Tizen::Ui::Controls::TableViewItem* pTableItem, TableViewItemPos position);
86         //Function is used to set and change expand icon to expandable item based on its state.
87         static void SetExpandIconToTableItem(Tizen::Ui::Controls::TableViewItem* pTableItem, bool isExpanded);
88         //Function to get Font size for settings view
89         static int GetSettingsItemFontSize(void);
90         //Function to get the Item Size based on the Font size that is set
91         static int GetSettingsItemRectSize(void);
92         //SubText Rect Size
93         static int      GetSettingsSubItemSize(void);
94         //MainText Rect Size
95         static int      GetSettingsMainItemSize(void);
96         //function to get Global font size
97         static void GetGlobalFontAndItemHeight(float *fontSize, float *itemHeight);
98         //funcstion to convert string to pointer character array
99         static char* ConvertStringToPointerCharArrayN(const Tizen::Base::String& strToConvert);
100 };
101
102 #endif // _PHN_APP_UTILITY_H_