Exemplo n.º 1
0
/* externally accessible functions */
EAPI Evas_Object *
e_widget_frametable_add(Evas *evas, const char *label, int homogenous)
{
   Evas_Object *obj, *o;
   E_Widget_Data *wd;
   Evas_Coord mw, mh;

   obj = e_widget_add(evas);

   e_widget_del_hook_set(obj, _e_wid_del_hook);
   e_widget_disable_hook_set(obj, _e_wid_disable_hook);
   wd = calloc(1, sizeof(E_Widget_Data));
   e_widget_data_set(obj, wd);

   o = edje_object_add(evas);
   wd->o_frame = o;
   e_theme_edje_object_set(o, "base/theme/widgets",
                           "e/widgets/frame");
   edje_object_part_text_set(o, "e.text.label", label);
   evas_object_show(o);
   e_widget_sub_object_add(obj, o);
   e_widget_resize_object_set(obj, o);

   o = e_table_add(evas);
   wd->o_table = o;
   e_table_homogenous_set(o, homogenous);
   edje_object_part_swallow(wd->o_frame, "e.swallow.content", o);
   e_widget_sub_object_add(obj, o);
   evas_object_show(o);

   edje_object_size_min_calc(wd->o_frame, &mw, &mh);
   e_widget_size_min_set(obj, mw, mh);

   return obj;
}
Exemplo n.º 2
0
/* externally accessible functions */
EAPI Evas_Object *
e_widget_label_add(Evas *evas, const char *label)
{
   Evas_Object *obj, *o;
   Evas_Coord mw, mh;
   E_Widget_Data *wd;
   
   obj = e_widget_add(evas);
   e_widget_del_hook_set(obj, _e_wid_del_hook);
   e_widget_disable_hook_set(obj, _e_wid_disable_hook);
   wd = calloc(1, sizeof(E_Widget_Data));
   e_widget_data_set(obj, wd);

   o = edje_object_add(evas);
   e_theme_edje_object_set(o, "base/theme/widgets",
			   "e/widgets/label");
   wd->text = o;
   edje_object_part_text_set(o, "e.text.label", label);
   evas_object_show(o);
   edje_object_size_min_calc(o, &mw, &mh);
   e_widget_can_focus_set(obj, 0);
   e_widget_size_min_set(obj, mw, mh);
   e_widget_sub_object_add(obj, o);
   e_widget_resize_object_set(obj, o);
      
   return obj;
}
Exemplo n.º 3
0
Evas_Object *
e_widget_spectrum_add(Evas *evas, E_Color_Component mode, E_Color *cv)
{
    Evas_Object *obj, *o;
    E_Widget_Data *wd;
    Evas_Coord mw, mh;

    obj = e_widget_add(evas);

    e_widget_del_hook_set(obj, _e_wid_del_hook);
    e_widget_focus_hook_set(obj, _e_wid_focus_hook);
    e_widget_disable_hook_set(obj, _e_wid_disable_hook);

    wd = calloc(1, sizeof(E_Widget_Data));
    e_widget_data_set(obj, wd);

    wd->cv = cv;
    wd->mode = mode;

    o = edje_object_add(evas);
    wd->o_edje = o;
    e_theme_edje_object_set(o, "base/theme/widgets",
                            "e/widgets/spectrum");

    evas_object_show(o);
    edje_object_size_min_calc(o, &mw, &mh);
    e_widget_size_min_set(obj, mw, mh);

    e_widget_sub_object_add(obj, o);
    evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_wid_focus_steal, obj);
    e_widget_resize_object_set(obj, o);
    evas_object_intercept_resize_callback_add(o, _e_wid_resize, wd);
    evas_object_intercept_move_callback_add(o, _e_wid_move, wd);

    o = e_spectrum_add(evas);
    e_spectrum_color_value_set(o, cv);
    e_spectrum_mode_set(o, mode);
    e_widget_sub_object_add(obj, o);
    evas_object_show(o);
    wd->o_spectrum = o;
    edje_object_part_swallow(wd->o_edje, "e.swallow.content", o);

    o = evas_object_rectangle_add(evas);
    evas_object_repeat_events_set(o, EINA_TRUE);
    evas_object_color_set(o, 0, 0, 0, 0);
    e_widget_sub_object_add(obj, o);
    evas_object_show(o);
    evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_wid_cb_down, obj);
    evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, _e_wid_cb_move, obj);
    evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, _e_wid_cb_up, obj);
    wd->o_event = o;

    e_widget_spectrum_update(obj, 0);

    return obj;
}
/**
 * Creates a new entry widget
 *
 * @param evas the evas where to add the new entry widget
 * @param text_location the location where to store the text of the entry.
 * @param func DOCUMENT ME!
 * @param data  DOCUMENT ME!
 * @param data2 DOCUMENT ME!
 * The current value will be used to initialize the entry
 * @return Returns the new entry widget
 */
EAPI Evas_Object *
e_widget_entry_add(Evas *evas, char **text_location, void (*func)(void *data, void *data2), void *data, void *data2)
{
   Evas_Object *obj, *o;
   E_Widget_Data *wd;
   Evas_Coord minw, minh;

   obj = e_widget_add(evas);

   e_widget_del_hook_set(obj, _e_wid_del_hook);
   e_widget_focus_hook_set(obj, _e_wid_focus_hook);
   e_widget_disable_hook_set(obj, _e_wid_disable_hook);

   wd = calloc(1, sizeof(E_Widget_Data));
   e_widget_data_set(obj, wd);
   wd->text_location = text_location;

   o = e_entry_add(evas);
   wd->o_entry = o;
   e_widget_sub_object_add(obj, o);
   e_widget_resize_object_set(obj, o);
   evas_object_show(o);

   evas_object_event_callback_add(o, EVAS_CALLBACK_KEY_DOWN, _e_wid_keydown, obj);
   evas_object_event_callback_add(o, EVAS_CALLBACK_MOVE, _e_wid_movresz, obj);
   evas_object_event_callback_add(o, EVAS_CALLBACK_RESIZE, _e_wid_movresz, obj);

   o = evas_object_rectangle_add(evas);
   wd->o_inout = o;
   evas_object_repeat_events_set(o, EINA_TRUE);
   evas_object_color_set(o, 0, 0, 0, 0);
   e_widget_sub_object_add(obj, o);
   evas_object_smart_member_add(o, obj);
   evas_object_show(o);

   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_wid_focus_steal, obj);
   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_IN, _e_wid_in, obj);
   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_OUT, _e_wid_out, obj);

   o = wd->o_entry;
   if ((text_location) && (*text_location))
     e_entry_text_set(o, *text_location);

   e_entry_size_min_get(o, &minw, &minh);
   e_widget_size_min_set(obj, minw, minh);
   evas_object_size_hint_min_set(obj, minw, minh);

   wd->func = func;
   wd->data = data;
   wd->data2 = data2;
   evas_object_smart_callback_add(o, "changed", _e_wid_changed_cb, obj);

   return obj;
}
Exemplo n.º 5
0
/* externally accessible functions */
EAPI Evas_Object *
e_widget_button_add(Evas *evas, const char *label, const char *icon, void (*func) (void *data, void *data2), void *data, void *data2)
{
   Evas_Object *obj, *o;
   E_Widget_Data *wd;
   Evas_Coord mw, mh;

   obj = e_widget_add(evas);

   e_widget_del_hook_set(obj, _e_wid_del_hook);
   e_widget_focus_hook_set(obj, _e_wid_focus_hook);
   e_widget_activate_hook_set(obj, _e_wid_activate_hook);
   e_widget_disable_hook_set(obj, _e_wid_disable_hook);
   wd = calloc(1, sizeof(E_Widget_Data));
   wd->func = func;
   wd->data = data;
   wd->data2 = data2;
   e_widget_data_set(obj, wd);

   o = edje_object_add(evas);
   wd->o_button = o;
   e_theme_edje_object_set(o, "base/theme/widgets",
			   "e/widgets/button");
   edje_object_signal_callback_add(o, "e,action,click", "", 
				   _e_wid_signal_cb1, obj);
   if ((label) && (label[0] != 0))
     {
	edje_object_part_text_set(o, "e.text.label", label);
	wd->type |= E_WIDGET_BUTTON_TEXT;
     }

   e_widget_sub_object_add(obj, o);
   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, 
				  _e_wid_focus_steal, obj);
   e_widget_resize_object_set(obj, o);
   evas_object_show(o);

   if (icon)
     {
	o = e_icon_add(evas);
	wd->o_icon = o;
	e_util_icon_theme_set(o, icon);
	edje_object_part_swallow(wd->o_button, "e.swallow.icon", o);
	e_widget_sub_object_add(obj, o);
	evas_object_show(o);
	wd->type |= E_WIDGET_BUTTON_ICON;
     }

   _e_wid_button_state_send(wd);
   edje_object_size_min_calc(wd->o_button, &mw, &mh);
   e_widget_size_min_set(obj, mw, mh);

   return obj;
}
Exemplo n.º 6
0
/* externally accessible functions */
EAPI Evas_Object *
e_widget_slider_add(Evas *evas, int horiz, int rev, const char *fmt, double min, double max, double step, int count, double *dval, int *ival, Evas_Coord size)
{
   Evas_Object *obj, *o;
   E_Widget_Data *wd;
   Evas_Coord mw, mh;

   obj = e_widget_add(evas);

   e_widget_del_hook_set(obj, _e_wid_del_hook);
   e_widget_focus_hook_set(obj, _e_wid_focus_hook);
   e_widget_disable_hook_set(obj, _e_wid_disable_hook);
   wd = calloc(1, sizeof(E_Widget_Data));
   e_widget_data_set(obj, wd);
   wd->o_widget = obj;

   o = e_slider_add(evas);
   wd->o_slider = o;
   evas_object_show(o);
   e_widget_sub_object_add(obj, o);
   e_widget_resize_object_set(obj, o);
   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_wid_focus_steal, obj);

   e_slider_orientation_set(o, horiz);
   e_slider_direction_set(o, rev);
   e_slider_value_range_set(o, min, max);
   e_slider_value_format_display_set(o, fmt);
   e_slider_value_step_count_set(o, count);
   e_slider_value_step_size_set(o, step);
   if (dval) e_slider_value_set(o, *dval);
   else if (ival) e_slider_value_set(o, *ival);

   e_slider_size_min_get(o, &mw, &mh);
   if (horiz)
     e_widget_size_min_set(obj, mw + size, mh);
   else
     e_widget_size_min_set(obj, mw, mh + size);

   wd->dval = dval;
   wd->ival = ival;
   evas_object_smart_callback_add(o, "changed", _e_wid_cb_changed, wd);

   return obj;
}
Exemplo n.º 7
0
/**  
 * Creates a check box widget
 *
 * @param evas pointer
 * @param label the text to asign to check widget
 * @param val pointer to int where changes are stored
 * @return the newly created evas object
 */
EAPI Evas_Object *
e_widget_check_add(Evas *evas, const char *label, int *val)
{
   Evas_Object *obj, *o;
   E_Widget_Data *wd;
   Evas_Coord mw, mh;

   obj = e_widget_add(evas);

   e_widget_del_hook_set(obj, _e_wid_del_hook);
   e_widget_focus_hook_set(obj, _e_wid_focus_hook);
   e_widget_activate_hook_set(obj, _e_wid_activate_hook);
   e_widget_disable_hook_set(obj, _e_wid_disable_hook);
   wd = calloc(1, sizeof(E_Widget_Data));
   wd->valptr = val;
   e_widget_data_set(obj, wd);

   o = edje_object_add(evas);
   wd->o_check = o;
   e_theme_edje_object_set(o, "base/theme/widgets",
                           "e/widgets/check");
   edje_object_signal_callback_add(o, "e,action,toggle", "*", _e_wid_signal_cb1, obj);
   edje_object_part_text_set(o, "e.text.label", label);
   evas_object_show(o);
   edje_object_size_min_calc(o, &mw, &mh);
   e_widget_size_min_set(obj, mw, mh);
   if (wd->valptr)
     {
        if (*(wd->valptr)) edje_object_signal_emit(o, "e,state,checked", "e");
     }

   e_widget_sub_object_add(obj, o);
   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_wid_focus_steal, obj);
   e_widget_resize_object_set(obj, o);

   return obj;
}
Exemplo n.º 8
0
/**  
 * Creates a check box widget with icon
 *
 * @param evas pointer
 * @param label the text to asign to check widget
 * @param icon the path to the icon file
 * @param icon_w the minimum wdith of the icon
 * @param icon_h the minumum height of the icon
 * @param val pointer to int where changes are stored
 * @return the newly created evas object
 */
