Exemple #1
0
static void
_enum_display (Ewl_Widget *w, void *ev_data, void *user_data)
{
  Ecrin_Hash_Data *data;
  Ecrin_Enum      *e;
  Ecrin_Enum_Item *item;
  char             str[4096];

  data = (Ecrin_Hash_Data *)user_data;
  e = (Ecrin_Enum *)data->data;

  ewl_text_text_set (EWL_TEXT (text), data->efl_name);
  ewl_text_text_append (EWL_TEXT (text), "\n");
  ewl_text_text_append (EWL_TEXT (text), "\n");

  snprintf (str, 4096, "enum %s\n", e->name);
  ewl_text_text_append (EWL_TEXT (text), str);
  ewl_text_text_append (EWL_TEXT (text), "{\n");
  ecore_list_first_goto (e->items);
  while ((item = ecore_list_next (e->items)))
    {
      snprintf (str, 4096, "  %s", item->name);
      ewl_text_text_append (EWL_TEXT (text), str);
      if (item->value)
	snprintf (str, 4096, " = %s", item->value);
      ewl_text_text_append (EWL_TEXT (text), str);
      if (ecore_list_index (e->items) != ecore_list_count (e->items))
        ewl_text_text_append (EWL_TEXT (text), ",");
      ewl_text_text_append (EWL_TEXT (text), "\n");
    }
  ewl_text_text_append (EWL_TEXT (text), "};\n");
}
Exemple #2
0
void
eke_gui_ewl_feed_change(Eke *eke, Eke_Feed *feed)
{
    Eke_Gui_Ewl_Feed *disp;
    Eke_Feed_Item *item;
    Ewl_Widget *o;

    disp = ecore_hash_get(eke->feeds, feed);
    if (!disp->tab) {
        Ewl_Widget *o;

        disp->tab = ewl_text_new(feed->title);
        ewl_widget_show(disp->tab);

        o = ewl_vbox_new();
        ewl_notebook_page_append(EWL_NOTEBOOK(eke->gui.ewl.notebook),
                                                        disp->tab, o);
        ewl_widget_show(o);

        disp->page = ewl_scrollpane_new();
        ewl_container_child_append(EWL_CONTAINER(o), disp->page);
        ewl_object_insets_set(EWL_OBJECT(disp->page), 5, 5, 5, 5);
        ewl_widget_show(disp->page);
    }
    ewl_container_reset(EWL_CONTAINER(disp->page));

    ecore_list_first_goto(feed->items);
    while ((item = ecore_list_next(feed->items)) != NULL) {
        o = ewl_text_new(NULL);
        ewl_text_wrap_set(EWL_TEXT(o), 1);
        ewl_text_style_set(EWL_TEXT(o), "soft_shadow");
        ewl_text_text_set(EWL_TEXT(o), item->title);
        ewl_container_child_append(EWL_CONTAINER(disp->page), o);
        ewl_widget_show(o);

        if (item->link) {
            o = ewl_text_new(item->link);
            ewl_text_wrap_set(EWL_TEXT(o), 1);
            ewl_container_child_append(EWL_CONTAINER(disp->page), o);
            ewl_widget_show(o);
        }

        if (item->desc) {
            o = ewl_text_new(item->desc);
            ewl_text_wrap_set(EWL_TEXT(o), 1);
            ewl_container_child_append(EWL_CONTAINER(disp->page), o);
            ewl_widget_show(o);
        }

        o = ewl_text_new(" ");
        ewl_container_child_append(EWL_CONTAINER(disp->page), o);
        ewl_widget_show(o);
    }
}
void ethpanel_set_eth(eth_panel* pnl, char* interface)
{
    char name[100];
    char *str;

    EXALT_ASSERT_RETURN_VOID(pnl!=NULL);
    EXALT_ASSERT_RETURN_VOID(interface!=NULL);
    sprintf(name,_("Network card: %s"),interface);

    EXALT_FREE(pnl->interface);
    pnl->interface = strdup(interface);

    ewl_border_label_set(EWL_BORDER(pnl->frame),name);
    str = exalt_dbus_eth_get_ip(exalt_conn,interface);
    ewl_text_text_set(EWL_TEXT(pnl->entry_ip),str);
    EXALT_FREE(str);

    str = exalt_dbus_eth_get_netmask(exalt_conn, interface);
    ewl_text_text_set(EWL_TEXT(pnl->entry_mask),str);
    EXALT_FREE(str);

    str = exalt_dbus_eth_get_gateway(exalt_conn, interface);
    ewl_text_text_set(EWL_TEXT(pnl->entry_gateway),str);
    EXALT_FREE(str);

    if(exalt_dbus_eth_is_dhcp(exalt_conn, interface))
        ewl_radiobutton_checked_set(EWL_RADIOBUTTON(pnl->check_dhcp), TRUE);
    else
        ewl_radiobutton_checked_set(EWL_RADIOBUTTON(pnl->check_static), TRUE);

    str = exalt_dbus_eth_get_cmd(exalt_conn, interface);

    ewl_text_text_set(EWL_TEXT(pnl->entry_cmd),str);
    EXALT_FREE(str);

    ethpanel_disabled_set(pnl);
}
/*------------------------------*/
void
hover_icon_mouse_move_cb (Ewl_Widget * w, void *ev_data, void *user_data)
{
  entropy_gui_component_instance *instance = user_data;
  entropy_icon_viewer *viewer = instance->data;
  gui_file *local_file = ecore_hash_get (viewer->icon_hash, w);
  char buffer[1024];

  if (local_file->file && local_file->file->retrieved_stat) {
    snprintf (buffer, 1024, "File type: %s\nSize: %d kb",
	      local_file->file->mime_type,
	      (int) local_file->file->properties.st_size / 1024);
    ewl_text_text_set (EWL_TEXT (viewer->hover_properties), buffer);
  }


}
Exemple #5
0
static void
_function_display (Ewl_Widget *w, void *ev_data, void *user_data)
{
  Ecrin_Hash_Data      *data;
  Ecrin_Function       *function;
  Ecrin_Function_Param *param;
  char                  str[4096];
  char                  space[4096];
  
  data = (Ecrin_Hash_Data *)user_data;
  function = (Ecrin_Function *)data->data;

  ewl_text_text_set (EWL_TEXT (text), data->efl_name);
  ewl_text_text_append (EWL_TEXT (text), "\n");
  ewl_text_text_append (EWL_TEXT (text), "\n");

  snprintf (str, 4096, "%s %s (", function->return_type, function->name);
  ewl_text_text_append (EWL_TEXT (text), str);
  memset (space, ' ', 4096);
  space[strlen (str)] = '\0';
  ecore_list_first_goto (function->params);
  while ((param = ecore_list_next (function->params)))
    {
      if (ecore_list_index (function->params) != 1)
        ewl_text_text_append (EWL_TEXT (text), space);
      snprintf (str, 4096, "%s", param->type);
      ewl_text_text_append (EWL_TEXT (text), str);
      if (param->name)
        {
          snprintf (str, 4096, " %s", param->name);
          ewl_text_text_append (EWL_TEXT (text), str);
        }
      if (ecore_list_index (function->params) != ecore_list_count (function->params))
        {
          snprintf (str, 4096, ",\n");
          ewl_text_text_append (EWL_TEXT (text), str);
        }
      else
        {
          snprintf (str, 4096, ")\n");
          ewl_text_text_append (EWL_TEXT (text), str);
        }
    }
}
Exemple #6
0
static void
_define_display (Ewl_Widget *w, void *ev_data, void *user_data)
{
  Ecrin_Hash_Data *data;
  Ecrin_Define    *define;
  char             str[4096];
  char            *p;
  char            *iter;
  
  data = (Ecrin_Hash_Data *)user_data;
  define = (Ecrin_Define *)data->data;

  ewl_text_text_set (EWL_TEXT (text), data->efl_name);
  ewl_text_text_append (EWL_TEXT (text), "\n");
  ewl_text_text_append (EWL_TEXT (text), "\n");

  snprintf (str, 4096, "#define %s", define->name);
  ewl_text_text_append (EWL_TEXT (text), str);
  iter = define->value;
  if (define->value)
    {
      while ((p = strchr (iter, '\\')) != NULL)
        {
          char *string;
          int   l;
          
          l = p - iter;
          string = strndup (iter, l);
          snprintf (str, 4096, " %s\n", string);
          ewl_text_text_append (EWL_TEXT (text), str);
          free (string);
          iter = p + 1;
        } 
    }
  snprintf (str, 4096, " %s\n", iter);
  ewl_text_text_append (EWL_TEXT (text), str);
  remove_description (define->value);
}
Exemple #7
0
void cb_menu_key_down(Ewl_Widget *w, void *ev, void *data)
{
    Ewl_Widget *curwidget;
    char temp[50];
    Ewl_Event_Key_Down *e;
    e = (Ewl_Event_Key_Down*)ev;
    int k = translate_key(e);
    
    switch(k)
    {
    case 1:
        sprintf(temp,"menuitem1");
        curwidget=ewl_widget_name_find(temp);
        ewl_menu_cb_expand(curwidget,NULL,NULL);
        ewl_widget_focus_send(EWL_WIDGET(EWL_MENU(curwidget)->popup));
        int curpage=ewl_pdf_page_get(EWL_PDF(pdfwidget))+1;
        //sprintf(temp,"%d",curpage);
        ewl_text_text_set(EWL_TEXT(goto_entry),"");
        ewl_widget_focus_send(goto_entry);
        break;
    case 2:
        /*ewl_widget_hide(menu);
        opt_dlg_init();    
        ewl_window_transient_for(EWL_WINDOW(opt_dlg_widget_get()),EWL_WINDOW(win));
        ewl_widget_show(opt_dlg_widget_get());
        ewl_widget_focus_send(opt_dlg_widget_get());*/
        ewl_widget_hide(menu);
        OptionsDialog();
        
        break;
    case K_ESCAPE:
        ewl_widget_hide(menu);
        break;
    default:
        return;
    }
    
}
void ewl_frontend_dialog_config_open(Eli_App * eap)
{
    Ewl_Widget * o;
    Ewl_Widget * border_box;
    Ewl_Widget * hbox;
    Ewl_Widget * vbox;
    Ewl_Widget * main_box;
    Ewl_Widget * radio_b[2];

    /* one open config dialog should be enough */
    if (conf_win) return;
    /* Setup and show the configuration window */
    conf_win = ewl_dialog_new();
    ewl_dialog_action_position_set(EWL_DIALOG(conf_win), EWL_POSITION_BOTTOM);
    ewl_window_title_set(EWL_WINDOW(conf_win), _("Configuration"));
    ewl_window_name_set(EWL_WINDOW(conf_win), "Elitaire");
    ewl_window_class_set(EWL_WINDOW(conf_win), "Elitaire");
    ewl_window_leader_foreign_set(EWL_WINDOW(conf_win),
		    		EWL_EMBED_WINDOW(eap->main_win));
    ewl_callback_append(conf_win, EWL_CALLBACK_DELETE_WINDOW, destroy_cb,
                        NULL);
    ewl_dialog_has_separator_set(EWL_DIALOG(conf_win), 1);
    ewl_object_fill_policy_set(EWL_OBJECT(conf_win), EWL_FLAG_FILL_NONE);
    ewl_widget_show(conf_win);
    
    /* the main_box contain the border_boxes */
    ewl_dialog_active_area_set(EWL_DIALOG(conf_win), EWL_POSITION_TOP);
    main_box = ewl_vbox_new();
    ewl_container_child_append(EWL_CONTAINER(conf_win), main_box);
    ewl_object_fill_policy_set(EWL_OBJECT(main_box), EWL_FLAG_ALIGN_CENTER);
    ewl_widget_show(main_box);

    /* Setup and show the stock icons */
    ewl_dialog_active_area_set(EWL_DIALOG(conf_win), EWL_POSITION_BOTTOM);

    o = ewl_button_new();
    ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_CANCEL);
    ewl_container_child_append(EWL_CONTAINER(conf_win), o);
    ewl_callback_append(o, EWL_CALLBACK_CLICKED, conf_win_clicked_cb,
                        conf_win);
    ewl_widget_show(o);

    o = ewl_button_new();
    ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_APPLY);
    ewl_container_child_append(EWL_CONTAINER(conf_win), o);
    ewl_callback_append(o, EWL_CALLBACK_CLICKED, conf_win_clicked_cb,
                        conf_win);
    ewl_widget_show(o);

    o = ewl_button_new();
    ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_OK);
    ewl_container_child_append(EWL_CONTAINER(conf_win), o);
    ewl_callback_append(o, EWL_CALLBACK_CLICKED, conf_win_clicked_cb,
                        conf_win);
    ewl_widget_show(o);

    /* *** Graphic Box *** */
    /* Setup and show the border box */
    border_box = ewl_border_new();
    ewl_border_label_set(EWL_BORDER(border_box), _("Graphic"));
    ewl_container_child_append(EWL_CONTAINER(main_box), border_box);
    //ewl_object_fill_policy_set(EWL_OBJECT(border_box), EWL_FLAG_FILL_HFILL);
    ewl_widget_show(border_box);

    /* Setup and show the checkbuttons */
    o = ewl_checkbutton_new();
    ewl_button_label_set(EWL_BUTTON(o), _("animated movements"));
    ewl_container_child_append(EWL_CONTAINER(border_box), o);
    ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
    ewl_widget_show(o);
    config.animations = ecore_config_boolean_get("/graphic/animations");
    ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(o), config.animations);
    ewl_callback_append(o, EWL_CALLBACK_CLICKED, _check_selected, NULL);

    o = ewl_checkbutton_new();
    ewl_button_label_set(EWL_BUTTON(o), _("shadows"));
    ewl_container_child_append(EWL_CONTAINER(border_box), o);
    ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
    ewl_widget_show(o);
    config.shadows = ecore_config_boolean_get("/graphic/shadows");
    ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(o), config.shadows);
    ewl_callback_append(o, EWL_CALLBACK_CLICKED, _check_selected, NULL);

    /* Setup and show the velocity label and seeker */
    hbox = ewl_grid_new();
    ewl_container_child_append(EWL_CONTAINER(border_box), hbox);
    ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_FILL);
    ewl_grid_column_preferred_w_use(EWL_GRID(hbox), 1);
    ewl_widget_show(hbox);

    o = ewl_label_new();
    ewl_label_text_set(EWL_LABEL(o), _("velocity:"));
    ewl_container_child_append(EWL_CONTAINER(hbox), o);
    ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
    ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
    ewl_widget_show(o);

    o = ewl_label_new();
    ewl_container_child_append(EWL_CONTAINER(hbox), o);
    ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
    ewl_widget_show(o);
    config.vel_label = o;

    o = ewl_hseeker_new();
    config.velocity = ecore_config_int_get("velocity");
    ewl_range_minimum_value_set(EWL_RANGE(o), 200.0);
    ewl_range_maximum_value_set(EWL_RANGE(o), 800.0);
    ewl_range_step_set(EWL_RANGE(o), 60.0);
    ewl_range_value_set(EWL_RANGE(o), (double) config.velocity);
    ewl_widget_name_set(o, "velocity");
    ewl_container_child_append(EWL_CONTAINER(border_box), o);
    ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED, _hseeker_cb, NULL);
                          _hseeker_cb(o, NULL, NULL);
    ewl_widget_show(o);

    /* Setup and show the frame_rate label and seeker */
    hbox = ewl_grid_new();
    ewl_container_child_append(EWL_CONTAINER(border_box), hbox);
    ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_ALL);
    ewl_grid_column_preferred_w_use(EWL_GRID(hbox), 1);
    ewl_widget_show(hbox);

    o = ewl_label_new();
    ewl_label_text_set(EWL_LABEL(o), _("frame rate:"));
    ewl_container_child_append(EWL_CONTAINER(hbox), o);
    ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
    ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
    ewl_widget_show(o);
    
    o = ewl_label_new();
    ewl_container_child_append(EWL_CONTAINER(hbox), o);
    ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
    ewl_widget_show(o);
    config.frt_label = o;

    o = ewl_hseeker_new();
    config.frame_rate = ecore_config_int_get("frame_rate");
    ewl_range_minimum_value_set(EWL_RANGE(o), 10.0);
    ewl_range_maximum_value_set(EWL_RANGE(o), 100.0);
    ewl_range_step_set(EWL_RANGE(o), 10.0);
    ewl_range_value_set(EWL_RANGE(o), (double) config.frame_rate);
    ewl_widget_name_set(o, "frame_rate");
    ewl_container_child_append(EWL_CONTAINER(border_box), o);
    ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED, _hseeker_cb, NULL);
    _hseeker_cb(o, NULL, NULL);
    ewl_widget_show(o);

    /* *** Lazy Box *** */
    vbox = ewl_vbox_new();
    ewl_container_child_append(EWL_CONTAINER(main_box), vbox);
    ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_NORMAL);
    ewl_widget_show(vbox);

    border_box = ewl_border_new();
    ewl_container_child_append(EWL_CONTAINER(vbox), border_box);
    ewl_border_label_set(EWL_BORDER(border_box), _("Laziness"));
    ewl_widget_show(border_box);
    /* the radio buttons */
    config.lazy = ecore_config_int_get("lazy");
    radio_b[0] = ewl_radiobutton_new();
    ewl_button_label_set(EWL_BUTTON(radio_b[0]), _("normal mode"));
    ewl_object_alignment_set(EWL_OBJECT(radio_b[0]), EWL_FLAG_ALIGN_LEFT);
    ewl_container_child_append(EWL_CONTAINER(border_box), radio_b[0]);
    ewl_callback_append(radio_b[0], EWL_CALLBACK_CLICKED, _check_selected,
                        NULL);
    ewl_widget_show(radio_b[0]);

    radio_b[1] = ewl_radiobutton_new();
    ewl_button_label_set(EWL_BUTTON(radio_b[1]), _("lazy mode"));
    ewl_container_child_append(EWL_CONTAINER(border_box), radio_b[1]);
    ewl_object_alignment_set(EWL_OBJECT(radio_b[1]), EWL_FLAG_ALIGN_LEFT);
    ewl_radiobutton_chain_set(EWL_RADIOBUTTON(radio_b[1]),
                              EWL_RADIOBUTTON(radio_b[0]));
    ewl_callback_append(radio_b[1], EWL_CALLBACK_CLICKED, _check_selected,
                        NULL);
    ewl_widget_show(radio_b[1]);
    if (config.lazy)
        ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(radio_b[1]), 1);
    else
        ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(radio_b[0]), 1);

    /* *** Render Box *** */
    /* Setup and show the border box */
    border_box = ewl_border_new();
    ewl_border_label_set(EWL_BORDER(border_box), _("Render Engine"));
    ewl_container_child_append(EWL_CONTAINER(vbox), border_box);
    ewl_object_fill_policy_set(EWL_OBJECT(border_box), EWL_FLAG_FILL_FILL);
    ewl_object_alignment_set(EWL_OBJECT(border_box), EWL_FLAG_ALIGN_CENTER);
    ewl_object_alignment_set(EWL_OBJECT(main_box), EWL_FLAG_ALIGN_TOP);
    ewl_widget_show(border_box);

    o = ewl_text_new();
    ewl_text_text_set(EWL_TEXT(o), _("Changes only affect after new start"));
    ewl_container_child_append(EWL_CONTAINER(border_box), o);
    ewl_widget_show(o);

    /* the radio buttons */
    config.gl = ecore_config_boolean_get("/graphic/gl");
    radio_b[0] = ewl_radiobutton_new();
    ewl_button_label_set(EWL_BUTTON(radio_b[0]), _("Software"));
    ewl_container_child_append(EWL_CONTAINER(border_box), radio_b[0]);
    ewl_object_alignment_set(EWL_OBJECT(radio_b[0]), EWL_FLAG_ALIGN_LEFT);
    ewl_callback_append(radio_b[0], EWL_CALLBACK_CLICKED, _check_selected,
                        NULL);
    ewl_widget_show(radio_b[0]);

    radio_b[1] = ewl_radiobutton_new();
    ewl_button_label_set(EWL_BUTTON(radio_b[1]), _("OpenGL (testing)"));
    ewl_container_child_append(EWL_CONTAINER(border_box), radio_b[1]);
    ewl_object_alignment_set(EWL_OBJECT(radio_b[1]), EWL_FLAG_ALIGN_LEFT);
    ewl_radiobutton_chain_set(EWL_RADIOBUTTON(radio_b[1]),
                              EWL_RADIOBUTTON(radio_b[0]));
    ewl_callback_append(radio_b[1], EWL_CALLBACK_CLICKED, _check_selected,
                        NULL);
    ewl_widget_show(radio_b[1]);
    if (config.gl)
        ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(radio_b[1]), 1);
    else
        ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(radio_b[0]), 1);

}
void mime_add_dialog_show(char* type, char* exe) {
	Ewl_Widget* layout_box = ewl_vbox_new();
	Ewl_Widget* window = ewl_window_new();
	Ewl_Widget* hbox;
	
	Ewl_Widget* label;
	Ewl_Widget* button;
	
	ewl_widget_show(layout_box);
	ewl_object_minimum_size_set(EWL_OBJECT(window), 400, 150);
	ewl_container_child_append(EWL_CONTAINER(window), layout_box);


	/*---*/
	hbox = ewl_hbox_new();
	ewl_widget_show(hbox);
	ewl_container_child_append(EWL_CONTAINER(layout_box), hbox);

	label = ewl_label_new();
	ewl_label_text_set(EWL_LABEL(label), "MIME Type");
	ewl_widget_show(label);
	ewl_container_child_append(EWL_CONTAINER(hbox), label);

	entry_type = ewl_entry_new();
	if (type) ewl_text_text_set(EWL_TEXT(entry_type), type);
	ewl_container_child_append(EWL_CONTAINER(hbox), entry_type);
	ewl_widget_show(entry_type);
	/*---*/

	/*---*/
	hbox = ewl_hbox_new();
	ewl_widget_show(hbox);
	ewl_container_child_append(EWL_CONTAINER(layout_box), hbox);

	label = ewl_label_new();
	ewl_label_text_set(EWL_LABEL(label), "Action");
	ewl_widget_show(label);
	ewl_container_child_append(EWL_CONTAINER(hbox), label);

	entry_action = ewl_entry_new();
	if (exe) ewl_text_text_set(EWL_TEXT(entry_action), exe);	
	ewl_container_child_append(EWL_CONTAINER(hbox), entry_action);
	ewl_widget_show(entry_action);
	/*---*/

	
	hbox = ewl_hbox_new();
	ewl_widget_show(hbox);
	ewl_container_child_append(EWL_CONTAINER(layout_box), hbox);

	button = ewl_button_new();
	ewl_button_label_set(EWL_BUTTON(button), "Add");
	ewl_object_maximum_h_set(EWL_OBJECT(button), 15);
	ewl_callback_append(button, EWL_CALLBACK_CLICKED, mime_add_cb, window);
	ewl_container_child_append(EWL_CONTAINER(hbox), button);
	ewl_widget_show(button);

	button = ewl_button_new();
	ewl_button_label_set(EWL_BUTTON(button), "Cancel");
	ewl_object_maximum_h_set(EWL_OBJECT(button), 15);
	ewl_callback_append(button, EWL_CALLBACK_CLICKED, window_dismiss_cb, window);
	ewl_container_child_append(EWL_CONTAINER(hbox), button);
	ewl_widget_show(button);

	ewl_widget_show(window);
}
Exemple #10
0
static int
create_test(Ewl_Container *box)
{
        Ewl_Widget *o, *o2, *hbox;

        hbox = ewl_hbox_new();
        ewl_container_child_append(box, hbox);
        ewl_widget_show(hbox);

        o = ewl_icon_new();
        ewl_box_orientation_set(EWL_BOX(o), EWL_ORIENTATION_HORIZONTAL);
        ewl_icon_image_set(EWL_ICON(o), ewl_test_image_get("Draw.png"), NULL);
        ewl_icon_label_set(EWL_ICON(o), "Draw");
        ewl_container_child_append(EWL_CONTAINER(hbox), o);
        ewl_widget_show(o);

        o = ewl_icon_new();
        ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
        ewl_icon_image_set(EWL_ICON(o), ewl_test_image_get("Draw.png"), NULL);
        ewl_icon_label_set(EWL_ICON(o), "Fill None");
        ewl_container_child_append(EWL_CONTAINER(hbox), o);
        ewl_widget_show(o);

        o = ewl_icon_new();
        ewl_icon_image_set(EWL_ICON(o), ewl_test_image_get("Draw.png"), NULL);
        ewl_icon_label_set(EWL_ICON(o), "Draw");
        ewl_container_child_append(EWL_CONTAINER(hbox), o);
        ewl_widget_show(o);

        o = ewl_hseparator_new();
        ewl_container_child_append(EWL_CONTAINER(box), o);
        ewl_widget_show(o);

        o = ewl_icon_new();
        ewl_icon_image_set(EWL_ICON(o), ewl_test_image_get("Draw.png"), NULL);
        ewl_icon_label_set(EWL_ICON(o), "Draw (Editable)");
        ewl_icon_editable_set(EWL_ICON(o), TRUE);
        ewl_container_child_append(EWL_CONTAINER(box), o);
        ewl_widget_show(o);

        o = ewl_hseparator_new();
        ewl_container_child_append(EWL_CONTAINER(box), o);
        ewl_widget_show(o);

        o2 = ewl_text_new();
        ewl_text_text_set(EWL_TEXT(o2), "This icon has\nextended data\n set "
                                        "on it.\n\n That data is just \n"
                                        "text, but could\nbe any widget.");
        ewl_widget_show(o2);

        o = ewl_icon_new();
        ewl_icon_image_set(EWL_ICON(o), ewl_test_image_get("Draw.png"), NULL);
        ewl_icon_extended_data_set(EWL_ICON(o), o2);
        ewl_icon_label_set(EWL_ICON(o), "World");
        ewl_icon_type_set(EWL_ICON(o), EWL_ICON_TYPE_LONG);
        ewl_container_child_append(EWL_CONTAINER(box), o);
        ewl_widget_show(o);

        o = ewl_hseparator_new();
        ewl_container_child_append(EWL_CONTAINER(box), o);
        ewl_widget_show(o);

        o = ewl_icon_new();
        ewl_icon_image_set(EWL_ICON(o), ewl_test_image_get("Draw.png"), NULL);
        ewl_icon_label_set(EWL_ICON(o), "This is a long title that is compressed.");
        ewl_icon_label_compressed_set(EWL_ICON(o), TRUE);
        ewl_container_child_append(EWL_CONTAINER(box), o);
        ewl_widget_show(o);

        o = ewl_hseparator_new();
        ewl_container_child_append(EWL_CONTAINER(box), o);
        ewl_widget_show(o);

        o = ewl_icon_new();
        ewl_icon_image_set(EWL_ICON(o), ewl_test_image_get("Draw.png"), NULL);
        ewl_icon_label_set(EWL_ICON(o), "This is a long title that is compressed.");
        ewl_icon_label_compressed_set(EWL_ICON(o), TRUE);
        ewl_icon_editable_set(EWL_ICON(o), TRUE);
        ewl_container_child_append(EWL_CONTAINER(box), o);
        ewl_widget_show(o);

        o = ewl_hseparator_new();
        ewl_container_child_append(EWL_CONTAINER(box), o);
        ewl_widget_show(o);

        o = ewl_icon_new();
        ewl_icon_alt_text_set(EWL_ICON(o), "Icon Alt Text");
        ewl_container_child_append(EWL_CONTAINER(box), o);
        ewl_widget_show(o);

        return 1;
}
Exemple #11
0
static EWL_CALLBACK_DEFN(entry_value_changed)
{
	Ewler_Widget_Elem *elem = user_data;
	char *text;

	text = ewl_text_text_get(EWL_TEXT(elem->entry));

	if( !text )
		return;

	switch( elem->spec->type ) {
		case EWLER_SPEC_ELEM_INT:
			elem->info.ivalue = strtol(text, NULL, 0);
			IF_FREE(text);

			if( !elem->changed ) {
				Ewl_Widget *parent;
				char *label = ewl_text_text_get(EWL_TEXT(elem->text));

				parent = elem->text->parent;
				ewl_widget_destroy(elem->text);

				elem->text = ewl_text_new("");
				ewl_text_color_set(EWL_TEXT(elem->text), 255, 0, 0, 255);
				ewl_text_text_append(EWL_TEXT(elem->text), label);
				ewl_container_child_append(EWL_CONTAINER(parent), elem->text);
				ewl_widget_show(elem->text);
				FREE(label);
			}

			elem->changed = true;
			if( elem->spec->set_func )
				elem->spec->set_func(elem->w->w, elem->info.ivalue);
			break;
		case EWLER_SPEC_ELEM_STRING:
			if( elem->spec == name_spec ) {
				if( ewl_widget_name_find(text) ) {
					ewler_error("A widget already exists with the name %s", text);
					FREE(text);
					ewl_text_text_set(EWL_TEXT(elem->entry), elem->info.svalue);
					return;
				}

				form_rename_widget(elem->info.svalue, text);
			}

			elem->info.svalue = text;

			if( !elem->changed ) {
				int len;

				len = ewl_text_length_get(EWL_TEXT(elem->text));
				ewl_text_cursor_position_set(EWL_TEXT(elem->text), 0);
				ewl_text_color_apply(EWL_TEXT(elem->text), 255, 0, 0, 255, len);
			}

			elem->changed = true;
			if( elem->spec->set_func )
				elem->spec->set_func(elem->w->w, elem->info.svalue);
			break;
		default: break;
	}
}
void
gui_event_callback (entropy_notify_event * eevent, void *requestor, void *ret,
		    void *user_data)
{
  entropy_gui_component_instance *comp =
    (entropy_gui_component_instance *) user_data;

  switch (eevent->event_type) {
  case ENTROPY_NOTIFY_FILELIST_REQUEST_EXTERNAL:
  case ENTROPY_NOTIFY_FILELIST_REQUEST:{
      event_idle_processor *proc =
	entropy_malloc (sizeof (event_idle_processor));
      entropy_generic_file *event_file;
      entropy_file_request *request = eevent->data;	/*A file request's data is the dest dir */
      entropy_icon_viewer *view = comp->data;
      Ecore_Hash *tmp_gui_hash;
      Ecore_Hash *tmp_icon_hash;

      printf ("Icon viewer got a directory change order!\n");

      /*Keep a reference to our existing hash */
      tmp_gui_hash = view->gui_hash;
      tmp_icon_hash = view->icon_hash;
      view->gui_hash =
	ecore_hash_new (ecore_direct_hash, ecore_direct_compare);
      view->icon_hash =
	ecore_hash_new (ecore_direct_hash, ecore_direct_compare);

      /*Terminate our last load if we are still going...Not the most elegant solution, but there can only be 1 at once */
      if (view->last_processor)
	view->last_processor->terminate = 1;


      /*Setup the background processor object */
      //proc->eevent = eevent;
      proc->requestor = comp;
      proc->count = 0;
      proc->terminate = 0;
      proc->user_data = ecore_list_new ();
      view->last_processor = proc;

      ecore_list_first_goto (ret);
      while ((event_file = ecore_list_next (ret))) {
	//printf("Populating with '%s'\n", event_file->filename);
	entropy_core_file_cache_add_reference (event_file->md5);
	ecore_list_append (proc->user_data, event_file);
      }

      ecore_idle_enterer_add (idle_add_icons, proc);

      /*Set the current path from the event source... */
      snprintf (view->current_dir, 1024, "%s://%s/%s",
		request->file->uri_base, request->file->path,
		request->file->filename);


      /*Before we begin, see if our file hash is initialized, if so - we must destroy it first */
       /*TODO*/ gui_object_destroy_and_free (comp, tmp_gui_hash);
      ecore_hash_destroy (tmp_icon_hash);

      /*Clear the view, if there's anything to nuke */
      ewl_iconbox_clear (EWL_ICONBOX (view->iconbox));


      /*See if there is a custom BG image for this folder */
      if (entropy_config_str_get ("iconbox_viewer", view->current_dir)) {
	ewl_iconbox_background_set (EWL_ICONBOX (view->iconbox),
				    entropy_config_str_get ("iconbox_viewer",
							    view->
							    current_dir));
	view->default_bg = 0;
      }
      else {			/*if (!view->default_bg) { */
	ewl_iconbox_background_set (EWL_ICONBOX (view->iconbox), NULL);
	view->default_bg = 1;
      }

      /*Goto the root of the iconbox */
      ewl_iconbox_scrollpane_recalculate (EWL_ICONBOX (view->iconbox));
      ewl_iconbox_scrollpane_goto_root (EWL_ICONBOX (view->iconbox));

    }
    break;


  case ENTROPY_NOTIFY_THUMBNAIL_REQUEST:{
      /*Only bother if we have a thumbnail, and a component */
      if (ret && user_data) {
	gui_file *obj;
	entropy_thumbnail *thumb = (entropy_thumbnail *) ret;
	entropy_icon_viewer *view = comp->data;

	obj = ecore_hash_get (view->gui_hash, thumb->parent);

	if (obj) {
	  obj->thumbnail = thumb;

	  /*printf("Received callback notify from notify event..\n"); */
	  /*Make sure the icon still exists */
	  /*if (obj->icon) { */
	  ewl_iconbox_icon_image_set (EWL_ICONBOX_ICON (obj->icon),
				      obj->thumbnail->thumbnail_filename);

	  /*FIXME This is inefficient as all hell - find a better way to do this */
	  //ewl_iconbox_icon_arrange(EWL_ICONBOX(view->iconbox)); 
	}
	else {
	  //printf("ERR: Couldn't find a hash reference for this file!\n");
	}
      }
    }				//End case
    break;


  case ENTROPY_NOTIFY_FILE_CHANGE:{
      //printf ("Received file change event at icon viewer for file %s \n", ((entropy_generic_file*)ret)->filename);

    }
    break;

  case ENTROPY_NOTIFY_FILE_CREATE:{
      //printf ("Received file create event at icon viewer for file %s \n", ((entropy_generic_file*)ret)->filename);
      ewl_icon_local_viewer_add_icon (comp, (entropy_generic_file *) ret,
				      DO_MIME);
    }
    break;

  case ENTROPY_NOTIFY_FILE_REMOVE_DIRECTORY:
  case ENTROPY_NOTIFY_FILE_REMOVE:{
      printf ("Received a remove file notify\n");
      ewl_icon_local_viewer_remove_icon (comp, (entropy_generic_file *) ret);
    }
    break;

  case ENTROPY_NOTIFY_FILE_STAT_EXECUTED:{
      //printf("STAT EXECUTED Response back at ewl_icon_local_viewer\n");
    }
    break;

  case ENTROPY_NOTIFY_USER_INTERACTION_YES_NO_ABORT: {
	printf("Yes/No/Abort to file copy?\n");
	entropy_ewl_user_interaction_dialog_new((entropy_file_operation*)ret);
  }
  break;

  case ENTROPY_NOTIFY_FILE_STAT_AVAILABLE:{

      entropy_file_stat *file_stat = (entropy_file_stat *) eevent->return_struct;
      if (file_stat->file == NULL) {
	printf ("***** File stat file is null\n");
      }
      ewl_icon_local_viewer_show_stat (file_stat);


    }
    break;

  case ENTROPY_NOTIFY_FILE_PROGRESS:{
      entropy_icon_viewer *view = comp->data;
      entropy_file_progress *progress = ret;


      if (!view->progress->progress_window) {
	printf ("Showing progressbar dialog..\n");

	ewl_progress_window_create (view->progress);
	ewl_widget_show (view->progress->progress_window);
      }

      if (view->progress->progress_window) {
	ewl_text_text_set (EWL_TEXT (view->progress->file_from),
			   progress->file_from->filename);
	ewl_text_text_set (EWL_TEXT (view->progress->file_to),
			   progress->file_to->filename);
	ewl_progressbar_value_set (EWL_PROGRESSBAR
				   (view->progress->progressbar),
				   progress->progress);
      }

      /*Is it time to hide (i.e. end) */
      if (progress->type == TYPE_END) {
	printf ("Hiding progressbar dialog..\n");
	ewl_widget_destroy (view->progress->progress_window);
	view->progress->progress_window = NULL;
      }

    }
    break;

  }				//End switch

}
entropy_gui_component_instance *
entropy_plugin_gui_instance_new (entropy_core * core,
		     entropy_gui_component_instance * layout)
{
  Ewl_Widget *context;

  entropy_gui_component_instance *instance =
    entropy_gui_component_instance_new ();
  entropy_icon_viewer *viewer = entropy_malloc (sizeof (entropy_icon_viewer));

  /*Save a reference to our local data */
  instance->data = viewer;
  instance->layout_parent = layout;

  viewer->iconbox = ewl_iconbox_new ();
  viewer->default_bg = 0;
  instance->gui_object = viewer->iconbox;
  ewl_widget_show (EWL_WIDGET (viewer->iconbox));


  /*Initialise the progress window */
  viewer->progress = entropy_malloc (sizeof (entropy_file_progress_window));

  /*Init the file wait list */
  viewer->file_wait_list =
    ecore_hash_new (ecore_direct_hash, ecore_direct_compare);


  /*Add some context menu items */
  context = ewl_menu_item_new ();
  ewl_button_label_set (EWL_BUTTON (context), "New Directory");
  ewl_button_image_set (EWL_BUTTON (context),
			   PACKAGE_DATA_DIR
			   "/icons/e17_button_detail_new_dir.png",
			   NULL);
  ewl_iconbox_context_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);
  /*ewl_callback_append (context, EWL_CALLBACK_CLICKED,
		       ewl_iconbox_file_copy_cb, instance);*/
  ewl_widget_show (context);


  /*Add some context menu items */
  context = ewl_menu_item_new ();
  ewl_button_label_set (EWL_BUTTON (context), "Copy selection");
  ewl_button_image_set (EWL_BUTTON (context),
			   PACKAGE_DATA_DIR
			   "/icons/e17_button_detail_copy.png",
			   NULL);
  ewl_iconbox_context_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);
  ewl_callback_append (context, EWL_CALLBACK_CLICKED,
		       ewl_iconbox_file_copy_cb, instance);
  ewl_widget_show (context);

  /*Add some context menu items */
  context = ewl_menu_item_new ();
  ewl_button_label_set (EWL_BUTTON (context), "Paste");
  ewl_button_image_set (EWL_BUTTON (context),
			   PACKAGE_DATA_DIR
			   "/icons/e17_button_detail_paste.png", 
			   NULL);
  ewl_iconbox_context_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);
  ewl_callback_append (context, EWL_CALLBACK_CLICKED,
		       ewl_iconbox_file_paste_cb, instance);
  ewl_widget_show (context);

  /*Add some context menu items */
  context = ewl_separator_new ();
  ewl_iconbox_context_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);
  ewl_widget_show (context);

  /*Add some context menu items */
  context = ewl_menu_item_new ();
  ewl_button_label_set (EWL_BUTTON (context),
			  "Set custom folder background...");
  ewl_iconbox_context_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);
  ewl_callback_append (context, EWL_CALLBACK_CLICKED,
		       ewl_iconbox_background_set_cb, instance);
  ewl_widget_show (context);

  /*Add some context menu items */
  context = ewl_menu_item_new ();
  ewl_button_label_set (EWL_BUTTON (context),
			  "Remove current custom background");
  ewl_iconbox_context_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);
  ewl_callback_append (context, EWL_CALLBACK_CLICKED,
		       ewl_iconbox_background_remove_cb, instance);
  ewl_widget_show (context);

	/*---------------Icon Menu---------------*/

  /*Copy */
  context = ewl_menu_item_new ();
  ewl_button_label_set (EWL_BUTTON (context), "Copy");
  ewl_button_image_set (EWL_BUTTON (context),
			   PACKAGE_DATA_DIR
			   "/icons/e17_button_detail_copy.png",
			   NULL);
  ewl_widget_show (context);
  ewl_iconbox_icon_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);
  ewl_callback_append (context, EWL_CALLBACK_CLICKED,
		       ewl_iconbox_file_copy_cb, instance);
  //

  context = ewl_menu_item_new ();
  ewl_button_label_set (EWL_BUTTON (context), "Cut");
  ewl_button_image_set (EWL_BUTTON (context),
			   PACKAGE_DATA_DIR
			   "/icons/e17_button_detail_cut.png",
			   NULL);
  ewl_widget_show (context);
  ewl_iconbox_icon_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);
  //ewl_callback_append(context, EWL_CALLBACK_MOUSE_DOWN, icon_properties_cb, instance);


  /*Icon menu */
  context = ewl_menu_item_new ();
  ewl_button_label_set (EWL_BUTTON (context), "Rename");
  ewl_button_image_set (EWL_BUTTON (context),
			   PACKAGE_DATA_DIR
			   "/icons/e17_button_detail_rename.png",
			   NULL);
  ewl_callback_append (context, EWL_CALLBACK_CLICKED,
		       ewl_icon_local_viewer_menu_rename_cb, instance);
  ewl_widget_show (context);
  ewl_iconbox_icon_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);

  /*Icon menu */
  context = ewl_menu_item_new ();
  ewl_button_label_set (EWL_BUTTON (context), "Delete");
  ewl_button_image_set (EWL_BUTTON (context),
			   PACKAGE_DATA_DIR
			   "/icons/e17_button_detail_delete.png",
			   NULL);
  ewl_widget_show (context);
  ewl_iconbox_icon_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);
  ewl_callback_append (context, EWL_CALLBACK_CLICKED,
		       ewl_icon_local_viewer_menu_delete_cb, instance);

  /*Icon menu */
  context = ewl_menu_item_new ();
  ewl_button_label_set (EWL_BUTTON (context), "Properties");
  ewl_button_image_set (EWL_BUTTON (context),
			   PACKAGE_DATA_DIR
			   "/icons/e17_button_detail_properties.png",
			   NULL);
  ewl_widget_show (context);
  ewl_iconbox_icon_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);
  ewl_callback_append (context, EWL_CALLBACK_CLICKED, icon_properties_cb,
		       instance);

  /*Properties hover */
  viewer->hover_properties = ewl_text_new ();
  ewl_callback_append (viewer->hover_properties, EWL_CALLBACK_SHOW,
		       icon_hover_properties_show_cb, instance);
  ewl_text_text_set (EWL_TEXT (viewer->hover_properties),
		     "Filename: ewl_text.c\nSize: 50kb\nType: text/c-src");
	/*------------------------*/

  /*FIXME remove the hardocded var */
  ewl_iconbox_icon_size_custom_set (EWL_ICONBOX (viewer->iconbox), 60, 60);


  /*Init the hash */
  viewer->gui_hash = ecore_hash_new (ecore_direct_hash, ecore_direct_compare);
  viewer->icon_hash =
    ecore_hash_new (ecore_direct_hash, ecore_direct_compare);

  /*Set the core back reference */
  instance->core = core;

  /*Register out interest in receiving folder notifications */
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FOLDER_CHANGE_CONTENTS));
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FOLDER_CHANGE_CONTENTS_EXTERNAL));

  /*Register our interest in receiving file mod/create/delete notifications */
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FILE_CHANGE));
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FILE_CREATE));
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FILE_REMOVE));
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FILE_REMOVE_DIRECTORY));

  /*Register interest in getting stat events */
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FILE_STAT));
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FILE_STAT_AVAILABLE));

  /*We want to know about file transfer progress events */
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FILE_PROGRESS));

  /*We want to know if the backend needs feedback */
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_USER_INTERACTION_YES_NO_ABORT));

  /*We want to know about thumbnail available events */
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_THUMBNAIL_AVAILABLE));

  ewl_iconbox_controlled_key_callback_register (viewer->iconbox,
						ewl_icon_local_viewer_key_event_cb,
						instance);
  return instance;
}
Exemple #14
0
static EWL_CALLBACK_DEFN(realize)
{
	Ewler_Widget *ewler_w = user_data;
	Ecore_List *elems;
	Ewler_Widget_Elem *elem;
	char *name;
	void *args[4];
	int i, n;

	if( ewler_w->selected )
		widget_select(ewler_w);

	elems = ecore_hash_keys(ewler_w->elems);

	while( (name = ecore_list_next(elems)) ) {
		elem = ecore_hash_get(ewler_w->elems, name);

		if( elem->spec->get_func )
			switch( elem->spec->type ) {
				case EWLER_SPEC_ELEM_INT:
					elem->info.ivalue = (int) elem->spec->get_func(ewler_w->w);

					if( elem->entry ) {
						ewl_text_text_set(EWL_TEXT(elem->entry), "");
						ewl_text_text_append(EWL_TEXT(elem->entry), elem_to_s(elem));
					}
					break;
				case EWLER_SPEC_ELEM_STRING:
					IF_FREE(elem->info.svalue);
					elem->info.svalue = (char *) elem->spec->get_func(ewler_w->w);

					if( elem->entry )
						ewl_text_text_set(EWL_TEXT(elem->entry), elem_to_s(elem));
					break;
				case EWLER_SPEC_ELEM_STRUCT:
					n = elem->spec->info.children->nodes;
					for( i=0;i<n;i++ )
						args[i] = elem_at_index(elem->info.children, i);

					switch( n ) {
						case 1: elem->spec->get_func(ewler_w->w, args[0]); break;
						case 2: elem->spec->get_func(ewler_w->w, args[0], args[1]); break;
						case 3:
							elem->spec->get_func(ewler_w->w, args[0], args[1], args[2]);
							break;
						case 4:
							elem->spec->get_func(ewler_w->w,
																	 args[0], args[1], args[2], args[3]);
							break;
						/* haven't seen anything higher just yet */
					}
					break;
				case EWLER_SPEC_ELEM_ENUM:
					elem->info.evalue = (int) elem->spec->get_func(ewler_w->w);

					if( elem->entry ) {
						Ewl_Widget *item;

						item = ecore_hash_get(elem->items, (void *) elem->info.evalue);
						ewl_combo_selected_set(EWL_COMBO(elem->entry), item);
					}
					break;
				default: break;
			}
		else if(elem->spec->type == EWLER_SPEC_ELEM_STRUCT)
			/* iterate through children, since we don't have a mass get */;
	}

	ecore_list_destroy(elems);
}
Exemple #15
0
static EWL_CALLBACK_DEFN(configure)
{
	Ewler_Widget *ewler_w = user_data;
	Ewler_Widget_Elem *preferred, *current, *elem;
	int x, y, height, width;
	int pref_w, pref_h;

	if( !REALIZED(ewler_w->w) )
		return;

	if( ewler_w->selected ) {
		ewl_widget_layer_set(ewler_w->fg, 1000);
		ewl_widget_layer_set(ewler_w->bg, -1);
		ewl_widget_layer_set(ewler_w->w, 1);
	} else if( ewler_w->parent ) {
		ewl_widget_layer_set(ewler_w->bg, -1);
		ewl_widget_layer_set(ewler_w->w, 1);
	}

	ewl_object_current_geometry_get(EWL_OBJECT(ewler_w->w),
																	&x, &y, &width, &height);
	ewl_object_preferred_inner_size_get(EWL_OBJECT(ewler_w->w), &pref_w, &pref_h);

	current = ecore_hash_get(ewler_w->elems, "current");

	elem = ecore_hash_get(current->info.children, "x");
	if( elem->info.ivalue != x ) {
		if( elem->text && !elem->changed ) {
			int len;

			len = ewl_text_length_get(EWL_TEXT(elem->text));
			ewl_text_cursor_position_set(EWL_TEXT(elem->text), 0);
			ewl_text_color_apply(EWL_TEXT(elem->text), 255, 0, 0, 255, len);
		}

		elem->info.ivalue = x;

		elem->changed = true;
		if( elem->entry )
			ewl_text_text_set(EWL_TEXT(elem->entry), elem_to_s(elem));
	}

	elem = ecore_hash_get(current->info.children, "y");
	if( elem->info.ivalue != y ) {
		if( elem->text && !elem->changed ) {
			int len;

			len = ewl_text_length_get(EWL_TEXT(elem->text));
			ewl_text_cursor_position_set(EWL_TEXT(elem->text), 0);
			ewl_text_color_apply(EWL_TEXT(elem->text), 255, 0, 0, 255, len);
		}

		elem->info.ivalue = y;

		elem->changed = true;
		if( elem->entry )
			ewl_text_text_set(EWL_TEXT(elem->entry), elem_to_s(elem));
	}

	elem = ecore_hash_get(current->info.children, "w");
	if( elem->info.ivalue != width ) {
		if( elem->text && !elem->changed ) {
			int len;

			len = ewl_text_length_get(EWL_TEXT(elem->text));
			ewl_text_cursor_position_set(EWL_TEXT(elem->text), 0);
			ewl_text_color_apply(EWL_TEXT(elem->text), 255, 0, 0, 255, len);
		}

		elem->info.ivalue = width;

		elem->changed = true;
		if( elem->entry )
			ewl_text_text_set(EWL_TEXT(elem->entry), elem_to_s(elem));
	}

	elem->info.ivalue = width;

	elem = ecore_hash_get(current->info.children, "h");
	if( elem->info.ivalue != height ) {
		if( elem->text && !elem->changed ) {
			int len;

			len = ewl_text_length_get(EWL_TEXT(elem->text));
			ewl_text_cursor_position_set(EWL_TEXT(elem->text), 0);
			ewl_text_color_apply(EWL_TEXT(elem->text), 255, 0, 0, 255, len);
		}

		elem->info.ivalue = height;

		elem->changed = true;
		if( elem->entry )
			ewl_text_text_set(EWL_TEXT(elem->entry), elem_to_s(elem));
	}

	preferred = ecore_hash_get(ewler_w->elems, "preferred");

	elem = ecore_hash_get(preferred->info.children, "w");
	if( elem->info.ivalue != pref_w ) {
		if( elem->text && !elem->changed ) {
			int len;

			len = ewl_text_length_get(EWL_TEXT(elem->text));
			ewl_text_cursor_position_set(EWL_TEXT(elem->text), 0);
			ewl_text_color_apply(EWL_TEXT(elem->text), 255, 0, 0, 255, len);
		}

		elem->info.ivalue = pref_w;

		elem->changed = true;
		if( elem->entry )
			ewl_text_text_set(EWL_TEXT(elem->entry), elem_to_s(elem));
	}

	elem = ecore_hash_get(preferred->info.children, "h");
	if( elem->info.ivalue != pref_h ) {
		if( elem->text && !elem->changed ) {
			int len;

			len = ewl_text_length_get(EWL_TEXT(elem->text));
			ewl_text_cursor_position_set(EWL_TEXT(elem->text), 0);
			ewl_text_color_apply(EWL_TEXT(elem->text), 255, 0, 0, 255, len);
		}

		elem->info.ivalue = pref_h;

		elem->changed = true;
		if( elem->entry )
			ewl_text_text_set(EWL_TEXT(elem->entry), elem_to_s(elem));
	}

	if( !ewler_w->configured ) {
		ewl_object_geometry_request(EWL_OBJECT(ewler_w->fg), x, y, width, height);
		ewl_object_geometry_request(EWL_OBJECT(ewler_w->bg), x, y, width, height);
	}

	ewler_w->configured = false;

	elem->info.ivalue = height;
}
Exemple #16
0
void ewl_entropy_tip_window_tip_next_cb(Ewl_Widget* w, void* ev_data, void* user_data) {
    char* tip = ewl_entropy_tip_window_tip_next();
    ewl_text_text_set(EWL_TEXT(text_tip), tip);
}