home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / devtools / dataflex / widelist.pkg < prev    next >
Encoding:
Text File  |  1993-08-10  |  7.8 KB  |  252 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/widelist.pkg,v $
  9. //     $Revision: 1.1 $
  10. //     $State: Exp $
  11. //     $Author: james $
  12. //     $Date: 1992/09/08 14:43:10 $
  13. //     $Locker:  $
  14. //
  15. //     $Log: widelist.pkg,v $
  16. //Revision 1.1  1992/09/08  14:43:10  james
  17. //Initial revision
  18. //
  19. //Revision 1.10  92/06/19  16:32:11  james
  20. //Last minute changes made to correct problem with 
  21. //SWITCH_BACK
  22. //
  23. //Revision 1.9  92/06/05  16:32:59  steve-l
  24. //altered set current_item occurrances to use set item false/true/2/3 instead,
  25. //in order ot properly handle displayonly/noenter items on top-of-panel et al.
  26. //
  27. //Revision 1.8  92/06/03  15:17:53  steve-l
  28. //altered Child_Wrapping for proper argument dereferencing
  29. //
  30. //Revision 1.7  92/06/03  15:11:03  steve-l
  31. //altered child_Wrapping for new argument
  32. //
  33. //Revision 1.6  92/05/29  14:05:59  lee
  34. //removed end_construct_* messages from mixins; now, classes that use the mixin
  35. //send the message that used to be sent by the end_construct_* message (for
  36. //efficiency).
  37. //
  38. //Revision 1.5  92/05/14  17:06:50  SWM
  39. //Updated Copyright slug.
  40. //
  41. //Revision 1.4  92/04/20  18:04:31  lee
  42. //added image argument error checking
  43. //
  44. //Revision 1.3  92/03/29  18:45:23  lee
  45. //added MSG_END_CONSTRUCT_OBJECT, moved ENDMAC macro stuff into END_CONSTRUCT-
  46. //OBJECT procedures (in .pkgs). moved Flag_ITems to list.pkg after generalizing
  47. //it based on PROTOTYPE_OBJECT instead of Whether or not it is a table-oriented
  48. //object. Moved define_access_keys mechanism completely into actionbr.pkg.
  49. //fixed two typos: import_class_protocol used !# instead of !3, and register-
  50. //procedure used !1 instead of !2.
  51. //
  52. //Revision 1.2  92/03/09  19:05:49  james
  53. //Added #CHKSUB directive to insure source
  54. //only compiled with correct revision of 
  55. //compiler.
  56. //
  57. //Revision 1.1  91/10/23  10:23:15  elsa
  58. //Initial revision
  59. //
  60. //************************************************************************/
  61.  
  62. //************************************************************************
  63. //     File Name: WideList.Pkg
  64. // Creation Date: January 1, 1991
  65. // Modified Date: July 1, 1991
  66. //     Author(s): Steven A. Lowe
  67. //
  68. // This module contains the Wide_List class definition.
  69. //************************************************************************/
  70.  
  71. #CHKSUB 1 1 // Verify the UI subsystem.
  72.  
  73. Use Nesting
  74. Use Navigate
  75. Use ActionBr
  76. Use EntItem
  77.  
  78. //
  79. // must set item_limit to use; defaults to 1
  80. //
  81. class Wide_List is an ENTRYLIST STARTMAC WLstart
  82.   procedure construct_object integer img
  83.     forward send construct_object img
  84.     set entry_msg to Initialize_List
  85.     set item_limit to 1
  86.     set auto_top_item_state to FALSE
  87.     on_key kUPARROW   send up_row   PRIVATE
  88.     on_key kDOWNARROW send down_row PRIVATE
  89.     send define_nesting     //invoke DEO nesting standard support constructor
  90.     send define_navigation  //invoke DEO navigation standard support constructor
  91.     send define_Action_bar  //invoke action-bar support constructor
  92.     send define_entry_item  //invoke Entry-Item support constructor
  93.   end_procedure
  94.  
  95.   IMPORT_CLASS_PROTOCOL Nesting_Mixin
  96.   IMPORT_CLASS_PROTOCOL Navigate_Mixin
  97.   IMPORT_CLASS_PROTOCOL Action_Bar_Mixin
  98.   IMPORT_CLASS_PROTOCOL Entry_Item_Mixin
  99.  
  100.   procedure Initialize_List
  101.   end_procedure
  102.  
  103.   procedure down_row
  104.     local integer toitem
  105.     calc (current_item(current_object) + item_limit(current_object)) ;
  106.         to toitem
  107.     if toitem lt (item_count(current_object)) set current_item to toitem
  108.   end_procedure
  109.  
  110.   procedure up_row
  111.     local integer toitem
  112.     calc (current_item(current_object) - item_limit(current_object)) ;
  113.         to toitem
  114.     if toitem ge 0 set current_item to toitem
  115.   end_procedure
  116.  
  117.  
  118.   //
  119.   // created for nesting support
  120.   //
  121.   procedure Child_Wrapping integer direction integer xorigID
  122.     local integer base targetItem lim origID
  123.  
  124.     if NUM_ARGUMENTS gt 1 move xorigID to origID
  125.     else get focus of desktop to origID
  126.     if origID eq 0 move current_object to origID
  127.  
  128.     send activate
  129. //    get base_item to base
  130. //    if direction ne 0 begin
  131. //      calc (item_count(current_object) - 1) to lim
  132. //      calc (base + item_limit(current_object)) to targetItem
  133. //      if targetItem gt lim move lim to targetItem
  134. //    end
  135. //    else begin
  136. //      calc (base - 1) to targetItem
  137. //      if targetItem lt 0 move 0 to targetItem
  138. //    end
  139. //    set current_item to targetItem
  140.  
  141.     // set item direction      //sets current_item to first/last enterable item
  142.  
  143.     procedure_return 1
  144.   end_procedure
  145.  
  146.  
  147.   //
  148.   // created for navigation support
  149.   //
  150.   procedure Top_of_Panel
  151.     local integer retval
  152.     //
  153.     // modification for EntItem support
  154.     //
  155.     get Object_Validation to retval
  156.     set Object_Validation to false
  157.     if (focus(desktop) <> current_object) send activate
  158. //    set current_item to (top_item(current_object))
  159.  
  160.     set item TRUE      //sets current_item to first enterable item
  161.  
  162.     set Object_Validation to retval
  163.   end_procedure
  164.  
  165.   //
  166.   // created for Bottom_of_Panel support
  167.   //
  168.   function last_panel_item returns integer
  169.     local integer lastitem maxitem
  170.     calc (top_item(current_object) + Display_Size(current_object) - 1) ;
  171.         to lastitem
  172.     get item_count to maxitem
  173.     if lastItem gt maxitem move (maxitem - 1) to lastitem
  174.     function_return lastitem
  175.   end_function
  176.  
  177.   //
  178.   // created for navigation support
  179.   //
  180.   procedure Bottom_of_Panel
  181.     local integer lastChild
  182.     //
  183.     // modification for composition support
  184.     //
  185.     if (Has_Components_State(current_object)) begin
  186.       get Find_Last_DEO to lastChild
  187.       if lastChild ne 0 begin
  188.         send Bottom_Of_Panel to lastChild
  189.         procedure_return
  190.       end
  191.     end
  192.     send activate
  193. //    set current_item to (last_panel_item(current_object))
  194.  
  195.     set item FALSE      //sets current_item to last enterable item
  196.  
  197.   end_procedure
  198.  
  199.   //
  200.   // created for navigation support
  201.   //
  202.   function next_entry_ok returns integer
  203.     local integer retval wrapstate
  204.     forward get next_entry_ok to retval
  205.     get wrap_State to wrapstate
  206.     if (retval >= 0 AND wrapstate = 0 AND ;
  207.         row(current_object,retval) <> current_row(current_object)) ;
  208.         move -1 to retval    //out of row bounds, pretend must switch
  209.     else if (retval < 0 AND wrapstate) begin  //on last row w/wrap_state true
  210.       send add_row                            //add new row at end
  211.       forward get next_entry_ok to retval     //try to rotate to it
  212.     end
  213.     function_Return retval
  214.   end_function
  215.  
  216.   //
  217.   // created for navigation support
  218.   //
  219.   function previous_entry_ok returns integer
  220.     local integer retval
  221.     forward get previous_entry_ok to retval
  222.     if (retval >= 0 AND wrap_state(current_object) = 0 AND ;
  223.         row(current_object,retval) <> current_row(current_object)) ;
  224.         function_return -1  //out of row bounds, pretend must switch back
  225.     function_Return retval
  226.   end_function
  227.  
  228.   procedure End_Construct_Object
  229.     send Mark_Components      // nesting
  230.     send Define_Access_Keys 0 // action_bar_keys
  231.     forward send End_Construct_Object
  232.   end_procedure
  233.  
  234. end_class
  235. //
  236. // WLStart <class> <image> { ACTION_BAR <actionbar#> } { POP_UP } { RING }
  237. //
  238. #COMMAND WLstart R R
  239.   #IFDEF !2
  240.   #ELSE
  241.     #IFDEF !2.N
  242.     #ELSE
  243.       #ERROR 100 IMAGE ARGUMENT MISSING IN OBJECT STATEMENT
  244.     #ENDIF
  245.   #ENDIF
  246.   FORWARD_BEGIN_CONSTRUCT !1 !2
  247.   bind_Action_bar !3 !4 !5 !6 !7 !8 !9
  248.   bind_Pop_up !3 !4 !5 !6 !7 !8 !9
  249.   bind_Ring !3 !4 !5 !6 !7 !8 !9
  250. #ENDCOMMAND
  251.                                              
  252.