static void _edje_signal_cb(void *data, Evas_Object *obj, const char *emission, const char *source) { //printf("Emission : %s - Source : %s\n", emission, source); if (!strcmp(emission, "info,clicked")) { Evas_Object *textblock; Evas_Object *edje; printf("info clicked \n"); textblock = elm_layout_add(win); elm_layout_file_set(textblock, "tut22.edj", "infos_panel"); evas_object_show(textblock); evas_object_size_hint_weight_set(textblock, 1, 1); elm_object_part_content_set(layout, "panel_swallow", textblock); evas_object_show(textblock); elm_object_part_text_set(textblock, "textblock", "<h1>What is Enlightenment?</h1><br>" "<tab><h4>Enlightenment is not just a window manager for <hilight>Linux/X11</hilight> and others, but also a whole suite of libraries to help you create beautiful user interfaces with much less work than doing it the old fashioned way and fighting with traditional toolkits, not to mention a traditional window manager. It covers uses from small mobile devices like phones all the way to powerful multi-core desktops (which are the primary development environment). </h4><br>" "<br><h1>Enlightenment Foundation Libraries (EFL)</h1> <br>" "<tab>These provide both a semi-traditional toolkit set in <rhinoceros>Elementary</rhinoceros> as well as the object canvas <h2>(Evas)</h2> and powerful abstracted objects (Edje) that you can combine, mix and match, even layer on top of each other with alpha channels and events in-tact. It has <link><a href=\"evas_map\">3D transformations</a></link> for all objects and more. )"); edje = elm_layout_edje_get(textblock); edje_object_signal_callback_add(edje, "*", "*", _edje_signal_textblock_cb, NULL); edje = elm_layout_edje_get(layout); edje_object_signal_emit(edje, "hide,table,anim", "tuto"); } }
int main(int argc, char **argv) { Evas_Object *edje; elm_init(argc, argv); win = elm_win_add(NULL, "tuto", ELM_WIN_BASIC); elm_win_title_set(win, "Edje Tutorial"); evas_object_smart_callback_add(win, "delete,request", _win_del, NULL); layout = elm_layout_add(win); elm_layout_file_set(layout, "tut22.edj", "interface"); evas_object_show(layout); elm_win_resize_object_add(win, layout); table = elm_layout_add(layout); elm_layout_file_set(table, "tut22.edj", "table"); evas_object_show(table); evas_object_size_hint_weight_set(layout, 1, 1); elm_object_part_content_set(layout, "table_swallow", table); edje = elm_layout_edje_get(table); edje_object_signal_callback_add(edje, "*", "*", _edje_signal_cb, NULL); evas_object_resize(win, 800, 480); evas_object_show(win); elm_run(); elm_shutdown(); }
static void _number_update_number(struct MessageNewViewData *view) { g_debug("Updating number to %s", view->number); edje_object_part_text_set(elm_layout_edje_get(view->layout_number), "number_number", view->number); }
static void _mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) { UI *ui = data; Evas_Event_Mouse_Down *ev = event_info; float x, z, w; _get_pos(ui, &ev->canvas, &x, &z, &w); Evas_Object *edj = elm_layout_edje_get(ui->theme); edje_object_part_drag_value_set(edj, "magnet", x, 0.0); edje_object_part_drag_size_set(edj, "magnet", w, z); chimaera_event_t *cev = &ui->cev; cev->state = CHIMAERA_STATE_ON; cev->sid += 1; cev->gid = 0; cev->pid = ev->button == 1 ? 128 : 256; cev->x = x; cev->z = z; cev->X = 0.f; cev->Z = 0.f; _write_event(ui, cev); cev->state = CHIMAERA_STATE_SET; }
static void _win_nowplaying_update(Win *w, Song *previous) { Evas_Object *cover; int label_size; char *artist_title; const char *s1, *s2; if (previous && w->song && previous->album_id != w->song->album_id) { cover = cover_album_fetch_by_id(w->win, w->db, w->song->album_id, 480, NULL, NULL); // TODO: size! elm_object_part_content_set(w->nowplaying, "ejy.swallow.cover", cover); } db_song_artist_fetch(w->db, w->song); s1 = w->song->title; s2 = w->song->artist; if (!s1) s1 = ""; if (!s2) s2 = ""; label_size = strlen(s1) + strlen(s2) + 4; artist_title = malloc(label_size); if (!artist_title) return; if (snprintf(artist_title, label_size, "%s - %s", s1, s2) >= label_size) { CRITICAL("could not set nowplaying title"); goto nowplaying_error; } edje_object_part_text_set(elm_layout_edje_get(w->nowplaying), "ejy.text.title", eina_stringshare_add(artist_title)); nowplaying_error: free(artist_title); }
void enna_mainmenu_hide(Evas_Object *obj) { Smart_Data *sd; Evas_Object *ic; sd = evas_object_data_get(obj, "mainmenu_data"); if (!sd) return; sd->visible = 0; edje_object_signal_emit(elm_layout_edje_get(enna->layout), "mainmenu,hide", "enna"); edje_object_signal_emit(elm_layout_edje_get(enna->layout), "gadgets,hide", "enna"); enna_gadgets_hide(); }
static void _init_content_page(struct MessageNewViewData *view) { Evas_Object *win, *btn; win = ui_utils_view_window_get(VIEW_PTR(*view)); view->layout_content = elm_layout_add(win); elm_win_resize_object_add(win, view->layout_content); evas_object_size_hint_weight_set(view->layout_content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_layout_file_set(view->layout_content, phoneui_theme, "phoneui/messages/new/content"); evas_object_show(view->layout_content); edje_object_part_text_set(elm_layout_edje_get(view->layout_content), "content_title", D_("Enter your message")); view->content_entry = elm_entry_add(win); elm_entry_scrollable_set(view->content_entry, EINA_TRUE); evas_object_smart_callback_add(view->content_entry, "changed", _content_changed, view); if (view->content != NULL) { elm_entry_entry_set(view->content_entry, elm_entry_utf8_to_markup(view->content)); } evas_object_show(view->content_entry); elm_object_part_content_set(view->layout_content, "content_entry", view->content_entry); elm_object_focus_set(view->content_entry, EINA_TRUE); btn = elm_button_add(win); elm_object_text_set(btn, D_("Insert")); evas_object_smart_callback_add(btn, "clicked", _content_button_insert_clicked, view); elm_object_part_content_set(view->layout_content, "content_button_insert", btn); evas_object_show(btn); btn = elm_button_add(win); elm_object_text_set(btn, D_("Close")); evas_object_smart_callback_add(btn, "clicked", _content_button_close_clicked, view); elm_object_part_content_set(view->layout_content, "content_button_close", btn); evas_object_show(btn); btn = elm_button_add(win); elm_object_text_set(btn, D_("Continue")); evas_object_smart_callback_add(btn, "clicked", _content_button_continue_clicked, view); elm_object_part_content_set(view->layout_content, "content_button_continue", btn); evas_object_show(btn); elm_naviframe_item_simple_push(view->pager, view->layout_content); }
EAPI int elm_main(int argc, char **argv) { Evas_Object *win=NULL, *bg=NULL, *pattern=NULL, *edje=NULL, *object=NULL, *item=NULL; Ecore_X_Window xwin, rootxwin; char theme[PATH_MAX]; setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); win = elm_win_add(NULL, "e_pattern_lock", ELM_WIN_BASIC); elm_win_autodel_set(win, EINA_TRUE); elm_win_maximized_set(win, EINA_TRUE); // change to full screen and above everything for lockscreen effect evas_object_size_hint_min_set(win, 480, 480); evas_object_size_hint_max_set(win, 640, 640); elm_win_fullscreen_set(win, EINA_TRUE); elm_win_sticky_set(win, EINA_TRUE); elm_win_keyboard_mode_set(win, ELM_WIN_KEYBOARD_OFF); elm_win_layer_set(win, INT_MAX); xwin = elm_win_xwindow_get(win); rootxwin = ecore_x_window_root_get(xwin); ecore_x_pointer_grab(xwin); ecore_x_keyboard_grab(rootxwin); bg = elm_bg_add(win); evas_object_size_hint_weight_set(bg, 1.0, 1.0); elm_win_resize_object_add(win, bg); evas_object_show(bg); snprintf(theme, sizeof(theme), "%s/themes/default.edj", PKGDATADIR); elm_theme_extension_add(NULL, theme); elm_theme_overlay_add(NULL, theme); pattern = elm_layout_add(win); elm_layout_file_set(pattern, theme, "e_lock/table/default"); evas_object_size_hint_weight_set(pattern, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(pattern, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_win_resize_object_add(win, pattern); edje = elm_layout_edje_get(pattern); set_event_cbs(0, 0, "top_left"); set_event_cbs(1, 0, "top"); set_event_cbs(2, 0, "top_right"); set_event_cbs(0, 1, "left"); set_event_cbs(1, 1, "center"); set_event_cbs(2, 1, "right"); set_event_cbs(0, 2, "bottom_left"); set_event_cbs(1, 2, "bottom"); set_event_cbs(2, 2, "bottom_right"); evas_object_show(pattern); evas_object_show(win); elm_run(); elm_shutdown(); return(0); }
/* Language changed noti handler */ static int lang_changed(void *data) { struct appdata *ad = data; if (ad->layout_main == NULL) return 0; update_ts(elm_layout_edje_get(ad->layout_main), main_txt, sizeof(main_txt) / sizeof(main_txt[0])); return 0; }
void contact_list_fill(struct ContactListData *list_data) { g_debug("contact_list_fill()"); list_data->current = 0; elm_progressbar_pulse(list_data->progress, EINA_TRUE); edje_object_signal_emit(elm_layout_edje_get(list_data->layout), "start_loading",""); phoneui_utils_contacts_get(&list_data->count, _process_entry, list_data); }
void Browser_Common_View::show_notify_popup(const char *msg, int timeout, Eina_Bool has_control_bar) { if (m_selection_info_layout) { evas_object_del(m_selection_info_layout); m_selection_info_layout = NULL; } if (m_selection_info) { evas_object_del(m_selection_info); m_selection_info = NULL; } int angle = 0; angle = elm_win_rotation_get(m_win); m_selection_info = elm_notify_add(m_navi_bar); if (!m_selection_info) { BROWSER_LOGD("elm_notify_add failed"); return; } elm_notify_orient_set(m_selection_info, ELM_NOTIFY_ORIENT_BOTTOM); evas_object_size_hint_weight_set(m_selection_info, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(m_selection_info, EVAS_HINT_FILL, EVAS_HINT_FILL); m_selection_info_layout = elm_layout_add(m_selection_info); if (!m_selection_info_layout) { BROWSER_LOGD("elm_layout_add failed"); return; } evas_object_size_hint_weight_set(m_selection_info_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(m_selection_info_layout, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_object_content_set(m_selection_info, m_selection_info_layout); if (has_control_bar) { if(angle == 0 || angle == 180) elm_layout_theme_set(m_selection_info_layout, "standard", "selectioninfo", "vertical/bottom_64"); else elm_layout_theme_set(m_selection_info_layout, "standard", "selectioninfo", "horizontal/bottom_64"); } else { if(angle == 0 || angle == 180) elm_layout_theme_set(m_selection_info_layout, "standard", "selectioninfo", "vertical/bottom_12"); else elm_layout_theme_set(m_selection_info_layout, "standard", "selectioninfo", "horizontal/bottom_12"); } edje_object_part_text_set(elm_layout_edje_get(m_selection_info_layout), "elm.text", msg); if (timeout) elm_notify_timeout_set(m_selection_info, timeout); evas_object_show(m_selection_info); }
static void _size_changed_cb(void *data, Evas_Object *layout, const char *emission, const char *source) { Evas_Object *edje; Evas_Coord w, h; elm_layout_sizing_eval(layout); edje = elm_layout_edje_get(layout); edje_object_size_min_calc(edje, &w, &h); printf("Minimum size for this theme: %dx%d\n", w, h); }
/* FIXME: replicated from elm_layout just because button's icon spot * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we * can changed the theme API */ static void _icon_signal_emit(Evas_Object *obj) { char buf[64]; snprintf(buf, sizeof(buf), "elm,state,icon,%s", elm_layout_content_get(obj, "icon") ? "visible" : "hidden"); elm_layout_signal_emit(obj, buf, "elm"); edje_object_message_signal_process(elm_layout_edje_get(obj)); _elm_button_smart_sizing_eval(obj); }
static void _init_number_page(struct MessageNewViewData *view) { Evas_Object *win, *btn, *ico; win = ui_utils_view_window_get(VIEW_PTR(*view)); view->number[0] = '\0'; view->number_length = 0; view->layout_number = elm_layout_add(view->pager); elm_win_resize_object_add(win, view->layout_number); elm_layout_file_set(view->layout_number, phoneui_theme, "phoneui/messages/new/number"); evas_object_show(view->layout_number); edje_object_part_text_set(elm_layout_edje_get(view->layout_number), "number_title", D_("Add Number")); btn = elm_button_add(win); elm_object_text_set(btn, D_("Back")); evas_object_smart_callback_add(btn, "clicked", _number_button_back_clicked, view); elm_object_part_content_set(view->layout_number, "number_button_back", btn); evas_object_show(btn); btn = elm_button_add(win); elm_object_text_set(btn, D_("Add")); evas_object_smart_callback_add(btn, "clicked", _number_button_add_clicked, view); elm_object_part_content_set(view->layout_number, "number_button_add", btn); evas_object_show(btn); ico = elm_icon_add(win); evas_object_size_hint_aspect_set(ico, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); elm_image_file_set(ico, phoneui_theme, "icon/edit-undo"); evas_object_show(ico); btn = elm_button_add(win); elm_object_content_set(btn, ico); elm_object_part_content_set(view->layout_number, "number_button_delete", btn); evas_object_smart_callback_add(btn, "clicked", _number_button_delete_clicked, view); evas_object_show(btn); view->number_keypad = (Evas_Object *) elm_keypad_add(win); evas_object_smart_callback_add(view->number_keypad, "clicked", _number_keypad_clicked, view); elm_object_part_content_set(view->layout_number, "number_keypad", view->number_keypad); evas_object_show(view->number_keypad); elm_naviframe_item_simple_push(view->pager, view->layout_number); }
static void _update_animation_time(Evas_Object *prefs, Evas_Object *layout) { Eina_Value value; float animation_time; Edje_Message_Float msg; elm_prefs_item_value_get(prefs, "main:config:options:animation_time", &value); eina_value_get(&value, &animation_time); msg.val = animation_time; edje_object_message_send(elm_layout_edje_get(layout), EDJE_MESSAGE_FLOAT, MSG_ID_VEL, &msg); }
static void _win_song_set(Win *w, Song *s) { Edje_Message_Int mi; Song *previous; char str[32]; w->play.position = 0.0; w->play.length = 0.0; previous = w->song; w->song = s; if (!s) goto end; if (s->trackno > 0) snprintf(str, sizeof(str), "%d", s->trackno); else str[0] = '\0'; edje_object_part_text_set(w->edje, "ejy.text.trackno", str); edje_object_part_text_set(w->edje, "ejy.text.title", s->title); edje_object_part_text_set(w->edje, "ejy.text.album", s->album); edje_object_part_text_set(w->edje, "ejy.text.artist", s->artist); edje_object_part_text_set(w->edje, "ejy.text.genre", s->genre); mi.val = s->rating; edje_object_message_send(elm_layout_edje_get(w->nowplaying), EDJE_MESSAGE_INT, MSG_RATING, &mi); emotion_object_file_set(w->emotion, s->path); emotion_object_position_set(w->emotion, w->play.position); w->play.playing = EINA_TRUE; w->play.playing_last = EINA_FALSE; emotion_object_play_set(w->emotion, EINA_TRUE); emotion_object_audio_volume_set(w->emotion, w->play.volume); end: if ((!w->play.playing) && (w->timer.play_eval)) { ecore_timer_del(w->timer.play_eval); w->timer.play_eval = NULL; } else if ((w->play.playing) && (!w->timer.play_eval)) w->timer.play_eval = ecore_timer_loop_add (0.1, _win_play_eval_timer, w); _win_nowplaying_update(w, previous); _win_play_eval(w); _win_toolbar_eval(w); ecore_event_add(ENJOY_EVENT_PLAYER_CAPS_CHANGE, NULL, NULL, NULL); ecore_event_add(ENJOY_EVENT_PLAYER_TRACK_CHANGE, NULL, NULL, NULL); }
void enna_mainmenu_show(Evas_Object *obj) { Evas_Object *ic; Smart_Data *sd; sd = evas_object_data_get(obj, "mainmenu_data"); if (!sd) return; sd->visible = 1; sd->selected = NULL; enna_gadgets_show(); edje_object_signal_emit(elm_layout_edje_get(enna->layout), "mainmenu,show", "enna"); edje_object_signal_emit(elm_layout_edje_get(enna->layout), "gadgets,show", "enna"); if (enna->o_button_back) { ic = elm_icon_add(enna->o_button_back); elm_image_file_set(ic, enna_config_theme_get(), "ctrl/shutdown"); elm_object_content_set(enna->o_button_back, ic); } }
static Evas_Object *__create_main_layout(Evas_Object *win) { Evas_Object *layout; layout = elm_layout_add(win); if (!layout) return NULL; if (!elm_layout_theme_set(layout, "layout", "application", "default")) BROWSER_LOGE("elm_layout_theme_set is failed.\n"); evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, layout); edje_object_signal_emit(elm_layout_edje_get(layout), "elm,state,show,indicator", "elm"); evas_object_show(layout); return layout; }
static void _clock_month_update(Instance *inst) { Evas_Object *od, *oi; int x, y; oi = elm_layout_edje_get(inst->o_cal); edje_object_part_text_set(oi, "e.text.month", inst->month); edje_object_part_text_set(oi, "e.text.year", inst->year); for (x = 0; x < 7; x++) { od = edje_object_part_table_child_get(oi, "e.table.daynames", x, 0); edje_object_part_text_set(od, "e.text.label", inst->daynames[x]); edje_object_message_signal_process(od); if (inst->dayweekends[x][0]) edje_object_signal_emit(od, "e,state,weekend", "e"); else edje_object_signal_emit(od, "e,state,weekday", "e"); } for (y = 0; y < 6; y++) { for (x = 0; x < 7; x++) { char buf[32]; od = edje_object_part_table_child_get(oi, "e.table.days", x, y); snprintf(buf, sizeof(buf), "%i", (int)inst->daynums[x][y]); edje_object_part_text_set(od, "e.text.label", buf); if (inst->dayweekends[x][y]) edje_object_signal_emit(od, "e,state,weekend", "e"); else edje_object_signal_emit(od, "e,state,weekday", "e"); if (inst->dayvalids[x][y]) edje_object_signal_emit(od, "e,state,visible", "e"); else edje_object_signal_emit(od, "e,state,hidden", "e"); if (inst->daytoday[x][y]) edje_object_signal_emit(od, "e,state,today", "e"); else edje_object_signal_emit(od, "e,state,someday", "e"); edje_object_message_signal_process(od); } } edje_object_message_signal_process(oi); }
static void _process_entry(void *_entry, void *_data) { Elm_Object_Item *glit; GHashTable *entry = (GHashTable *)_entry; struct ContactListData *list_data = (struct ContactListData *) _data; glit = contact_list_item_add(list_data, entry, 0); if (!glit) { g_warning("Failed adding a contact to the list"); return; } list_data->current++; if (list_data->count == list_data->current) { contact_list_fill_index(list_data); edje_object_signal_emit(elm_layout_edje_get(list_data->layout), "stop_loading",""); elm_progressbar_pulse(list_data->progress, EINA_FALSE); } }
static void _edje_signal_textblock_cb(void *data, Evas_Object *obj, const char *emission, const char *source) { //printf("Textblock Emission : %s - Source : %s\n", emission, source); if (!strncmp(emission, "anchor,mouse,up,1,", strlen("anchor,mouse,up,1,"))) { const char *href = emission + strlen("anchor,mouse,up,1,"); printf("href = %s\n", href); if (!strcmp(href, "\"evas_map\"")) { Evas_Object *edje; printf("action\n"); edje = elm_layout_edje_get(layout); edje_object_signal_emit(edje, "show,table,anim", "tuto"); } } }
static void _class_show(void) { /* create the activity content once for all */ if (!mod->o_layout) { mod->o_layout = elm_layout_add(enna->layout); elm_layout_file_set(mod->o_layout, enna_config_theme_get(), "activity/bookstore"); mod->edje = elm_layout_edje_get(mod->o_layout); enna_content_append(ENNA_MODULE_NAME, mod->o_layout); } /* create the menu, once for all */ if (!mod->menu) bs_menu_create(); /* show module */ enna_content_select(ENNA_MODULE_NAME); edje_object_signal_emit(mod->edje, "module,show", "enna"); edje_object_signal_emit(mod->edje, "menu,show", "enna"); }
static inline void _get_pos(UI *ui, Evas_Coord_Point *coord, float *dx, float *dz, float *dw) { Evas_Coord x, y, w, h; Evas_Object *edj = elm_layout_edje_get(ui->theme); const Evas_Object *canvas = edje_object_part_object_get(edj, "canvas"); evas_object_geometry_get(canvas, &x, &y, &w, &h); *dx = (coord->x - x) / (float)w; *dz = (coord->y - y) / (float)h; if(*dx < 0.f) *dx = 0.f; if(*dx > 1.f) *dx = 1.f; if(*dz < 0.f) *dz = 0.f; if(*dz > 1.f) *dz = 1.f; *dw = 4.f / (float)w; }
static void _mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info) { UI *ui = data; Evas_Event_Mouse_Move *ev = event_info; float x, z, w; _get_pos(ui, &ev->cur.canvas, &x, &z, &w); Evas_Object *edj = elm_layout_edje_get(ui->theme); edje_object_part_drag_value_set(edj, "magnet", x, 0.0); edje_object_part_drag_size_set(edj, "magnet", w, z); chimaera_event_t *cev = &ui->cev; if(cev->state == CHIMAERA_STATE_SET) { cev->x = x; cev->z = z; _write_event(ui, cev); } }
static void _win_play_eval(Win *w) { Edje_Message_Float_Set *mf; w->play.position = emotion_object_position_get(w->emotion); w->play.length = emotion_object_play_length_get(w->emotion); if ((w->song) && (w->song->length != (int)w->play.length)) db_song_length_set(w->db, w->song, w->play.length); mf = alloca(sizeof(Edje_Message_Float_Set) + sizeof(double)); mf->count = 2; mf->val[0] = w->play.position; mf->val[1] = w->play.length; edje_object_message_send(elm_layout_edje_get(w->nowplaying), EDJE_MESSAGE_FLOAT_SET, MSG_POSITION, mf); if (w->play.playing_last == w->play.playing) return; w->play.playing_last = !w->play.playing; _win_play_pause_toggle(w); ecore_event_add(ENJOY_EVENT_PLAYER_CAPS_CHANGE, NULL, NULL, NULL); }
static void _init_contacts_page(struct MessageNewViewData *view) { Evas_Object *win, *btn; win = ui_utils_view_window_get(VIEW_PTR(*view)); view->layout_contacts = elm_layout_add(view->pager); elm_win_resize_object_add(win, view->layout_contacts); elm_layout_file_set(view->layout_contacts, phoneui_theme, "phoneui/messages/new/contacts"); evas_object_show(view->layout_contacts); edje_object_part_text_set(elm_layout_edje_get(view->layout_contacts), "contacts_title", D_("Add Contact")); view->contact_list_data.layout = view->layout_contacts; contact_list_add(&view->contact_list_data); btn = elm_button_add(win); elm_object_text_set(btn, D_("Back")); evas_object_smart_callback_add(btn, "clicked", _contacts_button_back_clicked, view); elm_object_part_content_set(view->layout_contacts, "contacts_button_back", btn); evas_object_show(btn); btn = elm_button_add(win); elm_object_text_set(btn, D_("Add")); evas_object_smart_callback_add(btn, "clicked", _contacts_button_add_clicked, view); elm_object_part_content_set(view->layout_contacts, "contacts_button_add", btn); evas_object_show(btn); contact_list_fill(&view->contact_list_data); elm_naviframe_item_simple_push(view->pager, view->layout_contacts); }
static void indicator_clock_changed_cb(void *data) { struct appdata *ad = (struct appdata *)data; char time_str[32]; char time_buf[128], ampm_buf[128]; char buf[256]; struct tm *ts = NULL; time_t ctime; int len; retif(data == NULL, , "Invalid parameter!"); /* Set time */ ctime = time(NULL); ts = localtime(&ctime); if (ts == NULL) return; if (timer != NULL) { ecore_timer_del(timer); timer = NULL; } memset(time_str, 0x00, sizeof(time_str)); memset(time_buf, 0x00, sizeof(time_buf)); memset(ampm_buf, 0x00, sizeof(ampm_buf)); memset(buf, 0x00, sizeof(buf)); timer = ecore_timer_add(60 - ts->tm_sec, (void *)indicator_clock_changed_cb, data); if (clock_mode == INDICATOR_CLOCK_MODE_12H) { char bf1[32] = { 0, }; int hour; if (ts->tm_hour >= 0 && ts->tm_hour < 12) snprintf(ampm_buf, sizeof(ampm_buf), LABEL_STRING, AMPM_FONT_SIZE, _("IDS_COM_POP_AM_M_ABB")); else snprintf(ampm_buf, sizeof(ampm_buf), LABEL_STRING, AMPM_FONT_SIZE, _("IDS_COM_POP_PM_M_ABB")); strftime(bf1, sizeof(bf1), "%l", ts); hour = atoi(bf1); strftime(bf1, sizeof(bf1), ":%M", ts); snprintf(time_str, sizeof(time_str), "%d%s", hour, bf1); // strftime(time_str, sizeof(time_str), "%I:%M", ts); } else { strftime(time_str, sizeof(time_str), "%H:%M", ts); } snprintf(time_buf, sizeof(time_buf), LABEL_STRING, TIME_FONT_SIZE, time_str); len = snprintf(buf, sizeof(buf), "%s%s", time_buf, ampm_buf); if (len < 0) { ERR("Unexpected ERROR!"); return; } INFO("[CLOCK MODULE] Timer Status : %d Time: %s", timer, buf); edje_object_part_text_set(elm_layout_edje_get(ad->layout_main), "elm.text.clock", buf); return; }
void create_pager(Evas_Object *parent, Evas_Object *pg, Pginfo *info, Measurements_Lists *ml) { Evas_Object *ed, *converters_list, *layout; pg = elm_naviframe_add(parent); elm_win_resize_object_add(parent, pg); evas_object_size_hint_weight_set(pg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(pg, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(pg); info->pager = pg; /*main page*/ layout = elm_layout_add(parent); if (!elm_layout_file_set(layout, PACKAGE_DATA_DIR "/default.edj", "main")) { DBG("Can't load Edje Layout %s", PACKAGE_DATA_DIR "/default.edj"); return; } evas_object_show(layout); elm_naviframe_item_simple_push(pg, layout); info->pg1 = layout; converters_list = elm_list_add(parent); elm_object_part_content_set(layout, "converters_list", converters_list); evas_object_size_hint_weight_set(converters_list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_fill_set(converters_list, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(converters_list); populate_converters_list(converters_list, info); /* distance conerter*/ layout = elm_layout_add(parent); if (!elm_layout_file_set(layout, PACKAGE_DATA_DIR "/default.edj", "distance_converter")) { DBG("Can't load Edje Layout %s", PACKAGE_DATA_DIR "/default.edj"); return; } evas_object_show(layout); ed = elm_layout_edje_get(layout); edje_object_part_text_set(ed, "equal", ""); edje_object_part_text_set(ed, "input", ""); edje_object_part_text_set(ed, "output", ""); ml->list_in = elm_list_add(parent); elm_object_part_content_set(layout, "measurements_in", ml->list_in); evas_object_size_hint_weight_set(ml->list_in, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_fill_set(ml->list_in, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(ml->list_in); populate_measurements_list_in(ml->list_in, ed, info); ml->list_out = elm_list_add(parent); elm_object_part_content_set(layout, "measurements_out", ml->list_out); evas_object_size_hint_weight_set(ml->list_out, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_fill_set(ml->list_out, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(ml->list_out); populate_measurements_list_out(ml->list_out, ed, info); /* Set callback functions */ edje_object_signal_callback_add(ed, "mouse,clicked,1", "bt_1", on_number_button_clicked, "1"); edje_object_signal_callback_add(ed, "mouse,clicked,1", "bt_2", on_number_button_clicked, "2"); edje_object_signal_callback_add(ed, "mouse,clicked,1", "bt_3", on_number_button_clicked, "3"); edje_object_signal_callback_add(ed, "mouse,clicked,1", "bt_4", on_number_button_clicked, "4"); edje_object_signal_callback_add(ed, "mouse,clicked,1", "bt_5", on_number_button_clicked, "5"); edje_object_signal_callback_add(ed, "mouse,clicked,1", "bt_6", on_number_button_clicked, "6"); edje_object_signal_callback_add(ed, "mouse,clicked,1", "bt_7", on_number_button_clicked, "7"); edje_object_signal_callback_add(ed, "mouse,clicked,1", "bt_8", on_number_button_clicked, "8"); edje_object_signal_callback_add(ed, "mouse,clicked,1", "bt_9", on_number_button_clicked, "9"); edje_object_signal_callback_add(ed, "mouse,clicked,1", "bt_0", on_number_button_clicked, "0"); edje_object_signal_callback_add(ed, "mouse,clicked,1", "bt_clear", on_number_button_clear, ml); edje_object_signal_callback_add(ed, "mouse,clicked,1", "bt_enter", on_number_button_enter, ml); edje_object_signal_callback_add(ed, "mouse,clicked,1", "back", back_page_1, info); elm_naviframe_item_simple_push(pg, layout); info->pg2 = layout; elm_naviframe_item_simple_promote(info->pager, info->pg1); }
EAPI int elm_main(int argc, char **argv) { Evas_Object *window; Evas_Object *layout; Evas_Object *edje; Evas_Object *grid; Evas_Object *list; char path[PATH_MAX]; Eina_Bool quit_option = EINA_FALSE; int args; Ecore_Getopt_Value values[] = { ECORE_GETOPT_VALUE_BOOL(crazy_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_NONE }; _log_domain = eina_log_domain_register("Excessive", NULL); if (_log_domain < 0) { EINA_LOG_CRIT("could not create log domain 'Excessive'."); return -1; } args = ecore_getopt_parse(&options, values, argc, argv); if (args < 0) { ERR("could not parse command line options."); return -1; } if (quit_option) return 0; excessive_browse_init(); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); elm_theme_extension_add(NULL, PACKAGE_DATA_DIR "/themes/theme.edj"); elm_theme_overlay_add(NULL, PACKAGE_DATA_DIR "/themes/theme.edj"); elm_need_efreet(); elm_need_ethumb(); window = elm_win_add(NULL, PACKAGE_NAME, ELM_WIN_BASIC); if (!window) { ERR("could'nt create window."); return -1; } /* FIXME: later remember last size */ elm_win_alpha_set(window, 1); evas_object_resize(window, 800, 600); elm_win_title_set(window, PACKAGE_STRING); elm_win_autodel_set(window, 1); layout = elm_layout_add(window); if (!layout) { ERR("couldn't create layout object."); return -1; } evas_object_size_hint_align_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_weight_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_win_resize_object_add(window, layout); if (!elm_layout_theme_set(layout, "layout", "application", "content")) { ERR("could not load style 'content' from theme"); return -1; } evas_object_show(layout); evas_object_show(window); edje = elm_layout_edje_get(layout); grid = edje_object_part_external_object_get(edje, "grid"); evas_object_data_set(grid, "excessive/layout", layout); evas_object_data_set(layout, "excessive/win", window); evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_gengrid_bounce_set(grid, EINA_FALSE, EINA_TRUE); elm_gengrid_align_set(grid, 0.5, 0.5); elm_gengrid_item_size_set(grid, 128, 128); excessive_browse_load(layout); list = edje_object_part_external_object_get(edje, "shortcut"); excessive_shortcut_init(list, grid); if (argc < args + 1) { getcwd(path, PATH_MAX); excessive_browse_directory(grid, path); } else { excessive_browse_directory(grid, argv[args]); } elm_run(); excessive_shortcut_shutdown(); excessive_browse_shutdown(); return 0; }
_update_time_part(priv->layout, "time_duration.text", emotion_object_play_length_get(emotion)); timestamp = time(NULL); timestamp += emotion_object_play_length_get(emotion) - emotion_object_position_get(emotion); t = localtime(×tamp); str = eina_strbuf_new(); eina_strbuf_append_printf(str, "End at %02dh%02d", t->tm_hour, t->tm_min); elm_object_part_text_set(priv->layout, "time_end_at.text", eina_strbuf_string_get(str)); eina_strbuf_free(str); v = emotion_object_position_get(emotion) / emotion_object_play_length_get(emotion); edje = elm_layout_edje_get(priv->layout); edje_object_part_drag_value_set(edje, "time.slider", v, v); } #if 0 static void _item_file_name_get_cb(void *data, Ems_Node *node EINA_UNUSED, const char *value) { Enna_View_Player_Video_Data *priv = data; if (value && value[0]) { elm_object_part_text_set(priv->layout, "title.text", value); } else {