Piano / src / view /

window.c

/*
 * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
 *
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "view/window.h"
#include "logger.h"

#include <Elementary.h>

#define APP_NAME "$(appName)"

window_obj *win_create()
{
	window_obj *obj = calloc(1, sizeof(window_obj));
	RETVM_IF(!obj, NULL, "Cannot allocate memory");

	obj->win = elm_win_add(NULL, APP_NAME, ELM_WIN_BASIC);
	elm_win_conformant_set(obj->win, EINA_TRUE);
	evas_object_show(obj->win);

	elm_win_indicator_mode_set(obj->win, ELM_WIN_INDICATOR_SHOW);
	obj->conform = elm_conformant_add(obj->win);
	evas_object_size_hint_weight_set(obj->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	elm_win_resize_object_add(obj->win, obj->conform);
	evas_object_show(obj->conform);

	obj->bg = elm_bg_add(obj->conform);
	evas_object_size_hint_weight_set(obj->bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	evas_object_show(obj->bg);

	elm_object_part_content_set(obj->conform, "elm.swallow.bg", obj->bg);

	return obj;
}

void win_destroy(window_obj *obj)
{
	if (obj) {
		elm_theme_free(obj->theme);
		evas_object_del(obj->bg);
		evas_object_del(obj->layout);
		evas_object_del(obj->win);
		free(obj);
	}
}

void win_lower(window_obj *obj)
{
	if (obj) {
		elm_win_lower(obj->win);
	}
}