Revision: 2704 http://skim-app.svn.sourceforge.net/skim-app/?rev=2704&view=rev Author: hofman Date: 2007-08-22 12:50:59 -0700 (Wed, 22 Aug 2007)
Log Message: ----------- Add files for outlineView base class. Added Paths: ----------- trunk/SKOutlineView.h trunk/SKOutlineView.m Added: trunk/SKOutlineView.h =================================================================== --- trunk/SKOutlineView.h (rev 0) +++ trunk/SKOutlineView.h 2007-08-22 19:50:59 UTC (rev 2704) @@ -0,0 +1,53 @@ +// +// SKOutlineView.h +// Skim +// +// Created by Christiaan Hofman on 8/22/07. +/* + This software is Copyright (c) 2007 + Christiaan Hofman. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of Christiaan Hofman nor the names of any + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <Cocoa/Cocoa.h> + [EMAIL PROTECTED] SKTypeSelectHelper; + [EMAIL PROTECTED] SKOutlineView : NSOutlineView { + SKTypeSelectHelper *typeSelectHelper; +} + +- (SKTypeSelectHelper *)typeSelectHelper; +- (void)setTypeSelectHelper:(SKTypeSelectHelper *)newTypeSelectHelper; + +- (void)scrollToBeginningOfDocument:(id)sender; +- (void)scrollToEndOfDocument:(id)sender; + [EMAIL PROTECTED] Added: trunk/SKOutlineView.m =================================================================== --- trunk/SKOutlineView.m (rev 0) +++ trunk/SKOutlineView.m 2007-08-22 19:50:59 UTC (rev 2704) @@ -0,0 +1,104 @@ +// +// SKOutlineView.m +// Skim +// +// Created by Christiaan Hofman on 8/22/07. +/* + This software is Copyright (c) 2007 + Christiaan Hofman. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of Christiaan Hofman nor the names of any + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "SKOutlineView.h" +#import "SKTypeSelectHelper.h" + + [EMAIL PROTECTED] SKOutlineView + +- (void)dealloc { + [typeSelectHelper setDataSource:nil]; + [typeSelectHelper release]; + [super dealloc]; +} + +- (SKTypeSelectHelper *)typeSelectHelper { + return typeSelectHelper; +} + +- (void)setTypeSelectHelper:(SKTypeSelectHelper *)newTypeSelectHelper { + if (typeSelectHelper != newTypeSelectHelper) { + [typeSelectHelper release]; + typeSelectHelper = [newTypeSelectHelper retain]; + } +} + +- (void)expandItem:(id)item expandChildren:(BOOL)collapseChildren { + [super expandItem:item expandChildren:collapseChildren]; + [typeSelectHelper rebuildTypeSelectSearchCache]; +} + +- (void)collapseItem:(id)item collapseChildren:(BOOL)collapseChildren { + [super collapseItem:item collapseChildren:collapseChildren]; + [typeSelectHelper rebuildTypeSelectSearchCache]; +} + +- (void)reloadData{ + [super reloadData]; + [typeSelectHelper rebuildTypeSelectSearchCache]; +} + +- (void)keyDown:(NSEvent *)theEvent { + NSString *characters = [theEvent charactersIgnoringModifiers]; + unichar eventChar = [characters length] > 0 ? [characters characterAtIndex:0] : 0; + unsigned modifierFlags = [theEvent modifierFlags] & NSDeviceIndependentModifierFlagsMask; + + if (typeSelectHelper && modifierFlags == 0 && [[NSCharacterSet alphanumericCharacterSet] characterIsMember:eventChar]) + [typeSelectHelper processKeyDownCharacter:eventChar]; + else if (typeSelectHelper && modifierFlags == 0 && eventChar == '/') + [typeSelectHelper repeatSearch]; + else if (eventChar == NSHomeFunctionKey && (modifierFlags & ~NSFunctionKeyMask) == 0) + [self scrollToBeginningOfDocument:nil]; + else if (eventChar == NSEndFunctionKey && (modifierFlags & ~NSFunctionKeyMask) == 0) + [self scrollToEndOfDocument:nil]; + else + [super keyDown:theEvent]; +} + +- (void)scrollToBeginningOfDocument:(id)sender { + if ([self numberOfRows]) + [self scrollRowToVisible:0]; +} + +- (void)scrollToEndOfDocument:(id)sender { + if ([self numberOfRows]) + [self scrollRowToVisible:[self numberOfRows] - 1]; +} + [EMAIL PROTECTED] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Skim-app-commit mailing list Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit