You can now add the definitions of the menu bar, menus, and menu buttons, to the definition of the <task-frame> class, to give the code shown below. At this stage, the only thing missing from the final application are real callback functions. Callbacks are dealt with in Chapter 5, "Adding Callbacks to the Application".
Note that the final definition of <task-frame> includes the definition of a slot: frame-task-list. This takes an instance of the class <task-list> as a value, the default value being an empty <task-list>. Although it has not been referred to so far, this class will be used as the basic data structure in which task lists are stored, and a more complete description of these data structures is given in Section 5.1 on page 42. It transpires that defining the frame-task-list slot is essential for some of the file handling routines that are described in Section 5.3.1 on page 48.
define frame <task-frame> (<simple-frame>) slot frame-task-list :: <task-list> = make(<task-list>); // definition of menu bar pane task-menu-bar (frame) make(<menu-bar>, children: vector(frame.file-menu, frame.edit-menu, frame.task-menu, frame.help-menu)); // definition of menus pane file-menu (frame) make(<menu>, label: "File", children: vector(frame.open-menu-button, frame.save-menu-button, frame.save-as-menu-button, frame.exit-menu-button)); pane edit-menu (frame) make(<menu>, label: "Edit", children: vector(frame.cut-menu-button, frame.copy-menu-button, frame.paste-menu-button)); pane task-menu (frame) make(<menu>, label: "Task", children: vector(frame.add-menu-button, frame.remove-menu-button)); pane help-menu (frame) make(<menu>, label: "Help", children: vector(frame.about-menu-button)); // definition of menu buttons // Commands in the File menu pane open-menu-button (frame) make(<menu-button>, label: "Open...", activate-callback: not-yet-implemented, accelerator: make-keyboard-gesture(#"o", #"control"), documentation: "Opens an existing file."); pane save-menu-button (frame) make(<menu-button>, label: "Save", activate-callback: not-yet-implemented, accelerator: make-keyboard-gesture(#"s", #"control"), documentation: "Saves the current file to disk."); pane save-as-menu-button (frame) make(<menu-button>, label: "Save As...", activate-callback: save-as-file, documentation: "Saves the current file with a new name."); pane exit-menu-button (frame) make(<menu-button>, label: "Exit", activate-callback: not-yet-implemented, accelerator: make-keyboard-gesture(#"f4", #"alt"), documentation: "Exits the application."); //Commands in the Edit menu pane cut-menu-button (frame) make(<menu-button>, label: "Cut", activate-callback: not-yet-implemented, accelerator: make-keyboard-gesture(#"x", #"control"), documentation: "Cut the selection to the clipboard."); pane copy-menu-button (frame) make(<menu-button>, label: "Copy", activate-callback: not-yet-implemented, accelerator: make-keyboard-gesture(#"c", #"control"), documentation: "Copy the selection to the clipboard."); pane paste-menu-button (frame) make(<menu-button>, label: "Paste", activate-callback: not-yet-implemented, accelerator: make-keyboard-gesture(#"v", #"control"), documentation: "Paste the selection in the clipboard at the current position."); //Commands in the Task menu pane add-menu-button (frame) make(<menu-button>, label: "Add...", activate-callback: not-yet-implemented, accelerator: make-keyboard-gesture (#"a", #"control", #"shift"), documentation: "Add a new task."); pane remove-menu-button (frame) make(<menu-button>, label: "Remove", activate-callback: not-yet-implemented, accelerator: make-keyboard-gesture (#"d", #"control", #"shift"), documentation: "Remove the selected task from the list."); //Commands in the Help menu pane about-menu-button (frame) make(<menu-button>, label: "About", activate-callback: not-yet-implemented, accelerator: make-keyboard-gesture(#"f1"), documentation: "Display information about the application."); // definition of buttons pane add-button (frame) make(<push-button>, label: "Add task", activate-callback: not-yet-implemented); pane remove-button (frame) make(<push-button>, label: "Remove task", activate-callback: not-yet-implemented); pane open-button (frame) make(<push-button>, label: "Open file", activate-callback: not-yet-implemented); pane save-button (frame) make(<push-button>, label: "Save file", activate-callback: not-yet-implemented); // definition of radio box pane priority-box (frame) make (<radio-box>, items: $priority-items, orientation: #"horizontal", label-key: first, value-key: second, value: #"medium", activate-callback: not-yet-implemented); // definition of tool bar pane task-tool-bar (frame) make(<tool-bar>, child: horizontally () frame.open-button; frame.save-button; frame.add-button; frame.remove-button end); // definition of status bar pane task-status-bar (frame) make(<status-bar>, label: "Task Manager"); // definition of list pane task-list (frame) make (<list-box>, items: #(), lines: 15, activate-callback: not-yet-implemented); // main layout pane task-layout (frame) vertically () frame.task-list; frame.priority-box; end; // activation of frame elements layout (frame) frame.task-layout; tool-bar (frame) frame.task-tool-bar; status-bar (frame) frame.task-status-bar; menu-bar (frame) frame.task-menu-bar; // frame title keyword title: = "Task List Manager"; end frame <task-frame>;