1/*****************************************************************************
2 * HelpWindowController.m
3 *****************************************************************************
4 * Copyright (C) 2001-2014 VLC authors and VideoLAN
5 * $Id: 9520e5aead0dbcd99fce04073c7b3dc317df3115 $
6 *
7 * Authors: Derk-Jan Hartman <thedj@users.sourceforge.net>
8 *          Felix Paul Kühne <fkuehne -at- videolan.org>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
24
25#import "VLCHelpWindowController.h"
26
27#import "VLCMain.h"
28#import <vlc_intf_strings.h>
29#import <vlc_about.h>
30#import "CompatibilityFixes.h"
31#import "VLCScrollingClipView.h"
32
33@implementation VLCHelpWindowController
34
35- (id)init
36{
37    self = [super initWithWindowNibName:@"Help"];
38    if (self) {
39        [self setWindowFrameAutosaveName:@"help"];
40    }
41
42    return self;
43}
44
45- (void)windowDidLoad
46{
47    [[self window] setTitle:_NS("VLC media player Help")];
48    [forwardButton setToolTip:_NS("Next")];
49    [backButton setToolTip:_NS("Previous")];
50    [homeButton setToolTip:_NS("Index")];
51}
52
53- (void)showHelp
54{
55    [self showWindow:nil];
56    [self helpGoHome:nil];
57}
58
59- (IBAction)helpGoHome:(id)sender
60{
61    NSString *htmlWithStyle = [NSString
62                               stringWithFormat:@"<style>body { font-family: -apple-system, %@; }</style>%@",
63                               ((OSX_YOSEMITE_AND_HIGHER) ? @"Helvetica Neue" : @"Lucida Grande"), _NS(I_LONGHELP)];
64
65    [[helpWebView mainFrame] loadHTMLString:htmlWithStyle
66                                    baseURL:[NSURL URLWithString:@"https://videolan.org"]];
67}
68
69- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
70{
71    /* Update back/forward button states whenever a new page is loaded */
72    [forwardButton setEnabled:[helpWebView canGoForward]];
73    [backButton setEnabled:[helpWebView canGoBack]];
74}
75
76@end
77