Esempio n. 1
0
EAPI_MAIN int
elm_main(int argc, char **argv)
{
   Evas_Object *win, *bg, *bt, *bt2, *rect, *rect2, *rect3, *hover;

   win = elm_win_add(NULL, "hover", ELM_WIN_BASIC);
   elm_win_title_set(win, "Hover");
   elm_win_autodel_set(win, EINA_TRUE);
   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

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

   rect = evas_object_rectangle_add(evas_object_evas_get(win));
   evas_object_size_hint_min_set(rect, 25, 25);
   evas_object_color_set(rect, 255, 0, 0, 255);
   evas_object_show(rect);

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

   rect3 = evas_object_rectangle_add(evas_object_evas_get(win));
   evas_object_size_hint_min_set(rect3, 25, 25);
   evas_object_color_set(rect3, 0, 0, 255, 255);
   evas_object_show(rect3);

   bt = elm_button_add(win);
   elm_object_text_set(bt, "Show hover");
   evas_object_move(bt, 60, 90);
   evas_object_resize(bt, 80, 20);
   evas_object_show(bt);

   bt2 = elm_button_add(win);
   elm_object_text_set(bt2, "Hide hover");
   evas_object_show(bt2);

   hover = elm_hover_add(win);
   elm_hover_parent_set(hover, win);
   elm_hover_target_set(hover, bt);

   elm_object_style_set(hover, "popout");

   elm_hover_content_set(hover, "left", rect);
   elm_hover_content_set(hover, "top", rect2);
   elm_hover_content_set(hover, "right", rect3);
   elm_hover_content_set(hover, "middle", bt2);

   evas_object_smart_callback_add(bt, "clicked", _show_hover, hover);
   evas_object_smart_callback_add(bt2, "clicked", _hide_hover, hover);

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

   elm_run();

   return 0;
}
Esempio n. 2
0
static void
_del_pre_hook(Evas_Object *obj)
{
    Widget_Data *wd = elm_widget_data_get(obj);
    if (!wd)
        return;

    if (evas_object_visible_get(obj))
        evas_object_smart_callback_call(obj, SIG_CLICKED, NULL);
    elm_hover_target_set(obj, NULL);
    elm_hover_parent_set(obj, NULL);
    evas_object_event_callback_del_full(wd->hov, EVAS_CALLBACK_MOVE, _hov_move, obj);
    evas_object_event_callback_del_full(wd->hov, EVAS_CALLBACK_RESIZE, _hov_resize, obj);
    evas_object_event_callback_del_full(wd->hov, EVAS_CALLBACK_SHOW, _hov_show, obj);
    evas_object_event_callback_del_full(wd->hov, EVAS_CALLBACK_HIDE, _hov_hide, obj);
}
Esempio n. 3
0
struct MessageListViewData *
message_list_view_show(struct Window *win, GHashTable * options)
{
	g_debug("message_list_view_show()");
	struct MessageListViewData *data =
		g_slice_alloc0(sizeof(struct MessageListViewData));
	data->win = win;

	window_layout_set(win, MESSAGE_FILE, "list");
	window_text_set(win, "title", D_("Inbox"));

	data->bt1 = elm_button_add(window_evas_object_get(win));
	elm_button_label_set(data->bt1, D_("New"));
	evas_object_smart_callback_add(data->bt1, "clicked",
				       message_list_view_new_clicked, data);
	window_swallow(win, "button_new", data->bt1);
	evas_object_show(data->bt1);


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

	data->bt2 = elm_button_add(window_evas_object_get(win));
	elm_button_label_set(data->bt2, D_("Options"));
	evas_object_smart_callback_add(data->bt2, "clicked", my_hover_bt_1,
				       data->hv);
	window_swallow(win, "button_options", data->bt2);
	evas_object_show(data->bt2);

	elm_hover_parent_set(data->hv, window_evas_object_get(win));
	elm_hover_target_set(data->hv, data->bt2);

	data->bx = elm_box_add(window_evas_object_get(win));
	elm_box_horizontal_set(data->bx, 0);
	elm_box_homogenous_set(data->bx, 1);
	evas_object_show(data->bx);

	data->button_answer = elm_button_add(window_evas_object_get(win));
	elm_button_label_set(data->button_answer, D_("Answer"));
	evas_object_size_hint_min_set(data->button_answer, 130, 80);
	evas_object_smart_callback_add(data->button_answer, "clicked",
				       message_list_view_answer_clicked, data);
	evas_object_show(data->button_answer);
	elm_box_pack_end(data->bx, data->button_answer);

	data->button_delete = elm_button_add(window_evas_object_get(win));
	elm_button_label_set(data->button_delete, D_("Delete"));
	evas_object_size_hint_min_set(data->button_delete, 130, 80);
	evas_object_smart_callback_add(data->button_delete, "clicked",
				       message_list_view_delete_clicked, data);
	evas_object_show(data->button_delete);
	elm_box_pack_end(data->bx, data->button_delete);

	elm_hover_content_set(data->hv, "top", data->bx);


	data->bt3 = elm_button_add(window_evas_object_get(win));
	elm_button_label_set(data->bt3, D_("Show"));
	evas_object_smart_callback_add(data->bt3, "clicked",
				       message_list_view_show_clicked, data);
	window_swallow(win, "button_show", data->bt3);
	evas_object_show(data->bt3);


	g_debug("tree init");

	data->tree = etk_tree_new();
	etk_tree_rows_height_set(ETK_TREE(data->tree), 80);
	etk_tree_mode_set(ETK_TREE(data->tree), ETK_TREE_MODE_LIST);
	etk_tree_headers_visible_set(ETK_TREE(data->tree), ETK_FALSE);
	etk_tree_multiple_select_set(ETK_TREE(data->tree), ETK_FALSE);

	data->col1 = etk_tree_col_new(ETK_TREE(data->tree), "Title", 300, 0.0);
	etk_tree_col_model_add(data->col1,
			       etk_tree_model_edje_new(MESSAGE_FILE,
						       "message_row"));
	etk_tree_build(ETK_TREE(data->tree));

	Etk_Scrolled_View *scrolled_view =
		etk_tree_scrolled_view_get(ETK_TREE(data->tree));
	etk_scrolled_view_dragable_set(ETK_SCROLLED_VIEW(scrolled_view),
				       ETK_TRUE);
	etk_scrolled_view_drag_bouncy_set(ETK_SCROLLED_VIEW(scrolled_view),
					  ETK_FALSE);
	etk_scrolled_view_policy_set(ETK_SCROLLED_VIEW(scrolled_view),
				     ETK_POLICY_HIDE, ETK_POLICY_HIDE);

	data->container =
		etk_embed_new(evas_object_evas_get
			      (window_evas_object_get(win)));
	etk_container_add(ETK_CONTAINER(data->container), data->tree);
	etk_widget_show_all(data->container);

	window_swallow(win, "list",
		       etk_embed_object_get(ETK_EMBED(data->container)));


	ogsmd_sim_retrieve_messagebook("all", retrieve_messagebook_callback,
				       data);
	window_show(win);
	return data;
}
Esempio n. 4
0
static void
retrieve_callback2(struct MessageShowViewData *data)
{
	struct Window *win = data->win;
	window_layout_set(win, MESSAGE_FILE, "message_show");

	time_t timestamp = 0;
	GValue *value = g_hash_table_lookup(data->properties, "timestamp");
	if (value) {
		const char *timestr = g_value_get_string(value);
		timestamp = time_stringtotimestamp(timestr);
	}
	else
		g_debug("no timestamp for message found !!!");
	char *status = data->status;
	char *number = data->number;
	char *content = data->content;

	char datestr[32];
	strftime(datestr, 31, "%d.%m.%Y, %H:%M", localtime(&timestamp));

	window_text_set(win, "text_status", status);
	window_text_set(win, "text_number", number);
	window_text_set(win, "text_content", content);
	window_text_set(win, "text_date", datestr);
	window_text_set(win, "label_number", D_("From:"));
	window_text_set(win, "label_date", D_("Date:"));
	window_text_set(win, "label_status", D_("Status:"));
	window_text_set(win, "text_number", data->name);

	data->bt1 = elm_button_add(window_evas_object_get(win));
	elm_button_label_set(data->bt1, D_("Close"));
	evas_object_smart_callback_add(data->bt1, "clicked",
				       message_show_view_close_clicked, data);
	window_swallow(win, "button_close", data->bt1);
	evas_object_show(data->bt1);


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

	data->bt2 = elm_button_add(window_evas_object_get(win));
	elm_button_label_set(data->bt2, D_("Options"));
	evas_object_smart_callback_add(data->bt2, "clicked", my_hover_bt_1,
				       data->hv);
	window_swallow(win, "button_options", data->bt2);
	evas_object_show(data->bt2);

	elm_hover_parent_set(data->hv, window_evas_object_get(win));
	elm_hover_target_set(data->hv, data->bt2);

	data->bx = elm_box_add(window_evas_object_get(win));
	elm_box_horizontal_set(data->bx, 0);
	elm_box_homogenous_set(data->bx, 1);
	evas_object_show(data->bx);

	data->hbt1 = elm_button_add(window_evas_object_get(win));
	elm_button_label_set(data->hbt1, D_("Call"));
	evas_object_size_hint_min_set(data->hbt1, 140, 80);
	evas_object_smart_callback_add(data->hbt1, "clicked",
				       message_show_view_call_clicked, data);
	evas_object_show(data->hbt1);
	elm_box_pack_end(data->bx, data->hbt1);

	data->hbt2 = elm_button_add(window_evas_object_get(win));
	elm_button_label_set(data->hbt2, D_("Delete"));
	evas_object_size_hint_min_set(data->hbt2, 140, 80);
	evas_object_smart_callback_add(data->hbt2, "clicked",
				       message_show_view_delete_clicked, data);
	evas_object_show(data->hbt2);
	elm_box_pack_end(data->bx, data->hbt2);

	data->hbt3 = elm_button_add(window_evas_object_get(win));
	elm_button_label_set(data->hbt3, D_("Add Contact"));
	evas_object_size_hint_min_set(data->hbt3, 140, 80);
	evas_object_smart_callback_add(data->hbt3, "clicked",
				       message_show_view_new_contact_clicked,
				       data);
	evas_object_show(data->hbt3);
	elm_box_pack_end(data->bx, data->hbt3);

	elm_hover_content_set(data->hv, "top", data->bx);


	data->bt3 = elm_button_add(window_evas_object_get(win));
	elm_button_label_set(data->bt3, D_("Answer"));
	evas_object_smart_callback_add(data->bt3, "clicked",
				       message_show_view_answer_clicked, data);
	window_swallow(win, "button_answer", data->bt3);
	evas_object_show(data->bt3);


	window_show(win);
}
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;
}
Esempio n. 6
0
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);
}
Esempio n. 7
0
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);
}