00001
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;
00082 } length;
00084 unsigned int total_size;
00085 unsigned int cursor_position;
00087 struct
00088 {
00089 const char *size_string;
00091 } min, max;
00092
00093 struct
00094 {
00095 void *nodes;
00096 void *tx;
00097 } formatting;
00099 Ecore_List *triggers;
00100 Ecore_List *areas_cache;
00101 Ewl_Widget *selection;
00103 struct
00104 {
00105 int x;
00106 int y;
00107 } offset;
00109 unsigned char delete_count;
00110 unsigned char in_select;
00112 unsigned char selectable;
00113 unsigned char dirty;
00114 };
00115
00116 Ewl_Widget *ewl_text_new(void);
00117 int ewl_text_init(Ewl_Text *t);
00118
00119 unsigned int ewl_text_length_get(Ewl_Text *t);
00120 void ewl_text_length_maximum_set(Ewl_Text *t,
00121 unsigned int char_num);
00122 unsigned int ewl_text_length_maximum_get(Ewl_Text *t);
00123
00124 void ewl_text_minimum_size_string_set(Ewl_Text *t,
00125 const char *string);
00126 const char *ewl_text_minimum_size_string_get(Ewl_Text *t);
00127 void ewl_text_maximum_size_string_set(Ewl_Text *t,
00128 const char *string);
00129 const char *ewl_text_maximum_size_string_get(Ewl_Text *t);
00130
00131 void ewl_text_offsets_set(Ewl_Text *t, int x, int y);
00132 void ewl_text_offsets_get(Ewl_Text *t, int *x, int *y);
00133
00134 void ewl_text_index_geometry_map(Ewl_Text *t,
00135 unsigned int char_idx,
00136 int *x, int *y,
00137 int *w, int *h);
00138 unsigned int ewl_text_coord_index_map(Ewl_Text *t, int x, int y);
00139
00140 char *ewl_text_text_get(Ewl_Text *t);
00141 void ewl_text_text_set(Ewl_Text *t, const char *text);
00142 void ewl_text_clear(Ewl_Text *t);
00143
00144 void ewl_text_text_prepend(Ewl_Text *t, const char *text);
00145 void ewl_text_text_append(Ewl_Text *t, const char *text);
00146 void ewl_text_text_insert(Ewl_Text *t, const char *text,
00147 unsigned int char_idx);
00148 void ewl_text_text_delete(Ewl_Text *t, unsigned int length);
00149
00150 void ewl_text_obscure_set(Ewl_Text *t, const char *utf8_character);
00151 const char *ewl_text_obscure_get(Ewl_Text *t);
00152
00153 void ewl_text_selectable_set(Ewl_Text *t, unsigned int selectable);
00154 unsigned int ewl_text_selectable_get(Ewl_Text *t);
00155
00156 char *ewl_text_selection_text_get(Ewl_Text *t);
00157 unsigned int ewl_text_has_selection(Ewl_Text *t);
00158 Ewl_Widget *ewl_text_selection_get(Ewl_Text *t);
00159 void ewl_text_select(Ewl_Text *t, unsigned int char_idx,
00160 unsigned int char_len);
00161 void ewl_text_all_select(Ewl_Text *t);
00162
00163 void ewl_text_cursor_position_set(Ewl_Text *t,
00164 unsigned int char_pos);
00165 unsigned int ewl_text_cursor_position_get(Ewl_Text *t);
00166
00167 unsigned int ewl_text_cursor_position_line_up_get(Ewl_Text *t);
00168 unsigned int ewl_text_cursor_position_line_down_get(Ewl_Text *t);
00169
00170 unsigned int ewl_text_cursor_position_line_start_get(Ewl_Text *t);
00171 unsigned int ewl_text_cursor_position_line_end_get(Ewl_Text *t);
00172 unsigned int ewl_text_cursor_position_word_previous_get(Ewl_Text *t);
00173 unsigned int ewl_text_cursor_position_word_next_get(Ewl_Text *t);
00174
00175
00176 void ewl_text_font_set(Ewl_Text *t, const char *font);
00177 void ewl_text_font_apply(Ewl_Text *t, const char *font,
00178 unsigned int char_len);
00179 char *ewl_text_font_get(Ewl_Text *t, unsigned int char_idx);
00180
00181 void ewl_text_font_source_set(Ewl_Text *t, const char *source,
00182 const char *font);
00183 void ewl_text_font_source_apply(Ewl_Text *t, const char *source,
00184 const char *font,
00185 unsigned int char_len);
00186 char *ewl_text_font_source_get(Ewl_Text *t, unsigned int char_idx);
00187
00188 void ewl_text_font_size_set(Ewl_Text *t, unsigned int size);
00189 void ewl_text_font_size_apply(Ewl_Text *t, unsigned int size,
00190 unsigned int char_len);
00191 unsigned int ewl_text_font_size_get(Ewl_Text *t, unsigned int char_idx);
00192
00193 void ewl_text_color_set(Ewl_Text *t,
00194 unsigned int r, unsigned int g,
00195 unsigned int b, unsigned int a);
00196 void ewl_text_color_apply(Ewl_Text *t,
00197 unsigned int r, unsigned int g,
00198 unsigned int b, unsigned int a,
00199 unsigned int char_len);
00200 void ewl_text_color_get(Ewl_Text *t,
00201 unsigned int *r, unsigned int *g,
00202 unsigned int *b, unsigned int *a,
00203 unsigned int char_idx);
00204
00205 void ewl_text_align_set(Ewl_Text *t, unsigned int align);
00206 void ewl_text_align_apply(Ewl_Text *t, unsigned int align,
00207 unsigned int char_len);
00208 unsigned int ewl_text_align_get(Ewl_Text *t, unsigned int char_idx);
00209
00210 void ewl_text_styles_set(Ewl_Text *t, unsigned int styles);
00211 void ewl_text_styles_apply(Ewl_Text *t, unsigned int styles,
00212 unsigned int char_len);
00213 unsigned int ewl_text_styles_get(Ewl_Text *t, unsigned int char_idx);
00214
00215 void ewl_text_style_add(Ewl_Text *t, Ewl_Text_Style sytle,
00216 unsigned int char_len);
00217 void ewl_text_style_del(Ewl_Text *t, Ewl_Text_Style style,
00218 unsigned int char_len);
00219 void ewl_text_style_invert(Ewl_Text *t, Ewl_Text_Style style,
00220 unsigned int char_len);
00221 unsigned int ewl_text_style_has(Ewl_Text *t, Ewl_Text_Style style,
00222 unsigned int char_idx);
00223
00224 void ewl_text_wrap_set(Ewl_Text *t, Ewl_Text_Wrap wrap);
00225 void ewl_text_wrap_apply(Ewl_Text *t, Ewl_Text_Wrap wrap,
00226 unsigned int char_len);
00227 Ewl_Text_Wrap ewl_text_wrap_get(Ewl_Text *t, unsigned int char_idx);
00228
00229 void ewl_text_bg_color_set(Ewl_Text *t,
00230 unsigned int r, unsigned int g,
00231 unsigned int b, unsigned int a);
00232 void ewl_text_bg_color_apply(Ewl_Text *t,
00233 unsigned int r, unsigned int g,
00234 unsigned int b, unsigned int a,
00235 unsigned int char_len);
00236 void ewl_text_bg_color_get(Ewl_Text *t,
00237 unsigned int *r, unsigned int *g,
00238 unsigned int *b, unsigned int *a,
00239 unsigned int char_idx);
00240
00241 void ewl_text_glow_color_set(Ewl_Text *t,
00242 unsigned int r, unsigned int g,
00243 unsigned int b, unsigned int a);
00244 void ewl_text_glow_color_apply(Ewl_Text *t,
00245 unsigned int r, unsigned int g,
00246 unsigned int b, unsigned int a,
00247 unsigned int char_len);
00248 void ewl_text_glow_color_get(Ewl_Text *t,
00249 unsigned int *r, unsigned int *g,
00250 unsigned int *b, unsigned int *a,
00251 unsigned int char_idx);
00252
00253 void ewl_text_outline_color_set(Ewl_Text *t,
00254 unsigned int r, unsigned int g,
00255 unsigned int b, unsigned int a);
00256 void ewl_text_outline_color_apply(Ewl_Text *t,
00257 unsigned int r, unsigned int g,
00258 unsigned int b, unsigned int a,
00259 unsigned int char_len);
00260 void ewl_text_outline_color_get(Ewl_Text *t,
00261 unsigned int *r, unsigned int *g,
00262 unsigned int *b, unsigned int *a,
00263 unsigned int char_idx);
00264
00265 void ewl_text_shadow_color_set(Ewl_Text *t,
00266 unsigned int r, unsigned int g,
00267 unsigned int b, unsigned int a);
00268 void ewl_text_shadow_color_apply(Ewl_Text *t,
00269 unsigned int r, unsigned int g,
00270 unsigned int b, unsigned int a,
00271 unsigned int char_len);
00272 void ewl_text_shadow_color_get(Ewl_Text *t,
00273 unsigned int *r, unsigned int *g,
00274 unsigned int *b, unsigned int *a,
00275 unsigned int char_idx);
00276
00277 void ewl_text_strikethrough_color_set(Ewl_Text *t,
00278 unsigned int r, unsigned int g,
00279 unsigned int b, unsigned int a);
00280 void ewl_text_strikethrough_color_apply(Ewl_Text *t,
00281 unsigned int r, unsigned int g,
00282 unsigned int b, unsigned int a,
00283 unsigned int char_len);
00284 void ewl_text_strikethrough_color_get(Ewl_Text *t,
00285 unsigned int *r, unsigned int *g,
00286 unsigned int *b, unsigned int *a,
00287 unsigned int char_idx);
00288
00289 void ewl_text_underline_color_set(Ewl_Text *t,
00290 unsigned int r, unsigned int g,
00291 unsigned int b, unsigned int a);
00292 void ewl_text_underline_color_apply(Ewl_Text *t,
00293 unsigned int r, unsigned int g,
00294 unsigned int b, unsigned int a,
00295 unsigned int char_len);
00296 void ewl_text_underline_color_get(Ewl_Text *t,
00297 unsigned int *r, unsigned int *g,
00298 unsigned int *b, unsigned int *a,
00299 unsigned int char_idx);
00300
00301 void ewl_text_double_underline_color_set(Ewl_Text *t,
00302 unsigned int r, unsigned int g,
00303 unsigned int b, unsigned int a);
00304 void ewl_text_double_underline_color_apply(Ewl_Text *t,
00305 unsigned int r, unsigned int g,
00306 unsigned int b, unsigned int a,
00307 unsigned int char_len);
00308 void ewl_text_double_underline_color_get(Ewl_Text *t,
00309 unsigned int *r, unsigned int *g,
00310 unsigned int *b, unsigned int *a,
00311 unsigned int char_idx);
00312
00313 char *ewl_text_text_next_char(const char *text, unsigned int *idx);
00314
00315
00316
00317
00318
00319 void ewl_text_cb_configure(Ewl_Widget *w, void *ev, void *data);
00320 void ewl_text_cb_reveal(Ewl_Widget *w, void *ev, void *data);
00321 void ewl_text_cb_realize(Ewl_Widget *w, void *ev, void *data);
00322 void ewl_text_cb_obscure(Ewl_Widget *w, void *ev, void *data);
00323 void ewl_text_cb_show(Ewl_Widget *w, void *ev, void *data);
00324 void ewl_text_cb_hide(Ewl_Widget *w, void *ev, void *data);
00325 void ewl_text_cb_destroy(Ewl_Widget *w, void *ev, void *data);
00326 void ewl_text_cb_mouse_down(Ewl_Widget *w, void *ev, void *data);
00327 void ewl_text_cb_mouse_up(Ewl_Widget *w, void *ev, void *data);
00328 void ewl_text_cb_mouse_move(Ewl_Widget *w, void *ev, void *data);
00329 void ewl_text_cb_key_down(Ewl_Widget *w, void *ev, void *data);
00330 void ewl_text_cb_selection_clear(Ewl_Widget *w, void *ev, void *data);
00331
00332 void ewl_text_cb_child_add(Ewl_Container *c, Ewl_Widget *w);
00333 void ewl_text_cb_child_remove(Ewl_Container *c, Ewl_Widget *w, int idx);
00334
00335 void ewl_text_trigger_cb_destroy(Ewl_Widget *w, void *ev, void *data);
00336
00341 #endif
00342