Exemplo n.º 1
0
// BEGIN - code running in my custom win32 thread instance
//
static DWORD WINAPI
my_thread_run(LPVOID arg)
{
   double t = 0.0;

   for (;;)
     {
        ecore_thread_main_loop_begin(); // begin critical
          { // indented for illustration of "critical" block
             Evas_Coord x, y;

             x = 200 + (200 * sin(t));
             y = 200 + (200 * cos(t));
             evas_object_move(rect, x - 50, y - 50);
          }
        ecore_thread_main_loop_end(); // end critical
        usleep(1000);
        t += 0.02;
     }
   return 0;
}
Exemplo n.º 2
0
static void _ewk_view_single_smart_resize(Evas_Object *o, Evas_Coord w, Evas_Coord h)
{
    Ewk_View_Smart_Data *sd = (Ewk_View_Smart_Data*)evas_object_smart_data_get(o);
    _parent_sc.sc.resize(o, w, h);

    // these should be queued and processed in calculate as well!
    evas_object_image_size_set(sd->backing_store, w, h);
    if (sd->animated_zoom.zoom.current < 0.00001) {
        Evas_Object *clip = evas_object_clip_get(sd->backing_store);
        Evas_Coord x, y, cw, ch;
        evas_object_image_fill_set(sd->backing_store, 0, 0, w, h);
        evas_object_geometry_get(sd->backing_store, &x, &y, 0, 0);
        evas_object_move(clip, x, y);
        ewk_frame_contents_size_get(sd->main_frame, &cw, &ch);
        if (w > cw)
            w = cw;
        if (h > ch)
            h = ch;
        evas_object_resize(clip, w, h);
    }
}
Exemplo n.º 3
0
void ApplicationController::onMenuAddWidgetClick()
{
    Evas_Object *table = createPaddingTable(evas, layout, 260, 200);

    Evas_Object *glist = elm_genlist_add(layout);
    elm_object_style_set(glist, "calaos");
    elm_genlist_select_mode_set(glist, ELM_OBJECT_SELECT_MODE_ALWAYS);
    evas_object_size_hint_fill_set(glist, EVAS_HINT_FILL, EVAS_HINT_FILL);
    evas_object_size_hint_weight_set(glist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_show(glist);

    Evas_Object *popup = elm_ctxpopup_add(layout);
    elm_object_style_set(popup, "calaos");
    evas_object_size_hint_min_set(popup, 300, 240);

    vector<ModuleDef> mods = ModuleManager::Instance().getAvailableModules();

    for (uint i = 0;i < mods.size();i++)
    {
        ModuleDef def = mods[i];
        GenlistItemWidget *item = new GenlistItemWidget(evas, glist, def);
        item->Append(glist);
        item->item_selected.connect([this,i,popup](void *)
        {
            vector<ModuleDef> m = ModuleManager::Instance().getAvailableModules();
            widgetsController->AddWidget(m[i], 200, 200);
            elm_ctxpopup_dismiss(popup);
            menuView->CloseLinkMenu();
        });
    }

    elm_table_pack(table, glist, 1, 1, 1, 1);

    elm_object_content_set(popup, table);

    Evas_Coord x,y;
    evas_pointer_canvas_xy_get(evas, &x, &y);
    evas_object_move(popup, x, y);
    evas_object_show(popup);
}
Exemplo n.º 4
0
static void
_resize_movie(struct _emotion_plugin *_plugin)
{
   Ethumb *e = _plugin->e;
   double ratio;
   int w, h;
   int fx, fy, fw, fh;

   ratio = emotion_object_ratio_get(_plugin->video);
   ethumb_calculate_aspect_from_ratio(e, ratio, &w, &h);
   ethumb_calculate_fill_from_ratio(e, ratio, &fx, &fy, &fw, &fh);
   DBG("size: w=%d, h=%d fill: x=%d, y=%d, w=%d, h=%d", w, h, fx, fy, fw, fh);

   _plugin->w = w;
   _plugin->h = h;

   ethumb_plugin_image_resize(e, _plugin->w, _plugin->h);

   evas_object_resize(_plugin->video, fw, fh);
   evas_object_move(_plugin->video, fx, fy);
   emotion_object_audio_mute_set(_plugin->video, 1);
}
Exemplo n.º 5
0
EAPI void
evas_object_smart_move_children_relative(Evas_Object *obj, Evas_Coord dx, Evas_Coord dy)
{
   const Eina_Inlist *lst;
   Evas_Object *child;

   if ((dx == 0) && (dy == 0))
     return;

   lst = evas_object_smart_members_get_direct(obj);
   EINA_INLIST_FOREACH(lst, child)
     {
        Evas_Coord orig_x, orig_y;

        // shortcut as we are in evas        
        // evas_object_geometry_get(child, &orig_x, &orig_y, NULL, NULL);
        if (child->delete_me) continue;
        if (child->is_static_clip) continue;
        orig_x = child->cur.geometry.x;
        orig_y = child->cur.geometry.y;
        evas_object_move(child, orig_x + dx, orig_y + dy);
     }
Exemplo n.º 6
0
static MiniBrowser *browserCreate(const char *url)
{
    MiniBrowser *app = malloc(sizeof(MiniBrowser));

    app->ee = ecore_evas_new(0, 0, 0, DEFAULT_WIDTH, DEFAULT_HEIGHT, 0);

    ecore_evas_title_set(app->ee, "EFL MiniBrowser");
    ecore_evas_callback_resize_set(app->ee, on_ecore_evas_resize);
    ecore_evas_borderless_set(app->ee, 0);
    ecore_evas_show(app->ee);

    app->evas = ecore_evas_get(app->ee);

    app->bg = evas_object_rectangle_add(app->evas);
    evas_object_name_set(app->bg, "bg");
    evas_object_size_hint_weight_set(app->bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);

    evas_object_move(app->bg, 0, 0);
    evas_object_resize(app->bg, DEFAULT_WIDTH, DEFAULT_HEIGHT);
    evas_object_color_set(app->bg, 255, 150, 150, 255);
    evas_object_show(app->bg);

    /* Create webview */
    app->browser = ewk_view_add(app->evas);
    evas_object_name_set(app->browser, "browser");

    evas_object_smart_callback_add(app->browser, "title,changed", on_title_changed, app);

    evas_object_event_callback_add(app->browser, EVAS_CALLBACK_KEY_DOWN, on_key_down, app);

    evas_object_size_hint_weight_set(app->browser, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_resize(app->browser, DEFAULT_WIDTH, DEFAULT_HEIGHT);
    evas_object_show(app->browser);
    evas_object_focus_set(app->browser, EINA_TRUE);

    ewk_view_uri_set(app->browser, url);

    return app;
}
static void
_btn_clicked(void *data, Evas_Object *obj, void *event_info)
{
    Evas_Object *win = data;
    Evas_Object *ctxpopup;
    Evas_Coord x,y;

    ctxpopup = elm_ctxpopup_add(win);

    elm_object_style_set(ctxpopup, "1text.1icon");
    elm_object_signal_emit(ctxpopup, "elm,action,focus", "elm");
    item_new(ctxpopup, "Text List1", "home");
    item_new(ctxpopup, "Text List2", "file");
    item_new(ctxpopup, "Text List3", "delete");

    switch (dir) {
        case 0:
            elm_ctxpopup_direction_priority_set(ctxpopup,
                                                ELM_CTXPOPUP_DIRECTION_UP, 0, 0, 0);
            break;
        case 1:
            elm_ctxpopup_direction_priority_set(ctxpopup,
                                                ELM_CTXPOPUP_DIRECTION_DOWN, 0, 0, 0);
            break;
        case 2:
            elm_ctxpopup_direction_priority_set(ctxpopup,
                                                ELM_CTXPOPUP_DIRECTION_LEFT, 0, 0, 0);
            break;
        case 3:
            elm_ctxpopup_direction_priority_set(ctxpopup,
                                                ELM_CTXPOPUP_DIRECTION_RIGHT, 0, 0, 0);
            break;
    }

    evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y);
    evas_object_move(ctxpopup, x, y);
    evas_object_show(ctxpopup);
    eext_object_event_callback_add(ctxpopup, EEXT_CALLBACK_BACK, _ctxpopup_back_key_cb, NULL);
}
Exemplo n.º 8
0
void
theme_init(const char *theme)
{
   Evas_Object *o;
   char buf[4096];
   
   if (!theme) theme = "default";
   o = edje_object_add(evas);
   if ((theme) && 
       (theme[0] != '/') && 
       (!!strncmp(theme, "./", 2)) &&
	(!!strncmp(theme, "../", 3)))
     snprintf(buf, sizeof(buf), THEMES"/%s.edj", theme);
   else
     snprintf(buf, sizeof(buf), "%s", theme);
   edje_object_file_set(o, buf, "exquisite/theme");
   evas_object_move(o, 0, 0);
   evas_object_resize(o, scr_w, scr_h);
   edje_object_signal_callback_add(o, "exquisite", "done", _theme_cb_exit_done, NULL);
   evas_object_show(o);
   o_bg = o;
}
Exemplo n.º 9
0
/* 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;
}
Exemplo n.º 10
0
/* Updates the selection of the editable object */
static void
_e_editable_selection_update(Evas_Object *editable)
{
   E_Editable_Smart_Data *sd;
   const Evas_Object *text_obj;
   Evas_Coord tx, ty;
   Evas_Coord cx, cy;
   Evas_Coord sx, sy, sw, sh;
   int start_pos, end_pos;

   if ((!editable) || (!(sd = evas_object_smart_data_get(editable))))
     return;
   if (!(text_obj = edje_object_part_object_get(sd->text_object, "e.text.text")))
     return;

   if ((sd->cursor_pos == sd->selection_pos) || (!sd->selection_visible))
     evas_object_hide(sd->selection_object);
   else
     {
        evas_object_geometry_get(text_obj, &tx, &ty, NULL, NULL);
        start_pos = (sd->cursor_pos <= sd->selection_pos) ?
          sd->cursor_pos : sd->selection_pos;
        end_pos = (sd->cursor_pos >= sd->selection_pos) ?
          sd->cursor_pos : sd->selection_pos;

        _e_editable_char_geometry_get_from_pos(editable, start_pos,
                                               &cx, &cy, NULL, NULL);
        sx = tx + cx;
        sy = ty + cy;

        _e_editable_char_geometry_get_from_pos(editable, end_pos,
                                               &cx, NULL, NULL, &sh);
        sw = tx + cx - sx;

        evas_object_move(sd->selection_object, sx, sy);
        evas_object_resize(sd->selection_object, sw, sh);
        evas_object_show(sd->selection_object);
     }
}
Exemplo n.º 11
0
/* 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;
}
            void WebViewImpl::draw(cocos2d::Renderer *renderer, cocos2d::Mat4 const &transform, int flags) {
                if (flags & cocos2d::Node::FLAGS_TRANSFORM_DIRTY) {
                    auto directorInstance = cocos2d::Director::getInstance();
                    auto glView = directorInstance->getOpenGLView();
                    auto frameSize = glView->getFrameSize();

                    auto winSize = directorInstance->getWinSize();

                    auto leftBottom = this->_webView->convertToWorldSpace(cocos2d::Point::ZERO);
                    auto rightTop = this->_webView->convertToWorldSpace(cocos2d::Point(this->_webView->getContentSize().width,this->_webView->getContentSize().height));

                    auto uiLeft = frameSize.width / 2 + (leftBottom.x - winSize.width / 2 ) * glView->getScaleX();
                    auto uiTop = frameSize.height /2 - (rightTop.y - winSize.height / 2) * glView->getScaleY();

                    Evas_Coord width = (rightTop.x - leftBottom.x) * glView->getScaleX();
                    Evas_Coord height = (rightTop.y - leftBottom.y) * glView->getScaleY();

                    evas_object_resize(_ewkView, width, height);
                    evas_object_move(_ewkView, uiLeft, uiTop);
                    evas_object_show(_ewkView);
                }
            }
Exemplo n.º 13
0
static void _elitaire_object_move(Evas_Object * o, Evas_Coord x, Evas_Coord y)
{
    Elitaire * eli;
    Evas_Coord nx, ny;

    eli = (Elitaire *) evas_object_smart_data_get(o);
    if (!eli) return;

    evas_object_move(eli->clip, x, y);

    nx = x + eli->offset.l;
    ny = y + eli->offset.t;

    if (eli->y == ny && eli->x == nx) return;
    eli->x = nx;
    eli->y = ny;

    if (eli->w == 0 || eli->h == 0) return;
    
    if (eli->deal) elitaire_reinit(eli);
    else elitaire_stacks_reinit(eli);
}
Exemplo n.º 14
0
void eyelight_viewer_tableofcontents_start(Eyelight_Viewer* pres,int select)
{
    Evas_Object *o;
    int w_win, h_win;
    const char* data;

    evas_output_viewport_get(pres->evas, NULL, NULL, &w_win, &h_win);

    pres->state = EYELIGHT_VIEWER_STATE_TABLEOFCONTENTS;
    pres->tableofcontents_current = select;

    o = edje_object_add(pres->evas);
    pres->tableofcontents_background = o;
    if(edje_object_file_set(o, pres->theme, "eyelight/tableofcontents") ==  0)
    {
        WARN("table of contents is not supported by the theme");
        return ;
    }

    data = edje_object_data_get(o, "nb_slides");
    pres->tableofcontents_nb_slides = atoi(data);
    evas_object_show(o);
    evas_object_resize(o, pres->current_size_w, pres->current_size_h);
    edje_object_scale_set(o, pres->current_scale);
    evas_object_move(o, pres->current_pos_x, pres->current_pos_y);
    evas_object_smart_member_add(o,pres->smart_obj);
    evas_object_clip_set(o, pres->current_clip);

    edje_object_signal_callback_add(o,"tableofcontents,slide,next","eyelight",_eyelight_viewer_tableofcontents_next_cb,pres);
    edje_object_signal_callback_add(o,"tableofcontents,slide,previous","eyelight",_eyelight_viewer_tableofcontents_previous_cb,pres);
    edje_object_signal_callback_add(o,"tableofcontents,next,end","eyelight",_eyelight_viewer_tableofcontents_next_end_cb,pres);
    edje_object_signal_callback_add(o,"tableofcontents,previous,end","eyelight",_eyelight_viewer_tableofcontents_previous_end_cb,pres);

    _eyelight_viewer_tableofcontents_slides_load(pres);

    edje_object_signal_emit(pres->tableofcontents_background,
           "show","eyelight");
}
Exemplo n.º 15
0
/* setup */
static void _setup(void)
{
   int i;
   Evas_Object *o,*src;

   o = evas_object_image_add(evas);
   evas_object_image_file_set(o, build_path("logo.png"), NULL);
   evas_object_image_fill_set(o, 0, 0, 120, 160);
   evas_object_resize(o, 120, 160);
   evas_object_move(o, -400, -300);
   src = o;

   for (i = 0; i < OBNUM / 2; i++)
     {
	o = evas_object_image_add(evas);
	o_images[i] = o;
	evas_object_image_source_set(o, src);
	evas_object_resize(o, 120, 160);
	evas_object_image_fill_set(o, 0,0,120,160);
	evas_object_show(o);
     }
   done = 0;
}
Exemplo n.º 16
0
EAPI_MAIN int
elm_main(int argc, char **argv)
{
   Evas_Object *win = NULL;
   Evas_Object *bg  = NULL;
   Evas_Object *btn = NULL;

   /* Create an win, associate it with a canvas and */
   /* turn it visible on WM (Window Manager).       */
   win = elm_win_add(NULL, "Greetings", ELM_WIN_BASIC);
   elm_win_title_set(win, "Hello, World!");
   elm_win_autodel_set(win, EINA_TRUE);
   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
   evas_object_resize(win, 240, 60);
   evas_object_show(win);

   /* Create a bg, associate it to an win */
   /* and turn it visible on WM.          */
   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);

   /* Create a btn, associate to a function, associate */
   /* to win,  give a dimension and position.          */
   btn = elm_button_add(win);
   elm_object_text_set(btn, "Good-Bye, World!");
   evas_object_smart_callback_add(btn, "clicked", on_click, NULL);
   evas_object_resize(btn, 120, 30);
   evas_object_move(btn, 60, 15);
   evas_object_show(btn);

   elm_run();
   elm_shutdown();

   return 0;
}
Exemplo n.º 17
0
static Evas_Object *create_my_group(Evas *canvas, const char *text)
{
   Evas_Object *edje;

   edje = edje_object_add(canvas);
   if (!edje)
     {
        EINA_LOG_CRIT("could not create edje object!");
        return NULL;
     }

   if (!edje_object_file_set(edje, PACKAGE_DATA_DIR"/edje_example.edj",
                             "my_group"))
     {
        int err = edje_object_load_error_get(edje);
        const char *errmsg = edje_load_error_str(err);
        EINA_LOG_ERR("could not load 'my_group' from edje_example.edj: %s",
                     errmsg);

        evas_object_del(edje);
        return NULL;
     }

   if (text)
     {
        if (!edje_object_part_text_set(edje, "text", text))
          {
             EINA_LOG_WARN("could not set the text. "
                           "Maybe part 'text' does not exist?");
          }
     }

   evas_object_move(edje, 0, 0);
   evas_object_resize(edje, WIDTH, HEIGHT);
   evas_object_show(edje);
   return edje;
}
Exemplo n.º 18
0
static void _ewk_view_single_smart_resize(Evas_Object* ewkView, Evas_Coord width, Evas_Coord height)
{
    Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(ewkView));
    _parent_sc.sc.resize(ewkView, width, height);

    if (!smartData)
        return;

    // these should be queued and processed in calculate as well!
    evas_object_image_size_set(smartData->backing_store, width, height);
    if (smartData->animated_zoom.zoom.current < 0.00001) {
        Evas_Object* clip = evas_object_clip_get(smartData->backing_store);
        Evas_Coord x, y, cw, ch;
        evas_object_image_fill_set(smartData->backing_store, 0, 0, width, height);
        evas_object_geometry_get(smartData->backing_store, &x, &y, 0, 0);
        evas_object_move(clip, x, y);
        ewk_frame_contents_size_get(smartData->main_frame, &cw, &ch);
        if (width > cw)
            width = cw;
        if (height > ch)
            height = ch;
        evas_object_resize(clip, width, height);
    }
}
Exemplo n.º 19
0
void setup_panel(Evas *_e)
{
	int w;
	Panel_Button *pbutton1, *pbutton2, *pbutton3;

	o_panel = evas_object_image_add(_e);
	evas_object_image_file_set(o_panel, IM "panel.png",
			IM "panel.png");

	evas_object_image_size_get(o_panel, &w, NULL);
	evas_object_move(o_panel, 0, 0);
	evas_object_resize(o_panel, w, win_h);
	evas_object_image_fill_set(o_panel, 0, 0, w, win_h);
	evas_object_layer_set(o_panel, 200);

	evas_object_show(o_panel);

	/* Panel title */
	o_txt_paneltitle = evas_object_text_add(_e);
	evas_object_text_font_set(o_txt_paneltitle, "sinon", 17);
	evas_object_text_text_set(o_txt_paneltitle, "Etox Test");
	evas_object_color_set(o_txt_paneltitle, 255, 255, 255, 255);
	evas_object_layer_set(o_txt_paneltitle, 250);
	evas_object_show(o_txt_paneltitle);

	/* Panel buttons */
	pbutton1 = panel_button(evas, "Basic", basic_tests());
	pbuttons = eina_list_append(pbuttons, pbutton1);

	pbutton2 = panel_button(evas, "Style", style_tests());
	pbuttons = eina_list_append(pbuttons, pbutton2);

	pbutton3 = panel_button(evas, "Callbacks", callback_tests());
	pbuttons = eina_list_append(pbuttons, pbutton3);

}
Exemplo n.º 20
0
void FileLoader::ReadTexture(const char *filename, TexData &out) const
{

    Evas_Object * parent = SampleLauncher::GetInstance()->GetParent();

    int w, h;
    int surface_w, surface_h;
    evas_object_geometry_get(parent, NULL, NULL, &surface_w, &surface_h);

    Evas_Object * inline_buffer = elm_win_add(parent, "Img Read", ELM_WIN_INLINED_IMAGE);
    evas_object_move(inline_buffer, 0, 0);
    evas_object_resize(inline_buffer, surface_w, surface_h);
    evas_object_show(inline_buffer);

    Evas *canvas = evas_object_evas_get(inline_buffer);
    Evas_Object * image = evas_object_image_add(canvas);

    char path[200];
    sprintf(path, "%s%s", app_get_resource_path(), filename);
    evas_object_image_file_set(image, path, NULL);
    evas_object_image_size_get(image, &w, &h);
    evas_object_image_fill_set(image, 0, 0, w, h);
    evas_object_image_filled_set(image, EINA_TRUE);
    evas_object_resize(image, w, h);
    evas_object_show(image);

    elm_win_render(inline_buffer);

    GLubyte *pixels;
    pixels = static_cast<GLubyte *>(evas_object_image_data_get(image, EINA_FALSE));

    out.SetData(w * h, pixels, w, h, GL_BGRA_EXT);

    evas_object_del(inline_buffer);

}
Exemplo n.º 21
0
//Called when the menu is resized
static void _eclair_menu_resize_cb(Ecore_Evas *menu_window)
{
   Eclair_Menu *menu;
   Eina_List *l;
   Eclair_Menu_Item *item;
   Evas_Coord w, h, y;
   int i;
   
   if (!(menu = ecore_evas_data_get(menu_window, "eclair_menu")))
      return;

   ecore_evas_geometry_get(menu_window, NULL, NULL, &w, &h);
   evas_object_resize(menu->edje_object, w, h);
   y = 0;
   for (l = menu->items, i = 0; l; l = l->next, i++)
   {
      if (!(item = l->data))
         continue;

      evas_object_move(item->edje_object, 0, y);
      evas_object_resize(item->edje_object, w, item->height);
      y += item->height;
   }
}
Exemplo n.º 22
0
static void gui_list_show_error(const char *errstr, va_list ap) {
	static Evas_Object *etext;
	char buf[128];

	if (!etext) {
		Evas_Object *ebox = evas_object_box_add(evas);
		evas_object_box_align_set(ebox, 0.5, 0.5);
		evas_object_box_padding_set(ebox, 10, 10);
		evas_object_move(ebox, 0, SCREEN_HEIGHT - LIST_LOGO_HEIGHT);
		evas_object_resize(ebox, SCREEN_WIDTH, LIST_LOGO_HEIGHT);

		etext = evas_object_text_add(evas);
		evas_object_text_font_set(etext, FONT, FONT_SIZE);
		evas_object_color_set(etext, LIST_FONT_COLOR, 255);

		evas_object_box_append(ebox, etext);
		evas_object_show(ebox);
	}

	vsnprintf(buf, sizeof buf, errstr, ap);

	evas_object_text_text_set(etext, buf);
	evas_object_show(etext);
}
static void
_e_wid_reconfigure(E_Widget_Data *wd)
{
   int px, py, pw, ph;
   int cx, cy, cw, ch;
   double ap, ad;

   if (!wd->obj || !wd->child) return;

   evas_object_geometry_get(wd->obj, &px, &py, &pw, &ph);

   if (ph == 0)
     {
        evas_object_resize(wd->child, 0, 0);
        return;
     }

   ap = (double)pw / ph;
   ad = (double)(wd->aspect_w) / wd->aspect_h;
   if (ap >= ad)
     {
        ch = ph;
        cw = (ch * wd->aspect_w) / wd->aspect_h;
     }
   else
     {
        cw = pw;
        ch = (cw * wd->aspect_h) / wd->aspect_w;
     }

   cx = px + (wd->align_x * (pw - cw));
   cy = py + (wd->align_y * (ph - ch));

   evas_object_resize(wd->child, cw, ch);
   evas_object_move(wd->child, cx, cy);
}
Exemplo n.º 24
0
static Eina_Bool
cone_do_drop(void *data, double pos)
{
   view_sys *p_sys = data;
   cone_animation *anim = p_sys->p_anim;

   int x,y,w,h;
   double frame = pos;
   frame = ecore_animator_pos_map(pos, ECORE_POS_MAP_BOUNCE, 2, 4);

   evas_object_geometry_get(anim->obj, &x, &y, &w, &h);
   double posy = frame * (anim->anim_end_y - anim->anim_begin_y);
   evas_object_move(anim->obj, x, anim->anim_begin_y + posy);

   if (y > anim->container_height)
   {
       anim->anim_begin_y = -h;
       anim->anim_end_y = anim->initial_y;
       ecore_animator_timeline_add(1, cone_do_drop, p_sys);
       return EINA_FALSE;
   }

   return EINA_TRUE;
}
Exemplo n.º 25
0
END_TEST

