home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pmos2002.zip / DEF / GWINDOWS.DEF < prev    next >
Text File  |  1994-04-18  |  6KB  |  154 lines

  1. DEFINITION MODULE GWindows;
  2.  
  3.     (********************************************************)
  4.     (*                            *)
  5.     (*        Windows module for screen graphics        *)
  6.     (*                            *)
  7.     (*  Programmer:        P. Moylan            *)
  8.     (*  Last edited:    18 April 1994            *)
  9.     (*  Status:                        *)
  10.     (*    Mostly working, still adding features.        *)
  11.     (*                            *)
  12.     (********************************************************)
  13.  
  14. FROM ScreenGeometry IMPORT
  15.     (* type *)    Point, Rectangle;
  16.  
  17. FROM Graphics IMPORT
  18.     (* type *)    ColourType;
  19.  
  20. (************************************************************************)
  21.  
  22. TYPE
  23.     Window;    (* is private *)
  24.  
  25.     BorderType = (single, double);
  26.  
  27. (************************************************************************)
  28.  
  29. PROCEDURE InitGraphics (mode: CARDINAL);
  30.  
  31.     (* Sets up the Graphics mode.  Optional, since the module starts up    *)
  32.     (* with a best estimate of the "best" mode possible on the        *)
  33.     (* available hardware.                        *)
  34.  
  35. PROCEDURE OpenWindow (VAR (*OUT*) w: Window;
  36.                 left, bottom, right, top: CARDINAL;
  37.                 Foregrnd, Backgrnd: ColourType;
  38.                 b: BorderType);
  39.  
  40.     (* Creates a new window.    *)
  41.  
  42. PROCEDURE OpenWindowR (VAR (*OUT*) w: Window;  location: Rectangle;
  43.                     Foregrnd, Backgrnd: ColourType;
  44.                     b: BorderType);
  45.  
  46.     (* Same as OpenWindow, except for method of specifying location.    *)
  47.  
  48. PROCEDURE WindowMemory (w: Window;  memory: BOOLEAN);
  49.  
  50.     (* Specifying a FALSE value for the memory parameter means that    *)
  51.     (* subsequent data sent to this window will be written to the    *)
  52.     (* screen but not remembered.  This saves time and memory, the only    *)
  53.     (* penalty being that data covered by an overlapping window will    *)
  54.     (* be lost.  Specifying TRUE restores the default condition, where    *)
  55.     (* all window data are retained for refreshing the screen when    *)
  56.     (* necessary.                            *)
  57.  
  58. PROCEDURE CloseWindow (VAR (*INOUT*) w: Window);
  59.  
  60.     (* Destroys the window.    *)
  61.  
  62. PROCEDURE SetColour (w: Window;  colour: ColourType);
  63.  
  64.     (* Specifies the foreground colour to be used until further notice.    *)
  65.  
  66. PROCEDURE PutPixel (w: Window;  p: Point);
  67.  
  68.     (* Plots a dot at the point (x,y) in window w.  The coordinates are    *)
  69.     (* relative to the bottom left of the window.  If the dot lies    *)
  70.     (* outside the window it will be ignored.                *)
  71.  
  72. PROCEDURE PutPixel2 (w: Window;  x, y: INTEGER);
  73.  
  74.     (* Same as PutPixel, with a different way of specifying the point.    *)
  75.  
  76. PROCEDURE PutPixel2C (w: Window;  x, y: INTEGER;  colour: ColourType);
  77.  
  78.     (* Same as PutPixel2, with the colour explicitly specified.    *)
  79.  
  80. PROCEDURE Line (w: Window;  start, end: Point);
  81.  
  82.     (* Draws a straight line.  The points are relative to the bottom    *)
  83.     (* left corner of w.  Parts of the line lying outside the window    *)
  84.     (* are clipped.                            *)
  85.  
  86. PROCEDURE Line2 (w: Window;  xstart, ystart, xend, yend: INTEGER);
  87.  
  88.     (* The same operation as Line, with a different way of specifying    *)
  89.     (* the parameters.                            *)
  90.  
  91. PROCEDURE Line2C (w: Window;  xstart, ystart, xend, yend: INTEGER;
  92.                             colour: ColourType);
  93.  
  94.     (* The same operation as Line2, but with the colour explicitly    *)
  95.     (* specified.                            *)
  96.  
  97. PROCEDURE GString (w: Window;  x, y: CARDINAL;  text: ARRAY OF CHAR);
  98.  
  99.     (* Writes a horizontal character string at graphics position (x,y)    *)
  100.     (* relative to window w.  Characters which do not fit are not    *)
  101.     (* displayed.  This is not considered to be a text operation since    *)
  102.     (* the text cursor is not affected and there is no line wrap.    *)
  103.  
  104. PROCEDURE GStringUp (w: Window;  x, y: CARDINAL;  text: ARRAY OF CHAR);
  105.  
  106.     (* Like GString, but the string is rotated counterclockwise by    *)
  107.     (* 90 degrees, i.e. it is written in the +Y direction.        *)
  108.  
  109. PROCEDURE ClearWindow (w: Window);
  110.  
  111.     (* Erases all data from w, but keeps it open.    *)
  112.  
  113. (************************************************************************)
  114. (*                TEXT OPERATIONS                *)
  115. (************************************************************************)
  116. (*                                    *)
  117. (*  Every open window has a "text cursor" which is used only for text    *)
  118. (*  operations and is independent of any operations on dots and lines.    *)
  119. (*  The text cursor is updated after any text operation in such a way    *)
  120. (*  that the characters follow one another in the way one would expect    *)
  121. (*  for non-graphics windows.                        *)
  122. (*                                    *)
  123. (************************************************************************)
  124.  
  125. PROCEDURE SetCursor (w: Window;  row, column: CARDINAL);
  126.  
  127.     (* Sets the text cursor to the specified row and column.  The row    *)
  128.     (* and column are measured in units of characters (not pixels),    *)
  129.     (* with (0,0) representing the first character position at the    *)
  130.     (* upper left of the window.                    *)
  131.  
  132. PROCEDURE SaveCursor (w: Window;  VAR (*OUT*) row, column: CARDINAL);
  133.  
  134.     (* Returns the current row and column of the text cursor. *)
  135.  
  136. PROCEDURE WriteChar (w: Window;  ch: CHAR);
  137.  
  138.     (* Writes a horizontal character at the current text cursor        *)
  139.     (* position for window w.  The text cursor is updated.        *)
  140.  
  141. PROCEDURE WriteString (w: Window;  text: ARRAY OF CHAR);
  142.  
  143.     (* Writes a horizontal character string at the current text cursor    *)
  144.     (* position for window w.  Characters which do not fit on the    *)
  145.     (* current line are wrapped around to a new row.            *)
  146.  
  147. PROCEDURE WriteLn (w: Window);
  148.  
  149.     (* Sets the text cursor to the start of the next text line down.    *)
  150.     (* If the cursor reaches the bottom of the window, the text in the    *)
  151.     (* window is scrolled.                        *)
  152.  
  153. END GWindows.
  154.