Report abuse

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
;; @file       preferences.nu
;; @discussion Example Preferences Window
;;
;; @copyright  Copyright (c) 2008 Matt McCray, Elucidata u0nLTD.

(class PreferencesController is NSWindowController
     (ivars)
     
     (- (id)init is
        (super initWithWindowNibName:"Preferences")
        (set @toolbarItemIdents NO)
        self)
     
     ;; This is the target action for the toolbar items
     (- changeTab:(id)sender is
        (puts "clicked toolbar icon..."))
     
     ;; Select the first toolbar item when the window loads
     (- windowDidLoad is
        (((self window) toolbar) setSelectedItemIdentifier:(((((self window) toolbar) items) 0) itemIdentifier)))
     
     ;; Delegate method that returns the itemIdentifiers for the selectable items (in our case, all of 'em)
     (- (id)toolbarSelectableItemIdentifiers:(id)toolbar is
        (unless @toolbarItemIdents
                (set @toolbarItemIdents (NSMutableArray array))
                ((((self window) toolbar) items) each:(do (item)
                                                          (@toolbarItemIdents addObject:(item itemIdentifier)))))
        @toolbarItemIdents))