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
|
|
|
|
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 "../../Gorm.h"
|
2002-02-18 12:37:26 +00:00
|
|
|
#include "GormNSBrowser.h"
|
2002-03-26 17:15:26 +00:00
|
|
|
#include "GormNSTableView.h"
|
|
|
|
#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
|
|
|
|
{
|
|
|
|
|
|
|
|
NSView *contents;
|
|
|
|
NSTableView *tv;
|
|
|
|
NSTableColumn *tc;
|
|
|
|
NSSize contentSize;
|
|
|
|
id v;
|
|
|
|
|
|
|
|
window = [[NSWindow alloc] initWithContentRect: NSMakeRect(0, 0, 272, 192)
|
|
|
|
styleMask: NSBorderlessWindowMask
|
|
|
|
backing: NSBackingStoreRetained
|
|
|
|
defer: NO];
|
|
|
|
contents = [window contentView];
|
|
|
|
|
|
|
|
/*******************/
|
|
|
|
/* First Column... */
|
|
|
|
/*******************/
|
|
|
|
|
|
|
|
|
|
|
|
// NSBrowser
|
|
|
|
// 124 is the minimum width. Below that the browser doesn't display !!
|
2002-02-18 12:37:26 +00:00
|
|
|
v = [[GormNSBrowser alloc] initWithFrame: NSMakeRect(10, 38, 124, 116)];
|
2001-11-20 16:52:25 +00:00
|
|
|
|
2002-02-18 12:37:26 +00:00
|
|
|
// [v setDelegate:nil];
|
2001-11-20 16:52:25 +00:00
|
|
|
[v setHasHorizontalScroller: YES];
|
|
|
|
[v setTitled: YES];
|
|
|
|
[v loadColumnZero];
|
|
|
|
|
|
|
|
//[v setTitle: @"Browser" ofColumn:0];
|
|
|
|
//[v setAutoresizingMask: NSViewHeightSizable|NSViewWidthSizable];
|
|
|
|
[contents addSubview: v];
|
|
|
|
RELEASE(v);
|
|
|
|
|
|
|
|
// browserDelegate = [[NSBrowserDelegate alloc] init];
|
|
|
|
//[v setDelegate:browserDelegate];
|
|
|
|
// [v setMaxVisibleColumns: 3];
|
|
|
|
//[v setAllowsMultipleSelection:NO];
|
|
|
|
// [v setAutoresizingMask: NSViewHeightSizable|NSViewWidthSizable];
|
|
|
|
|
|
|
|
/********************/
|
|
|
|
/* Second Column... */
|
|
|
|
/********************/
|
|
|
|
|
|
|
|
|
|
|
|
// NSTableView
|
|
|
|
v = [[NSScrollView alloc] initWithFrame: NSMakeRect(136, 38, 124, 116)];
|
|
|
|
|
|
|
|
[v setHasVerticalScroller: YES];
|
|
|
|
[v setHasHorizontalScroller: NO];
|
|
|
|
//[v setAutoresizingMask: NSViewHeightSizable|NSViewWidthSizable];
|
|
|
|
contentSize = [v contentSize];
|
|
|
|
|
2002-03-26 17:15:26 +00:00
|
|
|
tv = [[GormNSTableView alloc] initWithFrame:
|
2001-11-20 16:52:25 +00:00
|
|
|
NSMakeRect(0,0,contentSize.width, contentSize.height)];
|
|
|
|
// [tv setDataSource: [[NSTableViewDataSource alloc] init]];
|
2002-03-26 17:15:26 +00:00
|
|
|
// [tv setAutoresizesAllColumnsToFit: YES];
|
2001-11-20 16:52:25 +00:00
|
|
|
[v setDocumentView: tv];
|
|
|
|
RELEASE(tv);
|
|
|
|
|
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);
|
|
|
|
[tv setFrame: NSMakeRect(0,0,contentSize.width, contentSize.height)];
|
|
|
|
|
2002-03-26 17:15:26 +00:00
|
|
|
// [v setDocumentView: tv];
|
2001-11-20 16:52:25 +00:00
|
|
|
[contents addSubview: v];
|
|
|
|
RELEASE(tv);
|
|
|
|
RELEASE(v);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|