/******************************************************************************* * Copyright 1991-1996 by ORCA Software, Inc. * * * * All rights reserved. May not be reproduced or distributed, in printed or * * electronic form, without permission of ORCA Software, Inc. May not be * * distributed as object code, separately or linked with other object modules, * * without permission. * *******************************************************************************/ /* The font in the text may be just a copy of a font pointer that is elsewhere, in which case, it will be freed when the interface goes away. It also could be an instantiated copy of a font, in which case, the font will have been put into the interface font list, so that it will be freed when the interface goes away. */ typedef struct { int line_break; int ip1; /* -1 is null value */ int ip2; /* -1 is null value */ int active_ip; } XI_TEXT_LINE_BREAK; typedef struct { /* edit control info */ char *string; /* current text of edit control */ int pix_width; /* pix width as specified by user of text */ int internal_pix_width; /* pix_width - scroll bar width - sb delta */ int min_buffer_size; int buffer_size; int allocated_length; BOOLEAN var_len_text; int font_height; int leading; int ascent; int descent; XinFont *font; XinWindow win; XI_OBJ *parent_obj; XinRect prect; /* physical rectangle of edit control */ XinRect clip_rect; /* clipping is intersected with this rect */ XinColor fore_color; XinColor back_color; XinColor fore_color_in_use; XinColor back_color_in_use; BOOLEAN multi_line; /* selection of multi or single line editing */ BOOLEAN right_justify; /* selection of right or left justified text */ BOOLEAN password; BOOLEAN read_only; BOOLEAN cr_ok; /* multiline edit control info */ int nbr_lines; XI_TEXT_LINE_BREAK *line_breaks; int max_lines_to_draw; BOOLEAN scrollbar; XinWindow sb_win; int sb_width; int cid; /* used for scrollbar, same as parent's. */ BOOLEAN scrollbar_always_visible; /* true for fields, false for cells. */ XI_OBJ* itf; BOOLEAN visible; /* editing state */ BOOLEAN editing; int selection_start_ip; int ip1; int ip2; BOOLEAN selecting; BOOLEAN double_selecting; int double_selecting_start_ip; BOOLEAN timer_set; long timer_id; BOOLEAN initialized; /* multiline editing state */ int delta_y; /* number of lines scrolled vertically */ /* singleline editing state */ int delta_x; /* number of characters scrolled horizontally */ } XI_TEXT; #define xi_text_nbr_lines_get( text ) text->nbr_lines #define xi_text_line_break_get( text, cnt ) ( text->line_breaks[ cnt ].line_break ) #define xi_text_font_height_get( text ) text->font_height #define xi_text_clip_set( text, rctp ) ( text->clip_rect = *(rctp)) #define xi_text_max_lines_to_draw_set( text, max_lines_to_draw_arg ) ( text->max_lines_to_draw = max_lines_to_draw_arg ) #define xi_text_color_fore_set( text, color ) ( text->fore_color = color ) #define xi_text_color_back_set( text, color ) ( text->back_color = color ) #define xi_text_get( text ) text->string #define xi_text_parent_obj_set( text, obj ) ( text->parent_obj = obj ) #define xi_text_scrollbar_set( text, has_scroll_bar ) ( text->scrollbar = has_scroll_bar ) #define xi_text_password_set( text, is_pw ) ( text->password = is_pw ) #define xi_text_read_only_set( text, flag ) ( text->read_only = flag ) #define xi_text_editing_is( text ) text->editing #define xi_text_buffer_set( text, buffer ) ( text->string = buffer ) #define xi_text_cr_ok_set( text, is_ok ) ( text->cr_ok = is_ok ) #define xi_text_initialized_set( text, set ) ( text->initialized = set ) #define xi_text_buffer_size_get( text ) ( text->buffer_size ) #define xi_text_min_buffer_size_set( text, set ) ( text->min_buffer_size = set ) #define xi_text_var_len_text_set( text, set ) ( text->var_len_text = set ) #define xi_text_font_get( text ) text->font void xi_text_set( XI_TEXT * text, char *string ); void xi_text_wrap( XI_TEXT * text ); void xi_text_pix_width_set( XI_TEXT * text, int pix_width ); void xi_text_pix_width_and_text_set( XI_TEXT * text, char *string, int pix_width, BOOLEAN set_font ); void xi_text_destruct( XI_TEXT * text ); XI_TEXT *xi_text_construct( XinWindow win, int pix_width, XinFont * font, void *parent, BOOLEAN multi_line, int cid, BOOLEAN scrollbar_always_visible ); void xi_text_draw( XI_TEXT * text, XinColor color, XinColor back_color, BOOLEAN update ); void xi_text_selection_set( XI_TEXT * text, int ip1, int ip2 ); void xi_text_selection_get( XI_TEXT * text, int *ip1, int *ip2 ); void xi_text_selection_get_internal( XI_TEXT * text, int *ip1, int *ip2, int *start_ip ); void xi_text_selection_set_internal( XI_TEXT * text, int ip1, int ip2, int selection_start_ip, BOOLEAN do_carets, BOOLEAN map_font ); void xi_text_editing_start( XI_TEXT * text ); void xi_text_editing_stop( XI_TEXT * text ); BOOLEAN xi_text_event( XI_TEXT * text, XinEvent * ep, BOOLEAN gaining_focus, BOOLEAN *changed ); void xi_text_prect_set( XI_TEXT * text, XinRect * rectp ); XI_TEXT *xi_text_focus_get( XinWindow win ); void xi_text_buffer_size_set( XI_TEXT* text, int size ); void xi_text_font_set( XI_TEXT* text, XinFont* font ); void xi_text_visible_set( XI_TEXT* text, BOOLEAN visible ); XinRect* xi_text_rect_get_adjusted( XI_TEXT * text, XinRect * rcta ); void xi_text_paste_internal( XI_TEXT * text, char *string ); void xi_text_right_justify_set( XI_TEXT* text, BOOLEAN flag ); void xi_text_reinitialize( XI_TEXT* text );