2003-01-05 06:03:14 +00:00
|
|
|
/* GormNSPanel.m
|
|
|
|
|
|
|
|
Copyright (C) 2003 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
Author: Gregory John Casamento <greg_casamento@yahoo.com>
|
|
|
|
Date: 2003
|
2008-05-03 17:40:55 +00:00
|
|
|
(Adapted from GormNSWindow.m)
|
2003-01-05 06:03:14 +00:00
|
|
|
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
|
2003-01-05 06:03:14 +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
|
|
|
|
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.
|
2003-01-05 06:03:14 +00:00
|
|
|
*/
|
|
|
|
|
2003-03-03 09:15:48 +00:00
|
|
|
#include <AppKit/AppKit.h>
|
2019-11-03 01:57:39 +00:00
|
|
|
|
2005-07-19 03:50:29 +00:00
|
|
|
#include <InterfaceBuilder/InterfaceBuilder.h>
|
2019-11-03 01:57:39 +00:00
|
|
|
|
2008-12-02 07:54:31 +00:00
|
|
|
#include <GNUstepGUI/GSGormLoading.h>
|
2019-11-03 01:57:39 +00:00
|
|
|
|
2003-03-03 09:15:48 +00:00
|
|
|
#include "GormNSPanel.h"
|
2003-01-05 06:03:14 +00:00
|
|
|
|
2008-12-02 07:54:31 +00:00
|
|
|
|
2008-05-03 17:40:55 +00:00
|
|
|
// the default style mask we start with.
|
2013-11-04 15:02:25 +00:00
|
|
|
static NSUInteger defaultStyleMask = NSTitledWindowMask | NSClosableWindowMask
|
2004-08-23 19:03:20 +00:00
|
|
|
| NSResizableWindowMask | NSMiniaturizableWindowMask;
|
2003-01-05 06:03:14 +00:00
|
|
|
|
|
|
|
@implementation GormNSPanel
|
|
|
|
- (void)encodeWithCoder: (NSCoder*) aCoder
|
|
|
|
{
|
|
|
|
unsigned oldStyleMask;
|
2004-07-21 01:49:07 +00:00
|
|
|
|
|
|
|
// save the old values...
|
2003-01-05 06:03:14 +00:00
|
|
|
oldStyleMask = _styleMask;
|
2004-07-21 01:49:07 +00:00
|
|
|
|
|
|
|
// set the values we wish to save.. after save restore.
|
2003-01-05 06:03:14 +00:00
|
|
|
_styleMask = _gormStyleMask;
|
2004-07-21 01:49:07 +00:00
|
|
|
[self setReleasedWhenClosed: _gormReleasedWhenClosed];
|
2003-01-05 06:03:14 +00:00
|
|
|
[super encodeWithCoder: aCoder];
|
|
|
|
_styleMask = oldStyleMask;
|
2004-07-21 01:49:07 +00:00
|
|
|
[self setReleasedWhenClosed: NO];
|
2003-01-05 06:03:14 +00:00
|
|
|
}
|
|
|
|
|
2008-05-03 17:40:55 +00:00
|
|
|
- (id) initWithCoder: (NSCoder *)coder
|
|
|
|
{
|
|
|
|
self = [super initWithCoder: coder];
|
|
|
|
if (self == nil)
|
|
|
|
{
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
// preserve the setting and set the actual window to NO.
|
|
|
|
_gormReleasedWhenClosed = [self isReleasedWhenClosed];
|
|
|
|
[self setReleasedWhenClosed: NO];
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2003-01-05 06:03:14 +00:00
|
|
|
- (id) initWithContentRect: (NSRect)contentRect
|
2013-01-30 12:43:27 +00:00
|
|
|
styleMask: (NSUInteger)aStyle
|
2003-01-05 06:03:14 +00:00
|
|
|
backing: (NSBackingStoreType)bufferingType
|
|
|
|
defer: (BOOL)flag
|
|
|
|
{
|
|
|
|
_gormStyleMask = aStyle;
|
2004-08-23 19:03:20 +00:00
|
|
|
self = [super initWithContentRect: contentRect
|
2010-05-19 01:44:50 +00:00
|
|
|
styleMask: defaultStyleMask
|
|
|
|
backing: bufferingType
|
|
|
|
defer: flag];
|
2004-08-23 19:03:20 +00:00
|
|
|
if(self != nil)
|
|
|
|
{
|
|
|
|
// Don't release when the window is closed, a window being edited may
|
|
|
|
// be periodically opened and closed.
|
|
|
|
[self setReleasedWhenClosed: NO];
|
2004-12-28 17:07:59 +00:00
|
|
|
|
|
|
|
// remove the default icon...
|
|
|
|
[self setMiniwindowImage: nil];
|
2005-06-04 11:46:43 +00:00
|
|
|
|
|
|
|
// set the default position mask;
|
|
|
|
autoPositionMask = GSWindowMaxXMargin | GSWindowMaxYMargin;
|
2004-08-23 19:03:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return self;
|
2003-01-05 06:03:14 +00:00
|
|
|
}
|
|
|
|
|
2004-08-23 19:03:20 +00:00
|
|
|
- (void) _setStyleMask: (unsigned int) newStyleMask
|
2003-01-05 06:03:14 +00:00
|
|
|
{
|
|
|
|
_gormStyleMask = newStyleMask;
|
|
|
|
}
|
|
|
|
|
2004-08-23 19:03:20 +00:00
|
|
|
- (unsigned int) _styleMask
|
2003-01-05 06:03:14 +00:00
|
|
|
{
|
|
|
|
return _gormStyleMask;
|
|
|
|
}
|
2004-03-04 04:01:09 +00:00
|
|
|
|
|
|
|
- (NSString *) className
|
|
|
|
{
|
|
|
|
return @"NSPanel";
|
|
|
|
}
|
2004-07-21 01:49:07 +00:00
|
|
|
|
|
|
|
- (void) _setReleasedWhenClosed: (BOOL) flag
|
|
|
|
{
|
|
|
|
_gormReleasedWhenClosed = flag;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) _isReleasedWhenClosed
|
|
|
|
{
|
|
|
|
return _gormReleasedWhenClosed;
|
|
|
|
}
|
2005-06-04 11:46:43 +00:00
|
|
|
|
|
|
|
- (unsigned int) autoPositionMask
|
|
|
|
{
|
|
|
|
return autoPositionMask;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setAutoPositionMask: (unsigned int)mask
|
|
|
|
{
|
|
|
|
autoPositionMask = mask;
|
|
|
|
}
|
2005-07-19 03:50:29 +00:00
|
|
|
|
2013-01-30 12:43:27 +00:00
|
|
|
- (void) orderWindow: (NSWindowOrderingMode)place relativeTo: (NSInteger)otherWin
|
2005-07-19 04:31:00 +00:00
|
|
|
{
|
2023-06-17 16:14:48 +00:00
|
|
|
id<IBDocuments> document = [(id<IB>)[NSApp delegate] documentForObject: self];
|
2005-07-24 15:15:52 +00:00
|
|
|
[super orderWindow: place relativeTo: otherWin];
|
2023-06-17 16:14:48 +00:00
|
|
|
if([[NSApp delegate] isConnecting] == NO)
|
2005-07-24 15:15:52 +00:00
|
|
|
{
|
|
|
|
id editor = [document editorForObject: self create: NO];
|
|
|
|
|
|
|
|
// select myself.
|
|
|
|
if([editor respondsToSelector: @selector(selectObjects:)])
|
2005-07-19 04:31:00 +00:00
|
|
|
{
|
2005-07-24 15:15:52 +00:00
|
|
|
[editor selectObjects: [NSArray arrayWithObject: self]];
|
2005-07-19 04:31:00 +00:00
|
|
|
}
|
|
|
|
|
2005-07-24 15:15:52 +00:00
|
|
|
[document setSelectionFromEditor: editor];
|
|
|
|
[editor makeSelectionVisible: YES];
|
|
|
|
}
|
2005-07-19 04:31:00 +00:00
|
|
|
}
|
2005-07-24 16:26:46 +00:00
|
|
|
|
|
|
|
- (void) saveFrameUsingName: (NSString*)name
|
|
|
|
{
|
|
|
|
// do nothing...
|
|
|
|
}
|
2003-01-05 06:03:14 +00:00
|
|
|
@end
|