Download

Support

lib/ewl_text.h

Go to the documentation of this file.
00001 /* vim: set sw=8 ts=8 sts=8 expandtab: */
00002 #ifndef EWL_TEXT_H
00003 #define EWL_TEXT_H
00004 
00032 #define EWL_TEXT_TYPE "text"
00033 
00038 #define EWL_TEXT_IS(w) (ewl_widget_type_is(EWL_WIDGET(w), EWL_TEXT_TYPE))
00039 
00044 #define EWL_TEXT_SELECTION_TYPE "selection"
00045 
00050 #define EWL_TEXT_SELECTION_IS(w) (ewl_widget_type_is(EWL_WIDGET(w), EWL_TEXT_SELECTION_TYPE))
00051 
00056 #define EWL_TEXT(x) ((Ewl_Text *)x)
00057 
00062 typedef struct Ewl_Text Ewl_Text;
00063 
00068 struct Ewl_Text
00069 {
00070         Ewl_Container container;  
00071         void *textblock;          
00073         char *text;                  
00074         char *obscure;            
00076         struct
00077         {
00078                 unsigned int chars;         
00079                 unsigned int bytes;         
00080                 unsigned int max_chars; 
00081         } length;                         
00083         unsigned int total_size;         
00084         unsigned int cursor_position;         
00086         struct
00087         {
00088                 void *nodes;        
00089                 void *tx;        
00090         } formatting;                  
00092         Ecore_List *triggers;            
00093         Ecore_List *areas_cache;  
00094         Ewl_Widget *selection;          
00096         struct
00097         {
00098                 int x;                         
00099                 int y;                         
00100         } offset;                        
00102         unsigned char delete_count;          
00103         unsigned char in_select;          
00105         unsigned char selectable;          
00106         unsigned char dirty;                    
00107 };
00108 
00109 Ewl_Widget         *ewl_text_new(void);
00110 int                  ewl_text_init(Ewl_Text *t);
00111 
00112 unsigned int         ewl_text_length_get(Ewl_Text *t);
00113 void                 ewl_text_length_maximum_set(Ewl_Text *t,
00114                                                 unsigned int char_num);
00115 unsigned int         ewl_text_length_maximum_get(Ewl_Text *t);
00116 
00117 void                  ewl_text_offsets_set(Ewl_Text *t, int x, int y);
00118 void                  ewl_text_offsets_get(Ewl_Text *t, int *x, int *y);
00119 
00120 void                 ewl_text_index_geometry_map(Ewl_Text *t,
00121                                         unsigned int char_idx,
00122                                         int *x, int *y,
00123                                         int *w, int *h);
00124 unsigned int         ewl_text_coord_index_map(Ewl_Text *t, int x, int y);
00125 
00126 char                 *ewl_text_text_get(Ewl_Text *t);
00127 void                 ewl_text_text_set(Ewl_Text *t, const char *text);
00128 void                 ewl_text_clear(Ewl_Text *t);
00129 
00130 void                 ewl_text_text_prepend(Ewl_Text *t, const char *text);
00131 void                 ewl_text_text_append(Ewl_Text *t, const char *text);
00132 void                 ewl_text_text_insert(Ewl_Text *t, const char *text,
00133                                                 unsigned int char_idx);
00134 void                 ewl_text_text_delete(Ewl_Text *t, unsigned int length);
00135 
00136 void                 ewl_text_obscure_set(Ewl_Text *t, const char *utf8_character);
00137 
00138 void                 ewl_text_selectable_set(Ewl_Text *t, unsigned int selectable);
00139 unsigned int         ewl_text_selectable_get(Ewl_Text *t);
00140 
00141 char                 *ewl_text_selection_text_get(Ewl_Text *t);
00142 unsigned int          ewl_text_has_selection(Ewl_Text *t);
00143 Ewl_Widget        *ewl_text_selection_get(Ewl_Text *t);
00144 void                 ewl_text_select(Ewl_Text *t, unsigned int char_idx,
00145                                                 unsigned int char_len);
00146 void                 ewl_text_all_select(Ewl_Text *t);
00147 
00148 void                 ewl_text_cursor_position_set(Ewl_Text *t,
00149                                                 unsigned int char_pos);
00150 unsigned int         ewl_text_cursor_position_get(Ewl_Text *t);
00151 
00152 unsigned int         ewl_text_cursor_position_line_up_get(Ewl_Text *t);
00153 unsigned int         ewl_text_cursor_position_line_down_get(Ewl_Text *t);
00154 
00155 void                 ewl_text_font_set(Ewl_Text *t, const char *font);
00156 void                 ewl_text_font_apply(Ewl_Text *t, const char *font,
00157                                                 unsigned int char_len);
00158 char                 *ewl_text_font_get(Ewl_Text *t, unsigned int char_idx);
00159 
00160 void                 ewl_text_font_source_set(Ewl_Text *t, const char *source,
00161                                                         const char *font);
00162 void                 ewl_text_font_source_apply(Ewl_Text *t, const char *source,
00163                                                         const char *font,
00164                                                         unsigned int char_len);
00165 char                *ewl_text_font_source_get(Ewl_Text *t, unsigned int char_idx);
00166 
00167 void                 ewl_text_font_size_set(Ewl_Text *t, unsigned int size);
00168 void                 ewl_text_font_size_apply(Ewl_Text *t, unsigned int size,
00169                                                         unsigned int char_len);
00170 unsigned int         ewl_text_font_size_get(Ewl_Text *t, unsigned int char_idx);
00171 
00172 void                 ewl_text_color_set(Ewl_Text *t,
00173                                         unsigned int r, unsigned int g,
00174                                         unsigned int b, unsigned int a);
00175 void                 ewl_text_color_apply(Ewl_Text *t,
00176                                         unsigned int r, unsigned int g,
00177                                         unsigned int b, unsigned int a,
00178                                         unsigned int char_len);
00179 void                  ewl_text_color_get(Ewl_Text *t,
00180                                         unsigned int *r, unsigned int *g,
00181                                         unsigned int *b, unsigned int *a,
00182                                         unsigned int char_idx);
00183 
00184 void                 ewl_text_align_set(Ewl_Text *t, unsigned int align);
00185 void                 ewl_text_align_apply(Ewl_Text *t, unsigned int align,
00186                                                 unsigned int char_len);
00187 unsigned int         ewl_text_align_get(Ewl_Text *t, unsigned int char_idx);
00188 
00189 void                 ewl_text_styles_set(Ewl_Text *t, unsigned int styles);
00190 void                 ewl_text_styles_apply(Ewl_Text *t, unsigned int styles,
00191                                                 unsigned int char_len);
00192 unsigned int         ewl_text_styles_get(Ewl_Text *t, unsigned int char_idx);
00193 
00194 void                 ewl_text_style_add(Ewl_Text *t, Ewl_Text_Style sytle,
00195                                                 unsigned int char_len);
00196 void                 ewl_text_style_del(Ewl_Text *t, Ewl_Text_Style style,
00197                                                 unsigned int char_len);
00198 void                 ewl_text_style_invert(Ewl_Text *t, Ewl_Text_Style style,
00199                                                 unsigned int char_len);
00200 unsigned int         ewl_text_style_has(Ewl_Text *t, Ewl_Text_Style style,
00201                                                 unsigned int char_idx);
00202 
00203 void                 ewl_text_wrap_set(Ewl_Text *t, Ewl_Text_Wrap wrap);
00204 void                 ewl_text_wrap_apply(Ewl_Text *t, Ewl_Text_Wrap wrap,
00205                                                 unsigned int char_len);
00206 Ewl_Text_Wrap         ewl_text_wrap_get(Ewl_Text *t, unsigned int char_idx);
00207 
00208 void                 ewl_text_bg_color_set(Ewl_Text *t,
00209                                         unsigned int r, unsigned int g,
00210                                         unsigned int b, unsigned int a);
00211 void                 ewl_text_bg_color_apply(Ewl_Text *t,
00212                                         unsigned int r, unsigned int g,
00213                                         unsigned int b, unsigned int a,
00214                                         unsigned int char_len);
00215 void                 ewl_text_bg_color_get(Ewl_Text *t,
00216                                         unsigned int *r, unsigned int *g,
00217                                         unsigned int *b, unsigned int *a,
00218                                         unsigned int char_idx);
00219 
00220 void                 ewl_text_glow_color_set(Ewl_Text *t,
00221                                         unsigned int r, unsigned int g,
00222                                         unsigned int b, unsigned int a);
00223 void                 ewl_text_glow_color_apply(Ewl_Text *t,
00224                                         unsigned int r, unsigned int g,
00225                                         unsigned int b, unsigned int a,
00226                                         unsigned int char_len);
00227 void                 ewl_text_glow_color_get(Ewl_Text *t,
00228                                         unsigned int *r, unsigned int *g,
00229                                         unsigned int *b, unsigned int *a,
00230                                         unsigned int char_idx);
00231 
00232 void                 ewl_text_outline_color_set(Ewl_Text *t,
00233                                         unsigned int r, unsigned int g,
00234                                         unsigned int b, unsigned int a);
00235 void                 ewl_text_outline_color_apply(Ewl_Text *t,
00236                                         unsigned int r, unsigned int g,
00237                                         unsigned int b, unsigned int a,
00238                                         unsigned int char_len);
00239 void                 ewl_text_outline_color_get(Ewl_Text *t,
00240                                         unsigned int *r, unsigned int *g,
00241                                         unsigned int *b, unsigned int *a,
00242                                         unsigned int char_idx);
00243 
00244 void                 ewl_text_shadow_color_set(Ewl_Text *t,
00245                                         unsigned int r, unsigned int g,
00246                                         unsigned int b, unsigned int a);
00247 void                 ewl_text_shadow_color_apply(Ewl_Text *t,
00248                                         unsigned int r, unsigned int g,
00249                                         unsigned int b, unsigned int a,
00250                                         unsigned int char_len);
00251 void                   ewl_text_shadow_color_get(Ewl_Text *t,
00252                                         unsigned int *r, unsigned int *g,
00253                                         unsigned int *b, unsigned int *a,
00254                                         unsigned int char_idx);
00255 
00256 void                 ewl_text_strikethrough_color_set(Ewl_Text *t,
00257                                         unsigned int r, unsigned int g,
00258                                         unsigned int b, unsigned int a);
00259 void                 ewl_text_strikethrough_color_apply(Ewl_Text *t,
00260                                         unsigned int r, unsigned int g,
00261                                         unsigned int b, unsigned int a,
00262                                         unsigned int char_len);
00263 void                 ewl_text_strikethrough_color_get(Ewl_Text *t,
00264                                         unsigned int *r, unsigned int *g,
00265                                         unsigned int *b, unsigned int *a,
00266                                         unsigned int char_idx);
00267 
00268 void                 ewl_text_underline_color_set(Ewl_Text *t,
00269                                         unsigned int r, unsigned int g,
00270                                         unsigned int b, unsigned int a);
00271 void                 ewl_text_underline_color_apply(Ewl_Text *t,
00272                                         unsigned int r, unsigned int g,
00273                                         unsigned int b, unsigned int a,
00274                                         unsigned int char_len);
00275 void                 ewl_text_underline_color_get(Ewl_Text *t,
00276                                         unsigned int *r, unsigned int *g,
00277                                         unsigned int *b, unsigned int *a,
00278                                         unsigned int char_idx);
00279 
00280 void                 ewl_text_double_underline_color_set(Ewl_Text *t,
00281                                         unsigned int r, unsigned int g,
00282                                         unsigned int b, unsigned int a);
00283 void                 ewl_text_double_underline_color_apply(Ewl_Text *t,
00284                                         unsigned int r, unsigned int g,
00285                                         unsigned int b, unsigned int a,
00286                                         unsigned int char_len);
00287 void                  ewl_text_double_underline_color_get(Ewl_Text *t,
00288                                         unsigned int *r, unsigned int *g,
00289                                         unsigned int *b, unsigned int *a,
00290                                         unsigned int char_idx);
00291 
00292 char                 *ewl_text_text_next_char(const char *text, unsigned int *idx);
00293 
00294 /*
00295  * Internal stuff
00296  */
00297 
00298 void ewl_text_cb_configure(Ewl_Widget *w, void *ev, void *data);
00299 void ewl_text_cb_reveal(Ewl_Widget *w, void *ev, void *data);
00300 void ewl_text_cb_obscure(Ewl_Widget *w, void *ev, void *data);
00301 void ewl_text_cb_show(Ewl_Widget *w, void *ev, void *data);
00302 void ewl_text_cb_hide(Ewl_Widget *w, void *ev, void *data);
00303 void ewl_text_cb_destroy(Ewl_Widget *w, void *ev, void *data);
00304 void ewl_text_cb_mouse_down(Ewl_Widget *w, void *ev, void *data);
00305 void ewl_text_cb_mouse_up(Ewl_Widget *w, void *ev, void *data);
00306 void ewl_text_cb_mouse_move(Ewl_Widget *w, void *ev, void *data);
00307 
00308 void ewl_text_cb_child_add(Ewl_Container *c, Ewl_Widget *w);
00309 void ewl_text_cb_child_remove(Ewl_Container *c, Ewl_Widget *w, int idx);
00310 
00311 void ewl_text_trigger_cb_destroy(Ewl_Widget *w, void *ev, void *data);
00312 
00317 #endif
00318 

Copyright © Enlightenment.org

Enlightened Widget Library Documentation Generated: Sat May 17 16:49:08 2008