This is ActivatorBar.m in view mode; [Download] [Up]
/* Copyright 1993 Jeremy Slade. You are free to use all or any parts of the Locus project however you wish, just give credit where credit is due. The author (Jeremy Slade) shall not be held responsible for any damages that result out of use or misuse of any part of this project. */ /* Project: Locus File: ActivatorBar.m Description: See ActivatorBar.m Original Author: Jeremy Slade Revision History: Created V.101 JGS Tue Feb 2 18:42:19 GMT-0700 1993 */ #import "ActivatorBar.h" #import "ActivatorBarView.h" #import "FolderController.h" #import "Globals.h" #import "PSWraps.h" @implementation ActivatorBar // ------------------------------------------------------------------------- // Creating and initializing // ------------------------------------------------------------------------- + initialize { [self setVersion:ActivatorBar_VERSION]; return ( self ); } - initAt:(int)position { [self initContent:NULL style:NX_PLAINSTYLE // No title bar backing:NX_BUFFERED buttonMask:0 defer:NO]; [[[self setFreeWhenClosed:NO] setHideOnDeactivate:NO] setBecomeKeyOnlyIfNeeded:YES]; [[self setContentView:[[ActivatorBarView alloc] initFrame:NULL]] free]; // Free the previous content view [self setPosition:position]; return ( self ); } - free { return ( [super free] ); } // ------------------------------------------------------------------------- // Displaying // ------------------------------------------------------------------------- #define BAR_VWID 5 #define BAR_HWID 5 - setPosition:(int)position /* This method moves and resizes the bar so that it will lay along the edge of the screen specified by the position value -- None, Left, Right, Top, or Bottom. It asks NXApp for the current screen size, so that it can adjust to different size screens. The bar also checks the floatActivator global variable to see which window tier it should display in. If floatActivator is YES, the bars will be shown in the same tier as the standard Dock (tier 5). Otherwise, they will be in the standard window tier (tier 0). */ { NXRect rect; unsigned int winNum; NXSize screen; pos = position; if ( pos == ABAR_NONE ) { [self orderOut:self]; return ( self ); // No bar } // Set frame rect according to position [NXApp getScreenSize:&screen]; if ( pos == ABAR_TOP || pos == ABAR_BOTTOM ) { // Horizontal bar NXSetRect ( &rect, 0, 0, screen.width, BAR_VWID ); // Bottom of screen if ( pos == ABAR_TOP ) rect.origin.y = screen.height - BAR_VWID; // Top of screen } else { // Vertical bar NXSetRect ( &rect, 0, 0, BAR_HWID, screen.height ); // Left of screen if ( pos == ABAR_RIGHT ) rect.origin.x = screen.width - BAR_HWID; // Right of screen } [self placeWindow:&rect]; // Raise the activator bar to the proper tier NXConvertWinNumToGlobal ( [self windowNum], &winNum ); if ( floatActivator ) PSsettier ( 5, winNum ); // Same tier as Dock else PSsettier ( 0, winNum ); // Standard tier for windows [self disableFlushWindow]; [self display]; [self reenableFlushWindow]; return ( self ); } - setColor:(NXColor)color { [contentView setColor:color]; return ( self ); } - setBorderColor:(NXColor)color { [contentView setBorderColor:color]; return ( self ); } - show:sender { // Always put bar at back of screen list if ( pos != ABAR_NONE ) [self orderBack:self]; return ( self ); } - hide:sender { [self orderOut:sender]; return ( self ); } // ------------------------------------------------------------------------- // Trapping mouseDown // ------------------------------------------------------------------------- - barHit:sender /* Sent by the ActivatorBarView when it receives a mouseDown -- notify our delegate. */ { if ( [delegate respondsTo:@selector(barHit:)] ) [delegate barHit:self]; return ( self ); } // ------------------------------------------------------------------------- // NXDraggingDestination Protocol - forward to dragDelegate // ------------------------------------------------------------------------- - (NXDragOperation)draggingEntered:(id <NXDraggingInfo>)sender { [folderController setDragDest:activator]; return ( [folderController draggingEntered:sender] ); } - (NXDragOperation)draggingUpdated:(id <NXDraggingInfo>)sender { return ( [folderController draggingUpdated:sender] ); } - draggingExited:(id <NXDraggingInfo>)sender { return ( [folderController draggingExited:sender] ); } - (BOOL)prepareForDragOperation:(id <NXDraggingInfo>)sender { return ( [folderController prepareForDragOperation:sender] ); } - (BOOL)performDragOperation:(id <NXDraggingInfo>)sender { return ( [folderController performDragOperation:sender] ); } - concludeDragOperation:(id <NXDraggingInfo>)sender { return ( [folderController concludeDragOperation:sender] ); } // ------------------------------------------------------------------------- // Misc // ------------------------------------------------------------------------- - (BOOL)canBecomeKeyWindow { return ( NO ); } - (BOOL)canBecomeMainWindow { return ( NO ); } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.