home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / devtools / dataflex / navigate.pkg < prev    next >
Encoding:
Text File  |  1993-08-10  |  10.6 KB  |  417 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/navigate.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: navigate.pkg,v $
  16. //Revision 1.1  1992/09/08  14:43:07  james
  17. //Initial revision
  18. //
  19. //Revision 1.4  92/05/14  15:49:42  unknown
  20. //Updated Copyright slug - SWM.
  21. //
  22. //Revision 1.3  92/04/01  00:33:36  lee
  23. //removed navstart and liststart (unused), renamed bind_main_file and bind_index
  24. //in datalist to bind_list_main_file and bind_list_index to avoid conflict with
  25. //commands used by data_set, moved bind_static from sellist to datalist as it
  26. //only sets properties defined in datalist (not sellist).
  27. //
  28. //Revision 1.2  92/03/09  19:03:38  james
  29. //Added #CHKSUB directive to insure source
  30. //only compiled with correct revision of 
  31. //compiler.
  32. //
  33. //Revision 1.1  91/10/23  10:21:48  elsa
  34. //Initial revision
  35. //
  36. //************************************************************************/
  37.  
  38. //************************************************************************
  39. //     File Name: Navigate.Inc
  40. // Creation Date: January 1, 1991
  41. // Modified Date: June 26, 1991
  42. //     Author(s): Steven A. Lowe
  43. //
  44. // This module defines the basic data-entry object operations and
  45. // properties, collected in the abstract class Navigate_Mixin.
  46. //
  47. // This file should be USEd prior to and IMPORTed within the scope of the
  48. // class definition by any user-interface (esp. data-entry) class which
  49. // must support the data-entry object standards.
  50. //
  51. // This file is used by ENTRYFRM.PKG, WIDELIST.PKG, TEXT_WIN.PKG, and
  52. // ENCLIENT.PKG.
  53. //************************************************************************/
  54.  
  55.  
  56. //
  57. // Description
  58. //
  59. //   Defines the panel navigation keys if necessary.
  60. //
  61. // Assumptions/Preconditions
  62. //
  63. //   None.
  64. //
  65. // Exceptions
  66. //
  67. //   If kSwitch_Panel and kSwitch_Panel_Back are already defined, no
  68. //   action is taken.
  69. //
  70. // Notes
  71. //
  72. //   Used in on-key commands in define_navigation, below.
  73. //
  74. #IFDEF kSwitch_Panel
  75. #ELSE
  76.   #REPLACE kSwitch_Panel KEY_ALT+KEY_F6
  77. #ENDIF
  78. #IFDEF kSwitch_Panel_Back
  79. #ELSE
  80.   #REPLACE kSwitch_Panel_Back KEY_CTRL+KEY_F6
  81. #ENDIF
  82.  
  83.  
  84. //
  85. // Description
  86. //
  87. //   Define a synonym for Request_Cancel.
  88. //
  89. // Assumptions/Preconditions
  90. //
  91. //   None.
  92. //
  93. // Exceptions
  94. //
  95. //   If MSG_CANCEL_SCOPE is already defined, no action is taken.
  96. //
  97. // Notes
  98. //
  99. //   Defined for historical reasons.
  100. //
  101. #IFDEF MSG_CANCEL_SCOPE
  102. #ELSE
  103.   #REPLACE MSG_CANCEL_SCOPE MSG_REQUEST_CANCEL
  104. #ENDIF
  105.  
  106. #CHKSUB 1 1 // Verify the UI subsystem.
  107.  
  108. use ui
  109. class navigate_mixin is a message
  110.  
  111.   //
  112.   // Description
  113.   //
  114.   //   This procedure defines the accelerator keys and properties required to
  115.   //   support the data-entry object navigation standard.
  116.   //
  117.   // Assumptions/Preconditions
  118.   //
  119.   //   This procedure should only be invoked by the Construct_Object procedure
  120.   //   of a class definition.
  121.   //
  122.   // Exceptions
  123.   //
  124.   //   None.
  125.   //
  126.   // Notes
  127.   //
  128.   //   Auto_Top_Panel_State determines if the Clear operation should rotate
  129.   //   to the first object/item in the current group.
  130.   //
  131.   //   Verify_Exit_Msg holds a message id (function) which is used to prompt
  132.   //   the user during exit confirmation.  If Verify_Exit_Msg is 0, the user
  133.   //   will not be prompted to confirm exit.  Verify_Exit_Msg is a private
  134.   //   property, but access operations are defined below to allow it to be
  135.   //   visible (public).
  136.   //
  137.   procedure define_navigation
  138.     on_key kBegin_of_Panel    SEND Beginning_of_Panel PRIVATE
  139.     on_key kCancel            SEND Request_Cancel     PRIVATE
  140.     on_key kEnd_of_Panel      SEND End_of_Panel       PRIVATE
  141.     on_key kExit_Function     SEND Exit_Function      PRIVATE
  142.     on_key kSwitch            SEND Switch             PRIVATE
  143.     on_key kSwitch_Back       SEND Switch_Back        PRIVATE
  144.     on_key kSwitch_Panel      SEND Switch_Next_Group  PRIVATE
  145.     on_key kSwitch_Panel_Back SEND Switch_Prior_Group PRIVATE
  146.     Property integer Auto_Top_Panel_State             PUBLIC  1
  147.     Property integer private.Verify_Exit_Msg          PUBLIC  0
  148.   end_procedure
  149.  
  150.  
  151.   //
  152.   // Description
  153.   //
  154.   //   This function returns a message id to be used to prompt the user
  155.   //   during exit confirmation, or it returns 0.
  156.   //
  157.   // Assumptions/Preconditions
  158.   //
  159.   //   This object must understand the Get_Component_State message (defined
  160.   //   in NESTING.INC).
  161.   //
  162.   // Exceptions
  163.   //
  164.   //   None.
  165.   //
  166.   // Notes
  167.   //
  168.   //   If this object's Verify_Exit_Msg is 0, this function returns the value
  169.   //   of the parent object's Verify_Exit_Msg, if this object has a parent
  170.   //   (indicated by Component_State = TRUE).
  171.   //
  172.   function verify_exit_msg returns integer
  173.     local integer msg#
  174.     get private.verify_exit_msg to msg#
  175.     if (msg# = 0 AND Component_State(current_object)) ;
  176.         delegate get verify_exit_msg to msg#
  177.     function_return msg#
  178.   end_function
  179.  
  180.  
  181.   //
  182.   // Description
  183.   //
  184.   //   This procedure sets the value of the Verify_Exit_Msg property.
  185.   //
  186.   // Assumptions/Preconditions
  187.   //
  188.   //   msg# should be a vlid messaage id, or 0.
  189.   //
  190.   // Exceptions
  191.   //
  192.   //   None.
  193.   //
  194.   // Notes
  195.   //
  196.   //   None.
  197.   //
  198.   procedure SET verify_exit_msg integer msg#
  199.     set private.verify_Exit_Msg to msg#
  200.   end_procedure
  201.  
  202.  
  203.   //
  204.   // Description
  205.   //
  206.   //   This function sends the message which this object uses to prompt the
  207.   //   user during exit confirmation.  The result of the message-send is
  208.   //   returned.  A return value of 0 means that exit should continue, a non-
  209.   //   zero return value means that exiting should be aborted.
  210.   //
  211.   // Assumptions/Preconditions
  212.   //
  213.   //   None.
  214.   //
  215.   // Exceptions
  216.   //
  217.   //   If this object has no message with which to prompt the user, this
  218.   //   function returns 0 to permit exit without confirmation.
  219.   //
  220.   // Notes
  221.   //
  222.   //   None.
  223.   //
  224.   function verify_Exit returns integer
  225.     local integer msg#
  226.     get verify_Exit_msg to msg#
  227.     if msg# ne 0 get msg# to msg#
  228.     function_return msg#
  229.   end_function
  230.  
  231.  
  232.   #IFSUB 'AREA_FLAG'
  233.   #ELSE
  234.     #REPLACE AREA_FLAG 3  //scope AND popup
  235.   #ENDIF
  236.  
  237.  
  238.   //
  239.   // Description
  240.   //
  241.   //   This procedure deactivates this object and ensures that the focus after
  242.   //   deactivation is not an object which should be 'skipped' (in rotation,
  243.   //   e.g. an action-bar), if possible.
  244.   //
  245.   // Assumptions/Preconditions
  246.   //
  247.   //   None.
  248.   //
  249.   // Exceptions
  250.   //
  251.   //   Deactivation may be cancelled by the user via the Verify_Exit function.
  252.   //
  253.   // Notes
  254.   //
  255.   //   the deactivate message-send passes AREA_FLAG, which means that we want
  256.   //   to deactivate the object in the focus tree which is either a scope
  257.   //   (i.e. Scope_State = TRUE) or a pop-up (i.e. PopUp_State = TRUE), and
  258.   //   which is closest to this object in an 'upward' direction (i.e.
  259.   //   client/parent, not child or sibling).
  260.   //
  261.   procedure Request_Cancel
  262.     local integer foc#
  263.     if (verify_exit(current_object) = 0) begin
  264.       send deactivate AREA_FLAG
  265.       get focus of desktop to foc#
  266.       if (foc# AND skip_State(foc#)) send switch to foc#
  267.     end
  268.   end_procedure
  269.  
  270.  
  271.   //
  272.   // Description
  273.   //
  274.   //   This procedure gives the focus to the first object/item in this group
  275.   //   (parent-child hierarchy).
  276.   //
  277.   // Assumptions/Preconditions
  278.   //
  279.   //   This object understands Component_State, Scope_State, and Top_of_Panel.
  280.   //
  281.   // Exceptions
  282.   //
  283.   //   None.
  284.   //
  285.   // Notes
  286.   //
  287.   //   To find the first object in the panel, delegation is first used to
  288.   //   find the "parent-most" object, then Top_of_Panel is used to find the
  289.   //   first object/item within the "parent-most" object.
  290.   //
  291.   procedure Beginning_of_Panel
  292.     if (Component_State(current_object)) begin
  293.       if (Scope_State(current_object)) ;
  294.           send top_of_panel
  295.       else delegate send Beginning_of_Panel
  296.     end
  297.     else send Top_of_Panel
  298.   end_procedure
  299.  
  300.  
  301.   //
  302.   // Description
  303.   //
  304.   //   This procedure gives the focus to the last object/item in this group
  305.   //   (parent-child hierarchy).
  306.   //
  307.   // Assumptions/Preconditions
  308.   //
  309.   //   This object understands Component_State, Scope_State, and
  310.   //   Bottom_of_Panel.
  311.   //
  312.   // Exceptions
  313.   //
  314.   //   None.
  315.   //
  316.   // Notes
  317.   //
  318.   //   To find the first object in the panel, delegation is first used to
  319.   //   find the "parent-most" object, then Bottom_of_Panel is used to find the
  320.   //   last object/item within the "parent-most" object.
  321.   //
  322.   procedure End_of_Panel
  323.     if (Component_State(current_object)) begin
  324.       if (Scope_State(current_object)) ;
  325.           send bottom_of_panel
  326.       else delegate send End_of_Panel
  327.     end
  328.     else send Bottom_Of_Panel
  329.   end_procedure
  330.  
  331.  
  332.   //
  333.   // Description
  334.   //
  335.   //   This procedure deactivates this object.
  336.   //
  337.   // Assumptions/Preconditions
  338.   //
  339.   //   This object understands Request_Cancel
  340.   //
  341.   // Exceptions
  342.   //
  343.   //   None.
  344.   //
  345.   // Notes
  346.   //
  347.   //   None.
  348.   //
  349.   procedure Exit_Function
  350.     send request_cancel
  351.   end_procedure
  352.  
  353. end_class
  354.  
  355.  
  356. //
  357. // Description
  358. //
  359. //   This macro processes the POP_UP (or POPUP) option, if any, of an
  360. //   object-creation command line.  It sets the PopUp_State and Focus_Mode
  361. //   of this object as appropriate if the POPUP/POP_UP option is present.
  362. //
  363. // Assumptions/Preconditions
  364. //
  365. //   None.
  366. //
  367. // Exceptions
  368. //
  369. //   If POP_UP or POPUP does not appear on the command line, no action is
  370. //   taken.
  371. //
  372. // Notes
  373. //
  374. //   If POP_UP or POPUP appears, PopUp_State will be set to TRUE, and
  375. //   Focus_Mode will be set to NO_ACTIVATE.
  376. //
  377. #COMMAND bind_pop_up
  378.   #IF (!0>0)
  379.     #IFSAME !1 POP_UP POPUP
  380.       set PopUp_State to TRUE
  381.       set focus_mode to NO_ACTIVATE
  382.     #ELSE
  383.       bind_pop_up !2 !3 !4 !5 !6 !7 !8 !9
  384.     #ENDIF
  385.   #ENDIF
  386. #ENDCOMMAND
  387.  
  388.  
  389. //
  390. // Description
  391. //
  392. //   This macro processes the RING option, if any, of an object-creation
  393. //   command line.  It sets the Ring_State to TRUE if the option is present.
  394. //   
  395. //
  396. // Assumptions/Preconditions
  397. //
  398. //   None.
  399. //
  400. // Exceptions
  401. //
  402. //   If RING does not appear on the command line, no action is taken.
  403. //
  404. // Notes
  405. //
  406. //   None.
  407. //
  408. #COMMAND bind_ring
  409.   #IF (!0>0)
  410.     #IFSAME !1 RING
  411.       set Ring_State to TRUE
  412.     #ELSE
  413.       bind_ring !2 !3 !4 !5 !6 !7 !8 !9
  414.     #ENDIF
  415.   #ENDIF
  416. #ENDCOMMAND
  417.