2 * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @author Janusz Kozerski (j.kozerski@samsung.com)
24 #define UG_MODULE_API __attribute__ ((visibility("default")))
27 #include "im-uigadget.h"
28 #include "im-main-menu.h"
30 static void _win_del(void *data, Evas_Object * obj, void *event_info)
32 printf("Enter function: %s\n", __func__);
40 static Evas_Object *_create_win(const char *name)
42 printf("Enter function: %s\n", __func__);
45 eo = elm_win_add(NULL, name, ELM_WIN_BASIC);
47 elm_win_title_set(eo, name);
48 evas_object_smart_callback_add(eo, "delete,request", _win_del, NULL );
49 // elm_win_screen_size_get(eo, NULL, NULL, &w, &h);
53 //int t = h * 3. / 4.;
54 //w = (t < w) ? t : w;
56 // FIXME: Hardcoded size
57 evas_object_resize(eo, 1000, 1000);
63 static bool on_create(void *data)
65 printf("Enter function: %s\n", __func__);
69 bindtextdomain(PACKAGE, LOCALEDIR);
71 struct ug_data *ugd = data;
73 ugd->win_main = _create_win(PACKAGE);
74 if (ugd->win_main == NULL) {
77 evas_object_show(ugd->win_main);
78 elm_win_indicator_mode_set(ugd->win_main, ELM_WIN_INDICATOR_SHOW);
80 ugd->bg = elm_bg_add(ugd->win_main);
82 LOGD("ugd->bg is null");
86 elm_win_resize_object_add(ugd->win_main, ugd->bg);
87 // evas_object_size_hint_weight_set(ugd->bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
88 evas_object_size_hint_weight_set(ugd->bg, EVAS_HINT_FILL, EVAS_HINT_FILL);
89 evas_object_resize(ugd->bg, 1000, 1000);
90 evas_object_show(ugd->bg);
93 ugd->layout_main = elm_layout_add(ugd->win_main);
95 if (!ugd->layout_main) {
96 LOGD("ugd->layout_main is null");
102 ugd->theme = elm_theme_new();
103 elm_theme_set(ugd->theme, "tizen-HD-dark");
105 elm_object_theme_set(ugd->layout_main, ugd->theme);
106 elm_layout_theme_set(ugd->layout_main, "layout", "application", "default");
107 //evas_object_size_hint_weight_set(ugd->layout_main, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
108 evas_object_size_hint_weight_set(ugd->layout_main, EVAS_HINT_FILL, EVAS_HINT_FILL);
109 //evas_object_size_hint_min_set(ugd->layout_main, 600, 400);
110 evas_object_resize(ugd->layout_main, 1000, 1000);
111 evas_object_show(ugd->layout_main);
113 elm_object_part_content_set(ugd->layout_main, "elm.swallow.bg", ugd->bg);
115 ugd->navi_bar = elm_naviframe_add(ugd->layout_main);
116 if (!ugd->navi_bar) {
117 LOGD("ugd->navi_bar is null");
120 free(ugd->layout_main);
123 elm_object_part_content_set(ugd->layout_main, "elm.swallow.content", ugd->navi_bar);
124 evas_object_show(ugd->navi_bar);
126 im_main_menu_cb((void*) ugd, NULL, NULL);
131 static void on_pause(void *priv)
133 printf("Enter function: %s\n", __func__);
137 static void on_resume(void *priv)
139 printf("Enter function: %s\n", __func__);
143 static void on_destroy(void *priv)
145 printf("Enter function: %s\n", __func__);
147 LOGD("NULL == priv; return");
151 struct ug_data *ugd = priv;
154 elm_theme_free(ugd->theme);
158 evas_object_del(ugd->layout_main);
159 ugd->layout_main = NULL;
162 //static void _tmp(void *priv)
165 // printf("Enter function: %s\n", __func__);
168 //static void _tmp2(app_device_orientation_e mode, void *priv)
172 // printf("Enter function: %s\n", __func__);
175 int main(int argc, char *argv[])
177 printf("Enter function: %s\n", __func__);
179 memset(&ugd, 0x0, sizeof(struct ug_data));
181 app_event_callback_s event_callback;
183 event_callback.create = on_create;
184 event_callback.pause = on_pause;
185 event_callback.resume = on_resume;
186 event_callback.terminate = on_destroy;
188 event_callback.service = NULL;
189 event_callback.low_memory = NULL;
190 event_callback.low_battery = NULL;
191 event_callback.device_orientation = NULL;
192 event_callback.language_changed = NULL;
193 event_callback.region_format_changed = NULL;
194 // event_callback.service = NULL;
195 // event_callback.low_memory = _tmp;
196 // event_callback.low_battery = _tmp;
197 // event_callback.device_orientation = _tmp2;
198 // event_callback.language_changed = _tmp;
199 // event_callback.region_format_changed = _tmp;
201 int ret = app_efl_main(&argc, &argv, &event_callback, &ugd);
204 printf("APP_ERROR_NONE\n");
206 case APP_ERROR_INVALID_PARAMETER:
207 printf("APP_ERROR_INVALID_PARAMETER\n");
209 case APP_ERROR_INVALID_CONTEXT:
210 printf("APP_ERROR_INVALID_CONTEXT\n");
212 case APP_ERROR_ALREADY_RUNNING:
213 printf("APP_ERROR_ALREADY_RUNNING\n");
216 printf("Unknown error\n");
220 printf("return function: %s (%d)\n", __func__, ret);