Refactoring 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 "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_WIDTH_DOUBLE (ICO_HS_MENUTILE_WIDTH * 2) + ICO_HS_MENUTILE_SPACE_TILE_AND_TILE
74 #define ICO_HS_MENUTILE_HEIGHT_DOUBLE (ICO_HS_MENUTILE_HEIGHT * 2) + ICO_HS_MENUTILE_SPACE_TILE_AND_TILE
75
76 #define ICO_HS_MENUTILE_TERM_ICON_PATH "/usr/apps/org.tizen.ico.homescreen/res/images/termIcon.png"
77 #define ICO_HS_MENUTILE_DEFAULT_ICON_PATH "/usr/apps/org.tizen.ico.homescreen/res/images/tizen_32.png"
78 #define ICO_HS_MENUTILE_TERM_ICON_WIDTH 64
79 #define ICO_HS_MENUTILE_TERM_ICON_HEIGHT 64
80
81 class CicoHSMenuTile
82 {
83   public:
84     CicoHSMenuTile(const char *appid,const char *icon_image_path
85         ,int page,int position,int width,int height);
86     ~CicoHSMenuTile(void);
87     void CreateObject(Evas *evas);
88     void FreeObject(void);
89     void Resize(int width,int height);
90     void MovePosition(int page,int poisition);
91     void OffsetMove(int offset_x,int offset_y);
92     const char* GetImagePath(void);
93     int GetWidth(void);
94     int GetHeight(void);
95     int GetPosition(void);
96     int GetPage(void);
97     int GetPositionX(void);
98     int GetPositionY(void);
99     int GetAppIdx(void);
100     const char* GetAppId(void);
101     void ShowTermIcon(void);
102     void HideTermIcon(void);
103     void ValidMenuIcon(void);   
104     void ValidThumbnail(int surface);
105     void SetThumbnail(int surface);
106
107   private:
108     char appid[ICO_HS_MAX_PROCESS_NAME];
109     char icon_image_path[ICO_HS_MAX_PATH_BUFF_LEN];
110     int page;
111     int position;
112     int width;
113     int height;
114     int pos_x;
115     int pos_y;
116     Evas_Object *tile;
117     Evas_Object *term_icon;
118     int                   thumb_surface;
119     ico_syc_thumb_data_t *thumbnail;
120
121   protected:
122     CicoHSMenuTile operator=(const CicoHSMenuTile&);
123     CicoHSMenuTile(const CicoHSMenuTile&);
124 };
125
126 #endif