Exemple #1
0
/* Creates the window for the mdi test */
void etk_test_mdi_window_window_create(void *data)
{
   static Etk_Widget *win = NULL;
   Etk_Widget *mdi_area;
   Etk_Widget *mdi_window;
   Etk_Widget *down_image;
   Etk_Widget *next_image;
   Etk_Widget *prev_image;
   Etk_Widget *up_image;
   Etk_Widget *table;

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

   win = etk_window_new();
   etk_window_resize(ETK_WINDOW(win), 300, 300);
   etk_window_title_set(ETK_WINDOW(win), "Etk Mdi Window Test");
   etk_container_border_width_set(ETK_CONTAINER(win), 5);
   etk_signal_connect_by_code(ETK_WINDOW_DELETE_EVENT_SIGNAL, ETK_OBJECT(win), ETK_CALLBACK(etk_window_hide_on_delete), NULL);

   down_image = etk_image_new_from_stock(ETK_STOCK_GO_DOWN, ETK_STOCK_BIG);
   next_image = etk_image_new_from_stock(ETK_STOCK_GO_NEXT, ETK_STOCK_BIG);
   prev_image = etk_image_new_from_stock(ETK_STOCK_GO_PREVIOUS, ETK_STOCK_BIG);
   up_image = etk_image_new_from_stock(ETK_STOCK_GO_UP, ETK_STOCK_BIG);

   table = etk_table_new(3, 3, ETK_TABLE_NOT_HOMOGENEOUS);
   etk_container_add(ETK_CONTAINER(win), table);

   etk_table_attach(ETK_TABLE(table), down_image, 0, 2, 0, 0, ETK_TABLE_NONE, 0, 0);
   etk_table_attach(ETK_TABLE(table), next_image, 0, 0, 1, 1, ETK_TABLE_NONE, 0, 0);
   etk_table_attach(ETK_TABLE(table), prev_image, 2, 2, 1, 1, ETK_TABLE_NONE, 0, 0);
   etk_table_attach(ETK_TABLE(table), up_image, 0, 2, 2, 2, ETK_TABLE_NONE, 0, 0);

   mdi_area = etk_mdi_area_new();
   etk_table_attach_default(ETK_TABLE(table), mdi_area, 1, 1, 1, 1);

   mdi_window = etk_mdi_window_new();
   etk_mdi_window_title_set(ETK_MDI_WINDOW(mdi_window), "Mdi Window 1");
   etk_widget_size_request_set(ETK_WIDGET(mdi_window), 100, 100);
   etk_container_add(ETK_CONTAINER(mdi_area), mdi_window);

   mdi_window = etk_mdi_window_new();
   etk_mdi_window_title_set(ETK_MDI_WINDOW(mdi_window), "Mdi Window 2");
   etk_mdi_window_move(ETK_MDI_WINDOW(mdi_window), 100, 100);
   etk_widget_size_request_set(ETK_WIDGET(mdi_window), 100, 100);
   etk_container_add(ETK_CONTAINER(mdi_area), mdi_window);

   etk_widget_show_all(win);
}
Exemple #2
0
void
_ex_tab_select(Ex_Tab *tab)
{
   //chdir(tab->dir);

   D(("_ex_tab_select: changed dir to %s\n", tab->dir));
   D(("_ex_tab_select: selecting tab num %d\n", e->cur_tab->num));

   if (tab->comment.visible)
     etk_notebook_page_child_set(ETK_NOTEBOOK(e->notebook), tab->num,
				 tab->comment.vbox);
   else if (tab->fit_window)
     etk_notebook_page_child_set(ETK_NOTEBOOK(e->notebook), tab->num,
				 tab->alignment);

   etk_table_attach(ETK_TABLE(e->table), tab->dtree,
		    0, 3, 3, 3,
		    ETK_TABLE_VEXPAND | ETK_TABLE_FILL, 0, 0);
   etk_widget_show(tab->dtree);

   etk_paned_child2_set(ETK_PANED(e->vpaned), tab->itree, ETK_TRUE);
   etk_widget_show(tab->itree);

   etk_widget_show(tab->image);
   etk_widget_show(tab->alignment);
   etk_widget_show(tab->scrolled_view);

   etk_widget_show_all(e->win);
}
/***   Implementation   ***/
Etk_Widget*
gradient_frame_create(void)
{
   Etk_Widget *table;
   Etk_Widget *label;
   Etk_Combobox_Item *item;

   //table
   table = etk_table_new(2, 5, ETK_TABLE_NOT_HOMOGENEOUS);

   //UI_GradientTypeComboBox
   label = etk_label_new("<b>Type</b>");
   etk_table_attach(ETK_TABLE(table), label, 0, 0, 0, 0, ETK_TABLE_NONE, 0, 0);

   UI_GradientTypeComboBox = etk_combobox_new();
   etk_combobox_items_height_set(ETK_COMBOBOX(UI_GradientTypeComboBox), 24);
   etk_combobox_column_add(ETK_COMBOBOX(UI_GradientTypeComboBox),
                           ETK_COMBOBOX_IMAGE, 27, ETK_COMBOBOX_NONE, 0.0);
   etk_combobox_column_add(ETK_COMBOBOX(UI_GradientTypeComboBox),
                           ETK_COMBOBOX_LABEL, 75, ETK_COMBOBOX_EXPAND_FILL, 0.0);
   etk_combobox_build(ETK_COMBOBOX(UI_GradientTypeComboBox));
   etk_table_attach_default(ETK_TABLE(table), UI_GradientTypeComboBox, 1, 1, 0, 0);

   item = etk_combobox_item_append(ETK_COMBOBOX(UI_GradientTypeComboBox),
                  etk_image_new_from_edje(EdjeFile,"GRAD_LINEAR.PNG"), "linear");
   item = etk_combobox_item_append(ETK_COMBOBOX(UI_GradientTypeComboBox),
                  etk_image_new_from_edje(EdjeFile,"GRAD_RADIAL.PNG"), "radial");
   item = etk_combobox_item_append(ETK_COMBOBOX(UI_GradientTypeComboBox),
                  etk_image_new_from_edje(EdjeFile,"GRAD_RECTANGULAR.PNG"), "rectangular");
   item = etk_combobox_item_append(ETK_COMBOBOX(UI_GradientTypeComboBox),
                  etk_image_new_from_edje(EdjeFile,"GRAD_ANGULAR.PNG"), "angular");
   item = etk_combobox_item_append(ETK_COMBOBOX(UI_GradientTypeComboBox),
                  etk_image_new_from_edje(EdjeFile,"GRAD_SINUSOIDAL.PNG"), "sinusoidal");

   //UI_GradientSpectraComboBox
   label = etk_label_new("<b>Spectra</b>");
   etk_table_attach(ETK_TABLE(table), label, 0, 0, 1, 1, ETK_TABLE_NONE, 0, 0);

   UI_GradientSpectraComboBox = etk_combobox_new();
   etk_combobox_column_add(ETK_COMBOBOX(UI_GradientSpectraComboBox),
                           ETK_COMBOBOX_OTHER, 45, ETK_COMBOBOX_NONE, 0.5);
   etk_combobox_column_add(ETK_COMBOBOX(UI_GradientSpectraComboBox),
                           ETK_COMBOBOX_LABEL, 100, ETK_COMBOBOX_EXPAND_FILL, 0.0);
   etk_combobox_build(ETK_COMBOBOX(UI_GradientSpectraComboBox));
   etk_table_attach_default(ETK_TABLE(table), UI_GradientSpectraComboBox, 1, 1, 1, 1);

   //GradientAlphaSlider
   label = etk_label_new("<b>Alpha</b>");
   etk_table_attach(ETK_TABLE(table), label, 0, 0, 2, 2,  ETK_TABLE_NONE, 0, 0);
   UI_GradientAlphaSlider = etk_hslider_new(0, 255, 15, 1,20);
   etk_slider_label_set(ETK_SLIDER(UI_GradientAlphaSlider), "%.0f");
   etk_table_attach_default(ETK_TABLE(table), UI_GradientAlphaSlider, 1, 1, 2, 2);
   
   //GradientAngleSlider
   label = etk_label_new("<b>Angle</b>");
   etk_table_attach(ETK_TABLE(table), label, 0, 0, 3, 3,  ETK_TABLE_NONE, 0, 0);
   UI_GradientAngleSlider = etk_hslider_new(0, 360, 15, 1,20);
   etk_slider_label_set(ETK_SLIDER(UI_GradientAngleSlider), "%.0f");
   etk_table_attach_default(ETK_TABLE(table), UI_GradientAngleSlider, 1, 1, 3, 3);

   //~ //hbox (first handler)
   //~ hbox = etk_hbox_new(ETK_FALSE, 0);
   //~ etk_table_attach_default(ETK_TABLE(table), hbox, 0, 2, 3, 3);
   
   //~ label = etk_label_new("<b>Start  X </b>");
   //~ etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);

   //~ //UI_GradientRel1XSpinner
   //~ UI_GradientRel1XSpinner = etk_spinner_new(-100.0, 100.0, 0.0, 0.01, 0.1);
   //~ etk_spinner_digits_set(ETK_SPINNER(UI_GradientRel1XSpinner), 2);
   //~ etk_widget_size_request_set(UI_GradientRel1XSpinner, 45, 20);
   //~ etk_box_append(ETK_BOX(hbox), UI_GradientRel1XSpinner,
                  //~ ETK_BOX_START, ETK_BOX_NONE, 0);

   //~ label = etk_label_new("+");
   //~ etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_NONE, 0);

   //~ //UI_GradientRel1XOffsetSpinner
   //~ UI_GradientRel1XOffsetSpinner = etk_spinner_new(-2000, 2000, 0, 1, 10);
   //~ etk_widget_size_request_set(UI_GradientRel1XOffsetSpinner, 45, 20);
   //~ etk_box_append(ETK_BOX(hbox), UI_GradientRel1XOffsetSpinner,
                  //~ ETK_BOX_START, ETK_BOX_NONE, 0);

   //~ label = etk_label_new("<b>  Y </b>");
   //~ etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);

   //~ //UI_GradientRel1YSpinner
   //~ UI_GradientRel1YSpinner = etk_spinner_new(-100.0, 100.0, 0.0, 0.01, 0.1);
   //~ etk_spinner_digits_set(ETK_SPINNER(UI_GradientRel1YSpinner), 2);
   //~ etk_widget_size_request_set(UI_GradientRel1YSpinner, 45, 20);
   //~ etk_box_append(ETK_BOX(hbox), UI_GradientRel1YSpinner,
                  //~ ETK_BOX_START, ETK_BOX_NONE, 0);

   //~ label = etk_label_new("+");
   //~ etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_NONE, 0);

   //~ //UI_GradientRel1YOffsetSpinner
   //~ UI_GradientRel1YOffsetSpinner = etk_spinner_new(-2000, 2000, 0, 1, 10);
   //~ etk_widget_size_request_set(UI_GradientRel1YOffsetSpinner, 45, 20);
   //~ etk_box_append(ETK_BOX(hbox), UI_GradientRel1YOffsetSpinner,
                  //~ ETK_BOX_START, ETK_BOX_NONE, 0);


   //hbox (second handler)
   //~ hbox = etk_hbox_new(ETK_FALSE, 0);
   //~ etk_table_attach_default(ETK_TABLE(table), hbox, 0, 2, 4, 4);

   //~ label = etk_label_new("<b>End     X </b>");
   //~ etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);

   //~ //UI_GradientRel2XSpinner
   //~ UI_GradientRel2XSpinner = etk_spinner_new(-100.0, 100.0, 0.0, 0.01, 0.1);
   //~ etk_spinner_digits_set(ETK_SPINNER(UI_GradientRel2XSpinner), 2);
   //~ etk_widget_size_request_set(UI_GradientRel2XSpinner, 45, 20);
   //~ etk_box_append(ETK_BOX(hbox), UI_GradientRel2XSpinner,
                  //~ ETK_BOX_START, ETK_BOX_NONE, 0);

   //~ label = etk_label_new("+");
   //~ etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_NONE, 0);

   //~ //UI_GradientRel2XOffsetSpinner
   //~ UI_GradientRel2XOffsetSpinner = etk_spinner_new(-2000, 2000, 0, 1, 10);
   //~ etk_widget_size_request_set(UI_GradientRel2XOffsetSpinner, 45, 20);
   //~ etk_box_append(ETK_BOX(hbox), UI_GradientRel2XOffsetSpinner,
                  //~ ETK_BOX_START, ETK_BOX_NONE, 0);

   //~ label = etk_label_new("<b>  Y </b>");
   //~ etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);

   //~ //UI_GradientRel2YSpinner
   //~ UI_GradientRel2YSpinner = etk_spinner_new(-100.0, 100.0, 0.0, 0.01, 0.1);
   //~ etk_spinner_digits_set(ETK_SPINNER(UI_GradientRel2YSpinner), 2);
   //~ etk_widget_size_request_set(UI_GradientRel2YSpinner, 45, 20);
   //~ etk_box_append(ETK_BOX(hbox), UI_GradientRel2YSpinner,
                  //~ ETK_BOX_START, ETK_BOX_NONE, 0);

   //~ label = etk_label_new("+");
   //~ etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_NONE, 0);

   //~ //UI_GradientRel2YOffsetSpinner
   //~ UI_GradientRel2YOffsetSpinner = etk_spinner_new(-2000, 2000, 0, 1, 10);
   //~ etk_widget_size_request_set(UI_GradientRel2YOffsetSpinner, 45, 20);
   //~ etk_box_append(ETK_BOX(hbox), UI_GradientRel2YOffsetSpinner,
                  //~ ETK_BOX_START, ETK_BOX_NONE, 0);

   etk_signal_connect("item-activated", ETK_OBJECT(UI_GradientTypeComboBox),
                     ETK_CALLBACK(_gradient_type_combo_activated_cb), NULL);
   etk_signal_connect("item-activated", ETK_OBJECT(UI_GradientSpectraComboBox),
                     ETK_CALLBACK(_gradient_spectra_combo_activated_cb), NULL);
   
   etk_signal_connect("value-changed", ETK_OBJECT(UI_GradientAlphaSlider),
            ETK_CALLBACK(_image_AlphaSlider_value_changed_cb), NULL);
   etk_signal_connect("value-changed", ETK_OBJECT(UI_GradientAngleSlider),
            ETK_CALLBACK(_gradient_AngleSlider_value_changed_cb), NULL);

   //~ etk_signal_connect("value-changed", ETK_OBJECT(UI_GradientRel1XSpinner),
                      //~ ETK_CALLBACK(_gradient_RelSpinners_value_changed_cb),
                      //~ (void *)REL1X_SPINNER);
   //~ etk_signal_connect("value-changed", ETK_OBJECT(UI_GradientRel1YSpinner),
                      //~ ETK_CALLBACK(_gradient_RelSpinners_value_changed_cb),
                      //~ (void *)REL1Y_SPINNER);
   //~ etk_signal_connect("value-changed", ETK_OBJECT(UI_GradientRel2XSpinner),
                      //~ ETK_CALLBACK(_gradient_RelSpinners_value_changed_cb),
                      //~ (void *)REL2X_SPINNER);
   //~ etk_signal_connect("value-changed", ETK_OBJECT(UI_GradientRel2YSpinner),
                      //~ ETK_CALLBACK(_gradient_RelSpinners_value_changed_cb),
                      //~ (void *)REL2Y_SPINNER);

   //~ etk_signal_connect("value-changed", ETK_OBJECT(UI_GradientRel1XOffsetSpinner),
                      //~ ETK_CALLBACK(_gradient_RelSpinners_value_changed_cb),
                      //~ (void *)REL1XO_SPINNER);
   //~ etk_signal_connect("value-changed", ETK_OBJECT(UI_GradientRel1YOffsetSpinner),
                      //~ ETK_CALLBACK(_gradient_RelSpinners_value_changed_cb),
                      //~ (void *)REL1YO_SPINNER);
   //~ etk_signal_connect("value-changed", ETK_OBJECT(UI_GradientRel2XOffsetSpinner),
                      //~ ETK_CALLBACK(_gradient_RelSpinners_value_changed_cb),
                      //~ (void *)REL2XO_SPINNER);
   //~ etk_signal_connect("value-changed", ETK_OBJECT(UI_GradientRel2YOffsetSpinner),
                      //~ ETK_CALLBACK(_gradient_RelSpinners_value_changed_cb),
                      //~ (void *)REL2YO_SPINNER);

   return table;
}
Exemple #4
0
static void _ex_tab_tree_drag_begin_cb(Etk_Object *object, void *data)
{
   Ex_Tab       *tab;
   Etk_Tree     *tree;
   Etk_Tree_Row *row;
   Etk_Widget   *drag;
   Etk_Widget   *image;
   Eina_List    *rows;
   char *icol1_string;
   char *icol2_string;
   char *drag_data;
   const char **types;
   unsigned int num_types;

   tab = data;
   tree = ETK_TREE(object);
   /* TODO: reimplement dnd when it is reimplemented in Etk
   drag = (ETK_WIDGET(tree))->drag; */
   drag = NULL;

   rows = etk_tree_selected_rows_get(tree);

   types = calloc(1, sizeof(char*));
   num_types = 1;
   types[0] = strdup("text/uri-list");

   if (eina_list_count(rows) > 1)
     {
	Eina_List *ll;
	Etk_Widget *table;
	int i = 0, l = 0, r = 0, t = 0, b = 0, row_num;

	if (eina_list_count(rows) >= EX_DND_COL_NUM)
	  row_num = eina_list_count(rows) / EX_DND_COL_NUM;
	else
	  row_num = 1;

	table = etk_table_new(EX_DND_COL_NUM, row_num + 1, ETK_TABLE_HOMOGENEOUS);
	drag_data = calloc(PATH_MAX * eina_list_count(rows), sizeof(char));
	EINA_LIST_FOREACH(rows, ll, row)
	  {
	     char tmp[PATH_MAX];

	     etk_tree_row_fields_get(row, etk_tree_nth_col_get(tree, 0), &icol1_string, &icol2_string, etk_tree_nth_col_get(tree, 1),NULL);
	     snprintf(tmp, PATH_MAX * sizeof(char), "file://%s%s\r\n", tab->dir, icol2_string);
	     strncat(drag_data, tmp, PATH_MAX * eina_list_count(rows));
	     if (i <= EX_DND_MAX_NUM * EX_DND_MAX_NUM)
	       {
		  image = etk_image_new_from_file(icol1_string, NULL);
		  etk_image_keep_aspect_set(ETK_IMAGE(image), ETK_TRUE);
		  etk_widget_size_request_set(image, 48, 48);
		  etk_table_attach(ETK_TABLE(table), image, l, r, t, b, ETK_TABLE_NONE, 3, 3);

		  ++l; ++r;

		  if (l == EX_DND_COL_NUM)
		    {
		       l = r = 0;
		       ++t; ++b;
		    }
	       }
	     ++i;
	  }
Exemple #5
0
/**
 * @brief Same as etk_table_attach() but with default settings: padding is set to 0 and
 * the fill policy is ETK_TABLE_EXPAND_FILL.
 * @param table a table
 * @param child the widget to attach
 * @param left_attach the column where the left side of the child will be attached (starting from 0)
 * @param right_attach the column where the right side of the child will be attached (starting from 0)
 * @param top_attach the row where the top side of the child will be attached (starting from 0)
 * @param bottom_attach the row where the bottom side of the child will be attached (starting from 0)
 */
void etk_table_attach_default(Etk_Table *table, Etk_Widget *child, int left_attach, int right_attach, int top_attach, int bottom_attach)
{
   etk_table_attach(table, child, left_attach, right_attach, top_attach, bottom_attach, ETK_TABLE_EXPAND_FILL, 0, 0);
}