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
14 #include <tzplatform_config.h>
15 #include "CicoHSBackWindow.h"
16 #include "CicoResourceConfig.h"
18 /*============================================================================*/
20 /*============================================================================*/
21 /*--------------------------------------------------------------------------*/
23 * @brief CicoHSBackWindow::CicoHSBackWindow
29 /*--------------------------------------------------------------------------*/
30 CicoHSBackWindow::CicoHSBackWindow(void)
34 CicoResourceConfig::GetImagePath(img_dir_path,ICO_HS_MAX_PATH_BUFF_LEN);
38 /*--------------------------------------------------------------------------*/
40 * @brief CicoHSBackWindow::~CicoHSBackWindow
46 /*--------------------------------------------------------------------------*/
47 CicoHSBackWindow::~CicoHSBackWindow(void)
49 /* Do not somthing to do */
52 /*--------------------------------------------------------------------------*/
54 * @brief CicoHSBackWindow::CreateBackWindow
55 * create window (back)
57 * @param[in] pos_x position x
58 * @param[in] pos_y position y
59 * @param[in] width width
60 * @param[in] height height
61 * @return OK or ERRROR
63 /*--------------------------------------------------------------------------*/
65 CicoHSBackWindow::CreateBackWindow(int pos_x,int pos_y,int width,int height)
70 ret = CreateWindow(ICO_HS_BACK_WINDOW_TITLE, pos_x, pos_y, width, height, EINA_TRUE);
76 evas = ecore_evas_get(window);
78 ICO_ERR("CicoHSBackWindow::CreateBackWindow: could not get evas.");
82 /* get configuration */
83 CicoGKeyFileConfig config;
84 config.Initialize(ICO_HOMESCREEN_CONFIG_FILE, ICO_SYC_PACKAGE_HOMESCREEN);
86 const char *back_image = config.ConfigGetFilePath(
87 "homescreen", "background",
88 ICO_SYC_CONFIGPATH_HOME_IMAGE,
89 ICO_SYC_PACKAGE_HOMESCREEN
90 "/" ICO_SYC_CONFIGPATH_PACKAGE_IMAGE,
93 // if image file dos not exist, search system imahe files
94 const char *back_file = config.ConfigGetString(
95 "homescreen", "background",
96 ICO_HS_DEFAULT_BACK_WINDOW_IMAGE_FILE_FILE);
97 back_image = tzplatform_mkpath3(TZ_SYS_DATA,
98 ICO_HS_DEFAULT_BACK_WINDOW_IMAGE_FILE_DIR,
100 if (access(back_image, R_OK) != 0) {
101 // not exist, set default back image file
102 back_image = tzplatform_mkpath3(TZ_SYS_DATA,
103 ICO_HS_DEFAULT_BACK_WINDOW_IMAGE_FILE_DIR,
104 ICO_HS_DEFAULT_BACK_WINDOW_IMAGE_FILE_FILE);
107 ICO_DBG("CicoHSBackWindow::CreateBackWindow: background(%s)", back_image);
110 canvas = evas_object_image_filled_add(evas);
111 evas_object_image_file_set(canvas, back_image, NULL);
112 int err = evas_object_image_load_error_get(canvas);
113 if (err != EVAS_LOAD_ERROR_NONE) {
114 ICO_ERR("CicoHSBackWindow::CreateBackWindow: backgound image is not exist");
115 evas_object_del(canvas);
119 evas_object_image_fill_set(canvas, pos_x, pos_y, width, height);
120 evas_object_resize(canvas, width,height);
121 evas_object_show(canvas);
126 /*--------------------------------------------------------------------------*/
128 * @brief CicoHSBackWindow::FreeBackWindow
134 /*--------------------------------------------------------------------------*/
136 CicoHSBackWindow::FreeBackWindow(void)
138 evas_object_del(canvas);
141 // vim: set expandtab ts=4 sw=4: