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 XBasic.h 22 * 23 * X Window dependent stuff 24 * 25 */ 26 27 #ifndef FL_XBASIC_H 28 #define FL_XBASIC_H 29 30 /* Draw mode */ 31 32 enum { 33 FL_XOR = GXxor, 34 FL_COPY = GXcopy, 35 FL_AND = GXand 36 }; 37 38 #define FL_MINDEPTH 1 39 40 41 /* FL_xxx does not do anything anymore, but kept for compatibility */ 42 43 enum { 44 FL_IllegalVisual = -1, 45 FL_StaticGray = StaticGray, 46 FL_GrayScale = GrayScale, 47 FL_StaticColor = StaticColor, 48 FL_PseudoColor = PseudoColor, 49 FL_TrueColor = TrueColor, 50 FL_DirectColor = DirectColor, 51 FL_DefaultVisual = 10 /* special request */ 52 }; 53 54 55 enum { 56 FL_North = NorthGravity, 57 FL_NorthEast = NorthEastGravity, 58 FL_NorthWest = NorthWestGravity, 59 FL_South = SouthGravity, 60 FL_SouthEast = SouthEastGravity, 61 FL_SouthWest = SouthWestGravity, 62 FL_East = EastGravity, 63 FL_West = WestGravity, 64 FL_NoGravity = ForgetGravity, 65 FL_ForgetGravity = ForgetGravity 66 }; 67 68 #ifndef GreyScale 69 #define GreyScale GrayScale 70 #define StaticGrey StaticGray 71 #endif 72 73 #define FL_is_gray( v ) ( ( v ) == GrayScale || ( v ) == StaticGray ) 74 #define FL_is_rgb( v ) ( ( v ) == TrueColor || ( v ) == DirectColor ) 75 76 77 /* Internal colormap size. Not really very meaningful as fl_mapcolor 78 * and company allow color "leakage", that is, although only FL_MAX_COLS 79 * are kept in the internal colormap, the server might have substantially 80 * more colors allocated */ 81 82 #define FL_MAX_COLORS 1024 83 #define FL_MAX_COLS FL_MAX_COLORS 84 85 86 /* FL graphics state information. Some are redundant. */ 87 88 typedef struct { 89 XVisualInfo * xvinfo; 90 XFontStruct * cur_fnt; /* current font in default GC */ 91 Colormap colormap; /* colormap valid for xvinfo */ 92 Window trailblazer; /* a valid window for xvinfo */ 93 int vclass, /* visual class and color depth */ 94 depth; 95 int rgb_bits; /* primary color resolution */ 96 int dithered; /* true if dithered color */ 97 int pcm; /* true if colormap is not shared */ 98 GC gc[ 16 ]; /* working GC */ 99 GC textgc[ 16 ]; /* GC used exclusively for text */ 100 GC dimmedGC; /* A GC having a checkboard stipple */ 101 unsigned long lut[ FL_MAX_COLS ]; /* secondary lookup table */ 102 unsigned int rshift, 103 rmask, 104 rbits; 105 unsigned int gshift, 106 gmask, 107 gbits; 108 unsigned int bshift, 109 bmask, 110 bbits; 111 } FL_State; 112 113 #define FL_STATE FL_State /* for compatibility */ 114 115 116 /***** Global variables ******/ 117 118 FL_EXPORT Display *fl_display; 119 120 FL_EXPORT int fl_screen; 121 122 FL_EXPORT Window fl_root; /* root window */ 123 FL_EXPORT Window fl_vroot; /* virtual root window */ 124 FL_EXPORT int fl_scrh, /* screen dimension in pixels */ 125 fl_scrw; 126 FL_EXPORT int fl_vmode; 127 128 #define fl_visual ( fl_state[ fl_vmode ].xvinfo->visual ) 129 #define fl_colormap ( fl_state[ fl_vmode ].colormap ) 130 131 #define fl_get_visual( ) ( fl_state[ fl_vmode ].xvinfo->visual ) 132 #define fl_get_colormap( ) ( fl_state[ fl_vmode ].colormap ) 133 134 135 /* Current version only runs in single visual mode */ 136 137 #define fl_get_vclass( ) fl_vmode 138 #define fl_get_form_vclass( a ) fl_vmode 139 #define fl_get_gc( ) fl_state[ fl_vmode ].gc[ 0 ] 140 141 FL_EXPORT FL_State fl_state[ ]; 142 143 FL_EXPORT char *fl_ul_magic_char; 144 145 FL_EXPORT double fl_dpi; 146 #define fl_get_dpi( ) ( fl_dpi ) 147 148 FL_EXPORT int fl_mode_capable( int mode, 149 int warn ); 150 151 152 #define fl_default_win( ) ( fl_state[ fl_vmode ].trailblazer ) 153 #define fl_default_window( ) ( fl_state[ fl_vmode ].trailblazer ) 154 155 156 /* All pixmaps used by FL_OBJECT to simulate double buffering have the 157 * following entries in the structure. FL_Coord x,y are used to shift 158 * the origin of the drawing routines */ 159 160 struct FL_pixmap_ { 161 Pixmap pixmap; 162 Window win; 163 Visual * visual; 164 FL_Coord x, 165 y, 166 w, 167 h; 168 int depth; 169 FL_COLOR dbl_background; 170 FL_COLOR pixel; 171 }; 172 173 174 /* Fonts related */ 175 176 #define FL_MAX_FONTSIZES 10 177 #define FL_MAX_FONTNAME_LENGTH 80 178 179 typedef struct { 180 XFontStruct * fs[ FL_MAX_FONTSIZES ]; /* cached fontstruct */ 181 short size[ FL_MAX_FONTSIZES ]; /* cached sizes */ 182 short nsize; /* cached so far */ 183 char fname[ FL_MAX_FONTNAME_LENGTH + 1 ]; /* without size info */ 184 } FL_FONT; 185 186 /* Some basic drawing routines */ 187 188 typedef XPoint FL_POINT; 189 typedef XRectangle FL_RECT; 190 191 /* Rectangles */ 192 193 FL_EXPORT void fl_rectangle( int fill, 194 FL_Coord x, 195 FL_Coord y, 196 FL_Coord w, 197 FL_Coord h, 198 FL_COLOR col ); 199 200 FL_EXPORT void fl_rectbound( FL_Coord x, 201 FL_Coord y, 202 FL_Coord w, 203 FL_Coord h, 204 FL_COLOR col ); 205 206 #define fl_rectf( x, y, w, h, c) fl_rectangle( 1, x, y, w, h, c ) 207 #define fl_rect( x, y, w, h, c ) fl_rectangle( 0, x, y, w, h, c ) 208 209 /* Rectangle with rounded-corners */ 210 211 FL_EXPORT void fl_roundrectangle( int fill, 212 FL_Coord x, 213 FL_Coord y, 214 FL_Coord w, 215 FL_Coord h, 216 FL_COLOR col ); 217 218 #define fl_roundrectf( x, y, w, h, c ) fl_roundrectangle( 1, x, y, w, h, c ) 219 #define fl_roundrect( x, y, w, h, c ) fl_roundrectangle( 0, x, y, w, h, c ) 220 221 /* General polygon and polylines */ 222 223 FL_EXPORT void fl_polygon( int fill, 224 FL_POINT * xp, 225 int n, 226 FL_COLOR col ); 227 228 #define fl_polyf( p, n, c ) fl_polygon( 1, p, n, c ) 229 #define fl_polyl( p, n, c ) fl_polygon( 0, p, n, c ) 230 231 #define fl_polybound( p, n, c ) \ 232 do { fl_polygon( 1, p, n, c ); \ 233 fl_polygon( 0, p, n, FL_BLACK ); \ 234 } while( 0 ) 235 236 FL_EXPORT void fl_lines( FL_POINT * xp, 237 int n, 238 FL_COLOR col ); 239 240 FL_EXPORT void fl_line( FL_Coord xi, 241 FL_Coord yi, 242 FL_Coord xf, 243 FL_Coord yf, 244 FL_COLOR c ); 245 246 FL_EXPORT void fl_point( FL_Coord x, 247 FL_Coord y, 248 FL_COLOR c ); 249 250 FL_EXPORT void fl_points( FL_POINT * p, 251 int np, 252 FL_COLOR c ); 253 254 #define fl_simple_line fl_line 255 256 FL_EXPORT void fl_dashedlinestyle( const char * dash, 257 int ndash ); 258 259 FL_EXPORT void fl_update_display( int block ); 260 261 262 #define fl_diagline( x, y, w, h, c ) \ 263 do \ 264 { \ 265 FL_COORD fli_x = ( x ), fli_y = ( y ); \ 266 fl_line( fli_x, fli_y, fli_x + ( w ) - 1, fli_y + ( h ) - 1, ( c ) ); \ 267 } while ( 0 ) 268 269 /* Line attributes */ 270 271 enum { 272 FL_SOLID = LineSolid, 273 FL_USERDASH = LineOnOffDash, 274 FL_USERDOUBLEDASH = LineDoubleDash, 275 FL_DOT, 276 FL_DOTDASH, 277 FL_DASH, 278 FL_LONGDASH 279 }; 280 281 FL_EXPORT void fl_linewidth( int n ); 282 283 FL_EXPORT void fl_linestyle( int n ); 284 285 FL_EXPORT void fl_drawmode( int request ); 286 287 FL_EXPORT int fl_get_linewidth( void ); 288 289 FL_EXPORT int fl_get_linestyle( void ); 290 291 FL_EXPORT int fl_get_drawmode( void ); 292 293 #define fl_set_linewidth fl_linewidth 294 #define fl_set_linestyle fl_linestyle 295 #define fl_set_drawmode fl_drawmode 296 297 /** Ellipses **/ 298 299 FL_EXPORT void fl_circ( FL_COORD x, 300 FL_COORD y, 301 FL_COORD r, 302 FL_COLOR col ); 303 304 FL_EXPORT void fl_circf( FL_COORD x, 305 FL_COORD y, 306 FL_COORD r, 307 FL_COLOR col ); 308 309 FL_EXPORT void fl_circbound( FL_COORD x, 310 FL_COORD y, 311 FL_COORD r, 312 FL_COLOR col ); 313 314 FL_EXPORT void fl_oval( int fill, 315 FL_Coord x, 316 FL_Coord y, 317 FL_Coord w, 318 FL_Coord h, 319 FL_COLOR col ); 320 321 FL_EXPORT void fl_ovalbound( FL_Coord x, 322 FL_Coord y, 323 FL_Coord w, 324 FL_Coord h, 325 FL_COLOR col ); 326 327 FL_EXPORT void fl_ovalarc( int fill, 328 FL_Coord x, 329 FL_Coord y, 330 FL_Coord w, 331 FL_Coord h, 332 int t0, 333 int dt, 334 FL_COLOR col ); 335 336 #define fl_ovalf( x, y, w, h, c ) fl_oval( 1, x, y, w, h, c ) 337 #define fl_ovall( x, y, w, h, c ) fl_oval( 0, x, y, w, h, c ) 338 #define fl_oval_bound fl_ovalbound 339 340 /* Arcs */ 341 342 FL_EXPORT void fl_arcf( FL_COORD x, 343 FL_Coord y, 344 FL_COORD r, 345 int a1, 346 int a2, 347 FL_COLOR col ); 348 349 FL_EXPORT void fl_arc( FL_COORD x, 350 FL_Coord y, 351 FL_COORD r, 352 int a1, 353 int a2, 354 FL_COLOR col ); 355 356 FL_EXPORT void fl_pieslice( int fill, 357 FL_Coord x, 358 FL_Coord y, 359 FL_Coord w, 360 FL_Coord h, 361 int a1, 362 int a2, 363 FL_COLOR col ); 364 365 /* High level drawing routines */ 366 367 #define fl_drw_frame fl_draw_frame 368 FL_EXPORT void fl_draw_frame( int style, 369 FL_Coord x, 370 FL_Coord y, 371 FL_Coord w, 372 FL_Coord h, 373 FL_COLOR c, 374 int bw ); 375 376 /* 377 * Interfaces 378 */ 379 380 FL_EXPORT XFontStruct *fl_get_fontstruct( int style, 381 int size ); 382 383 #define fl_get_font_struct fl_get_fontstruct 384 #define fl_get_fntstruct fl_get_font_struct 385 386 FL_EXPORT Window fl_get_mouse( FL_Coord * x, 387 FL_Coord * y, 388 unsigned int * keymask ); 389 390 FL_EXPORT void fl_set_mouse( FL_Coord mx, 391 FL_Coord my ); 392 393 FL_EXPORT Window fl_get_win_mouse( Window win, 394 FL_Coord * x, 395 FL_Coord * y, 396 unsigned int * keymask ); 397 398 FL_EXPORT Window fl_get_form_mouse( FL_FORM * fm, 399 FL_Coord * x, 400 FL_Coord * y, 401 unsigned int * keymask ); 402 403 FL_EXPORT FL_FORM * fl_win_to_form( Window win ); 404 405 FL_EXPORT void fl_set_form_icon( FL_FORM * form, 406 Pixmap p, 407 Pixmap m ); 408 409 FL_EXPORT int fl_get_decoration_sizes( FL_FORM * form, 410 int * top, 411 int * right, 412 int * bottom, 413 int * left ); 414 415 FL_EXPORT void fl_raise_form( FL_FORM * form ); 416 417 FL_EXPORT void fl_lower_form( FL_FORM * form ); 418 419 FL_EXPORT void fl_set_foreground( GC gc, 420 FL_COLOR color ); 421 FL_EXPORT void fl_set_background( GC gc, 422 FL_COLOR color ); 423 424 /* General windowing support */ 425 426 FL_EXPORT Window fl_wincreate( const char * label ); 427 428 FL_EXPORT Window fl_winshow( Window win ); 429 430 FL_EXPORT Window fl_winopen( const char * label ); 431 432 FL_EXPORT void fl_winhide( Window win ); 433 434 FL_EXPORT void fl_winclose( Window win ); 435 436 FL_EXPORT void fl_winset( Window win ); 437 438 FL_EXPORT int fl_winreparent( Window win, 439 Window new_parent ); 440 441 FL_EXPORT void fl_winfocus( Window win ); 442 443 FL_EXPORT Window fl_winget( void ); 444 445 FL_EXPORT int fl_iconify( Window win ); 446 447 FL_EXPORT void fl_winresize( Window win, 448 FL_Coord neww, 449 FL_Coord newh ); 450 451 FL_EXPORT void fl_winmove( Window win, 452 FL_Coord dx, 453 FL_Coord dy ); 454 455 FL_EXPORT void fl_winreshape( Window win, 456 FL_Coord dx, 457 FL_Coord dy, 458 FL_Coord w, 459 FL_Coord h ); 460 461 FL_EXPORT void fl_winicon( Window win, 462 Pixmap p, 463 Pixmap m ); 464 465 FL_EXPORT void fl_winbackground( Window win, 466 unsigned long bk ); 467 468 FL_EXPORT void fl_winstepsize( Window win, 469 FL_Coord dx, 470 FL_Coord dy ); 471 472 FL_EXPORT int fl_winisvalid( Window win ); 473 474 FL_EXPORT void fl_wintitle( Window win, 475 const char * title ); 476 477 FL_EXPORT void fl_wintitle_f( Window win, 478 const char * fmt, 479 ... ); 480 481 FL_EXPORT void fl_winicontitle( Window win, 482 const char * title ); 483 484 FL_EXPORT void fl_winicontitle_f( Window win, 485 const char * fmt, 486 ... ); 487 488 FL_EXPORT void fl_winposition( FL_Coord x, 489 FL_Coord y ); 490 491 #define fl_pref_winposition fl_winposition 492 #define fl_win_background fl_winbackground 493 #define fl_winstepunit fl_winstepsize 494 #define fl_set_winstepunit fl_winstepsize 495 496 FL_EXPORT void fl_winminsize( Window win, 497 FL_Coord w, 498 FL_Coord h ); 499 500 FL_EXPORT void fl_winmaxsize( Window win, 501 FL_Coord w, 502 FL_Coord h ); 503 504 FL_EXPORT void fl_winaspect( Window win, 505 FL_Coord x, 506 FL_Coord y ); 507 508 FL_EXPORT void fl_reset_winconstraints( Window win ); 509 510 511 FL_EXPORT void fl_winsize( FL_Coord w, 512 FL_Coord h ); 513 514 FL_EXPORT void fl_initial_winsize( FL_Coord w, 515 FL_Coord h ); 516 517 #define fl_pref_winsize fl_winsize 518 519 FL_EXPORT void fl_initial_winstate( int state ); 520 521 FL_EXPORT Colormap fl_create_colormap( XVisualInfo * xv, 522 int nfill ); 523 524 525 526 FL_EXPORT void fl_wingeometry( FL_Coord x, 527 FL_Coord y, 528 FL_Coord w, 529 FL_Coord h ); 530 531 #define fl_pref_wingeometry fl_wingeometry 532 533 FL_EXPORT void fl_initial_wingeometry( FL_Coord x, 534 FL_Coord y, 535 FL_Coord w, 536 FL_Coord h ); 537 538 FL_EXPORT void fl_noborder( void ); 539 540 FL_EXPORT void fl_transient( void ); 541 542 FL_EXPORT void fl_get_winsize( Window win, 543 FL_Coord * w, 544 FL_Coord * h ); 545 546 FL_EXPORT void fl_get_winorigin( Window win, 547 FL_Coord * x, 548 FL_Coord * y ); 549 550 FL_EXPORT void fl_get_wingeometry( Window win, 551 FL_Coord * x, 552 FL_Coord * y, 553 FL_Coord * w, 554 FL_Coord * h ); 555 556 /* For compatibility */ 557 558 #define fl_get_win_size fl_get_winsize 559 #define fl_get_win_origin fl_get_winorigin 560 #define fl_get_win_geometry fl_get_wingeometry 561 #define fl_initial_winposition fl_pref_winposition 562 563 #define fl_get_display( ) fl_display 564 #define FL_FormDisplay( form ) fl_display 565 #define FL_ObjectDisplay( object ) fl_display 566 #define FL_IS_CANVAS( o ) \ 567 ( ( o )->objclass == FL_CANVAS || ( o )->objclass == FL_GLCANVAS ) 568 569 /* The window an object belongs to - for drawing */ 570 571 #define FL_ObjWin( o ) \ 572 ( FL_IS_CANVAS( o ) ? fl_get_canvas_id( o ) : ( o )->form->window ) 573 574 575 FL_EXPORT Window fl_get_real_object_window( FL_OBJECT * ob ); 576 577 #define FL_OBJECT_WID FL_ObjWin 578 579 /* All registerable events, including Client Message */ 580 581 #define FL_ALL_EVENT ( KeyPressMask \ 582 | KeyReleaseMask \ 583 | ButtonPressMask \ 584 | ButtonReleaseMask \ 585 | EnterWindowMask \ 586 | LeaveWindowMask \ 587 | ButtonMotionMask \ 588 | PointerMotionMask ) 589 590 591 /* Replacements for X functions that access the event queue */ 592 593 FL_EXPORT int fl_XNextEvent( XEvent * xev ); 594 595 FL_EXPORT int fl_XPeekEvent( XEvent * xev ); 596 597 FL_EXPORT int fl_XEventsQueued( int mode ); 598 599 FL_EXPORT void fl_XPutBackEvent( XEvent * xev ); 600 601 FL_EXPORT const XEvent *fl_last_event( void ); 602 603 typedef int ( * FL_APPEVENT_CB )( XEvent *, void * ); 604 605 FL_EXPORT FL_APPEVENT_CB fl_set_event_callback( FL_APPEVENT_CB callback, 606 void * user_data ); 607 608 FL_EXPORT FL_APPEVENT_CB fl_set_idle_callback( FL_APPEVENT_CB callback, 609 void * user_data ); 610 611 FL_EXPORT long fl_addto_selected_xevent( Window win, 612 long mask ); 613 614 FL_EXPORT long fl_remove_selected_xevent( Window win, 615 long mask ); 616 617 #define fl_add_selected_xevent fl_addto_selected_xevent 618 619 FL_EXPORT void fl_set_idle_delta( long delta ); 620 621 FL_EXPORT FL_APPEVENT_CB fl_add_event_callback( Window win, 622 int ev, 623 FL_APPEVENT_CB wincb, 624 void * user_data ); 625 626 FL_EXPORT void fl_remove_event_callback( Window win, 627 int ev ); 628 629 FL_EXPORT void fl_activate_event_callbacks( Window win ); 630 631 FL_EXPORT XEvent *fl_print_xevent_name( const char * where, 632 const XEvent * xev ); 633 634 FL_EXPORT void fl_XFlush( void ); 635 636 #define metakey_down( mask ) ( ( mask ) & Mod1Mask ) 637 #define shiftkey_down( mask ) ( ( mask ) & ShiftMask ) 638 #define controlkey_down( mask ) ( ( mask ) & ControlMask ) 639 #define button_down( mask ) ( ( ( mask ) & Button1Mask ) \ 640 || ( ( mask ) & Button2Mask ) \ 641 || ( ( mask ) & Button3Mask ) \ 642 || ( ( mask ) & Button4Mask ) \ 643 || ( ( mask ) & Button5Mask ) ) 644 645 #define fl_keypressed fl_keysym_pressed 646 647 /****************** Resources ***************/ 648 649 typedef enum { 650 FL_NONE, 651 FL_SHORT = 10, 652 FL_BOOL, 653 FL_INT, 654 FL_LONG, 655 FL_FLOAT, 656 FL_STRING 657 } FL_RTYPE; 658 659 typedef struct { 660 const char * res_name; /* resource name */ 661 const char * res_class; /* resource class */ 662 FL_RTYPE type; /* FL_INT, FL_FLOAT, FL_BOOL, FL_STRING */ 663 void * var; /* address for the variable */ 664 const char * defval; /* default setting in string form */ 665 int nbytes; /* used only for strings */ 666 } FL_RESOURCE; 667 668 #define FL_resource FL_RESOURCE 669 670 #define FL_CMD_OPT XrmOptionDescRec 671 672 FL_EXPORT Display * fl_initialize( int * na, 673 char * arg[ ], 674 const char * appclass, 675 FL_CMD_OPT * appopt, 676 int nappopt ); 677 678 FL_EXPORT void fl_finish( void ); 679 680 FL_EXPORT const char * fl_get_resource( const char * rname, 681 const char * cname, 682 FL_RTYPE dtype, 683 const char * defval, 684 void * val, 685 int size ); 686 687 FL_EXPORT void fl_set_resource( const char * str, 688 const char * val ); 689 690 FL_EXPORT void fl_get_app_resources( FL_RESOURCE * appresource, 691 int n ); 692 693 FL_EXPORT void fl_set_visualID( long id ); 694 695 FL_EXPORT int fl_keysym_pressed( KeySym k ); 696 697 #define buttonLabelSize buttonFontSize 698 #define sliderLabelSize sliderFontSize 699 #define inputLabelSize inputFontSize 700 701 /* All Form control variables. Named closely as its resource name */ 702 703 typedef struct { 704 float rgamma, 705 ggamma, 706 bgamma; 707 int debug, 708 sync; 709 int depth, 710 vclass, 711 doubleBuffer; 712 int ulPropWidth, /* underline stuff */ 713 ulThickness; 714 int buttonFontSize; 715 int sliderFontSize; 716 int inputFontSize; 717 int browserFontSize; 718 int menuFontSize; 719 int choiceFontSize; 720 int labelFontSize; /* all other labels fonts */ 721 int pupFontSize, /* font for pop-up menus */ 722 pupFontStyle; 723 int privateColormap; 724 int sharedColormap; 725 int standardColormap; 726 int scrollbarType; 727 int backingStore; 728 int coordUnit; 729 int borderWidth; 730 int safe; 731 char * rgbfile; /* where RGB file is, not used */ 732 char vname[ 24 ]; 733 } FL_IOPT; 734 735 #define FL_PDButtonLabelSize FL_PDButtonFontSize 736 #define FL_PDSliderLabelSize FL_PDSliderFontSize 737 #define FL_PDInputLabelSize FL_PDInputFontSize 738 739 /* Program default masks */ 740 741 enum { 742 FL_PDDepth = ( 1 << 1 ), 743 FL_PDClass = ( 1 << 2 ), 744 FL_PDDouble = ( 1 << 3 ), 745 FL_PDSync = ( 1 << 4 ), 746 FL_PDPrivateMap = ( 1 << 5 ), 747 FL_PDScrollbarType = ( 1 << 6 ), 748 FL_PDPupFontSize = ( 1 << 7 ), 749 FL_PDButtonFontSize = ( 1 << 8 ), 750 FL_PDInputFontSize = ( 1 << 9 ), 751 FL_PDSliderFontSize = ( 1 << 10 ), 752 FL_PDVisual = ( 1 << 11 ), 753 FL_PDULThickness = ( 1 << 12 ), 754 FL_PDULPropWidth = ( 1 << 13 ), 755 FL_PDBS = ( 1 << 14 ), 756 FL_PDCoordUnit = ( 1 << 15 ), 757 FL_PDDebug = ( 1 << 16 ), 758 FL_PDSharedMap = ( 1 << 17 ), 759 FL_PDStandardMap = ( 1 << 18 ), 760 FL_PDBorderWidth = ( 1 << 19 ), 761 FL_PDSafe = ( 1 << 20 ), 762 FL_PDMenuFontSize = ( 1 << 21 ), 763 FL_PDBrowserFontSize = ( 1 << 22 ), 764 FL_PDChoiceFontSize = ( 1 << 23 ), 765 FL_PDLabelFontSize = ( 1 << 24 ) 766 }; 767 768 #define FL_PDButtonLabel FL_PDButtonLabelSize 769 770 FL_EXPORT void fl_set_defaults( unsigned long mask, 771 FL_IOPT * cntl ); 772 773 FL_EXPORT void fl_set_tabstop( const char * s ); 774 775 FL_EXPORT int fl_get_visual_depth( void ); 776 777 FL_EXPORT int fl_is_global_clipped( void ); 778 779 FL_EXPORT int fl_is_clipped( int include_global ); 780 781 FL_EXPORT int fl_is_text_clipped( int include_global ); 782 783 FL_EXPORT void fl_set_clipping( FL_Coord x, 784 FL_Coord y, 785 FL_Coord w, 786 FL_Coord h ); 787 788 FL_EXPORT void fl_unset_clipping( void ); 789 790 FL_EXPORT void fl_set_text_clipping( FL_Coord x, 791 FL_Coord y, 792 FL_Coord w, 793 FL_Coord h ); 794 795 FL_EXPORT void fl_unset_text_clipping( void ); 796 797 FL_EXPORT int fl_get_global_clipping( FL_COORD * x, 798 FL_COORD * y, 799 FL_COORD * w, 800 FL_COORD * h ); 801 802 FL_EXPORT int fl_get_clipping( int include_global, 803 FL_COORD * x, 804 FL_COORD * y, 805 FL_COORD * w, 806 FL_COORD * h ); 807 808 FL_EXPORT int fl_get_text_clipping( int include_global, 809 FL_COORD * x, 810 FL_COORD * y, 811 FL_COORD * w, 812 FL_COORD * h ); 813 814 FL_EXPORT void fl_set_gc_clipping( GC gc, 815 FL_Coord x, 816 FL_Coord y, 817 FL_Coord w, 818 FL_Coord h ); 819 820 FL_EXPORT void fl_unset_gc_clipping( GC gc ); 821 822 823 /* How we pack and unpack colors */ 824 825 #ifndef FL_PCBITS 826 typedef unsigned char FL_PCTYPE; /* primary color type */ 827 #define FL_PCBITS 8 /* primary color bits */ 828 #define FL_PCMAX ( ( 1 << FL_PCBITS ) - 1 ) 829 #define FL_PCCLAMP( a ) \ 830 ( ( a ) > ( FL_PCMAX ) ? ( FL_PCMAX ) : ( ( a ) < 0 ? 0 : ( a ) ) ) 831 typedef unsigned int FL_PACKED4; 832 #define FL_PACKED FL_PACKED4 833 834 #define FL_RMASK 0x000000ff 835 #define FL_RSHIFT 0 836 #define FL_GMASK 0x0000ff00 837 #define FL_GSHIFT 8 838 #define FL_BMASK 0x00ff0000 839 #define FL_BSHIFT 16 840 #define FL_AMASK 0xff000000 841 #define FL_ASHIFT 24 842 843 /* If PCBITS is not 8, we need to apply the RGBmask */ 844 845 #define FL_GETR( packed ) ( ( ( packed ) >> FL_RSHIFT ) & FL_RMASK ) 846 #define FL_GETG( packed ) ( ( ( packed ) >> FL_GSHIFT ) & FL_PCMAX ) 847 #define FL_GETB( packed ) ( ( ( packed ) >> FL_BSHIFT ) & FL_PCMAX ) 848 #define FL_GETA( packed ) ( ( ( packed ) >> FL_ASHIFT ) & FL_PCMAX ) 849 850 #define FL_PACK3( r, g, b ) \ 851 ( ( ( r ) << FL_RSHIFT ) | ( ( g ) << FL_GSHIFT ) | ( ( b ) << FL_BSHIFT ) ) 852 853 #define FL_PACK FL_PACK3 854 855 #define FL_PACK4( r, g, b, a ) ( FL_PACK3( r, g, b ) | ( ( a ) << FL_ASHIFT ) ) 856 857 #define FL_UNPACK( p, r, g, b ) \ 858 do { r = FL_GETR( p ); \ 859 g = FL_GETG( p ); \ 860 b = FL_GETB( p ); \ 861 } while( 0 ) 862 863 #define FL_UNPACK3 FL_UNPACK 864 865 #define FL_UNPACK4( p, r, g, b, a ) \ 866 do { FL_UNPACK3( p, r, g, b ); \ 867 a = FL_GETA( p ); \ 868 } while( 0 ) 869 870 #endif 871 872 typedef struct { 873 unsigned int rshift, 874 rmask, 875 rbits; 876 unsigned int gshift, 877 gmask, 878 gbits; 879 unsigned int bshift, 880 bmask, 881 bbits; 882 int bits_per_rgb; 883 int colormap_size; 884 } FL_RGB2PIXEL_; 885 886 #define FL_RGB2PIXEL FL_RGB2PIXEL_ 887 888 #endif /* ! defined FL_XBASIC_H */ 889 890 891 /* 892 * Local variables: 893 * tab-width: 4 894 * indent-tabs-mode: nil 895 * End: 896 */ 897