bug fix: TIVI-1997, TIVI-2161, An action is inaccurate when the menu of HomeScreen...
[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 <EGL/egl.h>
28 #include <GLES2/gl2.h>
29 #include <GLES2/gl2ext.h>
30 #include <EGL/eglext.h>
31
32 #include "ico_syc_common.h"
33 #include "ico_syc_winctl.h"
34
35 #include "CicoHomeScreenCommon.h"
36
37 /*1920 * 1080 display*/
38 /*orientation is vertical*/
39 /* max is (4 * 3)*/
40 /*it can't use all height 1920 ,it needs deduct ControlBar 128 and StatusBar 64*/
41 /*home screen use 1728 * 1080*/
42 /*one rectangle size is 340 * 340 and space = 15*/
43 /**/
44 /*raw is four */
45
46 /*** position       ***/
47 /***+---+---+---+******/
48 /***+ 0 + 1 + 2 +******/
49 /***+ 3 + 4 + 5 +******/
50 /***+ 6 + 7 + 8 +******/
51 /***+ 9 +10 +11 +******/
52 /***+---+---+---+******/
53
54 #define ICO_HS_MENUTILE_ROW 3
55 #define ICO_HS_MENUTILE_COLUMN 4
56 #define ICO_HS_MENUTILE_NUM (ICO_HS_MENUTILE_COLUMN * ICO_HS_MENUTILE_ROW)
57 #define ICO_HS_MENUTILE_POSITION_0 0
58 #define ICO_HS_MENUTILE_POSITION_1 1
59 #define ICO_HS_MENUTILE_POSITION_2 2
60 #define ICO_HS_MENUTILE_POSITION_3 3
61 #define ICO_HS_MENUTILE_POSITION_4 4
62 #define ICO_HS_MENUTILE_POSITION_5 5
63 #define ICO_HS_MENUTILE_POSITION_6 6
64 #define ICO_HS_MENUTILE_POSITION_7 7
65 #define ICO_HS_MENUTILE_POSITION_8 8
66 #define ICO_HS_MENUTILE_POSITION_9 9
67 #define ICO_HS_MENUTILE_POSITION_10 10
68 #define ICO_HS_MENUTILE_POSITION_11 11
69 #define ICO_HS_MENUTILE_POSITION_RESERVE 0xFFFF
70
71 #define ICO_HS_MENUTILE_WIDTH 290
72 #define ICO_HS_MENUTILE_HEIGHT 290
73 #define ICO_HS_MENUTILE_SPACE_TILE_AND_TILE 25
74
75 #define ICO_HS_MENUTILE_START_POS_X 80
76 #define ICO_HS_MENUTILE_START_POS_Y 210
77
78 #define ICO_HS_MENUTILE_TERM_ICON_PATH "/usr/apps/org.tizen.ico.homescreen/res/images/termIcon.png"
79 #define ICO_HS_MENUTILE_DEFAULT_ICON_PATH "/usr/apps/org.tizen.ico.homescreen/res/images/tizen_32.png"
80 #define ICO_HS_MENUTILE_TERM_ICON_WIDTH 64
81 #define ICO_HS_MENUTILE_TERM_ICON_HEIGHT 64
82
83 #define ICO_HS_MENUTILE_THUMBNAIL_FPS_SHOW  10
84 #define ICO_HS_MENUTILE_THUMBNAIL_FPS_HIDE   1
85 #define ICO_HS_MENUTILE_THUMBNAIL_REDUCE_PIX    4
86 #define ICO_HS_MENUTILE_THUMBNAIL_REDUCE_PIX2   6
87 #define ICO_HS_MENUTILE_THUMBNAIL_REDUCE_RATE  10
88 #define ICO_HS_MENUTILE_THUMBNAIL_REDUCTION     4
89
90 struct _CicoHSMenuTile_glfunc {
91     EGLDisplay  egl_display;            // EGL display
92     PFNEGLCREATEIMAGEKHRPROC            create_image;               // create image
93     PFNGLEGLIMAGETARGETTEXTURE2DOESPROC image_target_texture_2d;    // set image target
94     PFNEGLDESTROYIMAGEKHRPROC           destroy_image;              // destroy image
95 };
96 struct _CicoHSMenuTile_thumb {
97     int         surface;                // surface id
98     int         name;                   // EGL buffer name
99     int         width;                  // frame buffer width
100     int         height;                 // frame buff height
101     int         stride;                 // frame buffer stride
102     int         format;                 // frame buffer format(only EGL_TEXTURE_RGBA)
103     int         fbcount;                // frame buffer change counter
104     EGLImageKHR image;                  // frame buffer image
105     GLuint      texture;                // texture id
106 };
107
108 class CicoHSMenuTile
109 {
110   public:
111     CicoHSMenuTile(const char *appid,const char *icon_image_path
112         ,int page,int subpage,int position,int width,int height);
113     ~CicoHSMenuTile(void);
114     void CreateObject(Evas *evas);
115     void FreeObject(void);
116     void Resize(int width,int height);
117     void MovePosition(int page,int poisition);
118     void OffsetMove(int offset_x,int offset_y);
119     const char* GetImagePath(void);
120     int GetWidth(void);
121     int GetHeight(void);
122     int GetPosition(void);
123     int GetPage(void);
124     int GetSubPage(void);
125     int GetPositionX(void);
126     int GetPositionY(void);
127     int GetAppIdx(void);
128     const char* GetAppId(void);
129     void ShowTermIcon(void);
130     void HideTermIcon(void);
131     void ValidMenuIcon(void);
132     void ValidThumbnail(int surface);
133     void SetThumbnail(ico_syc_thumb_info_t *info);
134     void ShowMenu(bool show);
135
136   private:
137     static struct _CicoHSMenuTile_glfunc glfunc;
138
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: