1 /* 2 * This file is part of the XForms library package. 3 * 4 * XForms is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU Lesser General Public License as 6 * published by the Free Software Foundation; either version 2.1, or 7 * (at your option) any later version. 8 * 9 * XForms is distributed in the hope that it will be useful, but 10 * WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with XForms. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 #ifndef PTBOX_H 19 #define PTBOX_H 20 21 22 typedef struct { 23 char * fulltext; /* text of line with flags */ 24 char * text; /* text of line without flags */ 25 unsigned int len; /* line length */ 26 int selected; /* whether line is selected */ 27 int selectable; /* whether line is selectable */ 28 int x; /* vertical position relative to topline */ 29 int y; /* horizontal position of text */ 30 int w; /* length of text in pixels */ 31 int h; /* height of text in pixels */ 32 int size; /* font size */ 33 int style; /* font style */ 34 int asc; /* font ascent */ 35 int desc; /* font descent */ 36 FL_COLOR color; /* font color */ 37 int align; /* alignment of text */ 38 int is_underlined; /* whether to draw underlined */ 39 int is_separator; /* is this a separator line? */ 40 int is_special; /* does it need special GC? */ 41 GC specialGC; /* GC for if not default font/color */ 42 int incomp_esc; /* text has incomplete escape sequence */ 43 } TBOX_LINE; 44 45 46 typedef struct { 47 TBOX_LINE ** lines; /* strurctures for lines of text */ 48 int num_lines; /* number of structures */ 49 int xoffset; /* horizontal scroll in pixels */ 50 int yoffset; /* vertical scroll in pixels */ 51 int x, /* coordinates and sizes of drawing area */ 52 y, 53 w, 54 h; 55 int attrib; /* set when attributes changed */ 56 int no_redraw; /* flags when no redraw is to be done */ 57 int select_line; /* last selected line */ 58 int deselect_line; /* last deselected line */ 59 int max_width; /* length of longest line in pixels */ 60 int max_height; /* height of all lines in pixels */ 61 int def_size; /* default front size */ 62 int def_style; /* default font style */ 63 int def_align; /* default alignment */ 64 int def_height; /* height of line with default font size */ 65 GC defaultGC; /* text drawing GC */ 66 GC backgroundGC; /* background GC */ 67 GC selectGC; /* background for selection GC */ 68 GC nonselectGC; /* for text of non-selectable lines */ 69 GC bw_selectGC; /* b&w selection text GC */ 70 int specialkey; /* Key that indicates a special symbol */ 71 FL_CALLBACKPTR callback; /* double and triple click callback */ 72 long callback_data; /* data for callback */ 73 int old_yoffset; 74 int react_to_vert; 75 int react_to_hori; 76 } FLI_TBOX_SPEC; 77 78 79 /* Defaults */ 80 81 #define FLI_TBOX_BOXTYPE FL_DOWN_BOX 82 #define FLI_TBOX_COL1 FL_WHITE 83 #define FLI_TBOX_COL2 FL_YELLOW 84 #define FLI_TBOX_LCOL FL_LCOL 85 #define FLI_TBOX_ALIGN FL_ALIGN_BOTTOM 86 #define FLI_TBOX_FONTSIZE FL_SMALL_SIZE 87 88 89 extern FL_OBJECT * fli_create_tbox( int, 90 FL_Coord, 91 FL_Coord, 92 FL_Coord, 93 FL_Coord, 94 const char *); 95 96 extern void fli_tbox_delete_line( FL_OBJECT * obj, 97 int line ); 98 99 extern void fli_tbox_insert_lines( FL_OBJECT *, 100 int, 101 const char * ); 102 103 extern void fli_tbox_insert_line( FL_OBJECT *, 104 int, 105 const char * ); 106 107 extern void fli_tbox_add_line( FL_OBJECT *, 108 const char *, 109 int ); 110 111 extern void fli_tbox_add_chars( FL_OBJECT *, 112 const char * ); 113 114 extern const char * fli_tbox_get_line( FL_OBJECT *, 115 int ); 116 117 extern void fli_tbox_replace_line( FL_OBJECT *, 118 int, 119 const char * ); 120 121 extern void fli_tbox_clear( FL_OBJECT * ); 122 123 extern int fli_tbox_load( FL_OBJECT *, 124 const char * ); 125 126 extern void fli_tbox_recalc_area( FL_OBJECT * ); 127 128 extern void fli_tbox_set_fontsize( FL_OBJECT *, 129 int ); 130 131 extern void fli_tbox_set_fontstyle( FL_OBJECT *, 132 int ); 133 134 extern int fli_tbox_set_xoffset( FL_OBJECT *, 135 int ); 136 137 extern double fli_tbox_set_rel_xoffset( FL_OBJECT *, 138 double ); 139 140 extern int fli_tbox_set_yoffset( FL_OBJECT *, 141 int ); 142 143 extern double fli_tbox_set_rel_yoffset( FL_OBJECT *, 144 double ); 145 146 extern int fli_tbox_get_xoffset( FL_OBJECT * ); 147 148 extern double fli_tbox_get_rel_xoffset( FL_OBJECT * ); 149 150 extern int fli_tbox_get_yoffset( FL_OBJECT * ); 151 152 extern double fli_tbox_get_rel_yoffset( FL_OBJECT * ); 153 154 extern void fli_tbox_set_topline( FL_OBJECT *, 155 int ); 156 157 extern void fli_tbox_set_bottomline( FL_OBJECT *, 158 int ); 159 160 extern void fli_tbox_set_centerline( FL_OBJECT *, 161 int ); 162 163 extern void fli_tbox_deselect( FL_OBJECT * obj ); 164 165 extern void fli_tbox_deselect_line( FL_OBJECT *, 166 int ); 167 168 extern void fli_tbox_select_line( FL_OBJECT *, 169 int ); 170 171 extern int fli_tbox_is_line_selected( FL_OBJECT *, 172 int ); 173 174 extern int fli_tbox_get_selection( FL_OBJECT *obj ); 175 176 extern void fli_tbox_make_line_selectable( FL_OBJECT *, 177 int, 178 int ); 179 180 extern void fli_tbox_set_dblclick_callback( FL_OBJECT *, 181 FL_CALLBACKPTR, 182 long ); 183 184 extern int fli_tbox_get_num_lines( FL_OBJECT * ); 185 186 extern int fli_tbox_get_topline( FL_OBJECT * obj ); 187 188 extern int fli_tbox_get_bottomline( FL_OBJECT * ); 189 190 extern void fli_tbox_react_to_vert( FL_OBJECT *, 191 int ); 192 extern void fli_tbox_react_to_hori( FL_OBJECT *, 193 int ); 194 195 extern int fli_tbox_get_line_yoffset( FL_OBJECT *, 196 int ); 197 198 #endif 199 200 201 202 /* 203 * Local variables: 204 * tab-width: 4 205 * indent-tabs-mode: nil 206 * End: 207 */ 208