8b08eb6a068df6212d4e8341146ae34617b86e8b
[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 #include "ico_syc_private.h"
30
31 #include "CicoHomeScreenCommon.h"
32
33 /*1920 * 1080 display*/
34 /*orientation is vertical*/
35 /* max is (4 * 3)*/
36 /*it can't use all height 1920 ,it needs deduct ControlBar 128 and StatusBar 64*/
37 /*home screen use 1728 * 1080*/
38 /*one rectangle size is 340 * 340 and space = 15*/
39 /**/
40 /*raw is four */
41
42 /*** position       ***/
43 /***+---+---+---+******/
44 /***+ 0 + 1 + 2 +******/
45 /***+ 3 + 4 + 5 +******/
46 /***+ 6 + 7 + 8 +******/
47 /***+ 9 +10 +11 +******/
48 /***+---+---+---+******/
49
50 #define ICO_HS_MENUTILE_ROW 3
51 #define ICO_HS_MENUTILE_COLUMN 4
52 #define ICO_HS_MENUTILE_NUM (ICO_HS_MENUTILE_COLUMN * ICO_HS_MENUTILE_ROW)
53 #define ICO_HS_MENUTILE_POSITION_0 0
54 #define ICO_HS_MENUTILE_POSITION_1 1
55 #define ICO_HS_MENUTILE_POSITION_2 2
56 #define ICO_HS_MENUTILE_POSITION_3 3
57 #define ICO_HS_MENUTILE_POSITION_4 4
58 #define ICO_HS_MENUTILE_POSITION_5 5
59 #define ICO_HS_MENUTILE_POSITION_6 6
60 #define ICO_HS_MENUTILE_POSITION_7 7
61 #define ICO_HS_MENUTILE_POSITION_8 8
62 #define ICO_HS_MENUTILE_POSITION_9 9
63 #define ICO_HS_MENUTILE_POSITION_10 10
64 #define ICO_HS_MENUTILE_POSITION_11 11
65 #define ICO_HS_MENUTILE_POSITION_RESERVE 0xFFFF
66
67 #define ICO_HS_MENUTILE_WIDTH 290
68 #define ICO_HS_MENUTILE_HEIGHT 290
69 #define ICO_HS_MENUTILE_SPACE_TILE_AND_TILE 25
70
71 #define ICO_HS_MENUTILE_START_POS_X 80
72 #define ICO_HS_MENUTILE_START_POS_Y 210
73
74 #define ICO_HS_MENUTILE_TERM_ICON_PATH  ICO_SYC_PACKAGE_HOMESCREEN "/res/images/termIcon.png"
75 #define ICO_HS_MENUTILE_DEFAULT_ICON_PATH ICO_SYC_PACKAGE_HOMESCREEN "/res/images/tizen_32.png"
76 #define ICO_HS_MENUTILE_TERM_ICON_WIDTH 64
77 #define ICO_HS_MENUTILE_TERM_ICON_HEIGHT 64
78
79 #define ICO_HS_MENUTILE_THUMBNAIL_FPS_SHOW      15          /* 15 frames/sec        */
80 #define ICO_HS_MENUTILE_THUMBNAIL_FPS_HIDE      -1          /* meanse 'not update'  */
81 #define ICO_HS_MENUTILE_THUMBNAIL_REDUCE_PIX    4
82 #define ICO_HS_MENUTILE_THUMBNAIL_REDUCE_PIX2   6
83 #define ICO_HS_MENUTILE_THUMBNAIL_REDUCE_RATE  10
84 #define ICO_HS_MENUTILE_THUMBNAIL_REDUCTION     4
85
86 #define ICO_HS_MENUTILE_THUMBNAIL_RETRYTIME     (0.3f)      /* thumbnail retry time(sec) */
87
88 /*shared memory buffer*/
89 #define ICO_HS_THUMB_ICODIR       "/tmp/ico"
90 #define ICO_HS_THUMB_FILEDIR       "/thumbnail"
91 #define ICO_HS_THUMB_FILEEXT       "pixel"
92
93 struct _CicoHSMenuTile_thumb {
94     int         surface;                // surface id
95     int         type;                   // frame buffer type
96     int         width;                  // frame buffer width
97     int         height;                 // frame buff height
98     int         stride;                 // frame buffer stride
99     int         format;                 // frame buffer format(only EGL_TEXTURE_RGBA)
100     int         fbcount;                // frame buffer change counter
101     char        *pixel_data;            // glReadPixels data buffer
102     int         pixel_bufsize;          // data buffer size
103     Ecore_Timer *thumb_timer;           // retry timer
104     int         orgsurface;             // original surface id
105 };
106
107 class CicoHSMenuTile
108 {
109   public:
110     CicoHSMenuTile(const char *appid,const char *icon_image_path
111         ,int page,int subpage,int position,int width,int height);
112     ~CicoHSMenuTile(void);
113     void CreateObject(Evas *evas);
114     void FreeObject(void);
115     void Resize(int width,int height);
116     void MovePosition(int page,int poisition);
117     void OffsetMove(int offset_x,int offset_y);
118     const char* GetImagePath(void);
119     int GetWidth(void);
120     int GetHeight(void);
121     int GetPosition(void);
122     int GetPage(void);
123     int GetSubPage(void);
124     int GetPositionX(void);
125     int GetPositionY(void);
126     int GetAppIdx(void);
127     const char* GetAppId(void);
128     void ShowTermIcon(void);
129     void HideTermIcon(void);
130     void ValidMenuIcon(void);
131     void ValidThumbnail(int surface);
132     void SetThumbnail(ico_syc_thumb_info_t *info);
133     void ShowMenu(bool show);
134     void SetOrgThumbnail(CicoHSMenuTile *orgTile);
135     void RetryThumbnail(void);
136     static Eina_Bool TimerThumbnail(void *data);
137
138   private:
139     char appid[ICO_HS_MAX_PROCESS_NAME];
140     char icon_image_path[ICO_HS_MAX_PATH_BUFF_LEN];
141     int page;
142     int subpage;
143     int position;
144     int width;
145     int height;
146     int pos_x;
147     int pos_y;
148     int thumb_reduce_x;
149     int thumb_reduce_y;
150     bool app_running;
151     bool menu_show;
152     Evas        *menu_evas;
153     Evas_Object *tile;
154     Evas_Object *thumb_tile;
155     Evas_Object *icon;
156     Evas_Object *small_icon;
157     Evas_Object *term_icon;
158     struct _CicoHSMenuTile_thumb thumb;
159
160   protected:
161     CicoHSMenuTile operator=(const CicoHSMenuTile&);
162     CicoHSMenuTile(const CicoHSMenuTile&);
163 };
164 #endif
165 // vim: set expandtab ts=4 sw=4: