Eflxx::Size Object::getMinimalSize() const { int w, h; edje_object_size_min_get( o, &w, &h ); Dout( dc::notice, "size min get seems to be " << w << " x " << h ); return Eflxx::Size( w, h ); }
/** * Moves notification to orientation. * * This function moves notification to orientation * according to object RTL orientation. * * @param obj notification object. * * @param orient notification orientation. * * @internal **/ static void _notify_move_to_orientation(Evas_Object *obj) { Evas_Coord minw = -1, minh = -1; Evas_Coord x, y, w, h; double ax, ay; ELM_NOTIFY_DATA_GET(obj, sd); evas_object_geometry_get(obj, &x, &y, &w, &h); edje_object_size_min_get(sd->notify, &minw, &minh); edje_object_size_min_restricted_calc(sd->notify, &minw, &minh, minw, minh); ax = sd->horizontal_align; ay = sd->vertical_align; if ((elm_widget_mirrored_get(obj)) && (ax != ELM_NOTIFY_ALIGN_FILL)) ax = 1.0 - ax; if (ax == ELM_NOTIFY_ALIGN_FILL) minw = w; if (ay == ELM_NOTIFY_ALIGN_FILL) minh = h; x = x + ((w - minw) * ax); y = y + ((h - minh) * ay); evas_object_move(sd->notify, x, y); }
EAPI void e_obj_dialog_show(E_Obj_Dialog *od) { Evas_Coord w, h, mw, mh; const char *s; E_OBJECT_CHECK(od); E_OBJECT_TYPE_CHECK(od, E_OBJ_DIALOG_TYPE); edje_object_size_min_get(od->bg_object, &mw, &mh); edje_object_size_min_restricted_calc(od->bg_object, &mw, &mh, mw, mh); evas_object_resize(od->bg_object, mw, mh); e_win_resize(od->win, mw, mh); e_win_size_min_set(od->win, mw, mh); edje_object_size_max_get(od->bg_object, &w, &h); if ((w > 0) && (h > 0)) { if (w < mw) w = mw; if (h < mh) h = mh; e_win_size_max_set(od->win, w, h); } s = edje_object_data_get(od->bg_object, "borderless"); if (s && (!strcmp(s, "1"))) e_win_borderless_set(od->win, 1); s = edje_object_data_get(od->bg_object, "shaped"); if (s && (!strcmp(s, "1"))) e_win_shaped_set(od->win, 1); e_win_show(od->win); }
static void _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient EINA_UNUSED) { Evas_Coord mw, mh; edje_object_size_min_get(gcc->o_base, &mw, &mh); if ((mw < 1) || (mh < 1)) edje_object_size_min_calc(gcc->o_base, &mw, &mh); if (mw < 4) mw = 4; if (mh < 4) mh = 4; e_gadcon_client_aspect_set(gcc, mw, mh); e_gadcon_client_min_size_set(gcc, mw, mh); }
Scrolling * scrolling_new(Game *g, int nbr) { Scrolling *s; Evas_Coord gw; Evas_Coord gh; if (nbr <= 0) return NULL; s = (Scrolling *)calloc(1, sizeof(Scrolling)); if (!s) return NULL; game_size_get(g, &gw, &gh); s->elts[0] = elements_new(game_evas_get(g), gw, gh, nbr, SCROLLING_LEFT); if (!s->elts[0]) goto free_s; s->elts[1] = elements_new(game_evas_get(g), gw, gh, nbr, SCROLLING_RIGHT); if (!s->elts[1]) goto free_elts_0; s->g = g; s->nebula = edje_object_add(game_evas_get(s->g)); if (edje_object_file_set(s->nebula, "theme.edj", "nebula")) { double r; Evas_Coord w; Evas_Coord h; srand(time(NULL)); edje_object_size_min_get(s->nebula, &w, &h); r = (double)(gw - 40 - w) * (double)rand() / (double)RAND_MAX; evas_object_move (s->nebula, 20 + (Evas_Coord)r, -h); evas_object_resize(s->nebula, w, h); evas_object_layer_set(s->nebula, -8); evas_object_show (s->nebula); ecore_timer_add(0.06, _nebula_move_cb, s); } return s; free_elts_0: elements_free(s->elts[0]); free_s: free(s); return NULL; }
void etk_test_evas_object_window_create(void *data) { Evas *evas; Evas_Object *edje_object; Evas_Object *evas_object; static Etk_Widget *window = NULL; Etk_Widget *vbox; Etk_Widget *frame; Etk_Widget *etk_evas_object; int w, h; if (window) { etk_widget_show_all(window); return; } window = etk_window_new(); etk_signal_connect_by_code(ETK_WINDOW_DELETE_EVENT_SIGNAL, ETK_OBJECT(window), ETK_CALLBACK(etk_window_hide_on_delete), NULL); etk_window_title_set(ETK_WINDOW(window), "Etk-Evas Object Test"); evas = etk_toplevel_evas_get(ETK_TOPLEVEL(window)); vbox = etk_vbox_new(ETK_FALSE, 5); /* Add an edje object */ frame = etk_frame_new("Edje Object"); edje_object = edje_object_add(evas); edje_object_file_set(edje_object, PACKAGE_DATA_DIR"/test/clock.edj", "icon"); edje_object_size_min_get(edje_object, &w, &h); edje_extern_object_min_size_set(edje_object, w, h); evas_object_resize(edje_object, w, h); etk_evas_object = etk_evas_object_new(); etk_evas_object_set_object(ETK_EVAS_OBJECT(etk_evas_object), edje_object); etk_container_add(ETK_CONTAINER(frame), etk_evas_object); etk_box_append(ETK_BOX(vbox), frame, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); /* Add an evas rectangle */ frame = etk_frame_new("Evas Object"); evas_object = evas_object_rectangle_add(evas); evas_object_resize(evas_object, 150, 150); evas_object_color_set(evas_object, 150, 100, 100, 255); etk_evas_object = etk_evas_object_new(); etk_evas_object_set_object(ETK_EVAS_OBJECT(etk_evas_object), evas_object); etk_container_add(ETK_CONTAINER(frame), etk_evas_object); etk_box_append(ETK_BOX(vbox), frame, ETK_BOX_END, ETK_BOX_EXPAND_FILL, 0); etk_container_add(ETK_CONTAINER(window), vbox); etk_widget_show_all(window); }
/** * Moves notification to orientation. * * This fucntion moves notification to orientation * according to object RTL orientation. * * @param obj notification object. * * @param orient notification orientation. * * @internal **/ static void _notify_move_to_orientation(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); int offx; int offy; Evas_Coord minw = -1, minh = -1; Evas_Coord x, y, w, h; if (!wd) return; evas_object_geometry_get(obj, &x, &y, &w, &h); edje_object_size_min_get(wd->notify, &minw, &minh); edje_object_size_min_restricted_calc(wd->notify, &minw, &minh, minw, minh); offx = (w - minw) / 2; offy = (h - minh) / 2; switch (_notify_orientation_with_rtl(obj, wd->orient)) { case ELM_NOTIFY_ORIENT_TOP: evas_object_move(wd->notify, x + offx, y); break; case ELM_NOTIFY_ORIENT_CENTER: evas_object_move(wd->notify, x + offx, y + offy); break; case ELM_NOTIFY_ORIENT_BOTTOM: evas_object_move(wd->notify, x + offx, y + h - minh); break; case ELM_NOTIFY_ORIENT_LEFT: evas_object_move(wd->notify, x, y + offy); break; case ELM_NOTIFY_ORIENT_RIGHT: evas_object_move(wd->notify, x + w - minw, y + offy); break; case ELM_NOTIFY_ORIENT_TOP_LEFT: evas_object_move(wd->notify, x, y); break; case ELM_NOTIFY_ORIENT_TOP_RIGHT: evas_object_move(wd->notify, x + w - minw, y); break; case ELM_NOTIFY_ORIENT_BOTTOM_LEFT: evas_object_move(wd->notify, x, y + h - minh); break; case ELM_NOTIFY_ORIENT_BOTTOM_RIGHT: evas_object_move(wd->notify, x + w - minw, y + h - minh); break; case ELM_NOTIFY_ORIENT_LAST: break; } }
void _eli_edje_frontend_menu_container_fill(Eli_App * eap, Evas_Object * container) { const char ** games; char * file; file = ecore_config_theme_with_path_from_name_get(eap->theme.gui.current); games = elitaire_available_games_get(); for (int i = 0; games[i][0]; i++) { Evas_Object * item; item = edje_object_add(evas_object_evas_get(container)); if (edje_object_file_set(item, file, "elitaire/element")) { Evas_Coord w, h; edje_object_size_min_get(item, NULL, &h); evas_object_geometry_get(container, NULL, NULL, &w, NULL); evas_object_resize(item, w, h); if (edje_object_part_exists(item, "elitaire_element_value")) { edje_object_part_text_set(item, "elitaire_element_value", games[i]); evas_object_show(item); edje_object_signal_callback_add(item, "item_selected", "item_selected", _eli_edje_frontend_new_game_cb, eap); esmart_container_element_append(container, item); } else { fprintf(stderr, _("Elitaire Error in %s: " "missing element_value part!\n"), file); evas_object_del(item); } } else { fprintf(stderr, _("Elitaire Error in %s: missing element group!\n"), file); evas_object_del(item); } } }
/** * Sets the theme group to be used by the editable object. * This function has to be called, or the cursor and the selection won't be * visible. * * @param editable an editable object * @param category the theme category to use for the editable object * @param group the theme group to use for the editable object */ EAPI void e_editable_theme_set(Evas_Object *editable, const char *category, const char *group) { E_Editable_Smart_Data *sd; char *obj_group; const char *data; if (evas_object_smart_smart_get(editable) != _e_editable_smart) SMARTERRNR(); if ((!editable) || (!(sd = evas_object_smart_data_get(editable)))) return; if ((!category) || (!group)) return; obj_group = alloca(strlen(group) + strlen("/selection") + 1); /* Gets the theme for the text object */ sprintf(obj_group, "%s/text", group); e_theme_edje_object_set(sd->text_object, category, obj_group); sd->average_char_w = -1; sd->average_char_h = -1; /* Gets the theme for the cursor */ sprintf(obj_group, "%s/cursor", group); e_theme_edje_object_set(sd->cursor_object, category, obj_group); edje_object_size_min_get(sd->cursor_object, &sd->cursor_width, NULL); if (sd->cursor_width < 1) sd->cursor_width = 1; /* Gets the theme for the selection */ sprintf(obj_group, "%s/selection", group); e_theme_edje_object_set(sd->selection_object, category, obj_group); data = edje_object_data_get(sd->selection_object, "on_foreground"); if ((data) && (strcmp(data, "1") == 0)) { sd->selection_on_fg = 1; evas_object_stack_above(sd->selection_object, sd->text_object); } else { sd->selection_on_fg = 0; evas_object_stack_below(sd->selection_object, sd->text_object); } _e_editable_text_update(editable); _e_editable_cursor_update(editable); }
static void _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient EINA_UNUSED) { Instance *inst; Evas_Coord mw, mh, mxw, mxh; inst = gcc->data; mw = 0, mh = 0; edje_object_size_min_get(inst->o_battery, &mw, &mh); edje_object_size_max_get(inst->o_battery, &mxw, &mxh); if ((mw < 1) || (mh < 1)) edje_object_size_min_calc(inst->o_battery, &mw, &mh); if (mw < 4) mw = 4; if (mh < 4) mh = 4; if ((mxw > 0) && (mxh > 0)) e_gadcon_client_aspect_set(gcc, mxw, mxh); e_gadcon_client_min_size_set(gcc, mw, mh); }
Evas_Object *init_entrybox(Evas *evas,const char* title,const char *defaultentry,int maxlength,entry_handler handler, Evas_Object *parent) { entry_info_struct *info = (entry_info_struct *) malloc(sizeof(entry_info_struct)); info->entry=(char*)malloc(sizeof(char)*(maxlength+1)); (info->entry)[0]='\0'; if(strlen(defaultentry) <= maxlength) { info->curchar = strlen(defaultentry); strcpy(info->entry,defaultentry); } else info->curchar = 0; info->maxchar = maxlength; info->handler = handler; info->parent = parent; Evas_Object *win=edje_object_add(evas); char *themefile=get_theme_file(); edje_object_file_set(win,themefile, "dlg_entrybox"); evas_object_data_set(win,"entry_info",(void *)info); set_key_handler(win, &entrybox_handlers); int edje_w,edje_h; edje_object_size_min_get(win, &edje_w, &edje_h); evas_object_resize(win,edje_w,edje_h); evas_object_move (win,0,0); if(title) edje_object_part_text_set(win,"dlg_entrybox/titletext",title); edje_object_part_text_set(win,"dlg_entrybox/entrytext",info->entry); evas_object_show(win); evas_object_focus_set(win,1); free(themefile); return win; }
static void _e_gadcon_popup_size_recalc(E_Gadcon_Popup *pop, Evas_Object *obj) { Evas_Coord w = 0, h = 0; e_widget_size_min_get(obj, &w, &h); if ((!w) || (!h)) evas_object_size_hint_min_get(obj, &w, &h); if ((!w) || (!h)) { edje_object_size_min_get(obj, &w, &h); edje_object_size_min_restricted_calc(obj, &w, &h, w, h); } edje_extern_object_min_size_set(obj, w, h); edje_object_size_min_calc(pop->o_bg, &pop->w, &pop->h); evas_object_resize(pop->o_bg, pop->w, pop->h); if (pop->win->visible) _e_gadcon_popup_position(pop); }
bool ui_init_edje(ePlayer *player, const char *name) { double edje_w = 0, edje_h = 0; debug(DEBUG_LEVEL_INFO, "EDJE: Defining Edje \n"); if (!(player->gui.edje = edje_object_add(player->gui.evas))) { debug(DEBUG_LEVEL_CRITICAL, "Cannot create Edje!\n"); return false; } evas_object_name_set(player->gui.edje, "main_edje"); if (!edje_object_file_set(player->gui.edje, find_theme(player->cfg.theme), name)) { debug(DEBUG_LEVEL_CRITICAL, "Cannot load theme '%s'!\n", player->cfg.theme); return false; } evas_object_move(player->gui.edje, 0, 0); evas_object_pass_events_set (player->gui.edje, 1); evas_object_show(player->gui.edje); /* set max size */ edje_object_size_max_get(player->gui.edje, &edje_w, &edje_h); ecore_evas_size_max_set(player->gui.ee, edje_w, edje_h); /* set min size */ edje_object_size_min_get(player->gui.edje, &edje_w, &edje_h); ecore_evas_size_min_set(player->gui.ee, edje_w, edje_h); /* resize to the min size */ ecore_evas_resize(player->gui.ee, (int) edje_w, (int) edje_h); setup_playlist(player); ui_refresh_volume(player); register_callbacks(player); return true; }
EdjeObject *ActivityAudioListView::createRootButton(string title, string subtitle, string total, int row, int col) { EdjeObject *obj = new EdjeObject(theme, evas); obj->LoadEdje("calaos/audio/browser/button"); obj->setPartText("title", title); obj->setPartText("subtitle", subtitle); obj->setPartText("total", total); obj->Show(); int w, h; edje_object_size_min_get(obj->getEvasObject(), &w, &h); obj->Resize(w, h); evas_object_size_hint_min_set(obj->getEvasObject(), w, h); browser_root_buttons.push_back(obj); if (!edje_object_part_table_pack(browser_root->getEvasObject(), "table", obj->getEvasObject(), col, row, 1, 1)) cCritical() << "ActivityAudioListView::createRootButton(), failed to pack object into table !"; return obj; }
/* Checkbox: render() */ static Etk_Bool _checkbox_render(Etk_Tree_Model *model, Etk_Tree_Row *row, Etk_Geometry geometry, void *cell_data, Evas_Object *cell_objects[ETK_TREE_MAX_OBJECTS_PER_MODEL], Evas *evas) { Etk_Bool *checked; int w, h; if (!(checked = cell_data) || !cell_objects[0]) return ETK_FALSE; if (*checked) edje_object_signal_emit(cell_objects[0], "etk,state,on", "etk"); else edje_object_signal_emit(cell_objects[0], "etk,state,off", "etk"); edje_object_message_signal_process(cell_objects[0]); evas_object_data_set(cell_objects[0], "_Etk_Tree_Model_Checkbox::Row", row); edje_object_size_min_get(cell_objects[0], &w, &h); evas_object_move(cell_objects[0], geometry.x, geometry.y + ((geometry.h - h) / 2)); evas_object_resize(cell_objects[0], w, h); evas_object_show(cell_objects[0]); return ETK_FALSE; }
/* Progressbar: render() */ static Etk_Bool _progress_bar_render(Etk_Tree_Model *model, Etk_Tree_Row *row, Etk_Geometry geometry, void *cell_data, Evas_Object *cell_objects[ETK_TREE_MAX_OBJECTS_PER_MODEL], Evas *evas) { Etk_Tree_Model_Progressbar_Data *pbar_data; int w, h; if (!(pbar_data = cell_data) || !cell_objects[0]) return ETK_FALSE; edje_object_part_text_set(cell_objects[0], "etk.text.text", pbar_data->text ? pbar_data->text : ""); evas_object_data_set(cell_objects[0], "_Etk_Tree_Model_Progressbar::Row", row); edje_object_size_min_get(cell_objects[0], &w, &h); evas_object_move(cell_objects[0], geometry.x, geometry.y + ((geometry.h - h) / 2)); evas_object_resize(cell_objects[0], w > geometry.w ? w : geometry.w, h); edje_object_part_drag_value_set(cell_objects[0], "etk.dragable.filler", 0.0, 0.0); edje_object_part_drag_size_set(cell_objects[0], "etk.dragable.filler", pbar_data->fraction, 0.0); evas_object_show(cell_objects[0]); return ETK_FALSE; }
static void _calc(Evas_Object *obj) { Evas_Coord minw = -1, minh = -1; Evas_Coord x, y, w, h; ELM_NOTIFY_DATA_GET(obj, sd); _sizing_eval(obj); evas_object_geometry_get(obj, &x, &y, &w, &h); edje_object_size_min_get(sd->notify, &minw, &minh); edje_object_size_min_restricted_calc(sd->notify, &minw, &minh, minw, minh); if (sd->horizontal_align == ELM_NOTIFY_ALIGN_FILL) minw = w; if (sd->vertical_align == ELM_NOTIFY_ALIGN_FILL) minh = h; if (sd->content) { _notify_move_to_orientation(obj); evas_object_resize(sd->notify, minw, minh); } }
void Widget::applyCursor() { const char *file; Evas_Coord x, y; String theme = edjeThemeRecursive(); if (!theme.isNull()) file = edjeThemeRecursive().utf8().data(); m_data->m_cursorObject = edje_object_add(evas()); if (!edje_object_file_set(m_data->m_cursorObject, file, m_data->m_cursorGroup.utf8().data())) { evas_object_del(m_data->m_cursorObject); m_data->m_cursorObject = 0; ecore_evas_object_cursor_set(ecoreEvas(), 0, 0, 0, 0); applyFallbackCursor(); } else { Evas_Coord w, h; const char *d; edje_object_size_min_get(m_data->m_cursorObject, &w, &h); if ((w <= 0) || (h <= 0)) edje_object_size_min_calc(m_data->m_cursorObject, &w, &h); if ((w <= 0) || (h <= 0)) w = h = 16; evas_object_resize(m_data->m_cursorObject, w, h); d = edje_object_data_get(m_data->m_cursorObject, "hot.x"); x = d ? atoi(d) : 0; d = edje_object_data_get(m_data->m_cursorObject, "hot.y"); y = d ? atoi(d) : 0; ecore_evas_object_cursor_set(ecoreEvas(), m_data->m_cursorObject, EVAS_LAYER_MAX, x, y); } }
/* Theme Change */ void cc_update_theme() { int w, h; char *edjefn; if (!controlcentre) return; edjefn = malloc(PATH_MAX); snprintf(edjefn, PATH_MAX, PACKAGE_DATA_DIR "/themes/%s.edj", main_config->theme); edje_object_file_set(controlcentre->edje, edjefn, CC_PART); free(edjefn); /* EDJE and ECORE min, max and resizing */ edje_object_size_max_get(controlcentre->edje, &w, &h); ecore_evas_size_max_set(controlcentre->win, w, h); edje_object_size_min_get(controlcentre->edje, &w, &h); ecore_evas_size_min_set(controlcentre->win, w, h); ecore_evas_resize(controlcentre->win, w, h); evas_object_resize(controlcentre->edje, w, h); evas_object_resize(controlcentre->dragger, w, h); }
int elitaire_object_file_set(Evas_Object * elitaire, const char * file) { int i, number; Evas_Object * card; Elitaire * eli; vector<stackLook>::const_iterator iord, iend; Eina_Bool change_file; card_iterator it, it_end; int num_decks; eli = (Elitaire *) evas_object_smart_data_get(elitaire); if (!eli) return 0; /* for the stack images */ iord = eli->game->getStackLooksBegin(); iend = eli->game->getStackLooksEnd(); if (eli->file) change_file = true; else change_file = false; if (eli->file) { free(eli->file); eli->file = NULL; } if (!file) return 0; else eli->file = strdup(file); /* get the maximal and minimal size of the cards via edje */ /* I expect that every card in the game has the same size */ card = edje_object_add(eli->evas); if (!edje_object_file_set(card, eli->file, "elitaire/card/00")) return 0; edje_object_size_max_get(card, &eli->card_max_w, &eli->card_max_h); edje_object_size_min_get(card, &eli->card_min_w, &eli->card_min_h); evas_object_del(card); /*connect the playingCards with elitaire_cards and set the callbacks */ if (change_file) elitaire_cards_del(eli); num_decks = eli->game->getNumDecks(); for (i = 0; i < num_decks; i++) { it = eli->game->getDeckBegin(i); it_end = eli->game->getDeckEnd(i); while (it != it_end) { card = elitaire_card_new(eli, *it); evas_object_smart_member_add(card, elitaire); evas_object_clip_set(card, eli->clip); evas_object_show(card); (*it)->data = (void *) card; elitaire_card_callback_add(card, EVAS_CALLBACK_MOUSE_DOWN, elitaire_mouse_down_cb); elitaire_card_callback_add(card, EVAS_CALLBACK_MOUSE_UP, elitaire_mouse_up_cb); //evas_object_layer_set(card, 1); if (evas_alloc_error() != EVAS_ALLOC_ERROR_NONE) { fprintf(stderr, _("Elitaire Error: Callback registering failed!\n")); return 0; } it++; } } /* give the stacks an pic */ if (change_file) elitaire_stacks_del(eli); eli->stacks = (Evas_Object **) calloc(eli->num_stacks, sizeof(Elitaire*)); number = 0; while (iord != iend) { switch (*iord) { case STACK: case LAST: eli->stacks[number] = edje_object_add(eli->evas); evas_object_smart_member_add(eli->stacks[number], elitaire); edje_object_file_set(eli->stacks[number], eli->file, "elitaire/stack/last"); evas_object_event_callback_add(eli->stacks[number], EVAS_CALLBACK_MOUSE_UP, _elitaire_stack_mouse_up_cb, eli); evas_object_show(eli->stacks[number]); evas_object_lower(eli->stacks[number]); number++; break; case ALL: eli->stacks[number] = edje_object_add(eli->evas); evas_object_smart_member_add(eli->stacks[number], elitaire); edje_object_file_set(eli->stacks[number], eli->file, "elitaire/stack/all"); evas_object_event_callback_add(eli->stacks[number], EVAS_CALLBACK_MOUSE_UP, _elitaire_stack_mouse_up_cb, eli); evas_object_show(eli->stacks[number]); evas_object_lower(eli->stacks[number]); number++; break; default: break; } iord++; } if (change_file) { elitaire_force_resize(eli); elitaire_reinit(eli); } return 1; }
/* Image: render() */ static Etk_Bool _image_render(Etk_Tree_Model *model, Etk_Tree_Row *row, Etk_Geometry geometry, void *cell_data, Evas_Object *cell_objects[ETK_TREE_MAX_OBJECTS_PER_MODEL], Evas *evas) { Etk_Tree_Model_Image *image_model; Etk_Tree_Model_Image_Data *image_data; int image_width, image_height; Etk_Geometry image_geometry; Etk_Bool object_created = ETK_FALSE; float aspect; char *ext; if (!(image_model = (Etk_Tree_Model_Image *)model) || !(image_data = cell_data) || !evas) return ETK_FALSE; if (!image_data->filename || image_data->type == ETK_TREE_MODEL_NOT_FOUND) return ETK_FALSE; /* If we don't know yet what the image's type is, we "guess" it */ if (image_data->type == ETK_TREE_MODEL_UNKNOWN_YET) { if (!image_data->key) image_data->type = ETK_TREE_MODEL_NORMAL; else if ((ext = strrchr(image_data->filename, '.')) && strcasecmp(ext + 1, "eet") == 0) image_data->type = ETK_TREE_MODEL_NORMAL; else image_data->type = ETK_TREE_MODEL_EDJE; } /* If the object is not already in the cache, we load it */ if (!(cell_objects[0] = etk_cache_find(image_model->cache, image_data->filename, image_data->key))) { if (image_data->type == ETK_TREE_MODEL_NORMAL) { cell_objects[0] = evas_object_image_add(evas); evas_object_pass_events_set(cell_objects[0], 1); evas_object_image_file_set(cell_objects[0], image_data->filename, image_data->key); if (!evas_object_image_load_error_get(cell_objects[0])) object_created = ETK_TRUE; else image_data->type = ETK_TREE_MODEL_NOT_FOUND; } /* If it's not a normal image file, then it's an Edje file... */ else { cell_objects[0] = edje_object_add(evas); evas_object_pass_events_set(cell_objects[0], 1); if (edje_object_file_set(cell_objects[0], image_data->filename, image_data->key)) object_created = ETK_TRUE; else image_data->type = ETK_TREE_MODEL_NOT_FOUND; } } /* If loading the image has failed, we destroy the object and return */ if (image_data->type == ETK_TREE_MODEL_NOT_FOUND) { if (cell_objects[0]) { evas_object_del(cell_objects[0]); cell_objects[0] = NULL; } return ETK_FALSE; } /* The image is correctly loaded, we can now render it */ if (image_data->type == ETK_TREE_MODEL_NORMAL) evas_object_image_size_get(cell_objects[0], &image_width, &image_height); else edje_object_size_min_get(cell_objects[0], &image_width, &image_height); if (image_width == 0 || image_height == 0) { image_width = geometry.h; image_height = geometry.h; } aspect = ((float)image_width / image_height); /* No limitation of width */ if (image_model->width <= 0) { if (image_height <= geometry.h) { image_geometry.w = image_width; image_geometry.h = image_height; } else { image_geometry.w = geometry.h * aspect; image_geometry.h = geometry.h; } image_geometry.x = geometry.x; image_geometry.y = geometry.y + ((geometry.h - image_geometry.h) / 2); } /* The max width is limited */ else { if ((image_width > image_model->width || image_height > geometry.h)) { /* The image doesn't fit in, we need to resize it */ if (geometry.h * aspect > image_model->width) { image_geometry.w = image_model->width; image_geometry.h = image_model->width / aspect; } else { image_geometry.w = geometry.h * aspect; image_geometry.h = geometry.h; } } else { image_geometry.w = image_width; image_geometry.h = image_height; } image_geometry.x = geometry.x + ((image_model->width - image_geometry.w) * image_model->halign); image_geometry.y = geometry.y + ((geometry.h - image_geometry.h) / 2); } if (image_data->type == ETK_TREE_MODEL_NORMAL) evas_object_image_fill_set(cell_objects[0], 0, 0, image_geometry.w, image_geometry.h); evas_object_move(cell_objects[0], image_geometry.x, image_geometry.y); evas_object_resize(cell_objects[0], image_geometry.w, image_geometry.h); evas_object_show(cell_objects[0]); return object_created; }
ApplicationController::ApplicationController(Evas *_e, Evas_Object *_l): evas(_e), layout(_l), mouseCursor(NULL), menu_hidden(false), homeController(NULL), mediaController(NULL), scenariosController(NULL), configController(NULL), keyboardController(NULL), webController(NULL), editScController(NULL), scheduleScController(NULL) { if (Utils::get_config_option("show_cursor") == "true") { mouseCursor = new EdjeObject(ApplicationMain::getTheme(), evas); try { mouseCursor->LoadEdje("calaos/cursor"); } catch(exception const& e) { cCritical() << "ApplicationController: Can't load mouse cursor"; throw; } int w, h; edje_object_size_min_get(mouseCursor->getEvasObject(), &w, &h); mouseCursor->Resize(w, h); mouseCursor->Show(); ecore_evas_object_cursor_set(ecore_evas_ecore_evas_get(evas), mouseCursor->getEvasObject(), EVAS_LAYER_MAX - 32, w / 2, h / 2); } else { Evas_Object *cursor = evas_object_rectangle_add(evas); evas_object_color_set(cursor, 0, 0, 0, 0); evas_object_resize(cursor, 1, 1); evas_object_show(cursor); ecore_evas_object_cursor_set(ecore_evas_ecore_evas_get(evas), cursor, EVAS_LAYER_MAX - 32, 0, 0); } menuView = new MainMenuView(evas, layout); menuView->setVersionString(PACKAGE_VERSION); menuView->on_home_click.connect(sigc::mem_fun(*this, &ApplicationController::onMenuHomeClick)); menuView->on_media_click.connect(sigc::mem_fun(*this, &ApplicationController::onMenuMediaClick)); menuView->on_scenario_click.connect(sigc::mem_fun(*this, &ApplicationController::onMenuScenarioClick)); menuView->on_config_click.connect(sigc::mem_fun(*this, &ApplicationController::onMenuConfigClick)); menuView->on_reboot_click.connect(sigc::mem_fun(*this, &ApplicationController::onMenuRebootClick)); menuView->on_suspend_click.connect(sigc::mem_fun(*this, &ApplicationController::onMenuSuspendClick)); menuView->on_widget_click.connect(sigc::mem_fun(*this, &ApplicationController::onMenuWidgetClick)); menuView->on_addwidget_click.connect(sigc::mem_fun(*this, &ApplicationController::onMenuAddWidgetClick)); //Start the model instance CalaosModel::Instance().home_loaded.connect(sigc::mem_fun(*this, &ApplicationController::home_loaded)); CalaosModel::Instance().login_failed.connect(sigc::mem_fun(*this, &ApplicationController::login_failed)); contentView = new MainContentView(evas, layout); elm_object_part_content_set(layout, "calaos.main.content", contentView->getSmartObject()); widgetsController = new ActivityWidgetsController(evas, layout); contentView->addView(widgetsController->getView()); menuView->on_menu_open.connect(sigc::mem_fun(*widgetsController, &ActivityWidgetsController::dimView)); menuView->on_menu_close.connect(sigc::mem_fun(*widgetsController, &ActivityWidgetsController::resetView)); menuView->on_widget_valid_click.connect(sigc::mem_fun(*widgetsController, &ActivityWidgetsController::validEdit)); menuView->on_widget_cancel_click.connect(sigc::mem_fun(*widgetsController, &ActivityWidgetsController::cancelEdit)); }
int set0(Evas *e){ Evas_Object *img, *proxy; bool rv; int w,h; struct imageupdate *iu; //int minw,minh,maxw,maxh; label_add(e,10,0,"The Source",false); img = evas_object_image_filled_add(e); evas_object_image_file_set(img, images[0], NULL); evas_object_image_size_get(img, &w, &h); w = w/2; h = h/2; evas_object_resize(img, w, h); evas_object_move(img, 10,10); evas_object_show(img); iu = calloc(1,sizeof(struct imageupdate)); iu->cur = 0; iu->max = N_IMAGES; iu->obj = img; iu->imagelist = images; ecore_timer_add(1.4, image_next, iu); label_add(e,20+w,0,"Normal Proxy",false); proxy = evas_object_image_filled_add(e); if (!proxy){ printf("Unable to create proxy object\n"); return 1; } rv = evas_object_image_source_set(proxy, img); if (rv != true){ printf("Error setting proxy source\n"); return 1; } evas_object_resize(proxy, w, h); evas_object_move(proxy, 20 + w, 10); /* If this is uncommented: Moves proxy evyer second (swap x/y) */ //iu->proxy = proxy; evas_object_show(proxy); label_add(e,10,h + 20, "Reflected Proxy",false); proxy = evas_object_image_filled_add(e); evas_object_image_source_set(proxy, img); evas_object_resize(proxy, w, h); evas_object_move(proxy, 10, 30+h); evas_object_show(proxy); flip_map(proxy); label_add(e,20+w,h+20,"Squish Proxy",false); proxy = evas_object_image_add(e); evas_object_image_source_set(proxy, img); evas_object_resize(proxy, w, h / 2); evas_object_image_fill_set(proxy, 0,0, w, h/2); evas_object_move(proxy, 20+w, 30+h); evas_object_show(proxy); /* Proxy a label */ img = label_add(e, 300, 10, "Label Source ",true); evas_object_geometry_get(img, NULL, NULL, &w, &h); proxy = evas_object_image_filled_add(e); evas_object_image_source_set(proxy, img); evas_object_resize(proxy, w, h); evas_object_move(proxy, 300, 10 + h + 3); evas_object_show(proxy); flip_map(proxy); label_add(e, 440, 10, "Squish Label",false); proxy = evas_object_image_add(e); evas_object_image_source_set(proxy, img); evas_object_resize(proxy, w, h / 2); evas_object_image_fill_set(proxy, 0,0,w,h/2); evas_object_move(proxy, 440, 10 + h + 3); evas_object_show(proxy); label_add(e, 440, 60, "Stretch Label",false); proxy = evas_object_image_add(e); evas_object_image_source_set(proxy, img); evas_object_resize(proxy, w, h); evas_object_image_fill_set(proxy, 0,0,w, h); evas_object_move(proxy, 440, 60 + h + 3); evas_object_show(proxy); label_add(e, 240, 60, "Highlight", false); proxy = evas_object_image_add(e); evas_object_image_source_set(proxy, img); evas_object_resize(proxy, 50,50); evas_object_image_fill_set(proxy, -w/2,-h/2,w*3,h*3); evas_object_move(proxy, 250, 60 + h + 3); evas_object_show(proxy); img = label_add(e, 400, 120, "Zoomy Text!", false); proxy = evas_object_image_filled_add(e); evas_object_image_source_set(proxy, img); evas_object_resize(proxy, w, h); evas_object_move(proxy, 350, 150); zoom_map(proxy); evas_object_show(proxy); /* Proxy a text block */ img = textblock_add(e, 10, 200); evas_object_geometry_get(img, NULL, NULL, &w, &h); proxy = evas_object_image_filled_add(e); evas_object_image_source_set(proxy, img); evas_object_resize(proxy, w, h); evas_object_move(proxy, 10, 320); evas_object_show(proxy); flip_map(proxy); proxy = evas_object_image_filled_add(e); evas_object_image_source_set(proxy, img); evas_object_resize(proxy, w/2, h/2); evas_object_move(proxy, 10 + w, 320); evas_object_show(proxy); /* The 'smart' object */ img = sp_add(e); evas_object_move(img, 300,200); evas_object_resize(img, 100, 20); ecore_timer_add(0.05, smart_animate, img); w = 100; h = 20; proxy = evas_object_image_filled_add(e); evas_object_image_source_set(proxy, img); evas_object_resize(proxy, w, h); evas_object_move(proxy, 300, 240); evas_object_show(proxy); flip_map(proxy); proxy = evas_object_image_filled_add(e); evas_object_image_source_set(proxy, img); evas_object_resize(proxy, w * 2, h / 3); evas_object_image_fill_set(proxy, 0, 0, w * 2, h /3 ); evas_object_move(proxy, 420, 240); evas_object_show(proxy); img = evas_object_image_filled_add(e); proxy = evas_object_image_filled_add(e); evas_object_move(img, 500, 300); evas_object_move(proxy, 600, 300); evas_object_resize(img, 100, 100); evas_object_resize(proxy, 100, 100); evas_object_show(img); evas_object_show(proxy); evas_object_image_source_set(img, proxy); evas_object_image_source_set(proxy, img); #if 0 label_add(e, 300,90, "Edje File", false); img = edje_object_add(e); if (!_edje_load_or_show_error(img, "basic.edj", "proxytest")){ evas_object_del(img); } evas_object_resize(img,220,200); evas_object_move(img,300,100); evas_object_show(img); edje_object_size_max_get(img, &maxw, &maxh); edje_object_size_min_get(img, &minw, &minh); if ((minw <= 0) && (minh <= 0)) edje_object_size_min_calc(img, &minw, &minh); evas_object_size_hint_max_set(img, maxw, maxh); evas_object_size_hint_min_set(img, minw, minh); evas_object_size_hint_weight_set(img, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(img, EVAS_HINT_FILL, EVAS_HINT_FILL); #endif /* The edje file */ return 0; }
void setup_cc_with_pos(int x, int y) { ControlCentre *cc; char *edjefn = malloc(PATH_MAX); char *fontpath = malloc(PATH_MAX); Evas_Coord edje_w, edje_h; CCPos *pos; cc = malloc(sizeof(ControlCentre)); controlcentre = cc; pos = get_cc_pos(); if (x >= 0 || y >= 0) { pos->x = x; pos->y = y; } /* Setup the Window */ if (!strcmp(main_config->render_method, "gl")) { #ifdef HAVE_ECORE_EVAS_GL cc->win = ecore_evas_gl_x11_new(NULL, 0, pos->x, pos->y, pos->width, pos->height); #else dml("GL not in Ecore_Evas module. Falling back on software!", 1); free(main_config->render_method); main_config->render_method = strdup("software"); cc->win = ecore_evas_software_x11_new(NULL, 0, pos->x, pos->y, pos->width, pos->height); #endif } else cc->win = ecore_evas_software_x11_new(NULL, 0, pos->x, pos->y, pos->width, pos->height); ecore_evas_title_set(cc->win, "Enotes"); ecore_evas_name_class_set(cc->win, "Enotes", "Enotes"); if (main_config->ontop == 1) ecore_evas_layer_set(cc->win, 7); else ecore_evas_layer_set(cc->win, 2); if (main_config->sticky == 1) ecore_evas_sticky_set(cc->win, 1); else ecore_evas_sticky_set(cc->win, 0); ecore_evas_borderless_set(cc->win, 1); ecore_evas_shaped_set(cc->win, 1); if (pos->x != 0 && pos->y != 0) ecore_evas_resize(cc->win, pos->x, pos->y); ecore_evas_show(cc->win); // if(main_config->ontop==1) /* Moving the damn thing */ ecore_evas_move(cc->win, pos->x, pos->y); /* Setup the Canvas, Render-Method and Font Path */ cc->evas = ecore_evas_get(cc->win); evas_output_method_set(cc->evas, evas_render_method_lookup(main_config-> render_method)); snprintf(fontpath, PATH_MAX, "%s/fonts", PACKAGE_DATA_DIR); evas_font_path_append(cc->evas, fontpath); free(fontpath); /* Draggable Setup */ cc->dragger = esmart_draggies_new(cc->win); evas_object_name_set(cc->dragger, "dragger"); evas_object_move(cc->dragger, 0, 0); evas_object_layer_set(cc->dragger, 0); evas_object_color_set(cc->dragger, 255, 255, 255, 0); esmart_draggies_button_set(cc->dragger, 1); evas_object_show(cc->dragger); /* Setup the EDJE */ cc->edje = edje_object_add(cc->evas); snprintf(edjefn, PATH_MAX, CC_EDJE, PACKAGE_DATA_DIR, main_config->theme); edje_object_file_set(cc->edje, edjefn, CC_PART); free(edjefn); evas_object_move(cc->edje, 0, 0); evas_object_layer_set(cc->edje, 1); evas_object_name_set(cc->edje, "edje"); evas_object_pass_events_set(cc->edje, 0); evas_object_show(cc->edje); if (pos->shaded) edje_object_signal_emit(cc->edje, EDJE_SIGNAL_CC_SHADE "_GO", ""); else edje_object_signal_emit(cc->edje, EDJE_SIGNAL_CC_UNSHADE "_GO", ""); /* EDJE and ECORE min, max and resizing */ edje_object_size_max_get(cc->edje, &edje_w, &edje_h); ecore_evas_size_max_set(cc->win, edje_w, edje_h); edje_object_size_min_get(cc->edje, &edje_w, &edje_h); ecore_evas_size_min_set(cc->win, edje_w, edje_h); ecore_evas_resize(cc->win, (int) edje_w, (int) edje_h); evas_object_resize(cc->edje, edje_w, edje_h); evas_object_resize(cc->dragger, edje_w, edje_h); /* Ecore Callbacks */ ecore_evas_callback_resize_set(cc->win, cc_resize); ecore_evas_callback_destroy_set(cc->win, cc_close_win); ecore_evas_callback_delete_request_set(cc->win, cc_close_win); /* Edje Callbacks */ edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_MINIMIZE, "", (void *) cc_minimize, cc->win); edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_CLOSE, "", (void *) cc_close, NULL); edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_SAVELOAD, "", (void *) cc_saveload, NULL); edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_SETTINGS, "", (void *) cc_settings, NULL); edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_NEW, "", (void *) cc_newnote, NULL); edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_SHADE, "", (void *) cc_shade, NULL); edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_UNSHADE, "", (void *) cc_unshade, NULL); free(pos); return; }
int elicit_theme_set(Elicit *el, const char *theme) { const char *path; int w, h; if (!theme) theme = "default"; /* first check if full path is given */ if (theme[0] == '/') { if (!edje_file_group_exists(theme, "elicit.main")) return 0; path = theme; } else path = elicit_theme_find(el, theme); if (!path) { fprintf(stderr, "[Elicit] Warning: theme \"%s\" not found, falling back to default.\n", theme); theme = "default"; path = elicit_theme_find(el, theme); } if (!path) { fprintf(stderr, "[Elicit] Error: theme \"%s\" not found.\n", theme); return 0; } if (el->path.theme) free(el->path.theme); el->path.theme = strdup(path); if (el->conf.theme != theme) { if (el->conf.theme) free(el->conf.theme); el->conf.theme = strdup(theme); } elicit_theme_unswallow_objs(el); edje_object_file_set(el->obj.main, path, "elicit.main"); edje_object_size_min_get(el->obj.main, &w, &h); if (w > el->conf.w) el->conf.w = w; if (h > el->conf.h) el->conf.h = h; ecore_evas_size_min_set(el->ee, w, h); ecore_evas_resize(el->ee, el->conf.w, el->conf.h); evas_object_move(el->obj.main, 0, 0); evas_object_resize(el->obj.main, el->conf.w, el->conf.h); evas_object_show(el->obj.main); elicit_theme_swallow_objs(el); edje_object_signal_callback_add(el->obj.main, "elicit,*", "*", cb_edje_signal, el); edje_object_signal_callback_add(el->obj.main, "mouse,move", "*", cb_edje_move, el); color_changed(el->color); /* emit signals to set theme state */ if (el->conf.grid_visible) edje_object_signal_emit(el->obj.main, "elicit,grid,on", "elicit"); else edje_object_signal_emit(el->obj.main, "elicit,grid,off", "elicit"); if (el->conf.show_band) edje_object_signal_emit(el->obj.main, "elicit,band,on", "elicit"); else edje_object_signal_emit(el->obj.main, "elicit,band,off", "elicit"); return 1; }