UKDocumentationController
Language: Objective-C, Author: Uli Kusterer
License: MIT/X11
A small handy drop-in class lets you easily add menu items that show the "Readme", "Release Notes" and "FAQ" sections of your application's help book. Simply looks up the appropriate anchors.
UKDocumentationController source preview
// // UKDocumentationController.m // Shovel // // Created by Uli Kusterer on 04.10.04. // Copyright 2004 M. Uli Kusterer. All rights reserved. // #import "UKDocumentationController.h" @implementation UKDocumentationController -(void) showReadme: (id)sender { [self showHelpBookAnchor: @"readme"]; } -(void) showReleaseNotes: (id)sender { [self showHelpBookAnchor: @"release_notes"]; } -(void) showFAQ: (id)sender { [self showHelpBookAnchor: @"faq"]; } // Main bottleneck for all of our menu item actions: -(void) showHelpBookAnchor: (NSString*)str { NSDictionary* infod = nil; NSBundle* mainb = [NSBundle mainBundle]; if( [mainb respondsToSelector: @selector(localizedInfoDictionary)] ) infod = [mainb localizedInfoDictionary]; else infod = [mainb infoDictionary]; NSString* helpBookName = [infod objectForKey: @"CFBundleHelpBookName"]; if( helpBookName == nil ) helpBookName = [[mainb infoDictionary] objectForKey: @"CFBundleHelpBookName"]; [[NSHelpManager sharedHelpManager] openHelpAnchor: str inBook: helpBookName]; } @end
UKDocumentationController header preview
// // UKDocumentationController.h // Shovel // // Created by Uli Kusterer on 04.10.04. // Copyright 2004 M. Uli Kusterer. All rights reserved. // #import <Cocoa/Cocoa.h> /* This is a little controller object that you can instantiate in your MainMenu.nib to add a few menu items to your application's "Help" menu. It will bring up the anchors of the specified name (e.g. #readme) in your application's help book. This way, you are very flexible in regard to where you put this info in your help book. As long as the specified anchor tags (e.g. <a name="readme"></a> is present in your help book somewhere and you have run the Apple Help Indexing Tool on your help book's HTML files, this object will show the right page and the right location, even if your help consists only of one large file and not several pages. */ @interface UKDocumentationController : NSObject { } // IBActions for our additional help menu items: -(void) showReadme: (id)sender; // #readme -(void) showReleaseNotes: (id)sender; // #release_notes -(void) showFAQ: (id)sender; // #faq // Private, used by the other three: -(void) showHelpBookAnchor: (NSString*)str; @endDownload Archive
Compatible with:
- Mac OS X 10.3
- Mac OS X 10.4 PPC
- Mac OS X 10.4 Intel
- Mac OS X 10.5 PPC
- Mac OS X 10.5 Intel
Comments
Comment feed
