mirror of
https://github.com/ksherlock/ample.git
synced 2025-01-24 06:29:47 +00:00
move machine browser to it's own view/controller.
This commit is contained in:
parent
ef959a623b
commit
ab1315d22d
@ -56,7 +56,7 @@
|
||||
B6109A4224F5F377005CB652 /* apple2p.plist in Resources */ = {isa = PBXBuildFile; fileRef = B6109A1524F5F376005CB652 /* apple2p.plist */; };
|
||||
B6109A4324F5F377005CB652 /* agat7.plist in Resources */ = {isa = PBXBuildFile; fileRef = B6109A1624F5F376005CB652 /* agat7.plist */; };
|
||||
B64979C224EF6703008ABD20 /* MediaViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B64979C124EF6703008ABD20 /* MediaViewController.m */; };
|
||||
B64E15A924EA1D5300E8AD3D /* ROMBrowserDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B64E15A824EA1D5300E8AD3D /* ROMBrowserDelegate.m */; };
|
||||
B64E15A924EA1D5300E8AD3D /* MachineViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B64E15A824EA1D5300E8AD3D /* MachineViewController.m */; };
|
||||
B64E15AC24EA1FD400E8AD3D /* SlotBrowserDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B64E15AB24EA1FD400E8AD3D /* SlotBrowserDelegate.m */; };
|
||||
B65593B124ECB61800722E0C /* SlotViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B65593B024ECB61800722E0C /* SlotViewController.m */; };
|
||||
B6BA258024E99BE9005FB8FF /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B6BA257F24E99BE9005FB8FF /* AppDelegate.m */; };
|
||||
@ -67,6 +67,7 @@
|
||||
B6D6DE3B24FACF4F00661A5F /* Defaults.plist in Resources */ = {isa = PBXBuildFile; fileRef = B6D6DE3A24FACF4F00661A5F /* Defaults.plist */; };
|
||||
B6D6DE3E24FADF8B00661A5F /* LaunchWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = B6D6DE3C24FADF8B00661A5F /* LaunchWindow.xib */; };
|
||||
B6D6DE4124FADFAC00661A5F /* LaunchWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = B6D6DE4024FADFAC00661A5F /* LaunchWindowController.m */; };
|
||||
B6D6DE4524FAF00300661A5F /* ModelsView.xib in Resources */ = {isa = PBXBuildFile; fileRef = B6D6DE4324FAF00300661A5F /* ModelsView.xib */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
@ -122,8 +123,8 @@
|
||||
B6109A1624F5F376005CB652 /* agat7.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = agat7.plist; sourceTree = "<group>"; };
|
||||
B64979C024EF6703008ABD20 /* MediaViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediaViewController.h; sourceTree = "<group>"; };
|
||||
B64979C124EF6703008ABD20 /* MediaViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MediaViewController.m; sourceTree = "<group>"; };
|
||||
B64E15A724EA1D5300E8AD3D /* ROMBrowserDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ROMBrowserDelegate.h; sourceTree = "<group>"; };
|
||||
B64E15A824EA1D5300E8AD3D /* ROMBrowserDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ROMBrowserDelegate.m; sourceTree = "<group>"; };
|
||||
B64E15A724EA1D5300E8AD3D /* MachineViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MachineViewController.h; sourceTree = "<group>"; };
|
||||
B64E15A824EA1D5300E8AD3D /* MachineViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MachineViewController.m; sourceTree = "<group>"; };
|
||||
B64E15AA24EA1FD400E8AD3D /* SlotBrowserDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SlotBrowserDelegate.h; sourceTree = "<group>"; };
|
||||
B64E15AB24EA1FD400E8AD3D /* SlotBrowserDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SlotBrowserDelegate.m; sourceTree = "<group>"; };
|
||||
B65593AF24ECB61800722E0C /* SlotViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SlotViewController.h; sourceTree = "<group>"; };
|
||||
@ -142,6 +143,7 @@
|
||||
B6D6DE3D24FADF8B00661A5F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchWindow.xib; sourceTree = "<group>"; };
|
||||
B6D6DE3F24FADFAC00661A5F /* LaunchWindowController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LaunchWindowController.h; sourceTree = "<group>"; };
|
||||
B6D6DE4024FADFAC00661A5F /* LaunchWindowController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LaunchWindowController.m; sourceTree = "<group>"; };
|
||||
B6D6DE4424FAF00300661A5F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/ModelsView.xib; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -236,17 +238,20 @@
|
||||
B6BA257D24E99BE9005FB8FF /* MA2ME */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B65593B024ECB61800722E0C /* SlotViewController.m */,
|
||||
B65593AF24ECB61800722E0C /* SlotViewController.h */,
|
||||
B60A6E1324EE0AE2004B7EEF /* FlippedView.m */,
|
||||
B60A6E1224EE0AE2004B7EEF /* FlippedView.h */,
|
||||
B6BA257E24E99BE9005FB8FF /* AppDelegate.h */,
|
||||
B6BA257F24E99BE9005FB8FF /* AppDelegate.m */,
|
||||
B6D6DE4324FAF00300661A5F /* ModelsView.xib */,
|
||||
B6D6DE3F24FADFAC00661A5F /* LaunchWindowController.h */,
|
||||
B6D6DE4024FADFAC00661A5F /* LaunchWindowController.m */,
|
||||
B65593B024ECB61800722E0C /* SlotViewController.m */,
|
||||
B65593AF24ECB61800722E0C /* SlotViewController.h */,
|
||||
B64979C024EF6703008ABD20 /* MediaViewController.h */,
|
||||
B64979C124EF6703008ABD20 /* MediaViewController.m */,
|
||||
B64E15A724EA1D5300E8AD3D /* MachineViewController.h */,
|
||||
B64E15A824EA1D5300E8AD3D /* MachineViewController.m */,
|
||||
B60A6E1324EE0AE2004B7EEF /* FlippedView.m */,
|
||||
B60A6E1224EE0AE2004B7EEF /* FlippedView.h */,
|
||||
B6BA258124E99BEB005FB8FF /* Assets.xcassets */,
|
||||
B64E15A724EA1D5300E8AD3D /* ROMBrowserDelegate.h */,
|
||||
B64E15A824EA1D5300E8AD3D /* ROMBrowserDelegate.m */,
|
||||
B64E15AA24EA1FD400E8AD3D /* SlotBrowserDelegate.h */,
|
||||
B64E15AB24EA1FD400E8AD3D /* SlotBrowserDelegate.m */,
|
||||
B64E15AF24EA365E00E8AD3D /* Resources */,
|
||||
@ -254,15 +259,21 @@
|
||||
B6D6DE3A24FACF4F00661A5F /* Defaults.plist */,
|
||||
B6BA258724E99BEB005FB8FF /* main.m */,
|
||||
B6BA258924E99BEB005FB8FF /* MA2ME.entitlements */,
|
||||
B6D6DE4224FAEE8900661A5F /* Nibs */,
|
||||
);
|
||||
path = MA2ME;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B6D6DE4224FAEE8900661A5F /* Nibs */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B6BA258324E99BEB005FB8FF /* MainMenu.xib */,
|
||||
B6D6DE3C24FADF8B00661A5F /* LaunchWindow.xib */,
|
||||
B6D6DE3724FAC8B500661A5F /* Preferences.xib */,
|
||||
B61099E524F5F230005CB652 /* MediaView.xib */,
|
||||
B61099E324F5F230005CB652 /* SlotView.xib */,
|
||||
B6D6DE3F24FADFAC00661A5F /* LaunchWindowController.h */,
|
||||
B6D6DE4024FADFAC00661A5F /* LaunchWindowController.m */,
|
||||
);
|
||||
path = MA2ME;
|
||||
name = Nibs;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
@ -360,6 +371,7 @@
|
||||
B6109A3B24F5F377005CB652 /* apple2gsr1.plist in Resources */,
|
||||
B6D6DE3B24FACF4F00661A5F /* Defaults.plist in Resources */,
|
||||
B6109A2224F5F377005CB652 /* models.plist in Resources */,
|
||||
B6D6DE4524FAF00300661A5F /* ModelsView.xib in Resources */,
|
||||
B6109A4024F5F377005CB652 /* craft2p.plist in Resources */,
|
||||
B6109A1B24F5F377005CB652 /* uniap2pt.plist in Resources */,
|
||||
B6109A3724F5F377005CB652 /* las128e2.plist in Resources */,
|
||||
@ -387,7 +399,7 @@
|
||||
B6BA258824E99BEB005FB8FF /* main.m in Sources */,
|
||||
B64E15AC24EA1FD400E8AD3D /* SlotBrowserDelegate.m in Sources */,
|
||||
B6D6DE4124FADFAC00661A5F /* LaunchWindowController.m in Sources */,
|
||||
B64E15A924EA1D5300E8AD3D /* ROMBrowserDelegate.m in Sources */,
|
||||
B64E15A924EA1D5300E8AD3D /* MachineViewController.m in Sources */,
|
||||
B64979C224EF6703008ABD20 /* MediaViewController.m in Sources */,
|
||||
B60A6E1424EE0AE2004B7EEF /* FlippedView.m in Sources */,
|
||||
B6BA258024E99BE9005FB8FF /* AppDelegate.m in Sources */,
|
||||
@ -438,6 +450,14 @@
|
||||
name = LaunchWindow.xib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B6D6DE4324FAF00300661A5F /* ModelsView.xib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
B6D6DE4424FAF00300661A5F /* Base */,
|
||||
);
|
||||
name = ModelsView.xib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
|
@ -8,9 +8,10 @@
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="LaunchWindowController">
|
||||
<connections>
|
||||
<outlet property="machineView" destination="oVt-eD-aaj" id="Q9V-Kr-6GN"/>
|
||||
<outlet property="machineViewController" destination="RgH-d9-xl8" id="DIa-h0-6y2"/>
|
||||
<outlet property="mediaController" destination="t7c-zy-czN" id="a7d-HC-TWx"/>
|
||||
<outlet property="mediaView" destination="J9O-xI-P5J" id="PmZ-VC-4SN"/>
|
||||
<outlet property="modelView" destination="oVt-eD-aaj" id="nam-De-IQe"/>
|
||||
<outlet property="slotController" destination="lyS-mc-3Tf" id="LXo-Ii-fDX"/>
|
||||
<outlet property="slotView" destination="P9d-sS-qEb" id="T2q-ON-owm"/>
|
||||
<outlet property="window" destination="Vze-YF-m6e" id="JUs-Eb-MW8"/>
|
||||
@ -123,6 +124,7 @@
|
||||
</window>
|
||||
<viewController title="Media View" nibName="MediaView" id="t7c-zy-czN" customClass="MediaViewController"/>
|
||||
<viewController title="Slot View" nibName="SlotView" id="lyS-mc-3Tf" customClass="SlotViewController"/>
|
||||
<customObject id="RgH-d9-xl8" customClass="MachineViewController"/>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="NSAppleMenuImage" width="11" height="14"/>
|
||||
|
11
MA2ME/Base.lproj/ModelsView.xib
Normal file
11
MA2ME/Base.lproj/ModelsView.xib
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11134" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11134"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner"/>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
</objects>
|
||||
</document>
|
@ -9,15 +9,18 @@
|
||||
#import "LaunchWindowController.h"
|
||||
#import "MediaViewController.h"
|
||||
#import "SlotViewController.h"
|
||||
#import "MachineViewController.h"
|
||||
|
||||
static NSString *kMyContext = @"kMyContext";
|
||||
static NSString *kContextMachine = @"kContextMachine";
|
||||
|
||||
|
||||
@interface LaunchWindowController ()
|
||||
@property (strong) IBOutlet MediaViewController *mediaController;
|
||||
@property (strong) IBOutlet SlotViewController *slotController;
|
||||
@property (strong) IBOutlet MachineViewController *machineViewController;
|
||||
|
||||
@property (weak) IBOutlet NSView *modelView;
|
||||
@property (weak) IBOutlet NSView *machineView;
|
||||
@property (weak) IBOutlet NSView *slotView;
|
||||
@property (weak) IBOutlet NSView *mediaView;
|
||||
|
||||
@ -33,7 +36,6 @@ static NSString *kMyContext = @"kMyContext";
|
||||
@property BOOL mameNoBlur;
|
||||
|
||||
|
||||
@property NSArray *browserItems;
|
||||
|
||||
@end
|
||||
|
||||
@ -49,38 +51,10 @@ static NSString *kMyContext = @"kMyContext";
|
||||
|
||||
// Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
|
||||
|
||||
NSBundle *bundle = [NSBundle mainBundle];
|
||||
NSString *path;
|
||||
NSWindow *window = [self window];
|
||||
|
||||
|
||||
/* My Copy of XCode/Interface Builder barfs on NSBrowser. */
|
||||
|
||||
|
||||
path = [bundle pathForResource: @"models" ofType: @"plist"];
|
||||
_browserItems = [NSArray arrayWithContentsOfFile: path];
|
||||
|
||||
NSView *view = [window contentView];
|
||||
|
||||
NSRect frame;
|
||||
NSBrowser *browser = nil;
|
||||
|
||||
frame = [_modelView frame];
|
||||
browser = [[NSBrowser alloc] initWithFrame: frame];
|
||||
|
||||
[browser setMaxVisibleColumns: 2];
|
||||
//[browser setTakesTitleFromPreviousColumn: YES];
|
||||
//[browser setTitled: NO];
|
||||
[browser setAllowsEmptySelection: NO];
|
||||
[browser setDelegate: self];
|
||||
[browser setAction: @selector(modelClick:)];
|
||||
|
||||
[view addSubview: browser];
|
||||
//[browser setTitled: YES]; // NSBrowser title bug.
|
||||
|
||||
|
||||
[_slotView addSubview: [_slotController view]];
|
||||
[_mediaView addSubview: [_mediaController view]];
|
||||
[_machineView addSubview: [_machineViewController view]];
|
||||
|
||||
|
||||
[self addObserver: self forKeyPath: @"mameMachine" options:0 context: (__bridge void * _Nullable)(kMyContext)];
|
||||
@ -91,14 +65,14 @@ static NSString *kMyContext = @"kMyContext";
|
||||
|
||||
[self addObserver: self forKeyPath: @"mameNoBlur" options:0 context: (__bridge void * _Nullable)(kMyContext)];
|
||||
|
||||
[_slotController addObserver: self forKeyPath: @"args" options: 0 context: (__bridge void * _Nullable)(kMyContext)];
|
||||
[_mediaController addObserver: self forKeyPath: @"args" options: 0 context: (__bridge void * _Nullable)(kMyContext)];
|
||||
[_slotController addObserver: self forKeyPath: @"args" options: 0 context: (__bridge void * _Nullable)(kMyContext)];
|
||||
[_mediaController addObserver: self forKeyPath: @"args" options: 0 context: (__bridge void * _Nullable)(kMyContext)];
|
||||
|
||||
[_mediaController bind: @"media" toObject: _slotController withKeyPath: @"media" options: 0];
|
||||
|
||||
[self buildCommandLine];
|
||||
|
||||
|
||||
[_machineViewController addObserver: self forKeyPath: @"machine" options: 0 context: (__bridge void * _Nullable)kContextMachine];
|
||||
}
|
||||
|
||||
|
||||
@ -106,6 +80,11 @@ static NSString *kMyContext = @"kMyContext";
|
||||
|
||||
if (context == (__bridge void *)kMyContext) {
|
||||
[self buildCommandLine];
|
||||
} else if (context == (__bridge void *)kContextMachine) {
|
||||
NSString *machine = [_machineViewController machine];
|
||||
[self setMameMachine: machine];
|
||||
[_slotController setModel: machine];
|
||||
[self buildCommandLine];
|
||||
} else {
|
||||
[super observeValueForKeyPath: keyPath ofObject: object change: change context: context];
|
||||
}
|
||||
@ -241,17 +220,6 @@ static NSString * JoinArguments(NSArray *argv) {
|
||||
|
||||
# pragma mark - IBActions
|
||||
|
||||
-(IBAction)modelClick:(id)sender {
|
||||
|
||||
NSDictionary *item = [self itemForBrowser: sender];
|
||||
NSString *model = [item objectForKey: @"value"];
|
||||
|
||||
[self setMameMachine: model];
|
||||
|
||||
// [self buildCommandLine];
|
||||
|
||||
[_slotController setModel: model];
|
||||
}
|
||||
|
||||
|
||||
- (IBAction)launchAction:(id)sender {
|
||||
@ -280,72 +248,5 @@ static NSString * JoinArguments(NSArray *argv) {
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - NSBrowser
|
||||
|
||||
-(NSDictionary *)itemForBrowser: (NSBrowser *)browser {
|
||||
|
||||
NSIndexPath *path = [browser selectionIndexPath];
|
||||
|
||||
NSArray *a = _browserItems;
|
||||
NSDictionary *item = nil;
|
||||
|
||||
NSUInteger l = [path length];
|
||||
for (NSUInteger i = 0; i < l; ++i) {
|
||||
NSUInteger ix = [path indexAtPosition: i];
|
||||
if (ix > [a count]) return nil;
|
||||
item = [a objectAtIndex: ix];
|
||||
a = [item objectForKey: @"children"];
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
-(NSArray *)itemsForBrowser: (NSBrowser *)browser column: (NSInteger) column {
|
||||
|
||||
NSArray *a = _browserItems;
|
||||
for (unsigned i = 0; i < column; ++i) {
|
||||
NSInteger ix = [browser selectedRowInColumn: i];
|
||||
if (ix < 0) return 0;
|
||||
|
||||
NSDictionary *item = [a objectAtIndex: ix];
|
||||
a = [item objectForKey: @"children"];
|
||||
if (!a) return 0;
|
||||
}
|
||||
return a;
|
||||
|
||||
}
|
||||
|
||||
- (void)browser:(NSBrowser *)sender willDisplayCell:(id)cell atRow:(NSInteger)row column:(NSInteger)column {
|
||||
NSArray *a = [self itemsForBrowser: sender column: column];
|
||||
if (!a || row >= [a count]) return;
|
||||
|
||||
NSDictionary *item = [a objectAtIndex: row];
|
||||
|
||||
NSBrowserCell *bc = (NSBrowserCell *)cell;
|
||||
|
||||
[bc setStringValue: [item objectForKey: @"description"]];
|
||||
[bc setLeaf: ![item objectForKey: @"children"]];
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (NSString *)browser:(NSBrowser *)sender titleOfColumn:(NSInteger)column {
|
||||
return column == 0 ? @"Model" : @"Submodel";
|
||||
}
|
||||
|
||||
#if 0
|
||||
- (id)browser:(NSBrowser *)browser child:(NSInteger)index ofItem:(id)item {
|
||||
return nil;
|
||||
}
|
||||
-(id)rootItemForBrowser:(NSBrowser *)browser {
|
||||
return _browserItems;
|
||||
}
|
||||
#endif
|
||||
|
||||
- (NSInteger)browser:(NSBrowser *)sender numberOfRowsInColumn:(NSInteger)column {
|
||||
|
||||
NSArray *a = [self itemsForBrowser: sender column: column];
|
||||
return [a count];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// ROMBrowserDelegate.h
|
||||
// MachineViewController.h
|
||||
// MA2ME
|
||||
//
|
||||
// Created by Kelvin Sherlock on 8/16/2020.
|
||||
@ -11,9 +11,9 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface ROMBrowserDelegate : NSObject <NSBrowserDelegate>
|
||||
@interface MachineViewController : NSViewController <NSBrowserDelegate>
|
||||
|
||||
@property NSString *model;
|
||||
@property NSString *machine;
|
||||
|
||||
@end
|
||||
|
@ -1,20 +1,20 @@
|
||||
//
|
||||
// ROMBrowserDelegate.m
|
||||
// MachineViewController.m
|
||||
// MA2ME
|
||||
//
|
||||
// Created by Kelvin Sherlock on 8/16/2020.
|
||||
// Copyright © 2020 Kelvin Sherlock. All rights reserved.
|
||||
//
|
||||
|
||||
#import "ROMBrowserDelegate.h"
|
||||
#import "MachineViewController.h"
|
||||
|
||||
@interface ROMBrowserDelegate()
|
||||
@interface MachineViewController()
|
||||
|
||||
@property NSArray *data;
|
||||
|
||||
@end
|
||||
|
||||
@implementation ROMBrowserDelegate
|
||||
@implementation MachineViewController
|
||||
|
||||
|
||||
-(void)awakeFromNib {
|
||||
@ -22,13 +22,29 @@
|
||||
NSBundle *bundle = [NSBundle mainBundle];
|
||||
NSString *path = [bundle pathForResource: @"models" ofType: @"plist"];
|
||||
_data = [NSArray arrayWithContentsOfFile: path];
|
||||
|
||||
|
||||
/* My Copy of XCode/Interface Builder barfs on NSBrowser. */
|
||||
|
||||
NSBrowser *browser;
|
||||
NSRect frame = NSMakeRect(0, 0, 718, 200);
|
||||
|
||||
browser = [[NSBrowser alloc] initWithFrame: frame];
|
||||
|
||||
[browser setMaxVisibleColumns: 2];
|
||||
//[browser setTakesTitleFromPreviousColumn: YES];
|
||||
//[browser setTitled: NO];
|
||||
[browser setAllowsEmptySelection: NO];
|
||||
[browser setDelegate: self];
|
||||
[browser setAction: @selector(clickAction:)];
|
||||
|
||||
[self setView: browser];
|
||||
}
|
||||
|
||||
-(IBAction)click:(id)sender {
|
||||
-(IBAction)clickAction:(id)sender {
|
||||
|
||||
NSDictionary *item = [self itemForBrowser: sender];
|
||||
[self setModel: [item objectForKey: @"value"]];
|
||||
[self setMachine: [item objectForKey: @"value"]];
|
||||
}
|
||||
|
||||
#pragma mark NSBrowser
|
Loading…
x
Reference in New Issue
Block a user