2 * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
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
10 * @brief Menu Window class
14 #ifndef __CICO_HS_MENU_WINDOW_H__
15 #define __CICO_HS_MENU_WINDOW_H__
18 #include <libwebsockets.h>
20 #include "ico_syc_common.h"
21 #include "ico_syc_winctl.h"
27 #include <Ecore_Wayland.h>
28 #include <Ecore_Evas.h>
31 #include "CicoHomeScreenConfig.h"
32 #include "CicoHSWindow.h"
33 #include "CicoHSMenuTile.h"
35 #include "CicoHomeScreenCommon.h"
37 #include "CicoSCAilItems.h"
38 #include "CicoSCLifeCycleController.h"
40 #define ICO_HS_MENU_SHOWING 0
41 #define ICO_HS_MENU_HIDING 1
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
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
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
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
64 #define ICO_HS_MENU_OTHER_CATEGORY_ID -1
67 #define ICO_HS_MENU_TERMINATE_BUTTON_LAYER 5
69 typedef struct _CicoLayoutInfo{
77 typedef struct _CicoCurrentPage{
82 typedef struct _CicoCategoryInfo {
91 class CicoHSMenuWindow :public CicoHSWindow
95 ~CicoHSMenuWindow(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);
118 static Eina_Bool MoveDownAnimation(void *data,double pos);
119 static Eina_Bool MoveUpAnimation(void *data,double pos);
121 void SetNightMode(void);
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);
129 static int Tile_Width(void);
130 static int Tile_Height(void);
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);
155 CicoCurrentPage current_info;
156 CicoCategoryInfo category_info[ICO_HS_MENU_MAX_MENU_CATEGORY_NUM];
157 int all_category_num;
160 /* image directory path */
161 char img_dir_path[ICO_HS_MAX_PATH_BUFF_LEN];
166 Evas_Object *rectangle;
168 CicoHSMenuTile *menu_tile[ICO_HS_MENU_MAX_TILE_NUM];
170 Evas_Object *page_pointer[ICO_HS_MENU_MAX_MENU_PAGE_NUM];
172 Evas_Object *page_up_cursor;
173 Evas_Object *page_down_cursor;
174 /* for window control */
175 char appid[ICO_HS_MAX_PROCESS_NAME];
178 Evas_Object *terminate_back;
179 Evas_Object *terminate_really;
180 Evas_Object *terminate_button_yes;
181 Evas_Object *terminate_button_no;
183 CicoSCLifeCycleController *life_cycle_controller;
184 /* my instance (for callback) */
185 static CicoHSMenuWindow *menu_window_instance;
188 static int menu_tile_width;
189 static int menu_tile_height;
192 CicoHSMenuWindow operator=(const CicoHSMenuWindow&);
193 CicoHSMenuWindow(const CicoHSMenuWindow&);