e3dbb060c1a9af56851911bbc1eaf73166caad85
[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 #define ICO_HS_MENUTILE_THUMBNAIL_RETRYTIME     (0.3f)      /* thumbnail retry time(sec) */
86
87 /*shared memory buffer*/
88 #define ICO_HS_THUMB_ICODIR       "/tmp/ico"
89 #define ICO_HS_THUMB_FILEDIR       "/thumbnail"
90 #define ICO_HS_THUMB_FILEEXT       "pixel"
91
92 struct _CicoHSMenuTile_thumb {
93     int         surface;                // surface id
94     int         type;                   // frame buffer type
95     int         width;                  // frame buffer width
96     int         height;                 // frame buff height
97     int         stride;                 // frame buffer stride
98     int         format;                 // frame buffer format(only EGL_TEXTURE_RGBA)
99     int         fbcount;                // frame buffer change counter
100     char        *pixel_data;            // glReadPixels data buffer
101     int         pixel_bufsize;          // data buffer size
102     Ecore_Timer *thumb_timer;           // retry timer
103     int         orgsurface;             // original surface id
104 };
105
106 class CicoHSMenuTile
107 {
108   public:
109     CicoHSMenuTile(const char *appid,const char *icon_image_path
110         ,int page,int subpage,int position,int width,int height);
111     ~CicoHSMenuTile(void);
112     void CreateObject(Evas *evas);
113     void FreeObject(void);
114     void Resize(int width,int height);
115     void MovePosition(int page,int poisition);
116     void OffsetMove(int offset_x,int offset_y);
117     const char* GetImagePath(void);
118     int GetWidth(void);
119     int GetHeight(void);
120     int GetPosition(void);
121     int GetPage(void);
122     int GetSubPage(void);
123     int GetPositionX(void);
124     int GetPositionY(void);
125     int GetAppIdx(void);
126     const char* GetAppId(void);
127     void ShowTermIcon(void);
128     void HideTermIcon(void);
129     void ValidMenuIcon(void);
130     void ValidThumbnail(int surface);
131     void SetThumbnail(ico_syc_thumb_info_t *info);
132     void ShowMenu(bool show);
133     void SetOrgThumbnail(CicoHSMenuTile *orgTile);
134     void RetryThumbnail(void);
135     static Eina_Bool TimerThumbnail(void *data);
136
137   private:
138     char appid[ICO_HS_MAX_PROCESS_NAME];
139     char icon_image_path[ICO_HS_MAX_PATH_BUFF_LEN];
140     int page;
141     int subpage;
142     int position;
143     int width;
144     int height;
145     int pos_x;
146     int pos_y;
147     int thumb_reduce_x;
148     int thumb_reduce_y;
149     bool app_running;
150     bool menu_show;
151     Evas        *menu_evas;
152     Evas_Object *tile;
153     Evas_Object *thumb_tile;
154     Evas_Object *icon;
155     Evas_Object *small_icon;
156     Evas_Object *term_icon;
157     struct _CicoHSMenuTile_thumb thumb;
158
159   protected:
160     CicoHSMenuTile operator=(const CicoHSMenuTile&);
161     CicoHSMenuTile(const CicoHSMenuTile&);
162 };
163 #endif
164 // vim: set expandtab ts=4 sw=4: