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

192 lines
5.1 KiB
Mathematica
Raw Normal View History

/* main.m
Copyright (C) 1999 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 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 <Foundation/Foundation.h>
#include <AppKit/AppKit.h>
#include <InterfaceBuilder/InterfaceBuilder.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
#include "GormNSBrowser.h"
#include "GormNSTableView.h"
#include "GormNSOutlineView.h"
#include <math.h>
/* ---------------------------------------------------------------
* Containers Palette Display
*/
@interface ContainersPalette: IBPalette
{
}
@end
@implementation ContainersPalette
- (void) finishInstantiate
{
NSView *contents;
NSTableView *tv;
NSOutlineView *ov;
NSTableColumn *tc;
NSSize contentSize;
id v;
originalWindow = [[NSWindow alloc] initWithContentRect:
NSMakeRect(0, 0, 272, 192)
styleMask: NSBorderlessWindowMask
backing: NSBackingStoreRetained
defer: NO];
contents = [originalWindow contentView];
/*******************/
/* First Column... */
/*******************/
// NSBrowser
// 124 is the minimum width. Below that the browser doesn't display !!
GormBoxEditor.h GormBoxEditor.m GormButtonEditor.h GormButtonEditor.m GormControlEditor.h GormControlEditor.m GormInternalViewEditor.h GormInternalViewEditor.m GormMatrixEditor.h GormPlacementInfo.h GormPosingView.h GormPosingView.m GormSplitViewEditor.h GormSplitViewEditor.m GormTabViewEditor.h GormTabViewEditor.m GormViewEditor.h GormViewEditor.m GormViewWithContentViewEditor.h GormViewWithContentViewEditor.m GormViewWithSubviewsEditor.h GormViewWithSubviewsEditor.m Palettes/3Containers/GormTableViewEditor.h Palettes/3Containers/GormTableViewEditor.m ChangeLog GNUmakefile Gorm.h Gorm.m GormClassEditor.m GormClassManager.m GormCustomClassInspector.m GormCustomView.m GormDocument.m GormMatrixEditor.m GormObjectEditor.m GormOutlineView.m GormPrivate.h GormWindowEditor.m Palettes/0Menus/GormMenuEditor.m Palettes/1Windows/main.m Palettes/2Controls/GormBoxInspector.gorm Palettes/2Controls/GormButtonInspector.gorm Palettes/2Controls/GormTextFieldInspector.gorm Palettes/2Controls/main.m Palettes/3Containers/GNUmakefile Palettes/3Containers/GormNSBrowser.m Palettes/3Containers/GormNSOutlineView.m Palettes/3Containers/GormNSTableView.h Palettes/3Containers/GormTableColumnInspector.classes Palettes/3Containers/GormTableColumnInspector.gorm Palettes/3Containers/GormTableViewInspector.gorm Palettes/3Containers/inspectors.m Palettes/3Containers/main.m Palettes/4Data/inspectors.m Palettes/4Data/main.m git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@14267 72102866-910b-0410-8b05-ffd578937521
2002-08-14 00:01:42 +00:00
v = [[GormNSBrowser alloc] initWithFrame: NSMakeRect(10, 98, 124, 78)];
[v setHasHorizontalScroller: YES];
[v setTitled: YES];
[v loadColumnZero];
[contents addSubview: v];
RELEASE(v);
GormBoxEditor.h GormBoxEditor.m GormButtonEditor.h GormButtonEditor.m GormControlEditor.h GormControlEditor.m GormInternalViewEditor.h GormInternalViewEditor.m GormMatrixEditor.h GormPlacementInfo.h GormPosingView.h GormPosingView.m GormSplitViewEditor.h GormSplitViewEditor.m GormTabViewEditor.h GormTabViewEditor.m GormViewEditor.h GormViewEditor.m GormViewWithContentViewEditor.h GormViewWithContentViewEditor.m GormViewWithSubviewsEditor.h GormViewWithSubviewsEditor.m Palettes/3Containers/GormTableViewEditor.h Palettes/3Containers/GormTableViewEditor.m ChangeLog GNUmakefile Gorm.h Gorm.m GormClassEditor.m GormClassManager.m GormCustomClassInspector.m GormCustomView.m GormDocument.m GormMatrixEditor.m GormObjectEditor.m GormOutlineView.m GormPrivate.h GormWindowEditor.m Palettes/0Menus/GormMenuEditor.m Palettes/1Windows/main.m Palettes/2Controls/GormBoxInspector.gorm Palettes/2Controls/GormButtonInspector.gorm Palettes/2Controls/GormTextFieldInspector.gorm Palettes/2Controls/main.m Palettes/3Containers/GNUmakefile Palettes/3Containers/GormNSBrowser.m Palettes/3Containers/GormNSOutlineView.m Palettes/3Containers/GormNSTableView.h Palettes/3Containers/GormTableColumnInspector.classes Palettes/3Containers/GormTableColumnInspector.gorm Palettes/3Containers/GormTableViewInspector.gorm Palettes/3Containers/inspectors.m Palettes/3Containers/main.m Palettes/4Data/inspectors.m Palettes/4Data/main.m git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@14267 72102866-910b-0410-8b05-ffd578937521
2002-08-14 00:01:42 +00:00
// NSTabView
v = [[NSTabView alloc] initWithFrame: NSMakeRect(10, 10, 124, 78)];
[contents addSubview: v];
{
NSView *vv;
NSTabViewItem *tvi;
tvi = [[NSTabViewItem alloc] initWithIdentifier: @"item 1"];
[tvi setLabel: @"Item 1"];
vv = [[NSView alloc] init];
[vv setAutoresizingMask:
NSViewWidthSizable | NSViewHeightSizable];
[tvi setView: vv];
[v addTabViewItem: tvi];
RELEASE(tvi);
tvi = [[NSTabViewItem alloc] initWithIdentifier: @"item 2"];
[tvi setLabel: @"Item 2"];
vv = [[NSView alloc] init];
[vv setAutoresizingMask:
NSViewWidthSizable | NSViewHeightSizable];
[tvi setView: vv];
[v addTabViewItem: tvi];
RELEASE(tvi);
}
RELEASE(v);
/********************/
/* Second Column... */
/********************/
// NSTableView
v = [[NSScrollView alloc] initWithFrame:
NSMakeRect(136, 10, 124, 78)];
[contents addSubview: v];
[v setHasVerticalScroller: YES];
[v setHasHorizontalScroller: NO];
contentSize = [v contentSize];
[v setBorderType: NSBezelBorder];
tv = [[GormNSTableView alloc] initWithFrame:
GormBoxEditor.h GormBoxEditor.m GormButtonEditor.h GormButtonEditor.m GormControlEditor.h GormControlEditor.m GormInternalViewEditor.h GormInternalViewEditor.m GormMatrixEditor.h GormPlacementInfo.h GormPosingView.h GormPosingView.m GormSplitViewEditor.h GormSplitViewEditor.m GormTabViewEditor.h GormTabViewEditor.m GormViewEditor.h GormViewEditor.m GormViewWithContentViewEditor.h GormViewWithContentViewEditor.m GormViewWithSubviewsEditor.h GormViewWithSubviewsEditor.m Palettes/3Containers/GormTableViewEditor.h Palettes/3Containers/GormTableViewEditor.m ChangeLog GNUmakefile Gorm.h Gorm.m GormClassEditor.m GormClassManager.m GormCustomClassInspector.m GormCustomView.m GormDocument.m GormMatrixEditor.m GormObjectEditor.m GormOutlineView.m GormPrivate.h GormWindowEditor.m Palettes/0Menus/GormMenuEditor.m Palettes/1Windows/main.m Palettes/2Controls/GormBoxInspector.gorm Palettes/2Controls/GormButtonInspector.gorm Palettes/2Controls/GormTextFieldInspector.gorm Palettes/2Controls/main.m Palettes/3Containers/GNUmakefile Palettes/3Containers/GormNSBrowser.m Palettes/3Containers/GormNSOutlineView.m Palettes/3Containers/GormNSTableView.h Palettes/3Containers/GormTableColumnInspector.classes Palettes/3Containers/GormTableColumnInspector.gorm Palettes/3Containers/GormTableViewInspector.gorm Palettes/3Containers/inspectors.m Palettes/3Containers/main.m Palettes/4Data/inspectors.m Palettes/4Data/main.m git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@14267 72102866-910b-0410-8b05-ffd578937521
2002-08-14 00:01:42 +00:00
NSZeroRect];
tc = [[NSTableColumn alloc] initWithIdentifier: @"column1"];
[[tc headerCell] setStringValue: @" "];
[tc setWidth: floor(contentSize.width/2)];
[tc setMinWidth: 20];
[tc setResizable: YES];
[tc setEditable: YES];
[tv addTableColumn: tc];
RELEASE(tc);
tc = [[NSTableColumn alloc] initWithIdentifier: @"column2"];
[[tc headerCell] setStringValue: @" "];
[tc setWidth: ceil(contentSize.width/2)];
[tc setMinWidth: 20];
[tc setResizable: YES];
[tc setEditable: YES];
[tv addTableColumn: tc];
RELEASE(tc);
[v setDocumentView: tv];
[contents addSubview: v];
RELEASE(tv);
RELEASE(v);
// NSOutlineView
v = [[NSScrollView alloc] initWithFrame:
NSMakeRect(136, 98, 124, 78)];
[contents addSubview: v];
[v setHasVerticalScroller: YES];
[v setHasHorizontalScroller: NO];
contentSize = [v contentSize];
[v setBorderType: NSBezelBorder];
ov = [[GormNSOutlineView alloc] initWithFrame:
GormBoxEditor.h GormBoxEditor.m GormButtonEditor.h GormButtonEditor.m GormControlEditor.h GormControlEditor.m GormInternalViewEditor.h GormInternalViewEditor.m GormMatrixEditor.h GormPlacementInfo.h GormPosingView.h GormPosingView.m GormSplitViewEditor.h GormSplitViewEditor.m GormTabViewEditor.h GormTabViewEditor.m GormViewEditor.h GormViewEditor.m GormViewWithContentViewEditor.h GormViewWithContentViewEditor.m GormViewWithSubviewsEditor.h GormViewWithSubviewsEditor.m Palettes/3Containers/GormTableViewEditor.h Palettes/3Containers/GormTableViewEditor.m ChangeLog GNUmakefile Gorm.h Gorm.m GormClassEditor.m GormClassManager.m GormCustomClassInspector.m GormCustomView.m GormDocument.m GormMatrixEditor.m GormObjectEditor.m GormOutlineView.m GormPrivate.h GormWindowEditor.m Palettes/0Menus/GormMenuEditor.m Palettes/1Windows/main.m Palettes/2Controls/GormBoxInspector.gorm Palettes/2Controls/GormButtonInspector.gorm Palettes/2Controls/GormTextFieldInspector.gorm Palettes/2Controls/main.m Palettes/3Containers/GNUmakefile Palettes/3Containers/GormNSBrowser.m Palettes/3Containers/GormNSOutlineView.m Palettes/3Containers/GormNSTableView.h Palettes/3Containers/GormTableColumnInspector.classes Palettes/3Containers/GormTableColumnInspector.gorm Palettes/3Containers/GormTableViewInspector.gorm Palettes/3Containers/inspectors.m Palettes/3Containers/main.m Palettes/4Data/inspectors.m Palettes/4Data/main.m git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@14267 72102866-910b-0410-8b05-ffd578937521
2002-08-14 00:01:42 +00:00
NSZeroRect];
tc = [[NSTableColumn alloc] initWithIdentifier: @"classes"];
[[tc headerCell] setStringValue: @" "];
[tc setWidth: floor(contentSize.width/2)];
[tc setMinWidth: 20];
[tc setResizable: YES];
[tc setEditable: YES];
[ov addTableColumn: tc];
[ov setOutlineTableColumn: tc];
RELEASE(tc);
tc = [[NSTableColumn alloc] initWithIdentifier: @"outlets"];
[[tc headerCell] setStringValue: @" "];
[tc setWidth: ceil(contentSize.width/2)];
[tc setMinWidth: 20];
[tc setResizable: YES];
[tc setEditable: YES];
[ov addTableColumn: tc];
RELEASE(tc);
tc = [[NSTableColumn alloc] initWithIdentifier: @"actions"];
[[tc headerCell] setStringValue: @" "];
[tc setWidth: ceil(contentSize.width/2)];
[tc setMinWidth: 20];
[tc setResizable: YES];
[tc setEditable: YES];
[ov addTableColumn: tc];
RELEASE(tc);
[ov setDrawsGrid: NO];
[ov setIndentationPerLevel: 10.];
[ov setIndentationMarkerFollowsCell: YES];
[ov expandItem: @"NSObject" expandChildren: YES];
[v setDocumentView: ov];
RELEASE(ov);
RELEASE(v);
}
@end