apps-gorm/GormViewWindow.m
Gregory John Casamento 5829d599d0 Changes to correct the set name issue as well as some of the code to facilitate standalone views.:
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@17643 72102866-910b-0410-8b05-ffd578937521
2003-09-09 01:28:46 +00:00

52 lines
917 B
Objective-C

#include "GormViewWindow.h"
#include <AppKit/NSWindow.h>
#include <AppKit/NSView.h>
#include <Foundation/NSNotification.h>
@implementation GormViewWindow
- (id) initWithView: (NSView *)view
{
// initializer yourself....
if((self = [super init]) != nil)
{
ASSIGN(_view,view);
[self setDelegate: self];
}
return self;
}
- (void) _resizeView
{
NSRect newFrame = [[self contentView] frame];
newFrame.origin.x += 10;
newFrame.origin.y += 10;
newFrame.size.height -= 10;
newFrame.size.width -= 10;
[_view setFrame: newFrame];
}
- (void) setView: (NSView *) view
{
if(_view != nil)
{
[_view removeFromSuperview];
}
ASSIGN(_view,view);
[self _resizeView];
[[self contentView] addSubview: _view];
}
- (NSView *) view
{
return _view;
}
- (void) windowDidResize: (NSNotification *)notification
{
if(_view != nil)
{
[self _resizeView];
}
}
@end