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 swipe input window
14 #include "CicoHSSwipeInputWindow.h"
15 #include "CicoHSSwipeTouch.h"
16 #include "CicoHomeScreen.h"
17 #include "CicoHSSystemState.h"
19 /*============================================================================*/
21 /*============================================================================*/
22 /*--------------------------------------------------------------------------*/
24 * @brief CicoHSSwipeInputWindow::CicoHSSwipeInputWindow
30 /*--------------------------------------------------------------------------*/
31 CicoHSSwipeInputWindow::CicoHSSwipeInputWindow(void)
33 ICO_DBG("CicoHSSwipeInputWindow::CicoHSSwipeInputWindow: constractor");
39 /*--------------------------------------------------------------------------*/
41 * @brief CicoHSSwipeInputWindow::~CicoHSSwipeInputWindow
47 /*--------------------------------------------------------------------------*/
48 CicoHSSwipeInputWindow::~CicoHSSwipeInputWindow(void)
50 ICO_DBG("CicoHSSwipeInputWindow::CicoHSSwipeInputWindow: destractor");
51 /* not somthing to do */
54 /*--------------------------------------------------------------------------*/
56 * @brief CicoHSSwipeInputWindow::CreateSwipeInputWindow
57 * crate window (swipe input window)
59 * @param[in] pos_x position x
60 * @param[in] pos_y position y
61 * @param[in] width width
62 * @param[in] height height
63 * @param[in] subname swipe input window sub name
64 * @return OK or ERRROR
66 /*--------------------------------------------------------------------------*/
68 CicoHSSwipeInputWindow::CreateSwipeInputWindow(int pos_x, int pos_y,
69 int width, int height, const char *subname)
73 ICO_DBG("CreateSwipeInputWindow: start(%s,x/y=%d/%d,w/h=%d/%d)",
74 subname ? subname : "(null)", pos_x, pos_y, width, height);
78 snprintf(winname, sizeof(winname), "%s_%s",
79 ICO_HS_SWIPE_INPUT_WINDOW_TITLE, subname);
82 strncpy(winname, ICO_HS_SWIPE_INPUT_WINDOW_TITLE, ICO_SYC_MAX_WINNAME_LEN);
84 winname[ICO_SYC_MAX_WINNAME_LEN-1] = 0;
85 ICO_DBG("CreateSwipeInputWindow: winname=%s", winname);
86 ret = CreateWindow(winname, pos_x, pos_y, width, height, EINA_TRUE);
88 ICO_CRI("CicoHSSwipeInputWindow::CreateSwipeInputWindow: can not create window");
93 evas = ecore_evas_get(window);
95 ICO_CRI("CicoHSSwipeInputWindow::CreateSwipeInputWindow: could not get evas.");
99 /* background object(transparent) */
100 background = evas_object_image_filled_add(evas);
102 /* set mouse/touch callback */
103 evas_object_event_callback_add(background, EVAS_CALLBACK_MOUSE_DOWN,
104 CicoHSSwipeTouch::TouchDownSwipe, this);
105 evas_object_event_callback_add(background, EVAS_CALLBACK_MOUSE_UP,
106 CicoHSSwipeTouch::TouchUpSwipe, this);
107 evas_object_event_callback_add(background, EVAS_CALLBACK_MOUSE_MOVE,
108 CicoHSSwipeTouch::TouchMoveSwipe, this);
109 /* move and show window */
110 evas_object_move(background, 0, 0);
111 evas_object_resize(background, width, height);
112 evas_object_show(background);
114 ICO_DBG("CreateSwipeInputWindow: end");
118 /*--------------------------------------------------------------------------*/
120 * @brief CicoHSSwipeInputWindow::FreeSwipeInputWindow
121 * free window (swipe input window)
126 /*--------------------------------------------------------------------------*/
128 CicoHSSwipeInputWindow::FreeSwipeInputWindow(void)
130 evas_object_del(background);
134 /*--------------------------------------------------------------------------*/
136 * @brief CicoHSSwipeInputWindow::SetupSwipeWindow
137 * initiale setup swipe input window
142 /*--------------------------------------------------------------------------*/
144 CicoHSSwipeInputWindow::SetupSwipeWindow(void)
146 ico_syc_win_move_t move;
147 ico_syc_animation_t show;
150 ICO_DBG("SetupSwipeWindow: start");
156 move.height = height;
157 memset(&show, 0, sizeof(show));
158 show.name = (char *)"none";
160 /* set default animation */
161 ico_syc_set_animation(appid, surface, ICO_SYC_ANIMATION_TYPE_ALL, &show);
162 /* move swipe input window to TouchLayer */
163 ico_syc_change_layer(appid, surface, HS_LAYER_TOUCHPANEL);
164 /* move window position and size */
165 ico_syc_move(appid, surface, &move, NULL);
166 /* show and raise window */
167 show.time = ICO_SYC_WIN_SURF_RAISE;
168 ico_syc_show(appid, surface, &show);
170 /* show touch layer */
171 ico_syc_show_layer(HS_LAYER_TOUCHPANEL);
173 ICO_DBG("SetupSwipeWindow: end");
177 /*--------------------------------------------------------------------------*/
179 * @brief CicoHSSwipeInputWindow::Show
185 /*--------------------------------------------------------------------------*/
187 CicoHSSwipeInputWindow::Show(void)
189 ICO_DBG("CicoHSSwipeInputWindow::Show: %08x.%s", surface, this->winname);
190 ico_syc_show(appid, surface, NULL);
193 /*--------------------------------------------------------------------------*/
195 * @brief CicoHSSwipeInputWindow::Hide
201 /*--------------------------------------------------------------------------*/
203 CicoHSSwipeInputWindow::Hide(void)
205 ICO_DBG("CicoHSSwipeInputWindow::Hide: %08x.%s", surface, this->winname);
206 ico_syc_hide(appid, surface, NULL);
209 /*--------------------------------------------------------------------------*/
211 * @brief CicoHSSwipeInputWindow::isMyWindowName
214 * @param[in] winname target window name
215 * @return check result
216 * @retval true my window name is winname
217 * @retval false my window name is NOT winname
219 /*--------------------------------------------------------------------------*/
221 CicoHSSwipeInputWindow::isMyWindowName(const char *winname)
225 ret = (strcmp(winname, this->winname)) ? false : true;
226 ICO_DBG("isMyWindowName: %s is %s", winname, ret ? "TRUE" : "FALSE");
231 CicoHSSwipeInputWindow::GetPosX(void)
237 CicoHSSwipeInputWindow::GetPosY(void)
243 CicoHSSwipeInputWindow::GetWidth(void)
249 CicoHSSwipeInputWindow::GetHeight(void)
254 /*--------------------------------------------------------------------------*/
256 * @brief CicoHSSwipeInputWindow::SetWindowID
257 * set appid and surface
262 /*--------------------------------------------------------------------------*/
264 CicoHSSwipeInputWindow::SetWindowID(const char *appid, int surface)
266 ICO_DBG("SetWindowID: appid=%s surface=%08x", appid, surface);
267 strncpy(this->appid, appid, ICO_HS_MAX_PROCESS_NAME);
268 this->surface = surface;
270 // vim: set expandtab ts=4 sw=4: