Exemple #1
0
void
theme_text_clear()
{
  if (messages)
    {
      Eina_List *l = NULL;
      Exquisite_Text_Line *t = NULL;
   
      for(l = messages; l; l = l->next)
        {
          t = l->data;
          eina_stringshare_del(t->message);
          if(t->status_text) eina_stringshare_del(t->status_text);
          free(l->data);
        }
      
      eina_list_free(messages);
      messages = NULL;
    }  

   if (edje_object_part_exists(o_bg, "textarea") &&
       edje_object_part_exists(o_bg, "statusarea"))
     {
	edje_object_signal_emit(o_bg, "exquisite", "text_clear");
	edje_object_part_text_set(o_bg, "textarea", "");
	edje_object_part_text_set(o_bg, "statusarea", "");
     }
}
/* to win not window */
static void _win_game_cb(int end, float points, pointsType ptype, void * data)
{
    Eli_App * eap;

    eap = (Eli_App *) data;
    
    if (eap) {
        _Eli_App_End * eend = NULL;
	Eli_Edje_Frontend * eef;
        char * game;

	eef = eli_app_edje_frontend_get(eap);
        game = eap->current.game;

        elitaire_object_pause(eef->elitaire);
        if (end == 0) {
            if (edje_object_part_exists(eef->gui, "elitaire_win_text")) {
                edje_object_part_text_set(eef->gui, "elitaire_win_text",
                                          _("You win!"));
            }
            eli_statistics_win_add(game);
        }
        else if (end == 1) {
            if (edje_object_part_exists(eef->gui, "elitaire_win_text")) {
                edje_object_part_text_set(eef->gui, "elitaire_win_text",
                                          _("You lose!"));
            }
            eli_statistics_lost_add(game);
	    eli_app_state_set(eap, ELI_STATE_GAME_KILL);
            eli_app_game_end(eap);
            return;
        }
        else {
            if (edje_object_part_exists(eef->gui, "elitaire_win_text")) {
                edje_object_part_text_set(eef->gui, "elitaire_win_text",
                                          _("Game Over"));
            }
            eli_statistics_lost_add(game);
        }
        edje_object_signal_emit(eef->gui, "win,on", "");

        eend = (_Eli_App_End *) malloc(sizeof(_Eli_App_End));
        eend->eap = eap;
        eend->end = end;
        eend->points = points;
        eend->type = ptype;

	eli_app_state_set(eap, ELI_STATE_GAME_END);
        elitaire_object_wait_for_end_of_jobs(eef->elitaire, 
			                       _eli_app_wait_for_end,
                                               eend);
	
    }
}
Exemple #3
0
static void
theme_update_text(int signal)
{
   char buf[8192];
   char buf2[8192];
   char *p = buf, *s = buf2;
   Eina_List *l = NULL;
   int i;
   const char *msg, *status;
   Exquisite_Text_Line *t;

   edje_object_signal_emit(o_bg, "exquisite", "text_enable");

   if(!messages)
     {
        buf[0] = 0;
        buf2[0] = 0;
     }

   for(l = messages, i = 0; l && i < 8192; l = l->next)
     {
       t = (Exquisite_Text_Line*)l->data;
       snprintf(p, strlen(t->message)+8, "<p>%s</p>", t->message);
       p = buf+strlen(buf);
       
       if(!t->status_text)
         snprintf(s, 5, "<br>");
       else
         {
           if(t->status != -1)
             snprintf(s, strlen(t->status_text)+8, "<%i>%s</%i>", t->status, t->status_text, t->status);
           else
             snprintf(s, strlen(t->status_text)+5, "%s<br>", t->status_text);
         }
       
       s = buf2+strlen(buf2);
     }

   if (edje_object_part_exists(o_bg, "textarea") &&
       edje_object_part_exists(o_bg, "statusarea"))
     {          
        if(signal == 1)
          edje_object_signal_emit(o_bg, "exquisite", "text_set");  
        else if(signal == 2)
          edje_object_signal_emit(o_bg, "exquisite", "status_set");
        
        edje_object_part_text_set(o_bg, "textarea", buf);
        edje_object_part_text_set(o_bg, "statusarea", buf2);
     }
}
Exemple #4
0
int
elicit_cslider_theme_set(Evas_Object *o, const char *file, const char *group)
{
  Elicit_Cslider *cs;

  cs = evas_object_smart_data_get(o);

  if (cs->gui && cs->spectrum)
    edje_object_part_unswallow(cs->gui, cs->spectrum);

  if(!edje_object_file_set(cs->gui, file, group))
  {
    fprintf(stderr, "[Elicit] Error setting cslider theme (%s, %s)\n", file, group);
    return 0;
  }

  edje_object_signal_callback_add(cs->gui, "drag", "slider", cb_drag, cs);
  edje_object_signal_callback_add(cs->gui, "elicit,scroll,*", "*", cb_scroll, cs);

  if (edje_object_part_exists(cs->gui, "spectrum"))
  {
    if (!cs->spectrum)
    {
      //cs->spectrum = evas_object_gradient_add(evas_object_evas_get(o));
      //evas_object_gradient_angle_set(cs->spectrum, 270);
    }

    edje_object_part_swallow(cs->gui, "spectrum", cs->spectrum);
  }
  return 1;
}
Exemple #5
0
void
elicit_cslider_color_set(Evas_Object *o, Color *color, Color_Type type)
{
  Elicit_Cslider *cs;

  cs = evas_object_smart_data_get(o);

  if (cs->color)
  {
    color_callback_changed_del(cs->color, cb_color_changed);
    color_unref(cs->color);
  }

  cs->color = color;
  color_ref(color);

  cs->type = type;

  if (edje_object_part_exists(cs->gui, "label")) {
    edje_object_part_text_set(cs->gui, "label", cslider_labels[cs->type]);
  }

  color_callback_changed_add(cs->color, cb_color_changed, cs);

}
static void _points_cb(float points, pointsType ptype, void *data)
{
    Eli_Edje_Frontend * eef;

    eef = (Eli_Edje_Frontend *) data;
    if (eef) {
        if (edje_object_part_exists(eef->gui, "elitaire_points")) {
            const char * pstring;

            pstring = pointsType_point_string_get(points, ptype);
            edje_object_part_text_set(eef->gui, "elitaire_points", pstring);
        }
    }
}
Exemple #7
0
/* set theme title text */
void
theme_message_set(const char *txt)
{
   if (edje_object_part_exists(o_bg, "exquisite.message"))
     {
	edje_object_part_text_set(o_bg, "exquisite.message", txt);
	edje_object_signal_emit(o_bg, "exquisite", "message");
     }
   else
     {
	Edje_Message_String m;
	m.str = (char *)txt;
	edje_object_message_send(o_bg, EDJE_MESSAGE_STRING, 1, &m);
     }
}
Exemple #8
0
/* set progress position 0.0 -> 1.0 */
void
theme_progress_set(double val)
{	
   if (edje_object_part_exists(o_bg, "exquisite.progress"))
     {
	edje_object_part_drag_value_set(o_bg, "exquisite.progress", val, val);
	edje_object_signal_emit(o_bg, "exquisite", "progress");
     }
   else
     {
	Edje_Message_Float m;
	m.val = val;
	edje_object_message_send(o_bg, EDJE_MESSAGE_FLOAT, 2, &m);
     }
}
Exemple #9
0
//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;
}
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);
        }
    }
}
Exemple #11
0
//Create the playlist container and swallow it into the window
//Return 0 if failed
static Evas_Bool _eclair_create_playlist_container_object(Eclair *eclair, Eclair_Window *window)
{
   if (!eclair || !window)
      return 0;

   if (edje_object_part_exists(window->edje_object, "playlist_container"))
   {
      if (eclair->playlist_container)
         evas_object_del(eclair->playlist_container);
      eclair->playlist_container = eclair_playlist_container_object_add(window->evas, eclair);
      eclair_playlist_container_set_entry_theme_path(eclair->playlist_container, eclair->gui_theme_file);
      edje_object_part_swallow(window->edje_object, "playlist_container", eclair->playlist_container);
      evas_object_show(eclair->playlist_container);
      eclair->playlist_container_owner = window;
      return 1;
   }
   return 0;
}
Exemple #12
0
/**
 * Add the playlist container.
 *
 * @param player
 */
