merge with master
[apps/osp/Internet.git] / inc / IntCommonLib.h
1 //\r
2 \r
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
4 //\r
5 // Licensed under the Flora License, Version 1.0 (the License);\r
6 // you may not use this file except in compliance with the License.\r
7 // You may obtain a copy of the License at\r
8 //\r
9 //     http://floralicense.org/license/\r
10 //\r
11 // Unless required by applicable law or agreed to in writing, software\r
12 // distributed under the License is distributed on an AS IS BASIS,\r
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
14 // See the License for the specific language governing permissions and\r
15 // limitations under the License.\r
16 //\r
17 //!Internet\r
18 /*@file: IntCommonLib.h\r
19  *@brief: To define the common method of Internet application\r
20  */\r
21 \r
22 #ifndef _INT_COMMON_LIB_H_\r
23 #define _INT_COMMON_LIB_H_\r
24 \r
25 #include <FGraphics.h>\r
26 \r
27 /**\r
28 * @struct       CommonBitmapTable\r
29 *\r
30 * Defines the table to store a bitmap\r
31 *\r
32 */\r
33 struct CommonBitmapTable\r
34 {\r
35         Tizen::Graphics::Bitmap* ptr;\r
36         int refcount;\r
37         Tizen::Base::String filename;\r
38         int width;\r
39         int height;\r
40 };\r
41 \r
42 /**\r
43 * @enum CommonBitmapId\r
44 *\r
45 * Defines a ID for a Bitmap path\r
46 *\r
47 */\r
48 enum CommonBitmapId\r
49 {\r
50 \r
51 };\r
52 \r
53 /**\r
54  * @class CommonUtil\r
55  * @brief This file declares common methods to be used\r
56  */\r
57 class CommonUtil\r
58 {\r
59 public:\r
60 \r
61         /**\r
62          * Returns a pointer to a bitmap value using ID\r
63          *\r
64          * @return              Pointer to a bitmap value\r
65          * @param[in]   CommonBitmapId  The ID of the Bitmap\r
66          * @remarks             To work properly, the existing CommonBitmapId has to be passed.\r
67          */\r
68         static Tizen::Graphics::Bitmap* GetBitmap(uint id);\r
69 \r
70         /**\r
71          * Returns a pointer to a bitmap value using bitmap path, bitmap width and bitmap height\r
72          *\r
73          * @return              Pointer to a bitmap value\r
74          * @param[in]   strPath The path of the existing bitmap stored in res folder\r
75          * @param[in]   width The width of the existing bitmap stored in res folder\r
76          * @param[in]   height The height of the existing bitmap stored in res folder\r
77          * @remarks             To work properly, the existing strPath, its width and height has to be passed.\r
78          */\r
79         static Tizen::Graphics::Bitmap* GetBitmapN(const Tizen::Base::String& strPath, const int width, const int height);\r
80 \r
81         /**\r
82          * Gets a bitmap using ID assigned to it.\r
83          *\r
84          * @return              Bitmap\r
85          * @param[in]   Path\r
86          * @param[in]   width\r
87          * @param[in]   height\r
88          * @remarks             Releases all the bitmaps stored\r
89          */\r
90         static Tizen::Graphics::Bitmap* GetNinepatchedBitmapN(const Tizen::Base::String& strPath, const int width, const int height);\r
91 \r
92         /**\r
93          * Returns the string value using ID\r
94          *\r
95          * @return              String\r
96          * @param[in]   resourceId      The ID of the resource string\r
97          * @remarks             To work properly, the existing resourceId has to be passed.\r
98          */\r
99         static Tizen::Base::String GetString(const Tizen::Base::String& resourceId);\r
100 \r
101 \r
102 private:\r
103         static CommonBitmapTable __commonBitmapTable[];\r
104 };\r
105 \r
106 #endif //_INT_COMMON_LIB_H_\r