File Manager / src / view /

window.c

  1. /*
  2. * Copyright 2014 - 2015 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.  
  18. #include "view/window.h"
  19. #include "utils/logger.h"
  20.  
  21. #include <Elementary.h>
  22.  
  23. #define APP_NAME "$(appName)"
  24.  
  25. window_obj *win_create()
  26. {
  27. window_obj *obj = calloc(1, sizeof(window_obj));
  28. RETVM_IF(!obj, NULL, "Cannot allocate memory");
  29.  
  30. obj->win = elm_win_add(NULL, APP_NAME, ELM_WIN_BASIC);
  31. elm_win_conformant_set(obj->win, EINA_TRUE);
  32. evas_object_show(obj->win);
  33.  
  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. evas_object_del(obj->win);
  52. free(obj);
  53. }
  54. }
  55.  
  56. void win_lower(window_obj *obj)
  57. {
  58. if (obj) {
  59. elm_win_lower(obj->win);
  60. }
  61. }
  62.  
  63. void win_set_layout(window_obj *obj, Evas_Object *layout)
  64. {
  65. RETM_IF(!obj, "Window object is NULL");
  66. RETM_IF(!layout, "Layout is NULL");
  67.  
  68. elm_object_part_content_set(obj->conform, "elm.swallow.content", layout);
  69. obj->layout = layout;
  70. }
  71.  
  72. Evas_Object *win_get_host_layout(const window_obj *obj)
  73. {
  74. RETVM_IF(!obj, NULL, "Window object is NULL");
  75.  
  76. return obj->conform;
  77. }