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 librararies 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"
71 #include <X11/apollosys.h>
85 * Local Function Declarations
88 static void CloseHelpDialog (Widget, XtPointer, XtPointer);
92 /*************************************<->*************************************
94 * TopicHelpRequested ()
99 * When a user requests help on a given topic - display that topic in a
100 * new or cached help dialog
105 * client_data - the id that is sent to Cache Creek which tells it which
117 *************************************<->***********************************/
121 XtPointer client_data,
122 XtPointer call_data )
126 char *locationId = (char *) client_data;
127 Widget transientShell;
130 Widget printButton = NULL;
131 Widget helpButton = NULL;
132 Widget backButton = NULL;
133 Widget okButton = NULL;
136 * Find the shell to make this a transient for for
139 while(!XtIsSubclass(transientShell, shellWidgetClass))
141 transientShell = XtParent(transientShell);
144 if((smDD.smHelpDialog != NULL) &&
145 (XtIsManaged(smDD.smHelpDialog)))
152 * Use the help dialog already created if it has been - otherwise
155 if (smDD.smHelpDialog != NULL)
158 XtSetArg(uiArgs[i], DtNlocationId,locationId); i++;
159 XtSetValues(smDD.smHelpDialog, uiArgs, i);
162 XtSetArg(uiArgs[i], XmNtransientFor, transientShell); i++;
163 XtSetValues(XtParent(smDD.smHelpDialog), uiArgs, i);
165 XtManageChild(smDD.smHelpDialog);
170 XtSetArg(uiArgs[i], XmNtitle, GETMESSAGE(29, 1,
171 "Session Manager Help")); i++;
172 XtSetArg (uiArgs[i],DtNhelpVolume, SM_HELP_VOLUME); i++;
173 XtSetArg (uiArgs[i],DtNhelpType, DtHELP_TYPE_TOPIC); i++;
174 XtSetArg (uiArgs[i], DtNlocationId,locationId); i++;
175 smDD.smHelpDialog = DtCreateHelpQuickDialog(smGD.topLevelWid,
176 "helpWidget", uiArgs, i);
179 XtSetArg(uiArgs[i], XmNtransientFor, transientShell); i++;
180 XtSetValues(XtParent(smDD.smHelpDialog), uiArgs, i);
183 XtAddCallback(smDD.smHelpDialog, DtNcloseCallback,
184 CloseHelpDialog, NULL);
186 okButton = DtHelpQuickDialogGetChild(smDD.smHelpDialog,
187 DtHELP_QUICK_CLOSE_BUTTON );
189 XtSetArg (setArgs2[n2], XmNlabelString, smDD.okString); n2++;
190 XtSetValues(okButton, setArgs2, n2);
192 printButton = DtHelpQuickDialogGetChild(smDD.smHelpDialog,
193 DtHELP_QUICK_PRINT_BUTTON );
194 helpButton = DtHelpQuickDialogGetChild(smDD.smHelpDialog,
195 DtHELP_QUICK_HELP_BUTTON );
196 backButton = DtHelpQuickDialogGetChild(smDD.smHelpDialog,
197 DtHELP_QUICK_BACK_BUTTON );
198 XtUnmanageChild(printButton);
199 XtUnmanageChild(helpButton);
200 XtUnmanageChild(backButton);
202 XtAddCallback (XtParent(smDD.smHelpDialog), XmNpopupCallback,
205 XtManageChild(smDD.smHelpDialog);
211 /*************************************<->*************************************
218 * This callback is called when the user wishes to dismiss the help callback
232 *************************************<->***********************************/
234 CloseHelpDialog (Widget w,
235 XtPointer clientData,
238 XtUnmanageChild(smDD.smHelpDialog);