Esempio n. 1
0
/* Menu_Item_Ckeck: Initializes the check menu item */
static void _etk_menu_item_check_constructor(Etk_Menu_Item_Check *check_item)
{
   Etk_Menu_Item *menu_item;

   if (!(menu_item = ETK_MENU_ITEM(check_item)))
      return;

   check_item->active = ETK_FALSE;
   check_item->toggled_handler = _etk_menu_item_check_toggled_handler;
   check_item->active_set = _etk_menu_item_check_active_set;

   menu_item->left_widget = etk_widget_new(ETK_WIDGET_TYPE,
      "theme-group", ETK_IS_MENU_ITEM_RADIO(check_item) ? "radiobox" : "checkbox",
      "theme-parent", check_item, "pass-mouse-events", ETK_TRUE, "visible", ETK_TRUE, NULL);
   etk_widget_parent_set(menu_item->left_widget, ETK_WIDGET(menu_item));
   etk_widget_swallow_widget(ETK_WIDGET(menu_item), "etk.swallow.left_widget", menu_item->left_widget);

   etk_widget_theme_signal_emit(ETK_WIDGET(menu_item), "etk,action,show,left_widget", ETK_TRUE);
   if (check_item->active)
      etk_widget_theme_signal_emit(menu_item->left_widget, "etk,state,on", ETK_FALSE);
   else
      etk_widget_theme_signal_emit(menu_item->left_widget, "etk,state,off", ETK_FALSE);

   etk_signal_connect_by_code(ETK_WIDGET_REALIZED_SIGNAL, ETK_OBJECT(menu_item->left_widget),
      ETK_CALLBACK(_etk_menu_item_check_box_realized_cb), menu_item);
   etk_signal_connect_by_code(ETK_MENU_ITEM_ACTIVATED_SIGNAL, ETK_OBJECT(menu_item),
      ETK_CALLBACK(_etk_menu_item_check_activated_cb), menu_item);
}
Esempio n. 2
0
boot_panel* bootpanel_create(main_window *win)
{
    boot_panel* pnl;
    Etk_Widget *scroll,*vbox, *hbox,*text,*frame;

    pnl = malloc(sizeof(boot_panel));
    pnl->win = win;

    vbox = etk_vbox_new(ETK_FALSE, 5);
    hbox = etk_hbox_new(ETK_FALSE, 5);

    pnl->frame = hbox;
    etk_box_append(ETK_BOX(hbox), vbox, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);

    scroll = etk_scrolled_view_new ();
    etk_box_append(ETK_BOX(vbox), scroll, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);
    etk_widget_show(scroll);

    pnl->eth_list = etk_tree_new();
    pnl->eth_col0 = etk_tree_col_new(ETK_TREE(pnl->eth_list), _("Interfaces"), 80, 0.0);
    etk_tree_col_model_add(pnl->eth_col0, etk_tree_model_checkbox_new());
    etk_tree_col_model_add(pnl->eth_col0, etk_tree_model_text_new());

    etk_signal_connect_by_code(ETK_TREE_COL_CELL_VALUE_CHANGED_SIGNAL,
            ETK_OBJECT(pnl->eth_col0),
            ETK_CALLBACK(bootpanel_ethlist_checkbox_change_cb), pnl);

    etk_tree_mode_set(ETK_TREE(pnl->eth_list), ETK_TREE_MODE_LIST);
    etk_tree_build(ETK_TREE(pnl->eth_list));
    etk_container_add(ETK_CONTAINER(scroll), pnl->eth_list);

    text = etk_text_view_new();
    etk_widget_size_request_set(text, -1, 150);
    etk_object_properties_set(ETK_OBJECT(text), "focusable", ETK_FALSE, NULL);
    etk_textblock_text_set(ETK_TEXT_VIEW(text)->textblock,
            _("<p align=\"center\"><style effect=glow color1=#fa14 color2=#fe87><b>Help!</b></style>"
                "\n<p>When your computer boot, exalt starts and configure yours networks interfaces in the background. If you use the DHCP, your interface will get a IP address after a while.</p>"
                "\n<p>You can have a problem if you use a daemon as nfs-client. If the daemon need a network connection when it starts and your interface has no IP address, the daemon will not work. To avoid this problem Exalt can configure your interface in the foreground. If you select the interface in the list, Exalt will wait until your interface gets a IP address.</p>"
                "\n<p>If the interface doesn't get a IP address before the timeout, your computer will continue the boot process.</p>"
             ),
            ETK_TRUE);
    etk_box_append(ETK_BOX(hbox), text, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);


    frame=etk_frame_new(_("Timeout"));
    etk_box_append(ETK_BOX(vbox), frame, ETK_BOX_START, ETK_BOX_FILL, 0);

    hbox = etk_hbox_new(ETK_FALSE, 5);
    etk_container_add(ETK_CONTAINER(frame), hbox);

    pnl->slider = etk_hslider_new(1,60,30,1,5);
    etk_box_append(ETK_BOX(hbox), pnl->slider, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);
    etk_slider_label_set(ETK_SLIDER(pnl->slider), "%.0f");
    etk_signal_connect_by_code(ETK_RANGE_VALUE_CHANGED_SIGNAL, ETK_OBJECT(pnl->slider), ETK_CALLBACK(bootpanel_slider_value_changed_cb), pnl);
    etk_slider_update_policy_set(ETK_SLIDER(pnl->slider), ETK_SLIDER_DELAYED);

    bootpanel_update_timeout(pnl);

    return pnl;
}
Esempio n. 3
0
/* Initializes the default values of the spinner */
static void _etk_spinner_constructor(Etk_Spinner *spinner)
{
   if (!spinner)
      return;

   spinner->digits = 0;
   strcpy(spinner->value_format, "%.0f");
   spinner->snap_to_ticks = ETK_FALSE;
   spinner->wrap = ETK_FALSE;
   spinner->step_timer = NULL;
   spinner->successive_steps = 0;
   spinner->editable_object = NULL;
   spinner->selection_dragging = ETK_FALSE;

   ETK_RANGE(spinner)->value_changed_handler = _etk_spinner_value_changed_handler;
   ETK_WIDGET(spinner)->size_allocate = _etk_spinner_size_allocate;

   etk_signal_connect_by_code(ETK_WIDGET_REALIZED_SIGNAL, ETK_OBJECT(spinner), ETK_CALLBACK(_etk_spinner_realized_cb), NULL);
   etk_signal_connect_by_code(ETK_WIDGET_UNREALIZED_SIGNAL, ETK_OBJECT(spinner), ETK_CALLBACK(_etk_spinner_unrealized_cb), NULL);
   etk_signal_connect_by_code(ETK_WIDGET_KEY_DOWN_SIGNAL, ETK_OBJECT(spinner), ETK_CALLBACK(_etk_spinner_key_down_cb), NULL);
   etk_signal_connect_by_code(ETK_WIDGET_KEY_UP_SIGNAL, ETK_OBJECT(spinner), ETK_CALLBACK(_etk_spinner_key_up_cb), NULL);
   etk_signal_connect_by_code(ETK_WIDGET_FOCUSED_SIGNAL, ETK_OBJECT(spinner), ETK_CALLBACK(_etk_spinner_focused_cb), NULL);
   etk_signal_connect_by_code(ETK_WIDGET_UNFOCUSED_SIGNAL, ETK_OBJECT(spinner), ETK_CALLBACK(_etk_spinner_unfocused_cb), NULL);
   etk_signal_connect_by_code(ETK_WIDGET_ENABLED_SIGNAL, ETK_OBJECT(spinner), ETK_CALLBACK(_etk_spinner_enabled_cb), NULL);
   etk_signal_connect_by_code(ETK_WIDGET_DISABLED_SIGNAL, ETK_OBJECT(spinner), ETK_CALLBACK(_etk_spinner_disabled_cb), NULL);
   etk_signal_connect_by_code(ETK_WIDGET_SELECTION_RECEIVED_SIGNAL, ETK_OBJECT(spinner),
         ETK_CALLBACK(_etk_spinner_selection_received_cb), NULL);
   etk_object_notification_callback_add(ETK_OBJECT(spinner), "step-increment",
         _etk_spinner_step_increment_changed_cb, NULL);
}
Esempio n. 4
0
/* Creates the window for the progress bar test */
void etk_test_progress_bar_window_create(void *data)
{
   static Etk_Widget *win;
   Etk_Widget *vbox;
   Etk_Widget *pbar;
   Etk_Widget *pbar2;

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

   win = etk_window_new();
   etk_window_title_set(ETK_WINDOW(win), "Etk Progress Bar Test");
   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_TRUE, 5);
   etk_container_add(ETK_CONTAINER(win), vbox);

   pbar = etk_progress_bar_new_with_text("0% done");
   etk_box_append(ETK_BOX(vbox), pbar, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);

   pbar2 = etk_progress_bar_new_with_text("Loading...");
   etk_progress_bar_pulse_step_set(ETK_PROGRESS_BAR(pbar2), 0.015);
   etk_box_append(ETK_BOX(vbox), pbar2, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);

   etk_widget_show_all(win);

   _etk_test_progress_bar_timer = ecore_timer_add(0.05, _etk_test_progress_bar_update, pbar);
   _etk_test_progress_bar_timer2 = ecore_timer_add(0.025, _etk_test_progress_bar_update2, pbar2);

   etk_signal_connect_swapped_by_code(ETK_OBJECT_DESTROYED_SIGNAL, ETK_OBJECT(pbar), ETK_CALLBACK(ecore_timer_del), _etk_test_progress_bar_timer);
   etk_signal_connect_swapped_by_code(ETK_OBJECT_DESTROYED_SIGNAL, ETK_OBJECT(pbar2), ETK_CALLBACK(ecore_timer_del), _etk_test_progress_bar_timer2);
}
Esempio n. 5
0
/* Initializes the members */
static void _etk_frame_constructor(Etk_Frame *frame)
{
   if (!frame)
      return;

   frame->label = NULL;
   etk_signal_connect_by_code(ETK_WIDGET_REALIZED_SIGNAL, ETK_OBJECT(frame), ETK_CALLBACK(_etk_frame_realized_cb), NULL);
}
Esempio n. 6
0
/* Initializes the members */
static void _etk_statusbar_constructor(Etk_Statusbar *statusbar)
{
   if (!statusbar)
      return;

   statusbar->has_resize_grip = ETK_TRUE;
   statusbar->msg_stack = NULL;
   statusbar->next_message_id = 0;
   statusbar->next_context_id = 0;

   etk_signal_connect_by_code(ETK_WIDGET_REALIZED_SIGNAL, ETK_OBJECT(statusbar), ETK_CALLBACK(_etk_statusbar_realized_cb), NULL);
}
Esempio n. 7
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);
}
Esempio n. 8
0
void etk_test_evas_object_window_create(void *data)
{
	Evas *evas;
	Evas_Object *edje_object;
	Evas_Object *evas_object;
	static Etk_Widget *window = NULL;
	Etk_Widget *vbox;
	Etk_Widget *frame;
	Etk_Widget *etk_evas_object;
	int w, h;

	if (window)
	{
		etk_widget_show_all(window);
		return;
	}

	window = etk_window_new();
  etk_signal_connect_by_code(ETK_WINDOW_DELETE_EVENT_SIGNAL, ETK_OBJECT(window), ETK_CALLBACK(etk_window_hide_on_delete), NULL);
	etk_window_title_set(ETK_WINDOW(window), "Etk-Evas Object Test");

	evas = etk_toplevel_evas_get(ETK_TOPLEVEL(window));

	vbox = etk_vbox_new(ETK_FALSE, 5);

	/* Add an edje object */
	frame = etk_frame_new("Edje Object");
	edje_object = edje_object_add(evas);
	edje_object_file_set(edje_object, PACKAGE_DATA_DIR"/test/clock.edj", "icon"); 
	edje_object_size_min_get(edje_object, &w, &h);
	edje_extern_object_min_size_set(edje_object, w, h);
	evas_object_resize(edje_object, w, h);
	etk_evas_object = etk_evas_object_new();
	etk_evas_object_set_object(ETK_EVAS_OBJECT(etk_evas_object), edje_object);
	etk_container_add(ETK_CONTAINER(frame), etk_evas_object);
	etk_box_append(ETK_BOX(vbox), frame, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);

	/* Add an evas rectangle */
	frame = etk_frame_new("Evas Object");
	evas_object = evas_object_rectangle_add(evas);
	evas_object_resize(evas_object, 150, 150);
	evas_object_color_set(evas_object, 150, 100, 100, 255);
	etk_evas_object = etk_evas_object_new();
	etk_evas_object_set_object(ETK_EVAS_OBJECT(etk_evas_object), evas_object);
	etk_container_add(ETK_CONTAINER(frame), etk_evas_object);
	etk_box_append(ETK_BOX(vbox), frame, ETK_BOX_END, ETK_BOX_EXPAND_FILL, 0);

	etk_container_add(ETK_CONTAINER(window), vbox);
	etk_widget_show_all(window);
}
Esempio n. 9
0
/**
 * @brief Associates a response-id to the button. This way, when the button will be clicked, the "response" signal
 * of the dialog will be emitted with this response-id. This function might be useful if you pack the button yourself,
 * without using etk_dialog_pack_button_in_action_area() or etk_dialog_button_add()
 * @param dialog a dialog
 * @param button the button to associate to the dialog and to the response-id
 * @param response_id the response-id to associate to the button
 * @note The button doesn't have to be packed in the dialog
 */
void etk_dialog_button_response_id_set(Etk_Dialog *dialog, Etk_Button *button, int response_id)
{
   int *id;

   if (!dialog || !button)
      return;

   id = malloc(sizeof(int));
   *id = response_id;
   etk_object_data_set_full(ETK_OBJECT(button), "_Etk_Dialog::Response_Id", id, free);

   etk_signal_disconnect_by_code(ETK_BUTTON_CLICKED_SIGNAL, ETK_OBJECT(button), ETK_CALLBACK(_etk_dialog_button_clicked_cb), dialog);
   etk_signal_connect_by_code(ETK_BUTTON_CLICKED_SIGNAL, ETK_OBJECT(button), ETK_CALLBACK(_etk_dialog_button_clicked_cb), dialog);
}
Esempio n. 10
0
/**
 * @brief Sets the toolbar's orientation (horizontal or vertical)
 * @param toolbar a toolbar
 * @param orientation the orientation to set
 */
void etk_toolbar_orientation_set(Etk_Toolbar *toolbar, Etk_Toolbar_Orientation orientation)
{
   Eina_List *children, *l;
   Etk_Widget *prev_box;

   if (!toolbar || toolbar->orientation == orientation)
      return;

   toolbar->reorientating = ETK_TRUE;
   prev_box = toolbar->box;
   toolbar->orientation = orientation;
   if (toolbar->orientation == ETK_TOOLBAR_VERT)
      toolbar->box = etk_vbox_new(ETK_FALSE, 0);
   else
      toolbar->box = etk_hbox_new(ETK_FALSE, 0);
   etk_widget_internal_set(toolbar->box, ETK_TRUE);
   etk_widget_show(toolbar->box);

   etk_signal_connect_by_code(ETK_CONTAINER_CHILD_ADDED_SIGNAL, ETK_OBJECT(toolbar->box), ETK_CALLBACK(_etk_toolbar_child_added_cb), toolbar);
   etk_signal_connect_by_code(ETK_CONTAINER_CHILD_REMOVED_SIGNAL, ETK_OBJECT(toolbar->box), ETK_CALLBACK(_etk_toolbar_child_removed_cb), NULL);


   children = etk_container_children_get(ETK_CONTAINER(prev_box));
   for (l = children; l; l = l->next)
      etk_toolbar_append(toolbar, ETK_WIDGET(l->data), ETK_BOX_START);
   eina_list_free(children);
   etk_object_destroy(ETK_OBJECT(prev_box));

   if (toolbar->orientation == ETK_TOOLBAR_VERT)
      etk_widget_theme_group_set(ETK_WIDGET(toolbar), "vtoolbar");
   else
      etk_widget_theme_group_set(ETK_WIDGET(toolbar), "htoolbar");
   etk_widget_parent_set(toolbar->box, ETK_WIDGET(toolbar));

   toolbar->reorientating = ETK_FALSE;
   etk_object_notify(ETK_OBJECT(toolbar), "orientation");
}
Esempio n. 11
0
/* Creates the window for the iconbox test */
void etk_test_iconbox_window_create(void *data)
{
   Etk_Widget *iconbox;

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

   win = etk_window_new();
   etk_window_title_set(ETK_WINDOW(win), "Etk Iconbox Test");
   etk_window_resize(ETK_WINDOW(win), 600, 330);
   etk_signal_connect_by_code(ETK_WINDOW_DELETE_EVENT_SIGNAL, ETK_OBJECT(win), ETK_CALLBACK(etk_window_hide_on_delete), NULL);

   iconbox = etk_iconbox_new();
   etk_iconbox_emblem_position_set(ETK_ICONBOX(iconbox), ETK_ICONBOX_EMBLEM_POSITION_TL);

   etk_container_add(ETK_CONTAINER(win), iconbox);
   etk_signal_connect_by_code(ETK_WIDGET_MOUSE_DOWN_SIGNAL, ETK_OBJECT(iconbox), ETK_CALLBACK(_etk_test_iconbox_mouse_down_cb), NULL);

   _etk_test_iconbox_folder_set(ETK_ICONBOX(iconbox), NULL);
   etk_widget_show_all(win);
}
Esempio n. 12
0
/* Initializes the members and build the toolbar */
static void _etk_toolbar_constructor(Etk_Toolbar *toolbar)
{
   if (!toolbar)
      return;

   toolbar->style = ETK_TOOLBAR_BOTH_VERT;
   toolbar->orientation = ETK_TOOLBAR_HORIZ;
   toolbar->stock_size = ETK_STOCK_MEDIUM;
   toolbar->reorientating = ETK_FALSE;

   ETK_WIDGET(toolbar)->size_request = _etk_toolbar_size_request;
   ETK_WIDGET(toolbar)->size_allocate = _etk_toolbar_size_allocate;
   ETK_CONTAINER(toolbar)->child_add = _etk_toolbar_child_add;
   ETK_CONTAINER(toolbar)->child_remove = _etk_toolbar_child_remove;
   ETK_CONTAINER(toolbar)->children_get = _etk_toolbar_children_get;

   toolbar->box = etk_hbox_new(ETK_FALSE, 0);
   etk_widget_parent_set(toolbar->box, ETK_WIDGET(toolbar));
   etk_widget_internal_set(ETK_WIDGET(toolbar->box), ETK_TRUE);
   etk_widget_show(toolbar->box);

   etk_signal_connect_by_code(ETK_CONTAINER_CHILD_ADDED_SIGNAL, ETK_OBJECT(toolbar->box), ETK_CALLBACK(_etk_toolbar_child_added_cb), toolbar);
   etk_signal_connect_by_code(ETK_CONTAINER_CHILD_REMOVED_SIGNAL, ETK_OBJECT(toolbar->box), ETK_CALLBACK(_etk_toolbar_child_removed_cb), NULL);
}
Esempio n. 13
0
/* Menu_Item: Initializes the menu item */
static void _etk_menu_item_constructor(Etk_Menu_Item *menu_item)
{
   if (!menu_item)
      return;

   menu_item->selected_handler = _etk_menu_item_selected_handler;
   menu_item->unselected_handler = _etk_menu_item_unselected_handler;
   menu_item->activated_handler = _etk_menu_item_activated_handler;

   menu_item->submenu = NULL;
   menu_item->parent_shell = NULL;
   menu_item->label = NULL;
   menu_item->left_widget = NULL;
   menu_item->is_selected = ETK_FALSE;

   etk_signal_connect_by_code(ETK_WIDGET_REALIZED_SIGNAL, ETK_OBJECT(menu_item), ETK_CALLBACK(_etk_menu_item_realized_cb), NULL);
}
Esempio n. 14
0
/* main etk_prefs dialog */
void etk_prefs_show()
{
   Etk_Widget *dialog; // initialize some widgets
   Etk_Widget *switch_button;
   Etk_Widget *notebook;
   
   /* main dialog to hold everything */
   dialog = etk_dialog_new();
   etk_window_title_set(ETK_WINDOW(dialog), _("Etk Preferences")); // set title - translatable
   etk_window_wmclass_set(ETK_WINDOW(dialog), "Etk Preferences", "Etk Preferences");
   etk_signal_connect_swapped_by_code(ETK_OBJECT_DESTROYED_SIGNAL, ETK_OBJECT(dialog),
				   ETK_CALLBACK(_etk_prefs_quit_cb), NULL);

   /* this will hold the current pref's contents */
   notebook = etk_notebook_new();
   etk_notebook_tabs_visible_set(ETK_NOTEBOOK(notebook), ETK_FALSE); 

   /* Some buttons */
   etk_dialog_button_add_from_stock(ETK_DIALOG(dialog), ETK_STOCK_DIALOG_CLOSE, ETK_RESPONSE_CLOSE);
   etk_dialog_button_add_from_stock(ETK_DIALOG(dialog), ETK_STOCK_DIALOG_APPLY, ETK_RESPONSE_APPLY);
   etk_dialog_button_add_from_stock(ETK_DIALOG(dialog), ETK_STOCK_DIALOG_OK, ETK_RESPONSE_OK);   
   etk_signal_connect("response", ETK_OBJECT(dialog), ETK_CALLBACK(_etk_prefs_response_cb), dialog);
   
   /* button for switching pages */
   switch_button = etk_button_new_with_label(_("Go to Engines page"));
   etk_signal_connect_by_code(ETK_BUTTON_CLICKED_SIGNAL, ETK_OBJECT(switch_button), ETK_CALLBACK(_etk_prefs_switch_cb), notebook);
   /* add the button into dialog action area */
   etk_dialog_pack_widget_in_action_area(ETK_DIALOG(dialog), switch_button, ETK_BOX_END, ETK_BOX_EXPAND, 0);  
   
   etk_container_border_width_set(ETK_CONTAINER(dialog), 5);
   etk_dialog_pack_in_main_area(ETK_DIALOG(dialog), notebook, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);
   
   /* create tabs */
   etk_notebook_page_append(ETK_NOTEBOOK(notebook), "Theme", _etk_prefs_theme_tab_create());
   etk_notebook_page_append(ETK_NOTEBOOK(notebook), "Engine", _etk_prefs_other_tab_create());
   
   etk_widget_show_all(dialog);
}
Esempio n. 15
0
/* Creates the window for the canvas test */
void etk_test_canvas_window_create(void *data)
{
   Etk_Widget *vbox;
   Etk_Widget *button;
	 int i;

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

   win = etk_window_new();
   etk_window_title_set(ETK_WINDOW(win), "Etk Canvas 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);

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

   canvas = etk_canvas_new();
   etk_widget_size_request_set(canvas, 500, 350);
   etk_box_append(ETK_BOX(vbox), canvas, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);

   button = etk_button_new_from_stock(ETK_STOCK_LIST_ADD);
   etk_button_label_set(ETK_BUTTON(button), "Add object");
   etk_signal_connect_swapped_by_code(ETK_BUTTON_CLICKED_SIGNAL, ETK_OBJECT(button), ETK_CALLBACK(_etk_test_canvas_object_add), canvas);
   etk_box_append(ETK_BOX(vbox), button, ETK_BOX_START, ETK_BOX_NONE, 0);

   /* add some progess bars to the canvas */
   for (i = 0; i < 3; i++)
   {
      _etk_test_canvas_progress_bars_create(50 + 50 * i, 50 + 50 * i);
   }

   etk_widget_show_all(win);
}
Esempio n. 16
0
/* Called when an event occurs on the resize grip of the statusbar */
static void _etk_statusbar_resize_grip_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
{
   Etk_Statusbar *statusbar;

   if (!(statusbar = ETK_STATUSBAR(data)))
      return;

   if (strcmp(emission, "mouse,in") == 0)
      etk_toplevel_pointer_push(etk_widget_toplevel_parent_get(ETK_WIDGET(statusbar)), ETK_POINTER_RESIZE_BR);
   else if (strcmp(emission, "mouse,out") == 0)
      etk_toplevel_pointer_pop(etk_widget_toplevel_parent_get(ETK_WIDGET(statusbar)), ETK_POINTER_RESIZE_BR);
   else if (strcmp(emission, "mouse,down,1") == 0)
   {
      Etk_Toplevel *window;

      if (!(window = etk_widget_toplevel_parent_get(ETK_WIDGET(statusbar))) || !ETK_IS_WINDOW(window))
         return;

      etk_window_geometry_get(ETK_WINDOW(window), NULL, NULL, &statusbar->window_width, &statusbar->window_height);
      etk_signal_connect_by_code(ETK_WIDGET_MOUSE_MOVE_SIGNAL, ETK_OBJECT(statusbar), ETK_CALLBACK(_etk_statusbar_mouse_move_cb), NULL);
   }
   else if (strcmp(emission, "mouse,up,1") == 0)
      etk_signal_disconnect_by_code(ETK_WIDGET_MOUSE_MOVE_SIGNAL, ETK_OBJECT(statusbar), ETK_CALLBACK(_etk_statusbar_mouse_move_cb), NULL);
}
Esempio n. 17
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);
}