2 * Copyright (c) 2000-2012 Samsung Electronics Co., Ltd All Rights Reserved
4 * This file is part of the ug-memo-efl
5 * Written by Zhibin Zhou <zhibin.zhou@samsung.com>, Canjiang Lu <canjiang.lu@samsung.com>,
6 * Feng Li <feng.li@samsung.com>
8 * PROPRIETARY/CONFIDENTIAL
10 * This software is the confidential and proprietary information of
11 * SAMSUNG ELECTRONICS ("Confidential Information").
12 * You shall not disclose such Confidential Information and shall
13 * use it only in accordance with the terms of the license agreement
14 * you entered into with SAMSUNG ELECTRONICS. SAMSUNG make no
15 * representations or warranties about the suitability
16 * of the software, either express or implied, including but not
17 * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
18 * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
19 * a result of using, modifying or distributing this software or its derivatives.
25 #include <Elementary.h>
27 #include <ui-gadget-module.h>
29 #include <memo_string.h>
30 #include <extended-elm.h>
31 #include <supplement.h>
32 #include <memo-assist.h>
33 #include <memo-genlist.h>
34 #include <memo-assist.h>
38 typedef struct __detail_view_t {
40 Evas_Object *navigator;
41 Evas_Object *ctrl_bar;
42 Evas_Object *body_main;
46 /* add more variables here */
50 static void _on_quit(void *data, Evas_Object *obj, void *event_info)
53 detail_view_t *dv = (detail_view_t *)data;
54 ug_data_t *ugd = dv->ugd;
55 ug_destroy_me(ugd->ug);
58 static void _on_entry_resize(void *data, Evas_Object *obj, void *event_info)
60 LOGD("---------------_on_entry_resize");
61 detail_view_t *dv = (detail_view_t *)data;
62 elm_entry_entry_set(dv->entry, dv->content);
66 static void _create_detail_layout(detail_view_t *dv)
68 ug_data_t *ugd = dv->ugd;
69 Evas_Object *content = NULL;
70 memo_data_t *md = memo_get_data(dv->index);
72 /* add navigationbar */
73 dv->navigator = elm_naviframe_add(ugd->base);
76 dv->body_main = elm_layout_create(dv->navigator, EDJ_FILE, "detail_frame");
79 memo_time_format(ugd->buf, MEMO_BUFFER_SIZE, md->modi_time);
80 edje_object_part_text_set(_EDJ(dv->body_main), "elm.text.date", ugd->buf);
83 snprintf(ugd->buf, MEMO_BUFFER_SIZE, DOODLEDIR"/%d.png", (int)md->id);
84 content = elm_swallowed_icon(dv->body_main, "elm.swallow.content", ugd->buf);
86 char buf[MEMO_BUFFER_SIZE];
87 Evas_Object *sc = NULL;
88 sc = elm_swallowed_scroller(dv->body_main, "elm.swallow.content");
89 unsigned char *color = (unsigned char *)&md->font_color;
90 snprintf(buf, MEMO_BUFFER_SIZE,
91 "<font_size=%d><color=#%02x%02x%02x>",
92 md->font_size, color[2], color[1], color[0]);
93 content = elm_entry_create(dv->body_main, buf);
94 elm_entry_entry_insert(content, elm_entry_utf8_to_markup(md->content));
95 dv->content = strdup(elm_entry_entry_get(content));
96 evas_object_size_hint_weight_set(content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
97 evas_object_size_hint_align_set(content, EVAS_HINT_FILL, EVAS_HINT_EXPAND);
98 elm_entry_editable_set(content, EINA_FALSE);
99 elm_entry_autocapital_type_set(content, ELM_AUTOCAPITAL_TYPE_SENTENCE);
100 elm_object_content_set(sc, content);
102 evas_object_render_flush_hook(dv->entry, _on_entry_resize, dv);
103 edje_object_signal_emit(_EDJ(dv->body_main), "sig_text_mode", "");
109 Elm_Object_Item *navi_it = elm_naviframe_item_push(dv->navigator, MEMO_I18N_MEMO, NULL, NULL, dv->body_main, NULL);
110 Evas_Object *ctrl_bar = memo_controlbar_add(dv->navigator);
111 elm_toolbar_item_append(ctrl_bar, NULL, MEMO_I18N_QUIT, _on_quit, dv);
112 elm_object_item_part_content_set(navi_it, "controlbar", ctrl_bar);
115 void *memo_load_detail_view(ug_data_t *ugd, bundle *data)
117 detail_view_t *dv = SMALLOC(detail_view_t);
118 RETVIF(dv == NULL, NULL);
123 str = bundle_get_val(data, "index");
125 dv->index = atoi(str);
132 _create_detail_layout(dv);
133 elm_object_part_content_set(ugd->base, "elm.swallow.content", dv->navigator);