Piano / src / view /

window.c

  1. /*
  2. * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the License);
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16.  
  17. #include "view/window.h"
  18. #include "logger.h"
  19.  
  20. #include <Elementary.h>
  21.  
  22. #define APP_NAME "$(appName)"
  23.  
  24. window_obj *win_create()
  25. {
  26. window_obj *obj = calloc(1, sizeof(window_obj));
  27. RETVM_IF(!obj, NULL, "Cannot allocate memory");
  28.  
  29. obj->win = elm_win_add(NULL, APP_NAME, ELM_WIN_BASIC);
  30. elm_win_conformant_set(obj->win, EINA_TRUE);
  31. evas_object_show(obj->win);
  32.  
  33. elm_win_indicator_mode_set(obj->win, ELM_WIN_INDICATOR_SHOW);
  34. obj->conform = elm_conformant_add(obj->win);
  35. evas_object_size_hint_weight_set(obj->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
  36. elm_win_resize_object_add(obj->win, obj->conform);
  37. evas_object_show(obj->conform);
  38.  
  39. obj->bg = elm_bg_add(obj->conform);
  40. evas_object_size_hint_weight_set(obj->bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
  41. evas_object_show(obj->bg);
  42.  
  43. elm_object_part_content_set(obj->conform, "elm.swallow.bg", obj->bg);
  44.  
  45. return obj;
  46. }
  47.  
  48. void win_destroy(window_obj *obj)
  49. {
  50. if (obj) {
  51. elm_theme_free(obj->theme);
  52. evas_object_del(obj->bg);
  53. evas_object_del(obj->layout);
  54. evas_object_del(obj->win);
  55. free(obj);
  56. }
  57. }
  58.  
  59. void win_lower(window_obj *obj)
  60. {
  61. if (obj) {
  62. elm_win_lower(obj->win);
  63. }
  64. }