home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / SoundMusicDSP / Resound-2.5-MIHS / APIExamples / Math / ModuleMenuNode.h < prev    next >
Encoding:
Text File  |  1997-12-05  |  3.2 KB  |  127 lines

  1. /* 
  2.  
  3. ModuleMenuNode (version 2.2)
  4.  
  5. Part of the Resound 2.2 API
  6. Sean Luke
  7. Last Revision: December 15, 1993
  8.  
  9. Copyright 1995, Sean Luke
  10. This code may be used, modified, or distributed freely without 
  11. permission of the author.
  12.  
  13.  
  14. This object stores menu information to be passed to Resound from modules.  Future versions will eliminate this node (I hope), when IB is able to generate menus without an application (or I learn to).
  15.  
  16. The Module Menu Node is a tree node.  The root (top) node of the tree should be set with a blank Name.  This node contains all the menu items to be added directly to Resound's Modules menu.  Children nodes have names, and the menu items _they_ contain are for custom submenus off of the Modules Menu.
  17.  
  18. Let's say you want to make two menu options in the Modules menu.  One is just a standard menu option, called "Tweak".  The other displays a submenu, called "Twist", with submenu items "Bend", "Break", and "Bust".  You'd generate a tree like this:
  19.  
  20. (Root Node):
  21.     Name            ""        (empty string)
  22.     Receiver        NULL    (indicates this node has submenus)
  23.     Message            (not set)
  24.     Length            2        (for Tweak and Twist)
  25.     Submenu[0]        points to the node Tweak
  26.     Submenu[1]        points to the node Twist
  27.     
  28. Tweak:
  29.     Name            "Tweak"
  30.     Receiver        points to the object that will receive the Tweak message
  31.     Message            selector to the message sent to Tweak's receiver
  32.     Length            0
  33.     Submenu...        (not set)
  34.     
  35. Twist:
  36.     Name            "Twist"
  37.     Receiver        NULL    (indicates this node has submenus)
  38.     Message            (not set)
  39.     Length            3        (for Bend, Break, and Bust)
  40.     Submenu[0]        points to the node Bend
  41.     Submenu[1]        points to the node Break
  42.     Submenu[2]        points to the node Bust    
  43.  
  44. Bend:
  45.     Name            "Bend"
  46.     Receiver        points to the object that will receive the Bend message
  47.     Message            selector to the message sent to Bend's receiver
  48.     Length            0
  49.     Submenu...        (not set)
  50.     
  51. Break:
  52.     Name            "Break"
  53.     Receiver        points to the object that will receive the Break message
  54.     Message            selector to the message sent to Break's receiver
  55.     Length            0
  56.     Submenu...        (not set)
  57.     
  58. Bust:
  59.     Name            "Bust"
  60.     Receiver        points to the object that will receive the Bust message
  61.     Message            selector to the message sent to Bust's receiver
  62.     Length            0
  63.     Submenu...        (not set)
  64.     
  65.  
  66. */
  67.  
  68.  
  69.  
  70.  
  71. #import <objc/Object.h>
  72. #define MODULE_MENU_NODE_ARRAY_MAX  256
  73. #define MODULE_MENU_NODE_STRING_MAX 256
  74.  
  75. @interface ModuleMenuNode:Object
  76.  
  77.  
  78. /* DATA */
  79.  
  80. {
  81.     // If Name is empty, then the menu is the list of initial menu choices.
  82.     
  83.     char Name [MODULE_MENU_NODE_STRING_MAX];    // Name to be put in menu
  84.     
  85.     
  86.     
  87.     // if Receiver is NULL, then the menu has submenus
  88.     
  89.     id   Receiver;                                // Receiver of method
  90.     SEL     Message;                                // Selector to be sent
  91.     
  92.     
  93.     
  94.     // if Length is 0, then there are no items in the submenu
  95.     // if Receiver is NULL, then Length should not be 0
  96.     
  97.     int  Length;                                // Length of Array
  98.     id   Submenu [MODULE_MENU_NODE_ARRAY_MAX];    // The Submenu Array    
  99. }
  100.  
  101.  
  102.  
  103. /*  METHODS */
  104.  
  105. - init;
  106. - free;
  107.  
  108. // get various data
  109.  
  110. - (const char*) getName;
  111. - getReceiver;
  112. - (SEL) getMessage;
  113. - (int) getLength;
  114. - getSubmenu: (int) this_index;
  115.  
  116.  
  117. // set various data
  118.  
  119. - setName: (char *) this_name;
  120. - setReceiver: this_receiver;
  121. - setMessage: (SEL) this_message;
  122. - setLength:(int) this_length;
  123. - setSubmenu: (int) this_index : this_node;
  124.  
  125.  
  126. @end
  127.