2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: SmHelp.c /main/4 1995/10/30 09:35:21 rswiston $ */
25 * (c) Copyright 1993, 1994 Hewlett-Packard Company *
26 * (c) Copyright 1993, 1994 International Business Machines Corp. *
27 * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
28 * (c) Copyright 1993, 1994 Novell, Inc. *
31 /*************************************<+>*************************************
32 *****************************************************************************
36 ** Project: HP DT Session Manager (dtsession)
40 ** This module is in charge of all interaction between the session
41 ** manager and the help subsystem. Anytime the user requests help,
42 ** it goes through this routine.
46 *******************************************************************
47 ** (c) Copyright Hewlett-Packard Company, 1990. All rights are
48 ** reserved. Copying or other reproduction of this program
49 ** except for archival purposes is prohibited without prior
50 ** written consent of Hewlett-Packard Company.
51 ********************************************************************
55 *****************************************************************************
56 *************************************<+>*************************************/
59 #include <X11/Intrinsic.h>
60 #include <X11/Shell.h>
62 #include <Xm/MwmUtil.h>
63 #include <Dt/HelpQuickD.h>
68 #include "SmGlobals.h"
80 * Local Function Declarations
83 static void CloseHelpDialog (Widget, XtPointer, XtPointer);
87 /*************************************<->*************************************
89 * TopicHelpRequested ()
94 * When a user requests help on a given topic - display that topic in a
95 * new or cached help dialog
100 * client_data - the id that is sent to Cache Creek which tells it which
112 *************************************<->***********************************/
116 XtPointer client_data,
117 XtPointer call_data )
121 char *locationId = (char *) client_data;
122 Widget transientShell;
125 Widget printButton = NULL;
126 Widget helpButton = NULL;
127 Widget backButton = NULL;
128 Widget okButton = NULL;
131 * Find the shell to make this a transient for for
134 while(!XtIsSubclass(transientShell, shellWidgetClass))
136 transientShell = XtParent(transientShell);
139 if((smDD.smHelpDialog != NULL) &&
140 (XtIsManaged(smDD.smHelpDialog)))
147 * Use the help dialog already created if it has been - otherwise
150 if (smDD.smHelpDialog != NULL)
153 XtSetArg(uiArgs[i], DtNlocationId,locationId); i++;
154 XtSetValues(smDD.smHelpDialog, uiArgs, i);
157 XtSetArg(uiArgs[i], XmNtransientFor, transientShell); i++;
158 XtSetValues(XtParent(smDD.smHelpDialog), uiArgs, i);
160 XtManageChild(smDD.smHelpDialog);
165 XtSetArg(uiArgs[i], XmNtitle, GETMESSAGE(29, 1,
166 "Session Manager Help")); i++;
167 XtSetArg (uiArgs[i],DtNhelpVolume, SM_HELP_VOLUME); i++;
168 XtSetArg (uiArgs[i],DtNhelpType, DtHELP_TYPE_TOPIC); i++;
169 XtSetArg (uiArgs[i], DtNlocationId,locationId); i++;
170 smDD.smHelpDialog = DtCreateHelpQuickDialog(smGD.topLevelWid,
171 "helpWidget", uiArgs, i);
174 XtSetArg(uiArgs[i], XmNtransientFor, transientShell); i++;
175 XtSetValues(XtParent(smDD.smHelpDialog), uiArgs, i);
178 XtAddCallback(smDD.smHelpDialog, DtNcloseCallback,
179 CloseHelpDialog, NULL);
181 okButton = DtHelpQuickDialogGetChild(smDD.smHelpDialog,
182 DtHELP_QUICK_CLOSE_BUTTON );
184 XtSetArg (setArgs2[n2], XmNlabelString, smDD.okString); n2++;
185 XtSetValues(okButton, setArgs2, n2);
187 printButton = DtHelpQuickDialogGetChild(smDD.smHelpDialog,
188 DtHELP_QUICK_PRINT_BUTTON );
189 helpButton = DtHelpQuickDialogGetChild(smDD.smHelpDialog,
190 DtHELP_QUICK_HELP_BUTTON );
191 backButton = DtHelpQuickDialogGetChild(smDD.smHelpDialog,
192 DtHELP_QUICK_BACK_BUTTON );
193 XtUnmanageChild(printButton);
194 XtUnmanageChild(helpButton);
195 XtUnmanageChild(backButton);
197 XtAddCallback (XtParent(smDD.smHelpDialog), XmNpopupCallback,
200 XtManageChild(smDD.smHelpDialog);
206 /*************************************<->*************************************
213 * This callback is called when the user wishes to dismiss the help callback
227 *************************************<->***********************************/
229 CloseHelpDialog (Widget w,
230 XtPointer clientData,
233 XtUnmanageChild(smDD.smHelpDialog);