diff --git a/ChangeLog b/ChangeLog index a05213fbc..788d99e4e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-11-11 14:41 Gregory John Casamento + + * Source/NSApplication.m: (-targetForAction:): Added code to check the + document of the main window as well. + * NSToolbar.m: Additional implementation. + * NSWindow.[hm]: Added some code for drawing the toolbar. + * GSToolbarView.h: added initWithToolbar: method. + 2003-11-07 15:28 Alexander Malmberg * Source/NSControl.m (-mouseDown:): Rewrite to use -setHighlighted: diff --git a/Headers/Additions/GNUstepGUI/GSToolbarView.h b/Headers/Additions/GNUstepGUI/GSToolbarView.h index 4407eca72..80e87f4a4 100644 --- a/Headers/Additions/GNUstepGUI/GSToolbarView.h +++ b/Headers/Additions/GNUstepGUI/GSToolbarView.h @@ -39,6 +39,7 @@ { NSToolbar *_toolbar; } +- (id) initWithToolbar: (NSToolbar *)toolbar; - (void) setToolbar: (NSToolbar *)toolbar; - (NSToolbar *) toolbar; @end diff --git a/Headers/AppKit/NSWindow.h b/Headers/AppKit/NSWindow.h index 7d4a30aa4..81e51904f 100644 --- a/Headers/AppKit/NSWindow.h +++ b/Headers/AppKit/NSWindow.h @@ -140,7 +140,7 @@ APPKIT_EXPORT NSSize NSTokenSize; float _alphaValue; NSToolbar *_toolbar; - + id _toolbarView; NSCachedImageRep *_cachedImage; NSPoint _cachedImageOrigin; diff --git a/Source/NSApplication.m b/Source/NSApplication.m index b3207eddd..a919292c5 100644 --- a/Source/NSApplication.m +++ b/Source/NSApplication.m @@ -1693,11 +1693,23 @@ IF_NO_GC(NSAssert([event retainCount] > 0, NSInternalInconsistencyException)); { return mainWindow; } + resp = [mainWindow delegate]; if (resp != nil && [resp respondsToSelector: aSelector]) { return resp; } + + if ([NSDocumentController isDocumentBasedApplication]) + { + resp = [[NSDocumentController sharedDocumentController] + documentForWindow: mainWindow]; + + if (resp != nil && [resp respondsToSelector: aSelector]) + { + return resp; + } + } } if ([self respondsToSelector: aSelector]) diff --git a/Source/NSToolbar.m b/Source/NSToolbar.m index f4d53edc7..ee3506721 100644 --- a/Source/NSToolbar.m +++ b/Source/NSToolbar.m @@ -45,6 +45,15 @@ static NSNotificationCenter *nc = nil; static const int current_version = 1; @implementation GSToolbarView +- (id) initWithToolbar: (NSToolbar *)toolbar +{ + if((self = [super init]) != nil) + { + ASSIGN(_toolbar,toolbar); + } + return self; +} + - (void) dealloc { RELEASE(_toolbar); @@ -83,33 +92,6 @@ static const int current_version = 1; } @end -@interface GSToolbarButton : NSButton -{ - NSToolbarItem *_item; -} -@end - -@implementation GSToolbarButton -- (id) initWithItem: (NSToolbarItem *)item -{ - [super init]; - ASSIGN(_item, item); - return self; -} - -- (void) dealloc -{ - RELEASE (_item); - [super dealloc]; -} - -- (void) drawRect: (NSRect)aRect -{ - // set the image and draw using the super class... - [super drawRect: aRect]; -} -@end - @implementation NSToolbar (GNUstepPrivate) - (id) _toolbarView { diff --git a/Source/NSWindow.m b/Source/NSWindow.m index 536856bd0..c19127672 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -70,6 +70,7 @@ #include "AppKit/NSToolbar.h" #include "GNUstepGUI/GSTrackingRect.h" #include "GNUstepGUI/GSDisplayServer.h" +#include "GNUstepGUI/GSToolbarView.h" BOOL GSViewAcceptsDrag(NSView *v, id dragInfo); @@ -4015,8 +4016,10 @@ Code shared with [NSPanel -sendEvent:], remember to update both places. - (void) setToolbar: (NSToolbar*)toolbar { + // assign and setup the toolbar... ASSIGN(_toolbar, toolbar); - // FIXME The toolbar needs to know about the window! + _toolbarView = [GSToolbarView initWithToolbar: _toolbar]; + } - (NSToolbar *) toolbar