Merge "Removed system controller." into tizen
[profile/ivi/ico-uxf-homescreen.git] / src / homescreen / CicoHSMenuWindow.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   Menu Window class
11  *
12  * @date    Aug-08-2013
13  */
14 #ifndef __CICO_HS_MENU_WINDOW_H__
15 #define __CICO_HS_MENU_WINDOW_H__
16 #include <stdio.h>
17 #include <pthread.h>
18 #include <libwebsockets.h>
19
20 #include "ico_syc_common.h"
21 #include "ico_syc_winctl.h"
22
23 #include <unistd.h>
24 #include <Eina.h>
25 #include <Evas.h>
26 #include <Ecore.h>
27 #include <Ecore_Wayland.h>
28 #include <Ecore_Evas.h>
29 #include <Edje.h>
30
31 #include "CicoGKeyFileConfig.h"
32 #include "CicoHSWindow.h"
33 #include "CicoHSMenuTile.h"
34
35 #include "CicoHomeScreenCommon.h"
36
37 #include "CicoAilItems.h"
38 #include "CicoHSLifeCycleController.h"
39
40 #define ICO_HS_MENU_SHOWING 0
41 #define ICO_HS_MENU_HIDING 1
42
43 #define ICO_HS_MENU_PAGE_POINTER_START_POS_X 300
44 #define ICO_HS_MENU_PAGE_POINTER_START_POS_Y 75
45 #define ICO_HS_MENU_PAGE_POINTER_WIDTH 64
46 #define ICO_HS_MENU_PAGE_POINTER_HEIGHT 64
47
48 #define ICO_HS_MENU_PAGE_UP_CURSOR_START_POS_X 50
49 #define ICO_HS_MENU_PAGE_UP_CURSOR_START_POS_Y 50
50 #define ICO_HS_MENU_PAGE_UP_CURSOR_WIDTH 64
51 #define ICO_HS_MENU_PAGE_UP_CURSOR_HEIGHT 64
52
53 #define ICO_HS_MENU_PAGE_DOWN_CURSOR_START_POS_X 50
54 #define ICO_HS_MENU_PAGE_DOWN_CURSOR_START_POS_Y 1630
55 #define ICO_HS_MENU_PAGE_DOWN_CURSOR_WIDTH 64
56 #define ICO_HS_MENU_PAGE_DOWN_CURSOR_HEIGHT 64
57
58 #define ICO_HS_MENU_HIDE_ANIMATION_SLIDE "Slide"
59 #define ICO_HS_MENU_SHOW_ANIMATION_SLIDE "Slide"
60 #define ICO_HS_MENU_HIDE_ANIMATION_FADE "Fade"
61 #define ICO_HS_MENU_SHOW_ANIMATION_FADE "Fade"
62 #define ICO_HS_MENU_ANIMATION_DURATION 300
63
64 #define ICO_HS_MENU_OTHER_CATEGORY_ID -1
65
66 /* Layer */
67 #define ICO_HS_MENU_TERMINATE_BUTTON_LAYER 5
68
69 typedef struct _CicoLayoutInfo{
70    int appidx;
71    int page;
72    int position;
73    int tile_width;
74    int tile_height;
75 } CicoLayoutInfo;
76
77 typedef struct _CicoCurrentPage{
78     int current_page;
79     int subcurrent_page;
80 } CicoCurrentPage;
81
82 typedef struct _CicoCategoryInfo {
83     int id;
84     int page;
85     int subpage_max;
86     int tile_num;
87 } CicoCategoryInfo;
88
89 /*  tile size   */
90
91 class CicoHSMenuWindow :public CicoHSWindow
92 {
93   public:
94     CicoHSMenuWindow();
95     ~CicoHSMenuWindow(void);
96     int Initialize(void);
97     void Finalize(void);
98     void SetMenuWindowID(const char* appid,int sruface);
99     int CreateMenuWindow(int pos_x,int pos_y,int width,int height);
100     void FreeMenuWindow(void);
101     void HSWindowSetting(int orientation);
102     void GoNextMenu(void);
103     void GoBackMenu(void);
104     static Eina_Bool MoveToNextAnimation(void *data,double pos);
105     static Eina_Bool MoveToBackAnimation(void *data,double pos);
106     void Show(ico_syc_animation_t *animation);
107     void Hide(ico_syc_animation_t *animation);
108     void ExecuteApp(const char *appid);
109     void TerminateApp(const char *appid);
110     void ChangeTerminateMode(void);
111     void ChangeNormalMode(void);
112     void ShowTerminateButton(void);
113     void HideTerminateButton(void);
114     void ValidMenuIcon(const char *appid);
115     void ValidThumbnail(const char *appid, int surface);
116     void SetThumbnail(const char *appid, ico_syc_thumb_info_t *info);
117
118     static Eina_Bool MoveDownAnimation(void *data,double pos);
119     static Eina_Bool MoveUpAnimation(void *data,double pos);
120
121     void SetNightMode(void);
122
123     void DspCtrlPageCursor(void);
124     void DownNextMenu(void);
125     void UpBackMenu(void);
126     static Eina_Bool MoveToNextSubAnimation(void *data,double pos);
127     static Eina_Bool MoveToBackSubAnimation(void *data,double pos);
128
129     static int Tile_Width(void);
130     static int Tile_Height(void);
131
132   private:
133     int SetMenuBack(void);
134     void FreeMenuBack(void);
135     void InitAppTiles(void);
136     int SetAppTiles(void);
137     void FreeAppTiles(void);
138     void RenewAppTiles(void);
139     int SetPagePointer(void);
140     void FreePagePointer(void);
141     int SetPageCursor(void);
142     void FreePageCursor(void);
143     int SetTerminateButton(void);
144     void FreeTerminateButton(void);
145     void GetLayout(const char *filename,CicoLayoutInfo *layout,int *num);
146     void SetLayout(const char *filename,CicoLayoutInfo *layout,int num);
147     void GetCategory(const char *filename,int *category,int *num);
148     void SetCategoryInfo(int id);
149     void GetTileInfo(int id, int *page, int *subpage, int *position);
150
151     bool terminate_mode;
152     /*for menu control*/
153     int current_page;
154     int subcurrent_page;
155     CicoCurrentPage current_info;
156     CicoCategoryInfo category_info[ICO_HS_MENU_MAX_MENU_CATEGORY_NUM];
157     int all_category_num;
158     int all_tile_num;
159     int all_page_num;
160     /* image directory path */
161     char img_dir_path[ICO_HS_MAX_PATH_BUFF_LEN];
162     /* evas object */
163     Evas *evas;
164     /* menu back */
165     Evas_Object *canvas;
166     bool transparent_background;
167     Evas_Object *rectangle;
168     /* tiles */
169     CicoHSMenuTile *menu_tile[ICO_HS_MENU_MAX_TILE_NUM];
170     /* Page pointer */
171     Evas_Object *page_pointer[ICO_HS_MENU_MAX_MENU_PAGE_NUM];
172     /* Page cursor */
173     Evas_Object *page_up_cursor;
174     Evas_Object *page_down_cursor;
175     /* for window control */
176     char appid[ICO_HS_MAX_PROCESS_NAME];
177     int surface;
178     /*terminate button*/
179     Evas_Object *terminate_back;
180     Evas_Object *terminate_really;
181     Evas_Object *terminate_button_yes;
182     Evas_Object *terminate_button_no;
183
184     CicoHSLifeCycleController *life_cycle_controller;
185     /* my instance (for callback) */
186     static CicoHSMenuWindow *menu_window_instance;
187     bool m_showState;
188     /* tile size    */
189     static int  menu_tile_width;
190     static int  menu_tile_height;
191
192   protected:
193     CicoHSMenuWindow operator=(const CicoHSMenuWindow&);
194     CicoHSMenuWindow(const CicoHSMenuWindow&);
195 };
196 #endif
197 // vim: set expandtab ts=4 sw=4: