Enlightenment CVS committal Author : rbdpngn Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_entry.c ewl_widget.c ewl_widget.h Log Message: API for named widgets. =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_entry.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -3 -r1.13 -r1.14 --- ewl_entry.c 4 May 2005 05:40:05 -0000 1.13 +++ ewl_entry.c 7 May 2005 23:51:35 -0000 1.14 @@ -243,8 +243,8 @@ op = ewl_entry_op_text_set_new(text); ewl_entry_op_prune_list(e, EWL_ENTRY_OP_TYPE_TEXT_SET, - EWL_ENTRY_OP_TYPE_TEXT_DELETE, - EWL_ENTRY_OP_TYPE_NONE, EWL_ENTRY_OP_TYPE_NONE); + EWL_ENTRY_OP_TYPE_TEXT_DELETE, + EWL_ENTRY_OP_TYPE_NONE, EWL_ENTRY_OP_TYPE_NONE); ecore_dlist_append(e->ops, op); if (REALIZED(e)) ewl_entry_ops_apply(e); @@ -253,7 +253,8 @@ if (text) { e->text = strdup(text); e->length = strlen(text); - } else + } + else e->length = 0; if (e->cursor) @@ -484,6 +485,35 @@ } /** + * @param e: the entry widget to retrieve the current color + * @brief Retrieve the color of the currently used font. + * @return Returns no value. + */ +void ewl_entry_color_get(Ewl_Entry *e, int *a, int *r, int *g, int *b) +{ + Ewl_Entry_Op *op; + Ewl_Entry_Op_Color *opc; + + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR("e", e); + + op = ewl_entry_op_relevant_find(e, EWL_ENTRY_OP_TYPE_COLOR_SET); + opc = (Ewl_Entry_Op_Color *)op; + if (opc) { + if (a) + *a = opc->a; + if (r) + *r = opc->r; + if (g) + *g = opc->g; + if (b) + *b = opc->b; + } + + DLEAVE_FUNCTION(DLEVEL_STABLE); +} + +/** * @param e: the entry widget to change font * @param font: the name of the font * @param size: the size of the font @@ -2198,6 +2228,8 @@ Ewl_Entry_Op_Type bend) { Ewl_Entry_Op *op; + if (!e->ops) + DRETURN(DLEVEL_STABLE); ecore_dlist_goto_last(e->ops); while ((op = ecore_dlist_current(e->ops))) { =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_widget.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- ewl_widget.c 28 Mar 2005 07:04:29 -0000 1.3 +++ ewl_widget.c 7 May 2005 23:51:35 -0000 1.4 @@ -7,6 +7,8 @@ Ewl_Widget *last_focused = NULL; Ewl_Widget *dnd_widget = NULL; +Ecore_Hash *name_table = NULL; + static void ewl_widget_theme_padding_get(Ewl_Widget *w, int *l, int *r, int *t, int *b); static void ewl_widget_theme_insets_get(Ewl_Widget *w, int *l, int *r, @@ -106,6 +108,59 @@ } /** + * @param w: the widget to name + * @param name: the new name for the widget + * @return Returns no value. + * @brief Name the specified widget. + */ +void ewl_widget_name_set(Ewl_Widget * w, char *name) +{ + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR("w", w); + + if (!name_table) + name_table = ecore_hash_new(ecore_str_hash, ecore_str_compare); + + IF_FREE(w->name); + w->name = strdup(name); + if (name_table) + ecore_hash_set(name_table, w->name, w); + + DLEAVE_FUNCTION(DLEVEL_STABLE); +} + +/** + * @param w: the widget to retrieve the name + * @return Returns an pointer to an allocated name string on success. + * @brief Get the name for the specified widget. + */ +char *ewl_widget_name_get(Ewl_Widget * w) +{ + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR_RET("w", w, NULL); + + DRETURN_PTR(w->name ? strdup(w->name) : NULL, DLEVEL_STABLE); +} + +/** + * @param name: the name of the widget to retrieve + * @return Returns an pointer a matched widget on success. + * @brief Find a widget identified by a name. + */ +Ewl_Widget *ewl_widget_name_find(char * name) +{ + Ewl_Widget *match = NULL; + + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR_RET("name", name, NULL); + + if (name_table) + match = ecore_hash_get(name_table, name); + + DRETURN_PTR(match, DLEVEL_STABLE); +} + +/** * @param w: the widget to realize * @return Returns no value. * @brief Realize the specified widget. @@ -951,6 +1006,7 @@ * Free up appearance related information */ ewl_theme_widget_shutdown(w); + IF_FREE(w->name); IF_FREE(w->appearance); /* =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_widget.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- ewl_widget.h 10 Apr 2005 05:24:09 -0000 1.3 +++ ewl_widget.h 7 May 2005 23:51:35 -0000 1.4 @@ -52,6 +52,7 @@ Evas_Object *fx_clip_box; /**< Clipping rectangle of widget */ Evas_Object *theme_object; /**< Appearance shown on canvas */ + char *name; /**< Unique identifier for this widget */ char *bit_state; /**< State of the appaarance */ char *appearance; /**< Key to lookup appearance in theme */ char *inheritance; /**< Key to lookup inhertiance of widget */ @@ -67,6 +68,21 @@ int ewl_widget_init(Ewl_Widget * w, char *appearance); /* + * Assign the given name to a widget + */ +void ewl_widget_name_set(Ewl_Widget * w, char *name); + +/* + * Retrieve the given name of a widget + */ +char * ewl_widget_name_get(Ewl_Widget * w); + +/* + * Find the widget identified by a given name. + */ +Ewl_Widget * ewl_widget_name_find(char *name); + +/* * Signal the widget that it's parent has changed. */ void ewl_widget_reparent(Ewl_Widget * widget); ------------------------------------------------------- This SF.Net email is sponsored by: NEC IT Guy Games. Get your fingers limbered up and give it your best shot. 4 great events, 4 opportunities to win big! Highest score wins.NEC IT Guy Games. Play to win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs