home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / devtools / dataflex / reszclnt.pkg < prev    next >
Encoding:
Text File  |  1993-08-10  |  6.3 KB  |  231 lines

  1. //************************************************************************
  2. //
  3. // Copyright 1987-1992 Data Access Corporation, Miami FL, USA
  4. // All Rights reserved
  5. // DataFlex is a registered trademark of Data Access Corporation.
  6. //
  7. //
  8. //     $Source: /u3/source.30/product/pkg/RCS/reszclnt.pkg,v $
  9. //     $Revision: 1.1 $
  10. //     $State: Exp $
  11. //     $Author: james $
  12. //     $Date: 1992/09/08 14:43:08 $
  13. //     $Locker:  $
  14. //
  15. //     $Log: reszclnt.pkg,v $
  16. //Revision 1.1  1992/09/08  14:43:08  james
  17. //Initial revision
  18. //
  19. //Revision 1.3  92/05/14  17:18:26  SWM
  20. //Updated Copyright slug.
  21. //
  22. //Revision 1.2  92/03/09  19:04:14  james
  23. //Added #CHKSUB directive to insure source
  24. //only compiled with correct revision of 
  25. //compiler.
  26. //
  27. //Revision 1.1  91/10/23  10:22:15  elsa
  28. //Initial revision
  29. //
  30. //************************************************************************/
  31.  
  32. //************************************************************************
  33. //     File Name: ReSzClnt.Pkg
  34. // Creation Date: January 1, 1991
  35. // Modified Date: May 23, 1991
  36. //     Author(s): Steven A. Lowe
  37. //
  38. // This module contains the Resize-Window pop-up object for the Text_Editor
  39. // class.
  40. //
  41. // This package implements a pop-up object for window resizing within a
  42. // text-editor object.
  43. //************************************************************************/
  44.  
  45. #CHKSUB 1 1 // Verify the UI subsystem.
  46.  
  47. Use UI
  48.  
  49.  
  50. /reSizeClientImg
  51. ┌──────────────────────────────┐
  52. │                 ┌──────────┐ │
  53. │  Height... __   │   <__>   │ │
  54. │                 │          │ │
  55. │  Width.... __   │ <______> │ │
  56. │                 └──────────┘ │
  57. └──────────────────────────────┘
  58. /*
  59. Sub_Page xyImg   FROM reSizeClientImg 1 3
  60. Sub_Page BtnsImg FROM reSizeClientImg 2 4
  61.  
  62.  
  63. //
  64. //Attribute: ReSize_Area
  65. //
  66. //Description: re-size window pop-up object
  67. //
  68. //Representation: modified CLIENT instance
  69. //
  70. object ReSize_Area is a CLIENT reSizeClientImg
  71.   set location to 3 26 relative
  72.   set Block_MOUSE_STATE to true
  73.   set DELEGATION_MODE to DELEGATE_PRIOR_LEVEL
  74.   set SCOPE_STATE to TRUE
  75.   set Exit_Msg to cancel_Scope
  76.   procedure cancel_scope
  77.     send deactivate 3
  78.   end_procedure
  79.   on_key kCancel        SEND cancel_scope
  80.   on_key kExit_Function SEND cancel_scope
  81.   //
  82.   //Attribute: ReSize_Form
  83.   //
  84.   //Description: form for entering new window height and width
  85.   //
  86.   //Representation: FORM, with two items sending message NONE
  87.   //
  88.   object ReSize_Form is a FORM xyImg
  89.     set LOCATION to 1 1 relative
  90.     set LOCAL_ROTATE_STATE to TRUE
  91.     item_list 
  92.       on_item "" SEND NEXT  //height
  93.       on_item "" SEND NEXT  //width
  94.     end_item_list 
  95.   end_object
  96.   //
  97.   //Attribute: Button_Area
  98.   //
  99.   //Description: panel of OK and CANCEL buttons
  100.   //
  101.   //Representation: BUTTON, with two items sending messages Request_ReSize
  102.   //
  103.   object Button_Area is a BUTTON BtnsImg
  104.     set location to 1 19 relative
  105.     set entry_msg to check_extent
  106.     item_list
  107.       on_item "OK"     SEND Finis
  108.       on_item "CANCEL" SEND cancel_scope
  109.     end_item_list
  110.   end_object 
  111.   procedure Finis
  112.     send request_resize
  113.     send cancel_Scope
  114.   end_procedure
  115.   //
  116.   //Operation: SET HEIGHT
  117.   //
  118.   //Assumption(s): none
  119.   //
  120.   //Goal(s): set item 0 of ReSize_Form to specified value
  121.   //
  122.   //Algorithm: sets value of ReSize_Form item 0 to Height
  123.   //
  124.   //Usage: 
  125.   //
  126.   procedure Set Height integer ht
  127.     set value of (ReSize_Form(current_object)) item 0 to ht
  128.   end_procedure
  129.   //
  130.   //Operation: HEIGHT
  131.   //
  132.   //Assumption(s): none
  133.   //
  134.   //Goal(s): return value of ReSize_Form's first item
  135.   //
  136.   //Algorithm: gets value of ReSize_Form's item 0 and returns it
  137.   //
  138.   //Usage: 
  139.   //
  140.   function Height returns integer
  141.     local integer i
  142.     get value of (ReSize_Form(current_object)) item 0 to i
  143.     function_Return i
  144.   end_function
  145.   //
  146.   //Operation: SET WIDTH
  147.   //
  148.   //Assumption(s): none
  149.   //
  150.   //Goal(s): set item 1 of ReSize_Form to specified value
  151.   //
  152.   //Algorithm: sets value of ReSize_Form's second item to wdth
  153.   //
  154.   //Usage: 
  155.   //
  156.   procedure Set Width integer wdth
  157.     set value of (ReSize_Form(current_object))  item 1 to wdth
  158.   end_procedure
  159.   //
  160.   //Operation: WIDTH
  161.   //
  162.   //Assumption(s): none
  163.   //
  164.   //Goal(s): return value of ReSize_Form's second item
  165.   //
  166.   //Algorithm: gets value of ReSize_Form's second item and returns it
  167.   //
  168.   //Usage: 
  169.   //
  170.   function Width returns integer
  171.     local integer i
  172.     get value of (ReSize_Form(current_object))  item 1 to i
  173.     function_Return i
  174.   end_function
  175.   //
  176.   //Operation: CHECK_EXTENT
  177.   //
  178.   //Assumption(s): none
  179.   //
  180.   //Goal(s): if extent parameters (height and width) are within proper
  181.   //  range, set shadow_state of Button_Area' OK button to False, else set
  182.   //  it to True
  183.   //
  184.   //Algorithm: get location of prior focus to x and y
  185.   //           if entered height > 0 and <= (ScreenEnd - y),
  186.   //             if width > 0 and width < (SCREEN_WIDTH - x),
  187.   //               set shadow_state of Button_Area' OK item to False and exit
  188.   //           set shadow_state of Button_Area' OK item to True
  189.   //             
  190.   //Usage: invoked on entry to Button_Area
  191.   //
  192.   procedure Check_Extent
  193.     local integer c x y
  194.     get location of (prior_level(current_object)) to y
  195.     move (low(y)) to x
  196.     move (hi(y)) to y
  197.     get height to c
  198.     if ((c > 0) AND (c <= (ScreenEnd - y))) begin  //height ok
  199.       get width to c
  200.       if ((c > 0) AND (c <= (SCREEN_WIDTH - x))) begin
  201.         set shadow_state of (Button_Area(current_object))  item 0 to false
  202.         procedure_return
  203.       end
  204.       else ERROR 499 "Width out of range"
  205.     end
  206.     else ERROR 498 "Height out of range"
  207.     set shadow_state of (Button_Area(current_object))  item 0 to true
  208.   end_procedure
  209.   //
  210.   //Operation: REQUEST_RESIZE
  211.   //
  212.   //Assumption(s): none
  213.   //
  214.   //Goal(s): if height and width parameters are within proper range,
  215.   //  deactivate self and delegate REQUEST_RESIZE, passing height and width
  216.   //
  217.   //Algorithm: send deactivate to self
  218.   //           send Request_ReSize to prior focus
  219.   //
  220.   //Usage: 
  221.   //
  222.   procedure Request_ReSize
  223.     local integer objID
  224.     get prior_level to objID
  225.     send Request_ReSize to objID ;
  226.         (height(current_object)) (width(current_object))
  227.   end_procedure
  228. end_object 
  229.  
  230.  
  231.