Additional functions of policy and resource management.
[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 "CicoHomeScreenConfig.h"
32 #include "CicoHSWindow.h"
33 #include "CicoHSMenuTile.h"
34
35 #include "CicoHomeScreenCommon.h"
36
37 #include "CicoSCAilItems.h"
38 #include "CicoSCLifeCycleController.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_HIDE_ANIMATION_SLIDE "Slide"
49 #define ICO_HS_MENU_SHOW_ANIMATION_SLIDE "Slide"
50 #define ICO_HS_MENU_HIDE_ANIMATION_FADE "Fade"
51 #define ICO_HS_MENU_SHOW_ANIMATION_FADE "Fade"
52 #define ICO_HS_MENU_ANIMATION_DURATION 200
53
54 typedef struct _CicoLayoutInfo{
55    int appidx;
56    int page;
57    int position;
58    int tile_width;
59    int tile_height;
60 }CicoLayoutInfo;
61
62 class CicoHSMenuWindow :public CicoHSWindow
63 {
64   public:
65     CicoHSMenuWindow();
66     ~CicoHSMenuWindow(void);
67     int Initialize(void);
68     void Finalize(void);
69     void SetMenuWindowID(const char* appid,int sruface);
70     int CreateMenuWindow(int pos_x,int pos_y,int width,int height);
71     void FreeMenuWindow(void);
72     void HSWindowSetting(int orientation);
73     void GoNextMenu(void);
74     void GoBackMenu(void);
75     static Eina_Bool MoveToNextAnimation(void *data,double pos);
76     static Eina_Bool MoveToBackAnimation(void *data,double pos);
77     void Show(ico_syc_animation_t *animation);
78     void Hide(ico_syc_animation_t *animation);
79     void ExecuteApp(const char *appid);
80     void TerminateApp(const char *appid);
81     void ChangeTerminateMode(void);
82     void ChangeNormalMode(void);
83     void ShowTerminateButton(void);
84     void HideTerminateButton(void);
85     void ValidMenuIcon(const char *appid);   
86     void ValidThumbnail(const char *appid,int surface);   
87     void SetThumbnail(const char *appid,int surface);   
88
89     static Eina_Bool MoveDownAnimation(void *data,double pos);
90     static Eina_Bool MoveUpAnimation(void *data,double pos);
91     
92         void SetNightMode(void);
93
94   private:
95     int SetMenuBack(void);
96     void FreeMenuBack(void);
97     int SetAppTiles(void);
98     void FreeAppTiles(void);
99     int SetPagePointer(void);
100     void FreePagePointer(void);
101     int SetTerminateButton(void);
102     void FreeTerminateButton(void);
103     void GetLayout(const char *filename,CicoLayoutInfo *layout,int *num);
104     void SetLayout(const char *filename,CicoLayoutInfo *layout,int num);
105
106     bool terminate_mode;
107     /*for menu control*/
108     int current_page;
109     int all_tile_num;
110     int all_page_num;
111     /* image directory path */
112     char img_dir_path[ICO_HS_MAX_PATH_BUFF_LEN];
113     /* evas object */
114     Evas *evas;         
115     /* menu back */
116     Evas_Object *canvas; 
117     Evas_Object *rectangle; 
118     /* tiles */
119     CicoHSMenuTile *menu_tile[ICO_HS_MENU_MAX_TILE_NUM];
120     /* Page pointer */
121     Evas_Object *page_pointer[ICO_HS_MENU_MAX_MENU_PAGE_NUM]; 
122     /* for window control */
123     char appid[ICO_HS_MAX_PROCESS_NAME];
124     int surface;
125     /*terminate button*/
126     Evas_Object *terminate_back; 
127     Evas_Object *terminate_really; 
128     Evas_Object *terminate_button_yes; 
129     Evas_Object *terminate_button_no; 
130    
131     CicoSCLifeCycleController *life_cycle_controller;
132     /* my instance (for callback) */
133     static CicoHSMenuWindow *menu_window_instance;
134         bool m_showState;
135
136   protected:
137     CicoHSMenuWindow operator=(const CicoHSMenuWindow&);
138     CicoHSMenuWindow(const CicoHSMenuWindow&);
139 };
140 #endif
141