194f19e0nwhitehorn/*
22b5579cbapt *  $Id: help.c,v 1.3 2012/12/04 02:01:10 tom Exp $
394f19e0nwhitehorn *
494f19e0nwhitehorn *  help.c -- implements the help dialog
594f19e0nwhitehorn *
62b5579cbapt *  Copyright 2011,2012	Thomas E. Dickey
794f19e0nwhitehorn *
894f19e0nwhitehorn *  This program is free software; you can redistribute it and/or modify
994f19e0nwhitehorn *  it under the terms of the GNU Lesser General Public License, version 2.1
1094f19e0nwhitehorn *  as published by the Free Software Foundation.
1194f19e0nwhitehorn *
1294f19e0nwhitehorn *  This program is distributed in the hope that it will be useful, but
1394f19e0nwhitehorn *  WITHOUT ANY WARRANTY; without even the implied warranty of
1494f19e0nwhitehorn *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1594f19e0nwhitehorn *  Lesser General Public License for more details.
1694f19e0nwhitehorn *
1794f19e0nwhitehorn *  You should have received a copy of the GNU Lesser General Public
1894f19e0nwhitehorn *  License along with this program; if not, write to
1994f19e0nwhitehorn *	Free Software Foundation, Inc.
2094f19e0nwhitehorn *	51 Franklin St., Fifth Floor
2194f19e0nwhitehorn *	Boston, MA 02110, USA.
2294f19e0nwhitehorn */
2394f19e0nwhitehorn
2494f19e0nwhitehorn#include <dialog.h>
2594f19e0nwhitehorn
2694f19e0nwhitehorn/*
2794f19e0nwhitehorn * Display a help-file as a textbox widget.
2894f19e0nwhitehorn */
2994f19e0nwhitehornint
3094f19e0nwhitehorndialog_helpfile(const char *title,
3194f19e0nwhitehorn		const char *file,
3294f19e0nwhitehorn		int height,
3394f19e0nwhitehorn		int width)
3494f19e0nwhitehorn{
3594f19e0nwhitehorn    int result = DLG_EXIT_ERROR;
362b5579cbapt    DIALOG_VARS save;
3794f19e0nwhitehorn
3894f19e0nwhitehorn    if (!dialog_vars.in_helpfile && file != 0 && *file != '\0') {
392b5579cbapt	dlg_save_vars(&save);
402b5579cbapt
412b5579cbapt	dialog_vars.no_label = NULL;
422b5579cbapt	dialog_vars.ok_label = NULL;
432b5579cbapt	dialog_vars.help_button = FALSE;
442b5579cbapt	dialog_vars.extra_button = FALSE;
452b5579cbapt	dialog_vars.nook = FALSE;
462b5579cbapt
4794f19e0nwhitehorn	dialog_vars.in_helpfile = TRUE;
482b5579cbapt
4994f19e0nwhitehorn	result = dialog_textbox(title, file, height, width);
502b5579cbapt
512b5579cbapt	dlg_restore_vars(&save);
5294f19e0nwhitehorn    }
5394f19e0nwhitehorn    return (result);
5494f19e0nwhitehorn}
55