home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / devtools / dataflex / nesting.pkg < prev    next >
Encoding:
Text File  |  1993-08-10  |  10.0 KB  |  345 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/nesting.pkg,v $
  9. //     $Revision: 1.1 $
  10. //     $State: Exp $
  11. //     $Author: james $
  12. //     $Date: 1992/09/08 14:43:07 $
  13. //     $Locker:  $
  14. //
  15. //     $Log: nesting.pkg,v $
  16. //Revision 1.1  1992/09/08  14:43:07  james
  17. //Initial revision
  18. //
  19. //Revision 1.8  92/06/27  09:35:58  lee
  20. //changed inquire_first/last_deo to recurse into client_Areas. this keeps
  21. //child_wrapping from sending get_auto_save_state to clients (which may
  22. //not define auto_save_state property).
  23. //
  24. //Revision 1.7  92/05/29  14:06:09  lee
  25. //removed end_construct_* messages from mixins; now, classes that use the mixin
  26. //send the message that used to be sent by the end_construct_* message (for
  27. //efficiency).
  28. //
  29. //Revision 1.6  92/05/14  15:48:59  unknown
  30. //Updated Copyright slug - SWM.
  31. //
  32. //Revision 1.5  92/04/07  18:03:17  lee
  33. //added NO_STOP option for broadcasting to override default behavior of
  34. //stopping broadcast on a non-zero return value.
  35. //
  36. //Revision 1.4  92/04/03  18:00:16  lee
  37. //updated add_focus/activate/deactivate/release_focus overrides to use (new)
  38. //return value properly.
  39. //
  40. //Revision 1.3  92/03/29  18:45:05  lee
  41. //added MSG_END_CONSTRUCT_OBJECT, moved ENDMAC macro stuff into END_CONSTRUCT-
  42. //OBJECT procedures (in .pkgs). moved Flag_ITems to list.pkg after generalizing
  43. //it based on PROTOTYPE_OBJECT instead of Whether or not it is a table-oriented
  44. //object. Moved define_access_keys mechanism completely into actionbr.pkg.
  45. //fixed two typos: import_class_protocol used !# instead of !3, and register-
  46. //procedure used !1 instead of !2.
  47. //
  48. //Revision 1.2  92/03/09  19:03:42  james
  49. //Added #CHKSUB directive to insure source
  50. //only compiled with correct revision of 
  51. //compiler.
  52. //
  53. //Revision 1.1  91/10/23  10:21:51  elsa
  54. //Initial revision
  55. //
  56. //************************************************************************/
  57.  
  58. //************************************************************************
  59. //     File Name: Nesting.Inc
  60. // Creation Date: January 1, 1991
  61. // Modified Date: June 26, 1991
  62. //     Author(s): Steven A. Lowe
  63. //
  64. // This module defines the properties and operations required to support
  65. // nesting of data-entry objects, collected in the abstract class
  66. // Navigate_Mixin.
  67. //
  68. // This file should be USEd prior to and IMPORTed within the scope of the
  69. // class definition by any user-interface (esp. data-entry) class which
  70. // must support the data-entry object standards.
  71. //
  72. // This file is used by ENTRYFRM.PKG, WIDELIST.PKG, TEXT_WIN.PKG, and
  73. // ENCLIENT.PKG.
  74. //************************************************************************/
  75.  
  76. #CHKSUB 1 1 // Verify the UI subsystem.
  77.  
  78. use ui
  79.  
  80. class nesting_mixin is a message
  81.  
  82.   //
  83.   // Description
  84.   //
  85.   //   This procedure defines the properties required to support the nesting
  86.   //   of data-entry objects.
  87.   //
  88.   // Assumptions/Preconditions
  89.   //
  90.   //   This procedure should only be invoked from within the Construct_Object
  91.   //   procedure of a class definition.
  92.   //
  93.   // Exceptions
  94.   //
  95.   //   None.
  96.   //
  97.   // Notes
  98.   //
  99.   //   Component_State indicates if this object has a parent object which is
  100.   //   also a data-entry object.
  101.   //
  102.   //   Has_Components_State indicates if this object has at least one child-
  103.   //   object which is also a data-entry object.
  104.   //
  105.   //   First_DEO and Last_DEO are used temporarily during the searches for
  106.   //   the first and last data-entry object children of this object (see
  107.   //   Find_First_DEO, Find_Last_DEO, Inquire_First_DEO and Inquire_Last_DEO).
  108.   //
  109.   procedure define_nesting
  110.     Property integer Component_State      PUBLIC  0
  111.     Property integer Has_Components_State PUBLIC  0
  112.     Property integer First_DEO            PUBLIC  0
  113.     Property integer Last_DEO             PUBLIC  0
  114.   end_procedure
  115.  
  116.  
  117.   //
  118.   // Description
  119.   //
  120.   //   If this object is focusable, set First_DEO to this object's id and
  121.   //   return a non-zero value to terminate the parent object's BROADCAST.
  122.   //
  123.   //   This procedure is used to locate the first data-entry object among
  124.   //   this object's siblings (its parent's children).
  125.   //
  126.   // Assumptions/Preconditions
  127.   //
  128.   //   None.
  129.   //
  130.   // Exceptions
  131.   //
  132.   //   None.
  133.   //
  134.   // Notes
  135.   //
  136.   //   This procedure is typically invoked via the BROADCAST command from
  137.   //   the Find_First_DEO function of this object's parent.
  138.   //
  139.   procedure inquire_first_DEO integer obj# integer recurseClients
  140.     if (focus_mode(current_object)) eq FOCUSABLE begin
  141.       if (recurseClients AND client_area_state(current_object)) ;
  142.           broadcast_focus send inquire_first_DEO obj# recurseClients
  143.       else begin
  144.         set first_DEO of obj# to current_object
  145.         procedure_return 1  //to stop broadcast, since this object answered
  146.       end
  147.     end
  148.   end_procedure
  149.  
  150.   //
  151.   // Description
  152.   //
  153.   //   If this object is focusable, set Lastt_DEO to this object's id.
  154.   //
  155.   //   This procedure is used to locate the last data-entry object among
  156.   //   this object's siblings (its parent's children).
  157.   //
  158.   // Assumptions/Preconditions
  159.   //
  160.   //   None.
  161.   //
  162.   // Exceptions
  163.   //
  164.   //   None.
  165.   //
  166.   // Notes
  167.   //
  168.   //   This procedure is typically invoked via the BROADCAST command from
  169.   //   the Find_Last_DEO function of this object's parent.
  170.   //
  171.   procedure inquire_last_DEO integer obj# integer recurseClients
  172.     if (focus_mode(current_object)) eq FOCUSABLE begin
  173.       if (recurseClients AND client_area_state(current_object)) ;
  174.           broadcast_focus send inquire_last_DEO obj# recurseClients
  175.       else set last_DEO of obj# to current_object
  176.     end
  177.   end_procedure
  178.  
  179.   //
  180.   // Description
  181.   //
  182.   //   This function returns the object id of the first data-entry object
  183.   //   which is a child of this object, or 0.
  184.   //
  185.   // Assumptions/Preconditions
  186.   //
  187.   //   None.
  188.   //
  189.   // Exceptions
  190.   //
  191.   //   None.
  192.   //
  193.   // Notes
  194.   //
  195.   //   This function 'searches' by broadcasting Inquire_First_DEO, which
  196.   //   returns a 1 to terminate the broadcast after the first data-entry
  197.   //   object has been located.
  198.   //
  199.   function find_first_DEO returns integer
  200.     set First_DEO to 0
  201.     broadcast_focus send inquire_first_DEO current_object FALSE //sets First_DEO property
  202.     function_return (first_deo(current_object))
  203.   end_function
  204.  
  205.  
  206.   //
  207.   // Description
  208.   //
  209.   //   This function returns the object id of the last data-entry object
  210.   //   which is a child of this object, or 0.
  211.   //
  212.   // Assumptions/Preconditions
  213.   //
  214.   //   None.
  215.   //
  216.   // Exceptions
  217.   //
  218.   //   None.
  219.   //
  220.   // Notes
  221.   //
  222.   //   This function 'searches' by broadcasting Inquire_Last_DEO, which sets
  223.   //   the property Last_DEO.  Thus, the last object reached by the broadcast
  224.   //   is the last value to be set into Last_DEO.
  225.   //
  226.   function find_last_DEO returns integer
  227.     set Last_DEO to 0
  228.     broadcast_focus send inquire_last_DEO current_object FALSE //sets Last_DEO property
  229.     function_return (Last_DEO(current_object))
  230.   end_function
  231.  
  232.  
  233.   //
  234.   // Description
  235.   //
  236.   //   Removes this object from the screen and focus-tree, and also removes
  237.   //   this object's children from the screen and focus-tree.
  238.   //
  239.   // Assumptions/Preconditions
  240.   //
  241.   //   This object must understand Client_Area_State.
  242.   //
  243.   // Exceptions
  244.   //
  245.   //   None.
  246.   //
  247.   // Notes
  248.   //
  249.   //   If no flag argument was passed, AREA_TYPE becomes the flag parameter.
  250.   //
  251.   //   Client-objects already automatically remove their children from the
  252.   //   focus-tree.
  253.   //
  254.   procedure deactivate integer flag returns integer
  255.     local integer retval
  256.     if NUM_ARGUMENTS gt 0 begin
  257.       forward get msg_deactivate flag to retval
  258.       
  259.       if (not(retval) AND (flag = 0) AND ;
  260.         (client_Area_state(current_object) = 0)) ;
  261.         broadcast NO_STOP send deactivate 0
  262.     end
  263.     else forward get msg_deactivate AREA_TYPE to retval
  264.     procedure_return retval
  265.   end_procedure
  266.  
  267.  
  268.   //
  269.   // Description
  270.   //
  271.   //   This procedure adds this object into the focus-tree as a child of the
  272.   //   specified toObj#, and also add the child-objects of this object into
  273.   //   the focus-tree as children of this object.
  274.   //
  275.   // Assumptions/Preconditions
  276.   //
  277.   //   This object must understand Client_Area_State.
  278.   //
  279.   // Exceptions
  280.   //
  281.   //   None.
  282.   //
  283.   // Notes
  284.   //
  285.   //   Client-objects already automatically add their children into the focus-
  286.   //   tree.
  287.   //
  288.   procedure add_focus integer toObj# returns integer
  289.     local integer retval
  290.     forward get msg_add_focus toObj# to retval
  291.     if (not(retval) AND (client_area_State(current_object) = 0)) ;
  292.         broadcast NO_STOP send add_focus current_object
  293.     procedure_return retval
  294.   end_procedure
  295.  
  296.  
  297.   //
  298.   // Description
  299.   //
  300.   //   This procedure marks an object as a child data-entry object, and
  301.   //   attempts to use its parent's Server if this object has no Server.
  302.   //
  303.   // Assumptions/Preconditions
  304.   //
  305.   //   None.
  306.   //
  307.   // Exceptions
  308.   //
  309.   //   None.
  310.   //
  311.   // Notes
  312.   //
  313.   //   Typically senbt via broadcast from parent DEO.
  314.   //
  315.   procedure Mark_As_Component
  316.     set Component_State to true
  317.     delegate set Has_Components_State to true
  318.   end_procedure
  319.  
  320.  
  321.   //
  322.   // Description
  323.   //
  324.   //   This procedure marks child data-entry objects as components.
  325.   //
  326.   // Assumptions/Preconditions
  327.   //
  328.   //   The child data-entry objects must understand Mark_As_Component as a
  329.   //   method of setting their Component_State to TRUE.
  330.   //
  331.   // Exceptions
  332.   //
  333.   //   None.
  334.   //
  335.   // Notes
  336.   //
  337.   //   Invoked by the DEOEnd macro (which manages completion of an object
  338.   //   declaration).
  339.   //
  340.   procedure Mark_Components
  341.     set Component_State to false
  342.     broadcast send Mark_As_Component
  343.   end_procedure
  344. end_class
  345.