Added new connectors and implemented keyed coding in split view.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@25520 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
gcasa 2007-10-07 03:04:39 +00:00
parent b3ce13417d
commit 6e46b25f8b
7 changed files with 285 additions and 19 deletions

View file

@ -1,3 +1,13 @@
2007-10-06 23:03-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Headers/Additions/GNUstepGUI/GSNibCompatibility.h
* Source/GNUmakefile: Added new classes.
* Source/NSNibAXAttributeConnector.m
* Source/NSNibAXRelationshipConnector.m
* Source/NSNibBindingConnector.m: Implementation of special
connectors for Key-Value binding.
* Source/NSSplitView.m: Added ode for keyed coding
2007-10-02 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSWindow.m (-deminiaturize:, -miniaturize:): Try to

View file

@ -27,6 +27,7 @@
#define _GNUstep_H_GSNibCompatibility
#include <Foundation/NSObject.h>
#include <AppKit/NSWindow.h>
#include <AppKit/NSMenu.h>
#include <AppKit/NSView.h>
@ -34,11 +35,12 @@
#include <AppKit/NSTextView.h>
#include <AppKit/NSControl.h>
#include <AppKit/NSButton.h>
#include <AppKit/NSGraphicsContext.h>
#include <AppKit/NSGraphics.h>
#include <AppKit/NSResponder.h>
#include <AppKit/NSEvent.h>
#include <AppKit/NSNibConnector.h>
#include "GNUstepGUI/GSNibContainer.h"
#include "GNUstepGUI/GSInstantiator.h"
@ -285,4 +287,49 @@ typedef struct _GSWindowTemplateFlags
@interface NSPSMatrix : NSObject
@end
@interface NSNibAXAttributeConnector : NSObject <NSCoding>
{
NSString *_attributeType;
NSString *_attributeValue;
id _destination;
id _source;
NSString *_label;
}
// Attribute name/type.
- (NSString *) attributeType;
- (void) setAttributeType: (NSString *)type;
- (NSString *) attributeValue;
- (void) setAttributeValue: (NSString *)value;
// Source destination, connectors.
- (id) destination;
- (void) setDestination: (id)destination;
- (NSString *) label;
- (void) setLabel: (NSString *)label;
- (id) source;
- (void) setSource: (id)source;
// establish connection...
- (void) establishConnection;
@end
@interface NSNibAXRelationshipConnector : NSNibConnector
@end
@interface NSNibBindingConnector: NSNibConnector
{
NSDictionary *_options;
NSString *_binding;
NSString *_keyPath;
BOOL _hasEstablishedConnection;
}
- (NSString *) binding;
- (NSString *) keyPath;
- (NSDictionary *) options;
- (void) setBinding: (NSString *)bindings;
- (void) setKeyPath: (NSString *)keyPath;
- (void) setOptions: (NSDictionary *)options;
@end
#endif /* _GNUstep_H_GSNibCompatibility */

View file

@ -117,6 +117,9 @@ NSMenuItemCell.m \
NSMovie.m \
NSMovieView.m \
NSNib.m \
NSNibBindingConnector.m \
NSNibAXAttributeConnector.m \
NSNibAXRelationshipConnector.m \
NSObjectController.m \
NSOpenGLContext.m \
NSOpenGLPixelFormat.m \

View file

@ -0,0 +1,104 @@
/** <title>NSNibAXAttributeConnector</title>
<abstract>
</abstract>
Copyright (C) 2007 Free Software Foundation, Inc.
Author: Gregory John Casamento
Date: 2007
This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library;
If not, write to the Free Software Foundation,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#import <GNUstepGUI/GSNibCompatibility.h>
#import <Foundation/NSString.h>
@implementation NSNibAXAttributeConnector
// Attribute name/type.
- (NSString *) attributeType
{
return _attributeType;
}
- (void) setAttributeType: (NSString *)type
{
ASSIGN(_attributeType, type);
}
- (NSString *) attributeValue
{
return _attributeValue;
}
- (void) setAttributeValue: (NSString *)value
{
ASSIGN(_attributeValue, value);
}
// Source destination, connectors.
- (id) destination
{
return _destination;
}
- (void) setDestination: (id)destination
{
ASSIGN(_destination, destination);
}
- (NSString *) label
{
return _label;
}
- (void) setLabel: (NSString *)label
{
ASSIGN(_label, label);
}
- (id) source
{
return _source;
}
- (void) setSource: (id)source
{
ASSIGN(_source, source);
}
// establish connection...
- (void) establishConnection
{
}
// archiving....
- (id) initWithCoder: (NSCoder *)coder
{
return self;
}
- (void) encodeWithCoder: (NSCoder *)coder
{
}
- (void) dealloc
{
[super dealloc];
}
@end

View file

@ -0,0 +1,33 @@
/** <title>NSNibAXAttributeConnector</title>
<abstract>
</abstract>
Copyright (C) 2007 Free Software Foundation, Inc.
Author: Gregory John Casamento
Date: 2007
This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library;
If not, write to the Free Software Foundation,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#import <GNUstepGUI/GSNibCompatibility.h>
#import <Foundation/NSString.h>
@implementation NSNibAXRelationshipConnector
@end

View file

@ -0,0 +1,63 @@
/** <title>NSNibAXAttributeConnector</title>
<abstract>
</abstract>
Copyright (C) 2007 Free Software Foundation, Inc.
Author: Gregory John Casamento
Date: 2007
This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library;
If not, write to the Free Software Foundation,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#import <GNUstepGUI/GSNibCompatibility.h>
#import <Foundation/NSString.h>
#import <Foundation/NSDictionary.h>
@implementation NSNibBindingConnector
- (NSString *) binding
{
return _binding;
}
- (NSString *) keyPath
{
return _keyPath;
}
- (NSDictionary *) options
{
return _options;
}
- (void) setBinding: (NSString *)binding
{
ASSIGN(_binding, binding);
}
- (void) setKeyPath: (NSString *)keyPath
{
ASSIGN(_keyPath, keyPath);
}
- (void) setOptions: (NSDictionary *)options
{
ASSIGN(_options, options);
}
@end

View file

@ -881,24 +881,30 @@ static inline NSPoint centerSizeInRect(NSSize innerSize, NSRect outerRect)
- (void) encodeWithCoder: (NSCoder *)aCoder
{
[super encodeWithCoder: aCoder];
/*
* Encode objects we don't own.
*/
[aCoder encodeConditionalObject: _delegate];
/*
* Encode the objects we do own.
*/
[aCoder encodeObject: _dimpleImage];
[aCoder encodeObject: _backgroundColor];
[aCoder encodeObject: _dividerColor];
/*
* Encode the rest of the ivar data.
*/
[aCoder encodeValueOfObjCType: @encode(int) at: &_draggedBarWidth];
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_isVertical];
if([aCoder allowsKeyedCoding])
{
[aCoder encodeBool: _isVertical forKey: @"NSIsVertical"];
}
else
{
/*
* Encode objects we don't own.
*/
[aCoder encodeConditionalObject: _delegate];
/*
* Encode the objects we do own.
*/
[aCoder encodeObject: _dimpleImage];
[aCoder encodeObject: _backgroundColor];
[aCoder encodeObject: _dividerColor];
/*
* Encode the rest of the ivar data.
*/
[aCoder encodeValueOfObjCType: @encode(int) at: &_draggedBarWidth];
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_isVertical];
}
}
- (id) initWithCoder: (NSCoder *)aDecoder