コード例 #1
0
ファイル: edje_test_edje.c プロジェクト: jigpu/efl
END_TEST

START_TEST(edje_test_complex_layout)
{
   int x, y, w, h;
   Evas *evas = EDJE_TEST_INIT_EVAS();
   Evas_Object *obj;

   obj = edje_object_add(evas);
   fail_unless(edje_object_file_set(obj, test_layout_get("complex_layout.edj"), "test_group"));
   evas_object_resize(obj, 1000, 1000);

   /* Apparently rel2 offsets are retarded and you have to introduce off-by-one
    * madness (rel2.offset: -1 -1; acts like there is zero offset...)
    * Take that into account when checking w and h */

   /* rel1.relative: 0.0 0.0; rel1.offset: 0 0;
    * rel2.relative: 1.0 1.0; rel2.offset -1 -1; */
   edje_object_part_geometry_get(obj, "background", &x, &y, &w, &h);
   fail_if(x != 0 || y != 0);
   fail_if(w != 1000-1 + 1 || h != 1000-1 + 1);

   /* rel1.relative: 0.0 0.0; rel1.offset: 1 1;
    * rel2.relative: 1.0 1.0; rel2.offset 0 0; */
   edje_object_part_geometry_get(obj, "background2", &x, &y, &w, &h);
   fail_if(x != 1 || y != 1);
   fail_if(w != 1000-1 + 1 || h != 1000-1 + 1);

   /* rel1.relative: 0.0 0.0; rel1.offset: 5 5;
    * rel2.relative: 0.5 0.5; rel2.offset -2 -2; */
   edje_object_part_geometry_get(obj, "ul", &x, &y, &w, &h);
   fail_if(x != 5 || y != 5);
   fail_if(w != 500-5-2 + 1 || h != 500-5-2 + 1);

   /* rel1.relative: 0.5 0.0; rel1.offset: 2 5;
    * rel2.relative: 1.0 0.5; rel2.offset -5 -2; */
   edje_object_part_geometry_get(obj, "ur", &x, &y, &w, &h);
   fail_if(x != 500+2 || y != 5);
   fail_if(w != 500-5-2 + 1 || h != 500-5-2 + 1);

   /* rel1.relative: 0.0 0.5; rel1.offset: 5 2;
    * rel2.relative: 1.0 1.0; rel2.offset -5 -5; */
   edje_object_part_geometry_get(obj, "l", &x, &y, &w, &h);
   fail_if(x != 5 || y != 500+2);
   fail_if(w != 1000-5-5 + 1 || h != 500-5-2 + 1);

   EDJE_TEST_FREE_EVAS();
}
コード例 #2
0
ファイル: edje_test_edje.c プロジェクト: jigpu/efl
END_TEST

START_TEST(edje_test_simple_layout_geometry)
{
   int x, y, w, h;
   int r, g, b, a;
   Evas *evas = EDJE_TEST_INIT_EVAS();
   Evas_Object *obj, *bg;

   obj = edje_object_add(evas);
   fail_unless(edje_object_file_set(obj, test_layout_get("test_layout.edj"), "test_group"));

   /* rel1.relative: 0.0 0.0;
    * rel2.relative: 1.0 1.0; */
   evas_object_resize(obj, 1000, 1000);
   edje_object_part_geometry_get(obj, "background", &x, &y, &w, &h);

   fail_if(x != 0 || y != 0);
   fail_if(w != 1000 || h != 1000);

   bg = edje_object_part_object_get(obj, "background");
   fail_if(!bg);

   evas_object_color_get(bg, &r, &g, &b, &a);
   fail_if(r != 255 || g != 255 || b != 255 || a != 255);

   EDJE_TEST_FREE_EVAS();
}
コード例 #3
0
ファイル: edje_test_edje.c プロジェクト: FlorentRevest/EFL
END_TEST

START_TEST(edje_test_masking)
{
   int x, y, w, h;
   Evas *evas = EDJE_TEST_INIT_EVAS();
   const Evas_Object *sub, *clip2, *clip;
   Evas_Object *obj;
   Eina_Bool b;

   obj = edje_object_add(evas);
   fail_unless(edje_object_file_set(obj, test_layout_get("test_masking.edj"), "test_group"));

   evas_object_resize(obj, 100, 100);
   edje_object_part_geometry_get(obj, "background", &x, &y, &w, &h);
   fail_if(x != 0 || y != 0 || w != 100 || h != 100);

   clip = edje_object_part_object_get(obj, "clip2");
   fail_if(!clip);

   /* check value of no_render flag as seen from evas land */
   sub = edje_object_part_object_get(obj, "mask");
   fail_if(!eo_do_ret(sub, b, evas_obj_no_render_get()));

   /* check that text has a clip (based on description.clip_to) */
   sub = edje_object_part_object_get(obj, "text");
   fail_if(!eo_do_ret(sub, clip2, evas_obj_clip_get()));

   /* test description.clip_to override */
   sub = edje_object_part_object_get(obj, "noclip");
   clip2 = eo_do_ret(sub, clip2, evas_obj_clip_get());
   fail_if(clip != clip2);

   EDJE_TEST_FREE_EVAS();
}
コード例 #4
0
void XmasWidget::Resize(int _w, int _h)
{
    EdjeObject::Resize(_w, _h);
    edje_object_part_geometry_get(edje, "widget.swallow", &clipx, &clipy, &clipw, &cliph);
    for (uint i = 0;i < flakes.size();i++)
    {
        Flake *flake = flakes[i];
        if (clipw == 0) return;
        int tx = random() % clipw;
        flake->Move(tx + clipx, flake->getY());
    }
}
コード例 #5
0
ファイル: eclair.c プロジェクト: playya/Enlightenment
//Create the cover object and swallow it into the window
//Return 0 if failed
static Evas_Bool _eclair_create_cover_object(Eclair *eclair, Eclair_Window *window)
{
   Evas_Coord cover_width, cover_height;

   if (!eclair || !window)
      return 0;

   if (edje_object_part_exists(window->edje_object, "cover"))
   {
      if (eclair->cover)
         evas_object_del(eclair->cover);
      if (eclair->previous_cover)
      {
         evas_object_del(eclair->previous_cover);
         eclair->previous_cover = NULL;
      }
      eclair->cover = evas_object_image_add(window->evas);
      evas_object_repeat_events_set(eclair->cover, 1);
      edje_object_part_swallow(window->edje_object, "cover", eclair->cover);
      edje_object_part_geometry_get(window->edje_object, "cover", NULL, NULL, &cover_width, &cover_height);
      evas_object_image_fill_set(eclair->cover, 0, 0, cover_width, cover_height);
      evas_object_hide(eclair->cover);
      if (edje_object_part_exists(window->edje_object, "previous_cover"))
      {
         eclair->previous_cover = evas_object_image_add(window->evas);
         evas_object_repeat_events_set(eclair->previous_cover, 1);
         edje_object_part_swallow(window->edje_object, "previous_cover", eclair->previous_cover);
         edje_object_part_geometry_get(window->edje_object, "previous_cover", NULL, NULL, &cover_width, &cover_height);
         evas_object_image_fill_set(eclair->previous_cover, 0, 0, cover_width, cover_height);
         evas_object_show(eclair->previous_cover);
      }
      eclair->cover_owner = window;
      return 1;
   }
   return 0;
}
コード例 #6
0
ファイル: edje_test_edje.c プロジェクト: FlorentRevest/EFL
END_TEST

START_TEST(edje_test_calculate_parens)
{
   int x, y, w, h;
   Evas *evas = EDJE_TEST_INIT_EVAS();
   Evas_Object *obj;

   obj = edje_object_add(evas);
   fail_unless(edje_object_file_set(obj, test_layout_get("test_parens.edj"), "test_group"));

   evas_object_resize(obj, 100, 100);
   edje_object_part_geometry_get(obj, "background", &x, &y, &w, &h);
   fail_if(x != 0 || y != 0 || w != 100 || h != 100);

   EDJE_TEST_FREE_EVAS();
}
コード例 #7
0
ファイル: edje_player.c プロジェクト: OpenInkpot-archive/edje
static void
_slave_mode_info(Evas_Object *edje, char *args)
{
   _slave_mode_tok(&args);

   if (!args)
     {
	fputs("ERROR: Invalid command arguments.\n", stderr);
	return;
     }

   if (!edje_object_part_exists(edje, args))
     {
	printf("INFO: \"%s\" does not exist.\n", args);
     }
   else
     {
	Evas_Coord x, y, w, h;
	edje_object_part_geometry_get(edje, args, &x, &y, &w, &h);
	printf("INFO: \"%s\" %d,%d,%d,%d\n", args, x, y, w, h);
     }
}
コード例 #8
0
void _eli_edje_frontend_game_new(Eli_App * eap)
{
    Eli_Edje_Frontend * eef;
    Evas_Coord x, y, w, h;
    Evas_Coord l, r, t, b;
    Evas_Coord min_w, min_h;
    char * card_theme;
    int vel;
    Eina_Bool bo;

    eef = eli_app_edje_frontend_get(eap);
   
    edje_object_signal_emit(eef->gui, "win,off", "");

    /* init elitaire, set the theme, ... */
    if (!(eef->elitaire = elitaire_object_new(eef->evas)))
        return;
    
    elitaire_object_game_set(eef->elitaire, eap->current.game);

    card_theme =
        ecore_config_theme_with_path_from_name_get(eap->theme.cards.current);
    /* get and set the offset */
    eli_edje_frontend_theme_offset_get(eap, &l, &r, &t, &b);
    elitaire_object_offset_set(eef->elitaire, l, r, t, b);

    if (elitaire_object_file_set(eef->elitaire, card_theme)) {
        elitaire_object_size_min_get(eef->elitaire, &w, &h);
    }
    else {
        fprintf(stderr, _("Elitaire Error: cards file %s not found!\n"),
                eap->theme.cards.current);
        return;
    }
    free(card_theme);
    card_theme = NULL;

    /* find and set the minimum size */
    elitaire_object_size_min_get(eef->elitaire, &min_w, &min_h);
    if (!edje_object_part_exists(eef->gui, "elitaire_card_field")) {
        fprintf(stderr,
                _("Elitaire Error in %s:"
		  " elitaire_card_field does not exist!\n"),
                eap->theme.gui.current);
        return;
    }
    edje_object_part_geometry_get(eef->gui, "elitaire_card_field", &x, &y, &w, &h);
    
    if (w < min_w || h < min_h) {
        Evas_Coord win_h, win_w;

        ecore_evas_geometry_get(eef->ee, NULL, NULL, &win_w, &win_h);
        ecore_evas_resize(eef->ee, win_w + min_w - w, win_h + min_h - h);
    }
    /* move and resize */
    evas_object_move(eef->elitaire, x, y);
    evas_object_resize(eef->elitaire, w, h);
    evas_object_show(eef->elitaire);

    /* tell elitaire the ecore_config vlaues */
    vel = ecore_config_int_get("velocity");
    elitaire_object_velocity_set(eef->elitaire, vel);

    vel = ecore_config_int_get("frame_rate");
    elitaire_object_frame_rate_set(eef->elitaire, vel);

    vel = ecore_config_int_get("lazy");
    elitaire_object_lazy_mode_set(eef->elitaire, vel);

    bo = ecore_config_boolean_get("/graphic/animations");
    elitaire_object_animations_set(eef->elitaire, bo);

    bo = ecore_config_boolean_get("/graphic/shadows");
    elitaire_object_shadows_set(eef->elitaire, bo);

    /* swallow the elitaire object */
    edje_object_part_swallow(eef->gui, "elitaire_card_field", eef->elitaire);
    /* Add the callbacks */
    elitaire_object_callback_win_add(eef->elitaire, _win_game_cb, eap);
    elitaire_object_callback_points_add(eef->elitaire, _points_cb, eef);
    
    /* and now deal */
    elitaire_object_deal(eef->elitaire);

    eli_app_state_set(eap, ELI_STATE_PLAYING);
    return;
}
コード例 #9
0
Rect EdjePart::geometry() const
{
    int x; int y; int w; int h;
    edje_object_part_geometry_get( _parent->obj(), _partname, &x, &y, &w, &h );
    return Rect( x, y, w, h );
}