3 * Copyright 2012 Samsung Electronics Co., Ltd
5 * Licensed under the Flora License, Version 1.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://floralicense.org/license/
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
20 #include "detail-view.h"
21 #include "day-expandable-list.h"
24 #define CAL_HEIGHT_OF_EXPAND_IMG 50
29 Evas_Object *ly; // self
31 cal_day_time_h day_time; // layout
32 Evas_Object *time_block; // layout
35 Eina_Bool is_expanded;
38 static const char *_name = "main/day";
40 static void __cal_day_text_refresh_callback(void *data)
44 c_retm_if(!data, "data is null");
45 cal_day_data *p = data;
47 cal_main_update_title_text(p->ad);
49 elm_object_text_set(p->ad->new_event_button, S_("IDS_COM_BODY_CREATE"));
52 snprintf(title, sizeof(title), "%s %s & %s", C_("IDS_COM_BODY_ALL_DAY"), "event", C_("IDS_CLD_BODY_TASKS"));
53 elm_object_part_text_set(p->ly, "list/title/text", title);
55 elm_genlist_realized_items_update(p->genlist);
59 static void __cal_day_delete_layout(void *data, Evas *e, Evas_Object *obj, void *ei)
65 cal_day_data *p = data;
67 cal_lang_manager_remove_callback(__cal_day_text_refresh_callback, p);
72 void cal_day_update_genlist(Evas_Object *ly)
78 cal_day_data *p = CAL_UTIL_GET_PRIV_DATA (ly);
80 c_ret_if(!p->genlist);
82 cal_day_exp_list_update(p->genlist);
85 Evas_Object* cal_day_create_view(struct appdata *ad, Evas_Object *main)
94 CAL_CALLOC(p, 1, cal_day_data);
98 ad->tapbar_focus_view = CV_DAY;
101 p->ly = ly = cal_util_add_layout(ad->naviframe, p->name);
108 evas_object_data_set(ly, "priv", p);
110 p->genlist = cal_day_exp_list_create(ly, "list/sw", ad);
112 int control_flag = ENABLE_MOUSE_DOWN_FLAG|ENABLE_MOUSE_UP_FLAG|ENABLE_MOUSE_MOVE_FLAG|ENABLE_MOUSE_OUT_FLAG|ENABLE_MULTI_DOWN_FLAG|ENABLE_MULTI_UP_FLAG|ENABLE_MULTI_MOVE_FLAG|ENABLE_GRAG_START_FLAG;
114 p->day_time = cal_base_time_new(_CAL_BASE_TYPE_EVENT, ly, ad->base_tm.tm_hour, &p->time_block, ad, control_flag);
116 CAL_ASSERT (p->day_time);
117 CAL_ASSERT (p->time_block);
119 elm_object_part_content_set(ly, "cont/sw", p->time_block);
121 Evas_Object *scroller = evas_object_data_get(p->time_block, "scroller");
122 c_retvm_if(!scroller, NULL, "scroller is null");
124 evas_object_event_callback_add(ly, EVAS_CALLBACK_DEL, __cal_day_delete_layout, p);
126 cal_lang_manager_add_callback(__cal_day_text_refresh_callback, p);
131 void cal_day_change_content_display_status(Evas_Object *ly)
135 cal_day_data *p = evas_object_data_get(ly, "priv");
138 struct appdata *ad = p->ad;
141 Elm_Object_Item *top = elm_naviframe_top_item_get(ad->naviframe);
142 Evas_Object *obj = elm_object_item_part_content_get(top, "default");
144 if (ad->main != obj || ad->ug) {
145 cal_base_time_hide(p->day_time);
147 cal_base_time_show(p->day_time);
151 void cal_day_update_view(Evas_Object *ly)
159 p = CAL_UTIL_GET_PRIV_DATA(ly);
160 if (!p || CAL_STRCMP(p->name, _name)) {
161 ERR("Invalid object");
165 cal_day_update_genlist(ly);
167 cal_base_time_update(p->day_time);
169 cal_day_change_content_display_status(p->ly);