home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pmos2002.zip / DEF / userinte.def < prev    next >
Text File  |  1997-05-11  |  6KB  |  107 lines

  1. DEFINITION MODULE UserInterface;
  2.  
  3.         (****************************************************************)
  4.         (*                                                              *)
  5.         (*              Text User Interface for PMOS                    *)
  6.         (*                                                              *)
  7.         (*      This module allows you to put selected text windows     *)
  8.         (*      under the control of the mouse.  In the present         *)
  9.         (*      version, the controls available are for repositioning   *)
  10.         (*      and for hiding windows.  The module also lets you       *)
  11.         (*      define "active regions" within windows, i.e. regions    *)
  12.         (*      within which a mouse click will cause a caller-supplied *)
  13.         (*      procedure to be executed.                               *)
  14.         (*                                                              *)
  15.         (*              Original version by M.Walsh.                    *)
  16.         (*                This version by P.Moylan                      *)
  17.         (*                                                              *)
  18.         (*      Last Edited:    11 May 1997                             *)
  19.         (*      Status:         OK                                      *)
  20.         (*                                                              *)
  21.         (****************************************************************)
  22.  
  23. FROM Mouse IMPORT
  24.     (* type *)  ButtonSet;
  25.  
  26. FROM Windows IMPORT
  27.     (* type *)  RowRange, ColumnRange, Window;
  28.  
  29. (************************************************************************)
  30.  
  31. TYPE
  32.     (* A UIWindow is like a Window from module Windows, but it has      *)
  33.     (* a few extra attributes added for the purposes of this module.    *)
  34.  
  35.     UIWindow;   (* is private *)
  36.  
  37.     (* The capabilities which you can add to a Window by making it into *)
  38.     (* a UIWindow are:                                                  *)
  39.     (*  wshow   left click anywhere on visible part of window (except,  *)
  40.     (*          of course, regions for which other click actions are    *)
  41.     (*          defined) brings it to the top of the stack of windows.  *)
  42.     (*          This will also change the input focus in cases where    *)
  43.     (*          a task is waiting for keyboard input in this window.    *)
  44.     (*  whide   window gets a "hide button", and left clicking on this  *)
  45.     (*          makes the window invisible.                             *)
  46.     (*  wmove   window gets a "move button", and you can drag the       *)
  47.     (*          window around the screen with the left or right button. *)
  48.     (*  wescape window gets a "hide button", and left clicking on this  *)
  49.     (*          simulates an Esc from the keyboard.  Note that this     *)
  50.     (*          option supersedes the operation of whide, since the     *)
  51.     (*          same button location is used for both.                  *)
  52.  
  53.     Capability = (wshow, wmove, whide, wescape);
  54.     CapabilitySet = SET OF Capability;
  55.  
  56.     (* This module also gives a special meaning to a right mouse click  *)
  57.     (* on a blank area of the screen: it brings up a list of windows    *)
  58.     (* for which mouse control is enabled, and you can click on a       *)
  59.     (* window name to bring that window to the top of the display.      *)
  60.     (* This is a way of getting back hidden windows.                    *)
  61.  
  62.     (* An Action procedure is one to be called on a mouse click in a    *)
  63.     (* defined Active Region.  The parameters identify the window       *)
  64.     (* which was clicked on, and the row and column within that window. *)
  65.  
  66.     Action = PROCEDURE (Window, RowRange, ColumnRange);
  67.  
  68. (************************************************************************)
  69. (*              ACTIVATING MOUSE CONTROL FOR A WINDOW                   *)
  70. (************************************************************************)
  71.  
  72. PROCEDURE AllowMouseControl (w: Window;  Title: ARRAY OF CHAR;
  73.                                 OptionsEnabled: CapabilitySet): UIWindow;
  74.  
  75.     (* Adds w to the set of windows which this module is allowed to     *)
  76.     (* manipulate.  The window should already be open (but not          *)
  77.     (* necessarily visible).  The Title parameter gives a name to be    *)
  78.     (* used when a list of windows is displayed.                        *)
  79.  
  80. (************************************************************************)
  81. (*                      DEFINING ACTIVE REGIONS                         *)
  82. (************************************************************************)
  83.  
  84. PROCEDURE AddActiveRegion (UIW: UIWindow; Top, Bottom: RowRange;
  85.                         Left, Right: ColumnRange;  ButtonsEnabled: ButtonSet;
  86.                         ActionProc: Action);
  87.  
  88.     (* After a call to this procedure, any mouse click on a button in   *)
  89.     (* ButtonsEnabled, and in the rectangle defined by the other        *)
  90.     (* parameters, will cause ActionProc to be called.                  *)
  91.     (* Note: Active regions may overlap.  In the event of an ambiguity, *)
  92.     (* the more recently defined active region takes precedence.        *)
  93.  
  94. PROCEDURE OutsideWindowHandler (UIW: UIWindow;  ActionProc: PROC);
  95.  
  96.     (* Like AddActiveRegion, except that in this case the region in     *)
  97.     (* question is the entire screen outside this window.  If this      *)
  98.     (* procedure has been called, mouse clicks are still sent to        *)
  99.     (* other windows, but only after ActionProc has been called.        *)
  100.     (* If several "outside window" handlers have been defined, they     *)
  101.     (* are called in last-in-first-out order, the sequence of calls     *)
  102.     (* stopping when we finally reach an action procedure that          *)
  103.     (* belongs to a window that is visible at the click location.       *)
  104.  
  105. END UserInterface.
  106.  
  107.