Hello,

The attached patch adds the following three functions into ewl_textarea

int ewl_textarea_get_font_size(Ewl_TextArea 
                                                        *ta);
void ewl_textarea_set_font_size(Ewl_TextArea                                           
 *ta, int size);
void ewl_textarea_apply_selection(Ewl_TextArea 
                                *ta, int start, int end);


The apply_selection will apply the currently set context into the
specified part of the etox. (I am using these to inc/decrease the font
size on a textarea on key press). The set/get font size work off of the
context stored in the textarea, so they won't be applied until you do a
selection.

Not sure if you want to apply them or not, but thought they maybe handy.

Thanks,
dan

Index: ewl_textarea.c
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_textarea.c,v
retrieving revision 1.22
diff -r1.22 ewl_textarea.c
149a150,203
> /**
>  * @param ta: the textarea to retrieve the font size
>  * @return Returns the font size in @a ta
>  * @brief Return the font size for the text area
>  */
> int ewl_textarea_get_font_size(Ewl_TextArea *ta)
> {
>     char * font;
>     int size;
> 
>     DENTER_FUNCTION(DLEVEL_STABLE)
>    
>     font = etox_context_get_font(ta->etox_context, &size);
>     free(font);
> 
>     DRETURN_INT(size, DLEVEL_STABLE);
> }
> 
> /**
>  * @param ta: the textarea to set the font size
>  * @return Returns no value
>  * @brief Set the font size of the text area @a ta
>  */
> void ewl_textarea_set_font_size(Ewl_TextArea *ta, int size) 
> {
>     DENTER_FUNCTION(DLEVEL_STABLE);
> 
>     etox_context_set_font_size(ta->etox_context, size);
> 
>     DRETURN(DLEVEL_STABLE);
> }
> 
> /**
>  * @param ta: the textarea to apply the selection
>  * @param start: the start index of the selection
>  * @param end: the end index of the selection
>  * @return Returns no value
>  * @brief Apply the current context to the given selection area
>  */
> void ewl_textarea_apply_selection(Ewl_TextArea *ta, int start, int end)
> {
>     Etox_Selection *sel = NULL;
> 
>     DENTER_FUNCTION(DLEVEL_STABLE);
> 
>     sel = etox_select_index(ta->etox, start, end);
>     etox_selection_apply_context(sel, ta->etox_context);
> 
>     /* update the size of the textarea */
> 	ewl_textarea_update_size(ta);
> 
>     DRETURN(DLEVEL_STABLE);
> }
> 
224a279,280
> 
>     ta->etox_context = etox_get_context(ta->etox);
Index: ewl_textarea.h
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_textarea.h,v
retrieving revision 1.10
diff -r1.10 ewl_textarea.h
52a53,58
> int             ewl_textarea_get_font_size(Ewl_TextArea *ta);
> void            ewl_textarea_set_font_size(Ewl_TextArea *ta, int size);
> 
> void            ewl_textarea_apply_selection(Ewl_TextArea *ta, int start,
>                                                 int end);
> 

Reply via email to