1 /* Copyright (C) 2000-2012 by George Williams */ 2 /* 3 * Redistribution and use in source and binary forms, with or without 4 * modification, are permitted provided that the following conditions are met: 5 6 * Redistributions of source code must retain the above copyright notice, this 7 * list of conditions and the following disclaimer. 8 9 * Redistributions in binary form must reproduce the above copyright notice, 10 * this list of conditions and the following disclaimer in the documentation 11 * and/or other materials provided with the distribution. 12 13 * The name of the author may not be used to endorse or promote products 14 * derived from this software without specific prior written permission. 15 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28 #ifndef FONTFORGE_GGADGET_P_H 29 #define FONTFORGE_GGADGET_P_H 30 31 #include "ggadget.h" 32 #include "gresedit.h" 33 34 struct gfuncs { 35 unsigned int is_widget: 1; 36 uint16 size; 37 int (*handle_expose)(GWindow pixmap,GGadget *g,GEvent *event); 38 int (*handle_mouse)(GGadget *g,GEvent *event); 39 int (*handle_key)(GGadget *g,GEvent *event); 40 int (*handle_editcmd)(GGadget *g,enum editor_commands); 41 int (*handle_focus)(GGadget *g,GEvent *event); 42 int (*handle_timer)(GGadget *g,GEvent *event); 43 int (*handle_sel)(GGadget *g,GEvent *event); 44 45 void (*redraw)(GGadget *g); 46 void (*move)(GGadget *g,int32 x, int32 y); 47 void (*resize)(GGadget *g,int32 width, int32 height); 48 void (*setvisible)(GGadget *g,int); 49 void (*setenabled)(GGadget *g,int); 50 51 GRect *(*getsize)(GGadget *g,GRect *); 52 GRect *(*getinnersize)(GGadget *g,GRect *); 53 54 void (*destroy)(GGadget *g); 55 56 void (*set_title)(GGadget *g,const unichar_t *str); 57 const unichar_t *(*_get_title)(GGadget *g); 58 unichar_t *(*get_title)(GGadget *g); 59 void (*set_imagetitle)(GGadget *g,GImage *,const unichar_t *str,int before); 60 GImage *(*get_image)(GGadget *g); 61 62 void (*set_font)(GGadget *g,GFont *); 63 GFont *(*get_font)(GGadget *g); 64 65 void (*clear_list)(GGadget *g); 66 void (*set_list)(GGadget *g, GTextInfo **ti, int32 copyit); 67 GTextInfo **(*get_list)(GGadget *g,int32 *len); 68 GTextInfo *(*get_list_item)(GGadget *g,int32 pos); 69 void (*select_list_item)(GGadget *g,int32 pos, int32 sel); 70 void (*select_one_list_item)(GGadget *g,int32 pos); 71 int32 (*is_list_item_selected)(GGadget *g,int32 pos); 72 int32 (*get_first_selection)(GGadget *g); 73 void (*scroll_list_to_pos)(GGadget *g,int32 pos); 74 void (*scroll_list_to_text)(GGadget *g,const unichar_t *lab,int32 sel); 75 void (*set_list_orderer)(GGadget *g,int (*orderer)(const void *, const void *)); 76 77 void (*get_desired_size)(GGadget *g, GRect *outer, GRect *inner); 78 void (*set_desired_size)(GGadget *g, GRect *outer, GRect *inner); 79 int (*fills_window)(GGadget *g); 80 int (*is_default)(GGadget *g); 81 }; 82 83 enum gadget_state {gs_invisible, gs_disabled, gs_enabled, gs_active, 84 gs_focused, gs_pressedactive }; 85 86 struct ggadget { 87 struct gfuncs *funcs; 88 struct gwindow *base; 89 GRect r; 90 GRect inner; 91 unichar_t mnemonic; 92 unichar_t shortcut; 93 short short_mask; 94 struct ggadget *prev; 95 unsigned int takes_input: 1; 96 unsigned int takes_keyboard: 1; 97 unsigned int focusable: 1; 98 unsigned int has_focus: 1; 99 unsigned int free_box: 1; 100 unsigned int was_disabled: 1; 101 unsigned int vert: 1; /* For lines & scrollbars */ 102 unsigned int opengroup: 1; /* For groupboxes */ 103 unsigned int prevlabel: 1; /* For groupboxes */ 104 unsigned int contained: 1; /* is part of a bigger ggadget (ie. a scrollbar is part of a listbox) */ 105 unsigned int gg_skip_hotkey_processing: 1; 106 unsigned int gg_skip_unqualified_hotkey_processing: 1; 107 short cid; 108 void *data; 109 GBox *box; 110 enum gadget_state state; 111 unichar_t *popup_msg; 112 GGadgetHandler handle_controlevent; 113 int16 desired_width, desired_height; 114 }; 115 116 typedef struct ggadget GLine; 117 typedef struct ggadget GGroup; 118 119 typedef struct ggadget GSpacer; /* a blank space of a given size, used in box layout */ 120 121 typedef struct glabel { /* or simple text, or groupbox */ 122 GGadget g; 123 unsigned int fh:8; 124 unsigned int as: 8; 125 unsigned int image_precedes: 1; 126 unsigned int is_default: 1; 127 unsigned int is_cancel: 1; 128 unsigned int pressed: 1; 129 unsigned int within: 1; 130 unsigned int labeltype: 2; /* 0=>label/button(this), 1=>imagebutton, 2=>listbutton, 3=>colorbutton */ 131 unsigned int shiftonpress: 1; 132 FontInstance *font; 133 unichar_t *label; 134 GImage *image; 135 GTextInfo **ti; 136 uint16 ltot; 137 } GLabel, GButton; 138 139 typedef struct gimagebutton { 140 GGadget g; 141 unsigned int fh:8; 142 unsigned int as: 8; 143 unsigned int image_precedes: 1; 144 unsigned int is_default: 1; 145 unsigned int is_cancel: 1; 146 unsigned int pressed: 1; 147 unsigned int within: 1; 148 unsigned int labeltype: 2; /* 0=>label, 1=>imagebutton(this), 2=>listbutton */ 149 unsigned int shiftonpress: 1; 150 FontInstance *font; 151 unichar_t *label; 152 GImage *image, *img_within, *active, *disabled; 153 } GImageButton; 154 155 typedef struct glistbutton { 156 GGadget g; 157 unsigned int fh:8; 158 unsigned int as: 8; 159 unsigned int image_precedes: 1; 160 unsigned int is_default: 1; 161 unsigned int is_cancel: 1; 162 unsigned int pressed: 1; 163 unsigned int within: 1; 164 unsigned int labeltype: 2; /* 0=>label, 1=>imagebutton, 2=>listbutton(this) */ 165 unsigned int shiftonpress: 1; 166 FontInstance *font; 167 unichar_t *label; 168 GImage *image; 169 GTextInfo **ti; 170 uint16 ltot; 171 GWindow popup; 172 } GListButton; 173 174 typedef struct gcolorbutton { 175 GGadget g; 176 unsigned int fh:8; 177 unsigned int as: 8; 178 unsigned int image_precedes: 1; 179 unsigned int is_default: 1; 180 unsigned int is_cancel: 1; 181 unsigned int pressed: 1; 182 unsigned int within: 1; 183 unsigned int labeltype: 2; /* 0=>label/button, 1=>imagebutton, 2=>listbutton, 3=>colorbutton(this) */ 184 unsigned int shiftonpress: 1; 185 FontInstance *font; 186 unichar_t *label; 187 GImage *image; 188 Color col; 189 } GColorButton; 190 191 typedef struct gcheck { 192 GGadget g; 193 unsigned int fh:8; 194 unsigned int as: 8; 195 unsigned int image_precedes: 1; 196 unsigned int pressed: 1; 197 unsigned int within: 1; 198 unsigned int isradio: 1; 199 unsigned int ison: 1; 200 FontInstance *font; 201 unichar_t *label; 202 GImage *image; 203 GRect onoffrect, onoffinner; 204 GBox *onbox, *offbox; 205 GResImage *on, *off, *ondis, *offdis; 206 } GCheckBox; 207 208 typedef struct gradio { 209 GGadget g; 210 unsigned int fh:8; 211 unsigned int as: 8; 212 unsigned int image_precedes: 1; 213 unsigned int pressed: 1; 214 unsigned int within: 1; 215 unsigned int isradio: 1; 216 unsigned int ison: 1; 217 FontInstance *font; 218 unichar_t *label; 219 GImage *image; 220 GRect onoffrect, onoffinner; 221 GBox *onbox, *offbox; 222 GResImage *on, *off, *ondis, *offdis; 223 struct gradio *post; 224 int radiogroup; 225 } GRadio; 226 227 typedef struct gscrollbar { /* and slider */ 228 struct ggadget g; 229 int32 sb_min, sb_max, sb_pagesize, sb_pos; 230 int32 sb_mustshow; /* normally this is sb_pagesize, but might be the height of a single line */ 231 /* if we want people to be able to scroll to see white space */ 232 /* after the document */ 233 /*unsigned int vert: 1; */ /* Moved to GGadget, shared with line */ 234 unsigned int thumbpressed: 1; 235 unsigned int ignorenext45: 1; 236 int8 repeatcmd; /* sb event to be generated on timer interupts (ie. upline)*/ 237 int8 thumbborder; /* Size of the border of the thumbbox */ 238 int8 sbborder; /* Size of the border of the main scrollbar */ 239 int16 size_offset; /* Thumb size offset when the thumb size gets clamped. */ 240 int16 thumboff; /* Offset from where the thumb was pressed to top of thumb */ 241 int16 arrowsize; 242 int16 thumbsize; /* Current thumb size, refigured after every call to setbounds */ 243 int16 thumbpos; /* Current thumb pos */ 244 GTimer *pressed; 245 GBox *thumbbox; 246 } GScrollBar; 247 248 typedef struct glist { 249 GGadget g; 250 uint8 fh; 251 uint8 as; 252 uint8 sofar_max, sofar_pos; 253 uint16 ltot, loff, lcnt; 254 uint16 xoff, xmax; 255 uint16 start, end; /* current selection drag */ 256 uint16 hmax; /* maximum line height */ 257 FontInstance *font; 258 GTextInfo **ti; 259 struct gscrollbar *vsb; 260 int (*orderer)(const void *, const void *); 261 unsigned int backwards: 1; /* reverse the order given by orderer */ 262 unsigned int multiple_sel: 1; /* Allow multiple selections */ 263 unsigned int exactly_one: 1; /* List must always have something selected */ 264 unsigned int parentpressed: 1; /* For listbuttons, pressed in parent */ 265 unsigned int freeti: 1; /* Free the ti array when we're destroyed */ 266 unsigned int ispopup: 1; /* respond to Return and Escape */ 267 unsigned int sameheight: 1; /* all lines are the same height */ 268 unsigned int always_show_sb: 1; /* display scrollbar even if we don't need it */ 269 unichar_t *sofar; /* user input */ 270 GTimer *enduser; 271 GTimer *pressed; 272 void (*popup_callback)(GGadget *g,int pos); 273 } GList; 274 275 typedef struct gtextfield { 276 GGadget g; 277 unsigned int cursor_on: 1; 278 unsigned int wordsel: 1; 279 unsigned int linesel: 1; 280 unsigned int listfield: 1; 281 unsigned int drag_and_drop: 1; 282 unsigned int has_dd_cursor: 1; 283 unsigned int hidden_cursor: 1; 284 unsigned int multi_line: 1; 285 unsigned int accepts_tabs: 1; 286 unsigned int accepts_returns: 1; 287 unsigned int wrap: 1; 288 unsigned int password: 1; 289 unsigned int dontdraw: 1; /* Used when the tf is part of a larger control, and the control determines when to draw the tf */ 290 unsigned int donthook: 1; /* Used when the tf is part of a the gchardlg.c */ 291 unsigned int numericfield: 1; 292 unsigned int incr_down: 1; /* Direction of increments when numeric_scroll events happen */ 293 unsigned int completionfield: 1; 294 unsigned int was_completing: 1; 295 uint8 fh; 296 uint8 as; 297 uint8 nw; /* Width of one character (an "n") */ 298 int16 xoff_left, loff_top; 299 int16 sel_start, sel_end, sel_base; 300 int16 sel_oldstart, sel_oldend, sel_oldbase; 301 int16 dd_cursor_pos; 302 unichar_t *text, *oldtext; 303 FontInstance *font; 304 GTimer *pressed; 305 GTimer *cursor; 306 GCursor old_cursor; 307 GScrollBar *hsb, *vsb; 308 int16 lcnt, lmax; 309 int32 *lines; /* offsets in text to the start of the nth line */ 310 int16 xmax; 311 GIC *gic; 312 GTimer *numeric_scroll; 313 char *utf8_text; /* For Pango */ 314 int32 *lines8; /* offsets in utf8_text */ 315 } GTextField; 316 317 typedef struct glistfield { 318 GTextField gt; 319 GRect fieldrect, buttonrect; 320 GTextInfo **ti; 321 uint16 ltot; 322 GWindow popup; 323 } GListField; 324 325 typedef struct gcompletionfield { 326 GListField gl; 327 unichar_t **choices; 328 uint16 ctot; int16 selected; 329 GWindow choice_popup; 330 GTextCompletionHandler completion; 331 } GCompletionField; 332 333 typedef struct gnumericfield { 334 GTextField gt; 335 GRect fieldrect, buttonrect; 336 } GNumericField; 337 338 typedef struct gmenubar { 339 GGadget g; 340 GMenuItem *mi; 341 uint16 *xs; /* locations at which to draw each name (+1 to give us width of last one) */ 342 uint16 mtot; 343 int16 entry_with_mouse; 344 int16 lastmi; /* If the menubar doesn't fit across the top the make some of it be vertical. Start here */ 345 struct gmenu *child; 346 unsigned int pressed: 1; 347 unsigned int initial_press: 1; 348 unsigned int any_unmasked_shortcuts: 1; 349 FontInstance *font; 350 GMenuItem fake[2]; /* Used if not enough room for menu... */ 351 } GMenuBar; 352 353 struct tabs { unichar_t *name; int16 x, width, tw, nesting; unsigned int disabled: 1; GWindow w; }; 354 355 typedef struct gtabset { 356 struct ggadget g; 357 struct tabs *tabs; 358 int16 *rowstarts; /* for each row, index into tab array of its first tab, one extra entry at end with tabcnt */ 359 int16 tabcnt; /* number of tabs */ 360 int16 sel; /* active tab */ 361 int16 oldsel; /* used when swapping tabs */ 362 int16 rcnt; /* number of rows */ 363 int16 active_row; /* row which is closest to the display area */ 364 int16 offset_per_row; /* stagger tabs by this much */ 365 int16 rowh; /* height of each row */ 366 int16 toff; /* amount things are scrolled off left (x, tabs) */ 367 int16 arrow_width; /* width of arrow tab (for scrolling) */ 368 int16 arrow_size; /* size of the actual arrow itself */ 369 int16 ds; 370 int16 pressed_sel; 371 unsigned int scrolled: 1; /* big tabsets either get scrolled or appear in multiple rows */ 372 unsigned int haslarrow: 1; 373 unsigned int hasrarrow: 1; 374 unsigned int pressed: 1; 375 unsigned int filllines: 1; /* If we have multiple lines then fill them so that each row takes up the entire width of the tabset */ 376 unsigned int fill1line: 1; 377 unsigned int vertical: 1; 378 unsigned int nowindow: 1; 379 bool closable, movable; 380 FontInstance *font; 381 void (*remove_sync)(GWindow gw, int pos); 382 void (*swap_sync)(GWindow gw, int pos_a, int pos_b); 383 void (*nested_expose)(GWindow pixmap, GGadget *g, GEvent *event); 384 int (*nested_mouse)(GGadget *g, GEvent *event); 385 int16 vert_list_width; 386 int16 as, fh, offtop; 387 GGadget *vsb; 388 } GTabSet; 389 390 struct gdirentry; 391 typedef struct gfilechooser { 392 struct ggadget g; 393 GTextField *name; 394 GList *files, *subdirs; 395 GListButton *directories; 396 GButton *ok, *filterb; /* Not created by us, can be set by user to give chooser a better appearance */ 397 unichar_t **mimetypes; 398 unichar_t *wildcard; 399 unichar_t *lastname; 400 GFileChooserFilterType filter; 401 GFileChooserInputFilenameFuncType inputfilenamefunc; 402 /*enum fchooserret (*filter)(GGadget *chooser,struct gdirentry *file,const unichar_t *dir);*/ 403 struct giocontrol *outstanding; 404 GCursor old_cursor; 405 GButton *up, *home; 406 GButton *bookmarks, *config; 407 struct ghvbox *topbox; 408 unichar_t **history; 409 unichar_t **paths; 410 unichar_t *inputfilenameprevchar; 411 int hpos, hcnt, hmax; 412 } GFileChooser; 413 414 typedef struct ghvbox { 415 GGadget g; 416 int rows, cols; 417 int hpad, vpad; /* Internal padding */ 418 int grow_col, grow_row; /* -1 => all */ 419 GGadget **children; /* array of rows*cols */ 420 GGadget *label; 421 int label_height; 422 } GHVBox; 423 424 struct col_data { 425 enum me_type me_type; 426 char *(*func)(GGadget *,int r,int c); /* Produces a string to display if md_str==NULL */ 427 GMenuItem *enum_vals; 428 void (*enable_enum)(GGadget *,GMenuItem *, int r, int c); 429 GTextCompletionHandler completer; 430 char *title; 431 int16 width, x; /* Relative to inner.x */ 432 uint8 fixed; 433 uint8 disabled; 434 uint8 hidden; 435 }; 436 437 typedef struct gmatrixedit { 438 GGadget g; 439 int rows, cols; 440 int row_max; 441 struct col_data *col_data; 442 int hpad, vpad; /* Internal padding */ 443 unsigned int has_titles: 1; 444 unsigned int lr_pointer: 1; 445 unsigned int wasnew: 1; /* So we need to call newafter when finished editing */ 446 unsigned int big_done: 1; 447 unsigned int edit_active: 1; 448 unsigned int no_edit: 1; 449 int pressed_col; /* For changing column spacing */ 450 struct matrix_data *data; 451 int16 as, fh; 452 int16 font_as, font_fh; 453 FontInstance *font; 454 FontInstance *titfont; 455 GGadget *tf; 456 int active_col, active_row; 457 int off_top, off_left; 458 GGadget *vsb, *hsb; 459 GGadget *del; 460 GGadget *up, *down; 461 GGadget **buttonlist; 462 GWindow nested; 463 int16 mark_length, mark_size, mark_skip; 464 char *newtext; 465 void (*initrow)(GGadget *g,int row); 466 int (*candelete)(GGadget *g,int row); 467 enum gme_updown (*canupdown)(GGadget *g,int row); 468 void (*popupmenu)(GGadget *g,GEvent *e,int row,int col); 469 int (*handle_key)(GGadget *g,GEvent *e); 470 char *(*bigedittitle)(GGadget *g,int r, int c); 471 void (*finishedit)(GGadget *g,int r, int c, int wasnew); 472 char *(*validatestr)(GGadget *g,int r, int c, int wasnew, char *str); 473 void (*setotherbuttons)(GGadget *g, int r, int c); 474 void (*reportmousemove)(GGadget *g, int r, int c); 475 void (*reporttextchanged)(GGadget *g, int r, int c, GGadget *textfield); 476 void (*predelete)(GGadget *g, int r); 477 void (*rowmotion)(GGadget *g, int oldr, int newr); 478 } GMatrixEdit; 479 480 typedef struct gdrawable { 481 GGadget g; 482 GWindow gw; 483 GDrawEH e_h; 484 } GDrawable; 485 486 typedef struct rowcol { 487 GGadget g; 488 int rows, cols; 489 GFont *font; 490 int as, fh; 491 unsigned int hrules: 1; /* Draw horizontal lines between each row */ 492 unsigned int vrules: 1; /* Draw vertical lines between each column */ 493 unsigned int display_only: 1; 494 unsigned int order_entries: 1; /* normally order rows based on first column entry */ 495 uint8 hpad; 496 int *colx; /* col+1 entries, last is xmax */ 497 GTextInfo **labels; 498 GTextInfo **ti; 499 GTextField *tf; 500 GScrollBar *vsb, *hsb; 501 int loff, xoff; 502 int tfr, tfc; /* row,col of textfield (or -1) */ 503 int (*orderer)(const void *, const void *); 504 } RowCol; 505 506 507 /* ColorPicker */ 508 509 extern int _GScrollBar_StartTime,_GScrollBar_RepeatTime; /* in millisecs */ 510 extern int _GScrollBar_Width; /* in points */ 511 extern int _GListMarkSize; /* in points, def width of popup mark in buttons */ 512 extern int _GGadget_Skip; /* in points, def hor space between gadgets */ 513 extern int _GGadget_TextImageSkip; /* in points, def hor space text and image */ 514 extern GBox _GListMark_Box, _GGroup_LineBox; 515 extern GResImage *_GListMark_Image; 516 extern FontInstance *_ggadget_default_font; 517 518 void _GWidget_AddGGadget(GWindow gw,struct ggadget *g); 519 void _GWidget_RemoveGadget(struct ggadget *g); 520 void _GWidget_SetMenuBar(GGadget *g); 521 void _GWidget_SetDefaultButton(GGadget *g); 522 void _GWidget_MakeDefaultButton(GGadget *g); 523 void _GWidget_SetCancelButton(GGadget *g); 524 void _GWidget_SetGrabGadget(GGadget *g); 525 void _GWidget_ClearGrabGadget(GGadget *g); 526 void _GWidget_SetPopupOwner(GGadget *g); 527 void _GWidget_ClearPopupOwner(GGadget *g); 528 529 extern void _GGadgetCopyDefaultBox(GBox *box); 530 extern FontInstance *_GGadgetInitDefaultBox(char *class,GBox *box,FontInstance *deffont); 531 extern void _ggadget_underlineMnemonic(GWindow gw,int32 x,int32 y,unichar_t *label, 532 unichar_t mneumonic, Color fg,int ymax); 533 extern void _ggadgetFigureSize(GWindow gw, GBox *design, GRect *r, int isdef); 534 extern void _ggadgetSetRects(GGadget *g, GRect *outer, GRect *inner, int xjust, int yjust ); 535 extern void _GGadgetCloseGroup(GGadget *g); 536 extern void _ggadget_redraw(GGadget *g); 537 extern int _ggadget_noop(GGadget *g, GEvent *event); 538 extern void _ggadget_move(GGadget *g, int32 x, int32 y ); 539 extern void _ggadget_resize(GGadget *g, int32 width, int32 height ); 540 extern void _ggadget_setvisible(GGadget *g,int visible); 541 extern void _ggadget_setenabled(GGadget *g,int enabled); 542 extern GRect *_ggadget_getsize(GGadget *g,GRect *rct); 543 extern GRect *_ggadget_getinnersize(GGadget *g,GRect *rct); 544 extern void _ggadget_getDesiredSize(GGadget *g, GRect *outer, GRect *inner); 545 extern void _ggadget_setDesiredSize(GGadget *g,GRect *outer, GRect *inner); 546 void _GGroup_Init(void); 547 548 extern unichar_t *_GGadgetFileToUString(char *filename,int max); 549 550 extern int GBoxDrawBorder(GWindow gw,GRect *pos,GBox *design, 551 enum gadget_state state,int is_default); 552 extern void GBoxDrawBackground(GWindow gw,GRect *pos,GBox *design, 553 enum gadget_state state,int is_default); 554 extern void GBoxDrawTabOutline(GWindow pixmap, GGadget *g, int x, int y, 555 int width, int rowh, int active ); 556 extern int GBoxDrawHLine(GWindow gw,GRect *pos,GBox *design); 557 extern int GBoxDrawVLine(GWindow gw,GRect *pos,GBox *design); 558 extern int GBoxBorderWidth(GWindow gw, GBox *box); 559 extern int GBoxExtraSpace(GGadget *g); 560 extern int GBoxDrawnWidth(GWindow gw, GBox *box); 561 562 extern int GGadgetInnerWithin(GGadget *g, int x, int y); 563 564 extern int GTextInfoGetWidth(GWindow base,GTextInfo *ti,FontInstance *font); 565 extern int GTextInfoGetMaxWidth(GWindow base,GTextInfo **ti,FontInstance *font); 566 extern int GTextInfoGetHeight(GWindow base,GTextInfo *ti,FontInstance *font); 567 extern int GTextInfoGetMaxHeight(GWindow base,GTextInfo **ti,FontInstance *font,int *allsame); 568 extern int GTextInfoGetAs(GWindow base,GTextInfo *ti, FontInstance *font); 569 extern int GTextInfoDraw(GWindow base,int x,int y,GTextInfo *ti, 570 FontInstance *font,Color fg,Color sel,int ymax); 571 extern GTextInfo *GTextInfoCopy(GTextInfo *ti); 572 extern GTextInfo **GTextInfoArrayFromList(GTextInfo *ti, uint16 *cnt); 573 extern GTextInfo **GTextInfoArrayCopy(GTextInfo **ti); 574 extern int GTextInfoArrayCount(GTextInfo **ti); 575 extern int GTextInfoCompare(GTextInfo *ti1, GTextInfo *ti2); 576 extern int GMenuItemArrayMask(GMenuItem *mi); 577 extern int GMenuItemArrayAnyUnmasked(GMenuItem *mi); 578 579 extern GGadget *_GGadget_Create(GGadget *g, struct gwindow *base, GGadgetData *gd,void *data, GBox *def); 580 extern void _GGadget_FinalPosition(GGadget *g, struct gwindow *base, GGadgetData *gd); 581 extern void _ggadget_destroy(GGadget *g); 582 583 extern GWindow GListPopupCreate(GGadget *owner,void (*inform)(GGadget *,int), GTextInfo **ti); 584 585 extern int GMenuPopupCheckKey(GEvent *event); 586 extern int GMenuBarCheckKey(GWindow top, GGadget *g, GEvent *event); 587 extern void _GButton_SetDefault(GGadget *g,int32 is_default); 588 extern void _GButtonInit(void); 589 extern void GListMarkDraw(GWindow pixmap,int x, int y, int height, enum gadget_state state ); 590 extern const char* const* _GGadget_GetImagePath(void); 591 extern int _GGadget_ImageInCache(GImage *image); 592 593 extern int _ggadget_use_gettext; 594 595 extern GResInfo ggadget_ri, listmark_ri; 596 extern GResInfo *_GGadgetRIHead(void), *_GButtonRIHead(void), *_GTextFieldRIHead(void); 597 extern GResInfo *_GRadioRIHead(void), *_GScrollBarRIHead(void), *_GLineRIHead(void); 598 extern GResInfo *_GMenuRIHead(void), *_GTabSetRIHead(void), *_GHVBoxRIHead(void); 599 extern GResInfo *_GListRIHead(void), *_GMatrixEditRIHead(void), *_GDrawableRIHead(void); 600 extern GResInfo *_GProgressRIHead(void); 601 602 #define SERIF_UI_FAMILIES "dejavu serif,times,caslon,serif,clearlyu,unifont,unifont upper" 603 #define SANS_UI_FAMILIES "dejavu sans,helvetica,caliban,sans,clearlyu,unifont,unifont upper" 604 #define MONO_UI_FAMILIES "courier,monospace,clearlyu,unifont,unifont upper" 605 606 #endif /* FONTFORGE_GGADGET_P_H */ 607