/* ** SummaryViewer.h ** ** Copyright (c) 2004 ** ** Author: Yen-Ju Chen ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "SummaryViewer.h" static SummaryViewer *sharedInstance; @implementation SummaryViewer - (IBAction)summaryStyleAction:(id)sender { unsigned int index = [sender indexOfSelectedItem]; switch(index) { case 0: style = SummaryBriefStyle; break; case 1: style = SummaryRegularStyle; break; case 2: style = SummaryCompleteStyle; break; } [delegate styleDidChangeInSummaryViewer: self]; } - (void) setSummary: (NSAttributedString *) as { [[textView textStorage] setAttributedString: as]; } - (void) setTitle: (NSString *) t { [viewer setTitle: [NSString stringWithFormat: sSummaryViewer_, t]]; } - (SummaryStyle) summaryStyle { return style; } - (void) makeViewerKeyAndOrderFront: (id) sender { [viewer makeKeyAndOrderFront: sender]; } + (SummaryViewer *) sharedViewer { if (sharedInstance == nil) { sharedInstance = [[SummaryViewer alloc] init]; } return sharedInstance; } - (void) awakeFromNib { } - (id) init { self = [super init]; BOOL result = [NSBundle loadNibNamed: @"SummaryViewer" owner: self]; if (result == NO) { NSLog(@"Unable to load AttributesViewer interface"); return nil; } style = SummaryBriefStyle; return self; } - (void) setDelegate: (id) d { ASSIGN(delegate, d); } - (id) delegate { return delegate; } @end