apps-gorm/Applications/Gorm/Palettes/1Windows/WindowsPalette.m

179 lines
4.7 KiB
Mathematica
Raw Normal View History

/*
main.m
Copyright (C) 1999-2005 Free Software Foundation, Inc.
Author: Richard frith-Macdonald (richard@brainstorm.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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
*/
#include <InterfaceBuilder/InterfaceBuilder.h>
#include <GormCore/GormCore.h>
#include "GormWindowSizeInspector.h"
#include "WindowsPalette.h"
@interface GormWindowMaker : NSObject <NSCoding>
{
}
@end
@implementation GormWindowMaker
- (void) encodeWithCoder: (NSCoder*)aCoder
{
}
- (id) initWithCoder: (NSCoder*)aCoder
{
id w;
unsigned style = ( NSTitledWindowMask | NSClosableWindowMask
| NSResizableWindowMask | NSMiniaturizableWindowMask);
NSRect screenRect = [[NSScreen mainScreen] frame];
float x = (screenRect.size.width - 500)/2;
float y = (screenRect.size.height - 300)/2;
NSRect windowRect = NSMakeRect(x,y,500,300);
w = [[GormNSWindow alloc] initWithContentRect: windowRect
* Palettes/3Containers/GNUmakefile * Palettes/3Containers/main.m * Palettes/3Containers/GormNSBrowser.m * Palettes/3Containers/GormNSBrowser.h * Gorm.m * GormDocument.m Subclass of NSBrowser and NSTableView to be able to set the delegate for runtime only (there is a dummy delegate for edit-time and test-time). Those classes are encoded as NSBrowser/NSTableView and NSTableView/NSBrowser are decoded as GormNSBrowser/GormNSTableView * Palettes/1Windows/GNUmakefile * Palettes/1Windows/GormNSWindow.h * Palettes/1Windows/GormNSWindow.m * Palettes/1Windows/main.m * GormDocument.m * Gorm.m Subclass of NSWindow to be able to choose the stylemask and to still be able to resize/close/minimize the window in the editor regardless of the stylemask. This class is encoded as NSWindow and NSWindow is decoded as GormNSWindow. * GormDocument.m ([-attachObect:toParent]): NSTableView & NSTextView objects contained in NSScrollView are now added. Connections to and from those objects are now available. * GormWindowEditor.m: new bestKnownSuperview function (original patch from Stefan Urbanek <stefanurbanek@yahoo.fr> modified to let the user select the NSScrollView or the NSTextView/ NSTableView contained within the NSScrollView). * Palettes/3Containers/inspectors.m * Palettes/3Containers/GormBrowserInspector.gorm * Palettes/3Containers/GormTableViewInspector.gorm NSTableView and NSBrowser inspectors updated (new tag field) (patch from Stefan Urbanek <stefanurbanek@yahoo.fr>) git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@12559 72102866-910b-0410-8b05-ffd578937521
2002-02-18 12:37:26 +00:00
styleMask: style
backing: NSBackingStoreRetained
defer: NO];
[w setFrame: windowRect display: YES];
[w setTitle: @"Window"];
[w orderFront: self];
RELEASE(self);
return w;
}
@end
@interface GormPanelMaker : NSObject <NSCoding>
{
}
@end
@implementation GormPanelMaker
- (void) encodeWithCoder: (NSCoder*)aCoder
{
}
- (id) initWithCoder: (NSCoder*)aCoder
{
id w;
unsigned style = NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask;
NSRect screenRect = [[NSScreen mainScreen] frame];
float
x = (screenRect.size.width - 500)/2,
y = (screenRect.size.height - 300)/2;
NSRect windowRect = NSMakeRect(x,y,500,300);
w = [[GormNSPanel alloc] initWithContentRect: windowRect
styleMask: style
backing: NSBackingStoreRetained
defer: NO];
[w setFrame: windowRect display: YES];
[w setTitle: @"Panel"];
[w orderFront: self];
RELEASE(self);
return w;
}
@end
@implementation WindowsPalette
- (void) finishInstantiate
{
NSView *contents;
id w;
id v;
NSBundle *bundle = [NSBundle bundleForClass: [self class]];
NSString *path = [bundle pathForImageResource: @"WindowDrag"];
NSImage *dragImage = [[NSImage alloc] initWithContentsOfFile: path];
NSString *drawerPath = [bundle pathForImageResource: @"Drawer"];
NSImage *drawerImage = [[NSImage alloc] initWithContentsOfFile: drawerPath];
NSFont *systemFont = [NSFont boldSystemFontOfSize: [NSFont systemFontSize]];
RELEASE(originalWindow);
originalWindow = [[NSWindow alloc] initWithContentRect:
NSMakeRect(0, 0, 272, 192)
styleMask: NSBorderlessWindowMask
backing: NSBackingStoreRetained
defer: NO];
[originalWindow setTitle: @"Windows"];
contents = [originalWindow contentView];
w = [[GormWindowMaker alloc] init];
v = [[NSButton alloc] initWithFrame: NSMakeRect(35, 100, 80, 64)];
[v setFont: systemFont];
[v setBordered: NO];
[v setImage: dragImage];
[v setImagePosition: NSImageOverlaps];
[v setTitle: @"Window"];
[contents addSubview: v];
[self associateObject: w
type: IBWindowPboardType
with: v];
RELEASE(v);
RELEASE(w);
w = [[GormPanelMaker alloc] init];
v = [[NSButton alloc] initWithFrame: NSMakeRect(155, 100, 80, 64)];
[v setFont: systemFont];
[v setBordered: NO];
[v setImage: dragImage];
[v setImagePosition: NSImageOverlaps];
[v setTitle: @"Panel"];
[contents addSubview: v];
[self associateObject: w
type: IBWindowPboardType
with: v];
RELEASE(v);
RELEASE(w);
w = [[NSDrawer alloc] init];
v = [[NSButton alloc] initWithFrame: NSMakeRect(95, 30, 80, 64)];
[v setFont: systemFont];
[v setBordered: NO];
[v setImage: drawerImage];
[v setImagePosition: NSImageOverlaps];
[v setTitle: @"Drawer"];
[contents addSubview: v];
[self associateObject: w
type: IBObjectPboardType
with: v];
RELEASE(v);
RELEASE(w);
RELEASE(dragImage);
RELEASE(drawerImage);
}
@end
* Palettes/3Containers/GNUmakefile * Palettes/3Containers/main.m * Palettes/3Containers/GormNSBrowser.m * Palettes/3Containers/GormNSBrowser.h * Gorm.m * GormDocument.m Subclass of NSBrowser and NSTableView to be able to set the delegate for runtime only (there is a dummy delegate for edit-time and test-time). Those classes are encoded as NSBrowser/NSTableView and NSTableView/NSBrowser are decoded as GormNSBrowser/GormNSTableView * Palettes/1Windows/GNUmakefile * Palettes/1Windows/GormNSWindow.h * Palettes/1Windows/GormNSWindow.m * Palettes/1Windows/main.m * GormDocument.m * Gorm.m Subclass of NSWindow to be able to choose the stylemask and to still be able to resize/close/minimize the window in the editor regardless of the stylemask. This class is encoded as NSWindow and NSWindow is decoded as GormNSWindow. * GormDocument.m ([-attachObect:toParent]): NSTableView & NSTextView objects contained in NSScrollView are now added. Connections to and from those objects are now available. * GormWindowEditor.m: new bestKnownSuperview function (original patch from Stefan Urbanek <stefanurbanek@yahoo.fr> modified to let the user select the NSScrollView or the NSTextView/ NSTableView contained within the NSScrollView). * Palettes/3Containers/inspectors.m * Palettes/3Containers/GormBrowserInspector.gorm * Palettes/3Containers/GormTableViewInspector.gorm NSTableView and NSBrowser inspectors updated (new tag field) (patch from Stefan Urbanek <stefanurbanek@yahoo.fr>) git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@12559 72102866-910b-0410-8b05-ffd578937521
2002-02-18 12:37:26 +00:00
@implementation NSWindow (GormPrivate)
+ (id) allocSubstitute
{
return [GormNSWindow alloc];
}
@end
@implementation NSPanel (GormPrivate)
+ (id) allocSubstitute
{
return [GormNSPanel alloc];
}
@end