EAPI Evas_Object *
e_widget_check_icon_add(Evas *evas, const char *label, const char *icon, int icon_w, int icon_h, int *val)
{
   Evas_Object *obj, *o, *o2;
   E_Widget_Data *wd;
   Evas_Coord mw, mh;

   obj = e_widget_add(evas);

   e_widget_del_hook_set(obj, _e_wid_del_hook);
   e_widget_focus_hook_set(obj, _e_wid_focus_hook);
   e_widget_activate_hook_set(obj, _e_wid_activate_hook);
   e_widget_disable_hook_set(obj, _e_wid_disable_hook);
   wd = calloc(1, sizeof(E_Widget_Data));
   wd->valptr = val;
   e_widget_data_set(obj, wd);

   o = edje_object_add(evas);
   wd->o_check = o;
   e_theme_edje_object_set(o, "base/theme/widgets",
                           "e/widgets/check_icon");
   edje_object_signal_callback_add(o, "e,action,toggle", "*", _e_wid_signal_cb1, obj);
   edje_object_part_text_set(o, "e.text.label", label);
   evas_object_show(o);
   if (label)
     {
        edje_object_signal_emit(o, "e,state,labeled", "e");
        edje_object_message_signal_process(o);
     }
   if (icon)
     {
        if (icon[0] == '/')
          {
             o2 = e_icon_add(evas);
             e_icon_file_set(o2, icon);
          }
        else
          {
             o2 = edje_object_add(evas);
             e_util_edje_icon_set(o2, icon);
          }
        evas_object_size_hint_min_set(o2, icon_w, icon_h);
        edje_object_part_swallow(wd->o_check, "e.swallow.icon", o2);
        evas_object_show(o2);
        e_widget_sub_object_add(obj, o2);
        wd->o_icon = o2;
     }

   edje_object_size_min_calc(o, &mw, &mh);
   e_widget_size_min_set(obj, mw, mh);
   if (wd->valptr)
     {
        if (*(wd->valptr)) edje_object_signal_emit(o, "e,state,checked", "e");
     }

   e_widget_sub_object_add(obj, o);
   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_wid_focus_steal, obj);
   e_widget_resize_object_set(obj, o);

   return obj;
}
/* Externally accessible functions */
EAPI Evas_Object *
e_widget_config_list_add(Evas *evas, Evas_Object * (*func_entry_add)(Evas * evas, char **val, void (*func)(void *data, void *data2), void *data, void *data2), const char *label, int listspan __UNUSED__)
{
   Evas_Object *obj, *o;
   E_Widget_Data *wd;
   Evas_Coord mw, mh;

   obj = e_widget_add(evas);
   e_widget_del_hook_set(obj, _e_wid_del_hook);
   e_widget_disable_hook_set(obj, _e_wid_disable_hook);
   wd = E_NEW(E_Widget_Data, 1);
   e_widget_data_set(obj, wd);

   o = e_widget_table_add(evas, 0);
   wd->gui.table = o;
   e_widget_sub_object_add(obj, o);

   o = e_widget_label_add(evas, label);
   e_widget_table_object_append(wd->gui.table, o, 0, 1, 2, 1, 1, 0, 1, 0);

   o = func_entry_add(evas, &(wd->cur_entry), NULL, NULL, NULL);
   wd->gui.entry = o;
   e_widget_disabled_set(o, 1);
   e_widget_size_min_set(o, 100, 25);
   e_widget_table_object_append(wd->gui.table, o, 0, 2, 2, 1, 1, 0, 1, 0);

   o = e_widget_button_add(evas, _("Add"), "list-add", _button_cb_add,
                           wd, obj);
   wd->gui.add = o;
   e_widget_disabled_set(o, 1);
   e_widget_table_object_append(wd->gui.table, o, 0, 3, 1, 1, 1, 0, 1, 0);

   o = e_widget_button_add(evas, _("Remove"), "list-remove",
                           _button_cb_remove, wd, obj);
   wd->gui.remove = o;
   e_widget_disabled_set(o, 1);
   e_widget_table_object_append(wd->gui.table, o, 1, 3, 1, 1, 1, 0, 1, 0);

   o = e_widget_ilist_add(evas, 0, 0, NULL);
   wd->gui.list = o;
   e_widget_disabled_set(o, 1);
   e_widget_size_min_set(o, 80, 40);
   e_widget_on_change_hook_set(o, _list_cb_change, wd);
   e_widget_ilist_go(o);
   e_widget_table_object_append(wd->gui.table, o, 0, 4, 2, 1, 1, 1, 1, 1);

   o = e_widget_button_add(evas, _("Up"), "go-up",
                           _button_cb_up, wd, NULL);
   wd->gui.up = o;
   e_widget_disabled_set(o, 1);
   e_widget_table_object_append(wd->gui.table, o, 0, 5, 1, 1, 1, 0, 1, 0);

   o = e_widget_button_add(evas, _("Down"), "go-down",
                           _button_cb_down, wd, NULL);
   wd->gui.down = o;
   e_widget_disabled_set(o, 1);
   e_widget_table_object_append(wd->gui.table, o, 1, 5, 1, 1, 1, 0, 1, 0);

   e_widget_size_min_get(wd->gui.table, &mw, &mh);
   e_widget_size_min_set(obj, mw, mh);
   e_widget_resize_object_set(obj, wd->gui.table);

   return obj;
}
Exemplo n.º 10
0
Evas_Object *
e_widget_cslider_add(Evas *evas, E_Color_Component mode, E_Color *color, int vertical, int fixed)
{
   Evas_Object *obj, *o;
   E_Widget_Data *wd;
   Evas_Coord mw, mh;

   obj = e_widget_add(evas);

   e_widget_del_hook_set(obj, _e_wid_del_hook);
   e_widget_focus_hook_set(obj, _e_wid_focus_hook);
   e_widget_disable_hook_set(obj, _e_wid_disable_hook);
   wd = calloc(1, sizeof(E_Widget_Data));
   e_widget_data_set(obj, wd);

   evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _e_wid_resize, wd);

   wd->vertical = vertical;
   wd->fixed = fixed;
   wd->mode = mode;
   wd->color = color;
   wd->prev = calloc(1, sizeof (E_Color));
   wd->o_hgrad = NULL;

   o = edje_object_add(evas);
   wd->o_cslider = o;
   e_theme_edje_object_set(o, "base/theme/widgets",
			   "e/widgets/cslider");
   if (wd->vertical)
     edje_object_signal_emit(o, "e,state,direction,v", "e");
   else
     edje_object_signal_emit(o, "e,state,direction,h", "e");
   evas_object_show(o);
   edje_object_size_min_calc(o, &mw, &mh);
   e_widget_size_min_set(obj, mw, mh);

   edje_object_signal_callback_add(wd->o_cslider, "drag,start", "*", _e_wid_cb_drag_start, obj);
   edje_object_signal_callback_add(wd->o_cslider, "drag", "*", _e_wid_cb_drag, obj);
   edje_object_signal_callback_add(wd->o_cslider, "drag,stop", "*", _e_wid_cb_drag_stop, obj);

   e_widget_sub_object_add(obj, o);
   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_wid_focus_steal, obj);
   e_widget_resize_object_set(obj, o);

   /* add gradient obj */
   o = evas_object_rectangle_add(evas);
   e_widget_sub_object_add(obj, o);
   /* evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_wid_cb_down, obj); */
   /* evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, _e_wid_cb_move, obj); */
   /* evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, _e_wid_cb_up, obj); */
   evas_object_color_set(o, 255, 255, 255, 255);
   wd->o_grad = o;

   edje_object_part_swallow(wd->o_cslider, "e.swallow.content", o);

   o = evas_object_rectangle_add(evas);
   e_widget_sub_object_add(obj, o);
   evas_object_event_callback_add(o, EVAS_CALLBACK_MOVE, _e_wid_move, wd);
   evas_object_show(o);
   evas_object_color_set(o, 0, 0, 0, 0);
   wd->o_event = o;

   _e_wid_update(wd);

   return obj;
}