Ejemplo n.º 1
0
static void
frame_recipient_show(struct MessageNewViewData *data)
{
	struct Window *win = data->win;

	window_layout_set(win, MESSAGE_FILE, "recipient_edit");

	window_text_set(win, "title", D_("Define Recipients"));

	data->bt1 = elm_button_add(window_evas_object_get(win));
	elm_button_label_set(data->bt1, D_("Back"));
	evas_object_smart_callback_add(data->bt1, "clicked",
				       frame_recipient_back_clicked, data);
	window_swallow(win, "button_back", data->bt1);
	evas_object_show(data->bt1);

	data->bt2 = elm_button_add(window_evas_object_get(win));
	elm_button_label_set(data->bt2, D_("Send"));
	evas_object_smart_callback_add(data->bt2, "clicked",
				       frame_recipient_continue_clicked, data);
	window_swallow(win, "button_continue", data->bt2);
	evas_object_show(data->bt2);

	data->bt3 = elm_button_add(window_evas_object_get(win));
	elm_button_label_set(data->bt3, D_("Add Contact"));
	evas_object_smart_callback_add(data->bt3, "clicked",
				       frame_recipient_contact_add_clicked,
				       data);
	window_swallow(win, "button_contact_add", data->bt3);
	evas_object_show(data->bt3);

	data->bt4 = elm_button_add(window_evas_object_get(win));
	elm_button_label_set(data->bt4, D_("Add Number"));
	evas_object_smart_callback_add(data->bt4, "clicked",
				       frame_recipient_number_add_clicked,
				       data);
	window_swallow(win, "button_number_add", data->bt4);
	evas_object_show(data->bt4);

	data->bt5 = elm_button_add(window_evas_object_get(win));
	elm_button_label_set(data->bt5, D_("Remove"));
	evas_object_smart_callback_add(data->bt5, "clicked",
				       frame_recipient_delete_clicked, data);
	window_swallow(win, "button_delete", data->bt5);
	evas_object_show(data->bt5);

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

	data->col1_recipients =
		etk_tree_col_new(ETK_TREE(data->tree_recipients), "Title", 300,
				 0.0);
	etk_tree_col_model_add(data->col1_recipients,
			       etk_tree_model_edje_new(CONTACTS_FILE, "row"));
	etk_tree_build(ETK_TREE(data->tree_recipients));

	Etk_Scrolled_View *scrolled_view =
		etk_tree_scrolled_view_get(ETK_TREE(data->tree_recipients));
	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_recipients =
		etk_embed_new(evas_object_evas_get
			      (window_evas_object_get(win)));
	etk_container_add(ETK_CONTAINER(data->container_recipients),
			  data->tree_recipients);
	etk_widget_show_all(data->container_recipients);
	data->container_recipients_eo =
		etk_embed_object_get(ETK_EMBED(data->container_recipients));

	window_swallow(win, "list", data->container_recipients_eo);

	g_ptr_array_foreach(data->recipients, frame_recipient_process_recipient,
			    data);
}
Ejemplo n.º 2
0
Ex_Tab *
_ex_tab_new(Exhibit *e, char *dir)
{
   Ex_Tab *tab;
   Etk_Tree_Model *imodel;
   char *file;

   file = NULL;
   tab = calloc(1, sizeof(Ex_Tab));
   //tab->num = eina_list_count(e->tabs);
   tab->dirs = NULL;

   if (!dir) {
	D(("NO DIR\n"));
	exit(-1);
   }

   D(("Creating new tab with %s\n", dir));

   if (e->options->default_view == EX_IMAGE_FIT_TO_WINDOW)
     {
	tab->fit_window = ETK_TRUE;
	D(("Setting EX_IMAGE_FIT_TO_WINDOW\n"));
     }
   else
      tab->fit_window = ETK_FALSE;

   tab->comment.visible = ETK_FALSE;
   tab->image_loaded = ETK_FALSE;

   tab->dtree = etk_tree_new();
   etk_widget_size_request_set(tab->dtree, 180, 120);
   etk_signal_connect("row-clicked", ETK_OBJECT(tab->dtree), ETK_CALLBACK(_ex_tab_dtree_item_clicked_cb), e);
   tab->dcol = etk_tree_col_new(ETK_TREE(tab->dtree), "Directories", 10, 0.0);
   etk_tree_col_model_add(tab->dcol, etk_tree_model_image_new());
   etk_tree_col_model_add(tab->dcol, etk_tree_model_text_new());
   etk_tree_headers_visible_set(ETK_TREE(tab->dtree), 0);
   etk_scrolled_view_policy_set(etk_tree_scrolled_view_get(ETK_TREE(tab->dtree)), ETK_POLICY_AUTO, ETK_POLICY_SHOW);
   etk_tree_build(ETK_TREE(tab->dtree));

   tab->itree = etk_tree_new();
   etk_scrolled_view_dragable_set(ETK_SCROLLED_VIEW(etk_tree_scrolled_view_get(ETK_TREE(tab->itree))), ETK_TRUE);
   etk_scrolled_view_drag_bouncy_set(ETK_SCROLLED_VIEW(etk_tree_scrolled_view_get(ETK_TREE(tab->itree))), ETK_FALSE);
   etk_scrolled_view_drag_damping_set(ETK_SCROLLED_VIEW(etk_tree_scrolled_view_get(ETK_TREE(tab->itree))), 300);



   etk_widget_dnd_source_set(ETK_WIDGET(tab->itree), ETK_TRUE);
//   etk_signal_connect("drag_begin", ETK_OBJECT(tab->itree), ETK_CALLBACK(_ex_tab_tree_drag_begin_cb), tab);
   etk_widget_size_request_set(tab->itree, 180, 220);
   etk_tree_multiple_select_set(ETK_TREE(tab->itree), ETK_TRUE);
   etk_signal_connect("row-selected", ETK_OBJECT(tab->itree), ETK_CALLBACK(_ex_tab_itree_item_clicked_cb), e);
   etk_signal_connect("key-down", ETK_OBJECT(tab->itree), ETK_CALLBACK(_ex_tab_itree_key_down_cb), e);
   imodel = etk_tree_model_wobbly_new();
   tab->imodel = imodel;
   //etk_tree_model_image_width_set(imodel, 80, 0.0);
   tab->icol = etk_tree_col_new(ETK_TREE(tab->itree), "Files", 10, 0.0);
   etk_tree_col_model_add(tab->icol, imodel);
   etk_tree_col_model_add(tab->icol, etk_tree_model_text_new());
   etk_tree_headers_visible_set(ETK_TREE(tab->itree), 0);
   etk_tree_rows_height_set(ETK_TREE(tab->itree), 60);
   etk_scrolled_view_policy_set(etk_tree_scrolled_view_get(ETK_TREE(tab->itree)), ETK_POLICY_AUTO, ETK_POLICY_SHOW);
   etk_tree_build(ETK_TREE(tab->itree));

   tab->dir = _ex_path_normalize(ecore_file_realpath(dir));
   tab->alignment = etk_alignment_new(0.5, 0.5, 1.0, 1.0);

   tab->image = etk_image_new();
   etk_widget_theme_file_set(tab->image, PACKAGE_DATA_DIR"/gui.edj");
   etk_widget_theme_group_set(tab->image, "image_bg");
   etk_signal_connect("mouse-down", ETK_OBJECT(tab->image), ETK_CALLBACK(_ex_image_mouse_down), e);
   etk_signal_connect("mouse-up", ETK_OBJECT(tab->image), ETK_CALLBACK(_ex_image_mouse_up), e);
   etk_signal_connect("mouse-move", ETK_OBJECT(tab->image), ETK_CALLBACK(_ex_image_mouse_move), e);
   etk_signal_connect("mouse-wheel", ETK_OBJECT(tab->image), ETK_CALLBACK(_ex_image_mouse_wheel), e);

   etk_image_keep_aspect_set(ETK_IMAGE(tab->image), ETK_TRUE);

   etk_container_add(ETK_CONTAINER(tab->alignment), tab->image);

   tab->scrolled_view = etk_scrolled_view_new();
   etk_scrolled_view_policy_set(ETK_SCROLLED_VIEW(tab->scrolled_view), ETK_POLICY_HIDE, ETK_POLICY_HIDE);
   etk_scrolled_view_dragable_set(ETK_SCROLLED_VIEW(tab->scrolled_view), ETK_TRUE);
   etk_scrolled_view_drag_bouncy_set((ETK_SCROLLED_VIEW(tab->scrolled_view)), ETK_FALSE);
   etk_scrolled_view_add_with_viewport(ETK_SCROLLED_VIEW(tab->scrolled_view), tab->alignment);
   etk_widget_has_event_object_set(tab->scrolled_view, ETK_TRUE);
   etk_signal_connect("mouse-wheel", ETK_OBJECT(tab->scrolled_view), ETK_CALLBACK(_ex_image_mouse_wheel), e);

   return tab;
}
Ejemplo n.º 3
0
/* Creates the window for the tree test */
void etk_test_tree_window_create(void *data)
{
   static Etk_Widget *win = NULL;
   Etk_Widget *vbox;
   Etk_Widget *hbox;
   Etk_Widget *tree;
   Etk_Widget *button;
   Etk_Tree_Col *col1, *col2, *col3, *col4, *col5, *col6;
   Etk_Tree_Row *row;
   Etk_Widget *statusbar;
   Etk_Color c_warn;
   char row_name[128];
   const char *stock_key;
   int i, j;

   if (win)
   {
      etk_widget_show(ETK_WIDGET(win));
      return;
   }

   /* Create the window and the vbox where the widgets will be packed into */
   win = etk_window_new();
   etk_window_title_set(ETK_WINDOW(win), "Etk Tree Test");
   etk_window_resize(ETK_WINDOW(win), 640, 500);
   etk_signal_connect_by_code(ETK_WINDOW_DELETE_EVENT_SIGNAL, ETK_OBJECT(win), ETK_CALLBACK(etk_window_hide_on_delete), NULL);

   vbox = etk_vbox_new(ETK_FALSE, 0);
   etk_container_add(ETK_CONTAINER(win), vbox);

   /* Create the tree widget */
   tree = etk_tree_new();
   etk_tree_mode_set(ETK_TREE(tree), ETK_TREE_MODE_TREE);
   etk_scrolled_view_extra_vmargin_set(etk_tree_scrolled_view_get(ETK_TREE(tree)), 250);
   etk_scrolled_view_drag_bouncy_set(etk_tree_scrolled_view_get(ETK_TREE(tree)), ETK_BOUNCY_STOPTOOBJECT);
   etk_scrolled_view_dragable_set(etk_tree_scrolled_view_get(ETK_TREE(tree)), ETK_TRUE);
   etk_tree_multiple_select_set(ETK_TREE(tree), ETK_TRUE);
   etk_widget_padding_set(tree, 5, 5, 5, 5);
   etk_box_append(ETK_BOX(vbox), tree, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);

   /* We first create the columns of the tree, and then we "build" the tree with etk_tree_build() */
   col1 = etk_tree_col_new(ETK_TREE(tree), "Column 1", 130, 0.0);
   etk_tree_col_model_add(col1, etk_tree_model_image_new());
   etk_tree_col_model_add(col1, etk_tree_model_text_new());

   col2 = etk_tree_col_new(ETK_TREE(tree), "Column 2", 60, 1.0);
   etk_tree_col_model_add(col2, etk_tree_model_double_new());

   col3 = etk_tree_col_new(ETK_TREE(tree), "Column 3", 80, 0.75);
   etk_tree_col_model_add(col3, etk_tree_model_int_new());

   col4 = etk_tree_col_new(ETK_TREE(tree), "Column 4", 60, 0.0);
   etk_tree_col_model_add(col4, etk_tree_model_image_new());

   col5 = etk_tree_col_new(ETK_TREE(tree), "Column 5", 60, 0.5);
   etk_tree_col_model_add(col5, etk_tree_model_checkbox_new());

   col6 = etk_tree_col_new(ETK_TREE(tree), "Column 6", 60, 0.0);
   etk_tree_col_model_add(col6, etk_tree_model_progress_bar_new());

   etk_tree_build(ETK_TREE(tree));

   /* Then we add the rows to the tree. etk_tree_freeze/thaw() is used to improve
    * the speed when you insert a lot of rows. It is not really important if you
    * insert only some thousands of rows (here, we insert 3000 rows) */
   etk_tree_freeze(ETK_TREE(tree));
   etk_theme_color_get(NULL, ETK_COLOR_WARNING_FG, &c_warn.r, &c_warn.g, &c_warn.b, &c_warn.a);
   for (i = 0; i < 1000; i++)
   {
      sprintf(row_name, "Row %d", (i * 3) + 1);
      stock_key = etk_stock_key_get(ETK_STOCK_PLACES_USER_HOME, ETK_STOCK_SMALL);
      row = etk_tree_row_append(ETK_TREE(tree), NULL,
         col1, etk_theme_icon_path_get(), stock_key, row_name,
         col2, 0.57,
         col3, rand(),
         col4, PACKAGE_DATA_DIR "/images/1star.png", NULL,
         col5, ETK_FALSE,
         col6, 0.57, "57 %",
         NULL);

      for (j = 0; j < 3; j++)
      {
        Etk_Tree_Row *current;
        sprintf(row_name, "Row %d", (i * 3) + 2);
        stock_key = etk_stock_key_get(ETK_STOCK_PLACES_FOLDER, ETK_STOCK_SMALL);
        current = etk_tree_row_append(ETK_TREE(tree), row,
                                      col1, etk_theme_icon_path_get(), stock_key, row_name,
                                      col2, 20.0,
                                      col3, rand(),
                                      col4, PACKAGE_DATA_DIR "/images/2stars.png", NULL,
                                      col5, ETK_TRUE,
                                      col6, 0.20, "20 %",
                                      NULL);
        if (j == 2) row = current;
      }

      sprintf(row_name, "<font color=#%.2X%.2X%.2X%.2X>Row %d</font>",
            c_warn.r, c_warn.g, c_warn.b, c_warn.a, (i * 3) + 3);
      stock_key = etk_stock_key_get(ETK_STOCK_TEXT_X_GENERIC, ETK_STOCK_SMALL);
      etk_tree_row_append(ETK_TREE(tree), row,
         col1, etk_theme_icon_path_get(), stock_key, row_name,
         col2, 300.0,
         col3, 257,
         col4, PACKAGE_DATA_DIR "/images/3stars.png", NULL,
         col5, ETK_TRUE,
         NULL);
   }
   etk_tree_thaw(ETK_TREE(tree));
   etk_tree_col_sort_set(col3, _etk_test_tree_compare_cb, NULL);

   hbox = etk_hbox_new(ETK_TRUE, 0);
   etk_box_append(ETK_BOX(vbox), hbox, ETK_BOX_START, ETK_BOX_FILL, 0);

   button = etk_button_new_with_label("Sort the tree");
   etk_box_append(ETK_BOX(hbox), button, ETK_BOX_START, ETK_BOX_EXPAND, 0);
   etk_signal_connect_by_code(ETK_BUTTON_CLICKED_SIGNAL, ETK_OBJECT(button),
      ETK_CALLBACK(_etk_test_tree_sort_button_cb), col3);

   button = etk_button_new_with_label("Insert a sorted row");
   etk_box_append(ETK_BOX(hbox), button, ETK_BOX_START, ETK_BOX_EXPAND, 0);
   etk_signal_connect_by_code(ETK_BUTTON_CLICKED_SIGNAL, ETK_OBJECT(button),
      ETK_CALLBACK(_etk_test_tree_insert_sorted_button_cb), ETK_TREE(tree));
   
   button = etk_button_new_with_label("Select all");
   etk_box_append(ETK_BOX(hbox), button, ETK_BOX_START, ETK_BOX_EXPAND, 0);
   etk_signal_connect_by_code(ETK_BUTTON_CLICKED_SIGNAL, ETK_OBJECT(button),
      ETK_CALLBACK(_etk_test_tree_select_all_cb), ETK_TREE(tree));

   button = etk_button_new_with_label("Unselect all");
   etk_box_append(ETK_BOX(hbox), button, ETK_BOX_START, ETK_BOX_EXPAND, 0);
   etk_signal_connect_by_code(ETK_BUTTON_CLICKED_SIGNAL, ETK_OBJECT(button),
      ETK_CALLBACK(_etk_test_tree_unselect_all_cb), ETK_TREE(tree));

   /* Finally we create the statusbar used to display the events on the tree */
   statusbar = etk_statusbar_new();
   etk_box_append(ETK_BOX(vbox), statusbar, ETK_BOX_START, ETK_BOX_FILL, 0);

   etk_signal_connect_by_code(ETK_WIDGET_KEY_DOWN_SIGNAL, ETK_OBJECT(tree),
      ETK_CALLBACK(_etk_test_tree_key_down_cb), NULL);
   etk_signal_connect_by_code(ETK_TREE_ROW_CLICKED_SIGNAL, ETK_OBJECT(tree),
      ETK_CALLBACK(_etk_test_tree_row_clicked_cb), statusbar);
   etk_signal_connect_by_code(ETK_TREE_COL_CELL_VALUE_CHANGED_SIGNAL, ETK_OBJECT(col5),
      ETK_CALLBACK(_etk_test_tree_checkbox_toggled_cb), statusbar);

   etk_widget_show_all(win);
}
Ejemplo n.º 4
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;
}