Example #1
0
static void _drag_start_cb(void *data, Evas_Object *scroller, void *event_info)
{
	int previous_x;

	_D("Invoked");

	elm_scroller_region_get(scroller, &previous_x, NULL, NULL, NULL);
	evas_object_data_set(scroller, "previous_x", (void *) previous_x);
	evas_object_data_set(scroller, "drag_start", (void *) 1);
}
Example #2
0
EAPI_MAIN int
elm_main(int argc, char **argv)
{
   Evas_Object *win, *prefs, *notify, *label;
   Elm_Prefs_Data *prefs_data;

   win = elm_win_util_standard_add("prefs", "Prefs Example 02");
   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
   elm_win_autodel_set(win, EINA_TRUE);

   prefs = elm_prefs_add(win);
   evas_object_size_hint_weight_set(prefs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_win_resize_object_add(win, prefs);
   evas_object_show(prefs);

   elm_prefs_autosave_set(prefs, EINA_TRUE);

   prefs_data = elm_prefs_data_new("./prefs_example_02.cfg", NULL,
                                   EET_FILE_MODE_READ_WRITE);

   elm_prefs_file_set(prefs, "prefs_example_02.epb", NULL);
   elm_prefs_data_set(prefs, prefs_data);

   label = elm_label_add(win);
   elm_object_text_set(label, "Editable, Visible and Disable! Just Saying...");
   evas_object_size_hint_weight_set(label, 0.0, 0.0);
   evas_object_size_hint_align_set(label, 0.5, 0.5);

   notify = elm_notify_add(win);
   elm_notify_align_set(notify, 0.5, 1);
   elm_notify_timeout_set(notify, 2);
   elm_object_content_set(notify, label);
   evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_show(notify);

   evas_object_data_set(notify, "prefs", prefs);
   evas_object_data_set(notify, "prefs_data", prefs_data);

   evas_object_smart_callback_add(prefs, "action", _action_cb, notify);

   evas_object_resize(win, 320, 320);
   evas_object_show(win);

   ecore_timer_add(5.0, _elm_prefs_items_change, notify);

   elm_run();

   elm_prefs_data_unref(prefs_data);

   elm_shutdown();

   return 0;
}
Example #3
0
/**
 * @brief Adds an Evas image object or an Edje object in the cache system. If the cache is already full, the oldest
 * object will be removed. The object to cache will also be automatically hidden
 * @param cache a cache system
 * @param object the Evas image object or the Edje object to cache
 * @param filename the filename associated to the object
 * @param key the key associated to the object (the group for an Edje object, the key for an image from an Eet file,
 * or NULL otherwise)
 * @note Once the object is added to the cache, you should keep no reference to it. It may for example be deleted if
 * there is no more space in the cache system
 */
void etk_cache_add(Etk_Cache *cache, Evas_Object *object, const char *filename, const char *key)
{
   Etk_Cache_Item *item;
   Eina_List *l;

   if (!cache || !object || cache->size <= 0 || !filename)
      return;

   /* If the object is already cached, we move it at the end of the cache */
   if ((l = evas_object_data_get(object, "_Etk_Cache::Node")))
   {
      item = l->data;
      if (item->filename != filename)
      {
         free(item->filename);
         item->filename = strdup(filename);
      }
      if (item->key != key)
      {
         free(item->key);
         item->key = strdup(key);
      }
      cache->cached_objects = eina_list_remove_list(cache->cached_objects, l);
      cache->cached_objects = eina_list_append(cache->cached_objects, item);
      evas_object_data_set(item->object, "_Etk_Cache::Node", eina_list_last(cache->cached_objects));
      return;
   }

   /* If no more space is available, we remove the oldest object of the cache */
   if (eina_list_count(cache->cached_objects) >= cache->size)
   {
      item = cache->cached_objects->data;
      //evas_object_event_callback_call(item->object, EVAS_CALLBACK_FREE, NULL);
      evas_object_event_callback_del(item->object, EVAS_CALLBACK_FREE, _etk_cache_object_deleted_cb);
      evas_object_del(item->object);
   }

   /* We create a new cache-item for the object and we add it to the cache */
   item = malloc(sizeof(Etk_Cache_Item));
   item->filename = strdup(filename);
   item->key = key ? strdup(key) : NULL;
   item->object = object;

   evas_object_hide(object);
   evas_object_event_callback_add(object, EVAS_CALLBACK_FREE, _etk_cache_object_deleted_cb, cache);

   cache->cached_objects = eina_list_append(cache->cached_objects, item);
   evas_object_data_set(item->object, "_Etk_Cache::Node", eina_list_last(cache->cached_objects));
}
Evas_Object *common_utils_add_edit_box(Evas_Object *parent, const common_utils_entry_info_t *entry_info)
{
	Evas_Object *layout = elm_layout_add(parent);
	Evas_Object *entry = NULL;
	elm_layout_theme_set(layout, "layout", "editfield", "title");
	evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
	elm_object_part_text_set(layout, "elm.text", entry_info->title);
	elm_object_part_text_set(layout, "elm.guidetext", entry_info->guide_txt); // Set guidetext.

	entry = elm_entry_add(layout);
	elm_object_part_content_set(layout, "elm.swallow.content", entry);
	elm_entry_single_line_set(entry, EINA_TRUE);
	elm_entry_scrollable_set(entry, EINA_TRUE);
	elm_entry_entry_set(entry, entry_info->entry_txt);
	elm_entry_input_panel_layout_set(entry, entry_info->panel_type);
	if (!elm_entry_is_empty(entry)) {
		INFO_LOG(UG_NAME_NORMAL, "entry is not empty");
		elm_object_signal_emit(layout, "elm,state,guidetext,hide", "elm");
		if (!entry_info->guide_txt || strlen(entry_info->guide_txt) <= 0)
			evas_object_data_set(layout, COMMON_UTILS_DEFAULT_ENTRY_TEXT_KEY, g_strdup(entry_info->entry_txt));
	}

	evas_object_smart_callback_add(entry, "changed", __common_utils_entry_changed_cb, layout);
	evas_object_smart_callback_add(entry, "focused", __common_utils_entry_focused_cb, layout);
	evas_object_smart_callback_add(entry, "unfocused", __common_utils_entry_unfocused_cb, layout);
	elm_object_signal_callback_add(layout, "elm,eraser,clicked", "elm", __common_utils_eraser_clicked_cb, entry);
	evas_object_show(entry);

	return layout;
}
Tab_Data *
tab_add(App_Data *ad)
{
   Tab_Data *td;

   td = calloc(1, sizeof(Tab_Data));
   if (!td) return NULL;

   td->web = elm_web_add(ad->win);
   elm_web_window_create_hook_set(td->web, _web_create_window_cb, ad);
   elm_web_inwin_mode_set(td->web, EINA_TRUE);
   evas_object_size_hint_weight_set(td->web, EVAS_HINT_EXPAND,
                                    EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(td->web, EVAS_HINT_FILL, EVAS_HINT_FILL);
   elm_naviframe_item_simple_push(ad->naviframe, td->web);

   td->app = ad;
   td->tab = elm_toolbar_item_append(td->app->tabs, NULL, "New tab",
                                     _tab_clicked_cb, td);
   elm_object_item_del_cb_set(td->tab, _tb_item_del_cb);

   evas_object_data_set(td->web, "tab_data", td);

   evas_object_smart_callback_add(td->web, "title,changed", _title_changed_cb,
                                  td);
   evas_object_smart_callback_add(td->web, "uri,changed", _uri_changed_cb, td);
   evas_object_event_callback_add(td->web, EVAS_CALLBACK_FREE, _web_free_cb,
                                  td);

   elm_toolbar_item_selected_set(td->tab, EINA_TRUE);
   return td;
}
Example #6
0
/* local subsystem functions */
static E_Layout_Item *
_e_layout_smart_adopt(E_Smart_Data *sd, Evas_Object *obj)
{
   E_Layout_Item *li;

   li = evas_object_data_get(obj, "e_layout_data");
   if (li) e_layout_unpack(obj);
   li = calloc(1, sizeof(E_Layout_Item));
   if (!li) return NULL;
   li->sd = sd;
   li->obj = obj;
   /* defaults */
   li->x = 0;
   li->y = 0;
   li->w = 0;
   li->h = 0;
   evas_object_clip_set(obj, sd->clip);
   evas_object_smart_member_add(obj, li->sd->obj);
   evas_object_data_set(obj, "e_layout_data", li);
   evas_object_event_callback_add(obj, EVAS_CALLBACK_FREE,
				  _e_layout_smart_item_del_hook, NULL);
   if ((!evas_object_visible_get(sd->clip)) &&
       (evas_object_visible_get(sd->obj)))
     evas_object_show(sd->clip);
   return li;
}
Example #7
0
static Evas_Object *
_eoi_help_new(Evas * canvas,
              const char *application,
              eoi_help_page_updated_t page_handler,
              eoi_help_closed_t closed,
              const char *page, keys_t * keys_info, const char *context)
{
    eoi_help_info_t *info =
        (eoi_help_info_t *) malloc(sizeof(eoi_help_info_t));

    info->textbox = eoi_textbox_new(canvas,
                                    THEME_EDJ,
                                    "help", help_page_update_handler);

    info->application = strdup(application);
    info->page_handler = page_handler;
    info->closed = closed;
    info->history = NULL;
    info->keys = NULL;
    info->navigation = NULL;
    info->keys_info = keys_info;
    info->keys_context = context;

    evas_object_event_callback_add(info->textbox,
                                   EVAS_CALLBACK_KEY_UP,
                                   &key_handler, (void *) info);

    if (!page)
        page = "index";
    load_page(info, page);

    evas_object_data_set(info->textbox, "help-info", info);

    return info->textbox;
}
static void _hide_finished_cb(void *data, Evas_Object *obj, void *event_info)
{
	view_manager_view_type_t top_view_id = (view_manager_view_type_t)evas_object_data_get(obj, SCREEN_TYPE_ID_KEY);

	if (data == elm_naviframe_top_item_get(obj)) {
		/* We are now in main view */
		evas_object_data_set(obj, SCREEN_TYPE_ID_KEY, (void *)VIEW_MANAGER_VIEW_TYPE_MAIN);
		top_view_id = VIEW_MANAGER_VIEW_TYPE_MAIN;
	}

	INFO_LOG(UG_NAME_NORMAL, "top view id = %d", top_view_id);

	switch(top_view_id) {
	case VIEW_MANAGER_VIEW_TYPE_MAIN:
		/* Lets enable the scan updates */
		wlan_manager_enable_scan_result_update();
		break;

	case VIEW_MANAGER_VIEW_TYPE_DETAIL:
	case VIEW_MANAGER_VIEW_TYPE_EAP:
	default:
		/* Lets disable the scan updates so that the UI is not refreshed un-necessarily */
		wlan_manager_disable_scan_result_update();
		break;
	}
}
void Object::init ()
{
  /* Set up magic object back link */
  evas_object_data_set( o, "obj_c++", this );

  /* Set up callbacks */
  registerCallbacks();
}
Example #10
0
static void _anim_start_cb(void *data, Evas_Object *scroller, void *event_info)
{
	_D("start the scroller(%p) animation", scroller);

	int drag_start = (int) evas_object_data_get(scroller, "drag_start");
	if (drag_start == 0) return;
	evas_object_data_set(scroller, "drag_start", (void *) 0);
}
inline void page_unmark_dirty(Evas_Object *page)
{
	int value;
	value = (int) evas_object_data_get(page, "dirty");
	if (value > 0) {
		evas_object_data_set(page, "dirty", (void*)(value - 1));
	}
}
void item_event_register(Evas_Object *item)
{
	Evas_Object *item_edje;
	item_edje = _EDJ(item);
	evas_object_data_set(item_edje, "item", item);

	edje_object_signal_callback_add(item_edje, "item,down", "menu", _item_down_cb, NULL);
	edje_object_signal_callback_add(item_edje, "item,up", "menu", _item_up_cb, NULL);
}
Example #13
0
//1click
static void _tab_view_fill_list(Evas_Object *list, tab_view_data *data)
{
	RETM_IF(!list, "list is NULL");
	RETM_IF(!data, "data is NULL");

	int size = 0;
	evas_object_data_set(list , "view_data", data->navi);

	notification_data *notification_list = NULL;

	if (STATE_INTERFACE == data->state)
	{
		notification_list = interface_list_get(&size);
		int i = 0;
			for (; i < size; i++)
			{	notification_list[i].status=list;
			}
			elm_list_item_append(list, notification_list[0].name, NULL, NULL, log_fill_item_cb, &notification_list[0]);
			elm_list_item_append(list, notification_list[1].name, NULL, NULL, notification_item_fill_cb, &notification_list[1]);
			elm_list_item_append(list, notification_list[2].name, NULL, NULL, ongoingnotification_item_fill_cb, &notification_list[2]);

	}
	else if (STATE_DEVICE == data->state)
	{
		notification_list = device_list_get(&size);
		int i = 0;
			for (; i < size; i++)
			{
				notification_list[i].status=list;
			}
			elm_list_item_append(list, notification_list[0].name, NULL, NULL, devicestatus_item_fill_cb, &notification_list[0]);
			elm_list_item_append(list, notification_list[1].name, NULL, NULL, file_item_fill_cb, &notification_list[1]);
			elm_list_item_append(list, notification_list[2].name, NULL, NULL, preference_item_fill_cb, &notification_list[2]);
			elm_list_item_append(list, notification_list[3].name, NULL, NULL, sensor_item_fill_cb, &notification_list[3]);
			elm_list_item_append(list, notification_list[4].name, NULL, NULL, mediarecorder_item_fill_cb, &notification_list[4]);

	}
	else if(STATE_COMMUNICATION == data->state)
	{
		notification_list = communication_list_get(&size);
		int i = 0;
			for (; i < size; i++)
			{
				notification_list[i].status=list;
			}
			elm_list_item_append(list, notification_list[0].name, NULL, NULL, bouetooth_fill_item_cb, &notification_list[0]);
			elm_list_item_append(list, notification_list[1].name, NULL, NULL, gps_fill_item_cb, &notification_list[1]);
			elm_list_item_append(list, notification_list[2].name, NULL, NULL, http_fill_item_cb, &notification_list[2]);
			elm_list_item_append(list, notification_list[3].name, NULL, NULL, nfc_fill_item_cb, &notification_list[3]);
			elm_list_item_append(list, notification_list[4].name, NULL, NULL, socket_fill_item_cb, &notification_list[4]);

	}


}
Example #14
0
static
void winchoosefile(char *prompt, char *buf, int len, int filter, Eina_Bool is_save)
{
    Evas *evas = NULL;
    if ( frame != NULL ){ //simulate a modal dialog by disabling all events to the main window
        ecore_evas_get( frame );
        disable_idlers();
        evas_event_freeze(evas);
    }
    /*TODO: implement file name filtering */
    Evas_Object *win, *fs, *bg, *vbox, *hbox, *bt;

    win = elm_win_add(NULL, "fileselector", ELM_WIN_BASIC);
    elm_win_title_set(win, prompt);

    bg = elm_bg_add(win);
    elm_win_resize_object_add(win, bg);
    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_show(bg);

    vbox = elm_box_add(win);
    elm_win_resize_object_add(win, vbox);
    evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_show(vbox);

    fs = elm_fileselector_add(win);
    elm_fileselector_is_save_set(fs, is_save);
    elm_fileselector_expandable_set(fs, EINA_FALSE);
    evas_object_size_hint_weight_set(fs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(fs, EVAS_HINT_FILL, EVAS_HINT_FILL);
    elm_box_pack_end(vbox, fs);
    evas_object_show(fs);
    evas_object_smart_callback_add(fs, "done", my_fileselector_done, win);

    if (strlen(buf))
        elm_fileselector_selected_set( fs, buf );

    if (fileselect)
        elm_fileselector_path_set( fs, filepath );
    else if (getenv("HOME"))
        elm_fileselector_path_set( fs, getenv("HOME") );

    evas_object_resize(win, 400, 350);
    evas_object_show(win);
    
    evas_object_data_set(fs, "buffer", buf);

    elm_run();
    
    if ( evas != NULL ){ //enable events to the main window
        enable_idlers();
        evas_event_thaw(evas);
    }
}
Example #15
0
E_EFX *
e_efx_new(Evas_Object *obj)
{
   E_EFX *e;
   e = calloc(1, sizeof(E_EFX));
   EINA_SAFETY_ON_NULL_RETURN_VAL(e, NULL);
   e->obj = obj;
   evas_object_data_set(obj, "e_efx-data", e);
   _e_efx_obj_count++;
   return e;
}
Example #16
0
HAPI Evas_Object *layout_create(Evas_Object *conformant, const char *file, const char *group, int rotate)
{
	Evas_Object *layout;

	do {
		int width;
		int height;

		layout = layout_load_edj(conformant, file, group);
		retv_if(NULL == layout, NULL);

		width = menu_screen_get_root_width();
		height = menu_screen_get_root_height() - INDEX_HEIGHT;

		evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
		evas_object_size_hint_min_set(layout, width, height);
		evas_object_size_hint_max_set(layout, width, height);
		evas_object_resize(layout, width, height);
		evas_object_show(layout);

		evas_object_data_set(layout, "win", menu_screen_get_win());
		evas_object_data_set(layout, "rotate", (void *) rotate);
		evas_object_data_set(layout, "width", (void *) width);
		evas_object_data_set(layout, "height", (void *) height);
	} while (0);

	do {
		Evas_Object *all_apps;

		all_apps = all_apps_layout_create(layout, rotate);
		if (NULL == all_apps) {
			_E("Failed to create scroller");
			layout_destroy(layout);
			return NULL;
		}
		evas_object_data_set(layout, "all_apps", all_apps);
		elm_object_part_content_set(layout, "content", all_apps);
	} while (0);

	return layout;
}
EAPI_MAIN int
elm_main(int argc, char **argv)
{
    Evas_Object *win, *prefs, *notify, *label;
    Elm_Prefs_Data *prefs_data;

    win = elm_win_util_standard_add("prefs", "Prefs Example 01");
    elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
    elm_win_autodel_set(win, EINA_TRUE);

    prefs = elm_prefs_add(win);
    evas_object_size_hint_weight_set(prefs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    elm_win_resize_object_add(win, prefs);
    evas_object_show(prefs);

    evas_object_smart_callback_add(prefs, "page,saved", _page_saved_cb, NULL);
    evas_object_smart_callback_add(prefs, "page,loaded", _page_loaded_cb, NULL);
    evas_object_smart_callback_add(prefs, "item,changed", _item_changed_cb, win);

    elm_prefs_autosave_set(prefs, EINA_TRUE);

    prefs_data = elm_prefs_data_new("./prefs_example_01.cfg", NULL,
                                    EET_FILE_MODE_READ_WRITE);

    elm_prefs_file_set(prefs, "prefs_example_01.epb", NULL);
    elm_prefs_data_set(prefs, prefs_data);

    label = elm_label_add(win);
    elm_object_text_set(label, "Setting Values Programmatically");
    evas_object_size_hint_align_set(label, 0.5, 0.5);

    notify = elm_notify_add(win);
    elm_notify_align_set(notify, 0.5, 1);
    elm_notify_timeout_set(notify, 2);
    elm_object_content_set(notify, label);
    evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_show(notify);

    evas_object_data_set(notify, "prefs_data", prefs_data);

    evas_object_resize(win, 320, 320);
    evas_object_show(win);

    ecore_timer_add(5.0, _elm_prefs_data_change, notify);

    elm_run();

    elm_prefs_data_unref(prefs_data);

    elm_shutdown();

    return 0;
}
Example #18
0
static Eina_Bool
_stop_torque_cb(void *data)
{
   EPhysics_Body *body = data;
   Evas_Object *obj;

   ephysics_body_forces_clear(body);
   obj = ephysics_body_evas_object_get(body);
   evas_object_data_set(obj, "stop_timer", NULL);

   return EINA_FALSE;
}
Example #19
0
static Eina_Bool
_increase_torque_cb(void *data)
{
   EPhysics_Body *body = data;
   Evas_Object *obj;

   ephysics_body_torque_apply(body, 0, 0, 2);
   obj = ephysics_body_evas_object_get(body);
   evas_object_data_set(obj, "increase_timer", NULL);

   return EINA_FALSE;
}
Example #20
0
static void
_e_elm_win_trap_del(void *data, Evas_Object *o)
{
   Elm_Win_Trap_Ctx *ctx = data;
   EINA_SAFETY_ON_NULL_RETURN(ctx);
   if (ctx->client)
     {
        ctx->client->internal_elm_win = NULL;
        e_object_del(E_OBJECT(ctx->client));
        evas_object_data_set(o, "E_Client", NULL);
     }
   free(ctx);
}
Example #21
0
static Eina_Bool
_color_change_do(void *data)
{
   Evas_Object *obj = data;
   int color;

   color = (int)(uintptr_t)evas_object_data_get(obj, "current_color");
   switch (color)
     {
      case 0:
        evas_object_data_set(obj, "current_color", (void *)1);
        evas_object_color_set(obj, 255, 0, 0, 255);    /* 1st red */
        goto renew;

      case 1:
        evas_object_data_set(obj, "current_color", (void *)2);
        evas_object_color_set(obj, 255, 255, 255, 255);    /* 2nd white */
        goto renew;

      case 2:
        evas_object_data_set(obj, "current_color", (void *)3);
        evas_object_color_set(obj, 255, 0, 0, 255);    /* 2nd red */
        goto renew;

      case 3:
      default:
        evas_object_data_set(obj, "current_color", (void *)0);
        evas_object_color_set(obj, 255, 255, 255, 255);    /* back to white */
        goto end;
     }

renew:
   return ECORE_CALLBACK_RENEW;

end:
   evas_object_data_del(obj, "timer");
   return ECORE_CALLBACK_CANCEL;
}
Example #22
0
Evas_Object *
enna_video_flags_add(Evas_Object *parent)
{
    Smart_Data *sd;

    sd = calloc(1, sizeof(Smart_Data));

    sd->o_edje = elm_layout_add(parent);
    elm_layout_file_set(sd->o_edje, enna_config_theme_get(), EDJE_GROUP);
    evas_object_show(sd->o_edje);
    evas_object_data_set(sd->o_edje, "sd", sd);
    evas_object_event_callback_add(sd->o_edje, EVAS_CALLBACK_DEL,
                                   video_flags_del, sd);
    return sd->o_edje;
}
Example #23
0
HAPI Evas_Object* layout_load_edj(Evas_Object *parent, const char *edjname, const char *grpname)
{
	Evas_Object *eo;

	retv_if(NULL == parent, NULL);

	eo = elm_layout_add(parent);
	retv_if(NULL == eo, NULL);
	retv_if(EINA_FALSE == elm_layout_file_set(eo, edjname, grpname), NULL);

	evas_object_data_set(_EDJ(eo), "evas_object", eo);
	evas_object_show(eo);

	return eo;
}
Example #24
0
/* externally accessible functions */
Evas_Object *
enna_panel_infos_add(Evas * evas)
{
    Smart_Data *sd;

    sd = calloc(1, sizeof(Smart_Data));

    sd->o_edje = edje_object_add(evas);
    edje_object_file_set(sd->o_edje,
                         enna_config_theme_get(),
                         "activity/video/panel_infos");
    evas_object_show(sd->o_edje);
    evas_object_data_set(sd->o_edje, "sd", sd);
    evas_object_event_callback_add(sd->o_edje, EVAS_CALLBACK_DEL,
                                   _del, sd);
    return sd->o_edje;
}
Example #25
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);
}
Example #26
0
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;
}
Example #27
0
static Eina_Bool
elm_prefs_entry_value_validate(Evas_Object *obj)
{
   Ecore_Timer *timer;
   const char *val;
   regex_t *regex;
   size_t min;

   val = elm_entry_entry_get(obj);
   if (!val) return EINA_FALSE;

   regex = evas_object_data_get(obj, "accept_regex");
   if (regex)
     {
        if (regexec(regex, val, 0, NULL, 0)) goto mismatch;
     }

   regex = evas_object_data_get(obj, "deny_regex");
   if (regex)
     {
        /* we want tokens *out* of the deny language */
        if (!regexec(regex, val, 0, NULL, 0)) goto mismatch;
     }

   min = (size_t) evas_object_data_get(obj, "min_size");
   if (min)
     {
        if (strlen(val) < min) goto mismatch;
     }

   return EINA_TRUE;

mismatch:
   evas_object_color_set(obj, 255, 0, 0, 255);

   timer = evas_object_data_get(obj, "timer");
   if (timer) ecore_timer_del(timer);

   evas_object_data_set
     (obj, "timer", ecore_timer_add(BLINK_INTERVAL, _color_change_do, obj));

   return EINA_FALSE;
}
Example #28
0
HAPI void page_scroller_bring_in(Evas_Object *scroller, int idx)
{
	Evas_Object *index;
	int w, h;

	_D("BRING IN TO %d", idx);

	evas_object_data_set(scroller, "current_idx", (void *) idx);

	evas_object_geometry_get(scroller, NULL, NULL, &w, &h);
	elm_scroller_region_bring_in(scroller, idx * w, 0, w, h);

	index = evas_object_data_get(scroller, "index");
	if (!index) {
		_E("cannot find index.");
	}
	_D("page index bring in to %d", idx);
	index_bring_in(index, idx);
}
Example #29
0
static Evas_Object *
create_button(datetimedata_s *dd, Evas_Object *parent, char *text, char *format)
{
	Evas_Object *layout, *button;

	layout = elm_layout_add(parent);
	elm_layout_file_set(layout, ELM_DEMO_EDJ, "button_layout_1");

	button = elm_button_add(layout);
	elm_object_text_set(button, text);
	evas_object_show(button);
	evas_object_data_set(button, "format", format);
	evas_object_smart_callback_add(button, "clicked", launch_popup_cb, dd);

	elm_object_part_content_set(layout, "elm.swallow.content", button);
	evas_object_show(layout);
	elm_box_pack_end(parent, layout);

	return button;
}
Example #30
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;
}