1950504da872a6f3acefa0e6b194104a66d6d418
[profile/ivi/ico-uxf-homescreen.git] / src / homescreen / CicoHSMenuTile.h
1 /*
2  * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
3  *
4  * This program is licensed under the terms and conditions of the
5  * Apache License, version 2.0.  The full text of the Apache License is at
6  * http://www.apache.org/licenses/LICENSE-2.0
7  *
8  */
9 /**
10  * @brief   tile in menu
11  *
12  * @date    Aug-08-2013
13  */
14 #ifndef __CICO_HS_MENU_TILE_H__
15 #define __CICO_HS_MENU_TILE_H__
16
17 #include <stdio.h>
18 #include <string.h>
19
20 #include <Eina.h>
21 #include <Evas.h>
22 #include <Ecore.h>
23 #include <Ecore_Wayland.h>
24 #include <Ecore_Evas.h>
25 #include <Edje.h>
26
27 #include "ico_syc_common.h"
28 #include "ico_syc_winctl.h"
29
30 #include "CicoHomeScreenCommon.h"
31
32 /*1920 * 1080 display*/
33 /*orientation is vertical*/
34 /* max is (4 * 3)*/
35 /*it can't use all height 1920 ,it needs deduct ControlBar 128 and StatusBar 64*/
36 /*home screen use 1728 * 1080*/
37 /*one rectangle size is 340 * 340 and space = 15*/
38 /**/
39 /*raw is four */
40
41 /*** position       ***/
42 /***+---+---+---+******/
43 /***+ 0 + 1 + 2 +******/
44 /***+ 3 + 4 + 5 +******/
45 /***+ 6 + 7 + 8 +******/
46 /***+ 9 +10 +11 +******/
47 /***+---+---+---+******/
48
49 #define ICO_HS_MENUTILE_ROW 3
50 #define ICO_HS_MENUTILE_COLUMN 4
51 #define ICO_HS_MENUTILE_NUM (ICO_HS_MENUTILE_COLUMN * ICO_HS_MENUTILE_ROW)
52 #define ICO_HS_MENUTILE_POSITION_0 0
53 #define ICO_HS_MENUTILE_POSITION_1 1
54 #define ICO_HS_MENUTILE_POSITION_2 2
55 #define ICO_HS_MENUTILE_POSITION_3 3
56 #define ICO_HS_MENUTILE_POSITION_4 4
57 #define ICO_HS_MENUTILE_POSITION_5 5
58 #define ICO_HS_MENUTILE_POSITION_6 6
59 #define ICO_HS_MENUTILE_POSITION_7 7
60 #define ICO_HS_MENUTILE_POSITION_8 8
61 #define ICO_HS_MENUTILE_POSITION_9 9
62 #define ICO_HS_MENUTILE_POSITION_10 10
63 #define ICO_HS_MENUTILE_POSITION_11 11
64 #define ICO_HS_MENUTILE_POSITION_RESERVE 0xFFFF
65
66 #define ICO_HS_MENUTILE_WIDTH 290
67 #define ICO_HS_MENUTILE_HEIGHT 290
68 #define ICO_HS_MENUTILE_SPACE_TILE_AND_TILE 25
69
70 #define ICO_HS_MENUTILE_START_POS_X 80
71 #define ICO_HS_MENUTILE_START_POS_Y 210
72
73 #define ICO_HS_MENUTILE_TERM_ICON_PATH "/usr/apps/org.tizen.ico.homescreen/res/images/termIcon.png"
74 #define ICO_HS_MENUTILE_DEFAULT_ICON_PATH "/usr/apps/org.tizen.ico.homescreen/res/images/tizen_32.png"
75 #define ICO_HS_MENUTILE_TERM_ICON_WIDTH 64
76 #define ICO_HS_MENUTILE_TERM_ICON_HEIGHT 64
77
78 #define ICO_HS_MENUTILE_THUMBNAIL_FPS_SHOW      15          /* 15 frames/sec        */
79 #define ICO_HS_MENUTILE_THUMBNAIL_FPS_HIDE      -1          /* meanse 'not update'  */
80 #define ICO_HS_MENUTILE_THUMBNAIL_REDUCE_PIX    4
81 #define ICO_HS_MENUTILE_THUMBNAIL_REDUCE_PIX2   6
82 #define ICO_HS_MENUTILE_THUMBNAIL_REDUCE_RATE  10
83 #define ICO_HS_MENUTILE_THUMBNAIL_REDUCTION     4
84
85 /*shared memory buffer*/
86 #define ICO_HS_THUMB_ICODIR       "/tmp/ico"
87 #define ICO_HS_THUMB_FILEDIR       "/thumbnail"
88 #define ICO_HS_THUMB_FILEEXT       "pixel"
89
90 struct _CicoHSMenuTile_thumb {
91     int         surface;                // surface id
92     int         type;                   // frame buffer type
93     int         width;                  // frame buffer width
94     int         height;                 // frame buff height
95     int         stride;                 // frame buffer stride
96     int         format;                 // frame buffer format(only EGL_TEXTURE_RGBA)
97     int         fbcount;                // frame buffer change counter
98     char        *pixel_data;            // glReadPixels data buffer
99     int         pixel_bufsize;          // data buffer size
100 };
101
102 class CicoHSMenuTile
103 {
104   public:
105     CicoHSMenuTile(const char *appid,const char *icon_image_path
106         ,int page,int subpage,int position,int width,int height);
107     ~CicoHSMenuTile(void);
108     void CreateObject(Evas *evas);
109     void FreeObject(void);
110     void Resize(int width,int height);
111     void MovePosition(int page,int poisition);
112     void OffsetMove(int offset_x,int offset_y);
113     const char* GetImagePath(void);
114     int GetWidth(void);
115     int GetHeight(void);
116     int GetPosition(void);
117     int GetPage(void);
118     int GetSubPage(void);
119     int GetPositionX(void);
120     int GetPositionY(void);
121     int GetAppIdx(void);
122     const char* GetAppId(void);
123     void ShowTermIcon(void);
124     void HideTermIcon(void);
125     void ValidMenuIcon(void);
126     void ValidThumbnail(int surface);
127     void SetThumbnail(ico_syc_thumb_info_t *info);
128     void ShowMenu(bool show);
129     void SetOrgThumbnail(CicoHSMenuTile *orgTile);
130
131   private:
132     char appid[ICO_HS_MAX_PROCESS_NAME];
133     char icon_image_path[ICO_HS_MAX_PATH_BUFF_LEN];
134     int page;
135     int subpage;
136     int position;
137     int width;
138     int height;
139     int pos_x;
140     int pos_y;
141     int thumb_reduce_x;
142     int thumb_reduce_y;
143     bool app_running;
144     bool menu_show;
145     Evas        *menu_evas;
146     Evas_Object *tile;
147     Evas_Object *thumb_tile;
148     Evas_Object *icon;
149     Evas_Object *small_icon;
150     Evas_Object *term_icon;
151     struct _CicoHSMenuTile_thumb thumb;
152
153   protected:
154     CicoHSMenuTile operator=(const CicoHSMenuTile&);
155     CicoHSMenuTile(const CicoHSMenuTile&);
156 };
157 #endif
158 // vim: set expandtab ts=4 sw=4: