home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sa104os2.zip / SATHR104.ZIP / SATHER / CONTRIB / SCHNETTR / XLIB / GC.SA < prev    next >
Text File  |  1994-11-21  |  2KB  |  61 lines

  1. -- -*-Sather-*-
  2. -- access to the X window system routines
  3. -- (c) 1994/11/03 - 1994/11/21 by Erik Schnetter
  4.    
  5.    
  6.    
  7. class X_GC_DEFS is
  8.    -- constants
  9.    const FillSolid := 0;
  10.    const FillTiled := 1;
  11.    const FillStippled := 2;
  12.    const FillOpaqueStippled := 3;
  13. end; -- class X_GC_DEFS
  14.    
  15.    
  16.    
  17. class X_GC is
  18.    -- handle a GC (graphical context)
  19.    
  20. -- internal representation
  21.    private attr display: X_DISPLAY;
  22.    readonly attr c_gc: EXT_OB;
  23.    
  24. -- constants
  25.    private const int_count := 19;
  26.    private const ext_ob_count := 4;;
  27.    
  28.    create: SAME is return new end;
  29.    
  30.    create (display: X_DISPLAY, c_gc: EXT_OB): SAME post ~Void is
  31.       res::=new; res.display:=display; res.c_gc:=c_gc; return res end;
  32.    
  33. -- is this object attached to a GC?
  34.    Void: BOOL is return void(self) or void(c_gc) end;
  35.    
  36. -- set foreground color
  37.    foreground (color: INT) pre ~Void is
  38.       C_X_GC::X_ChangeGC_foreground (display.c_display, c_gc, color);
  39.    end; -- foreground
  40.    
  41. -- set background color
  42.    background (color: INT) pre ~Void is
  43.       C_X_GC::X_ChangeGC_background (display.c_display, c_gc, color);
  44.    end; -- background
  45.    
  46. -- set fill style
  47. -- candidate for a bound routine!
  48.    fill_style (style: INT) pre ~Void is
  49.       C_X_GC::X_ChangeGC_fill_style (display.c_display, c_gc, style);
  50.    end; -- fill_style
  51. end; -- class X_GC
  52.    
  53.    
  54.    
  55. external class C_X_GC is
  56.    X_ChangeGC_foreground (display: EXT_OB, gc: EXT_OB, color: INT);
  57.    X_ChangeGC_background (display: EXT_OB, gc: EXT_OB, color: INT);
  58.    X_ChangeGC_fill_style (display: EXT_OB, gc: EXT_OB, style: INT);
  59. end; -- class C_X_GC
  60.  
  61.