Enlightenment CVS committal Author : rbdpngn Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_callback.c ewl_label.c ewl_label.h ewl_menu_item.c ewl_tree.c ewl_widget.c ewl_widget.h Log Message: Reduce the limit on callbacks of each type on a widget. Add the matching get calls for the appearance text setting. Change some default alignments. Complete the transition of the label to use only the widget text parts. =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_callback.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -3 -r1.16 -r1.17 --- ewl_callback.c 31 Jan 2006 16:37:09 -0000 1.16 +++ ewl_callback.c 14 Feb 2006 05:50:02 -0000 1.17 @@ -191,7 +191,7 @@ DCHECK_PARAM_PTR_RET("cb", cb, 0); DCHECK_TYPE_RET("w", w, EWL_WIDGET_TYPE, 0); - if (EWL_CALLBACK_LEN(w, t) == 65535) { + if (EWL_CALLBACK_LEN(w, t) == 255) { DERROR("Maximum number of callbacks of one type exceeded on a widget\n"); DRETURN_INT(0, DLEVEL_STABLE); } =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_label.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -3 -r1.16 -r1.17 --- ewl_label.c 12 Jan 2006 18:21:18 -0000 1.16 +++ ewl_label.c 14 Feb 2006 05:50:02 -0000 1.17 @@ -3,8 +3,6 @@ #include "ewl_macros.h" #include "ewl_private.h" -static void ewl_label_apply(Ewl_Label *la); - /** * @return Returns a new Ewl_Widget if successful, NULL on failure * @brief Creates a new Ewl_Label widget with the @a text text in it @@ -48,11 +46,9 @@ ewl_widget_appearance_set(w, EWL_LABEL_TYPE); ewl_widget_inherit(w, EWL_LABEL_TYPE); - ewl_object_fill_policy_set(EWL_OBJECT(la), EWL_FLAG_FILL_FILL); + ewl_object_fill_policy_set(EWL_OBJECT(la), EWL_FLAG_FILL_NONE); ewl_widget_focusable_set(w, FALSE); - ewl_callback_prepend(w, EWL_CALLBACK_DESTROY, ewl_label_destroy_cb, NULL); - DRETURN_INT(TRUE, DLEVEL_STABLE); } @@ -69,11 +65,7 @@ DCHECK_PARAM_PTR("la", la); DCHECK_TYPE("la", la, EWL_LABEL_TYPE); - IF_FREE(la->text); - if (text) la->text = strdup(text); - else la->text = strdup(""); - - ewl_label_apply(la); + ewl_widget_appearance_text_set(EWL_WIDGET(la), (char *)text); DLEAVE_FUNCTION(DLEVEL_STABLE); } @@ -90,45 +82,5 @@ DCHECK_PARAM_PTR_RET("la", la, NULL); DCHECK_TYPE_RET("la", la, EWL_LABEL_TYPE, NULL); - DRETURN_PTR(la->text, DLEVEL_STABLE); -} - -void -ewl_label_realize_cb(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__) -{ - DENTER_FUNCTION(DLEVEL_STABLE); - DCHECK_PARAM_PTR("w", w); - DCHECK_TYPE("w", w, EWL_WIDGET_TYPE); - - ewl_label_apply(EWL_LABEL(w)); - - DLEAVE_FUNCTION(DLEVEL_STABLE); -} - -void -ewl_label_destroy_cb(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__) -{ - Ewl_Label *label; - - DENTER_FUNCTION(DLEVEL_STABLE); - DCHECK_PARAM_PTR("w", w); - DCHECK_TYPE("w", w, EWL_WIDGET_TYPE); - - label = EWL_LABEL(w); - IF_FREE(label->text); - - DLEAVE_FUNCTION(DLEVEL_STABLE); + DRETURN_PTR(ewl_widget_appearance_text_get(EWL_WIDGET(la)), DLEVEL_STABLE); } - -static void -ewl_label_apply(Ewl_Label *la) -{ - DENTER_FUNCTION(DLEVEL_STABLE); - DCHECK_PARAM_PTR("la", la); - DCHECK_TYPE("la", la, EWL_LABEL_TYPE); - - ewl_widget_appearance_text_set(EWL_WIDGET(la), la->text); - - DLEAVE_FUNCTION(DLEVEL_STABLE); -} - =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_label.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- ewl_label.h 12 Jan 2006 18:21:18 -0000 1.7 +++ ewl_label.h 14 Feb 2006 05:50:02 -0000 1.8 @@ -30,7 +30,6 @@ struct Ewl_Label { Ewl_Widget widget; /**< Inherit from Ewl_Widget */ - char * text; /**< The text set into the widget */ }; Ewl_Widget *ewl_label_new(void); @@ -39,12 +38,6 @@ void ewl_label_text_set(Ewl_Label *la, const char *text); const char *ewl_label_text_get(Ewl_Label *la); -/* - * Internally used callbacks - */ -void ewl_label_realize_cb(Ewl_Widget *w, void *ev, void *data); -void ewl_label_destroy_cb(Ewl_Widget *w, void *ev, void *data); - /** * @} */ =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_menu_item.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- ewl_menu_item.c 6 Feb 2006 16:32:10 -0000 1.8 +++ ewl_menu_item.c 14 Feb 2006 05:50:02 -0000 1.9 @@ -114,6 +114,8 @@ item->text); ewl_object_fill_policy_set(EWL_OBJECT(item->text), EWL_FLAG_FILL_HFILL); + ewl_object_alignment_set(EWL_OBJECT(item->text), + EWL_FLAG_ALIGN_LEFT); ewl_widget_show(item->text); } =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_tree.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -3 -r1.27 -r1.28 --- ewl_tree.c 8 Feb 2006 04:52:52 -0000 1.27 +++ ewl_tree.c 14 Feb 2006 05:50:02 -0000 1.28 @@ -326,6 +326,8 @@ texts[i] = ewl_label_new(); ewl_object_fill_policy_set(EWL_OBJECT(texts[i]), EWL_FLAG_FILL_NONE); + ewl_object_alignment_set(EWL_OBJECT(texts[i]), + EWL_FLAG_ALIGN_LEFT); ewl_widget_show(texts[i]); if (text) { =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_widget.c,v retrieving revision 1.64 retrieving revision 1.65 diff -u -3 -r1.64 -r1.65 --- ewl_widget.c 8 Feb 2006 03:24:22 -0000 1.64 +++ ewl_widget.c 14 Feb 2006 05:50:02 -0000 1.65 @@ -891,6 +891,50 @@ } /** + * @param w: the widget whose text to retrieve + * @param part: the theme part name whose text to retrieve + * @return Returns NULL on failure, a copy of the current text on success. + * @brief Retrieve a copy of a parts current text. + * + * Get the text of a given Edje-define TEXT part. This is for + * widgets whose Edje appearance defines TEXT parts, and enables + * each of those text parts to be retrieved independently. + */ +char * +ewl_widget_appearance_part_text_get(Ewl_Widget * w, char *part) +{ + int i; + Ewl_Pair *match = NULL; + + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR_RET("w", w, NULL); + DCHECK_PARAM_PTR_RET("part", part, NULL); + DCHECK_TYPE_RET("w", w, EWL_WIDGET_TYPE, NULL); + + /* + * Check for an existing instance of the part key. + */ + if (w->theme_text.list) { + if (w->theme_text.direct) { + match = EWL_PAIR(w->theme_text.list); + if (strcmp(part, match->key)) + match = NULL; + } + else { + for (i = 0; i < w->theme_text.len; i++) { + Ewl_Pair *current = w->theme_text.list[i]; + if (!strcmp(current->key, part)) { + match = current; + break; + } + } + } + } + + DRETURN_PTR((match ? strdup(match->value) : NULL), DLEVEL_STABLE); +} + +/** * @param w: the widget whose text to change * @param part: the theme part name whose text to change * @param text: the new text to change to @@ -922,6 +966,30 @@ } /** + * @param w: the widget whose text to retrieve + * @return Returns the current text on success, NULL on failure. + * @brief Retrieve the text of the given theme part of a widget + */ +char * +ewl_widget_appearance_text_get(Ewl_Widget * w) +{ + char *part; + char *match = NULL; + + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR_RET("w", w, NULL); + DCHECK_TYPE_RET("w", w, EWL_WIDGET_TYPE, NULL); + + part = ewl_theme_data_str_get(w, "textpart"); + if (part) { + match = ewl_widget_appearance_part_text_get(w, part); + FREE(part); + } + + DRETURN_PTR(match, DLEVEL_STABLE); +} + +/** * @param w: the widget to re-enable * @return Returns no value. * @brief Re-enable a disabled widget =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_widget.h,v retrieving revision 1.33 retrieving revision 1.34 diff -u -3 -r1.33 -r1.34 --- ewl_widget.h 12 Jan 2006 18:21:19 -0000 1.33 +++ ewl_widget.h 14 Feb 2006 05:50:02 -0000 1.34 @@ -48,9 +48,9 @@ struct Ewl_Callback_Chain { void **list; - unsigned short int mask; - unsigned short int len; - unsigned short int index; + unsigned char mask; + unsigned char len; + unsigned char index; }; typedef struct Ewl_Color_Set Ewl_Color_Set; @@ -131,7 +131,9 @@ char *ewl_widget_appearance_path_get(Ewl_Widget * w); void ewl_widget_appearance_part_text_set(Ewl_Widget * w, char *part, char *text); +char *ewl_widget_appearance_part_text_get(Ewl_Widget * w, char *part); void ewl_widget_appearance_text_set(Ewl_Widget * w, char *text); +char *ewl_widget_appearance_text_get(Ewl_Widget * w); void ewl_widget_inherit(Ewl_Widget *widget, char *type); ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs