int
message_show_view_init(char* path, GHashTable *properties)
{
	struct MessageShowViewData *view;
	Evas_Object *win, *ico, *box, *obj;
	int ret;
	GVariant *tmp;
	const char *direction = NULL;
	Eina_Bool in_msg = EINA_FALSE;

	/* path MUST always be set! It will be freed by
	destroying the messageviews hashtable in here, thus must be a copy */
	if (!path) {
		g_warning("Trying to initialize a message view without path!");
		return 1;
	}

	g_debug("Initializing the contact view for '%s'", path);

	view = malloc(sizeof(struct MessageShowViewData));
	if (!view) {
		g_critical("Failed to allocate message view for '%s'", path);
		if (properties) {
			g_hash_table_unref(properties);
		}
		free(path);
		return 1;
	}

	ret = ui_utils_view_init(VIEW_PTR(*view), ELM_WIN_BASIC, D_("Message"),
				 NULL, NULL, _destroy_cb);
	if (ret) {
		g_critical("Failed to init message view for '%s'", path);
		if (properties) {
			g_hash_table_unref(properties);
		}
		free(view);
		free(path);
		return ret;
	}

	/* cache the views to open only one view per message */
	if (messageviews == NULL) {
		messageviews = g_hash_table_new_full(g_str_hash, g_str_equal,
						     free, NULL);
	}
	g_hash_table_insert(messageviews, path, view);

	view->path = path;
	view->number = NULL;
	view->name = NULL;
	view->photopath = NULL;

	elm_theme_extension_add(NULL, phoneui_theme);

	win = ui_utils_view_window_get(VIEW_PTR(*view));
	ui_utils_view_delete_callback_set(VIEW_PTR(*view), _delete_cb);

	ui_utils_view_layout_set(VIEW_PTR(*view), phoneui_theme,
				 "phoneui/messages/show");

	GList *keys = g_hash_table_get_keys(properties);
	for (; keys; keys = keys->next) {
		tmp = g_hash_table_lookup(properties, keys->data);
		if (tmp) {
			g_debug("--- %s: %s", (char *)keys->data, g_variant_print(tmp, TRUE));
		}
	}
	tmp = g_hash_table_lookup(properties, "Peer");
	if (!tmp) {
		tmp = g_hash_table_lookup(properties, "Sender");
	}
	if (!tmp) {
		tmp = g_hash_table_lookup(properties, "Recipient");
	}
	if (tmp) {
		view->number = g_variant_dup_string(tmp, NULL);
		g_debug("Found number %s - starting lookup", view->number);
		// FIXME: use new @Contacts feature from opimd whenever it is
		//        clear how to do that :P
		phoneui_utils_contact_lookup(view->number,
					     _common_name_callback,
					     common_utils_object_ref(view));
		ui_utils_view_text_set(VIEW_PTR(*view), "text_number",
				       view->number);
	}

	tmp = g_hash_table_lookup(properties, "Timestamp");
	if (tmp) {
		char *date = common_utils_timestamp_to_date(
					(long)g_variant_get_int32(tmp));
		if (date) {
			g_debug("Found date %s", date);
			ui_utils_view_text_set(VIEW_PTR(*view), "text_date", date);
			free(date);
		}
	}

	view->photo = elm_icon_add(win);
	evas_object_size_hint_aspect_set(view->photo,
					 EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
	elm_image_file_set(view->photo, phoneui_theme, "icon/contact");
	ui_utils_view_swallow(VIEW_PTR(*view), "photo", view->photo);
	evas_object_show(view->photo);

	ico = elm_icon_add(win);
	tmp = g_hash_table_lookup(properties, "Direction");
	if (tmp) {
		direction = g_variant_get_string(tmp, NULL);
		if (strcmp(direction, "in") == 0) {
			g_debug("Setting status icon for an incoming message");
			in_msg = EINA_TRUE;
			elm_image_file_set(ico, phoneui_theme,
					  "icon/phonelog-incoming");
		}
		else {
			g_debug("Setting status icon for a sent message");
			in_msg = EINA_FALSE;
			elm_image_file_set(ico, phoneui_theme,
					  "icon/phonelog-outgoing");
		}
	}
	ui_utils_view_swallow(VIEW_PTR(*view), "icon_status", ico);
	evas_object_show(ico);

	const char *content = NULL;
	tmp = g_hash_table_lookup(properties, "Content");
	if (tmp) {
		content = elm_entry_utf8_to_markup(g_variant_get_string(tmp, NULL));
	}

	view->sc_content = elm_scroller_add(win);
	elm_scroller_bounce_set(view->sc_content, EINA_FALSE, EINA_FALSE);

	view->content = elm_entry_add(win);
	elm_entry_anchor_hover_style_set(view->content, "popout");
	elm_entry_anchor_hover_parent_set(view->content, win);
	evas_object_size_hint_weight_set(view->content, EVAS_HINT_EXPAND,
					 EVAS_HINT_EXPAND);
	if (content) {
		elm_object_text_set(view->content, content);
	}
	elm_object_content_set(view->sc_content, view->content);
	evas_object_show(view->content);
	ui_utils_view_swallow(VIEW_PTR(*view), "text_content", view->sc_content);
	evas_object_show(view->sc_content);


	obj = elm_button_add(win);
	elm_object_text_set(obj, D_("Close"));
	evas_object_smart_callback_add(obj, "clicked",
				       _close_clicked, view);
	ui_utils_view_swallow(VIEW_PTR(*view), "button_close", obj);
	evas_object_show(obj);

	// Options button with hover
	view->hv = elm_hover_add(win);

	obj = elm_button_add(win);
	elm_object_text_set(obj, D_("Options"));
	evas_object_smart_callback_add(obj, "clicked", _hover_bt_1,
				       view->hv);
	ui_utils_view_swallow(VIEW_PTR(*view), "button_options", obj);
	evas_object_show(obj);

	elm_hover_parent_set(view->hv, win);
	elm_hover_target_set(view->hv, obj);

	box = elm_box_add(win);
	elm_box_horizontal_set(box, 0);
	elm_box_homogeneous_set(box, 1);
	evas_object_show(box);

	obj = elm_button_add(win);
	elm_object_text_set(obj, D_("Delete"));
	evas_object_size_hint_min_set(obj, 140, 80);
	evas_object_smart_callback_add(obj, "clicked",
				       _delete_clicked, view);
	evas_object_show(obj);
	elm_box_pack_end(box, obj);

	if (in_msg) {
		obj = elm_button_add(win);
		elm_object_text_set(obj, D_("Call"));
		evas_object_size_hint_min_set(obj, 140, 80);
		evas_object_smart_callback_add(obj, "clicked",
						   _call_clicked, view);
		evas_object_show(obj);
		elm_box_pack_end(box, obj);
	}

	obj = elm_button_add(win);
	elm_object_text_set(obj, D_("Add Contact"));
	evas_object_size_hint_min_set(obj, 140, 80);
	evas_object_smart_callback_add(obj, "clicked",
					   _new_contact_clicked,
					   view);
	evas_object_show(obj);
	elm_box_pack_end(box, obj);
	view->add_contact_bt = obj;

	obj = elm_button_add(win);
	elm_object_text_set(obj, D_("Forward"));
	evas_object_size_hint_min_set(obj, 140, 80);
	evas_object_smart_callback_add(obj, "clicked", _forward_clicked, view);
	evas_object_show(obj);
	elm_box_pack_end(box, obj);

	elm_object_part_content_set(view->hv, "top", box);


	obj = elm_button_add(win);
	elm_object_text_set(obj, D_("Answer"));
	evas_object_smart_callback_add(obj, "clicked",
				       _answer_clicked, view);
	ui_utils_view_swallow(VIEW_PTR(*view), "button_answer", obj);
	evas_object_show(obj);

	if (in_msg) {
		g_debug("going to set read status for the message");
		phoneui_utils_message_set_read_status(view->path, 1, NULL, NULL);
		g_debug("done - destroying properties now");
	}

	g_hash_table_destroy(properties);

	g_debug("done");

	return 0;
}
Evas_Object* viewer_manager_create(Evas_Object* _parent)
{
	__COMMON_FUNC_ENTER__;

	if (manager_object != NULL || _parent == NULL) {
		__COMMON_FUNC_EXIT__;
		return NULL;
	}

	manager_object = (viewer_manager_object*) g_malloc0(sizeof(viewer_manager_object));
	memset(manager_object, 0, sizeof(viewer_manager_object));

	manager_object->list = NULL;
	manager_object->item_hidden_btn = NULL;
	manager_object->item_sep_above_hidden_button = NULL;
	manager_object->item_sep_below_hidden_button = NULL;
	manager_object->item_header = NULL;

	/* Add Full Layout */
	Evas_Object* layout = elm_layout_add(_parent);
	elm_layout_theme_set(layout, "layout", "application", "default");
	evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	elm_win_resize_object_add(_parent, layout);
	edje_object_signal_emit(elm_layout_edje_get(layout), "elm,state,show,content", "elm");
	edje_object_signal_emit(elm_layout_edje_get(layout), "elm,bg,show,group_list", "elm");
	edje_object_signal_emit(elm_layout_edje_get(layout), "elm,state,show,indicator", "elm");

	/* Add Naviframe */
	manager_object->nav = elm_naviframe_add(layout);
	elm_object_part_content_set(layout, "elm.swallow.content", manager_object->nav);

	/* Add back button on Navigationbar */
	Evas_Object* button_back = elm_button_add(manager_object->nav);

	/* Add MainView Layout */
	Evas_Object* view_content = elm_layout_add(manager_object->nav);
	elm_layout_theme_set(view_content, "standard", "window", "integration");
	edje_object_signal_emit(elm_layout_edje_get(view_content), "elm,state,show,content", "elm");
	edje_object_signal_emit(elm_layout_edje_get(view_content), "elm,bg,show,group_list", "elm");

	/* Add Conformant */
	Evas_Object *conform = elm_conformant_add(manager_object->nav);
	elm_object_style_set(conform, "internal_layout");
	elm_object_part_content_set(view_content, "elm.swallow.content", conform);
	evas_object_show(conform);

	/* Add Genlist */
	manager_object->list = viewer_list_create(manager_object->nav);
	assertm_if(NULL == manager_object->list, "manager_object->list is NULL!!");
	viewer_manager_header_create(manager_object->list);
	viewer_manager_bottom_create(manager_object->list);
	viewer_manager_hidden_button_create(manager_object->list);

	elm_object_content_set(conform, manager_object->list);

	if (ug_app_state->ug_type == UG_VIEW_SETUP_WIZARD) {
		Elm_Object_Item* navi_it = elm_naviframe_item_push(manager_object->nav, sc(PACKAGE, I18N_TYPE_Wi_Fi), NULL, NULL, view_content, NULL);
		evas_object_data_set(manager_object->nav, SCREEN_TYPE_ID_KEY, (void *)VIEW_MANAGER_VIEW_TYPE_MAIN);
		evas_object_smart_callback_add(manager_object->nav, "transition,finished", _hide_finished_cb, navi_it);

		Evas_Object *toolbar = elm_toolbar_add(manager_object->nav);
		elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_EXPAND);

		if(ug_app_state->lbutton_setup_wizard_prev_icon != NULL && ug_app_state->lbutton_setup_wizard != NULL) {
		    manager_object->prev_button = (Evas_Object *)elm_toolbar_item_append(toolbar, ug_app_state->lbutton_setup_wizard_prev_icon, ug_app_state->lbutton_setup_wizard, _lbutton_click_cb, NULL);
		    elm_object_item_disabled_set(elm_toolbar_item_append(toolbar, NULL, "", NULL, NULL), EINA_TRUE);
		}
		if(ug_app_state->rbutton_setup_wizard_scan_icon != NULL) {
		    manager_object->scan_button = (Evas_Object *)elm_toolbar_item_append(toolbar, ug_app_state->rbutton_setup_wizard_scan_icon, sc(PACKAGE, I18N_TYPE_Scan), _refresh_sk_cb, NULL);
		    elm_object_item_disabled_set(elm_toolbar_item_append(toolbar, NULL, "", NULL, NULL), EINA_TRUE);
		}
		if(ug_app_state->rbutton_setup_wizard_skip_icon != NULL && ug_app_state->rbutton_setup_wizard_skip != NULL) {
		    manager_object->next_button = (Evas_Object *)elm_toolbar_item_append(toolbar, ug_app_state->rbutton_setup_wizard_skip_icon, ug_app_state->rbutton_setup_wizard_skip, _rbutton_click_cb, NULL);
		}
		elm_object_item_part_content_set(navi_it, "controlbar", toolbar);

	} else {
		Elm_Object_Item* navi_it = elm_naviframe_item_push(manager_object->nav, sc(PACKAGE, I18N_TYPE_Wi_Fi), button_back, NULL, view_content, NULL);
		evas_object_data_set(manager_object->nav, SCREEN_TYPE_ID_KEY, (void *)VIEW_MANAGER_VIEW_TYPE_MAIN);
		evas_object_smart_callback_add(manager_object->nav, "transition,finished", _hide_finished_cb, navi_it);

		Evas_Object *toolbar = elm_toolbar_add(manager_object->nav);
		elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_EXPAND);

		manager_object->scan_button = (Evas_Object *)elm_toolbar_item_append(toolbar, NULL, sc(PACKAGE, I18N_TYPE_Scan), _refresh_sk_cb, NULL);
		elm_object_item_disabled_set(elm_toolbar_item_append(toolbar, NULL, "", NULL, NULL), EINA_TRUE);
		elm_object_item_part_content_set(navi_it, "controlbar", toolbar);

		elm_object_style_set(button_back, "naviframe/back_btn/default");
		evas_object_smart_callback_add(button_back, "clicked", _back_sk_cb, NULL);
	}

	evas_object_show(layout);

	__COMMON_FUNC_EXIT__;
	return layout;
}
示例#3
0
EAPI_MAIN int
elm_main(int argc, char **argv)
{
   Evas_Object *win, *bg, *bx, *hbx, *tg, *ck, *mb, *tb, *ic;
   unsigned int i, j;

   win = elm_win_add(NULL, "mapbuf", ELM_WIN_BASIC);
   elm_win_title_set(win, "Mapbuf Example");
   evas_object_smart_callback_add(win, "delete,request", _on_done, NULL);

   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);

   bx = elm_box_add(win);
   evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
   elm_win_resize_object_add(win, bx);
   evas_object_show(bx);

   mb = elm_mapbuf_add(win);
   evas_object_size_hint_weight_set(mb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(mb, EVAS_HINT_FILL, EVAS_HINT_FILL);
   elm_box_pack_end(bx, mb);

   tb = elm_table_add(win);
   evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
   evas_object_show(tb);

   for (i = 0; i < 8; i++)
     {
        for (j = 0; j < 8; j++)
          {
             ic = elm_icon_add(win);
             elm_icon_standard_set(ic, "home");
             elm_image_resizable_set(ic, EINA_FALSE, EINA_FALSE);
             evas_object_show(ic);
             elm_table_pack(tb, ic, i, j, 1, 1);
          }
     }

   elm_object_content_set(mb, tb);
   evas_object_show(mb);

   hbx = elm_box_add(win);
   elm_box_horizontal_set(hbx, EINA_TRUE);
   evas_object_size_hint_weight_set(hbx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(hbx, EVAS_HINT_FILL, EVAS_HINT_FILL);
   elm_box_pack_end(bx, hbx);
   evas_object_show(hbx);

   tg = elm_check_add(win);
   elm_object_style_set(tg, "toggle");
   elm_object_part_text_set(tg, "on", "Enabled");
   elm_object_part_text_set(tg, "off", "Disabled");
   elm_object_text_set(tg, "Map");
   evas_object_smart_callback_add(tg, "changed", _enabled_cb, mb);
   elm_box_pack_end(hbx, tg);
   evas_object_show(tg);

   ck = elm_check_add(win);
   elm_object_text_set(ck, "Alpha");
   elm_check_state_set(ck, EINA_TRUE);
   evas_object_smart_callback_add(ck, "changed", _alpha_cb, mb);
   elm_box_pack_end(hbx, ck);
   evas_object_show(ck);

   ck = elm_check_add(win);
   elm_object_text_set(ck, "Smooth");
   elm_check_state_set(ck, EINA_TRUE);
   evas_object_smart_callback_add(ck, "changed", _smooth_cb, mb);
   elm_box_pack_end(hbx, ck);
   evas_object_show(ck);

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

   elm_run();
   elm_shutdown();

   return 0;
}
示例#4
0
文件: gui.c 项目: shr-project/e-tasks
void create_gui(Evas_Object *win)
{
	int i;
	char no[2], *tystr, buf[255];
	Evas_Object *bg, *hbox, *prop_button, *sc, *ic, *bx1;
	Evas_Object *vbox, *bx, *hbox1, *bt, *save_button, *note_button;

	//add background
	bg = elm_bg_add(win);
	elm_win_resize_object_add(win, bg);
	evas_object_size_hint_weight_set(bg, 1.0, 1.0);
	evas_object_show(bg);

	//add vbox
	vbox = elm_box_add(win);
	elm_win_resize_object_add(win, vbox);
	evas_object_size_hint_weight_set(vbox, 1.0, 1.0);
	evas_object_show(vbox);

	//add hbox to vbox
	hbox = elm_box_add(win);
	elm_box_horizontal_set(hbox, 1);
	evas_object_size_hint_weight_set(hbox, 1.0, 0.0);
	evas_object_size_hint_align_set(hbox, -1.0, 0.0);
	elm_box_pack_end(vbox, hbox);
	evas_object_show(hbox);
	
	//add hover for priority
	hv = elm_hover_add(win);
	//add box for hover
	bx = elm_box_add(win);
	elm_box_pack_end(hbox, bx);
	//evas_object_size_hint_weight_set(bx, 0.0, 1.0);
	//evas_object_size_hint_align_set(bx, 0.0, -1.0);
	evas_object_show(bx);

	pr_bt = elm_button_add(win);
	elm_object_text_set(pr_bt, "Pr");
	evas_object_smart_callback_add(pr_bt, "clicked", my_hover_bt_1, hv);
	elm_box_pack_end(bx, pr_bt);
	evas_object_show(pr_bt);
	elm_hover_parent_set(hv, win);
	elm_hover_target_set(hv, pr_bt);

	bt = elm_button_add(win);
	elm_object_text_set(bt, "Pr");
	elm_object_part_content_set(hv, "middle", bt);
	evas_object_show(bt);

	bx = elm_box_add(win);
	//add 5 buttons
	for (i=1; i<6; i++) {
		bt = elm_button_add(win);
		sprintf(no, "%d", i);
		elm_object_text_set(bt, no);
		elm_box_pack_end(bx, bt);
		tystr = strdup(no);
		evas_object_smart_callback_add(bt, "clicked", set_priority, (char *)tystr);
		evas_object_show(bt);
	}	
	evas_object_show(bx);
	elm_object_part_content_set(hv, "bottom", bx);
	
	//add scroller for entry
	sc = elm_scroller_add(win);
	elm_scroller_content_min_limit(sc, 0, 1);
	elm_scroller_policy_set(sc, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
	evas_object_size_hint_weight_set(sc, 1.0, 0.0);
	evas_object_size_hint_align_set(sc, -1.0, -1.0);
	elm_box_pack_end(hbox, sc);
	
	//add entry for task
	tk = elm_entry_add(win);
	elm_entry_single_line_set(tk ,1);
	elm_entry_entry_set(tk, "Task");
	evas_object_size_hint_weight_set(tk, 1.0, 0.0);
	evas_object_size_hint_align_set(tk, -1.0, 0.0);
	elm_object_content_set(sc, tk);
	evas_object_show(tk);
	evas_object_show(sc);

	//add hover for date
	date_hs = elm_hover_add(win);
	//add box for hover
	bx1 = elm_box_add(win);
	elm_box_pack_end(hbox, bx1);
	evas_object_size_hint_weight_set(bx1, 0.0, 0.0);
	evas_object_size_hint_align_set(bx1, 0.0, -1.0);
	evas_object_show(bx1);

	date_bt = elm_button_add(win);
	elm_object_text_set(date_bt, "Date");
	evas_object_smart_callback_add(date_bt, "clicked", my_hover_bt_1, date_hs);
	elm_box_pack_end(bx1, date_bt);
	evas_object_show(date_bt);
	elm_hover_parent_set(date_hs, win);
	elm_hover_target_set(date_hs, date_bt);

	bt = elm_button_add(win);
	elm_object_text_set(bt, "Date");
	elm_object_part_content_set(date_hs, "middle", bt);
	evas_object_show(bt);

	bx1 = elm_box_add(win);
	add_dates(win, bx1, bt);
	evas_object_show(bx1);
	elm_object_part_content_set(date_hs, "bottom", bx1);

	//add save button
	save_button = elm_button_add(win);
	elm_object_text_set(save_button, "Save");
	evas_object_size_hint_weight_set(save_button, 0.0, 0.0);
	evas_object_size_hint_align_set(save_button, 1.0, -1.0);
	elm_box_pack_end(hbox, save_button);
	evas_object_show(save_button);
	evas_object_smart_callback_add(save_button, "clicked", save_button_clicked, list);
	
	//add list to vbox now
	list = elm_genlist_add(win);
	evas_object_size_hint_weight_set(list, 1.0, 1.0);
	evas_object_size_hint_align_set(list, -1.0, -1.0);
	elm_list_multi_select_set(list, 0);
	elm_box_pack_end(vbox, list);
	elm_genlist_mode_set(list, ELM_LIST_LIMIT);
	evas_object_show(list);
	evas_object_smart_callback_add(list, "selected", task_select, list);

	//genlist class defs
	itc1.item_style     	= "default";
	itc1.func.text_get 	= gl_text_get;
	itc1.func.content_get  	= gl_content_get;
	itc1.func.state_get 	= gl_state_get;
	itc1.func.del      		= gl_del;

	//add hbox to vbox at pos 4
	hbox1 = elm_box_add(win);
	elm_box_horizontal_set(hbox1, 1);
	evas_object_size_hint_weight_set(hbox1, 1.0, 0.0);
	evas_object_size_hint_align_set(hbox1, -1.0, 0.0);
	elm_box_pack_end(vbox, hbox1);
	evas_object_show(hbox1);

	//add new button to the hbox
	new_button = elm_button_add(win);
	elm_object_text_set(new_button, "Add");
	evas_object_size_hint_weight_set(new_button, 1.0, 1.0);
	evas_object_size_hint_align_set(new_button, -1.0, -1.0);
	elm_box_pack_end(hbox1, new_button);
	evas_object_show(new_button);
	evas_object_smart_callback_add(new_button, "clicked", create_new_task, list);

	//add Properties button to the hbox
	prop_button = elm_button_add(win);
	elm_object_text_set(prop_button, "Details");
	evas_object_size_hint_weight_set(prop_button, 1.0, 1.0);
	evas_object_size_hint_align_set(prop_button, -1.0, -1.0);
	elm_box_pack_end(hbox1, prop_button);
	evas_object_show(prop_button);
	evas_object_smart_callback_add(prop_button, "clicked", create_details_page, NULL);

	//add note button to the hbox
	note_button = elm_button_add(win);
	ic = elm_icon_add(win);
	snprintf(buf, sizeof(buf), "/usr/share/e-tasks/note_butt.png");
	elm_icon_file_set(ic, buf, NULL);
	evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
	elm_object_content_set(note_button, ic);
	evas_object_show(ic);
	//elm_object_text_set(note_button, "Note");
	evas_object_size_hint_weight_set(note_button, 1.0, 1.0);
	evas_object_size_hint_align_set(note_button, -1.0, -1.0);
	elm_box_pack_end(hbox1, note_button);
	evas_object_show(note_button);
	evas_object_smart_callback_add(note_button, "clicked", note_button_clicked, list);

	//add hover for category select
	hs1 = elm_hover_add(win);
	//add box for hover
	bx = elm_box_add(win);
	evas_object_size_hint_weight_set(bx, 0.0, 0.0);
	elm_box_pack_end(hbox1, bx);
	evas_object_show(bx);

	sel_cat_bt = elm_button_add(win);
	elm_object_text_set(sel_cat_bt, " All Tasks ");
	evas_object_smart_callback_add(sel_cat_bt, "clicked", my_hover_bt_1, hs1);
	elm_box_pack_end(bx, sel_cat_bt);
	evas_object_show(sel_cat_bt);
	elm_hover_parent_set(hs1, win);
	elm_hover_target_set(hs1, sel_cat_bt);

	bt = elm_button_add(win);
	elm_object_text_set(bt, " All Tasks ");
	elm_object_part_content_set(hs1, "middle", bt);
	evas_object_show(bt);
	create_cat_hover ();

	// make window full screen
	evas_object_resize(win, 480, 640);
}
void ActivityScheduleScenarioView::reloadTimeRanges()
{
    elm_genlist_clear(schedule_list);

    vector<TimeRange> trange_sorted;
    auto sortTimeRange = [&trange_sorted](vector<TimeRange> &range, int day)
    {
        for (TimeRange &t: range)
        {
            auto it = std::find(trange_sorted.begin(), trange_sorted.end(), t);
            if (it != trange_sorted.end())
            {
                //timerange already in trange_sorted, add the day of week flag
                it->dayOfWeek.set(day);
            }
            else
            {
                TimeRange newtr = t;
                newtr.dayOfWeek.reset();
                newtr.dayOfWeek.set(day);
                trange_sorted.push_back(newtr);
            }
        }
    };

    sortTimeRange(range_infos.range_monday, 0);
    sortTimeRange(range_infos.range_tuesday, 1);
    sortTimeRange(range_infos.range_wednesday, 2);
    sortTimeRange(range_infos.range_thursday, 3);
    sortTimeRange(range_infos.range_friday, 4);
    sortTimeRange(range_infos.range_saturday, 5);
    sortTimeRange(range_infos.range_sunday, 6);

    for (TimeRange &t: trange_sorted)
    {
        GenlistItemScenarioScheduleTime *item = new GenlistItemScenarioScheduleTime(evas, parent, t);
        item->Append(schedule_list);
        item->edit_click.connect([=]()
        {
            is_edit = true;
            old_range = t;
            edit_range = t;
            editState = EDIT_START_TYPE;
            showTimeRangePopup();
        });
        item->del_click.connect([=]()
        {
            Evas_Object *table = createPaddingTable(evas, parent, 280, 260);

            Evas_Object *glist = elm_genlist_add(table);
            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);

            string title_label = _("Confirmation");
            title_label += "<br><small><light_blue>";
            title_label += _("Are you sure to delete this schedule?");
            title_label +=  "</light_blue></small>";
            GenlistItemBase *header = new GenlistItemSimpleHeader(evas, glist, title_label);
            header->Append(glist);

            Evas_Object *popup_del = elm_ctxpopup_add(parent);

            GenlistItemSimple *_item = new GenlistItemSimple(evas, parent, _("Yes, delete this schedule"), true);
            _item->Append(glist, header);
            _item->item_selected.connect([=](void *)
            {
                deleteTimeRange(t);
                elm_ctxpopup_dismiss(popup_del);
                reloadTimeRanges();
            });

            _item = new GenlistItemSimple(evas, parent, "Non", true);
            _item->Append(glist, header);
            _item->item_selected.connect([=](void *)
            {
                elm_ctxpopup_dismiss(popup_del);
            });

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

            elm_object_content_set(popup_del, table);
            elm_object_style_set(popup_del, "calaos");
            elm_ctxpopup_direction_priority_set(popup_del,
                                                ELM_CTXPOPUP_DIRECTION_DOWN,
                                                ELM_CTXPOPUP_DIRECTION_UP,
                                                ELM_CTXPOPUP_DIRECTION_LEFT,
                                                ELM_CTXPOPUP_DIRECTION_RIGHT);

            Evas_Coord x,y;
            evas_pointer_canvas_xy_get(evas, &x, &y);
            evas_object_move(popup_del, x, y);
            evas_object_show(popup_del);
        });
    }

    //reload months
    if (range_infos.range_months.all())
    {
        //all months are selected

        item_all->setSelected(true);
        for (uint i = 0;i < items_months.size();i++)
            items_months[i]->setSelected(false);
    }
    else
    {
        item_all->setSelected(false);
        for (uint i = 0;i < items_months.size();i++)
            items_months[i]->setSelected(range_infos.range_months.test(i));
    }
}
示例#6
0
/* ad-hoc network
  .-box-------------------------------------------------------------------.
  | .-scroller----------------------------------------------------------. |
  | | .-table---------------------------------------------------------. | |
  | | | Crate an Ad-Hoc Network                                       | | |
  | | | ESSID:                  [...................................] | | |
  | | | IP:                     [...................................] | | |
  | | | Channel:                [...................................] | | |
  | | | [] Activate Internet Connection Sharing                       | | |
  | | | [] Use Encryption (WEP only)                                  | | |
  | | | Key:                    [...................................] | | |
  | | `---------------------------------------------------------------' | |
  | `-------------------------------------------------------------------' |
  | .-box---------------------------------------------------------------. |
  | |                                                    [Cancel]  [OK] | |
  | `-------------------------------------------------------------------' |
  `-----------------------------------------------------------------------'
*/
void
wicd_adhoc(void)
{
    Evas_Object *bx, *sc, *tb, *ob, *bx2;

    bx = elm_box_add(wicdelm->win);
    elm_box_homogeneous_set(bx, EINA_FALSE);
    elm_box_horizontal_set(bx, EINA_FALSE);
    evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_show(bx);
    wicdelm->adhoc.page = bx;

    sc = elm_scroller_add(wicdelm->win);
    elm_scroller_content_min_limit(sc, EINA_TRUE, EINA_FALSE);
    elm_scroller_policy_set(sc
        , ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
    evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL);
    elm_scroller_bounce_set(sc, EINA_FALSE, EINA_TRUE);
    elm_box_pack_end(bx, sc);
    evas_object_show(sc);

    // table
    tb = elm_table_add(wicdelm->win);
    elm_table_homogeneous_set(tb, EINA_FALSE);
    evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, 0.0);
    evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0);
    elm_object_content_set(sc, tb);
    evas_object_show(tb);

    ob = elm_label_add(wicdelm->win);
    elm_object_text_set(ob, "<b>Create an Ad-Hoc Network</b>");
    evas_object_size_hint_weight_set(ob, EVAS_HINT_EXPAND, 0.0);
    evas_object_size_hint_align_set(ob, EVAS_HINT_FILL, 0.5);
    elm_table_pack(tb, ob, 0, 0, 2, 1);
    evas_object_show(ob);

    ob = elm_label_add(wicdelm->win);
    elm_object_text_set(ob, "ESSID:");
    evas_object_size_hint_weight_set(ob, 0.0, 0.0);
    evas_object_size_hint_align_set(ob, 0.0, 0.5);
    elm_table_pack(tb, ob, 0, 1, 1, 1);
    evas_object_show(ob);
    ob = elm_entry_add(wicdelm->win);
    elm_entry_scrollable_set(ob, EINA_TRUE);
    elm_entry_single_line_set(ob, EINA_TRUE);
    evas_object_size_hint_align_set(ob, EVAS_HINT_FILL, 0.0);
    evas_object_size_hint_weight_set(ob, EVAS_HINT_EXPAND, 0.0);
    elm_table_pack(tb, ob, 1, 1, 1, 1);
    evas_object_show(ob);
    evas_object_smart_callback_add(ob, "changed", _changed_cb, NULL);
    wicdelm->adhoc.essid = ob;

    ob = elm_label_add(wicdelm->win);
    elm_object_text_set(ob, "IP:");
    evas_object_size_hint_weight_set(ob, 0.0, 0.0);
    evas_object_size_hint_align_set(ob, 0.0, 0.5);
    elm_table_pack(tb, ob, 0, 2, 1, 1);
    evas_object_show(ob);
    ob = elm_entry_add(wicdelm->win);
    elm_entry_scrollable_set(ob, EINA_TRUE);
    elm_entry_single_line_set(ob, EINA_TRUE);
    evas_object_size_hint_align_set(ob, EVAS_HINT_FILL, 0.0);
    evas_object_size_hint_weight_set(ob, EVAS_HINT_EXPAND, 0.0);
    elm_table_pack(tb, ob, 1, 2, 1, 1);
    evas_object_show(ob);
    evas_object_smart_callback_add(ob, "changed", _changed_cb, NULL);
    wicdelm->adhoc.ip = ob;

    ob = elm_label_add(wicdelm->win);
    elm_object_text_set(ob, "Channel:");
    evas_object_size_hint_weight_set(ob, 0.0, 0.0);
    evas_object_size_hint_align_set(ob, 0.0, 0.5);
    elm_table_pack(tb, ob, 0, 3, 1, 1);
    evas_object_show(ob);
    ob = elm_slider_add(wicdelm->win);
    elm_slider_min_max_set(ob, 1.0, 14.0);
    elm_slider_indicator_format_set(ob, "%02.0f");
    elm_slider_unit_format_set(ob, "%02.0f");
    evas_object_size_hint_align_set(ob, EVAS_HINT_FILL, 0.0);
    evas_object_size_hint_weight_set(ob, EVAS_HINT_EXPAND, 0.0);
    elm_table_pack(tb, ob, 1, 3, 1, 1);
    evas_object_show(ob);
    evas_object_smart_callback_add(ob, "delay,changed", _changed_cb, NULL);
    wicdelm->adhoc.channel = ob;

    ob = elm_check_add(wicdelm->win);
    elm_object_text_set(ob, "Share Internet");
    evas_object_size_hint_weight_set(ob, EVAS_HINT_EXPAND, 0.0);
    evas_object_size_hint_align_set(ob, EVAS_HINT_FILL, 0.5);
    elm_table_pack(tb, ob, 0, 4, 2, 1);
    evas_object_show(ob);
    evas_object_smart_callback_add(ob, "changed", _changed_cb, NULL);
    wicdelm->adhoc.shareInternet = ob;

    ob = elm_check_add(wicdelm->win);
    elm_object_text_set(ob, "WEP Encryption");
    evas_object_size_hint_weight_set(ob, EVAS_HINT_EXPAND, 0.0);
    evas_object_size_hint_align_set(ob, EVAS_HINT_FILL, 0.5);
    elm_table_pack(tb, ob, 0, 5, 2, 1);
    evas_object_show(ob);
    evas_object_smart_callback_add(ob, "changed", _changed_cb, NULL);
    wicdelm->adhoc.useEncryption = ob;

    ob = elm_label_add(wicdelm->win);
    elm_object_text_set(ob, "Key:");
    evas_object_size_hint_weight_set(ob, 0.0, 0.0);
    evas_object_size_hint_align_set(ob, 0.0, 0.5);
    elm_table_pack(tb, ob, 0, 6, 1, 1);
    evas_object_show(ob);
    ob = elm_entry_add(wicdelm->win);
    elm_entry_scrollable_set(ob, EINA_TRUE);
    elm_entry_single_line_set(ob, EINA_TRUE);
    evas_object_size_hint_align_set(ob, EVAS_HINT_FILL, 0.0);
    evas_object_size_hint_weight_set(ob, EVAS_HINT_EXPAND, 0.0);
    elm_table_pack(tb, ob, 1, 6, 1, 1);
    evas_object_show(ob);
    evas_object_smart_callback_add(ob, "changed", _changed_cb, NULL);
    wicdelm->adhoc.key = ob;

    bx2 = elm_box_add(wicdelm->win);
    elm_box_homogeneous_set(bx2, EINA_TRUE);
    elm_box_horizontal_set(bx2, EINA_TRUE);
    evas_object_size_hint_align_set(bx2, 1.0, 1.0);
    evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
    elm_box_pack_end(bx, bx2);
    evas_object_show(bx2);

    ob = elm_button_add(wicdelm->win);
    elm_object_text_set(ob, "Cancel");
    evas_object_size_hint_align_set(ob, EVAS_HINT_FILL, 0.0);
    evas_object_smart_callback_add(ob, "clicked", _cancel_cb, NULL);
    elm_box_pack_end(bx2, ob);
    evas_object_show(ob);

    ob = elm_button_add(wicdelm->win);
    elm_object_text_set(ob, "Ok");
    evas_object_size_hint_align_set(ob, EVAS_HINT_FILL, 0.0);
    evas_object_smart_callback_add(ob, "clicked", _ok_cb, NULL);
    elm_box_pack_end(bx2, ob);
    evas_object_show(ob);

    wicdelm->adhoc.item = elm_naviframe_item_simple_push(wicdelm->naviframe, bx);
}
示例#7
0
文件: browser_bar.c 项目: gzorin/e17
Evas_Object *
enna_browser_bar_add(Evas_Object *parent, Enna_File *file)
{
   Evas_Object *o_layout;
   Evas_Object *o_ic;
   Evas_Object *o_seg;
   Evas_Object *o_box;
   Evas_Object *o_entry;

   o_layout = elm_layout_add(parent);
   elm_layout_file_set(o_layout, enna_config_theme_get(), "enna/browser/header");
   evas_object_show(o_layout);

   o_box = elm_box_add(o_layout);
   elm_box_horizontal_set(o_box, EINA_TRUE);
   evas_object_show(o_box);
   evas_object_size_hint_align_set(o_box, EVAS_HINT_FILL, EVAS_HINT_FILL);
   evas_object_size_hint_weight_set(o_box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_box_padding_set(o_box, 8, 8);

   o_seg = elm_button_add(o_layout);
   o_ic = elm_icon_add(o_layout);
   evas_object_show(o_ic);
   elm_icon_standard_set(o_ic, "go-up");
   elm_object_content_set(o_seg, o_ic);
   elm_object_style_set(o_seg, "black");
   evas_object_show(o_seg);
   elm_box_pack_end(o_box, o_seg);
   evas_object_smart_callback_add(o_seg, "clicked", _up_clicked_cb, o_layout);
   evas_object_size_hint_min_set(o_seg, 40, 40);

   o_seg = elm_segment_control_add(o_layout);
   o_ic = elm_icon_add(o_layout);
   evas_object_show(o_ic);
   elm_icon_standard_set(o_ic, "go-previous");
   elm_segment_control_item_add(o_seg, o_ic, NULL);
   o_ic = elm_icon_add(o_layout);
   evas_object_show(o_ic);
   elm_icon_standard_set(o_ic, "go-next");
   elm_segment_control_item_add(o_seg, o_ic, NULL);
   evas_object_show(o_seg);
   evas_object_smart_callback_add(o_seg, "changed", _browse_icons_changed_cb, o_layout);
   evas_object_data_set(o_layout, "browse", o_seg);
   elm_box_pack_end(o_box, o_seg);
   evas_object_size_hint_min_set(o_seg, 80, 40);

   o_entry = elm_entry_add(o_layout);
   elm_entry_single_line_set(o_entry, EINA_TRUE);
   if (file) elm_object_text_set(o_entry, file->mrl);
   evas_object_size_hint_weight_set(o_entry, EVAS_HINT_EXPAND, 0.0);
   evas_object_size_hint_align_set(o_entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
   evas_object_show(o_entry);
   elm_box_pack_end(o_box, o_entry);
   evas_object_data_set(o_layout, "entry", o_entry);
   evas_object_smart_callback_add(o_entry, "activated", _entry_activated_cb, o_layout);

   o_seg = elm_segment_control_add(o_layout);
   o_ic = elm_icon_add(o_layout);
   evas_object_show(o_ic);
   elm_icon_file_set(o_ic, enna_config_theme_get(), "icon/view_list");
   elm_segment_control_item_add(o_seg, o_ic, NULL);
   o_ic = elm_icon_add(o_layout);
   evas_object_show(o_ic);
   elm_icon_file_set(o_ic, enna_config_theme_get(), "icon/view_grid");
   elm_segment_control_item_add(o_seg, o_ic, NULL);
   evas_object_show(o_seg);
   elm_box_pack_end(o_box, o_seg);
   evas_object_smart_callback_add(o_seg, "changed", _view_mode_changed_cb, o_layout);
   evas_object_data_set(o_layout, "mode", o_seg);
   evas_object_size_hint_min_set(o_seg, 80, 40);


   o_seg = elm_button_add(o_layout);
   o_ic = elm_icon_add(o_layout);
   evas_object_show(o_ic);
   elm_icon_file_set(o_ic, enna_config_theme_get(), "icon/search");
   elm_object_content_set(o_seg, o_ic);
   elm_object_style_set(o_seg, "black");
   evas_object_show(o_seg);
   elm_box_pack_end(o_box, o_seg);
   evas_object_size_hint_min_set(o_seg, 40, 40);

   o_seg = elm_button_add(o_layout);
   o_ic = elm_icon_add(o_layout);
   evas_object_show(o_ic);
   elm_icon_file_set(o_ic, enna_config_theme_get(), "icon/settings");
   elm_object_content_set(o_seg, o_ic);
   elm_object_style_set(o_seg, "black");
   evas_object_show(o_seg);
   elm_box_pack_end(o_box, o_seg);
   evas_object_size_hint_min_set(o_seg, 40, 40);

   elm_object_part_content_set(o_layout, "enna.swallow.content", o_box);

   return o_layout;
}
EAPI_MAIN int
elm_main(int argc, char **argv)
{
   Evas_Object *win, *conform, *btn, *bx, *en;

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   win = elm_win_util_standard_add("conformant", "Conformant Example");
   elm_win_autodel_set(win, EINA_TRUE);

   elm_win_conformant_set(win, EINA_TRUE);

   conform = elm_conformant_add(win);
   evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_win_resize_object_add(win, conform);
   evas_object_show(conform);

   bx = elm_box_add(win);
   evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);

   btn = elm_button_add(win);
   elm_object_text_set(btn, "Test Conformant");
   evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0);
   evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 0);
   elm_box_pack_end(bx, btn);
   evas_object_show(btn);

   en = elm_entry_add(win);
   elm_entry_scrollable_set(en, EINA_TRUE);
   elm_object_text_set(en,
                       "This is a multi-line entry at the bottom<br>"
                       "This can contain more than 1 line of text and be "
                       "scrolled around to allow for entering of lots of "
                       "content. It is also to test to see that autoscroll "
                       "moves to the right part of a larger multi-line "
                       "text entry that is inside of a scroller than can be "
                       "scrolled around, thus changing the expected position "
                       "as well as cursor changes updating auto-scroll when "
                       "it is enabled.");

   evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
   evas_object_show(en);
   elm_box_pack_end(bx, en);

   btn = elm_button_add(win);
   elm_object_text_set(btn, "Test Conformant");
   evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0);
   evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 0);
   elm_box_pack_end(bx, btn);
   evas_object_show(btn);

   elm_object_content_set(conform, bx);
   evas_object_show(bx);

   evas_object_resize(win, 240, 480);
   evas_object_show(win);

   elm_run();

   return 0;
}
Eina_Bool Add_To_Most_Visited_Sites_View::_create_main_layout(void)
{
	BROWSER_LOGD("[%s]", __func__);
	elm_win_conformant_set(m_win, EINA_TRUE);

	m_conformant = elm_conformant_add(m_navi_bar);
	if (!m_conformant) {
		BROWSER_LOGE("elm_conformant_add failed");
		return EINA_FALSE;
	}
	elm_object_style_set(m_conformant, "internal_layout");
	evas_object_size_hint_weight_set(m_conformant, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	evas_object_size_hint_align_set(m_conformant, EVAS_HINT_FILL, EVAS_HINT_FILL);
	evas_object_show(m_conformant);

	m_content_box = elm_box_add(m_conformant);
	if (!m_content_box) {
		BROWSER_LOGE("elm_box_add failed");
		return EINA_FALSE;
	}
	evas_object_size_hint_align_set(m_content_box, EVAS_HINT_FILL, EVAS_HINT_FILL);
	evas_object_size_hint_weight_set(m_content_box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	evas_object_show(m_content_box);

	elm_object_content_set(m_conformant, m_content_box);

	m_url_edit_field = br_elm_editfield_add(m_conformant, EINA_TRUE);
	if (!m_url_edit_field) {
		BROWSER_LOGE("elm_editfield_add failed");
		return EINA_FALSE;
	}
	evas_object_size_hint_align_set(m_url_edit_field, EVAS_HINT_FILL, EVAS_HINT_FILL);
	br_elm_editfield_entry_single_line_set(m_url_edit_field, EINA_TRUE);
	br_elm_editfield_label_set(m_url_edit_field, BR_STRING_URL);
	evas_object_show(m_url_edit_field);

	Evas_Object *entry = br_elm_editfield_entry_get(m_url_edit_field);
	elm_entry_input_panel_layout_set(entry, ELM_INPUT_PANEL_LAYOUT_URL);

	if (m_most_visited_sites->m_selected_item->url && strlen(m_most_visited_sites->m_selected_item->url))
		/* If modify selected speed dial item. */
		elm_entry_entry_set(entry, m_most_visited_sites->m_selected_item->url);
	else
		/* If add empty speed dial item. */
		elm_entry_entry_set(entry, BROWSER_HTTP_SCHEME);

	/* To show ime.
	  * __set_focus_editfield_idler_cb is defined in browser_common_view class. */
	ecore_idler_add(__set_focus_editfield_idler_cb, m_url_edit_field);

	elm_box_pack_end(m_content_box, m_url_edit_field);

	m_history_genlist = _create_history_genlist();
	if (!m_history_genlist) {
		BROWSER_LOGE("_create_history_genlist failed");
		return EINA_FALSE;
	}
	elm_box_pack_end(m_content_box, m_history_genlist);
	evas_object_show(m_history_genlist);

	Elm_Object_Item *navi_it = elm_naviframe_item_push(m_navi_bar, BR_STRING_ADD_TO_MOST_VISITED_SITES,
						NULL, NULL, m_conformant, "browser_titlebar");
	elm_object_item_part_content_set(navi_it, ELM_NAVIFRAME_ITEM_PREV_BTN, NULL);

	m_cancel_button = elm_button_add(m_conformant);
	if (!m_cancel_button) {
		BROWSER_LOGE("elm_button_add failed");
		return EINA_FALSE;
	}
	elm_object_style_set(m_cancel_button, "browser/title_button");
	elm_object_text_set(m_cancel_button, BR_STRING_CANCEL);
	evas_object_show(m_cancel_button);
	evas_object_smart_callback_add(m_cancel_button, "clicked", __cancel_button_clicked_cb, this);
	elm_object_item_part_content_set(navi_it, ELM_NAVIFRAME_ITEM_TITLE_LEFT_BTN, m_cancel_button);

	m_save_button = elm_button_add(m_conformant);
	if (!m_save_button) {
		BROWSER_LOGE("elm_button_add failed");
		return EINA_FALSE;
	}
	elm_object_style_set(m_save_button, "browser/title_button");
	elm_object_text_set(m_save_button, BR_STRING_SAVE);
	evas_object_show(m_save_button);
	evas_object_smart_callback_add(m_save_button, "clicked", __save_button_clicked_cb, this);
	elm_object_item_part_content_set(navi_it, ELM_NAVIFRAME_ITEM_TITLE_RIGHT_BTN, m_save_button);

	return EINA_TRUE;
}
void GenlistItemScenarioSchedule::buttonClickMore()
{
    if (!scenario) return;

    Evas_Object *table = createPaddingTable(evas, parent, 280, 260);

    Evas_Object *glist = elm_genlist_add(table);
    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);

    string title_label = _("Scenario parameters<br><small><light_blue>Modify, add or delete a schedule.</light_blue></small>");
    GenlistItemBase *header = new GenlistItemSimpleHeader(evas, glist, title_label);
    header->Append(glist);

    GenlistItemSimple *_item;

    _item = new GenlistItemSimple(evas, glist, _("Modify the scenario"), true);
    _item->setIcon("calaos/icons/genlist/edit");
    _item->Append(glist, header);
    _item->item_selected.connect(sigc::mem_fun(*this, &GenlistItemScenarioSchedule::scenarioModify));

    _item = new GenlistItemSimple(evas, glist, _("Delete the scenario"), true);
    _item->setIcon("calaos/icons/genlist/trash");
    _item->Append(glist, header);
    _item->item_selected.connect(sigc::mem_fun(*this, &GenlistItemScenarioSchedule::scenarioDelete));

    _item = new GenlistItemSimple(evas, glist, _("Run the scenario now"), true);
    _item->setIcon("calaos/icons/genlist/play");
    _item->Append(glist, header);
    _item->item_selected.connect(sigc::mem_fun(*this, &GenlistItemScenarioSchedule::scenarioPlay));

    if (scenario->scenario_data.params["schedule"] == "false")
    {
        _item = new GenlistItemSimple(evas, glist, _("Add a schedule"), true);
        _item->setIcon("calaos/icons/genlist/plus");
        _item->Append(glist, header);
        _item->item_selected.connect(sigc::mem_fun(*this, &GenlistItemScenarioSchedule::scheduleAdd));
    }
    else
    {
        _item = new GenlistItemSimple(evas, glist, _("Schedule modification"), true);
        _item->setIcon("calaos/icons/genlist/clock");
        _item->Append(glist, header);
        _item->item_selected.connect(sigc::mem_fun(*this, &GenlistItemScenarioSchedule::scheduleModify));

        _item = new GenlistItemSimple(evas, glist, _("Delete schedule"), true);
        _item->setIcon("calaos/icons/genlist/trash");
        _item->Append(glist, header);
        _item->item_selected.connect(sigc::mem_fun(*this, &GenlistItemScenarioSchedule::scheduleDelete));
    }

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

    pager_popup = elm_naviframe_add(parent);
    evas_object_show(pager_popup);

    popup = elm_ctxpopup_add(parent);
    elm_object_content_set(popup, pager_popup);
    elm_object_style_set(popup, "calaos");
    elm_ctxpopup_direction_priority_set(popup,
                                        ELM_CTXPOPUP_DIRECTION_DOWN,
                                        ELM_CTXPOPUP_DIRECTION_UP,
                                        ELM_CTXPOPUP_DIRECTION_LEFT,
                                        ELM_CTXPOPUP_DIRECTION_RIGHT);

    Evas_Coord x,y;
    evas_pointer_canvas_xy_get(evas, &x, &y);
    evas_object_move(popup, x, y);
    evas_object_show(popup);

    elm_naviframe_item_push(pager_popup, NULL, NULL, NULL, table, "calaos");
}
示例#11
0
static void
_create_view_layout(Evas_Object *parent, char *layout_file, char *index_style, char it_style[][20], Eina_Bool even_num)
{
	Evas_Object *layout, *scroller, *box, *left_right_rect, *img, *page_layout, *index;
	Elm_Object_Item *nf_it;
	char img_path[PATH_MAX];
	int i, max_items;

	page_data *pd = (page_data *)calloc(1, sizeof(page_data));

	/* Create Layout */
	layout = elm_layout_add(parent);
	elm_layout_file_set(layout, ELM_DEMO_EDJ, layout_file);
	evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	evas_object_show(layout);
	evas_object_event_callback_add(layout, EVAS_CALLBACK_DEL, _layout_del_cb, pd);
	pd->main_layout = layout;

	/* Create Scroller */
	scroller = elm_scroller_add(layout);
	elm_scroller_loop_set(scroller, EINA_FALSE, EINA_FALSE);
	evas_object_size_hint_weight_set(scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	evas_object_size_hint_align_set(scroller, EVAS_HINT_FILL, EVAS_HINT_FILL);
	elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
	elm_scroller_page_scroll_limit_set(scroller, 1, 0);
	elm_object_scroll_lock_y_set(scroller, EINA_TRUE);
	elm_object_part_content_set(layout, "scroller", scroller);
	evas_object_show(scroller);
	evas_object_smart_callback_add(scroller, "scroll", _scroll, pd);
	pd->scroller = scroller;

	/* Create Box */
	box = elm_box_add(scroller);
	elm_box_horizontal_set(box, EINA_TRUE);
	elm_object_content_set(scroller, box);
	evas_object_show(box);
	pd->box = box;

	/* Create Rect object for page_layout center align in Box */
	left_right_rect = evas_object_rectangle_add(evas_object_evas_get(box));
	elm_box_pack_end(box, left_right_rect);

	/* Create Pages */
	if (even_num)
		max_items = NUM_INDEX_CIRCLE_EVEN;
	else
		max_items = NUM_ITEMS;
	for (i = 0; i < max_items; ++i)
	{
		page_layout = elm_layout_add(box);
		pd->page_layout[i] = page_layout;
		evas_object_size_hint_weight_set(page_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
		evas_object_size_hint_align_set(page_layout, 0, EVAS_HINT_FILL);
		elm_layout_theme_set(page_layout, "layout", "body_thumbnail", "default");
		evas_object_show(page_layout);

		img = elm_image_add(page_layout);
		snprintf(img_path, sizeof(img_path), "%s/100_%d.jpg", ICON_DIR, (i % 6) + 1);
		elm_image_file_set(img, img_path, NULL);
		elm_object_part_content_set(page_layout, "elm.icon", img);

		/* Make unselect state all of the pages except first one */
		if (i)
			elm_object_signal_emit(page_layout, "elm,state,thumbnail,unselect", "elm");

		elm_box_pack_end(box, page_layout);
	}

	/*Add resize callback for get a actual size of layout and main layout */
	evas_object_event_callback_add(pd->page_layout[0], EVAS_CALLBACK_RESIZE, _layout_resize_cb, pd);

	elm_box_pack_end(box, left_right_rect);
	pd->left_right_rect = left_right_rect;

	/* Add animator for page transfer effect */
	ecore_animator_add(animator_cb, pd);

	/* Create Index */
	index = elm_index_add(layout);
	elm_object_style_set(index, index_style);
	evas_object_size_hint_weight_set(index, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	evas_object_size_hint_align_set(index, EVAS_HINT_FILL, EVAS_HINT_FILL);
	elm_index_horizontal_set(index, EINA_TRUE);
	elm_index_autohide_disabled_set(index, EINA_TRUE);
	elm_object_part_content_set(layout, "controller", index);

	for (i = 0; i < max_items; ++i)
	{
		pd->it[i] = elm_index_item_append(index, NULL, NULL, (void *) i);
		if (it_style)
			elm_object_item_style_set(pd->it[i], it_style[i]);
	}

	pd->min_page = 0;
	pd->max_page = max_items - 1;
	elm_index_level_go(index, 0);
	elm_index_item_selected_set(pd->it[0], EINA_TRUE);

	pd->cur_page = 0;
	pd->index = index;
	pd->last_it = pd->it[0];

	evas_object_event_callback_add(index, EVAS_CALLBACK_MOUSE_DOWN, _on_index_mouse_down_cb, pd);
	evas_object_event_callback_add(index, EVAS_CALLBACK_MOUSE_MOVE, _on_index_mouse_move_cb, pd);
	evas_object_event_callback_add(index, EVAS_CALLBACK_MOUSE_UP, _on_index_mouse_up_cb, pd);

	nf_it = elm_naviframe_item_push(parent, NULL, NULL, NULL, layout, NULL);
	elm_naviframe_item_title_enabled_set(nf_it, EINA_FALSE, EINA_FALSE);
}
pswd_popup_t *common_pswd_popup_create(Evas_Object *win_main, const char *pkg_name, pswd_popup_create_req_data_t *popup_info)
{
	__COMMON_FUNC_ENTER__;

	if (!win_main || !popup_info || !pkg_name)
		return NULL;

	/* Lets disable the scan updates so that the UI is not refreshed un necessarily */
	wlan_manager_disable_scan_result_update();

	pswd_popup_t *pswd_popup_data = (pswd_popup_t *)g_malloc0(sizeof(pswd_popup_t));
	popup_btn_info_t	popup_btn_data;
	common_utils_entry_info_t entry_info;
	Evas_Object *conformant = NULL;

	conformant = elm_conformant_add(win_main);
	assertm_if(NULL == conformant, "conformant is NULL!!");
	elm_win_conformant_set(win_main, EINA_TRUE);
	elm_win_resize_object_add(win_main, conformant);
	evas_object_size_hint_weight_set(conformant, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	evas_object_size_hint_align_set(conformant, EVAS_HINT_FILL, EVAS_HINT_FILL);
	evas_object_show(conformant);

	Evas_Object *content = elm_layout_add(conformant);
	elm_object_content_set(conformant, content);

	memset(&popup_btn_data, 0, sizeof(popup_btn_data));
	popup_btn_data.title_txt = popup_info->title;
	popup_btn_data.btn1_cb = popup_info->ok_cb;
	popup_btn_data.btn1_data = popup_info->cb_data;
	popup_btn_data.btn2_cb = popup_info->cancel_cb;
	popup_btn_data.btn2_data = popup_info->cb_data;
	popup_btn_data.btn1_txt = sc(pkg_name, I18N_TYPE_Ok);
	popup_btn_data.btn2_txt = sc(pkg_name, I18N_TYPE_Cancel);
	Evas_Object *passpopup = common_utils_show_info_popup(content, &popup_btn_data);

	elm_object_content_set(content, passpopup);

	Evas_Object *box = elm_box_add(passpopup);
	evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
	evas_object_show(box);

	common_utils_set_entry_info(&entry_info, sc(pkg_name, I18N_TYPE_Enter_password), "", sc(pkg_name, I18N_TYPE_Enter_password), ELM_INPUT_PANEL_LAYOUT_URL);
	Evas_Object *ly_editfield = common_utils_add_edit_box(box, &entry_info);
	common_utils_entry_password_set(ly_editfield, TRUE);
	evas_object_show(ly_editfield);

	elm_box_pack_end(box, ly_editfield);

	Evas_Object *check = elm_check_add(box);
	elm_object_text_set(check, sc(pkg_name, I18N_TYPE_Show_password));
	elm_object_focus_allow_set(check, EINA_FALSE);
	evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL);
	evas_object_smart_callback_add(check, "changed", _check_changed_cb, ly_editfield);
	evas_object_show(check);
	elm_box_pack_end(box, check);

	if (popup_info->show_wps_btn) {
		Evas_Object *btn = elm_button_add(box);
		elm_object_text_set(btn, sc(pkg_name, I18N_TYPE_WPS_Button_Connection));
		evas_object_size_hint_weight_set(btn,
				EVAS_HINT_EXPAND,
				EVAS_HINT_EXPAND);
		evas_object_size_hint_align_set(btn,
				EVAS_HINT_FILL,
				EVAS_HINT_FILL);
		evas_object_smart_callback_add(btn, "clicked", popup_info->wps_btn_cb, popup_info->cb_data);
		elm_box_pack_end(box, btn);
		evas_object_show(btn);
	}
	elm_object_content_set(passpopup, box);
	evas_object_show(passpopup);
	pswd_popup_data->win = win_main;
	pswd_popup_data->str_pkg_name = pkg_name;
	pswd_popup_data->popup_conformant = conformant;
	pswd_popup_data->popup_entry_lyt = ly_editfield;
	Evas_Object *popup_entry = common_utils_entry_layout_get_entry(ly_editfield);
	elm_object_focus_set(popup_entry, EINA_TRUE);
	__COMMON_FUNC_EXIT__;

	return pswd_popup_data;
}
void common_pswd_popup_pbc_popup_create(pswd_popup_t *pswd_popup_data, Evas_Smart_Cb cancel_cb, void *cancel_cb_data)
{
	if (!pswd_popup_data) {
		return;
	}
	Evas_Object *popup = NULL,*progressbar = NULL;
	Evas_Object *label = NULL, *timer_label = NULL;

	pbc_popup_t *pbc_popup_data = NULL;
	pbc_popup_data = g_malloc0(sizeof(pbc_popup_t));

	popup_btn_info_t popup_btn_data;
	memset(&popup_btn_data, 0, sizeof(popup_btn_data));
	popup_btn_data.btn1_txt = sc(pswd_popup_data->str_pkg_name, I18N_TYPE_Cancel);
	popup_btn_data.btn1_cb = cancel_cb;
	popup_btn_data.btn1_data = cancel_cb_data;
	popup = common_utils_show_info_popup(pswd_popup_data->win, &popup_btn_data);

	label = elm_label_add(popup);
	elm_object_style_set(label, "popup/default");
	elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
	elm_object_text_set(label, sc(pswd_popup_data->str_pkg_name,I18N_TYPE_Press_WPS_On_Your_Wi_Fi_Access_Point));
	evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0);
	evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
	evas_object_show(label);

	progressbar = elm_progressbar_add(popup);
	elm_object_style_set(progressbar, "list_progress");
	elm_progressbar_horizontal_set(progressbar, EINA_TRUE);
	evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, EVAS_HINT_FILL);
	evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	elm_progressbar_value_set(progressbar, 0.0);

	timer_label = elm_label_add(popup);
	elm_object_style_set(timer_label, "label3");
	elm_label_line_wrap_set(timer_label, ELM_WRAP_MIXED);
	elm_object_text_set(timer_label, _("<font_size=40><align=center>02:00</align></font_size>"));
	evas_object_size_hint_weight_set(timer_label, EVAS_HINT_EXPAND, 0.0);
	evas_object_size_hint_align_set(timer_label, EVAS_HINT_FILL, EVAS_HINT_FILL);
	evas_object_show(timer_label);

	pbc_popup_data->checker = 0;
	pbc_popup_data->value = 0.0;
	pbc_popup_data->progressbar = progressbar;
	pbc_popup_data->timer_label = timer_label;
	pbc_popup_data->popup = popup;
	pbc_popup_data->timer = ecore_timer_add(1.0, _fn_pb_timer_bar, pswd_popup_data);
	evas_object_show(progressbar);

	Evas_Object *box = elm_box_add(popup);
	evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
	evas_object_show(box);
	elm_box_pack_end(box, label);
	elm_box_pack_end(box, progressbar);
	elm_box_pack_end(box, timer_label);

	evas_object_show(box);
	elm_object_content_set(popup, box);
	pswd_popup_data->pbc_popup_data = pbc_popup_data;

	/* Delete the password popup */
	evas_object_hide(pswd_popup_data->popup_conformant);
	evas_object_del(pswd_popup_data->popup_conformant);

	return;
}
示例#14
0
文件: Frame.cpp 项目: Limsik/e17
void Frame::setContent (const Evasxx::Object &content)
{
  elm_object_content_set (o, content.obj ());
}
/* 버튼 등의 기본 화면을 나타낼 것이다! */
static void
create_main_view(appdata_s *ad)
{
	Evas_Object *box;
	Evas_Object *button;
	Evas_Object *icon;
	Evas_Object *grid;
	Evas_Object *state_img;
	Evas_Object **entry_w_image;
	int i, j;
	char icon_path[PATH_MAX] = {0, };

	grid = elm_grid_add(ad->win);
	evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL);
	elm_object_content_set(ad->conform, grid);
	evas_object_show(grid);

	ad->img = (Evas_Object**)malloc(sizeof(Evas_Object*) * 12);

	app_get_resource("edje/images/button_0.png", icon_path, (int)PATH_MAX);
	ad->img[0] = elm_image_add(grid);
	elm_image_file_set(ad->img[0], icon_path, NULL);
	evas_object_show(ad->img[0]);
	elm_grid_pack(grid, ad->img[0], 42, 4, 16, 16);

	app_get_resource("edje/images/button_1.png", icon_path, (int)PATH_MAX);
	ad->img[1] = elm_image_add(grid);
	elm_image_file_set(ad->img[1], icon_path, NULL);
	evas_object_show(ad->img[1]);
	elm_grid_pack(grid, ad->img[1], 61, 10, 16, 16);

	app_get_resource("edje/images/button_2.png", icon_path, (int)PATH_MAX);
	ad->img[2] = elm_image_add(grid);
	elm_image_file_set(ad->img[2], icon_path, NULL);
	evas_object_show(ad->img[2]);
	elm_grid_pack(grid, ad->img[2], 75, 24, 16, 16);

	app_get_resource("edje/images/button_3.png", icon_path, (int)PATH_MAX);
	ad->img[3] = elm_image_add(grid);
	elm_image_file_set(ad->img[3], icon_path, NULL);
	evas_object_show(ad->img[3]);
	elm_grid_pack(grid, ad->img[3], 81, 43, 16, 16);

	app_get_resource("edje/images/button_4.png", icon_path, (int)PATH_MAX);
	ad->img[4] = elm_image_add(grid);
	elm_image_file_set(ad->img[4], icon_path, NULL);
	evas_object_show(ad->img[4]);
	elm_grid_pack(grid, ad->img[4], 74, 61, 16, 16);

	app_get_resource("edje/images/button_5.png", icon_path, (int)PATH_MAX);
	ad->img[5] = elm_image_add(grid);
	elm_image_file_set(ad->img[5], icon_path, NULL);
	evas_object_show(ad->img[5]);
	elm_grid_pack(grid, ad->img[5], 61, 75, 16, 16);

	app_get_resource("edje/images/button_6.png", icon_path, (int)PATH_MAX);
	ad->img[6] = elm_image_add(grid);
	elm_image_file_set(ad->img[6], icon_path, NULL);
	evas_object_show(ad->img[6]);
	elm_grid_pack(grid, ad->img[6], 42, 81, 16, 16);

	app_get_resource("edje/images/button_7.png", icon_path, (int)PATH_MAX);
	ad->img[7] = elm_image_add(grid);
	elm_image_file_set(ad->img[7], icon_path, NULL);
	evas_object_show(ad->img[7]);
	elm_grid_pack(grid, ad->img[7], 23, 75, 16, 16);

	app_get_resource("edje/images/button_8.png", icon_path, (int)PATH_MAX);
	ad->img[8] = elm_image_add(grid);
	elm_image_file_set(ad->img[8], icon_path, NULL);
	evas_object_show(ad->img[8]);
	elm_grid_pack(grid, ad->img[8], 10, 61, 16, 16);

	app_get_resource("edje/images/button_9.png", icon_path, (int)PATH_MAX);
	ad->img[9] = elm_image_add(grid);
	elm_image_file_set(ad->img[9], icon_path, NULL);
	evas_object_show(ad->img[9]);
	elm_grid_pack(grid, ad->img[9], 4, 43, 16, 16);

	app_get_resource("edje/images/button_plus.png", icon_path, (int)PATH_MAX);
	ad->img[INOUT_BTN] = elm_image_add(grid);
	elm_image_file_set(ad->img[INOUT_BTN], icon_path, NULL);
	evas_object_show(ad->img[INOUT_BTN]);
	elm_grid_pack(grid, ad->img[INOUT_BTN], 10, 24, 16, 16);

	app_get_resource("edje/images/button_del.png", icon_path, (int)PATH_MAX);
	ad->img[DEL_BTN] = elm_image_add(grid);
	elm_image_file_set(ad->img[DEL_BTN], icon_path, NULL);
	evas_object_show(ad->img[DEL_BTN]);
	elm_grid_pack(grid, ad->img[DEL_BTN], 23, 10, 16, 16);

	app_get_resource("edje/images/state_minus.png", icon_path, (int)PATH_MAX);
	state_img = elm_image_add(grid);
	elm_image_file_set(state_img, icon_path, NULL);
	evas_object_show(state_img);
	elm_grid_pack(grid, state_img, 42, 25, 16, 16);

	ad->entry = elm_entry_add(grid);
	elm_entry_editable_set(ad->entry, EINA_FALSE);
	elm_entry_single_line_set(ad->entry, EINA_TRUE);
	elm_entry_text_style_user_push(ad->entry, "DEFAULT='font_size=40 color=#ffffff align=center'");
	elm_entry_entry_set(ad->entry, "");
	evas_object_show(ad->entry);
	elm_grid_pack(grid, ad->entry, 25, 30, 50, 40);

	entry_w_image = (Evas_Object**)malloc(sizeof(Evas_Object*) * 2);

	entry_w_image[0] = ad->entry;
	entry_w_image[1] = state_img;

	evas_object_smart_callback_add(ad->img[0], "clicked", img_clicked_0_cb, ad->entry);
	evas_object_smart_callback_add(ad->img[1], "clicked", img_clicked_1_cb, ad->entry);
	evas_object_smart_callback_add(ad->img[2], "clicked", img_clicked_2_cb, ad->entry);
	evas_object_smart_callback_add(ad->img[3], "clicked", img_clicked_3_cb, ad->entry);
	evas_object_smart_callback_add(ad->img[4], "clicked", img_clicked_4_cb, ad->entry);
	evas_object_smart_callback_add(ad->img[5], "clicked", img_clicked_5_cb, ad->entry);
	evas_object_smart_callback_add(ad->img[6], "clicked", img_clicked_6_cb, ad->entry);
	evas_object_smart_callback_add(ad->img[7], "clicked", img_clicked_7_cb, ad->entry);
	evas_object_smart_callback_add(ad->img[8], "clicked", img_clicked_8_cb, ad->entry);
	evas_object_smart_callback_add(ad->img[9], "clicked", img_clicked_9_cb, ad->entry);
	evas_object_smart_callback_add(ad->img[INOUT_BTN], "clicked", img_clicked_inout_cb, entry_w_image);
	evas_object_smart_callback_add(ad->img[DEL_BTN], "clicked", img_clicked_del_cb, ad->entry);
	evas_object_smart_callback_add(ad->entry, "clicked", confirm_clicked_cb, NULL);
}
示例#16
0
EAPI_MAIN int
elm_main(int argc, char **argv)
{
   Evas_Object *win;
   Evas_Object *f1, *r1, *f2, *r2, *f3, *r3, *f4, *r4;

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   win = elm_win_util_standard_add("frame", "Frame");
   elm_win_autodel_set(win, EINA_TRUE);

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

   f1= elm_frame_add(win);
   elm_object_content_set(f1, r1);
   elm_object_text_set(f1, "Default frame");
   evas_object_resize(f1, 100, 100);
   evas_object_move(f1, 25, 25);
   evas_object_show(f1);

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

   f2 = elm_frame_add(win);
   elm_object_content_set(f2, r2);
   elm_object_text_set(f2, "Padding frame");
   evas_object_resize(f2, 100, 100);
   evas_object_move(f2, 150, 25);
   elm_object_style_set(f2, "pad_small");
   evas_object_show(f2);

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

   f3 = elm_frame_add(win);
   elm_object_content_set(f3, r3);
   elm_object_text_set(f3, "Top outdent frame");
   evas_object_resize(f3, 100, 100);
   evas_object_move(f3, 25, 150);
   elm_object_style_set(f3, "outdent_top");
   evas_object_show(f3);

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

   f4 = elm_frame_add(win);
   elm_object_content_set(f4, r4);
   elm_object_text_set(f4, "Bottom outdent frame");
   evas_object_resize(f4, 100, 100);
   evas_object_move(f4, 150, 150);
   elm_object_style_set(f4, "outdent_bottom");
   evas_object_show(f4);

   evas_object_resize(win, 275, 275);
   evas_object_show(win);

   elm_run();

   return 0;
}
示例#17
0
文件: gui.c 项目: shr-project/e-tasks
void create_cat_dialog(void *data, Evas_Object *obj, void *event_info)
{
	Evas_Object *bg, *inwin, *lb, *bt, *bt1, *entry, *vbox, *hbox, *hbox1;

	cat_dialog = elm_win_add(NULL, "inwin", ELM_WIN_DIALOG_BASIC);
	elm_win_title_set(cat_dialog, "Add Category");
	elm_win_autodel_set(cat_dialog, 1);

	bg = elm_bg_add(cat_dialog);
	elm_win_resize_object_add(cat_dialog, bg);
	evas_object_size_hint_weight_set(bg, 1.0, 1.0);
	evas_object_show(bg);

	inwin = elm_win_inwin_add(cat_dialog);
	elm_object_style_set(inwin, "minimal_vertical");

	//add vbox 
	vbox = elm_box_add(cat_dialog);
	elm_win_resize_object_add(cat_dialog, vbox);
	evas_object_size_hint_weight_set(vbox, 1.0, 1.0);
	elm_object_content_set(inwin, vbox);
	evas_object_show(vbox);

	//add hbox to vbox
	hbox = elm_box_add(cat_dialog);
	elm_box_horizontal_set(hbox, 1);
	evas_object_size_hint_weight_set(hbox, 1.0, 0.0);
	evas_object_size_hint_align_set(hbox, -1.0, 0.0);
	elm_box_pack_end(vbox, hbox);
	evas_object_show(hbox);

	//add a label to hbox
	lb = elm_label_add(cat_dialog);
	elm_object_text_set(lb,"Category:");
	elm_box_pack_end(hbox, lb);
	evas_object_show(lb);

	//add an entry to hbox
	entry = elm_entry_add(cat_dialog);
	//evas_object_size_hint_weight_set(entry, 1.0, 0.0);
	//evas_object_size_hint_align_set(entry, -1.0, 0.0);
	elm_entry_entry_set(entry, "New Cat");
	elm_entry_single_line_set(entry, 1);
	elm_entry_editable_set(entry, 1);
	elm_entry_line_wrap_set(entry, 0);
	elm_box_pack_end(hbox, entry);
	evas_object_show(entry);

	//add another hbox
	hbox1 = elm_box_add(cat_dialog);
	elm_box_horizontal_set(hbox1, 1);
	elm_box_homogeneous_set(hbox1, 1);
	elm_box_pack_end(vbox, hbox1);
	evas_object_show(hbox1);
	
	//add yes button
	bt = elm_button_add(cat_dialog);
	elm_object_text_set(bt, "Add");
	evas_object_size_hint_align_set(bt, -1.0, -1.0);
	elm_box_pack_end(hbox1, bt);
	evas_object_show(bt);
	evas_object_smart_callback_add(bt, "clicked", cat_dialog_add, entry);
	
	//add close button
	bt1 = elm_button_add(cat_dialog);
	elm_object_text_set(bt1, "Cancel");
	elm_box_pack_end(hbox1, bt1);
	evas_object_show(bt1);
	evas_object_smart_callback_add(bt1, "clicked", cat_win_del, cat_dialog);

	evas_object_show(inwin);
	
	evas_object_resize(cat_dialog, 480, 640);
	evas_object_show(cat_dialog);
}
EAPI_MAIN int
elm_main(int    argc,
         char **argv)
{
   int h;
   Evas_Object *win, *bg, *box, *frame, *check, *b, *slider;

   /* tell elm about our app so it can figure out where to get files */
   elm_app_compile_bin_dir_set(BIN_DIR);
   elm_app_compile_data_dir_set(DATA_DIR);
   elm_app_compile_lib_dir_set(LIB_DIR);
   elm_app_info_set(elm_main, "elementary", "images/logo.png");

   fprintf(stdout, "prefix was set to: %s\n", elm_app_prefix_dir_get());
   fprintf(stdout, "data directory is: %s\n", elm_app_data_dir_get());
   fprintf(stdout, "library directory is: %s\n", elm_app_lib_dir_get());
   fprintf(stdout, "locale directory is: %s\n", elm_app_locale_dir_get());

   win = elm_win_add(NULL, "top-level-funcs-example", ELM_WIN_BASIC);
   elm_win_title_set(win, "Elementary Top-level Functions Example");

   /* by using this policy value, we avoid having to
    * evas_object_smart_callback_add(win, "delete,request", _on_exit, NULL),
    * calling elm_exit() on that callback ourselves.
    */
   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
   elm_win_autodel_set(win, EINA_TRUE);

   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);
   evas_object_size_hint_min_set(bg, 160, 160);

   /* outer box */
   box = elm_box_add(win);
   evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
   elm_win_resize_object_add(win, box);
   evas_object_show(box);

   frame = elm_frame_add(win);
   elm_object_text_set(frame, "Button");
   evas_object_size_hint_align_set(frame, EVAS_HINT_FILL, EVAS_HINT_FILL);
   evas_object_show(frame);
   elm_box_pack_end(box, frame);

   d.btn = elm_button_add(win);
   elm_object_text_set(d.btn, "Click me");
   elm_object_content_set(frame, d.btn);

   fprintf(stdout, "Elementary's finger size is set to %d pixels\n.",
           elm_config_finger_size_get());
   elm_coords_finger_size_adjust(0, NULL, 3, &h);
   /* so, button will be 3 fingers tall */
   evas_object_size_hint_min_set(d.btn, 0, h);
   evas_object_show(d.btn);

   b = elm_box_add(win);
   elm_box_horizontal_set(b, EINA_FALSE);
   evas_object_size_hint_weight_set(b, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(b, EVAS_HINT_FILL, EVAS_HINT_FILL);
   elm_win_resize_object_add(win, b);
   elm_box_pack_end(box, b);
   evas_object_show(b);

   check = elm_check_add(win);
   evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(check, 0.0, 0.0);
   elm_object_text_set(check, "Button enabled");
   elm_check_state_pointer_set(check, &d.btn_enabled);
   evas_object_smart_callback_add(check, "changed", _btn_enabled_cb, NULL);
   elm_box_pack_end(box, check);
   evas_object_show(check);

   b = elm_button_add(win);
   evas_object_size_hint_weight_set(b, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(b, 0.0, 0.0);
   elm_object_text_set(b, "Focus top button");
   evas_object_smart_callback_add(b, "clicked", _btn_focus_cb, NULL);
   elm_box_pack_end(box, b);
   evas_object_show(b);

   b = elm_button_add(win);
   evas_object_size_hint_weight_set(b, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(b, 0.0, 0.0);
   elm_object_text_set(b, "Unfocus top button");
   evas_object_smart_callback_add(b, "clicked", _btn_unfocus_cb, NULL);
   elm_box_pack_end(box, b);
   evas_object_show(b);

   check = elm_check_add(win);
   evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(check, 0.0, 0.0);
   elm_object_text_set(check, "Button gets focus");
   elm_check_state_pointer_set(check, &d.btn_gets_focus);
   evas_object_smart_callback_add(check, "changed", _btn_focus_allow_cb, NULL);
   elm_box_pack_end(box, check);
   evas_object_show(check);

   slider = elm_slider_add(win);
   elm_slider_min_max_set(slider, 0, 4);
   elm_slider_unit_format_set(slider, "%1.1f");
   elm_slider_indicator_format_set(slider, "%1.1f");
   evas_object_size_hint_weight_set(
     slider, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(slider, EVAS_HINT_FILL, EVAS_HINT_FILL);
   evas_object_smart_callback_add(slider, "changed", _btn_scale_cb, NULL);
   elm_box_pack_end(box, slider);
   evas_object_show(slider);

   evas_object_resize(win, WIDTH, HEIGHT);
   elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
   evas_object_show(win);

   elm_run(); /* and run the program now, starting to handle all
               * events, etc. */
   elm_shutdown(); /* clean up and shut down */

   /* exit code */
   return 0;
}
示例#19
0
文件: gui.c 项目: shr-project/e-tasks
void edit_cat(void) 
{
	Evas_Object *bg, *cat_win, *vbox, *hbox, *add_cat_button, *del_cat_button, *done_button, *fr, *lb, *hbox1;

	cat_win = elm_win_add(NULL, "cat", ELM_WIN_BASIC);
	elm_win_title_set(cat_win, "Edit Categories");
	evas_object_smart_callback_add(cat_win, "delete,request", cat_win_del, cat_win);
	
	//add background
	bg = elm_bg_add(cat_win);
	elm_win_resize_object_add(cat_win, bg);
	evas_object_size_hint_weight_set(bg, 1.0, 1.0);
	evas_object_show(bg);

	//add vbox 
	vbox = elm_box_add(cat_win);
	elm_win_resize_object_add(cat_win, vbox);
	evas_object_size_hint_weight_set(vbox, 1.0, 1.0);
	evas_object_show(vbox);

	//add a hbox
	hbox1 = elm_box_add(cat_win);
	elm_box_horizontal_set(hbox1, 1);
	evas_object_size_hint_weight_set(hbox1, 1.0, 0.0);
	evas_object_size_hint_align_set(hbox1, -1.0, 0.0);
	elm_box_pack_end(vbox, hbox1);
	evas_object_show(hbox1);
	
	// add a frame
	fr = elm_frame_add(cat_win);
	elm_object_style_set(fr, "outdent_top");
	evas_object_size_hint_weight_set(fr, 0.0, 0.0);
	evas_object_size_hint_align_set(fr, 0.0, -1.0);
	elm_box_pack_end(hbox1, fr);
	evas_object_show(fr);

	// add a label
	lb = elm_label_add(cat_win);
	elm_object_text_set(lb, "Task Categories");
	elm_object_content_set(fr, lb);
	evas_object_show(lb);  
	
	//add list to vbox now
	cat_list = elm_genlist_add(cat_win);
	evas_object_size_hint_weight_set(cat_list, 1.0, 1.0);
	evas_object_size_hint_align_set(cat_list, -1.0, -1.0);
	elm_list_multi_select_set(cat_list, 0);
	elm_box_pack_end(vbox, cat_list);
	evas_object_show(cat_list);
	evas_object_smart_callback_add(cat_list, "clicked", cat_list_selected, cat_list);

	//genlist class defs
	itc2.item_style     		= "default";
	itc2.func.text_get 	= cat_text_get;
	itc2.func.content_get  	= cat_content_get;
	itc2.func.state_get 	= cat_state_get;
	itc2.func.del      		= cat_del;
	
	//add hbox to vbox
	hbox = elm_box_add(cat_win);
	elm_box_horizontal_set(hbox, 1);
	evas_object_size_hint_weight_set(hbox, 1.0, 0.0);
	evas_object_size_hint_align_set(hbox, -1.0, 0.0);
	elm_box_pack_end(vbox, hbox);
	evas_object_show(hbox);
	
	//add button to add categories
	add_cat_button = elm_button_add(cat_win);
	elm_object_text_set(add_cat_button, "Add");
	evas_object_size_hint_weight_set(add_cat_button, 1.0, 1.0);
	evas_object_size_hint_align_set(add_cat_button, -1.0, -1.0);
	elm_box_pack_end(hbox, add_cat_button);
	evas_object_show(add_cat_button);
	evas_object_smart_callback_add(add_cat_button, "clicked", create_cat_dialog, cat_list);
	
	//add button to del categories
	del_cat_button = elm_button_add(cat_win);
	elm_object_text_set(del_cat_button, "Delete");
	evas_object_size_hint_weight_set(del_cat_button, 1.0, 1.0);
	evas_object_size_hint_align_set(del_cat_button, -1.0, -1.0);
	elm_box_pack_end(hbox, del_cat_button);
	evas_object_show(del_cat_button);
	evas_object_smart_callback_add(del_cat_button, "clicked", del_cat_button_clicked, cat_list);

	//add done button
	done_button = elm_button_add(cat_win);
	elm_object_text_set(done_button, "Done");
	evas_object_size_hint_weight_set(done_button, 1.0, 1.0);
	evas_object_size_hint_align_set(done_button, -1.0, -1.0);
	elm_box_pack_end(hbox, done_button);
	evas_object_show(done_button);
	evas_object_smart_callback_add(done_button, "clicked", cat_win_del, cat_win);

	populate_cat_list(cat_list);
	// make window full screen
	evas_object_resize(cat_win, 480, 640);
	evas_object_show(cat_win);
}
Evas_Object *IOWOVoletSmartHomeView::getPartItem(Evas_Object *obj, string part)
{
    Evas_Object *o = NULL;

    if (!io) return o;

    if (part == "calaos.button.up")
    {
        o = elm_button_add(parent);
        Evas_Object *icon = elm_icon_add(o);
        elm_image_file_set(icon, ApplicationMain::getTheme(), "calaos/icons/action_button/up_arrow");
        elm_object_style_set(o, "calaos/action_button/yellow");
        elm_object_content_set(o, icon);
        evas_object_smart_callback_add(o, "clicked", _item_button_Up, this);
    }
    else if (part == "calaos.button.down")
    {
        o = elm_button_add(parent);
        Evas_Object *icon = elm_icon_add(o);
        elm_image_file_set(icon, ApplicationMain::getTheme(), "calaos/icons/action_button/down_arrow");
        elm_object_style_set(o, "calaos/action_button/default");
        elm_object_content_set(o, icon);
        evas_object_smart_callback_add(o, "clicked", _item_button_Down, this);
    }
    else if (part == "calaos.button.stop")
    {
        o = elm_button_add(parent);
        Evas_Object *icon = elm_icon_add(o);
        elm_image_file_set(icon, ApplicationMain::getTheme(), "calaos/icons/action_button/stop");
        elm_object_style_set(o, "calaos/action_button/default");
        elm_object_content_set(o, icon);
        evas_object_smart_callback_add(o, "clicked", _item_button_Stop, this);
    }
    else if (part == "calaos.button.impulse_up")
    {
        o = elm_button_add(parent);
        Evas_Object *icon = elm_icon_add(o);
        elm_image_file_set(icon, ApplicationMain::getTheme(), "calaos/icons/action_button/impulse_up");
        elm_object_style_set(o, "calaos/action_button/default");
        elm_object_content_set(o, icon);
        evas_object_smart_callback_add(o, "clicked", _item_button_ImpulseUp, this);
    }
    else if (part == "calaos.button.impulse_down")
    {
        o = elm_button_add(parent);
        Evas_Object *icon = elm_icon_add(o);
        elm_image_file_set(icon, ApplicationMain::getTheme(), "calaos/icons/action_button/impulse_down");
        elm_object_style_set(o, "calaos/action_button/default");
        elm_object_content_set(o, icon);
        evas_object_smart_callback_add(o, "clicked", _item_button_ImpulseDown, this);
    }
    else if (part == "calaos.button.25")
    {
        o = elm_button_add(parent);
        elm_object_style_set(o, "calaos/action_button/label");
        elm_object_text_set(o, "25%");
        evas_object_smart_callback_add(o, "clicked", _item_button_Set25, this);
    }
    else if (part == "calaos.button.50")
    {
        o = elm_button_add(parent);
        elm_object_style_set(o, "calaos/action_button/label");
        elm_object_text_set(o, "50%");
        evas_object_smart_callback_add(o, "clicked", _item_button_Set50, this);
    }
    else if (part == "calaos.button.75")
    {
        o = elm_button_add(parent);
        elm_object_style_set(o, "calaos/action_button/label");
        elm_object_text_set(o, "75%");
        evas_object_smart_callback_add(o, "clicked", _item_button_Set75, this);
    }
    else if (part == "calaos.window.slider")
    {
        window_slider = new EdjeObject(ApplicationMain::getTheme(), evas);
        window_slider->setAutoDelete(true);
        window_slider->object_deleted.connect(sigc::mem_fun(*this, &IOWOVoletSmartHomeView::sliderObjectDeleted));
        window_slider->LoadEdje("calaos/shutter/slider");
        window_slider->Show();

        o = window_slider->getEvasObject();
    }

    initView();

    return o;
}
示例#21
0
文件: gui.c 项目: shr-project/e-tasks
void create_details_page(void *data, Evas_Object *obj, void *event_info)
{
	Evas_Object *bg, *tb, *lb, *bt;
	Evas_Object *det_hv, *bx, *c_date_hs, *c_date_bt, *fr1, *fr, *bt_done;
	int i;
	char no[2], dt[10];
	static Details det[15];
	time_t curtime, tm;
	struct tm *loctime;

	//get the time
	curtime = time (NULL);
	
	//check task selected - otherwise return
	Elm_Object_Item *item = (Elm_Object_Item *)elm_genlist_selected_item_get(list);
	if(!item) return;
	_Task *tsk = (_Task *)elm_object_item_data_get(item);
	det_page = elm_win_add(NULL, "inwin", ELM_WIN_BASIC);
	elm_win_title_set(det_page, "Task Details");
	elm_win_autodel_set(det_page, 1);

	bg = elm_bg_add(det_page);
	elm_win_resize_object_add(det_page, bg);
	evas_object_size_hint_weight_set(bg, 1.0, 1.0);
	evas_object_show(bg);
	
	tb = elm_table_add(det_page);
	elm_win_resize_object_add(det_page, tb);
	evas_object_size_hint_weight_set(tb, 1.0, 1.0);
	evas_object_size_hint_align_set(tb, -1.0, -1.0);
	evas_object_show(tb);
	
	//add a frame 
	fr = elm_frame_add(det_page);
	elm_object_style_set(fr, "outdent_top");
	evas_object_size_hint_align_set(fr, 0.5, -1.0);
 	elm_table_pack(tb, fr, 0, 0, 3, 1);
	evas_object_show(fr);

	//add a label to frame
	lb = elm_label_add(det_page);
	elm_object_text_set(lb,"Edit Task Details");
	evas_object_size_hint_align_set(lb, 0.5, -1.0);
	elm_object_content_set(fr, lb);
	evas_object_show(lb);

	//add a label 
	lb = elm_label_add(det_page);
	elm_object_text_set(lb,"Task:");
	evas_object_size_hint_align_set(lb, 1.0, 0.5);
 	elm_table_pack(tb, lb, 0, 1, 1, 1);
	evas_object_show(lb);

	//add an entry 
	entry = elm_entry_add(det_page);
	elm_entry_single_line_set(entry, 1);
	elm_entry_editable_set(entry, 1);
	elm_entry_entry_set(entry, tsk->text);
	elm_entry_line_wrap_set(entry, 0);
 	elm_table_pack(tb, entry, 1, 1, 2, 1);
	evas_object_show(entry);

	//add a label to hbox
	lb = elm_label_add(det_page);
	elm_object_text_set(lb,"Priority:");
	evas_object_size_hint_align_set(lb, 1.0, 0.5);
 	elm_table_pack(tb, lb, 0, 2, 1, 1);
	evas_object_show(lb);

	//add hover for priority
	det_hv = elm_hover_add(det_page);
	//add box for hover
	bx = elm_box_add(det_page);
 	elm_table_pack(tb, bx, 1, 2, 2, 1);
	evas_object_show(bx);

	c_pr_bt = elm_button_add(det_page);
	sprintf(no, "%d", tsk->pr);
	elm_object_text_set(c_pr_bt, no);
	evas_object_smart_callback_add(c_pr_bt, "clicked", my_hover_bt_1, det_hv);
	elm_box_pack_end(bx, c_pr_bt);
	evas_object_show(c_pr_bt);
	elm_hover_parent_set(det_hv, det_page);
	elm_hover_target_set(det_hv, c_pr_bt);

	bt = elm_button_add(det_page);
	elm_object_text_set(bt, "Pr");
	elm_object_part_content_set(det_hv, "middle", bt);
	evas_object_show(bt);

	bx = elm_box_add(det_page);
	//add 5 buttons
	for (i=1; i<6; i++) {
		det[i].item = item;
		det[i].hover = det_hv;
		det[i].button = c_pr_bt;
		bt = elm_button_add(det_page);
		sprintf(no, "%d", i);
		elm_object_text_set(bt, no);
		elm_box_pack_end(bx, bt);
		det[i].data = strdup(no);
		evas_object_smart_callback_add(bt, "clicked", set_create_priority, &det[i]);
		evas_object_show(bt);
	}	
	evas_object_show(bx);
	elm_object_part_content_set(det_hv, "bottom", bx);

	//add a label to hbox
	lb = elm_label_add(det_page);
	elm_object_text_set(lb,"Category:");
	evas_object_size_hint_align_set(lb, 1.0, 0.5);
 	elm_table_pack(tb, lb, 0, 3, 1, 1);
	evas_object_show(lb);

	hs = elm_hover_add(det_page);
	//add box for hover
	bx = elm_box_add(det_page);
 	elm_table_pack(tb, bx, 1, 3, 2, 1);
	evas_object_show(bx);

	cat_bt = elm_button_add(det_page);
	elm_object_text_set(cat_bt, tsk->cat);
	evas_object_smart_callback_add(cat_bt, "clicked", my_hover_bt_1, hs);
	elm_box_pack_end(bx, cat_bt);
	evas_object_show(cat_bt);
	elm_hover_parent_set(hs, det_page);
	elm_hover_target_set(hs, cat_bt);

	bt = elm_button_add(det_page);
	elm_object_text_set(bt, "Category");
	elm_object_part_content_set(hs, "middle", bt);
	evas_object_show(bt);

	bx = elm_box_add(det_page);
	//add categories
	add_hs_items (det_page, bx, bt, 0);
	evas_object_show(bx);
	elm_object_part_content_set(hs, "bottom", bx); 

	//add a label to hbox
	lb = elm_label_add(det_page);
	elm_object_text_set(lb, "Date:");
	evas_object_size_hint_align_set(lb, 1.0, 0.5);
 	elm_table_pack(tb, lb, 0, 4, 1, 1);
	evas_object_show(lb);

	//add hover for date
	c_date_hs = elm_hover_add(det_page);
	//add box for hover
	bx = elm_box_add(det_page);
 	elm_table_pack(tb, bx, 1, 4, 2, 1);
	evas_object_show(bx);

	c_date_bt = elm_button_add(det_page);
	elm_object_text_set(c_date_bt, tsk->date);
	evas_object_smart_callback_add(c_date_bt, "clicked", my_hover_bt_1, c_date_hs);
	elm_box_pack_end(bx, c_date_bt);
	evas_object_show(c_date_bt);
	elm_hover_parent_set(c_date_hs, det_page);
	elm_hover_target_set(c_date_hs, c_date_bt);

	bt = elm_button_add(det_page);
	elm_object_text_set(bt, "Date");
	elm_object_part_content_set(c_date_hs, "middle", bt);
	evas_object_show(bt);

	bx = elm_box_add(det_page);
	
	//add dates
	det[6].item = item;
	det[6].hover = c_date_hs;
	det[6].button = c_date_bt;
	sprintf(dt, "No Date");
	bt = elm_button_add(det_page);
	elm_object_text_set(bt,dt);
	elm_box_pack_end(bx, bt);
	det[6].data = strdup(dt);
	evas_object_smart_callback_add(bt, "clicked", set_create_date, &det[6]);
	evas_object_show(bt);

	for(i=0; i<7; i++) {
		det[7+i].item = item;
		det[7+i].hover = c_date_hs;
		det[7+i].button = c_date_bt;
		tm = curtime + (i * 86400);
		loctime = localtime (&tm);
		strftime(dt, 7, "%d-%m", loctime);
		bt = elm_button_add(det_page);
		elm_object_text_set(bt,dt);
		elm_box_pack_end(bx, bt);
		det[7+i].data = strdup(dt);
		evas_object_smart_callback_add(bt, "clicked", set_create_date, &det[7+i]);
		evas_object_show(bt);
	}

	det[14].item = item;
	det[14].hover = c_date_hs;
	det[14].button = c_date_bt;
	sprintf(dt, "Calendar");
	bt = elm_button_add(det_page);
	elm_object_text_set(bt,dt);
	elm_box_pack_end(bx, bt);
	det[14].data = strdup(dt);
	evas_object_smart_callback_add(bt, "clicked", set_create_date, &det[14]);
	evas_object_show(bt);
	
	evas_object_show(bx);
	elm_object_part_content_set(c_date_hs, "bottom", bx);

	//add a label 
	lb = elm_label_add(det_page);
	elm_object_text_set(lb,"Note:");
	evas_object_size_hint_align_set(lb, 1.0, 0.5);
 	elm_table_pack(tb, lb, 0, 5, 1, 1);
	evas_object_show(lb);

	//add an entry 
	note_entry = elm_entry_add(det_page);
	elm_entry_single_line_set(note_entry, 1);
	elm_entry_editable_set(note_entry, 1);
	if(strcmp(tsk->note, "") != 0) elm_entry_entry_set(note_entry, tsk->note);
	else {
		elm_entry_entry_set(note_entry, "Note"); 
		   elm_entry_select_all(note_entry);
	}
	elm_entry_line_wrap_set(note_entry, 0);
 	elm_table_pack(tb, note_entry, 1, 5, 2, 1);
	evas_object_show(note_entry);

	/*lb = elm_label_add(det_page);
	elm_object_text_set(lb,"Note:");
 	elm_table_pack(tb, lb, 1, 5, 2, 1);
	evas_object_show(lb);*/
	
	//add a frame 
	fr1 = elm_frame_add(det_page);
	elm_object_style_set(fr1, "outdent_bottom");
	evas_object_size_hint_weight_set(fr1, -1.0, 0.0);
	evas_object_size_hint_align_set(fr1, -1.0, -1.0);
 	elm_table_pack(tb, fr1, 0, 6, 3, 1);
	evas_object_show(fr1);
	
	//add done button
	bt_done = elm_button_add(det_page);
	elm_object_text_set(bt_done, "Done");
	evas_object_size_hint_weight_set(bt_done, 1.0, 0.0);
	evas_object_size_hint_align_set(bt_done, -1.0, -1.0);
 	elm_table_pack(tb, bt_done, 0, 7, 1, 1);
	evas_object_show(bt_done);
	evas_object_smart_callback_add(bt_done, "clicked", det_page_done, (_Task *)tsk);
	
	//add del button
	bt = elm_button_add(det_page);
	elm_object_text_set(bt, "Delete");
	evas_object_size_hint_weight_set(bt, 1.0, 0.0);
	evas_object_size_hint_align_set(bt, -1.0, -1.0);
 	elm_table_pack(tb, bt, 1, 7, 1, 1);
	evas_object_show(bt);
	evas_object_smart_callback_add(bt, "clicked", det_page_del, (_Task *)tsk);

	//add yes button
	//bt = elm_button_add(det_page);
	//evas_object_size_hint_weight_set(bt, 1.0, 1.0);
	//evas_object_size_hint_align_set(bt, -1.0, -1.0);
	//elm_object_text_set(bt, "Note");
	//elm_box_pack_end(hbox1, bt);
	//evas_object_show(bt);
	//evas_object_smart_callback_add(bt, "clicked", det_page_add, entry);
	
	//add close button
	bt = elm_button_add(det_page);
	evas_object_size_hint_weight_set(bt, 1.0, 0.0);
	evas_object_size_hint_align_set(bt, -1.0, -1.0);
	elm_object_text_set(bt, "Cancel");
 	elm_table_pack(tb, bt, 2, 7, 1, 1);
	evas_object_show(bt);
	evas_object_smart_callback_add(bt, "clicked", cat_win_del, det_page);
	
	evas_object_resize(det_page, 480, 640);
	evas_object_show(det_page);
}             
Evas_Object *IOWODaliRVBHomeView::getPartItem(Evas_Object *obj, std::string part)
{
    Evas_Object *o = NULL;

    if (!io) return o;

    else if (part == "calaos.button.on")
    {
        o = elm_button_add(parent);
        Evas_Object *icon = elm_icon_add(o);
        elm_image_file_set(icon, ApplicationMain::getTheme(), "calaos/icons/action_button/light_on");
        elm_object_style_set(o, "calaos/action_button/yellow");
        elm_object_content_set(o, icon);
        evas_object_smart_callback_add(o, "clicked", _item_button_On, this);
    }
    else if (part == "calaos.button.off")
    {
        o = elm_button_add(parent);
        Evas_Object *icon = elm_icon_add(o);
        elm_image_file_set(icon, ApplicationMain::getTheme(), "calaos/icons/action_button/light_off");
        elm_object_style_set(o, "calaos/action_button/default");
        elm_object_content_set(o, icon);
        evas_object_smart_callback_add(o, "clicked", _item_button_Off, this);
    }
    else if (part == "calaos.button.red.more")
    {
        o = elm_button_add(parent);
        Evas_Object *icon = elm_icon_add(o);
        elm_image_file_set(icon, ApplicationMain::getTheme(), "calaos/icons/action_button/slider_more");
        elm_object_style_set(o, "calaos/action_button/default");
        elm_object_content_set(o, icon);
        evas_object_smart_callback_add(o, "clicked", _item_button_RedMore, this);
    }
    else if (part == "calaos.button.red.less")
    {
        o = elm_button_add(parent);
        Evas_Object *icon = elm_icon_add(o);
        elm_image_file_set(icon, ApplicationMain::getTheme(), "calaos/icons/action_button/slider_less");
        elm_object_style_set(o, "calaos/action_button/default");
        elm_object_content_set(o, icon);
        evas_object_smart_callback_add(o, "clicked", _item_button_RedLess, this);
    }
    else if (part == "calaos.button.green.more")
    {
        o = elm_button_add(parent);
        Evas_Object *icon = elm_icon_add(o);
        elm_image_file_set(icon, ApplicationMain::getTheme(), "calaos/icons/action_button/slider_more");
        elm_object_style_set(o, "calaos/action_button/default");
        elm_object_content_set(o, icon);
        evas_object_smart_callback_add(o, "clicked", _item_button_GreenMore, this);
    }
    else if (part == "calaos.button.green.less")
    {
        o = elm_button_add(parent);
        Evas_Object *icon = elm_icon_add(o);
        elm_image_file_set(icon, ApplicationMain::getTheme(), "calaos/icons/action_button/slider_less");
        elm_object_style_set(o, "calaos/action_button/default");
        elm_object_content_set(o, icon);
        evas_object_smart_callback_add(o, "clicked", _item_button_GreenLess, this);
    }
    else if (part == "calaos.button.blue.more")
    {
        o = elm_button_add(parent);
        Evas_Object *icon = elm_icon_add(o);
        elm_image_file_set(icon, ApplicationMain::getTheme(), "calaos/icons/action_button/slider_more");
        elm_object_style_set(o, "calaos/action_button/default");
        elm_object_content_set(o, icon);
        evas_object_smart_callback_add(o, "clicked", _item_button_BlueMore, this);
    }
    else if (part == "calaos.button.blue.less")
    {
        o = elm_button_add(parent);
        Evas_Object *icon = elm_icon_add(o);
        elm_image_file_set(icon, ApplicationMain::getTheme(), "calaos/icons/action_button/slider_less");
        elm_object_style_set(o, "calaos/action_button/default");
        elm_object_content_set(o, icon);
        evas_object_smart_callback_add(o, "clicked", _item_button_BlueLess, this);
    }
    else if (part == "calaos.slider.red")
    {
        slider_red = new EdjeObject(ApplicationMain::getTheme(), evas);
        slider_red->setAutoDelete(true);
        slider_red->object_deleted.connect(sigc::mem_fun(*this, &IOWODaliRVBHomeView::sliderRedObjectDeleted));
        slider_red->addCallback("object", "*", sigc::mem_fun(*this, &IOWODaliRVBHomeView::sliderSignalCallbackRed), slider_red);
        slider_red->LoadEdje("calaos/slider/horizontal/red");
        slider_red->Show();

        ColorValue c(io->params["state"]);
        if (c.isValid())
            slider_red->setDragValue("slider", c.getRed() / 255.0, 0.0);

        o = slider_red->getEvasObject();
    }
    else if (part == "calaos.slider.green")
    {
        slider_green = new EdjeObject(ApplicationMain::getTheme(), evas);
        slider_green->setAutoDelete(true);
        slider_green->object_deleted.connect(sigc::mem_fun(*this, &IOWODaliRVBHomeView::sliderRedObjectDeleted));
        slider_green->addCallback("object", "*", sigc::mem_fun(*this, &IOWODaliRVBHomeView::sliderSignalCallbackGreen), slider_green);
        slider_green->LoadEdje("calaos/slider/horizontal/green");
        slider_green->Show();

        ColorValue c(io->params["state"]);
        if (c.isValid())
            slider_green->setDragValue("slider", c.getGreen() / 255.0, 0.0);

        o = slider_green->getEvasObject();
    }
    else if (part == "calaos.slider.blue")
    {
        slider_blue = new EdjeObject(ApplicationMain::getTheme(), evas);
        slider_blue->setAutoDelete(true);
        slider_blue->object_deleted.connect(sigc::mem_fun(*this, &IOWODaliRVBHomeView::sliderRedObjectDeleted));
        slider_blue->addCallback("object", "*", sigc::mem_fun(*this, &IOWODaliRVBHomeView::sliderSignalCallbackBlue), slider_blue);
        slider_blue->LoadEdje("calaos/slider/horizontal/blue");
        slider_blue->Show();

        ColorValue c(io->params["state"]);
        if (c.isValid())
            slider_blue->setDragValue("slider", c.getBlue() / 255.0, 0.0);

        o = slider_blue->getEvasObject();
    }
    else if (part == "color.preview")
    {
        int a = 255;

        ColorValue c(io->params["state"]);

        if (c.getRed() == 0 && c.getGreen() == 0 && c.getBlue() == 0)
            a = 100;

        color_preview = evas_object_rectangle_add(evas);
        evas_object_color_set(color_preview, c.getRed(), c.getGreen(), c.getBlue(), a);
        evas_object_show(color_preview);

        o = color_preview;
    }

    initView();

    return o;
}
示例#23
0
void GenlistItemTrack::buttonClickMore()
{
        Evas_Object *table = createPaddingTable(evas, parent, 260, 200);

        Evas_Object *glist = elm_genlist_add(parent);
        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);

        string title_label = "Info de la <light_blue>piste #" + Utils::to_string(item_id + 1) + "</light_blue><br><small>Détails de la piste.</small>";
        GenlistItemBase *header = new GenlistItemSimpleHeader(evas, glist, title_label);
        header->Append(glist);

        string infolabel;
        if (item_infos["artist"] != "")
        {
                infolabel = item_infos["artist"];
                GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Artiste :", infolabel);
                it->Append(glist, header);
        }
        if (item_infos["album"] != "")
        {
                infolabel = item_infos["album"];
                GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Album :", infolabel);
                it->Append(glist, header);
        }
        if (item_infos["title"] != "")
        {
                infolabel = item_infos["title"];
                GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Titre :", infolabel);
                it->Append(glist, header);
        }
        if (item_infos["duration"] != "")
        {
                double dur;
                from_string(item_infos["duration"], dur);
                infolabel = Utils::time2string_digit((long)dur);
                GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Durée :", infolabel);
                it->Append(glist, header);
        }
        if (item_infos["genre"] != "")
        {
                infolabel = item_infos["genre"];
                GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Genre :", infolabel);
                it->Append(glist, header);
        }
        if (item_infos["type"] != "")
        {
                infolabel = item_infos["type"];
                GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Type de flux :", infolabel);
                it->Append(glist, header);
        }
        if (item_infos["bitrate"] != "")
        {
                infolabel = item_infos["bitrate"];
                GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Débit :", infolabel);
                it->Append(glist, header);
        }
        if (item_infos["filesize"] != "")
        {
                long int s;
                from_string(item_infos["filesize"], s);
                s /= 1024;
                s /= 1024;
                infolabel = Utils::to_string(s) + " Mo";
                GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Taille :", infolabel);
                it->Append(glist, header);
        }
        if (item_infos["samplerate"] != "")
        {
                infolabel = item_infos["samplerate"] + " Hz";
                GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Echantillonage :", infolabel);
                it->Append(glist, header);
        }
        if (item_infos["tagversion"] != "")
        {
                infolabel = item_infos["tagversion"];
                GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Version du tag :", infolabel);
                it->Append(glist, header);
        }
        if (item_infos["comment"] != "")
        {
                infolabel = item_infos["comment"];
                GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Commentaire :", infolabel);
                it->Append(glist, header);
        }

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

        Evas_Object *popup_position = elm_ctxpopup_add(parent);
        elm_object_style_set(popup_position, "calaos");
        evas_object_size_hint_min_set(popup_position, 300, 240);

        elm_object_content_set(popup_position, table);

        Evas_Coord x,y;
        evas_pointer_canvas_xy_get(evas, &x, &y);
        evas_object_move(popup_position, x, y);
        evas_object_show(popup_position);
}