static void _sizing_eval(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); Evas_Coord minw = -1, minh = -1; int i; if (!wd) return; elm_coords_finger_size_adjust(1, &minw, 1, &minh); for (i = 0; i < 4; i++) { if (wd->cp[i]->bg_rect) _colorselector_set_size_hints(wd->cp[i]->bg_rect, 1, 1); _colorselector_set_size_hints(wd->cp[i]->bar, 1, 1); _colorselector_set_size_hints(wd->cp[i]->rbt, 1, 1); _colorselector_set_size_hints(wd->cp[i]->lbt, 1, 1); _colorselector_set_size_hints(wd->cp[i]->colorbar, 4, 1); } elm_coords_finger_size_adjust(4, &minw, 4, &minh); edje_object_size_min_restricted_calc(wd->base, &minw, &minh, minw, minh); evas_object_size_hint_min_set(obj, minw, minh); evas_object_size_hint_max_set(obj, -1, -1); }
static void _sizing_eval(Eo *obj, Efl_Ui_Text_Alert_Popup_Data *pd) { ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); Evas_Coord obj_minw = -1, obj_minh = -1; Evas_Coord text_minw = -1, text_minh = -1; Eina_Size2D text_min; //Calculate popup's min size including scroller's min size { elm_label_line_wrap_set(pd->message, ELM_WRAP_NONE); text_min = efl_gfx_hint_size_combined_min_get(pd->message); elm_label_line_wrap_set(pd->message, ELM_WRAP_MIXED); elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_TRUE); elm_coords_finger_size_adjust(1, &text_minw, 1, &text_minh); edje_object_size_min_restricted_calc (wd->resize_obj, &text_minw, &text_minh, text_minw, text_minh); } //Calculate popup's min size except scroller's min size { elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE); elm_coords_finger_size_adjust(1, &obj_minw, 1, &obj_minh); edje_object_size_min_restricted_calc (wd->resize_obj, &obj_minw, &obj_minh, obj_minw, obj_minh); } text_min.h = text_minh; _scroller_sizing_eval(obj, pd, EINA_SIZE2D(obj_minw, obj_minh), text_min); }
EOLIAN static void _jk_spinner_elm_layout_sizing_eval(Eo *obj, Jk_Spinner_Data *pd) { Evas_Coord minw = -1, minh = -1; ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); elm_coords_finger_size_adjust(1, &minw, 1, &minh); edje_object_size_min_restricted_calc (wd->resize_obj, &minw, &minh, minw, minh); elm_coords_finger_size_adjust(1, &minw, 1, &minh); evas_object_size_hint_min_set(obj, minw, minh); evas_object_size_hint_max_set(obj, -1, -1); }
static void _elm_button_smart_sizing_eval(Evas_Object *obj) { Evas_Coord minw = -1, minh = -1; ELM_BUTTON_DATA_GET(obj, sd); elm_coords_finger_size_adjust(1, &minw, 1, &minh); edje_object_size_min_restricted_calc (ELM_WIDGET_DATA(sd)->resize_obj, &minw, &minh, minw, minh); elm_coords_finger_size_adjust(1, &minw, 1, &minh); evas_object_size_hint_min_set(obj, minw, minh); }
Eo* float_new(PropertyValue* val, Eo* obj) { Evas_Object *bx; bx = elm_box_add(obj); elm_box_horizontal_set(bx, EINA_TRUE); elm_box_padding_set(bx, 4, 0); evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); Evas_Coord fw = -1, fh = -1; elm_coords_finger_size_adjust(1, &fw, 1, &fh); evas_object_size_hint_min_set(bx, 0, fh); const char* name; /* Eo* l = elm_layout_add(obj); elm_layout_file_set(l, "edc/entry.edj", "main"); evas_object_size_hint_weight_set(l, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(l, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(l); elm_box_pack_end(bx, l); return bx; */ //Evas_Object* en = smart_entry_add(evas_object_evas_get(obj)); //Evas_Object* en = smart_entry_add(obj); //chris //Evas_Object *en = eo_add(JK_ENTRY_CLASS, obj); Evas_Object *en = jk_entry_add(obj); //evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); //evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5); evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(en); elm_box_pack_end(bx, en); //Eo* rect = evas_object_rectangle_add(evas_object_evas_get(obj)); //evas_object_show(rect); //evas_object_color_set(rect, rand() % 255, rand() % 255, rand() % 255, 255/2); //evas_object_size_hint_weight_set(rect, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); //evas_object_size_hint_align_set(rect, EVAS_HINT_FILL, EVAS_HINT_FILL); // //elm_box_pack_end(bx, rect); evas_object_smart_callback_add(en, "changed,end", _jk_entry_changed_end_cb_list, val); evas_object_smart_callback_add(en, "changed", _jk_entry_changed_cb_list, val); const float* f = val->data; //eo_do(en, jk_entry_value_set(*f)); jk_entry_value_set(en, *f); val->item_eo = en; evas_object_show(bx); return bx; }
EOLIAN static void _elm_actionslider_elm_layout_sizing_eval(Eo *obj, Elm_Actionslider_Data *sd) { Evas_Coord minw = -1, minh = -1; ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); elm_coords_finger_size_adjust(1, &minw, 1, &minh); evas_object_size_hint_min_set(sd->drag_button_base, minw, minh); evas_object_size_hint_max_set(sd->drag_button_base, -1, -1); minw = -1; minh = -1; elm_coords_finger_size_adjust(3, &minw, 1, &minh); edje_object_size_min_restricted_calc (wd->resize_obj, &minw, &minh, minw, minh); evas_object_size_hint_min_set(obj, minw, minh); evas_object_size_hint_max_set(obj, -1, -1); }
EOLIAN static void _elm_flipselector_elm_layout_sizing_eval(Eo *obj, Elm_Flipselector_Data *sd) { char *tmp = NULL; Evas_Coord minw = -1, minh = -1, w, h; ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); if (sd->evaluating) return; elm_coords_finger_size_adjust(1, &minw, 2, &minh); sd->evaluating = EINA_TRUE; if (sd->sentinel) { const char *label = elm_object_item_text_get(DATA_GET(sd->sentinel)); const char *src = elm_layout_text_get(obj, "elm.top"); if (src) tmp = strdup(src); elm_layout_text_set(obj, "elm.top", label); } edje_object_size_min_restricted_calc (wd->resize_obj, &minw, &minh, minw, minh); elm_coords_finger_size_adjust(1, &minw, 2, &minh); evas_object_size_hint_min_get(obj, &w, &h); if (sd->sentinel) { elm_layout_text_set(obj, "elm.top", tmp); free(tmp); } if (w > minw) minw = w; if (h > minh) minh = h; sd->evaluating = EINA_FALSE; evas_object_size_hint_min_set(obj, minw, minh); }
static void _sizing_eval(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; if (!wd) return; elm_coords_finger_size_adjust(1, &minw, 1, &minh); edje_object_size_min_restricted_calc(wd->bbl, &minw, &minh, minw, minh); evas_object_size_hint_min_set(obj, minw, minh); evas_object_size_hint_max_set(obj, maxw, maxh); }
static void _colorselector_set_size_hints(Evas_Object *obj, int timesw, int timesh) { Evas_Coord minw = -1, minh = -1; elm_coords_finger_size_adjust(timesw, &minw, timesh, &minh); edje_object_size_min_restricted_calc(obj, &minw, &minh, minw, minh); evas_object_size_hint_min_set(obj, minw, minh); evas_object_size_hint_max_set(obj, -1, -1); }
static void _elm_calendar_smart_sizing_eval(Evas_Object *obj) { Evas_Coord minw = -1, minh = -1; ELM_CALENDAR_DATA_GET(obj, sd); elm_coords_finger_size_adjust(8, &minw, ELM_DAY_LAST, &minh); edje_object_size_min_restricted_calc (ELM_WIDGET_DATA(sd)->resize_obj, &minw, &minh, minw, minh); evas_object_size_hint_min_set(obj, minw, minh); evas_object_size_hint_max_set(obj, -1, -1); }
static void _sizing_eval(Evas_Object *obj) { Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; double scale; ELM_PHOTO_DATA_GET(obj, sd); if (sd->size <= 0) return; scale = (sd->size * elm_widget_scale_get(obj) * elm_config_scale_get()); evas_object_size_hint_min_set(sd->icon, scale, scale); elm_coords_finger_size_adjust(1, &minw, 1, &minh); edje_object_size_min_restricted_calc (ELM_WIDGET_DATA(sd)->resize_obj, &minw, &minh, minw, minh); elm_coords_finger_size_adjust(1, &minw, 1, &minh); maxw = minw; maxh = minh; evas_object_size_hint_min_set(obj, minw, minh); evas_object_size_hint_max_set(obj, maxw, maxh); }
static void _elm_panes_smart_theme(Eo *obj, void *_pd, va_list *list) { double size; Evas_Coord minw = 0, minh = 0; Elm_Panes_Smart_Data *sd = _pd; Eina_Bool *ret = va_arg(*list, Eina_Bool *); if (ret) *ret = EINA_FALSE; Eina_Bool int_ret = EINA_FALSE; ELM_LAYOUT_DATA_GET(obj, ld); if (sd->horizontal) eina_stringshare_replace(&ld->group, "horizontal"); else eina_stringshare_replace(&ld->group, "vertical"); evas_object_hide(sd->event); elm_coords_finger_size_adjust(1, &minw, 1, &minh); evas_object_size_hint_min_set(sd->event, minw, minh); eo_do_super(obj, MY_CLASS, elm_wdg_theme(&int_ret)); if (!int_ret) return; size = elm_panes_content_left_size_get(obj); if (sd->fixed) { elm_layout_signal_emit(obj, "elm,panes,fixed", "elm"); //TODO: remove this signal on EFL 2.0. // I left this due to the backward compatibility. elm_layout_signal_emit(obj, "elm.panes.fixed", "elm"); } elm_layout_sizing_eval(obj); elm_panes_content_left_size_set(obj, size); if (ret) *ret = EINA_TRUE; }
EAPI_MAIN int elm_main(int argc, char **argv) { int h; Evas_Object *win, *bg, *box, *frame, *check, *b, *slider; /* tell elm about our app so it can figure out where to get files */ elm_app_compile_bin_dir_set(BIN_DIR); elm_app_compile_data_dir_set(DATA_DIR); elm_app_compile_lib_dir_set(LIB_DIR); elm_app_info_set(elm_main, "elementary", "images/logo.png"); fprintf(stdout, "prefix was set to: %s\n", elm_app_prefix_dir_get()); fprintf(stdout, "data directory is: %s\n", elm_app_data_dir_get()); fprintf(stdout, "library directory is: %s\n", elm_app_lib_dir_get()); fprintf(stdout, "locale directory is: %s\n", elm_app_locale_dir_get()); win = elm_win_add(NULL, "top-level-funcs-example", ELM_WIN_BASIC); elm_win_title_set(win, "Elementary Top-level Functions Example"); /* by using this policy value, we avoid having to * evas_object_smart_callback_add(win, "delete,request", _on_exit, NULL), * calling elm_exit() on that callback ourselves. */ elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); elm_win_autodel_set(win, EINA_TRUE); bg = elm_bg_add(win); evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, bg); evas_object_show(bg); evas_object_size_hint_min_set(bg, 160, 160); /* outer box */ box = elm_box_add(win); evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_win_resize_object_add(win, box); evas_object_show(box); frame = elm_frame_add(win); elm_object_text_set(frame, "Button"); evas_object_size_hint_align_set(frame, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(frame); elm_box_pack_end(box, frame); d.btn = elm_button_add(win); elm_object_text_set(d.btn, "Click me"); elm_object_content_set(frame, d.btn); fprintf(stdout, "Elementary's finger size is set to %d pixels\n.", elm_config_finger_size_get()); elm_coords_finger_size_adjust(0, NULL, 3, &h); /* so, button will be 3 fingers tall */ evas_object_size_hint_min_set(d.btn, 0, h); evas_object_show(d.btn); b = elm_box_add(win); elm_box_horizontal_set(b, EINA_FALSE); evas_object_size_hint_weight_set(b, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(b, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_win_resize_object_add(win, b); elm_box_pack_end(box, b); evas_object_show(b); check = elm_check_add(win); evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(check, 0.0, 0.0); elm_object_text_set(check, "Button enabled"); elm_check_state_pointer_set(check, &d.btn_enabled); evas_object_smart_callback_add(check, "changed", _btn_enabled_cb, NULL); elm_box_pack_end(box, check); evas_object_show(check); b = elm_button_add(win); evas_object_size_hint_weight_set(b, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(b, 0.0, 0.0); elm_object_text_set(b, "Focus top button"); evas_object_smart_callback_add(b, "clicked", _btn_focus_cb, NULL); elm_box_pack_end(box, b); evas_object_show(b); b = elm_button_add(win); evas_object_size_hint_weight_set(b, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(b, 0.0, 0.0); elm_object_text_set(b, "Unfocus top button"); evas_object_smart_callback_add(b, "clicked", _btn_unfocus_cb, NULL); elm_box_pack_end(box, b); evas_object_show(b); check = elm_check_add(win); evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(check, 0.0, 0.0); elm_object_text_set(check, "Button gets focus"); elm_check_state_pointer_set(check, &d.btn_gets_focus); evas_object_smart_callback_add(check, "changed", _btn_focus_allow_cb, NULL); elm_box_pack_end(box, check); evas_object_show(check); slider = elm_slider_add(win); elm_slider_min_max_set(slider, 0, 4); elm_slider_unit_format_set(slider, "%1.1f"); elm_slider_indicator_format_set(slider, "%1.1f"); evas_object_size_hint_weight_set( slider, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(slider, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_smart_callback_add(slider, "changed", _btn_scale_cb, NULL); elm_box_pack_end(box, slider); evas_object_show(slider); evas_object_resize(win, WIDTH, HEIGHT); elm_win_focus_highlight_enabled_set(win, EINA_TRUE); evas_object_show(win); elm_run(); /* and run the program now, starting to handle all * events, etc. */ elm_shutdown(); /* clean up and shut down */ /* exit code */ return 0; }