git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@5616 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1999-12-23 11:14:20 +00:00
parent dc5e41f84c
commit 81e2adb9d1
4 changed files with 186 additions and 48 deletions

View file

@ -77,6 +77,7 @@ Gorm_OBJC_FILES = \
GormViewKnobs.m \
GormFilesOwner.m \
GormObjectEditor.m \
GormObjectInspector.m \
GormWindowEditor.m \
GormClassManager.m \
GormInspectorsManager.m \

View file

@ -65,48 +65,6 @@
/*
* The GormObjectInspector is a placeholder for any object without a
* suitable inspector.
*/
@interface GormObjectInspector : IBInspector
@end
@implementation GormObjectInspector
- (void) dealloc
{
RELEASE(window);
[super dealloc];
}
- (id) init
{
self = [super init];
if (self != nil)
{
NSView *contents;
NSButton *button;
window = [[NSWindow alloc] initWithContentRect: NSMakeRect(0, 0, IVW, 360)
styleMask: NSBorderlessWindowMask
backing: NSBackingStoreRetained
defer: NO];
contents = [window contentView];
button = [[NSButton alloc] initWithFrame: [contents bounds]];
[button setAutoresizingMask:
NSViewHeightSizable | NSViewWidthSizable];
[button setStringValue: @"Unknown object"];
[button setBordered: NO];
[button setEnabled: NO];
[contents addSubview: button];
RELEASE(button);
}
return self;
}
@end
/*
* The GormMultipleInspector is a placeholder for a multiple selection.
*/

View file

@ -721,7 +721,7 @@ NSImage *mVLine = nil;
[button setEnabled: NO];
[box addSubview: button];
rect = NSMakeRect(90,150,20,50);
rect = NSMakeRect(91,151,20,50);
top = [[NSButton alloc] initWithFrame: rect];
[top setImagePosition: NSImageOnly];
[top setImage: eVLine];
@ -734,7 +734,7 @@ NSImage *mVLine = nil;
[box addSubview: top];
RELEASE(top);
rect = NSMakeRect(90,0,20,50);
rect = NSMakeRect(91,0,20,50);
bottom = [[NSButton alloc] initWithFrame: rect];
[bottom setImagePosition: NSImageOnly];
[bottom setImage: eVLine];
@ -747,7 +747,7 @@ NSImage *mVLine = nil;
[box addSubview: bottom];
RELEASE(bottom);
rect = NSMakeRect(0,90,50,20);
rect = NSMakeRect(0,91,50,20);
left = [[NSButton alloc] initWithFrame: rect];
[left setImagePosition: NSImageOnly];
[left setImage: eHLine];
@ -760,7 +760,7 @@ NSImage *mVLine = nil;
[box addSubview: left];
RELEASE(left);
rect = NSMakeRect(150,90,50,20);
rect = NSMakeRect(151,91,50,20);
right = [[NSButton alloc] initWithFrame: rect];
[right setImagePosition: NSImageOnly];
[right setImage: eHLine];
@ -773,7 +773,7 @@ NSImage *mVLine = nil;
[box addSubview: right];
RELEASE(right);
rect = NSMakeRect(51,90,97,20);
rect = NSMakeRect(51,92,97,19);
width = [[NSButton alloc] initWithFrame: rect];
[width setImagePosition: NSImageOnly];
[width setImage: mHLine];
@ -786,7 +786,7 @@ NSImage *mVLine = nil;
[box addSubview: width];
RELEASE(width);
rect = NSMakeRect(90,51,20,97);
rect = NSMakeRect(91,52,19,96);
height = [[NSButton alloc] initWithFrame: rect];
[height setImagePosition: NSImageOnly];
[height setImage: mVLine];

179
GormObjectInspector.m Normal file
View file

@ -0,0 +1,179 @@
/* GormObjectInspector.m
*
* Copyright (C) 1999 Free Software Foundation, Inc.
*
* Author: Richard Frith-Macdonald <richard@brainstrom.co.uk>
* Date: 1999
*
* This file is part of GNUstep.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "GormPrivate.h"
@interface GormObjectInspector : IBInspector
{
NSBrowser *browser;
NSArray *names;
NSArray *types;
NSButton *label;
NSText *value;
}
- (void) updateButtons;
@end
@implementation GormObjectInspector
- (int) browser: (NSBrowser*)sender numberOfRowsInColumn: (int)column
{
return [names count];
}
- (BOOL) browser: (NSBrowser*)sender
selectCellWithString: (NSString*)title
inColumn: (int)col
{
[self updateButtons];
return YES;
}
- (NSString*) browser: (NSBrowser*)sender titleOfColumn: (int)col
{
return @"Attribute setters";
}
- (void) browser: (NSBrowser*)sender
willDisplayCell: (id)aCell
atRow: (int)row
column: (int)col
{
if (row >= 0 && row < [names count])
{
[aCell setStringValue: [names objectAtIndex: row]];
[aCell setEnabled: YES];
}
else
{
[aCell setStringValue: @""];
[aCell setEnabled: NO];
}
[aCell setLeaf: YES];
}
- (void) dealloc
{
RELEASE(label);
RELEASE(value);
RELEASE(names);
RELEASE(types);
RELEASE(okButton);
RELEASE(revertButton);
RELEASE(window);
[super dealloc];
}
- (id) init
{
self = [super init];
if (self != nil)
{
NSView *contents;
NSRect windowRect = NSMakeRect(0, 0, IVW, IVH-IVB);
NSRect rect;
window = [[NSWindow alloc] initWithContentRect: windowRect
styleMask: NSBorderlessWindowMask
backing: NSBackingStoreRetained
defer: NO];
contents = [window contentView];
rect = windowRect;
rect.size.height -= 70;
rect.origin.y += 70;
browser = [[NSBrowser alloc] initWithFrame: rect];
[browser setAutoresizingMask: NSViewWidthSizable|NSViewHeightSizable];
[browser setMaxVisibleColumns: 1];
[browser setAllowsMultipleSelection: NO];
[browser setHasHorizontalScroller: NO];
[browser setTitled: YES];
[browser setDelegate: self];
[browser setTarget: self];
[browser setAction: @selector(updateButtons)];
[contents addSubview: browser];
RELEASE(browser);
rect = windowRect;
rect.size.width -= 120;
rect.size.height = 22;
rect.origin.y = 30;
rect.origin.x = 60;
label = [[NSButton alloc] initWithFrame: rect];
[label setBordered: NO];
[label setTitle: @"No Type"];
[contents addSubview: label];
RELEASE(label);
rect = windowRect;
rect.size.height = 22;
rect.origin.y = 0;
value = [[NSTextField alloc] initWithFrame: rect];
[contents addSubview: value];
RELEASE(value);
okButton = [[NSButton alloc] initWithFrame: NSMakeRect(0,0,90,20)];
[okButton setAutoresizingMask: NSViewMaxYMargin | NSViewMinXMargin];
[okButton setAction: @selector(ok:)];
[okButton setTarget: self];
[okButton setTitle: @"Add"];
[okButton setEnabled: NO];
revertButton = [[NSButton alloc] initWithFrame: NSMakeRect(0,0,90,20)];
[revertButton setAutoresizingMask: NSViewMaxYMargin | NSViewMinXMargin];
[revertButton setAction: @selector(revert:)];
[revertButton setTarget: self];
[revertButton setTitle: @"Revert"];
[revertButton setEnabled: NO];
}
return self;
}
- (void) ok: (id)sender
{
}
- (void) setObject: (id)anObject
{
if (anObject != nil && anObject != object)
{
ASSIGN(object, anObject);
[browser loadColumnZero];
[self updateButtons];
}
}
- (void) updateButtons
{
}
- (BOOL) wantsButtons
{
return YES;
}
@end