public
Description: iChm is a CHM reader for Mac OS X
Homepage: http://www.robinlu.com/blog/ichm
Clone URL: git://github.com/robin/ichm.git
ichm / CHMWebViewController.m
100644 51 lines (43 sloc) 1.194 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//
// CHMWebView.m
// ichm
//
// Created by Robin Lu on 7/29/08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
 
#import "CHMWebViewController.h"
#import <WebKit/WebKit.h>
 
@implementation CHMWebViewController
 
@synthesize webView;
@synthesize searchField;
 
- (id) init
{
if (![super initWithNibName:@"CHMWebView" bundle:nil])
return nil;
[self loadView];
[self hideFindPanel:self];
return self;
}
 
- (IBAction)hideFindPanel:(id)sender
{
if ([findPanel isHidden])
return;
[findPanel setHidden:YES];
float webViewHeight = [webView frame].size.height;
webViewHeight = webViewHeight + 27;
[webView setFrame:NSMakeRect([webView frame].origin.x, [webView frame].origin.y, [webView frame].size.width, webViewHeight)];
[webView setNeedsDisplay:YES];
}
 
- (IBAction)showFindPanel:(id)sender
{
if ([findPanel isHidden])
{
[findPanel setHidden:NO];
float webViewHeight = [webView frame].size.height;
webViewHeight = webViewHeight - 27;
[webView setFrame:NSMakeRect([webView frame].origin.x, [webView frame].origin.y, [webView frame].size.width, webViewHeight)];
[webView setNeedsDisplay:YES];
}
[[[self view] window] makeFirstResponder:searchField];
}
 
@end