1/* All Rights reserved */
2
3#include <AppKit/AppKit.h>
4#include "GormNSSplitViewInspector.h"
5
6@implementation NSSplitView (IBObjectAdditions)
7- (NSString *) inspectorClassName
8{
9  return @"GormNSSplitViewInspector";
10}
11
12- (NSString*) editorClassName
13{
14  return @"GormSplitViewEditor";
15}
16@end
17
18@implementation GormNSSplitViewInspector
19
20- init
21{
22  self = [super init];
23  if (self != nil)
24    {
25      if ([NSBundle loadNibNamed: @"GormNSSplitViewInspector"
26		    owner: self] == NO)
27	{
28
29	  NSDictionary	*table;
30	  NSBundle	*bundle;
31	  table = [NSDictionary dictionaryWithObject: self forKey: @"NSOwner"];
32	  bundle = [NSBundle mainBundle];
33	  if ([bundle loadNibFile: @"GormNSSplitViewInspector"
34		      externalNameTable: table
35		      withZone: [self zone]] == NO)
36	    {
37	      NSLog(@"Could not open gorm GormNSSplitViewInspector");
38	      NSLog(@"self %@", self);
39	      return nil;
40	    }
41	}
42    }
43
44  return self;
45}
46
47- (void) _getValuesFromObject
48{
49  BOOL state = [(NSSplitView *)object isVertical];
50  // get the values from the object
51  if(state == NO)
52    {
53      [orientation selectCellAtRow: 0 column: 0];
54    }
55  else
56    {
57      [orientation selectCellAtRow: 1 column: 0];
58    }
59}
60
61- (void) setObject: (id)anObject
62{
63  [super setObject: anObject];
64  [self _getValuesFromObject];
65}
66
67- (void) ok: (id)sender
68{
69  id cell = nil;
70  BOOL state = NO;
71
72  // horizontal switch..  if it's active/inactive we
73  // know what the selection is.
74  [super ok: sender];
75  cell = [orientation cellAtRow: 0 column: 0];
76  state = ([cell state] == NSOnState)?NO:YES;
77  [object setVertical: state];
78  [object adjustSubviews];
79}
80@end
81