apps-gorm/Palettes/3Containers/GormNSBrowser.m

120 lines
2.9 KiB
Mathematica
Raw Normal View History

* 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
/* GormNSBrowser.m
Copyright (C) 2001 Free Software Foundation, Inc.
Author: Pierre-Yves Rivaille <pyrivail@ens-lyon.fr>
Date: 2001
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
* 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
(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.
* 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
*/
#include <Foundation/Foundation.h>
#include <AppKit/AppKit.h>
#include "GormNSBrowser.h"
* 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
/* ---------------------------------------------------------------
* NSBrowser Delegate
*/
@interface NSBrowserDelegate: NSObject
{
}
- (NSInteger) browser: (NSBrowser *)sender numberOfRowsInColumn: (NSInteger)column;
- (NSString *) browser: (NSBrowser *)sender titleOfColumn: (NSInteger)column;
* 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
- (void) browser: (NSBrowser *)sender willDisplayCell: (id)cell
atRow: (NSInteger)row column: (NSInteger)column;
* 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
@end
@implementation NSBrowserDelegate
- (NSInteger) browser: (NSBrowser *)sender numberOfRowsInColumn: (NSInteger)column
* 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
{
return 0;
}
- (NSString *) browser: (NSBrowser *)sender titleOfColumn: (NSInteger)column
* 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
{
return (column==0) ? @"Browser" : @"";
}
- (void) browser: (NSBrowser *)sender
willDisplayCell: (id)cell
atRow: (NSInteger)row
column: (NSInteger)column
* 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
{
// NSDebugLog(@"%@: browser %@ will display %@ %@ at %d,%d",self,sender,[cell class],cell,row,column);
* 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
// This code should never be called because there is no row
// in our browser. But just in case...
[cell setLeaf:YES];
[cell setStringValue: @""];
}
@end
static id _sharedDelegate = nil;
@implementation GormNSBrowser
+ (id) sharedDelegate
{
if (_sharedDelegate == nil)
{
_sharedDelegate = [[NSBrowserDelegate alloc] init];
}
return _sharedDelegate;
}
- (id) initWithFrame: (NSRect) aRect
{
self = [super initWithFrame: aRect];
[super setDelegate: [GormNSBrowser sharedDelegate]];
_gormDelegate = nil;
return self;
}
- (void)setDelegate: (id)anObject
{
_gormDelegate = anObject;
}
- (id)delegate
{
return _gormDelegate;
}
- (void)encodeWithCoder: (NSCoder*) aCoder
{
_browserDelegate = _gormDelegate;
[super encodeWithCoder: aCoder];
_browserDelegate = _sharedDelegate;
}
- (id) initWithCoder: (NSCoder*) aCoder
{
[super setDelegate: [GormNSBrowser sharedDelegate]];
self = [super initWithCoder: aCoder];
return self;
}
- (NSString *) className
{
return @"NSBrowser";
}
* 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
@end