mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-24 03:51:22 +00:00
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@17643 72102866-910b-0410-8b05-ffd578937521
52 lines
917 B
Objective-C
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
|
|
|