diff --git a/Headers/Additions/GNUstepGUI/GSTheme.h b/Headers/Additions/GNUstepGUI/GSTheme.h
index 5c0459584..7bdc3d79a 100644
--- a/Headers/Additions/GNUstepGUI/GSTheme.h
+++ b/Headers/Additions/GNUstepGUI/GSTheme.h
@@ -204,7 +204,11 @@
A theme subclass may override the -imageClass method to change the
class used to load each image from the bundle ... thus allowing
customisation of not just the images but also of the image
- behavior in the (very rare) cases where this is desirable.
+ behavior in the (very rare) cases where this is desirable.
+ Finally, a theme may provide application specific images which are
+ loaded in preference to named images from the application's
+ own bundle. These images are simply stored in a subdirectory whose
+ name is the same as the application's bundleIdentifier.
@@ -235,8 +239,8 @@
#if OS_API_VERSION(GS_API_NONE,GS_API_NONE)
@class NSArray;
@class NSBundle;
+@class NSBrowserCell;
@class NSDictionary;
-
@class NSButton;
@class NSColor;
@class NSColorList;
@@ -1163,6 +1167,14 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
- (float) resizebarHeight;
+- (float) titlebarButtonSize;
+
+- (float) titlebarPaddingRight;
+
+- (float) titlebarPaddingTop;
+
+- (float) titlebarPaddingLeft;
+
- (void) drawWindowBorder: (NSRect)rect
withFrame: (NSRect)frame
forStyleMask: (unsigned int)styleMask
@@ -1457,5 +1469,60 @@ withRepeatedImage: (NSImage*)image
- (Class) pageLayoutClass;
@end
+@interface GSTheme (NSWindow)
+/**
+ * This method returns the standard window button for the
+ * given mask for the current theme.
+ */
+- (NSButton *) standardWindowButton: (NSWindowButton)button
+ forStyleMask: (NSUInteger) mask;
+
+/**
+ * This method does any additional setup after the default
+ * cell is set.
+ */
+- (void) didSetDefaultButtonCell: (NSButtonCell *)aCell;
+@end
+
+@interface GSTheme (NSBrowserCell)
+/**
+ * Draw editor in cell
+ */
+- (void) drawEditorForCell: (NSCell *)cell
+ withFrame: (NSRect)cellFrame
+ inView: (NSView *)view;
+
+/**
+ * Draw attributed text in cell
+ */
+- (void) drawInCell: (NSCell *)cell
+ attributedText: (NSAttributedString *)stringValue
+ inFrame: (NSRect)cellFrame;
+
+/**
+ * Draw the interior of the browser cell
+ */
+- (void) drawBrowserInteriorWithFrame: (NSRect)cellFrame
+ withCell: (NSBrowserCell *)cell
+ inView: (NSView *)controlView
+ withImage: (NSImage *)theImage
+ alternateImage: (NSImage *)alternateImage
+ isHighlighted: (BOOL)isHighlighted
+ state: (int)state
+ isLeaf: (BOOL)isLeaf;
+
+/**
+ * This method returns the branch image
+ */
+- (NSImage *) branchImage;
+
+/**
+ * This method returns the highlighted version of
+ * the branch image
+ */
+- (NSImage *) highlightedBranchImage;
+@end
+
+
#endif /* OS_API_VERSION */
#endif /* _GNUstep_H_GSTheme */
diff --git a/Headers/Additions/GNUstepGUI/GSXibLoading.h b/Headers/Additions/GNUstepGUI/GSXibLoading.h
index c0cf97661..47864c585 100644
--- a/Headers/Additions/GNUstepGUI/GSXibLoading.h
+++ b/Headers/Additions/GNUstepGUI/GSXibLoading.h
@@ -168,8 +168,8 @@
- (void) setName: (NSString *)name;
- (NSString *) name;
-- (void) setRuntimeAttributes: (NSString *)attributes;
-- (NSString *) runtimeAttributes;
+- (void) setRuntimeAttributes: (NSArray *)attributes;
+- (NSArray *) runtimeAttributes;
@end
diff --git a/Headers/AppKit/NSAnimationContext.h b/Headers/AppKit/NSAnimationContext.h
new file mode 100644
index 000000000..c5924b6d3
--- /dev/null
+++ b/Headers/AppKit/NSAnimationContext.h
@@ -0,0 +1,66 @@
+/*
+ NSAnimationContext.h
+
+ Created by Gregory John Casamento on Wed Jun 10 2015.
+ Copyright (c) 2015 Free Software Foundation, Inc.
+
+ Author: Gregory Casamento
+
+ 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 Lesser 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; see the file COPYING.LIB.
+ If not, see or write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef _GNUstep_H_NSAnimationContext_
+#define _GNUstep_H_NSAnimationContext_
+
+#import
+#import
+
+@class NSAnimationContext;
+
+DEFINE_BLOCK_TYPE_NO_ARGS(GSAnimationContextCompletionHandler, void);
+DEFINE_BLOCK_TYPE(GSAnimationContextChanges, void, NSAnimationContext*);
+
+@interface NSAnimationContext : NSObject
+{
+ NSTimeInterval _duration;
+ GSAnimationContextCompletionHandler _completionHandler;
+}
+
+// Begin and end grouping
++ (void) beginGrouping;
++ (void) endGrouping;
+
+// Retrieve current context
++ (NSAnimationContext *)currentContext;
+
+// run
++ (void)runAnimationGroup: (GSAnimationContextChanges)changes
+ completionHandler: (GSAnimationContextCompletionHandler)completionHandler;
+
+// Properties...
+- (void) setDuration: (NSTimeInterval)duration;
+- (NSTimeInterval) duration;
+
+- (GSAnimationContextCompletionHandler) completionHandler;
+- (void) setCompletionHandler: (GSAnimationContextCompletionHandler) completionHandler;
+
+@end
+
+#endif
diff --git a/Headers/AppKit/NSView.h b/Headers/AppKit/NSView.h
index b9dc998d7..cad2910ed 100644
--- a/Headers/AppKit/NSView.h
+++ b/Headers/AppKit/NSView.h
@@ -2,7 +2,7 @@
Encapsulates all drawing functionality
- Copyright (C) 1996 Free Software Foundation, Inc.
+ Copyright (C) 1996-2015 Free Software Foundation, Inc.
Author: Scott Christley
Date: 1996
@@ -119,6 +119,7 @@ PACKAGE_SCOPE
NSInteger _gstate;
void *_nextKeyView;
void *_previousKeyView;
+ CGFloat _alphaValue;
@public
/*
@@ -228,6 +229,17 @@ PACKAGE_SCOPE
- (BOOL) isRotatedFromBase;
- (BOOL) isRotatedOrScaledFromBase;
+/*
+ * View Layers
+ */
+
+#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
+- (CGFloat) alphaValue;
+- (void) setAlphaValue: (CGFloat)alpha;
+- (CGFloat) frameCenterRotation;
+- (void) setFrameCenterRotation:(CGFloat)rot;
+#endif
+
/*
* Converting Coordinates
*/
diff --git a/Source/GNUmakefile b/Source/GNUmakefile
index 6c96de073..500d99c69 100644
--- a/Source/GNUmakefile
+++ b/Source/GNUmakefile
@@ -48,6 +48,7 @@ NSActionCell.m \
NSAffineTransform.m \
NSAlert.m \
NSAnimation.m \
+NSAnimationContext.m \
NSApplication.m \
NSArrayController.m \
NSAttributedString.m \
@@ -120,6 +121,7 @@ NSMenuItemCell.m \
NSMovie.m \
NSMovieView.m \
NSNib.m \
+NSNibConnector.m \
NSNibBindingConnector.m \
NSNibAXAttributeConnector.m \
NSNibAXRelationshipConnector.m \
@@ -234,6 +236,7 @@ GSThemeOpenSavePanels.m \
GSThemePanel.m \
GSThemePrintPanels.m \
GSThemeTools.m \
+GSThemeWindow.m \
GSTitleView.m \
GSToolTips.m \
GSToolbarView.m \
@@ -278,6 +281,7 @@ NSActionCell.h \
NSAffineTransform.h \
NSAlert.h \
NSAnimation.h \
+NSAnimationContext.h \
NSApplication.h \
NSArrayController.h \
NSBezierPath.h \
diff --git a/Source/GSFontInfo.m b/Source/GSFontInfo.m
index 036e698d3..6f336b000 100644
--- a/Source/GSFontInfo.m
+++ b/Source/GSFontInfo.m
@@ -229,6 +229,14 @@ static GSFontEnumerator *sharedEnumerator = nil;
break;
}
}
+ else if ([key isEqual: NSFontCharacterSetAttribute])
+ {
+ if (![valueB isSupersetOfSet: valueA])
+ {
+ match = NO;
+ break;
+ }
+ }
else
{
if (![valueA isEqual: valueB])
diff --git a/Source/GSStandardWindowDecorationView.m b/Source/GSStandardWindowDecorationView.m
index 709c91a0f..e5c2333cb 100644
--- a/Source/GSStandardWindowDecorationView.m
+++ b/Source/GSStandardWindowDecorationView.m
@@ -108,15 +108,18 @@
}
if (hasCloseButton)
{
- closeButtonRect = NSMakeRect(
- [self bounds].size.width - 15 - 4, [self bounds].size.height - 15 - 4, 15, 15);
+ closeButtonRect = NSMakeRect([self bounds].size.width - [theme titlebarButtonSize] -
+ [theme titlebarPaddingRight], [self bounds].size.height -
+ [theme titlebarButtonSize] - [theme titlebarPaddingTop],
+ [theme titlebarButtonSize], [theme titlebarButtonSize]);
[closeButton setFrame: closeButtonRect];
}
if (hasMiniaturizeButton)
{
- miniaturizeButtonRect = NSMakeRect(
- 4, [self bounds].size.height - 15 - 4, 15, 15);
+ miniaturizeButtonRect = NSMakeRect([theme titlebarPaddingLeft], [self bounds].size.height -
+ [theme titlebarButtonSize] - [theme titlebarPaddingTop],
+ [theme titlebarButtonSize], [theme titlebarButtonSize]);
[miniaturizeButton setFrame: miniaturizeButtonRect];
}
}
diff --git a/Source/GSThemeDrawing.m b/Source/GSThemeDrawing.m
index 31ce69b33..80f8c7128 100644
--- a/Source/GSThemeDrawing.m
+++ b/Source/GSThemeDrawing.m
@@ -35,6 +35,7 @@
#import "AppKit/NSBezierPath.h"
#import "AppKit/NSButtonCell.h"
#import "AppKit/NSBrowser.h"
+#import "AppKit/NSBrowserCell.h"
#import "AppKit/NSCell.h"
#import "AppKit/NSColor.h"
#import "AppKit/NSColorList.h"
@@ -3514,4 +3515,131 @@ typedef enum {
}
}
+- (void) drawEditorForCell: (NSCell *)cell
+ withFrame: (NSRect)cellFrame
+ inView: (NSView *)view
+{
+ [cell _drawEditorWithFrame: cellFrame
+ inView: view];
+}
+
+
+- (void) drawInCell: (NSCell *)cell
+ attributedText: (NSAttributedString *)stringValue
+ inFrame: (NSRect)cellFrame
+{
+ [cell _drawAttributedText: stringValue
+ inFrame: cellFrame];
+}
+
+// NSBrowserCell
+- (void) drawBrowserInteriorWithFrame: (NSRect)cellFrame
+ withCell: (NSBrowserCell *)cell
+ inView: (NSView *)controlView
+ withImage: (NSImage *)theImage
+ alternateImage: (NSImage *)alternateImage
+ isHighlighted: (BOOL)isHighlighted
+ state: (int)state
+ isLeaf: (BOOL)isLeaf
+{
+ NSRect title_rect = cellFrame;
+ NSImage *branch_image = nil;
+ NSImage *cell_image = theImage;
+
+ if (isHighlighted || state)
+ {
+ if (!isLeaf)
+ branch_image = [self highlightedBranchImage];
+ if (nil != alternateImage)
+ [cell setImage: alternateImage];
+
+ // If we are highlighted, fill the background
+ [[cell highlightColorInView: controlView] setFill];
+ NSRectFill(cellFrame);
+ }
+ else
+ {
+ if (!isLeaf)
+ branch_image = [self branchImage];
+
+ // (Don't fill the background)
+ }
+
+ // Draw the branch image if there is one
+ if (branch_image)
+ {
+ NSRect imgRect;
+
+ imgRect.size = [branch_image size];
+ imgRect.origin.x = MAX(NSMaxX(title_rect) - imgRect.size.width - 4.0, 0.);
+ imgRect.origin.y = MAX(NSMidY(title_rect) - (imgRect.size.height/2.), 0.);
+
+ if (controlView != nil)
+ {
+ imgRect = [controlView centerScanRect: imgRect];
+ }
+
+ [branch_image drawInRect: imgRect
+ fromRect: NSZeroRect
+ operation: NSCompositeSourceOver
+ fraction: 1.0
+ respectFlipped: YES
+ hints: nil];
+
+ title_rect.size.width -= imgRect.size.width + 8;
+ }
+
+ // Skip 2 points from the left border
+ title_rect.origin.x += 2;
+ title_rect.size.width -= 2;
+
+ // Draw the cell image if there is one
+ if (cell_image)
+ {
+ NSRect imgRect;
+
+ imgRect.size = [cell_image size];
+ imgRect.origin.x = NSMinX(title_rect);
+ imgRect.origin.y = MAX(NSMidY(title_rect) - (imgRect.size.height/2.),0.);
+
+ if (controlView != nil)
+ {
+ imgRect = [controlView centerScanRect: imgRect];
+ }
+
+ [cell_image drawInRect: imgRect
+ fromRect: NSZeroRect
+ operation: NSCompositeSourceOver
+ fraction: 1.0
+ respectFlipped: YES
+ hints: nil];
+
+ title_rect.origin.x += imgRect.size.width + 4;
+ title_rect.size.width -= imgRect.size.width + 4;
+ }
+
+ // Draw the body of the cell
+ if ([cell _inEditing])
+ {
+ [self drawEditorForCell: cell
+ withFrame: cellFrame
+ inView: controlView];
+ }
+ else
+ {
+ [self drawInCell: cell
+ attributedText: [cell attributedStringValue]
+ inFrame: title_rect];
+ }
+}
+
+- (NSImage *) branchImage
+{
+ return [NSImage imageNamed: @"common_3DArrowRight"];
+}
+
+- (NSImage *) highlightedBranchImage
+{
+ return [NSImage imageNamed: @"common_3DArrowRightH"];
+}
@end
diff --git a/Source/GSThemeWindow.m b/Source/GSThemeWindow.m
new file mode 100644
index 000000000..554c2de91
--- /dev/null
+++ b/Source/GSThemeWindow.m
@@ -0,0 +1,89 @@
+/** GSThemeWindow
+
+ The theme methods for window specific functions
+
+ Copyright (C) 2015 Free Software Foundation, Inc.
+
+ Author: Gregory Casamento
+ Date: Jun 2015
+
+ This file is part of the GNU Objective C User interface library.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; see the file COPYING.LIB.
+ If not, see or write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#import "AppKit/NSWindow.h"
+#import "AppKit/NSImage.h"
+#import "AppKit/NSButton.h"
+
+#import "GNUstepGUI/GSTheme.h"
+#import "GNUstepGUI/GSWindowDecorationView.h"
+#import "GSThemePrivate.h"
+
+@implementation GSTheme (NSWindow)
+- (NSButton *) standardWindowButton: (NSWindowButton)button
+ forStyleMask: (NSUInteger) mask
+{
+ NSButton *newButton;
+
+ newButton = [[NSButton alloc] init];
+ [newButton setRefusesFirstResponder: YES];
+ [newButton setButtonType: NSMomentaryChangeButton];
+ [newButton setImagePosition: NSImageOnly];
+ [newButton setBordered: YES];
+ [newButton setTag: button];
+
+ switch (button)
+ {
+ case NSWindowCloseButton:
+ [newButton setImage: [NSImage imageNamed: @"common_Close"]];
+ [newButton setAlternateImage: [NSImage imageNamed: @"common_CloseH"]];
+ /* TODO: -performClose: should (but doesn't currently) highlight the
+ button, which is wrong here. When -performClose: is fixed, we'll need a
+ different method here. */
+ [newButton setAction: @selector(performClose:)];
+ break;
+
+ case NSWindowMiniaturizeButton:
+ [newButton setImage: [NSImage imageNamed: @"common_Miniaturize"]];
+ [newButton setAlternateImage: [NSImage imageNamed: @"common_MiniaturizeH"]];
+ [newButton setAction: @selector(miniaturize:)];
+ break;
+
+ case NSWindowZoomButton:
+ // FIXME
+ [newButton setAction: @selector(zoom:)];
+ break;
+
+ case NSWindowToolbarButton:
+ // FIXME
+ [newButton setAction: @selector(toggleToolbarShown:)];
+ break;
+ case NSWindowDocumentIconButton:
+ default:
+ // FIXME
+ break;
+ }
+
+ return AUTORELEASE(newButton);
+}
+
+- (void) didSetDefaultButtonCell: (NSButtonCell *)aCell
+{
+ // default implementation does nothing...
+}
+@end
diff --git a/Source/NSAnimationContext.m b/Source/NSAnimationContext.m
new file mode 100644
index 000000000..8770d71eb
--- /dev/null
+++ b/Source/NSAnimationContext.m
@@ -0,0 +1,86 @@
+/*
+ NSAnimationContext.h
+
+ Created by Gregory John Casamento on Wed Jun 10 2015.
+ Copyright (c) 2015 Free Software Foundation, Inc.
+
+ Author: Gregory Casamento
+
+ 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 Lesser 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; see the file COPYING.LIB.
+ If not, see or write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+
+#import
+
+static NSAnimationContext *_currentContext = nil;
+
+@implementation NSAnimationContext : NSObject
+
+// Begin and end grouping
++ (void) beginGrouping
+{
+}
+
++ (void) endGrouping
+{
+}
+
+// Retrieve current context
++ (NSAnimationContext *)currentContext
+{
+ return _currentContext;
+}
+
+// run
++ (void)runAnimationGroup: (GSAnimationContextChanges)changes
+ completionHandler: (GSAnimationContextCompletionHandler)completionHandler
+{
+}
+
+// Properties...
+- (void) setDuration: (NSTimeInterval)duration
+{
+ _duration = duration;
+}
+
+- (NSTimeInterval) duration
+{
+ return _duration;
+}
+
+- (GSAnimationContextCompletionHandler) completionHandler
+{
+ return _completionHandler;
+}
+
+- (void) setCompletionHandler: (GSAnimationContextCompletionHandler) completionHandler
+{
+ _completionHandler = completionHandler;
+}
+
+- (void *) timingFunction
+{
+ return NULL;
+}
+
+- (void) setTimingFunction: (void *)timingFunction
+{
+}
+
+@end
+
diff --git a/Source/NSBundleAdditions.m b/Source/NSBundleAdditions.m
index 3647956b6..d3fd49a1b 100644
--- a/Source/NSBundleAdditions.m
+++ b/Source/NSBundleAdditions.m
@@ -48,185 +48,6 @@
#import "AppKit/NSNibLoading.h"
#import "GNUstepGUI/GSModelLoaderFactory.h"
-@implementation NSNibConnector
-
-- (void) dealloc
-{
- RELEASE(_src);
- RELEASE(_dst);
- RELEASE(_tag);
- [super dealloc];
-}
-
-- (id) destination
-{
- return _dst;
-}
-
-- (void) encodeWithCoder: (NSCoder*)aCoder
-{
- if ([aCoder allowsKeyedCoding])
- {
- if (_src != nil)
- {
- [aCoder encodeObject: _src forKey: @"NSSource"];
- }
- if (_dst != nil)
- {
- [aCoder encodeObject: _dst forKey: @"NSDestination"];
- }
- if (_tag != nil)
- {
- [aCoder encodeObject: _tag forKey: @"NSLabel"];
- }
- }
- else
- {
- [aCoder encodeObject: _src];
- [aCoder encodeObject: _dst];
- [aCoder encodeObject: _tag];
- }
-}
-
-- (void) establishConnection
-{
-}
-
-- (id) initWithCoder: (NSCoder*)aDecoder
-{
- if ([aDecoder allowsKeyedCoding])
- {
- if ([aDecoder containsValueForKey: @"NSDestination"])
- {
- ASSIGN(_dst, [aDecoder decodeObjectForKey: @"NSDestination"]);
- }
- if ([aDecoder containsValueForKey: @"NSSource"])
- {
- ASSIGN(_src, [aDecoder decodeObjectForKey: @"NSSource"]);
- }
- if ([aDecoder containsValueForKey: @"NSLabel"])
- {
- ASSIGN(_tag, [aDecoder decodeObjectForKey: @"NSLabel"]);
- }
- }
- else
- {
- [aDecoder decodeValueOfObjCType: @encode(id) at: &_src];
- [aDecoder decodeValueOfObjCType: @encode(id) at: &_dst];
- [aDecoder decodeValueOfObjCType: @encode(id) at: &_tag];
- }
- return self;
-}
-
-- (NSString*) label
-{
- return _tag;
-}
-
-- (void) replaceObject: (id)anObject withObject: (id)anotherObject
-{
- if (_src == anObject)
- {
- ASSIGN(_src, anotherObject);
- }
- if (_dst == anObject)
- {
- ASSIGN(_dst, anotherObject);
- }
- if (_tag == anObject)
- {
- ASSIGN(_tag, anotherObject);
- }
-}
-
-- (id) source
-{
- return _src;
-}
-
-- (void) setDestination: (id)anObject
-{
- ASSIGN(_dst, anObject);
-}
-
-- (void) setLabel: (NSString*)label
-{
- ASSIGN(_tag, label);
-}
-
-- (void) setSource: (id)anObject
-{
- ASSIGN(_src, anObject);
-}
-
-- (NSString *)description
-{
- NSString *desc = [NSString stringWithFormat: @"<%@ src=%@ dst=%@ label=%@>",
- [super description],
- [self source],
- [self destination],
- [self label]];
- return desc;
-}
-@end
-
-@implementation NSNibControlConnector
-- (void) establishConnection
-{
- SEL sel = NSSelectorFromString(_tag);
-
- [_src setTarget: _dst];
- [_src setAction: sel];
-}
-@end
-
-@implementation NSNibOutletConnector
-- (void) establishConnection
-{
- NS_DURING
- {
- if (_src != nil)
- {
- NSString *selName;
- SEL sel;
-
- selName = [NSString stringWithFormat: @"set%@%@:",
- [[_tag substringToIndex: 1] uppercaseString],
- [_tag substringFromIndex: 1]];
- sel = NSSelectorFromString(selName);
-
- if (sel && [_src respondsToSelector: sel])
- {
- [_src performSelector: sel withObject: _dst];
- }
- else
- {
- const char *nam = [_tag cString];
- const char *type;
- unsigned int size;
- int offset;
-
- /*
- * Use the GNUstep additional function to set the instance
- * variable directly.
- * FIXME - need some way to do this for libFoundation and
- * Foundation based systems.
- */
- if (GSObjCFindVariable(_src, nam, &type, &size, &offset))
- {
- GSObjCSetVariable(_src, offset, size, (void*)&_dst);
- }
- }
- }
- }
- NS_HANDLER
- {
- NSLog(@"Error while establishing connection %@: %@",self,[localException reason]);
- }
- NS_ENDHANDLER;
-}
-@end
-
@implementation NSBundle (NSBundleAdditions)
+ (BOOL) loadNibFile: (NSString*)fileName
externalNameTable: (NSDictionary*)context
diff --git a/Source/NSNibConnector.m b/Source/NSNibConnector.m
new file mode 100644
index 000000000..49555ee54
--- /dev/null
+++ b/Source/NSNibConnector.m
@@ -0,0 +1,237 @@
+/*
+ NSNibConnector
+
+ Implementation of NSNibConnector and subclasses
+
+ Copyright (C) 1999, 2015 Free Software Foundation, Inc.
+
+ Author: Richard Frith-Macdonald
+ Date: 1999
+ Author: Fred Kiefer
+ Date: August 2015
+
+ 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 Lesser 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; see the file COPYING.LIB.
+ If not, see or write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#import "config.h"
+#import
+#import
+#import
+#import "AppKit/NSControl.h"
+#import "AppKit/NSNibConnector.h"
+
+@implementation NSNibConnector
+
+- (void) dealloc
+{
+ RELEASE(_src);
+ RELEASE(_dst);
+ RELEASE(_tag);
+ [super dealloc];
+}
+
+- (id) destination
+{
+ return _dst;
+}
+
+- (void) encodeWithCoder: (NSCoder*)aCoder
+{
+ if ([aCoder allowsKeyedCoding])
+ {
+ if (_src != nil)
+ {
+ [aCoder encodeObject: _src forKey: @"NSSource"];
+ }
+ if (_dst != nil)
+ {
+ [aCoder encodeObject: _dst forKey: @"NSDestination"];
+ }
+ if (_tag != nil)
+ {
+ [aCoder encodeObject: _tag forKey: @"NSLabel"];
+ }
+ }
+ else
+ {
+ [aCoder encodeObject: _src];
+ [aCoder encodeObject: _dst];
+ [aCoder encodeObject: _tag];
+ }
+}
+
+- (void) establishConnection
+{
+}
+
+- (id) initWithCoder: (NSCoder*)aDecoder
+{
+ if ([aDecoder allowsKeyedCoding])
+ {
+ if ([aDecoder containsValueForKey: @"NSDestination"])
+ {
+ ASSIGN(_dst, [aDecoder decodeObjectForKey: @"NSDestination"]);
+ }
+ if ([aDecoder containsValueForKey: @"NSSource"])
+ {
+ ASSIGN(_src, [aDecoder decodeObjectForKey: @"NSSource"]);
+ }
+ if ([aDecoder containsValueForKey: @"NSLabel"])
+ {
+ ASSIGN(_tag, [aDecoder decodeObjectForKey: @"NSLabel"]);
+ }
+ }
+ else
+ {
+ [aDecoder decodeValueOfObjCType: @encode(id) at: &_src];
+ [aDecoder decodeValueOfObjCType: @encode(id) at: &_dst];
+ [aDecoder decodeValueOfObjCType: @encode(id) at: &_tag];
+ }
+ return self;
+}
+
+- (BOOL) isEqual: (id)object
+{
+ BOOL result = NO;
+
+ if([object isKindOfClass: [NSNibConnector class]] == NO)
+ {
+ return NO;
+ }
+
+ if(self == object)
+ {
+ result = YES;
+ }
+ else if([[self source] isEqual: [object source]] &&
+ [[self destination] isEqual: [object destination]] &&
+ [[self label] isEqual: [object label]] &&
+ ([self class] == [object class]))
+ {
+ result = YES;
+ }
+ return result;
+}
+
+- (NSString*) label
+{
+ return _tag;
+}
+
+- (void) replaceObject: (id)anObject withObject: (id)anotherObject
+{
+ if (_src == anObject)
+ {
+ ASSIGN(_src, anotherObject);
+ }
+ if (_dst == anObject)
+ {
+ ASSIGN(_dst, anotherObject);
+ }
+ if (_tag == anObject)
+ {
+ ASSIGN(_tag, anotherObject);
+ }
+}
+
+- (id) source
+{
+ return _src;
+}
+
+- (void) setDestination: (id)anObject
+{
+ ASSIGN(_dst, anObject);
+}
+
+- (void) setLabel: (NSString*)label
+{
+ ASSIGN(_tag, label);
+}
+
+- (void) setSource: (id)anObject
+{
+ ASSIGN(_src, anObject);
+}
+
+- (NSString *)description
+{
+ NSString *desc = [NSString stringWithFormat: @"<%@ src=%@ dst=%@ label=%@>",
+ [super description],
+ [self source],
+ [self destination],
+ [self label]];
+ return desc;
+}
+@end
+
+@implementation NSNibControlConnector
+- (void) establishConnection
+{
+ SEL sel = NSSelectorFromString(_tag);
+
+ [_src setTarget: _dst];
+ [_src setAction: sel];
+}
+@end
+
+@implementation NSNibOutletConnector
+- (void) establishConnection
+{
+ NS_DURING
+ {
+ if (_src != nil)
+ {
+ NSString *selName;
+ SEL sel;
+
+ selName = [NSString stringWithFormat: @"set%@%@:",
+ [[_tag substringToIndex: 1] uppercaseString],
+ [_tag substringFromIndex: 1]];
+ sel = NSSelectorFromString(selName);
+
+ if (sel && [_src respondsToSelector: sel])
+ {
+ [_src performSelector: sel withObject: _dst];
+ }
+ else
+ {
+ /*
+ * We cannot use the KVC mechanism here, as this would always retain _dst
+ * and it could also affect _setXXX methods and _XXX ivars that aren't
+ * affected by the Cocoa code.
+ */
+ const char *name = [_tag cString];
+ Class class = object_getClass(_src);
+ Ivar ivar = class_getInstanceVariable(class, name);
+
+ if (ivar != 0)
+ {
+ object_setIvar(_src, ivar, _dst);
+ }
+ }
+ }
+ }
+ NS_HANDLER
+ {
+ NSLog(@"Error while establishing connection %@: %@", self, [localException reason]);
+ }
+ NS_ENDHANDLER;
+}
+@end
diff --git a/Source/NSView.m b/Source/NSView.m
index 33bd6f566..2c2e3212f 100644
--- a/Source/NSView.m
+++ b/Source/NSView.m
@@ -630,6 +630,8 @@ GSSetDragTypes(NSView* obj, NSArray *types)
//_nextKeyView = 0;
//_previousKeyView = 0;
+ _alphaValue = 1.0;
+
return self;
}
@@ -1639,6 +1641,30 @@ static NSSize _computeScale(NSSize fs, NSSize bs)
}
}
+
+- (CGFloat) alphaValue
+{
+ return _alphaValue;
+}
+
+- (void)setAlphaValue: (CGFloat)alpha
+{
+ _alphaValue = alpha;
+}
+
+- (CGFloat) frameCenterRotation
+{
+ // FIXME this is dummy, we don't have layers yet
+ return 0.0;
+}
+
+- (void) setFrameCenterRotation:(CGFloat)rot;
+{
+ // FIXME this is dummy, we don't have layers yet
+ // we probably need a Matrix akin frame rotation.
+}
+
+
- (NSRect) centerScanRect: (NSRect)aRect
{
NSAffineTransform *matrix;
@@ -2810,7 +2836,6 @@ in the main thread.
const NSRect inBase = [self convertRectToBase: _invalidRect];
const NSRect inBaseRounded = NSIntegralRect(inBase);
_invalidRect = [self convertRectFromBase: inBaseRounded];
-
}
else
{
diff --git a/Source/NSWindow.m b/Source/NSWindow.m
index b0bc15c7c..d9955af55 100644
--- a/Source/NSWindow.m
+++ b/Source/NSWindow.m
@@ -3284,50 +3284,10 @@ checkCursorRectanglesExited(NSView *theView, NSEvent *theEvent, NSPoint lastPoi
+ (NSButton *) standardWindowButton: (NSWindowButton)button
forStyleMask: (NSUInteger) mask
{
- NSButton *newButton;
-
- newButton = [[NSButton alloc] init];
- [newButton setRefusesFirstResponder: YES];
- [newButton setButtonType: NSMomentaryChangeButton];
- [newButton setImagePosition: NSImageOnly];
- [newButton setBordered: YES];
- [newButton setTag: button];
-
- switch (button)
- {
- case NSWindowCloseButton:
- [newButton setImage: [NSImage imageNamed: @"common_Close"]];
- [newButton setAlternateImage: [NSImage imageNamed: @"common_CloseH"]];
- /* TODO: -performClose: should (but doesn't currently) highlight the
- button, which is wrong here. When -performClose: is fixed, we'll need a
- different method here. */
- [newButton setAction: @selector(performClose:)];
- break;
-
- case NSWindowMiniaturizeButton:
- [newButton setImage: [NSImage imageNamed: @"common_Miniaturize"]];
- [newButton setAlternateImage: [NSImage imageNamed: @"common_MiniaturizeH"]];
- [newButton setAction: @selector(miniaturize:)];
- break;
-
- case NSWindowZoomButton:
- // FIXME
- [newButton setAction: @selector(zoom:)];
- break;
-
- case NSWindowToolbarButton:
- // FIXME
- [newButton setAction: @selector(toggleToolbarShown:)];
- break;
- case NSWindowDocumentIconButton:
- default:
- // FIXME
- break;
+ return [[GSTheme theme] standardWindowButton: button
+ forStyleMask: mask];
}
- return AUTORELEASE(newButton);
-}
-
- (NSButton *) standardWindowButton: (NSWindowButton)button
{
return [_wv viewWithTag: button];
@@ -5285,6 +5245,7 @@ current key view.
[aCell setKeyEquivalent: @"\r"];
[aCell setKeyEquivalentModifierMask: 0];
+ [[GSTheme theme] didSetDefaultButtonCell: aCell];
}
- (void) disableKeyEquivalentForDefaultButtonCell