static void setup_playlist(ePlayer *player) {
	if (!edje_object_part_exists(player->gui.edje, "playlist"))
		return;

	player->gui.playlist = esmart_container_new(player->gui.evas);
	assert(player->gui.playlist);

	evas_object_name_set(player->gui.playlist, "PlayList");
	evas_object_data_set(player->gui.playlist, "ePlayer", player);

	esmart_container_direction_set(player->gui.playlist, 1);
	esmart_container_spacing_set(player->gui.playlist, 0);
	esmart_container_fill_policy_set(player->gui.playlist,
	                            CONTAINER_FILL_POLICY_FILL_X);
	
	edje_object_part_swallow(player->gui.edje, "playlist",
	                         player->gui.playlist);
}
Exemple #13
0
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);
     }
}
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;
}
static void
_conformant_parts_swallow(Evas_Object *obj)
{
   Evas *e;
   ELM_CONFORMANT_DATA_GET(obj, sd);
   ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
   e = evas_object_evas_get(obj);

   sd->scroller = NULL;

   //Virtual Keyboard
   if (edje_object_part_exists(wd->resize_obj, VIRTUALKEYPAD_PART))
     {
        if (!sd->virtualkeypad)
          {
             sd->virtualkeypad = evas_object_rectangle_add(e);
             elm_widget_sub_object_add(obj, sd->virtualkeypad);
             evas_object_size_hint_max_set(sd->virtualkeypad, -1, 0);
          }
        else
          _conformant_part_sizing_eval(obj, ELM_CONFORMANT_VIRTUAL_KEYPAD_PART);

        evas_object_color_set(sd->virtualkeypad, 0, 0, 0, 0);
        elm_layout_content_set(obj, VIRTUALKEYPAD_PART, sd->virtualkeypad);
     }
   else
     ELM_SAFE_FREE(sd->virtualkeypad, evas_object_del);

   //Clipboard
   if (edje_object_part_exists(wd->resize_obj, CLIPBOARD_PART))
     {
        if (!sd->clipboard)
          {
             sd->clipboard = evas_object_rectangle_add(e);
             evas_object_size_hint_min_set(sd->clipboard, -1, 0);
             evas_object_size_hint_max_set(sd->clipboard, -1, 0);
          }
        else
          _conformant_part_sizing_eval(obj, ELM_CONFORMANT_CLIPBOARD_PART);

        evas_object_color_set(sd->clipboard, 0, 0, 0, 0);
        elm_layout_content_set(obj, CLIPBOARD_PART, sd->clipboard);
     }
   else
     ELM_SAFE_FREE(sd->clipboard, evas_object_del);

   //Softkey
   if (edje_object_part_exists(wd->resize_obj, SOFTKEY_PART))
     {
        if (!sd->softkey)
          {
             sd->softkey = evas_object_rectangle_add(e);
             evas_object_size_hint_min_set(sd->softkey, -1, 0);
             evas_object_size_hint_max_set(sd->softkey, -1, 0);
          }
        else
          _conformant_part_sizing_eval(obj, ELM_CONFORMANT_SOFTKEY_PART);

        evas_object_color_set(sd->softkey, 0, 0, 0, 0);
        elm_layout_content_set(obj, SOFTKEY_PART, sd->softkey);
     }
   else
     ELM_SAFE_FREE(sd->softkey, evas_object_del);
}
Exemple #16
0
bool Object::hasPart (const std::string &partname) const
{
  return edje_object_part_exists( o, partname.c_str () );
}
Exemple #17
0
void
elicit_theme_swallow_objs(Elicit *el)
{
  int i;

  /* magnified screen shot */
  if (edje_object_part_exists(el->obj.main, "elicit.shot"))
  {
    //XXX wrap in pan widget?
    if (!el->obj.shot)
    {
      el->obj.shot = elicit_shot_add(el->evas);
      elicit_shot_callback_select_add(el->obj.shot, cb_shot_selection, el);
      elicit_shot_callback_zoom_add(el->obj.shot, cb_shot_zoom, el);
      elicit_shot_zoom_set(el->obj.shot, el->conf.zoom_level);
      elicit_shot_grid_visible_set(el->obj.shot, el->conf.grid_visible);
    }

    edje_object_part_swallow(el->obj.main, "elicit.shot", el->obj.shot);

  }
  else if (el->obj.shot)
  {
    evas_object_del(el->obj.shot);
    el->obj.shot = NULL;
  }

  /* main swatch */
  if (edje_object_part_exists(el->obj.main, "elicit.swatch"))
  {
    if (!el->obj.swatch)
      el->obj.swatch = evas_object_rectangle_add(el->evas);

    edje_object_part_swallow(el->obj.main, "elicit.swatch", el->obj.swatch);
  }
  else if (el->obj.swatch)
  {
    evas_object_del(el->obj.swatch);
    el->obj.swatch = NULL;
  }


  /* color slider */
  for (i = 0; i < NUM_CSLIDERS; i++)
  {

    if (edje_object_part_exists(el->obj.main, cslider_part_names[i]))
    {
      el->obj.cslider[i] = elicit_cslider_add(el->evas);
      elicit_cslider_theme_set(el->obj.cslider[i], el->path.theme, "elicit.cslider");
      elicit_cslider_color_set(el->obj.cslider[i], el->color, i);
      edje_object_part_swallow(el->obj.main, cslider_part_names[i], el->obj.cslider[i]);
    }
    else if (el->obj.cslider[i])
    {
      evas_object_del(el->obj.cslider[i]);
      el->obj.cslider[i] = NULL;
    }
  }

  /* related colors */
  for (i = 0; i < NUM_RELATED_COLORS; i++)
  {
    if (edje_object_part_exists(el->obj.main, related_color_names[i]))
    {
      if (!el->obj.related[i])
      {
        el->obj.related[i] = evas_object_rectangle_add(el->evas);
        evas_object_event_callback_add(el->obj.related[i], EVAS_CALLBACK_MOUSE_UP, cb_related_color_select, el);
      }

      edje_object_part_swallow(el->obj.main, related_color_names[i], el->obj.related[i]);
    }
    else if (el->obj.related[i])
    {
      evas_object_del(el->obj.related[i]);
      el->obj.related[i] = NULL;
    }
  }

  /* palette */
  if (edje_object_part_exists(el->obj.main, "elicit.palette"))
  {
    if (!el->obj.palette_frame)
      el->obj.palette_frame = scrollframe_add(el->evas);

    if (!el->obj.palette)
    {
      el->obj.palette = palette_view_add(el->evas);
      palette_view_default_columns_set(el->obj.palette, el->conf.palette_columns);
      palette_view_palette_set(el->obj.palette, el->palette);
      evas_object_smart_callback_add(el->obj.palette, "scroll-to", cb_palette_scroll_to, el);
      evas_object_smart_callback_add(el->obj.palette, "selected", cb_palette_color_selected, el);
      evas_object_smart_callback_add(el->obj.palette, "deleted", cb_palette_color_deleted, el);
    }

    scrollframe_theme_set(el->obj.palette_frame, el->path.theme, "elicit.scrollframe");

    palette_view_theme_set(el->obj.palette, el->path.theme, "elicit.palette.swatch");
    scrollframe_child_set(el->obj.palette_frame, el->obj.palette);
    scrollframe_fill_policy_set(el->obj.palette_frame, 1, 0);
    edje_object_part_swallow(el->obj.main, "elicit.palette", el->obj.palette_frame);
  }
  else if (el->obj.palette)
  {
    evas_object_del(el->obj.palette);
    el->obj.palette = NULL;
  }
}