1999-12-16 21:41:21 +00:00
|
|
|
/* 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
|
2007-11-05 23:44:36 +00:00
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
1999-12-16 21:41:21 +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
|
2004-04-17 15:04:26 +00:00
|
|
|
along with this program; if not, write to the Free Software
|
2005-05-26 03:37:38 +00:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
|
1999-12-16 21:41:21 +00:00
|
|
|
*/
|
|
|
|
#include <Foundation/Foundation.h>
|
2004-11-18 05:34:19 +00:00
|
|
|
#include <AppKit/NSTableColumn.h>
|
|
|
|
#include <AppKit/NSTabView.h>
|
|
|
|
#include <AppKit/NSWindow.h>
|
|
|
|
#include <AppKit/NSTabViewItem.h>
|
|
|
|
#include <AppKit/NSScrollView.h>
|
2003-05-23 02:25:34 +00:00
|
|
|
#include <InterfaceBuilder/InterfaceBuilder.h>
|
2002-02-18 12:37:26 +00:00
|
|
|
#include "GormNSBrowser.h"
|
2002-03-26 17:15:26 +00:00
|
|
|
#include "GormNSTableView.h"
|
2002-03-31 15:59:18 +00:00
|
|
|
#include "GormNSOutlineView.h"
|
2002-03-26 17:15:26 +00:00
|
|
|
#include <math.h>
|
1999-12-16 21:41:21 +00:00
|
|
|
|
2001-11-20 16:52:25 +00:00
|
|
|
|
|
|
|
/* ---------------------------------------------------------------
|
|
|
|
* Containers Palette Display
|
|
|
|
*/
|
|
|
|
|
1999-12-16 21:41:21 +00:00
|
|
|
@interface ContainersPalette: IBPalette
|
|
|
|
{
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation ContainersPalette
|
|
|
|
|
2001-11-20 16:52:25 +00:00
|
|
|
- (void) finishInstantiate
|
2019-12-22 23:46:59 +00:00
|
|
|
{
|
2001-11-20 16:52:25 +00:00
|
|
|
|
|
|
|
NSView *contents;
|
2002-03-31 15:59:18 +00:00
|
|
|
NSTableView *tv;
|
|
|
|
NSOutlineView *ov;
|
|
|
|
NSTableColumn *tc;
|
|
|
|
NSSize contentSize;
|
2001-11-20 16:52:25 +00:00
|
|
|
id v;
|
|
|
|
|
2004-07-12 04:16:09 +00:00
|
|
|
originalWindow = [[NSWindow alloc] initWithContentRect:
|
|
|
|
NSMakeRect(0, 0, 272, 192)
|
2001-11-20 16:52:25 +00:00
|
|
|
styleMask: NSBorderlessWindowMask
|
|
|
|
backing: NSBackingStoreRetained
|
|
|
|
defer: NO];
|
2019-12-22 23:46:59 +00:00
|
|
|
[originalWindow setTitle: @"Conatiners"];
|
2004-07-12 04:16:09 +00:00
|
|
|
contents = [originalWindow contentView];
|
2001-11-20 16:52:25 +00:00
|
|
|
|
|
|
|
/*******************/
|
|
|
|
/* First Column... */
|
|
|
|
/*******************/
|
|
|
|
|
|
|
|
|
|
|
|
// NSBrowser
|
|
|
|
// 124 is the minimum width. Below that the browser doesn't display !!
|
2002-08-14 00:01:42 +00:00
|
|
|
v = [[GormNSBrowser alloc] initWithFrame: NSMakeRect(10, 98, 124, 78)];
|
2001-11-20 16:52:25 +00:00
|
|
|
[v setHasHorizontalScroller: YES];
|
|
|
|
[v setTitled: YES];
|
|
|
|
[v loadColumnZero];
|
|
|
|
[contents addSubview: v];
|
|
|
|
RELEASE(v);
|
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);
|
|
|
|
|
2001-11-20 16:52:25 +00:00
|
|
|
|
|
|
|
/********************/
|
|
|
|
/* Second Column... */
|
|
|
|
/********************/
|
|
|
|
|
|
|
|
|
|
|
|
// NSTableView
|
2002-03-31 15:59:18 +00:00
|
|
|
v = [[NSScrollView alloc] initWithFrame:
|
|
|
|
NSMakeRect(136, 10, 124, 78)];
|
2002-08-17 22:46:19 +00:00
|
|
|
[contents addSubview: v];
|
2001-11-20 16:52:25 +00:00
|
|
|
[v setHasVerticalScroller: YES];
|
|
|
|
[v setHasHorizontalScroller: NO];
|
|
|
|
contentSize = [v contentSize];
|
2004-05-29 12:49:01 +00:00
|
|
|
[v setBorderType: NSBezelBorder];
|
2001-11-20 16:52:25 +00:00
|
|
|
|
2002-03-26 17:15:26 +00:00
|
|
|
tv = [[GormNSTableView alloc] initWithFrame:
|
2002-08-14 00:01:42 +00:00
|
|
|
NSZeroRect];
|
2001-11-20 16:52:25 +00:00
|
|
|
|
2002-03-26 17:15:26 +00:00
|
|
|
tc = [[NSTableColumn alloc] initWithIdentifier: @"column1"];
|
2001-11-20 16:52:25 +00:00
|
|
|
[[tc headerCell] setStringValue: @" "];
|
2002-03-26 17:15:26 +00:00
|
|
|
[tc setWidth: floor(contentSize.width/2)];
|
|
|
|
[tc setMinWidth: 20];
|
2001-11-20 16:52:25 +00:00
|
|
|
[tc setResizable: YES];
|
|
|
|
[tc setEditable: YES];
|
|
|
|
[tv addTableColumn: tc];
|
|
|
|
RELEASE(tc);
|
|
|
|
|
2002-03-26 17:15:26 +00:00
|
|
|
tc = [[NSTableColumn alloc] initWithIdentifier: @"column2"];
|
2001-11-20 16:52:25 +00:00
|
|
|
[[tc headerCell] setStringValue: @" "];
|
2002-03-26 17:15:26 +00:00
|
|
|
[tc setWidth: ceil(contentSize.width/2)];
|
|
|
|
[tc setMinWidth: 20];
|
2001-11-20 16:52:25 +00:00
|
|
|
[tc setResizable: YES];
|
|
|
|
[tc setEditable: YES];
|
|
|
|
[tv addTableColumn: tc];
|
|
|
|
RELEASE(tc);
|
|
|
|
|
2002-08-17 22:46:19 +00:00
|
|
|
[v setDocumentView: tv];
|
2001-11-20 16:52:25 +00:00
|
|
|
[contents addSubview: v];
|
|
|
|
RELEASE(tv);
|
|
|
|
RELEASE(v);
|
|
|
|
|
2002-03-31 15:59:18 +00:00
|
|
|
// NSOutlineView
|
|
|
|
v = [[NSScrollView alloc] initWithFrame:
|
|
|
|
NSMakeRect(136, 98, 124, 78)];
|
2002-08-17 22:46:19 +00:00
|
|
|
[contents addSubview: v];
|
2002-03-31 15:59:18 +00:00
|
|
|
[v setHasVerticalScroller: YES];
|
|
|
|
[v setHasHorizontalScroller: NO];
|
|
|
|
contentSize = [v contentSize];
|
2004-05-29 12:49:01 +00:00
|
|
|
[v setBorderType: NSBezelBorder];
|
2002-03-31 15:59:18 +00:00
|
|
|
|
|
|
|
ov = [[GormNSOutlineView alloc] initWithFrame:
|
2002-08-14 00:01:42 +00:00
|
|
|
NSZeroRect];
|
2002-03-31 15:59:18 +00:00
|
|
|
|
|
|
|
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);
|
2004-04-17 15:04:26 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2002-03-31 15:59:18 +00:00
|
|
|
[ov setDrawsGrid: NO];
|
|
|
|
[ov setIndentationPerLevel: 10.];
|
|
|
|
[ov setIndentationMarkerFollowsCell: YES];
|
2004-04-17 15:04:26 +00:00
|
|
|
[ov expandItem: @"NSObject" expandChildren: YES];
|
2002-08-17 22:46:19 +00:00
|
|
|
[v setDocumentView: ov];
|
|
|
|
|
2002-03-31 15:59:18 +00:00
|
|
|
RELEASE(ov);
|
2004-05-29 12:49:01 +00:00
|
|
|
RELEASE(v);
|
2001-11-20 16:52:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|