Enlightenment CVS committal Author : dj2 Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_entry.c ewl_text.c ewl_text.h Log Message: - make the selectablity of text optional (off by default) =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_entry.c,v retrieving revision 1.30 retrieving revision 1.31 diff -u -3 -r1.30 -r1.31 --- ewl_entry.c 23 Oct 2005 23:09:38 -0000 1.30 +++ ewl_entry.c 27 Oct 2005 03:14:07 -0000 1.31 @@ -66,6 +66,7 @@ /* this has to be called after the cursor is created as it will try * to show the cursor */ ewl_entry_editable_set(e, TRUE); + ewl_text_selectable_set(EWL_TEXT(e), TRUE); /* setup callbacks */ ewl_callback_append(w, EWL_CALLBACK_SELECT, =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_text.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -3 -r1.33 -r1.34 --- ewl_text.c 26 Oct 2005 01:25:31 -0000 1.33 +++ ewl_text.c 27 Oct 2005 03:14:07 -0000 1.34 @@ -125,10 +125,6 @@ ewl_text_cb_hide, NULL); ewl_callback_prepend(EWL_WIDGET(t), EWL_CALLBACK_DESTROY, ewl_text_cb_destroy, NULL); - ewl_callback_append(EWL_WIDGET(t), EWL_CALLBACK_MOUSE_DOWN, - ewl_text_cb_mouse_down, NULL); - ewl_callback_append(EWL_WIDGET(t), EWL_CALLBACK_MOUSE_UP, - ewl_text_cb_mouse_up, NULL); ewl_container_add_notify_set(EWL_CONTAINER(t), ewl_text_cb_child_add); @@ -489,6 +485,55 @@ } /** + * @param t: The text to set the selectable value of + * @param selectable: The selectable value to set + * @return Returns no value + */ +void +ewl_text_selectable_set(Ewl_Text *t, unsigned int selectable) +{ + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR("t", t); + DCHECK_TYPE("t", t, "text"); + + if (t->selectable == selectable) + DRETURN(DLEVEL_STABLE); + + t->selectable = selectable; + + if (t->selectable) + { + ewl_callback_append(EWL_WIDGET(t), EWL_CALLBACK_MOUSE_DOWN, + ewl_text_cb_mouse_down, NULL); + ewl_callback_append(EWL_WIDGET(t), EWL_CALLBACK_MOUSE_UP, + ewl_text_cb_mouse_up, NULL); + } + else + { + ewl_callback_del(EWL_WIDGET(t), EWL_CALLBACK_MOUSE_DOWN, + ewl_text_cb_mouse_down); + ewl_callback_del(EWL_WIDGET(t), EWL_CALLBACK_MOUSE_UP, + ewl_text_cb_mouse_up); + } + + DLEAVE_FUNCTION(DLEVEL_STABLE); +} + +/** + * @param t: The text to get the selectable value from + * @retun Returns the selectable value of the widget + */ +unsigned int +ewl_text_selectable_get(Ewl_Text *t) +{ + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR_RET("t", t, 0); + DCHECK_TYPE_RET("t", t, "text", 0); + + DRETURN_INT(t->selectable, DLEVEL_STABLE); +} + +/** * @param t: The Ewl_Text widget to get the selection text from * @return Returns the selection text or NULL if none set * @brief Gets the current text of the selection =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_text.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -3 -r1.15 -r1.16 --- ewl_text.h 26 Oct 2005 01:25:31 -0000 1.15 +++ ewl_text.h 27 Oct 2005 03:14:07 -0000 1.16 @@ -59,6 +59,8 @@ Ecore_List *triggers; /**< The list of triggers */ Ewl_Text_Trigger *selection; /**< The current selection */ unsigned int in_select; /**< Are we in select mode? */ + + unsigned int selectable; /**< Is the text selectable? */ }; Ewl_Widget *ewl_text_new(void); @@ -78,6 +80,9 @@ unsigned int idx); void ewl_text_text_delete(Ewl_Text *t, unsigned int length); +void ewl_text_selectable_set(Ewl_Text *t, unsigned int selectable); +unsigned int ewl_text_selectable_get(Ewl_Text *t); + char *ewl_text_selection_text_get(Ewl_Text *t); unsigned int ewl_text_has_selection(Ewl_Text *t); Ewl_Text_Trigger *ewl_text_selection_get(Ewl_Text *t); ------------------------------------------------------- This SF.Net email is sponsored by the JBoss Inc. Get Certified Today * Register for a JBoss Training Course Free Certification Exam for All Training Attendees Through End of 2005 Visit http://www.jboss.com/services/certification for more information _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs