bug fix: HomeScreen sometimes fails in connection with SystemController at the time...
[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  10
79 #define ICO_HS_MENUTILE_THUMBNAIL_FPS_HIDE   1
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
89 struct _CicoHSMenuTile_thumb {
90     int         surface;                // surface id
91     int         type;                   // frame buffer type
92     int         width;                  // frame buffer width
93     int         height;                 // frame buff height
94     int         stride;                 // frame buffer stride
95     int         format;                 // frame buffer format(only EGL_TEXTURE_RGBA)
96     int         fbcount;                // frame buffer change counter
97     char        *pixel_data;            // glReadPixels data buffer
98     int         pixel_bufsize;          // data buffer size
99 };
100
101 class CicoHSMenuTile
102 {
103   public:
104     CicoHSMenuTile(const char *appid,const char *icon_image_path
105         ,int page,int subpage,int position,int width,int height);
106     ~CicoHSMenuTile(void);
107     void CreateObject(Evas *evas);
108     void FreeObject(void);
109     void Resize(int width,int height);
110     void MovePosition(int page,int poisition);
111     void OffsetMove(int offset_x,int offset_y);
112     const char* GetImagePath(void);
113     int GetWidth(void);
114     int GetHeight(void);
115     int GetPosition(void);
116     int GetPage(void);
117     int GetSubPage(void);
118     int GetPositionX(void);
119     int GetPositionY(void);
120     int GetAppIdx(void);
121     const char* GetAppId(void);
122     void ShowTermIcon(void);
123     void HideTermIcon(void);
124     void ValidMenuIcon(void);
125     void ValidThumbnail(int surface);
126     void SetThumbnail(ico_syc_thumb_info_t *info);
127     void ShowMenu(bool show);
128     void SetOrgThumbnail(CicoHSMenuTile *orgTile);
129
130   private:
131     char appid[ICO_HS_MAX_PROCESS_NAME];
132     char icon_image_path[ICO_HS_MAX_PATH_BUFF_LEN];
133     int page;
134     int subpage;
135     int position;
136     int width;
137     int height;
138     int pos_x;
139     int pos_y;
140     int thumb_reduce_x;
141     int thumb_reduce_y;
142     bool app_running;
143     bool menu_show;
144     Evas        *menu_evas;
145     Evas_Object *tile;
146     Evas_Object *thumb_tile;
147     Evas_Object *icon;
148     Evas_Object *small_icon;
149     Evas_Object *term_icon;
150     struct _CicoHSMenuTile_thumb thumb;
151
152   protected:
153     CicoHSMenuTile operator=(const CicoHSMenuTile&);
154     CicoHSMenuTile(const CicoHSMenuTile&);
155 };
156 #endif
157 // vim: set expandtab ts=4 sw=4: