24 |
|
|
25 |
#include <AppKit/AppKit.h> |
#include <AppKit/AppKit.h> |
26 |
#include <InterfaceBuilder/InterfaceBuilder.h> |
#include <InterfaceBuilder/InterfaceBuilder.h> |
27 |
|
#include "GormPrivate.h" |
28 |
|
#include "GormDocument.h" |
29 |
|
|
30 |
@interface GormMenuAttributesInspector : IBInspector |
@interface GormMenuAttributesInspector : IBInspector |
31 |
{ |
{ |
32 |
NSTextField *titleText; |
NSTextField *titleText; |
33 |
NSMatrix *menuType; |
NSMatrix *menuType; |
34 |
} |
} |
35 |
|
- (void) updateMenuType: (id)sender; |
36 |
@end |
@end |
37 |
|
|
38 |
@implementation GormMenuAttributesInspector |
@implementation GormMenuAttributesInspector |
57 |
|
|
58 |
- (void) setObject: (id)anObject |
- (void) setObject: (id)anObject |
59 |
{ |
{ |
60 |
|
BOOL flag = NO; |
61 |
|
GormDocument *doc = (GormDocument *)[(id<IB>)NSApp activeDocument]; |
62 |
[super setObject: anObject]; |
[super setObject: anObject]; |
63 |
[titleText setStringValue: [object title]]; |
[titleText setStringValue: [object title]]; |
64 |
|
|
65 |
|
// set up the menu type matrix... |
66 |
|
if([doc windowsMenu] == anObject) |
67 |
|
{ |
68 |
|
[menuType selectCellAtRow: 0 column: 0]; |
69 |
|
} |
70 |
|
else if([doc servicesMenu] == anObject) |
71 |
|
{ |
72 |
|
[menuType selectCellAtRow: 1 column: 0]; |
73 |
|
} |
74 |
|
else // normal menu without any special function |
75 |
|
{ |
76 |
|
[menuType selectCellAtRow: 2 column: 0]; |
77 |
|
} |
78 |
} |
} |
79 |
|
|
80 |
|
- (void) updateMenuType: (id)sender |
81 |
|
{ |
82 |
|
BOOL flag; |
83 |
|
GormDocument *doc = (GormDocument *)[(id<IB>)NSApp activeDocument]; |
84 |
|
|
85 |
|
// look at the values passed back in the matrix. |
86 |
|
flag = ([[menuType cellAtRow: 0 column: 0] state] == NSOnState) ? YES : NO; // windows menu... |
87 |
|
if(flag) |
88 |
|
{ |
89 |
|
[doc setWindowsMenu: [self object]]; |
90 |
|
if([doc servicesMenu] == [self object]) |
91 |
|
{ |
92 |
|
[doc setServicesObject: nil]; |
93 |
|
} |
94 |
|
} |
95 |
|
|
96 |
|
flag = ([[menuType cellAtRow: 1 column: 0] state] == NSOnState) ? YES : NO; // services menu... |
97 |
|
if(flag) |
98 |
|
{ |
99 |
|
[doc setServicesMenu: [self object]]; |
100 |
|
if([doc windowsMenu] == [self object]) |
101 |
|
{ |
102 |
|
[doc setWindowsObject: nil]; |
103 |
|
} |
104 |
|
} |
105 |
|
|
106 |
|
flag = ([[menuType cellAtRow: 2 column: 0] state] == NSOnState) ? YES : NO; // normal menu... |
107 |
|
if(flag) |
108 |
|
{ |
109 |
|
[doc setWindowsMenu: nil]; |
110 |
|
[doc setServicesMenu: nil]; |
111 |
|
} |
112 |
|
} |
113 |
@end |
@end |
114 |
|
|
115 |
|
|
174 |
} |
} |
175 |
|
|
176 |
@end |
@end |
|
|
|