1224012Snwhitehorn/*
2251843Sbapt *  $Id: help.c,v 1.3 2012/12/04 02:01:10 tom Exp $
3224012Snwhitehorn *
4224012Snwhitehorn *  help.c -- implements the help dialog
5224012Snwhitehorn *
6251843Sbapt *  Copyright 2011,2012	Thomas E. Dickey
7224012Snwhitehorn *
8224012Snwhitehorn *  This program is free software; you can redistribute it and/or modify
9224012Snwhitehorn *  it under the terms of the GNU Lesser General Public License, version 2.1
10224012Snwhitehorn *  as published by the Free Software Foundation.
11224012Snwhitehorn *
12224012Snwhitehorn *  This program is distributed in the hope that it will be useful, but
13224012Snwhitehorn *  WITHOUT ANY WARRANTY; without even the implied warranty of
14224012Snwhitehorn *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15224012Snwhitehorn *  Lesser General Public License for more details.
16224012Snwhitehorn *
17224012Snwhitehorn *  You should have received a copy of the GNU Lesser General Public
18224012Snwhitehorn *  License along with this program; if not, write to
19224012Snwhitehorn *	Free Software Foundation, Inc.
20224012Snwhitehorn *	51 Franklin St., Fifth Floor
21224012Snwhitehorn *	Boston, MA 02110, USA.
22224012Snwhitehorn */
23224012Snwhitehorn
24224012Snwhitehorn#include <dialog.h>
25224012Snwhitehorn
26224012Snwhitehorn/*
27224012Snwhitehorn * Display a help-file as a textbox widget.
28224012Snwhitehorn */
29224012Snwhitehornint
30224012Snwhitehorndialog_helpfile(const char *title,
31224012Snwhitehorn		const char *file,
32224012Snwhitehorn		int height,
33224012Snwhitehorn		int width)
34224012Snwhitehorn{
35224012Snwhitehorn    int result = DLG_EXIT_ERROR;
36251843Sbapt    DIALOG_VARS save;
37224012Snwhitehorn
38224012Snwhitehorn    if (!dialog_vars.in_helpfile && file != 0 && *file != '\0') {
39251843Sbapt	dlg_save_vars(&save);
40251843Sbapt
41251843Sbapt	dialog_vars.no_label = NULL;
42251843Sbapt	dialog_vars.ok_label = NULL;
43251843Sbapt	dialog_vars.help_button = FALSE;
44251843Sbapt	dialog_vars.extra_button = FALSE;
45251843Sbapt	dialog_vars.nook = FALSE;
46251843Sbapt
47224012Snwhitehorn	dialog_vars.in_helpfile = TRUE;
48251843Sbapt
49224012Snwhitehorn	result = dialog_textbox(title, file, height, width);
50251843Sbapt
51251843Sbapt	dlg_restore_vars(&save);
52224012Snwhitehorn    }
53224012Snwhitehorn    return (result);
54224012Snwhitehorn}
55