static void
_test_ellipsis(Evas_Object *to, const char *buf, const char *font, Evas_Font_Size size, double ellipsis)
{
   evas_object_text_ellipsis_set(to, ellipsis);
   evas_object_move(to, 0, 0);
   evas_object_resize(to, 500, 500);
   evas_object_text_font_set(to, font, size);
   evas_object_text_text_set(to, buf);

   /* Make it smaller to force ellipsis and check the resulting size. */
     {
        Evas_Coord w, h;
        evas_object_geometry_get(to, NULL, NULL, NULL, &h);
        evas_object_resize(to, 140, h);

        /* Because of the way text object behaves, this will actually force
         * a resize. */
        evas_object_geometry_get(to, NULL, NULL, &w, NULL);
        /* If it's gotten way too small, it means we have an issue. */
        fail_if(w < 100);
     }
}
Exemplo n.º 26
0
static Eina_Bool _ewk_view_single_smart_zoom_weak_set(Ewk_View_Smart_Data *sd, float zoom, Evas_Coord cx, Evas_Coord cy)
{
    // TODO: review
    float scale = zoom / sd->animated_zoom.zoom.start;
    Evas_Coord w = sd->view.w * scale;
    Evas_Coord h = sd->view.h * scale;
    Evas_Coord dx, dy, cw, ch;
    Evas_Object *clip = evas_object_clip_get(sd->backing_store);

    ewk_frame_contents_size_get(sd->main_frame, &cw, &ch);
    if (sd->view.w > 0 && sd->view.h > 0) {
        dx = (w * (sd->view.w - cx)) / sd->view.w;
        dy = (h * (sd->view.h - cy)) / sd->view.h;
    } else {
        dx = 0;
        dy = 0;
    }

    evas_object_image_fill_set(sd->backing_store, cx + dx, cy + dy, w, h);

    if (sd->view.w > 0 && sd->view.h > 0) {
        dx = ((sd->view.w - w) * cx) / sd->view.w;
        dy = ((sd->view.h - h) * cy) / sd->view.h;
    } else {
        dx = 0;
        dy = 0;
    }
    evas_object_move(clip, sd->view.x + dx, sd->view.y + dy);

    if (cw < sd->view.w)
        w = cw * scale;
    if (ch < sd->view.h)
        h = ch * scale;
    evas_object_resize(clip, w, h);
    return EINA_TRUE;
}
Exemplo n.º 27
0
int
main (int argc, char * argv[])
{
  Edvi_Device   *device;
  Edvi_Property *property;
  Edvi_Document *document;
  Edvi_Page     *page;
  Ecore_Evas    *ee;
  Evas          *evas;
  Evas_Object   *o;
  char          *param_kpathsea_mode  = "cx";
  int            page_number;
  int            width;
  int            height;

  if (argc < 3) {
    printf ("\nUsage: %s file.dvi page_number\n\n", argv[0]);
    return EXIT_FAILURE;
  }

  printf ("[DVI] version : %s\n", edvi_version_get ());

  if (!edvi_init (300, param_kpathsea_mode, 4,
                  1.0, 1.0,
                  0, 255, 255, 255, 0, 0, 0)) {
    return EXIT_FAILURE;
  }

  device = edvi_device_new (edvi_dpi_get (), edvi_dpi_get ());
  if (!device) {
    goto shutdown;
  }

  property = edvi_property_new ();
  if (!property) {
    goto free_device;
  }
  edvi_property_property_set (property, EDVI_PROPERTY_DELAYED_FONT_OPEN);

  document = edvi_document_new (argv[1], device, property);
  if (!document) {
    goto free_property;
  }

  sscanf (argv[2], "%d", &page_number);
  page = edvi_page_new (document);
  if (!page) {
    goto free_document;
  }
  edvi_page_page_set (page, page_number);
  edvi_page_size_get (page, &width, &height);

  if (!ecore_init()) {
    goto free_page;
  }

  if (!ecore_evas_init()) {
    goto shutdown_ecore;
  }

  ee = ecore_evas_software_x11_new (NULL, 0,  0, 0, width, height);
  /* these tests can be improved... */
  if (!ee) {
    printf ("Can not find Software X11 engine. Trying DirectDraw engine...\n");
    ee = ecore_evas_software_ddraw_new (NULL,  0, 0, width, height);
    if (!ee) {
      goto shutdown_ecore_evas;
    }
  }
  ecore_event_handler_add (ECORE_EVENT_SIGNAL_EXIT, app_signal_exit, NULL);
  ecore_evas_callback_delete_request_set (ee, app_delete_request);
  ecore_evas_title_set (ee, "Evas Dvi Test");
  ecore_evas_name_class_set (ee, "evas_dvi_test", "test_evas_dvi");
  ecore_evas_callback_resize_set (ee, app_resize);
  ecore_evas_show (ee);

  evas = ecore_evas_get (ee);

  o = evas_object_image_add (evas);
  evas_object_move (o, 0, 0);
  _evas_object_bg_set (o, 255, 255, 255);
  edvi_page_render (page, device, o);
  evas_object_show (o);

  ecore_main_loop_begin ();

  ecore_evas_shutdown ();
  ecore_shutdown ();
  evas_shutdown ();
  edvi_page_delete (page);
  edvi_document_delete (document);
  edvi_property_delete (property);
  edvi_device_delete (device);
  edvi_shutdown ();

  return EXIT_SUCCESS;

 shutdown_ecore_evas:
  ecore_evas_shutdown ();
 shutdown_ecore:
  ecore_shutdown ();
 free_page:
  edvi_page_delete (page);
 free_document:
  edvi_document_delete (document);
 free_property:
  edvi_property_delete (property);
 free_device:
  edvi_device_delete (device);
 shutdown:
  edvi_shutdown ();

  return EXIT_FAILURE;
}
Exemplo n.º 28
0
int
e_syscon_show(E_Zone *zone, const char *defact)
{
   Evas_Object *o, *o2;
   Evas_Coord mw, mh;
   int x, y, w, h, zx, zy, zw, zh;
   int iw, ih;
   Eina_List *l;
   double t;

   t = ecore_loop_time_get();
   if (popup)
     {
        if ((t - show_time) > 0.5)
          {
             for (l = e_config->syscon.actions; l; l = l->next)
               {
                  E_Config_Syscon_Action *sca;
                  E_Action *a;

                  if (!(sca = l->data)) continue;
                  if (!sca->action) continue;
                  a = e_action_find(sca->action);
                  if (!a) continue;
                  if (sca->is_main == 2)
                    {
                       a->func.go(NULL, sca->params);
                       e_syscon_hide();
                       break;
                    }
               }
          }
        return 0;
     }

   input_window = ecore_x_window_input_new(zone->container->win, zone->x,
                                           zone->y, zone->w, zone->h);
   ecore_x_window_show(input_window);
   if (!e_grabinput_get(input_window, 1, input_window))
     {
        ecore_x_window_free(input_window);
        input_window = 0;
        return 0;
     }

   popup = e_popup_new(zone, 0, 0, 1, 1);
   if (!popup)
     {
        e_grabinput_release(input_window, input_window);
        ecore_x_window_free(input_window);
        input_window = 0;
        return 0;
     }
   evas_event_freeze(popup->evas);
   e_popup_layer_set(popup, E_LAYER_POPUP);

   handlers = eina_list_append
       (handlers, ecore_event_handler_add
         (ECORE_EVENT_KEY_DOWN, _cb_key_down, NULL));
   handlers = eina_list_append
       (handlers, ecore_event_handler_add
         (ECORE_EVENT_MOUSE_BUTTON_DOWN, _cb_mouse_down, NULL));
   handlers = eina_list_append
       (handlers, ecore_event_handler_add
         (ECORE_EVENT_MOUSE_BUTTON_UP, _cb_mouse_up, NULL));
   handlers = eina_list_append
       (handlers, ecore_event_handler_add
         (ECORE_EVENT_MOUSE_MOVE, _cb_mouse_move, NULL));
   handlers = eina_list_append
       (handlers, ecore_event_handler_add
         (ECORE_EVENT_MOUSE_WHEEL, _cb_mouse_wheel, NULL));

   o = edje_object_add(popup->evas);
   o_bg = o;
   e_theme_edje_object_set(o, "base/theme/syscon",
                           "e/widgets/syscon/main");
   edje_object_part_text_set(o, "e.text.label", _("Cancel"));
   edje_object_signal_callback_add(o, "e,action,close", "",
                                   _cb_signal_close, NULL);
   edje_object_signal_callback_add(o, "e,action,syscon", "*",
                                   _cb_signal_syscon, NULL);

   act_count = 0;
   show_time = t;

   // main (default):
   //  halt | suspend | desk_lock
   // secondary (default):
   //  reboot | hibernate | logout
   // extra (example for illume):
   //  home | close | kill

   o = e_flowlayout_add(popup->evas);
   o_flow_main = o;
   e_flowlayout_orientation_set(o, 1);
   e_flowlayout_flowdirection_set(o, 1, 1);
   e_flowlayout_homogenous_set(o, 1);

   o = e_flowlayout_add(popup->evas);
   o_flow_secondary = o;
   e_flowlayout_orientation_set(o, 1);
   e_flowlayout_flowdirection_set(o, 1, 1);
   e_flowlayout_homogenous_set(o, 1);

   o = e_flowlayout_add(popup->evas);
   o_flow_extra = o;
   e_flowlayout_orientation_set(o, 1);
   e_flowlayout_flowdirection_set(o, 1, 1);
   e_flowlayout_homogenous_set(o, 1);

   for (l = e_config->syscon.actions; l; l = l->next)
     {
        E_Config_Syscon_Action *sca;
        char buf[1024];
        E_Action *a;
        int disabled;

        if (!(sca = l->data)) continue;
        if (!sca->action) continue;
        a = e_action_find(sca->action);
        if (!a) continue;
        disabled = 0;
        if ((!strcmp(sca->action, "logout")) &&
            (!e_sys_action_possible_get(E_SYS_LOGOUT))) disabled = 1;
        else if ((!strcmp(sca->action, "halt")) &&
                 (!e_sys_action_possible_get(E_SYS_HALT)))
          disabled = 1;
        else if ((!strcmp(sca->action, "halt_now")) &&
                 (!e_sys_action_possible_get(E_SYS_HALT_NOW)))
          disabled = 1;
        else if ((!strcmp(sca->action, "reboot")) &&
                 (!e_sys_action_possible_get(E_SYS_REBOOT)))
          disabled = 1;
        else if ((!strcmp(sca->action, "suspend")) &&
                 (!e_sys_action_possible_get(E_SYS_SUSPEND)))
          disabled = 1;
        else if ((!strcmp(sca->action, "hibernate")) &&
                 (!e_sys_action_possible_get(E_SYS_HIBERNATE)))
          disabled = 1;
        o = edje_object_add(popup->evas);
        edje_object_signal_callback_add(o, "e,action,click", "",
                                        _cb_signal_action, sca);
        if (sca->button)
          {
             snprintf(buf, sizeof(buf), "e/widgets/syscon/item/%s",
                      sca->button);
             e_theme_edje_object_set(o, "base/theme/widgets", buf);
          }
        else
          e_theme_edje_object_set(o, "base/theme/widgets",
                                  "e/widgets/syscon/item/button");
        edje_object_part_text_set(o, "e.text.label",
                                  _(e_action_predef_label_get(sca->action, sca->params)));
        if (sca->icon)
          {
             o2 = e_icon_add(popup->evas);
             e_util_icon_theme_set(o2, sca->icon);
             edje_object_part_swallow(o, "e.swallow.icon", o2);
             evas_object_show(o2);
             if (disabled)
               edje_object_signal_emit(o2, "e,state,disabled", "e");
          }
        if (disabled)
          edje_object_signal_emit(o, "e,state,disabled", "e");
        if (sca->is_main)
          {
             e_flowlayout_pack_end(o_flow_main, o);
             iw = ih = e_config->syscon.main.icon_size * e_scale;
          }
        else
          {
             e_flowlayout_pack_end(o_flow_secondary, o);
             iw = ih = e_config->syscon.secondary.icon_size * e_scale;
          }
        edje_object_message_signal_process(o);
        edje_object_size_min_calc(o, &mw, &mh);
        if (mw > iw) iw = mw;
        if (mh > ih) ih = mh;
        e_flowlayout_pack_options_set(o, 1, 1, 0, 0, 0.5, 0.5,
                                      iw, ih, iw, ih);
        evas_object_show(o);
     }

   for (l = (Eina_List *)e_sys_con_extra_action_list_get(); l; l = l->next)
     {
        E_Sys_Con_Action *sca;
        char buf[1024];

        sca = l->data;
        o = edje_object_add(popup->evas);
        edje_object_signal_callback_add(o, "e,action,click", "", _cb_signal_action_extra, sca);
        if (sca->button_name)
          {
             snprintf(buf, sizeof(buf), "e/widgets/syscon/item/%s",
                      sca->button_name);
             e_theme_edje_object_set(o, "base/theme/widgets", buf);
          }
        else
          e_theme_edje_object_set(o, "base/theme/widgets",
                                  "e/widgets/syscon/item/button");
        edje_object_part_text_set(o, "e.text.label", sca->label);
        if (sca->icon_group)
          {
             o2 = edje_object_add(popup->evas);
             e_util_edje_icon_set(o2, sca->icon_group);
             edje_object_part_swallow(o, "e.swallow.icon", o2);
             evas_object_show(o2);
             if (sca->disabled)
               edje_object_signal_emit(o2, "e,state,disabled", "e");
          }
        if (sca->disabled)
          edje_object_signal_emit(o, "e,state,disabled", "e");
        e_flowlayout_pack_end(o_flow_extra, o);
        iw = ih = e_config->syscon.extra.icon_size * e_scale;
        e_flowlayout_pack_options_set(o, 1, 1, 0, 0, 0.5, 0.5,
                                      iw, ih, iw, ih);
        evas_object_show(o);
     }

   e_flowlayout_fill_set(o_flow_main, 1);
   edje_object_part_swallow(o_bg, "e.swallow.main", o_flow_main);
   e_flowlayout_fill_set(o_flow_secondary, 1);
   edje_object_part_swallow(o_bg, "e.swallow.secondary", o_flow_secondary);
   e_flowlayout_fill_set(o_flow_extra, 1);
   edje_object_part_swallow(o_bg, "e.swallow.extra", o_flow_extra);

   e_zone_useful_geometry_get(zone, &zx, &zy, &zw, &zh);
   evas_object_resize(o_bg, zw, zh);
   edje_object_calc_force(o_bg);

   e_flowlayout_size_min_get(o_flow_main, &mw, &mh);
   edje_extern_object_min_size_set(o_flow_main, mw, mh);
   edje_object_part_swallow(o_bg, "e.swallow.main", o_flow_main);
   e_flowlayout_size_min_get(o_flow_secondary, &mw, &mh);
   edje_extern_object_min_size_set(o_flow_secondary, mw, mh);
   edje_object_part_swallow(o_bg, "e.swallow.secondary", o_flow_secondary);
   e_flowlayout_size_min_get(o_flow_extra, &mw, &mh);
   edje_extern_object_min_size_set(o_flow_extra, mw, mh);
   edje_object_part_swallow(o_bg, "e.swallow.extra", o_flow_extra);

   edje_object_size_min_calc(o_bg, &mw, &mh);

   w = mw;
   if (w > zw) w = zw;
   x = zx - zone->x + (zw - w) / 2;
   h = mh;
   if (h > zh) h = zh;
   y = zy - zone->y + (zh - h) / 2;

   e_popup_move_resize(popup, x, y, w, h);
   evas_object_move(o_bg, 0, 0);
   evas_object_resize(o_bg, w, h);
   evas_object_show(o_bg);
   e_popup_edje_bg_object_set(popup, o_bg);

   if (e_config->syscon.do_input)
     {
        deftimer = ecore_timer_add(e_config->syscon.timeout,
                                   _cb_timeout_defaction, NULL);
        if (defact) do_defact = eina_stringshare_add(defact);
     }

   evas_event_thaw(popup->evas);
   inevas = 0;
   e_popup_show(popup);
   return 1;
}
EAPI_MAIN int
elm_main(int argc, char **argv)
{
   Evas_Object *win, *rect, *rect2, *flip, *radio, *radio2, *radio3;

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   win = elm_win_util_standard_add("flip", "Flip");
   elm_win_autodel_set(win, EINA_TRUE);

   rect = evas_object_rectangle_add(evas_object_evas_get(win));
   evas_object_resize(rect, 150, 150);
   evas_object_color_set(rect, 0, 0, 255, 255);
   evas_object_show(rect);

   rect2 = evas_object_rectangle_add(evas_object_evas_get(win));
   evas_object_color_set(rect2, 0, 255, 0, 255);
   evas_object_show(rect2);

   flip = elm_flip_add(win);
   elm_object_part_content_set(flip, "front", rect);
   elm_object_part_content_set(flip, "back", rect2);
   evas_object_resize(flip, 150, 150);
   evas_object_move(flip, 10, 10);
   evas_object_show(flip);

   elm_flip_interaction_set(flip, ELM_FLIP_INTERACTION_PAGE);
   elm_flip_interaction_direction_enabled_set(flip, ELM_FLIP_DIRECTION_UP, EINA_TRUE);
   elm_flip_interaction_direction_enabled_set(flip, ELM_FLIP_DIRECTION_DOWN, EINA_TRUE);
   elm_flip_interaction_direction_enabled_set(flip, ELM_FLIP_DIRECTION_LEFT, EINA_TRUE);
   elm_flip_interaction_direction_enabled_set(flip, ELM_FLIP_DIRECTION_RIGHT, EINA_TRUE);
   elm_flip_interaction_direction_hitsize_set(flip, ELM_FLIP_DIRECTION_UP, 1);
   elm_flip_interaction_direction_hitsize_set(flip, ELM_FLIP_DIRECTION_DOWN, 1);
   elm_flip_interaction_direction_hitsize_set(flip, ELM_FLIP_DIRECTION_LEFT, 1);
   elm_flip_interaction_direction_hitsize_set(flip, ELM_FLIP_DIRECTION_RIGHT, 1);

   radio = elm_radio_add(win);
   elm_object_text_set(radio, "page");
   elm_radio_value_set(radio, ELM_FLIP_INTERACTION_PAGE);
   elm_radio_state_value_set(radio, ELM_FLIP_INTERACTION_PAGE);
   evas_object_resize(radio, 55, 30);
   evas_object_move(radio, 10, 160);
   evas_object_show(radio);
   evas_object_smart_callback_add(radio, "changed", _change_interaction, flip);

   radio2 = elm_radio_add(win);
   elm_object_text_set(radio2, "cube");
   elm_radio_state_value_set(radio2, ELM_FLIP_INTERACTION_CUBE);
   elm_radio_group_add(radio2, radio);
   evas_object_resize(radio2, 55, 30);
   evas_object_move(radio2, 75, 160);
   evas_object_show(radio2);
   evas_object_smart_callback_add(radio2, "changed", _change_interaction, flip);

   radio3 = elm_radio_add(win);
   elm_object_text_set(radio3, "rotate");
   elm_radio_state_value_set(radio3, ELM_FLIP_INTERACTION_ROTATE);
   elm_radio_group_add(radio3, radio);
   evas_object_resize(radio3, 55, 30);
   evas_object_move(radio3, 140, 160);
   evas_object_show(radio3);
   evas_object_smart_callback_add(radio3, "changed", _change_interaction, flip);

   evas_object_resize(win, 200, 200);
   evas_object_show(win);

   elm_run();
   elm_shutdown();

   return 0;
}
Exemplo n.º 30
0
static Elements *
elements_new(Evas *evas, Evas_Coord gw, Evas_Coord gh, int nbr, Scrolling_Pos pos)
{
  Elements *elts;
  int i;

  if (nbr <= 0) return NULL;

  elts = (Elements *)calloc(1, sizeof(Elements));
  if (!elts) return NULL;

  elts->objs = (Evas_Object **)calloc(nbr, sizeof(Evas_Object *));
  if (!elts->objs)
    goto free_elts;

  elts->heights = (int *)calloc(nbr, sizeof(int));
  if (!elts->heights)
    goto free_objs;

  elts->pos = pos;

  srand(time(NULL) + pos);
  i = 0;
  while (i < nbr)
    {
      int r;
      Evas_Coord h;

      elts->objs[i] = evas_object_rectangle_add(evas);
      evas_object_layer_set(elts->objs[i], 5);

      r = rand();
      if (r < (RAND_MAX / 3))
        {
          evas_object_resize(elts->objs[i], 20, 40);
          evas_object_color_set(elts->objs[i], 255, 0, 0, 255);
        }
      else if (r < 2 * (RAND_MAX / 3))
        {
          evas_object_resize(elts->objs[i], 30, 60);
          evas_object_color_set(elts->objs[i], 0, 255, 0, 255);
        }
      else
        {
          evas_object_resize(elts->objs[i], 15, 80);
          evas_object_color_set(elts->objs[i], 0, 0, 255, 255);
        }

      if (i != 0)
        {
          evas_object_geometry_get(elts->objs[i - 1], NULL, NULL, NULL, &h);
          elts->heights[i] = elts->heights[i - 1] + h;
        }

      i++;
    }

  i = 0;
  elts->n_min = 0;
  while (1)
    {
      if (elts->heights[i] < gh)
        {
          Evas_Coord w;

          evas_object_geometry_get(elts->objs[i], NULL, NULL, &w, NULL);
          switch (elts->pos)
            {
            case SCROLLING_LEFT:
              evas_object_move(elts->objs[i], 0, gh - elts->heights[i + 1] - 1);
              break;
            case SCROLLING_RIGHT:
              evas_object_move(elts->objs[i], gw - w, gh - elts->heights[i + 1] - 1);
              break;
            case SCROLLING_CENTER:
              evas_object_move(elts->objs[i], 0, gh - elts->heights[i + 1] - 1);
              break;
            default:
              evas_object_move(elts->objs[i], 0, gh - elts->heights[i + 1] - 1);
              break;
            }
          evas_object_show(elts->objs[i]);
          i++;
        }
      else
        {
          elts->n_max = i - 1;
          break;
        }
    }

  return elts;

 free_objs:
  free(elts->objs);
 free_elts:
  free(elts);

  return NULL;
}