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 /* move swipe input window to TouchLayer */
161 ico_syc_change_layer(appid, surface, HS_LAYER_TOUCHPANEL);
162 /* move window position and size */
163 ico_syc_move(appid, surface, &move, NULL);
164 /* show and raise window */
165 show.time = ICO_SYC_WIN_SURF_RAISE;
166 ico_syc_show(appid, surface, &show);
168 /* show touch layer */
169 ico_syc_show_layer(HS_LAYER_TOUCHPANEL);
171 ICO_DBG("SetupSwipeWindow: end");
175 /*--------------------------------------------------------------------------*/
177 * @brief CicoHSSwipeInputWindow::Show
183 /*--------------------------------------------------------------------------*/
185 CicoHSSwipeInputWindow::Show(void)
187 ICO_DBG("CicoHSSwipeInputWindow::Show: %08x.%s", surface, this->winname);
188 ico_syc_show(appid, surface, NULL);
191 /*--------------------------------------------------------------------------*/
193 * @brief CicoHSSwipeInputWindow::Hide
199 /*--------------------------------------------------------------------------*/
201 CicoHSSwipeInputWindow::Hide(void)
203 ICO_DBG("CicoHSSwipeInputWindow::Hide: %08x.%s", surface, this->winname);
204 ico_syc_hide(appid, surface, NULL);
207 /*--------------------------------------------------------------------------*/
209 * @brief CicoHSSwipeInputWindow::isMyWindowName
212 * @param[in] winname target window name
213 * @return check result
214 * @retval true my window name is winname
215 * @retval false my window name is NOT winname
217 /*--------------------------------------------------------------------------*/
219 CicoHSSwipeInputWindow::isMyWindowName(const char *winname)
223 ret = (strcmp(winname, this->winname)) ? false : true;
224 ICO_DBG("isMyWindowName: %s is %s", winname, ret ? "TRUE" : "FALSE");
229 CicoHSSwipeInputWindow::GetPosX(void)
235 CicoHSSwipeInputWindow::GetPosY(void)
241 CicoHSSwipeInputWindow::GetWidth(void)
247 CicoHSSwipeInputWindow::GetHeight(void)
252 /*--------------------------------------------------------------------------*/
254 * @brief CicoHSSwipeInputWindow::SetWindowID
255 * set appid and surface
260 /*--------------------------------------------------------------------------*/
262 CicoHSSwipeInputWindow::SetWindowID(const char *appid, int surface)
264 ICO_DBG("SetWindowID: appid=%s surface=%08x", appid, surface);
265 strncpy(this->appid, appid, ICO_HS_MAX_PROCESS_NAME);
266 this->surface = surface;
268 // vim: set expandtab ts=4 sw=4: