apps-gorm/Palettes/3Containers/main.m
Pierre-Yves Rivaille 3f892d52a9 ChangeLog
GormWindowEditor.m
GNUmakefile
GormObjectEditor.m
GormTableViewEditor.m
ClassInformation.plist
GormDocument.m
Palettes/3Containers/main.m
Palettes/3Containers/GNUmakefile
Palettes/3Containers/inspectors.m
Palettes/2Controls/GormBoxInspector.gorm
Palettes/2Controls/GormTextFieldInspector.gorm
Palettes/2Controls/GormSliderInspector.gorm
Palettes/2Controls/GormFormInspector.gorm
Palettes/2Controls/GormButtonInspector.gorm
Resources/GormViewSizeInspector.gorm
Resources/GormViewSizeInspector.classes
Palettes/3Containers/GormNSOutlineView.m
Palettes/3Containers/GormNSOutlineView.h


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@13277 72102866-910b-0410-8b05-ffd578937521
2002-03-31 15:59:18 +00:00

175 lines
4.9 KiB
Objective-C

/* 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"
#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;
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 !!
v = [[GormNSBrowser alloc] initWithFrame: NSMakeRect(10, 38, 124, 116)];
// [v setDelegate:nil];
[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, 10, 124, 78)];
[v setHasVerticalScroller: YES];
[v setHasHorizontalScroller: NO];
//[v setAutoresizingMask: NSViewHeightSizable|NSViewWidthSizable];
contentSize = [v contentSize];
tv = [[GormNSTableView alloc] initWithFrame:
NSZeroRect];
// [tv setDataSource: [[NSTableViewDataSource alloc] init]];
// [tv setAutoresizesAllColumnsToFit: YES];
[v setDocumentView: tv];
RELEASE(tv);
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);
[tv setFrame: NSMakeRect(0,0,contentSize.width, contentSize.height)];
// [v setDocumentView: tv];
[contents addSubview: v];
RELEASE(tv);
RELEASE(v);
// NSOutlineView
v = [[NSScrollView alloc] initWithFrame:
NSMakeRect(136, 98, 124, 78)];
[v setHasVerticalScroller: YES];
[v setHasHorizontalScroller: NO];
//[v setAutoresizingMask: NSViewHeightSizable|NSViewWidthSizable];
contentSize = [v contentSize];
ov = [[GormNSOutlineView alloc] initWithFrame:
NSMakeRect(0,0,contentSize.width, contentSize.height)];
// [tv setAutoresizesAllColumnsToFit: YES];
[v setDocumentView: ov];
RELEASE(tv);
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);
[ov setFrame: NSMakeRect(0,0,contentSize.width, contentSize.height)];
[ov setDrawsGrid: NO];
[ov setIndentationPerLevel: 10.];
[ov setIndentationMarkerFollowsCell: YES];
[contents addSubview: v];
RELEASE(ov);
RELEASE(v);
}
@end