gnustep-SlideShowKit-20041011/000075500000000000000000000000001227765274600160205ustar00rootroot00000000000000gnustep-SlideShowKit-20041011/GNUmakefile000064400000000000000000000005721227765274600200760ustar00rootroot00000000000000include $(GNUSTEP_MAKEFILES)/common.make LIBRARY_NAME = libSlideShow libSlideShow_OBJC_FILES = SlideShowWindow.m SlideShowMenu.m libSlideShow_HEADERS = SlideShowWindow.h SlideShowMenu.h libSlideShow_HEADER_FILES = SlideShowWindow.h SlideShow.h libSlideShow_HEADER_FILES_INSTALL_DIR = /SlideShow ADDITIONAL_OBJCFLAGS += -Wall include $(GNUSTEP_MAKEFILES)/library.make gnustep-SlideShowKit-20041011/SlideShow.h000064400000000000000000000005741227765274600201000ustar00rootroot00000000000000#ifndef _IMAGEAPPS_SLIDESHOWKIT_SLIDESHOW_H_ #define _IMAGEAPPS_SLIDESHOWKIT_SLIDESHOW_H_ #include @class NSEvent; @interface SlideShow: NSObject { @private id _window; } +(id) slideShow; -(void) run; -(void) reveiveMouseEvent: (NSEvent*) event; -(void) receiveKeyEvent: (NSEvent*) event; @end #endif /* _IMAGEAPPS_SLIDESHOWKIT_SLIDESHOW_H_ */ gnustep-SlideShowKit-20041011/SlideShow.m000064400000000000000000000016271227765274600201050ustar00rootroot00000000000000#include "SlideShow.h" #include "SlideShowWindow.h" static SlideShow *slideShow = nil; @implementation SlideShow -(id) init { if ( slideShow ) { [self dealloc]; return slideShow; } if ( ! ( self = [super init] ) ) return nil; _window = [SlideShowWindow sharedSlideShowWindow]; if ( _window ) [_window setDelegate: self]; else printf("could not init SlideShowWindow \n"); NSLog(@"_window : %@",_window); slideShow = self; return slideShow; } -(void) dealloc { #warning TODO [super dealloc]; } + (id) slideShow { if ( ! slideShow ) return [[self alloc] init]; else return slideShow; } -(void) run { NSLog(@"_window %@",_window); [_window orderFrontRegardless]; } -(void) reveiveMouseEvent: (NSEvent *) event { printf("Mouse Event\n"); } -(void) receiveKeyEvent:(NSEvent*) event { printf("Key Event\n"); } @end gnustep-SlideShowKit-20041011/SlideShowMenu.h000064400000000000000000000014121227765274600207150ustar00rootroot00000000000000#ifndef _IMAGEAPPS_SLIDESHOWKIT_SLIDESHOWSUBMENU_H_ #define _IMAGEAPPS_SLIDESHOWKIT_SLIDESHOWSUBMENU_H_ #include @class NSImage; @class NSMutableArray; @interface SlideShowItem: NSObject { @private SEL _action; id _target; NSImage *_image; unsigned int _tag; } -(void) setAction:(SEL) action; -(SEL) action; -(void) setTarget: (id) target; -(id) target; -(void) setImage: (NSImage*) image; -(NSImage*) image; -(void) setTag: (unsigned int) tag; -(unsigned int) tag; @end @interface SlideShowSubMenu: NSObject { @private NSMutableArray *_items; } -(void) insertItem:(SlideShowItem*) item atIndex:(unsigned int) index; -(SlideShowItem *) itemAtIndex:(unsigned int) index; @end #endif /* _IMAGEAPPS_SLIDESHOWKIT_SLIDESHOWSUBMENU_H_ */ gnustep-SlideShowKit-20041011/SlideShowMenu.m000064400000000000000000000017711227765274600207320ustar00rootroot00000000000000#include "SlideShowMenu.h" #include @implementation SlideShowItem -(void) setAction:(SEL) action { if ( _action == action ) return; _action = action; //Menu changed ?? } -(SEL) action { return _action; } -(void) setTarget: (id) target { if (_target == target) return; _target = target; //Menu Changed ? } -(id) target { return _target; } -(void) setImage: (NSImage*) image { // NSAssert(image == nil || [image isKindOfClass: imageClass], // NSInvalidArgumentException); ASSIGN(_image, image); //Menu Changed ? } -(NSImage*) image { return _image; } -(void) setTag: (unsigned int) tag { _tag = tag; } -(unsigned int) tag { return _tag; } @end @implementation SlideShowSubMenu -(void) insertItem:(SlideShowItem*) item atIndex:(unsigned int) index { // [self insertItem: item atIndex: [_items count]]; } -(SlideShowItem *) itemAtIndex:(unsigned int) index { #warning exception return [_items objectAtIndex:index]; } @end gnustep-SlideShowKit-20041011/SlideShowWindow.h000064400000000000000000000007171227765274600212670ustar00rootroot00000000000000#ifndef _IMAGEAPPS_SLIDESHOWKIT_SLIDESHOWWINDOW_H_ #define _IMAGEAPPS_SLIDESHOWKIT_SLIDESHOWWINDOW_H_ #include @interface SlideShowWindow: NSWindow { @private id _forwardEvent; } +(id) sharedSlideShowWindow; -(void) setDelegate: (id) delegate; @end @interface NSObject (SlideShowDelegate) -(void) keyEvent:(NSEvent*) theEvent; -(void)scrollWheelEvent : (NSEvent*)theEvent; @end #endif /* _IMAGEAPPS_SLIDESHOWKIT_SLIDESHOWWINDOW_H_ */ gnustep-SlideShowKit-20041011/SlideShowWindow.m000064400000000000000000000050011227765274600212630ustar00rootroot00000000000000#include "SlideShowWindow.h" #include #include #include static SlideShowWindow *sharedSlideShowWindow = nil; // @interface MenuButton: NSButton // -(BOOL) isOpaque; // @end // @implementation MenuButton // -(BOOL) isOpaque // { // NSLog(@"isOpaque"); // return YES; // } // @end // @interface SlideShowWindow (Private) // -(void) _showMenu; // @end // @implementation SlideShowWindow (Private) // -(void) _showMenu // { // MenuButton *nextButton = [[MenuButton alloc] initWithFrame:NSMakeRect(250,350,70,0)]; // [nextButton setTitle: @"Next"]; // [nextButton setTarget: self]; // [nextButton setAction: @selector(next:)]; // [[self contentView] addSubview: nextButton]; // [nextButton autorelease]; // [[self contentView] setNeedsDisplay:YES]; // } // @end @implementation SlideShowWindow - (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag { if ( sharedSlideShowWindow ) { [self dealloc]; return sharedSlideShowWindow; } if ( ! ( self = [super initWithContentRect:[[NSScreen mainScreen] frame] styleMask: NSBorderlessWindowMask backing: NSBackingStoreBuffered defer:NO] ) ) return nil; #warning FIXME NSMenu is still visible !!! [sharedSlideShowWindow setLevel:NSScreenSaverWindowLevel]; #warning FIXME should be a param [sharedSlideShowWindow setBackgroundColor:[NSColor blueColor]]; sharedSlideShowWindow = self; return sharedSlideShowWindow; } -(void) dealloc { NSLog(@"dealloc SlideShowWindow"); [super dealloc]; } +(id) sharedSlideShowWindow { if ( ! sharedSlideShowWindow ) return [[self alloc] initWithContentRect:NSMakeRect(0,0,0,0) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]; else return sharedSlideShowWindow; } - (void) keyDown: (NSEvent *)theEvent { if ( _forwardEvent ) { [_forwardEvent keyEvent:theEvent]; } else printf("send to delegate keyPressed\n"); } - (void)scrollWheel:(NSEvent *)theEvent { if ( _forwardEvent ) [_forwardEvent scrollWheelEvent : theEvent]; } - (void) mouseUp: (NSEvent *)theEvent { if ( ! _forwardEvent ) printf("do nothing\n"); else printf("send to delegate keyPressed\n"); } -(void) setDelegate: (id) delegate { _forwardEvent = delegate; } - (BOOL) canBecomeKeyWindow { return YES; } - (BOOL) canBecomeMainWindow { return YES; } @end