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 Lesser General Public License 15 * along with XForms. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 /********************** crop here for forms.h **********************/ 19 20 /** 21 * \file Basic.h 22 * 23 * Basic definitions and limits. 24 * Window system independent prototypes 25 * 26 * Modify with care 27 */ 28 29 #ifndef FL_BASIC_H 30 #define FL_BASIC_H 31 32 #include <math.h> 33 34 #include <X11/Xlib.h> 35 #include <X11/Xutil.h> 36 #include <X11/Xatom.h> 37 #include <X11/keysym.h> 38 #include <X11/Xresource.h> 39 40 #if defined __GNUC__ 41 #define FL_UNUSED_ARG __attribute__ ((unused)) 42 #else 43 #define FL_UNUSED_ARG 44 #endif 45 46 /* Some general constants */ 47 48 enum { 49 FL_ON = 1, 50 FL_OK = 1, 51 FL_VALID = 1, 52 FL_PREEMPT = 1, 53 FL_AUTO = 2, 54 FL_WHEN_NEEDED = FL_AUTO, 55 FL_OFF = 0, 56 FL_CANCEL = 0, 57 FL_INVALID = 0, 58 59 /* WM_DELETE_WINDOW callback return */ 60 61 FL_IGNORE = -1 62 }; 63 64 /* Max directory length */ 65 66 #ifndef FL_PATH_MAX 67 #ifndef PATH_MAX 68 #define FL_PATH_MAX 1024 69 #else 70 #define FL_PATH_MAX PATH_MAX 71 #endif 72 #endif /* ! def FL_PATH_MAX */ 73 74 /* The screen coordinate unit, FL_Coord, must be of signed type */ 75 76 typedef int FL_Coord; 77 #define FL_COORD FL_Coord 78 79 typedef unsigned long FL_COLOR; 80 81 /* Coordinates can be in pixels, milli-meters or points (1/72inch) */ 82 83 typedef enum { 84 FL_COORD_PIXEL, /* default, Pixel */ 85 FL_COORD_MM, /* milli-meter */ 86 FL_COORD_POINT, /* point */ 87 FL_COORD_centiMM, /* one hundredth of a mm */ 88 FL_COORD_centiPOINT /* one hundredth of a point */ 89 } FL_COORD_UNIT; 90 91 /* All object classes. */ 92 93 typedef enum { 94 FL_INVALID_CLASS, /* 0 */ 95 FL_BUTTON, /* 1 */ 96 FL_LIGHTBUTTON, /* 2 */ 97 FL_ROUNDBUTTON, /* 3 */ 98 FL_ROUND3DBUTTON, /* 4 */ 99 FL_CHECKBUTTON, /* 5 */ 100 FL_BITMAPBUTTON, /* 6 */ 101 FL_PIXMAPBUTTON, /* 7 */ 102 FL_BITMAP, /* 8 */ 103 FL_PIXMAP, /* 9 */ 104 FL_BOX, /* 10 */ 105 FL_TEXT, /* 11 */ 106 FL_MENU, /* 12 */ 107 FL_CHART, /* 13 */ 108 FL_CHOICE, /* 14 */ 109 FL_COUNTER, /* 15 */ 110 FL_SLIDER, /* 16 */ 111 FL_VALSLIDER, /* 17 */ 112 FL_INPUT, /* 18 */ 113 FL_BROWSER, /* 19 */ 114 FL_DIAL, /* 20 */ 115 FL_TIMER, /* 21 */ 116 FL_CLOCK, /* 22 */ 117 FL_POSITIONER, /* 23 */ 118 FL_FREE, /* 24 */ 119 FL_XYPLOT, /* 25 */ 120 FL_FRAME, /* 26 */ 121 FL_LABELFRAME, /* 27 */ 122 FL_CANVAS, /* 28 */ 123 FL_GLCANVAS, /* 29 */ 124 FL_TABFOLDER, /* 30 */ 125 FL_SCROLLBAR, /* 31 */ 126 FL_SCROLLBUTTON, /* 32 */ 127 FL_MENUBAR, /* 33 */ 128 FL_TEXTBOX, /* 34, for internal use only */ 129 FL_LABELBUTTON, /* 35 */ 130 FL_COMBOBOX, /* 36 */ 131 FL_IMAGECANVAS, /* 37 */ 132 FL_THUMBWHEEL, /* 38 */ 133 FL_COLORWHEEL, /* 39 */ 134 FL_FORMBROWSER, /* 40 */ 135 FL_SELECT, /* 41 */ 136 FL_NMENU, /* 42 */ 137 FL_SPINNER, /* 43 */ 138 FL_TBOX, /* 44 */ 139 FL_CLASS_END /* sentinel */ 140 } FL_CLASS; 141 142 #define FL_BEGIN_GROUP 10000 143 #define FL_END_GROUP 20000 144 145 #define FL_USER_CLASS_START 1001 /* min. user class value */ 146 #define FL_USER_CLASS_END 9999 /* max. user class value */ 147 148 /* Maximum border width (in pixel) */ 149 150 #define FL_MAX_BW 10 151 152 /* How to display a form onto screen */ 153 154 typedef enum { 155 FL_PLACE_FREE = 0, /* size remain resizable */ 156 FL_PLACE_MOUSE = 1, /* mouse centered on form */ 157 FL_PLACE_CENTER = 2, /* center of the screen */ 158 FL_PLACE_POSITION = 4, /* specific position */ 159 FL_PLACE_SIZE = 8, /* specific size */ 160 FL_PLACE_GEOMETRY = 16, /* specific size and position */ 161 FL_PLACE_ASPECT = 32, /* keep aspect ratio */ 162 FL_PLACE_FULLSCREEN = 64, /* scale to fit to screen */ 163 FL_PLACE_HOTSPOT = 128, /* so mouse fall on (x,y) */ 164 FL_PLACE_ICONIC = 256, /* start in iconified form */ 165 166 /* Modifiers */ 167 168 FL_FREE_SIZE = ( 1 << 14 ), 169 FL_FIX_SIZE = ( 1 << 15 ) /* seems to be useless, but some 170 programs seem to rely on it... */ 171 } FL_PLACE; 172 173 #define FL_PLACE_FREE_CENTER ( FL_PLACE_CENTER | FL_FREE_SIZE ) 174 #define FL_PLACE_CENTERFREE ( FL_PLACE_CENTER | FL_FREE_SIZE ) 175 176 /* Window manager decoration request and forms attributes */ 177 178 enum { 179 FL_FULLBORDER = 1, /* normal */ 180 FL_TRANSIENT, /* set TRANSIENT_FOR property */ 181 FL_NOBORDER /* use override_redirect to supress decor. */ 182 }; 183 184 /* All box types */ 185 186 typedef enum { 187 FL_NO_BOX, /* 0 */ 188 FL_UP_BOX, /* 1 */ 189 FL_DOWN_BOX, /* 2 */ 190 FL_BORDER_BOX, /* 3 */ 191 FL_SHADOW_BOX, /* 4 */ 192 FL_FRAME_BOX, /* 5 */ 193 FL_ROUNDED_BOX, /* 6 */ 194 FL_EMBOSSED_BOX, /* 7 */ 195 FL_FLAT_BOX, /* 8 */ 196 FL_RFLAT_BOX, /* 9 */ 197 FL_RSHADOW_BOX, /* 10 */ 198 FL_OVAL_BOX, /* 11 */ 199 FL_ROUNDED3D_UPBOX, /* 12 */ 200 FL_ROUNDED3D_DOWNBOX, /* 13 */ 201 FL_OVAL3D_UPBOX, /* 14 */ 202 FL_OVAL3D_DOWNBOX, /* 15 */ 203 FL_OVAL3D_FRAMEBOX, /* 16 */ 204 FL_OVAL3D_EMBOSSEDBOX, /* 17 */ 205 206 /* for internal use only */ 207 208 FL_TOPTAB_UPBOX, 209 FL_SELECTED_TOPTAB_UPBOX, 210 FL_BOTTOMTAB_UPBOX, 211 FL_SELECTED_BOTTOMTAB_UPBOX, 212 213 FL_MAX_BOX_STYLES /* sentinel */ 214 } FL_BOX_TYPE; 215 216 #define FL_IS_UPBOX( t ) ( ( t ) == FL_UP_BOX \ 217 || ( t ) == FL_OVAL3D_UPBOX \ 218 || ( t ) == FL_ROUNDED3D_UPBOX) 219 220 #define FL_IS_DOWNBOX( t ) ( ( t ) == FL_DOWN_BOX \ 221 || ( t ) == FL_OVAL3D_DOWNBOX \ 222 || ( t ) == FL_ROUNDED3D_DOWNBOX) 223 224 #define FL_TO_DOWNBOX( t ) ( ( t ) == FL_UP_BOX ? FL_DOWN_BOX: \ 225 ( ( t ) == FL_ROUNDED3D_UPBOX ? \ 226 FL_ROUNDED3D_DOWNBOX: \ 227 ( ( t ) == FL_OVAL3D_UPBOX ? \ 228 FL_OVAL3D_DOWNBOX : ( t ) ) ) ) 229 230 /* How to place text relative to a box */ 231 232 typedef enum { 233 FL_ALIGN_CENTER, 234 FL_ALIGN_TOP = 1, 235 FL_ALIGN_BOTTOM = 2, 236 FL_ALIGN_LEFT = 4, 237 FL_ALIGN_RIGHT = 8, 238 FL_ALIGN_LEFT_TOP = ( FL_ALIGN_TOP | FL_ALIGN_LEFT ), 239 FL_ALIGN_RIGHT_TOP = ( FL_ALIGN_TOP | FL_ALIGN_RIGHT ), 240 FL_ALIGN_LEFT_BOTTOM = ( FL_ALIGN_BOTTOM | FL_ALIGN_LEFT ), 241 FL_ALIGN_RIGHT_BOTTOM = ( FL_ALIGN_BOTTOM | FL_ALIGN_RIGHT ), 242 FL_ALIGN_INSIDE = ( 1 << 13 ), 243 FL_ALIGN_VERT = ( 1 << 14 ), /* not functional yet */ 244 245 /* the rest is for backward compatibility only, don't use! */ 246 247 FL_ALIGN_TOP_LEFT = FL_ALIGN_LEFT_TOP, 248 FL_ALIGN_TOP_RIGHT = FL_ALIGN_RIGHT_TOP, 249 FL_ALIGN_BOTTOM_LEFT = FL_ALIGN_LEFT_BOTTOM, 250 FL_ALIGN_BOTTOM_RIGHT = FL_ALIGN_RIGHT_BOTTOM 251 } FL_ALIGN; 252 253 254 FL_EXPORT int fl_is_inside_lalign( int align ); 255 256 FL_EXPORT int fl_is_outside_lalign( int align ); 257 258 FL_EXPORT int fl_is_center_lalign( int align ); 259 260 FL_EXPORT int fl_to_inside_lalign( int align ); 261 262 FL_EXPORT int fl_to_outside_lalign( int align ); 263 264 /* Mouse buttons */ 265 266 enum { 267 FL_MBUTTON1 = 1, 268 FL_MBUTTON2, 269 FL_MBUTTON3, 270 FL_MBUTTON4, 271 FL_MBUTTON5 272 }; 273 274 #define FL_LEFT_MOUSE FL_MBUTTON1 275 #define FL_MIDDLE_MOUSE FL_MBUTTON2 276 #define FL_RIGHT_MOUSE FL_MBUTTON3 277 #define FL_SCROLLUP_MOUSE FL_MBUTTON4 278 #define FL_SCROLLDOWN_MOUSE FL_MBUTTON5 279 280 #define FL_LEFTMOUSE FL_LEFT_MOUSE 281 #define FL_MIDDLEMOUSE FL_MIDDLE_MOUSE 282 #define FL_RIGHTMOUSE FL_RIGHT_MOUSE 283 #define FL_SCROLLUPMOUSE FL_SCROLLUP_MOUSE 284 #define FL_SCROLLDOWNMOUSE FL_SCROLLDOWN_MOUSE 285 286 /* Flags for when to return an object */ 287 288 #define FL_RETURN_NONE 0U 289 #define FL_RETURN_CHANGED 1U 290 #define FL_RETURN_END 2U 291 #define FL_RETURN_END_CHANGED 4U 292 #define FL_RETURN_SELECTION 8U 293 #define FL_RETURN_DESELECTION 16U 294 #define FL_RETURN_TRIGGERED 1024U 295 #define FL_RETURN_ALWAYS ( ~ FL_RETURN_END_CHANGED ) 296 297 298 /* Some special color indices for FL private colormap. It does not matter 299 * what the value of each enum is, but it must start from 0 and be 300 * consecutive. */ 301 302 typedef enum { 303 FL_BLACK, 304 FL_RED, 305 FL_GREEN, 306 FL_YELLOW, 307 FL_BLUE, 308 FL_MAGENTA, 309 FL_CYAN, 310 FL_WHITE, 311 FL_TOMATO, 312 FL_INDIANRED, 313 FL_SLATEBLUE, 314 FL_COL1, 315 FL_RIGHT_BCOL, 316 FL_BOTTOM_BCOL, 317 FL_TOP_BCOL, 318 FL_LEFT_BCOL, 319 FL_MCOL, 320 FL_INACTIVE, 321 FL_PALEGREEN, 322 FL_DARKGOLD, 323 FL_ORCHID, 324 FL_DARKCYAN, 325 FL_DARKTOMATO, 326 FL_WHEAT, 327 FL_DARKORANGE, 328 FL_DEEPPINK, 329 FL_CHARTREUSE, 330 FL_DARKVIOLET, 331 FL_SPRINGGREEN, 332 FL_DODGERBLUE, 333 FL_LIGHTER_COL1, 334 FL_DARKER_COL1, 335 FL_ALICEBLUE, 336 FL_ANTIQUEWHITE, 337 FL_AQUA, 338 FL_AQUAMARINE, 339 FL_AZURE, 340 FL_BEIGE, 341 FL_BISQUE, 342 FL_BLANCHEDALMOND, 343 FL_BLUEVIOLET, 344 FL_BROWN, 345 FL_BURLYWOOD, 346 FL_CADETBLUE, 347 FL_CHOCOLATE, 348 FL_CORAL, 349 FL_CORNFLOWERBLUE, 350 FL_CORNSILK, 351 FL_CRIMSON, 352 FL_DARKBLUE, 353 FL_DARKGOLDENROD, 354 FL_DARKGRAY, 355 FL_DARKGREEN, 356 FL_DARKGREY, 357 FL_DARKKHAKI, 358 FL_DARKMAGENTA, 359 FL_DARKOLIVEGREEN, 360 FL_DARKORCHID, 361 FL_DARKRED, 362 FL_DARKSALMON, 363 FL_DARKSEAGREEN, 364 FL_DARKSLATEBLUE, 365 FL_DARKSLATEGRAY, 366 FL_DARKSLATEGREY, 367 FL_DARKTURQUOISE, 368 FL_DEEPSKYBLUE, 369 FL_DIMGRAY, 370 FL_DIMGREY, 371 FL_FIREBRICK, 372 FL_FLORALWHITE, 373 FL_FORESTGREEN, 374 FL_FUCHSIA, 375 FL_GAINSBORO, 376 FL_GHOSTWHITE, 377 FL_GOLD, 378 FL_GOLDENROD, 379 FL_GRAY, 380 FL_GREENYELLOW, 381 FL_GREY, 382 FL_HONEYDEW, 383 FL_HOTPINK, 384 FL_INDIGO, 385 FL_IVORY, 386 FL_KHAKI, 387 FL_LAVENDER, 388 FL_LAVENDERBLUSH, 389 FL_LAWNGREEN, 390 FL_LEMONCHIFFON, 391 FL_LIGHTBLUE, 392 FL_LIGHTCORAL, 393 FL_LIGHTCYAN, 394 FL_LIGHTGOLDENRODYELLOW, 395 FL_LIGHTGRAY, 396 FL_LIGHTGREEN, 397 FL_LIGHTGREY, 398 FL_LIGHTPINK, 399 FL_LIGHTSALMON, 400 FL_LIGHTSEAGREEN, 401 FL_LIGHTSKYBLUE, 402 FL_LIGHTSLATEGRAY, 403 FL_LIGHTSLATEGREY, 404 FL_LIGHTSTEELBLUE, 405 FL_LIGHTYELLOW, 406 FL_LIME, 407 FL_LIMEGREEN, 408 FL_LINEN, 409 FL_MAROON, 410 FL_MEDIUMAQUAMARINE, 411 FL_MEDIUMBLUE, 412 FL_MEDIUMORCHID, 413 FL_MEDIUMPURPLE, 414 FL_MEDIUMSEAGREEN, 415 FL_MEDIUMSLATEBLUE, 416 FL_MEDIUMSPRINGGREEN, 417 FL_MEDIUMTURQUOISE, 418 FL_MEDIUMVIOLETRED, 419 FL_MIDNIGHTBLUE, 420 FL_MINTCREAM, 421 FL_MISTYROSE, 422 FL_MOCCASIN, 423 FL_NAVAJOWHITE, 424 FL_NAVY, 425 FL_OLDLACE, 426 FL_OLIVE, 427 FL_OLIVEDRAB, 428 FL_ORANGE, 429 FL_ORANGERED, 430 FL_PALEGOLDENROD, 431 FL_PALETURQUOISE, 432 FL_PALEVIOLETRED, 433 FL_PAPAYAWHIP, 434 FL_PEACHPUFF, 435 FL_PERU, 436 FL_PINK, 437 FL_PLUM, 438 FL_POWDERBLUE, 439 FL_PURPLE, 440 FL_ROSYBROWN, 441 FL_ROYALBLUE, 442 FL_SADDLEBROWN, 443 FL_SALMON, 444 FL_SANDYBROWN, 445 FL_SEAGREEN, 446 FL_SEASHELL, 447 FL_SIENNA, 448 FL_SILVER, 449 FL_SKYBLUE, 450 FL_SLATEGRAY, 451 FL_SLATEGREY, 452 FL_SNOW, 453 FL_STEELBLUE, 454 FL_TAN, 455 FL_TEAL, 456 FL_THISTLE, 457 FL_TURQUOISE, 458 FL_VIOLET, 459 FL_WHITESMOKE, 460 FL_YELLOWGREEN, 461 FL_COLOR_CHOOSER_COLOR = 255, 462 FL_FREE_COL1 = 256, 463 FL_FREE_COL2, 464 FL_FREE_COL3, 465 FL_FREE_COL4, 466 FL_FREE_COL5, 467 FL_FREE_COL6, 468 FL_FREE_COL7, 469 FL_FREE_COL8, 470 FL_FREE_COL9, 471 FL_FREE_COL10, 472 FL_FREE_COL11, 473 FL_FREE_COL12, 474 FL_FREE_COL13, 475 FL_FREE_COL14, 476 FL_FREE_COL15, 477 FL_FREE_COL16, 478 FL_NOCOLOR = INT_MAX 479 } FL_PD_COL; 480 481 482 #define FL_BUILT_IN_COLS ( FL_YELLOWGREEN + 1 ) 483 #define FL_INACTIVE_COL FL_INACTIVE 484 485 /* Some aliases for a number of colors */ 486 487 #define FL_GRAY16 FL_RIGHT_BCOL 488 #define FL_GRAY35 FL_BOTTOM_BCOL 489 #define FL_GRAY80 FL_TOP_BCOL 490 #define FL_GRAY90 FL_LEFT_BCOL 491 #define FL_GRAY63 FL_COL1 492 #define FL_GRAY75 FL_MCOL 493 #define FL_LCOL FL_BLACK 494 #define FL_NoColor FL_NOCOLOR 495 496 /* An alias probably for an earlier typo */ 497 498 #define FL_DOGERBLUE FL_DODGERBLUE 499 500 /* Events that a form reacts to */ 501 502 typedef enum { 503 FL_NOEVENT, /* 0 No event */ 504 FL_DRAW, /* 1 object is asked to redraw itself */ 505 FL_PUSH, /* 2 mouse button was pressed on the object */ 506 FL_RELEASE, /* 3 mouse button was release gain */ 507 FL_ENTER, /* 4 mouse entered the object */ 508 FL_LEAVE, /* 5 mouse left the object */ 509 FL_MOTION, /* 6 mouse motion over the object happend */ 510 FL_FOCUS, /* 7 object obtained focus */ 511 FL_UNFOCUS, /* 8 object lost focus */ 512 FL_KEYPRESS, /* 9 key was pressed while object has focus */ 513 FL_UPDATE, /* 10 for objects that need to update something 514 from time to time */ 515 FL_STEP, /* 11 */ 516 FL_SHORTCUT, /* 12 */ 517 FL_FREEMEM, /* 13 object is asked to free all its memory */ 518 FL_OTHER, /* 14 property, selection etc */ 519 FL_DRAWLABEL, /* 15 */ 520 FL_DBLCLICK, /* 16 double click on object */ 521 FL_TRPLCLICK, /* 17 triple click on object */ 522 FL_ATTRIB, /* 18 an object attribute changed */ 523 FL_KEYRELEASE, /* 19 key was released while object has focus */ 524 FL_PS, /* 20 dump a form into EPS */ 525 FL_MOVEORIGIN, /* 21 dragging the form across the screen 526 changes its absolute x,y coords. Objects 527 that themselves contain forms should 528 ensure that they are up to date. */ 529 FL_RESIZED, /* 22 the object has been resized by scale_form 530 Tell it that this has happened so that 531 it can resize any FL_FORMs that it 532 contains. */ 533 FL_PASTE, /* 23 text was pasted into input object */ 534 FL_TRIGGER, /* 24 result of fl_trigger_object() */ 535 536 /* The following are only for backward compatibility, not used anymore */ 537 538 FL_MOVE = FL_MOTION, 539 FL_KEYBOARD = FL_KEYPRESS, 540 FL_MOUSE = FL_UPDATE 541 } FL_EVENTS; 542 543 544 /* Resize policies */ 545 546 typedef enum { 547 FL_RESIZE_NONE, 548 FL_RESIZE_X, 549 FL_RESIZE_Y, 550 FL_RESIZE_ALL = ( FL_RESIZE_X | FL_RESIZE_Y ) 551 } FL_RESIZE_T; 552 553 554 /* Keyboard focus control */ 555 556 typedef enum { 557 FL_KEY_NORMAL = 1, /* normal keys(0-255) - tab +left/right */ 558 FL_KEY_TAB = 2, /* normal keys + 4 direction cursor */ 559 FL_KEY_SPECIAL = 4, /* only needs special keys (>255) */ 560 FL_KEY_ALL = 7 /* all keys */ 561 } FL_KEY; 562 563 #define FL_ALT_MASK ( 1L << 25 ) /* alt + Key --> FL_ALT_MASK + key */ 564 #define FL_CONTROL_MASK ( 1L << 26 ) 565 #define FL_SHIFT_MASK ( 1L << 27 ) 566 #define FL_ALT_VAL FL_ALT_MASK /* Don' use! */ 567 568 #define MAX_SHORTCUTS 8 569 570 /* Pop-up menu item attributes. NOTE if more than 8, need to change 571 * choice and menu class where mode is kept by a single byte */ 572 573 enum { 574 FL_PUP_NONE, 575 FL_PUP_GREY = 1, 576 FL_PUP_BOX = 2, 577 FL_PUP_CHECK = 4, 578 FL_PUP_RADIO = 8 579 }; 580 581 #define FL_PUP_GRAY FL_PUP_GREY 582 #define FL_PUP_TOGGLE FL_PUP_BOX /* not used anymore */ 583 #define FL_PUP_INACTIVE FL_PUP_GREY 584 585 /* Popup and menu entries */ 586 587 typedef int ( * FL_PUP_CB )( int ); /* callback prototype */ 588 589 typedef struct { 590 const char * text; /* label of a popup/menu item */ 591 FL_PUP_CB callback; /* the callback function */ 592 const char * shortcut; /* hotkeys */ 593 int mode; /* FL_PUP_GRAY, FL_PUP_CHECK etc */ 594 } FL_PUP_ENTRY; 595 596 #define FL_MENU_ENTRY FL_PUP_ENTRY 597 598 /******************************************************************* 599 * FONTS 600 ******************************************************************/ 601 602 #define FL_MAXFONTS 48 /* max number of fonts */ 603 604 typedef enum { 605 FL_INVALID_STYLE = -1, 606 FL_NORMAL_STYLE, 607 FL_BOLD_STYLE, 608 FL_ITALIC_STYLE, 609 FL_BOLDITALIC_STYLE, 610 611 FL_FIXED_STYLE, 612 FL_FIXEDBOLD_STYLE, 613 FL_FIXEDITALIC_STYLE, 614 FL_FIXEDBOLDITALIC_STYLE, 615 616 FL_TIMES_STYLE, 617 FL_TIMESBOLD_STYLE, 618 FL_TIMESITALIC_STYLE, 619 FL_TIMESBOLDITALIC_STYLE, 620 621 FL_MISC_STYLE, 622 FL_MISCBOLD_STYLE, 623 FL_MISCITALIC_STYLE, 624 FL_SYMBOL_STYLE, 625 626 /* modfier masks. Need to fit a short */ 627 628 FL_SHADOW_STYLE = ( 1 << 9 ), 629 FL_ENGRAVED_STYLE = ( 1 << 10 ), 630 FL_EMBOSSED_STYLE = ( 1 << 11 ) 631 } FL_TEXT_STYLE; 632 633 #define FL_FONT_STYLE FL_TEXT_STYLE 634 635 #define special_style( a ) ( ( a ) >= FL_SHADOW_STYLE \ 636 && ( a ) <= ( FL_EMBOSSED_STYLE + FL_MAXFONTS ) ) 637 638 /* Standard sizes in XForms */ 639 640 #define FL_TINY_SIZE 8 641 #define FL_SMALL_SIZE 10 642 #define FL_NORMAL_SIZE 12 643 #define FL_MEDIUM_SIZE 14 644 #define FL_LARGE_SIZE 18 645 #define FL_HUGE_SIZE 24 646 647 #define FL_DEFAULT_SIZE FL_SMALL_SIZE 648 649 /* Defines for compatibility */ 650 651 #define FL_TINY_FONT FL_TINY_SIZE 652 #define FL_SMALL_FONT FL_SMALL_SIZE 653 #define FL_NORMAL_FONT FL_NORMAL_SIZE 654 #define FL_MEDIUM_FONT FL_MEDIUM_SIZE 655 #define FL_LARGE_FONT FL_LARGE_SIZE 656 #define FL_HUGE_FONT FL_HUGE_SIZE 657 658 #define FL_NORMAL_FONT1 FL_SMALL_FONT 659 #define FL_NORMAL_FONT2 FL_NORMAL_FONT 660 #define FL_DEFAULT_FONT FL_SMALL_FONT 661 662 #define FL_BOUND_WIDTH ( FL_Coord ) 1 /* Border width of boxes */ 663 664 /* Definition of basic struct that holds an object */ 665 666 #define FL_CLICK_TIMEOUT 400 /* double click interval */ 667 668 typedef struct FL_FORM_ FL_FORM; 669 typedef struct FL_OBJECT_ FL_OBJECT; 670 typedef struct FL_pixmap_ FL_pixmap; 671 672 struct FL_OBJECT_ { 673 FL_FORM * form; /* the form this object belongs to */ 674 void * u_vdata; /* anything the user likes */ 675 char * u_cdata; /* anything the user likes */ 676 long u_ldata; /* anything the user likes */ 677 678 int objclass; /* class of object, button, slider etc */ 679 int type; /* type within the class */ 680 int boxtype; /* what kind of box type */ 681 FL_Coord x, /* current obj. location and size */ 682 y, 683 w, 684 h; 685 double fl1, /* distances of upper left hand (1) and */ 686 fr1, /* lower right hand corner (2) to left, */ 687 ft1, /* right, top and bottom of enclosing */ 688 fb1, /* form */ 689 fl2, 690 fr2, 691 ft2, 692 fb2; 693 FL_Coord bw; 694 FL_COLOR col1, /* colors of obj */ 695 col2; 696 char * label; /* object label */ 697 FL_COLOR lcol; /* label color */ 698 int align; 699 int lsize, /* label size and style */ 700 lstyle; 701 long * shortcut; 702 int ( * handle )( FL_OBJECT *, 703 int, 704 FL_Coord, 705 FL_Coord, 706 int, 707 void * ); 708 void ( * object_callback )( FL_OBJECT *, 709 long ); 710 long argument; 711 void * spec; /* instantiation */ 712 713 int ( * prehandle )( FL_OBJECT *, 714 int, 715 FL_Coord, 716 FL_Coord, 717 int, 718 void * ); 719 int ( * posthandle )( FL_OBJECT *, 720 int, 721 FL_Coord, 722 FL_Coord, 723 int, 724 void * ); 725 void ( * set_return )( FL_OBJECT *, 726 unsigned int ); 727 728 /* Re-configure preference */ 729 730 unsigned int resize; /* what to do if WM resizes the FORM */ 731 unsigned int nwgravity; /* how to re-position top-left corner */ 732 unsigned int segravity; /* how to re-position lower-right corner */ 733 734 FL_OBJECT * prev; /* prev. obj in form */ 735 FL_OBJECT * next; /* next. obj in form */ 736 737 FL_OBJECT * parent; 738 FL_OBJECT * child; 739 FL_OBJECT * nc; /* next child */ 740 741 FL_pixmap * flpixmap; /* pixmap double buffering stateinfo */ 742 int use_pixmap; /* true to use pixmap double buffering*/ 743 744 /* Some interaction flags */ 745 746 int returned; /* what last interaction returned */ 747 unsigned int how_return; /* under which conditions to return */ 748 int double_buffer; /* only used by mesa/gl canvas */ 749 int pushed; 750 int focus; 751 int belowmouse; 752 int active; /* if object accepts events */ 753 int input; 754 int wantkey; 755 int radio; 756 int automatic; 757 int redraw; 758 int visible; 759 int is_under; /* if (partially) hidden by other object */ 760 int clip; 761 unsigned long click_timeout; 762 void * c_vdata; /* for class use */ 763 char * c_cdata; /* for class use */ 764 long c_ldata; /* for class use */ 765 FL_COLOR dbl_background; /* double buffer background */ 766 char * tooltip; 767 int tipID; 768 int group_id; 769 int want_motion; 770 int want_update; 771 }; 772 773 774 /* Callback function for an entire form */ 775 776 typedef void ( * FL_FORMCALLBACKPTR )( FL_OBJECT *, 777 void * ); 778 /* Object callback function */ 779 780 typedef void ( * FL_CALLBACKPTR )( FL_OBJECT *, 781 long ); 782 783 /* Preemptive callback function */ 784 785 typedef int ( * FL_RAW_CALLBACK )( FL_FORM *, 786 void * ); 787 788 /* At close (WM menu delete/close etc.) function */ 789 790 typedef int ( * FL_FORM_ATCLOSE )( FL_FORM *, 791 void * ); 792 /* Deactivate/activate callback */ 793 794 typedef void ( * FL_FORM_ATDEACTIVATE )( FL_FORM *, 795 void * ); 796 typedef void ( * FL_FORM_ATACTIVATE )( FL_FORM *, 797 void * ); 798 799 typedef int ( * FL_HANDLEPTR )( FL_OBJECT *, 800 int, 801 FL_Coord, 802 FL_Coord, 803 int, 804 void * ); 805 806 /* Error callback */ 807 808 typedef void ( * FL_ERROR_FUNC )( const char *, 809 const char *, 810 ... ); 811 812 FL_EXPORT FL_OBJECT *FL_EVENT; 813 814 /*** FORM ****/ 815 816 /* Form visibility state: form->visible */ 817 818 enum { 819 FL_BEING_HIDDEN = -1, 820 FL_HIDDEN = 0, 821 FL_INVISIBLE = FL_HIDDEN, 822 FL_VISIBLE = 1 823 }; 824 825 struct FL_FORM_ { 826 void * fdui; /* for fdesign */ 827 void * u_vdata; /* for application */ 828 char * u_cdata; /* for application */ 829 long u_ldata; /* for application */ 830 831 char * label; /* window title */ 832 Window window; /* X resource ID for window */ 833 FL_Coord x, /* current geometry info */ 834 y, 835 w, 836 h; 837 int handle_dec_x, 838 handle_dec_y; 839 FL_Coord hotx, /* hot-spot of the form */ 840 hoty; 841 double w_hr, /* high resolution width and height */ 842 h_hr; /* (needed for precise scaling) */ 843 844 FL_OBJECT * first; 845 FL_OBJECT * last; 846 FL_OBJECT * focusobj; 847 848 FL_FORMCALLBACKPTR form_callback; 849 FL_FORM_ATACTIVATE activate_callback; 850 FL_FORM_ATDEACTIVATE deactivate_callback; 851 void * form_cb_data; 852 void * activate_data; 853 void * deactivate_data; 854 855 FL_RAW_CALLBACK key_callback; 856 FL_RAW_CALLBACK push_callback; 857 FL_RAW_CALLBACK crossing_callback; 858 FL_RAW_CALLBACK motion_callback; 859 FL_RAW_CALLBACK all_callback; 860 861 unsigned long compress_mask; 862 unsigned long evmask; 863 864 /* WM_DELETE_WINDOW message handler */ 865 866 FL_FORM_ATCLOSE close_callback; 867 void * close_data; 868 869 FL_pixmap * flpixmap; /* back buffer */ 870 871 Pixmap icon_pixmap; 872 Pixmap icon_mask; 873 874 /* Interaction and other flags */ 875 876 int deactivated; /* non-zero if deactivated */ 877 int use_pixmap; /* true if dbl buffering */ 878 int frozen; /* true if sync change */ 879 int visible; /* true if mapped */ 880 int wm_border; /* window manager info */ 881 unsigned int prop; /* other attributes */ 882 int num_auto_objects; 883 int needs_full_redraw; 884 int sort_of_modal; /* internal use */ 885 FL_FORM * parent; 886 FL_FORM * child; 887 FL_OBJECT * parent_obj; 888 int attached; /* not independent anymore */ 889 void ( * pre_attach )( FL_FORM * ); 890 void * attach_data; 891 int in_redraw; 892 }; 893 894 895 /* All FD_xxx structure emitted by fdesign contains at least the 896 * following */ 897 898 typedef struct { 899 FL_FORM * form; 900 void * vdata; 901 char * cdata; 902 long ldata; 903 } FD_Any; 904 905 /* Async IO stuff */ 906 907 enum { 908 FL_READ = 1, 909 FL_WRITE = 2, 910 FL_EXCEPT = 4 911 }; 912 913 /* IO other than XEvent Q */ 914 915 typedef void ( * FL_IO_CALLBACK )( int, 916 void * ); 917 918 FL_EXPORT void fl_add_io_callback( int fd, 919 unsigned int mask, 920 FL_IO_CALLBACK callback, 921 void * data ); 922 923 FL_EXPORT void fl_remove_io_callback( int fd, 924 unsigned int mask, 925 FL_IO_CALLBACK cb ); 926 927 /* signals */ 928 929 typedef void ( * FL_SIGNAL_HANDLER )( int, 930 void * ); 931 932 FL_EXPORT void fl_add_signal_callback( int s, 933 FL_SIGNAL_HANDLER cb, 934 void * data ); 935 936 FL_EXPORT void fl_remove_signal_callback( int s ); 937 938 FL_EXPORT void fl_signal_caught( int s ); 939 940 FL_EXPORT void fl_app_signal_direct( int y ); 941 942 943 enum { 944 FL_INPUT_END_EVENT_CLASSIC = 0, 945 FL_INPUT_END_EVENT_ALWAYS = 1 946 }; 947 948 FL_EXPORT int fl_input_end_return_handling( int type ); 949 950 951 /* Timeouts */ 952 953 typedef void (* FL_TIMEOUT_CALLBACK )( int, void * ); 954 955 FL_EXPORT int fl_add_timeout( long msec, 956 FL_TIMEOUT_CALLBACK callback, 957 void * data ); 958 959 FL_EXPORT void fl_remove_timeout( int id ); 960 961 /* Basic public routine prototypes */ 962 963 FL_EXPORT int fl_library_version( int * ver, 964 int * rev ); 965 966 FL_EXPORT long fl_library_full_version( int * version, 967 int * revision, 968 int * fix_level, 969 const char ** extra ); 970 971 /** Generic routines that deal with FORMS **/ 972 973 FL_EXPORT FL_FORM * fl_bgn_form( int type, 974 FL_Coord w, 975 FL_Coord h ); 976 977 FL_EXPORT void fl_end_form( void ); 978 979 FL_EXPORT FL_OBJECT * fl_do_forms( void ); 980 981 FL_EXPORT FL_OBJECT * fl_check_forms( void ); 982 983 FL_EXPORT FL_OBJECT * fl_do_only_forms( void ); 984 985 FL_EXPORT FL_OBJECT * fl_check_only_forms( void ); 986 987 FL_EXPORT void fl_freeze_form( FL_FORM * form ); 988 989 FL_EXPORT void fl_set_focus_object( FL_FORM * form, 990 FL_OBJECT * obj ); 991 992 FL_EXPORT FL_OBJECT *fl_get_focus_object( FL_FORM * form ); 993 994 FL_EXPORT void fl_reset_focus_object( FL_OBJECT * ob ); 995 996 #define fl_set_object_focus fl_set_focus_object 997 998 FL_EXPORT FL_FORM_ATCLOSE fl_set_form_atclose( FL_FORM * form, 999 FL_FORM_ATCLOSE fmclose, 1000 void * data ); 1001 1002 FL_EXPORT FL_FORM_ATCLOSE fl_set_atclose( FL_FORM_ATCLOSE fmclose, 1003 void * data ); 1004 1005 FL_EXPORT FL_FORM_ATACTIVATE fl_set_form_atactivate( FL_FORM * form, 1006 FL_FORM_ATACTIVATE cb, 1007 void * data ); 1008 1009 FL_EXPORT FL_FORM_ATDEACTIVATE fl_set_form_atdeactivate( FL_FORM * form, 1010 FL_FORM_ATDEACTIVATE cb, 1011 void * data ); 1012 1013 FL_EXPORT void fl_unfreeze_form( FL_FORM * form ); 1014 1015 FL_EXPORT int fl_form_is_activated( FL_FORM * form ); 1016 1017 FL_EXPORT void fl_deactivate_form( FL_FORM * form ); 1018 1019 FL_EXPORT void fl_activate_form( FL_FORM * form ); 1020 1021 FL_EXPORT void fl_deactivate_all_forms( void ); 1022 1023 FL_EXPORT void fl_activate_all_forms( void ); 1024 1025 FL_EXPORT void fl_freeze_all_forms( void ); 1026 1027 FL_EXPORT void fl_unfreeze_all_forms( void ); 1028 1029 FL_EXPORT void fl_scale_form( FL_FORM * form, 1030 double xsc, 1031 double ysc ); 1032 1033 FL_EXPORT void fl_set_form_position( FL_FORM * form, 1034 FL_Coord x, 1035 FL_Coord y ); 1036 1037 FL_EXPORT void fl_set_form_title( FL_FORM * form, 1038 const char * name ); 1039 1040 FL_EXPORT void fl_set_form_title_f( FL_FORM * form, 1041 const char * fmt, 1042 ... ); 1043 1044 FL_EXPORT void fl_set_app_mainform( FL_FORM * form ); 1045 1046 FL_EXPORT FL_FORM * fl_get_app_mainform( void ); 1047 1048 FL_EXPORT void fl_set_app_nomainform( int flag ); 1049 1050 FL_EXPORT void fl_set_form_callback( FL_FORM * form, 1051 FL_FORMCALLBACKPTR callback, 1052 void * d ); 1053 1054 #define fl_set_form_call_back fl_set_form_callback 1055 1056 FL_EXPORT void fl_set_form_size( FL_FORM * form, 1057 FL_Coord w, 1058 FL_Coord h ); 1059 1060 FL_EXPORT void fl_set_form_background_color( FL_FORM * form, 1061 FL_COLOR color ); 1062 1063 FL_EXPORT FL_COLOR fl_get_form_background_color( FL_FORM * form ); 1064 1065 FL_EXPORT void fl_set_form_hotspot( FL_FORM * form, 1066 FL_Coord x, 1067 FL_Coord y ); 1068 1069 FL_EXPORT void fl_set_form_hotobject( FL_FORM * form, 1070 FL_OBJECT * ob ); 1071 1072 FL_EXPORT void fl_set_form_minsize( FL_FORM * form, 1073 FL_Coord w, 1074 FL_Coord h ); 1075 1076 FL_EXPORT void fl_set_form_maxsize( FL_FORM * form, 1077 FL_Coord w, 1078 FL_Coord h ); 1079 1080 FL_EXPORT void fl_set_form_event_cmask( FL_FORM * form, 1081 unsigned long cmask ); 1082 1083 FL_EXPORT unsigned long fl_get_form_event_cmask( FL_FORM * form ); 1084 1085 FL_EXPORT void fl_set_form_geometry( FL_FORM * form, 1086 FL_Coord x, 1087 FL_Coord y, 1088 FL_Coord w, 1089 FL_Coord h ); 1090 1091 #define fl_set_initial_placement fl_set_form_geometry 1092 1093 FL_EXPORT Window fl_show_form( FL_FORM * form, 1094 int place, 1095 int border, 1096 const char * name ); 1097 1098 FL_EXPORT Window fl_show_form_f( FL_FORM * form, 1099 int place, 1100 int border, 1101 const char * fmt, 1102 ... ); 1103 1104 FL_EXPORT void fl_hide_form( FL_FORM * form ); 1105 1106 FL_EXPORT void fl_free_form( FL_FORM * form ); 1107 1108 FL_EXPORT void fl_redraw_form( FL_FORM * form ); 1109 1110 FL_EXPORT void fl_set_form_dblbuffer( FL_FORM * form, 1111 int y ); 1112 1113 FL_EXPORT Window fl_prepare_form_window( FL_FORM * form, 1114 int place, 1115 int border, 1116 const char * name ); 1117 1118 FL_EXPORT Window fl_prepare_form_window_f( FL_FORM * form, 1119 int place, 1120 int border, 1121 const char * fmt, 1122 ... ); 1123 1124 FL_EXPORT Window fl_show_form_window( FL_FORM * form ); 1125 1126 FL_EXPORT double fl_adjust_form_size( FL_FORM * form ); 1127 1128 FL_EXPORT int fl_form_is_visible( FL_FORM * form ); 1129 1130 FL_EXPORT int fl_form_is_iconified( FL_FORM * form ); 1131 1132 FL_EXPORT FL_RAW_CALLBACK fl_register_raw_callback( FL_FORM * form, 1133 unsigned long mask, 1134 FL_RAW_CALLBACK rcb ); 1135 1136 #define fl_register_call_back fl_register_raw_callback 1137 1138 FL_EXPORT FL_OBJECT * fl_bgn_group( void ); 1139 1140 FL_EXPORT void fl_end_group( void ); 1141 1142 FL_EXPORT FL_OBJECT *fl_addto_group( FL_OBJECT * group ); 1143 1144 1145 /****** Routines that deal with FL_OBJECTS ********/ 1146 1147 FL_EXPORT int fl_get_object_objclass( FL_OBJECT * obj ); 1148 1149 FL_EXPORT int fl_get_object_type( FL_OBJECT * obj ); 1150 1151 FL_EXPORT void fl_set_object_boxtype( FL_OBJECT * ob, 1152 int boxtype ); 1153 1154 FL_EXPORT int fl_get_object_boxtype( FL_OBJECT * obj ); 1155 1156 FL_EXPORT void fl_set_object_bw( FL_OBJECT * ob, 1157 int bw ); 1158 1159 FL_EXPORT int fl_get_object_bw( FL_OBJECT * ob ); 1160 1161 FL_EXPORT void fl_set_object_resize( FL_OBJECT * ob, 1162 unsigned int what ); 1163 1164 FL_EXPORT void fl_get_object_resize( FL_OBJECT * ob, 1165 unsigned int * what ); 1166 1167 FL_EXPORT void fl_set_object_gravity( FL_OBJECT * ob, 1168 unsigned int nw, 1169 unsigned int se ); 1170 1171 FL_EXPORT void fl_get_object_gravity( FL_OBJECT * ob, 1172 unsigned int * nw, 1173 unsigned int * se ); 1174 1175 FL_EXPORT void fl_set_object_lsize( FL_OBJECT * obj, 1176 int lsize ); 1177 1178 FL_EXPORT int fl_get_object_lsize( FL_OBJECT * obj ); 1179 1180 1181 FL_EXPORT void fl_set_object_lstyle( FL_OBJECT * obj, 1182 int lstyle ); 1183 1184 FL_EXPORT int fl_get_object_lstyle( FL_OBJECT * obj ); 1185 1186 FL_EXPORT void fl_set_object_lcol( FL_OBJECT * ob, 1187 FL_COLOR lcol ); 1188 1189 FL_EXPORT FL_COLOR fl_get_object_lcol( FL_OBJECT * obj ); 1190 1191 FL_EXPORT int fl_set_object_return( FL_OBJECT * ob, 1192 unsigned int when ); 1193 1194 FL_EXPORT void fl_set_object_lalign( FL_OBJECT * obj, 1195 int align ); 1196 1197 FL_EXPORT int fl_get_object_lalign( FL_OBJECT * obj ); 1198 1199 FL_EXPORT void fl_set_object_shortcut( FL_OBJECT * obj, 1200 const char * sstr, 1201 int showit ); 1202 1203 FL_EXPORT void fl_set_object_shortcutkey( FL_OBJECT * obj, 1204 unsigned int keysym ); 1205 1206 FL_EXPORT void fl_set_object_dblbuffer( FL_OBJECT * ob, 1207 int y ); 1208 1209 FL_EXPORT void fl_set_object_color( FL_OBJECT * ob, 1210 FL_COLOR col1, 1211 FL_COLOR col2 ); 1212 1213 FL_EXPORT void fl_get_object_color( FL_OBJECT * obj, 1214 FL_COLOR * col1, 1215 FL_COLOR * col2 ); 1216 1217 FL_EXPORT void fl_set_object_label( FL_OBJECT * ob, 1218 const char * label ); 1219 1220 FL_EXPORT void fl_set_object_label_f( FL_OBJECT * obj, 1221 const char * fmt, 1222 ... ); 1223 1224 FL_EXPORT const char * fl_get_object_label( FL_OBJECT * obj ); 1225 1226 FL_EXPORT void fl_set_object_helper( FL_OBJECT * ob, 1227 const char * tip ); 1228 1229 FL_EXPORT void fl_set_object_helper_f( FL_OBJECT * ob, 1230 const char * fmt, 1231 ... ); 1232 1233 FL_EXPORT void fl_set_object_position( FL_OBJECT * obj, 1234 FL_Coord x, 1235 FL_Coord y ); 1236 1237 FL_EXPORT void fl_get_object_size( FL_OBJECT * obj, 1238 FL_Coord * w, 1239 FL_Coord * h ); 1240 1241 FL_EXPORT void fl_set_object_size( FL_OBJECT * obj, 1242 FL_Coord w, 1243 FL_Coord h ); 1244 1245 FL_EXPORT void fl_set_object_automatic( FL_OBJECT * obj, 1246 int flag ); 1247 1248 FL_EXPORT int fl_object_is_automatic( FL_OBJECT * obj ); 1249 1250 FL_EXPORT void fl_draw_object_label( FL_OBJECT * ob ); 1251 1252 FL_EXPORT void fl_draw_object_label_outside( FL_OBJECT * ob ); 1253 1254 FL_EXPORT FL_OBJECT * fl_get_object_component( FL_OBJECT * composite, 1255 int objclass, 1256 int type, 1257 int numb ); 1258 1259 FL_EXPORT void fl_for_all_objects( FL_FORM * form, 1260 int ( * cb )( FL_OBJECT *, void * ), 1261 void * v ); 1262 1263 #define fl_draw_object_outside_label fl_draw_object_label_outside 1264 1265 FL_EXPORT void fl_set_object_dblclick( FL_OBJECT * obj, 1266 unsigned long timeout ); 1267 1268 FL_EXPORT unsigned long fl_get_object_dblclick( FL_OBJECT * obj ); 1269 1270 FL_EXPORT void fl_set_object_geometry( FL_OBJECT * obj, 1271 FL_Coord x, 1272 FL_Coord y, 1273 FL_Coord w, 1274 FL_Coord h ); 1275 1276 FL_EXPORT void fl_move_object( FL_OBJECT * obj, 1277 FL_Coord dx, 1278 FL_Coord dy ); 1279 1280 #define fl_set_object_lcolor fl_set_object_lcol 1281 #define fl_get_object_lcolor fl_get_object_lcol 1282 1283 FL_EXPORT void fl_fit_object_label( FL_OBJECT * obj, 1284 FL_Coord xmargin, 1285 FL_Coord ymargin ); 1286 1287 FL_EXPORT void fl_get_object_geometry( FL_OBJECT * ob, 1288 FL_Coord * x, 1289 FL_Coord * y, 1290 FL_Coord * w, 1291 FL_Coord * h ); 1292 1293 FL_EXPORT void fl_get_object_position( FL_OBJECT * ob, 1294 FL_Coord * x, 1295 FL_Coord * y ); 1296 1297 /* This one takes into account the label */ 1298 1299 FL_EXPORT void fl_get_object_bbox( FL_OBJECT * obj, 1300 FL_Coord * x, 1301 FL_Coord * y, 1302 FL_Coord * w, 1303 FL_Coord * h ); 1304 1305 #define fl_compute_object_geometry fl_get_object_bbox 1306 1307 FL_EXPORT void fl_call_object_callback( FL_OBJECT * ob ); 1308 1309 FL_EXPORT FL_HANDLEPTR fl_set_object_prehandler( FL_OBJECT * ob, 1310 FL_HANDLEPTR phandler ); 1311 1312 FL_EXPORT FL_HANDLEPTR fl_set_object_posthandler( FL_OBJECT * ob, 1313 FL_HANDLEPTR post ); 1314 1315 FL_EXPORT FL_CALLBACKPTR fl_set_object_callback( FL_OBJECT * obj, 1316 FL_CALLBACKPTR callback, 1317 long argument ); 1318 1319 #define fl_set_object_align fl_set_object_lalign 1320 #define fl_set_call_back fl_set_object_callback 1321 1322 FL_EXPORT void fl_redraw_object( FL_OBJECT * obj ); 1323 1324 FL_EXPORT void fl_show_object( FL_OBJECT * ob ); 1325 1326 FL_EXPORT void fl_hide_object( FL_OBJECT * ob ); 1327 1328 FL_EXPORT int fl_object_is_visible( FL_OBJECT * obj ); 1329 1330 FL_EXPORT void fl_free_object( FL_OBJECT * obj ); 1331 1332 FL_EXPORT void fl_delete_object( FL_OBJECT * obj ); 1333 1334 FL_EXPORT int fl_get_object_return_state( FL_OBJECT *obj ); 1335 1336 FL_EXPORT void fl_trigger_object( FL_OBJECT * obj ); 1337 1338 FL_EXPORT void fl_activate_object( FL_OBJECT * ob ); 1339 1340 FL_EXPORT void fl_deactivate_object( FL_OBJECT * ob ); 1341 1342 FL_EXPORT int fl_object_is_active( FL_OBJECT * obj ); 1343 1344 FL_EXPORT int fl_enumerate_fonts( void ( * output )( const char * s ), 1345 int shortform ); 1346 1347 FL_EXPORT int fl_set_font_name( int n, 1348 const char * name ); 1349 1350 FL_EXPORT int fl_set_font_name_f( int n, 1351 const char * fmt, 1352 ... ); 1353 1354 FL_EXPORT const char * fl_get_font_name( int n ); 1355 1356 FL_EXPORT void fl_set_font( int numb, 1357 int size ); 1358 1359 /* Routines that facilitate free object */ 1360 1361 FL_EXPORT int fl_get_char_height( int style, 1362 int size, 1363 int * asc, 1364 int * desc ); 1365 1366 FL_EXPORT int fl_get_char_width( int style, 1367 int size ); 1368 1369 FL_EXPORT int fl_get_string_height( int style, 1370 int size, 1371 const char * s, 1372 int len, 1373 int * asc, 1374 int * desc ); 1375 1376 FL_EXPORT int fl_get_string_width( int style, 1377 int size, 1378 const char * s, 1379 int len ); 1380 1381 FL_EXPORT int fl_get_string_widthTAB( int style, 1382 int size, 1383 const char * s, 1384 int len ); 1385 1386 FL_EXPORT void fl_get_string_dimension( int fntstyle, 1387 int fntsize, 1388 const char * s, 1389 int len, 1390 int * width, 1391 int * height ); 1392 1393 #define fl_get_string_size fl_get_string_dimension 1394 1395 FL_EXPORT void fl_get_align_xy( int align, 1396 int x, 1397 int y, 1398 int w, 1399 int h, 1400 int xsize, 1401 int ysize, 1402 int xoff, 1403 int yoff, 1404 int * xx, 1405 int * yy ); 1406 1407 FL_EXPORT int fl_get_label_char_at_mouse( FL_OBJECT * obj ); 1408 1409 #define fl_drw_text fl_draw_text 1410 FL_EXPORT void fl_draw_text( int align, 1411 FL_Coord x, 1412 FL_Coord y, 1413 FL_Coord w, 1414 FL_Coord h, 1415 FL_COLOR c, 1416 int style, 1417 int size, 1418 const char * istr ); 1419 1420 #define fl_drw_text_beside fl_draw_text_beside 1421 FL_EXPORT void fl_draw_text_beside( int align, 1422 FL_Coord x, 1423 FL_Coord y, 1424 FL_Coord w, 1425 FL_Coord h, 1426 FL_COLOR c, 1427 int style, 1428 int size, 1429 const char * str ); 1430 1431 #define fl_drw_text_cursor fl_draw_text_cursor 1432 FL_EXPORT void fl_draw_text_cursor( int align, 1433 FL_Coord x, 1434 FL_Coord y, 1435 FL_Coord w, 1436 FL_Coord h, 1437 FL_COLOR c, 1438 int style, 1439 int size, 1440 const char * str, 1441 FL_COLOR cc, 1442 int pos ); 1443 1444 #define fl_drw_box fl_draw_box 1445 FL_EXPORT void fl_draw_box( int style, 1446 FL_Coord x, 1447 FL_Coord y, 1448 FL_Coord w, 1449 FL_Coord h, 1450 FL_COLOR c, 1451 int bw_in ); 1452 1453 typedef void ( * FL_DRAWPTR )( FL_Coord, 1454 FL_Coord, 1455 FL_Coord, 1456 FL_Coord, 1457 int, 1458 FL_COLOR); 1459 1460 FL_EXPORT int fl_add_symbol( const char * name, 1461 FL_DRAWPTR drawit, 1462 int scalable ); 1463 1464 FL_EXPORT int fl_delete_symbol( const char * name ); 1465 1466 FL_EXPORT int fl_draw_symbol( const char * label, 1467 FL_Coord x, 1468 FL_Coord y, 1469 FL_Coord w, 1470 FL_Coord h, 1471 FL_COLOR col ); 1472 1473 FL_EXPORT unsigned long fl_mapcolor( FL_COLOR col, 1474 int r, 1475 int g, 1476 int b ); 1477 1478 FL_EXPORT long fl_mapcolorname( FL_COLOR col, 1479 const char * name ); 1480 1481 #define fl_mapcolor_name fl_mapcolorname 1482 1483 FL_EXPORT void fl_free_colors( FL_COLOR * c, 1484 int n ); 1485 1486 FL_EXPORT void fl_free_pixels( unsigned long * pix, 1487 int n ); 1488 1489 FL_EXPORT void fl_set_color_leak( int y ); 1490 1491 FL_EXPORT unsigned long fl_getmcolor( FL_COLOR i, 1492 int * r, 1493 int * g, 1494 int * b ); 1495 1496 FL_EXPORT unsigned long fl_get_pixel( FL_COLOR col ); 1497 1498 #define fl_get_flcolor fl_get_pixel 1499 1500 FL_EXPORT void fl_get_icm_color( FL_COLOR col, 1501 int * r, 1502 int * g, 1503 int * b ); 1504 1505 FL_EXPORT void fl_set_icm_color( FL_COLOR col, 1506 int r, 1507 int g, 1508 int b ); 1509 1510 FL_EXPORT void fl_color( FL_COLOR col ); 1511 1512 FL_EXPORT void fl_bk_color( FL_COLOR col ); 1513 1514 FL_EXPORT void fl_set_gamma( double r, 1515 double g, 1516 double b ); 1517 1518 FL_EXPORT void fl_show_errors( int y ); 1519 1520 /* Some macros */ 1521 1522 #define FL_max( a, b ) ( ( a ) > ( b ) ? ( a ) : ( b ) ) 1523 #define FL_min( a, b ) ( ( a ) < ( b ) ? ( a ) : ( b ) ) 1524 #define FL_abs( a ) ( ( a ) > 0 ? ( a ) : ( - ( a ) ) ) 1525 #define FL_nint( a ) ( ( int ) ( ( a ) > 0 ? \ 1526 ( ( a ) + 0.5 ) : \ 1527 ( ( a ) - 0.5 ) ) ) 1528 #define FL_nlong( a ) ( ( long ) ( ( a ) > 0 ? \ 1529 ( ( a ) + 0.5 ) : \ 1530 ( ( a ) - 0.5 ) ) ) 1531 #define FL_clamp( a, amin, amax ) ( ( a ) < ( amin ) ? \ 1532 ( amin ) : ( ( a ) > ( amax ) ? \ 1533 ( amax ) : ( a ) ) ) 1534 #define FL_crnd( a ) ( ( FL_Coord ) ( ( a ) > 0 ? \ 1535 ( ( a ) + 0.5 ) : \ 1536 ( ( a ) - 0.5 ) ) ) 1537 1538 typedef int ( * FL_FSCB )( const char *, 1539 void * ); 1540 1541 /* Utilities for new objects */ 1542 1543 FL_EXPORT FL_FORM *fl_current_form; 1544 1545 FL_EXPORT void fl_add_object( FL_FORM * form, 1546 FL_OBJECT * obj ); 1547 1548 FL_EXPORT FL_FORM *fl_addto_form( FL_FORM * form ); 1549 1550 FL_EXPORT FL_OBJECT * fl_make_object( int objclass, 1551 int type, 1552 FL_Coord x, 1553 FL_Coord y, 1554 FL_Coord w, 1555 FL_Coord h, 1556 const char * label, 1557 FL_HANDLEPTR handle ); 1558 1559 FL_EXPORT void fl_add_child( FL_OBJECT *, 1560 FL_OBJECT * ); 1561 1562 FL_EXPORT void fl_set_coordunit( int u ); 1563 1564 FL_EXPORT void fl_set_border_width( int bw ); 1565 1566 FL_EXPORT void fl_set_scrollbar_type( int t ); 1567 1568 #define fl_set_thinscrollbar( t ) \ 1569 fl_set_scrollbar_type( t ? FL_THIN_SCROLLBAR : FL_NORMAL_SCROLLBAR ) 1570 1571 FL_EXPORT void fl_flip_yorigin( void ); 1572 1573 FL_EXPORT int fl_get_coordunit( void ); 1574 1575 FL_EXPORT int fl_get_border_width( void ); 1576 1577 /* Misc. routines */ 1578 1579 FL_EXPORT void fl_ringbell( int percent ); 1580 1581 FL_EXPORT void fl_gettime( long * sec, 1582 long * usec ); 1583 1584 FL_EXPORT const char * fl_now( void ); 1585 1586 FL_EXPORT const char * fl_whoami( void ); 1587 1588 FL_EXPORT long fl_mouse_button( void ); 1589 1590 FL_EXPORT int fl_current_event( void ); 1591 1592 FL_EXPORT char * fl_strdup( const char * s ); 1593 1594 FL_EXPORT void fl_set_err_logfp( FILE * fp ); 1595 1596 FL_EXPORT void fl_set_error_handler( FL_ERROR_FUNC user_func ); 1597 1598 FL_EXPORT char ** fl_get_cmdline_args( int * ); 1599 1600 /* This function was called 'fl_set_error_logfp/' in XForms 0.89. */ 1601 1602 #define fl_set_error_logfp fl_set_err_logfp 1603 1604 #define fl_mousebutton fl_mouse_button 1605 1606 /* These give more flexibility for future changes. Also application 1607 * can re-assign these pointers to whatever function it wants, e.g., 1608 * to a shared memory pool allocator. */ 1609 1610 FL_EXPORT void ( * fl_free )( void * ); 1611 1612 FL_EXPORT void * ( * fl_malloc )( size_t ); 1613 1614 FL_EXPORT void * ( * fl_calloc )( size_t, 1615 size_t ); 1616 1617 FL_EXPORT void * ( * fl_realloc )( void *, 1618 size_t ); 1619 1620 FL_EXPORT int fl_msleep( unsigned long msec ); 1621 1622 #define FL_MAX_MENU_CHOICE_ITEMS 128 1623 1624 typedef const char * ( * FL_VAL_FILTER )( FL_OBJECT *, 1625 double, 1626 int ); 1627 1628 FL_EXPORT int fl_is_same_object( FL_OBJECT * obj1, 1629 FL_OBJECT * obj2 ); 1630 1631 #endif /* ! defined FL_BASIC_H */ 1632 1633