UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
helpdialog.h
1 /* helpdialog.h */
2 /* $Id: helpdialog.h,v 1.4 2006/10/09 11:16:24 shurik Exp $ */
3 #ifndef __helpdialog_h
4 #define __helpdialog_h
5 
6 /***********************************************************************
7  *
8  * Context help subsystem
9  *
10  ***********************************************************************/
11 
12 /***********************************************************************
13  * Help dialog window
14  ***********************************************************************/
15 
16 #include <X11/Intrinsic.h>
17 #include <Xm/Text.h>
18 
19 #include <mix/helpdoc.h>
20 
21 
22 /* Recommended width for help text and titles */
23 #define ZmHW_CONTENTS_WIDTH 60
24 
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif /* __cplusplus */
29 
30 
31 /* Structure for the help dialog window history item */
32 typedef struct ZmHelpHistItemTag
33 {
34  struct ZmHelpHistItemTag *pNext, *pPrev; /* bidirection list */
35  const char *szSection; /* section's label */
36 
38 
39 /* Structure for the help dialog window state */
40 typedef struct
41 {
42  short nTextRows, nTextCols; /* help text window size */
43  XmTextPosition nTextPos; /* position in text */
44  int nRefLines; /* visible lines in list of refs */
45  int nRefPos; /* position in list of refs */
46  Position xPos, yPos; /* common window position */
47 
49 
50 /* Structure for the help dialog window */
51 typedef struct
52 {
53  /* initial command line arguments */
54  char **argv;
55  int argc;
56 
57  /* context help dialog */
58  Widget wShell; /* window shell */
59  Widget wForm, wToolbar, wPaned; /* composites */
60  Widget wDocTitleLabel; /* title label for the document */
61  Widget wSectionTitleLabel;/* title label for the section */
62  Widget wCloseHelp, wNextSection, wPrevSection, wListOfSections;
63  Widget wHelpText; /* help text */
64  Widget wHelpRefs; /* list of references */
65 
66  ZmHelpWinState state; /* state of the window */
67 
68  /* table of contents dialog */
69  Widget wTOCShell; /* window shell */
70  Widget wTOCForm; /* container */
71  Widget wTOCSelBox; /* selection box */
72 
73  /* history */
74  ZmHelpHistItem *last; /* last item of history (list head) */
75  ZmHelpHistItem *cur; /* current item of history */
76 
77  ChDocument *doc; /* context help document structure */
78  ChReference *toc; /* table of contents */
79  Logic bFirst; /* first call */
80 
81  /* language-dependent dynamic resources */
82  XmFontList flTextFont; /* text, refs, common title */
83  TextEncoding eTextFontEnc;
84 
85  XmFontList flTitleFont; /* section title */
86  TextEncoding eTitleFontEnc;
87 
89 
90 
91 /* Initialize server code (before GUI start). */
92 ErrCode ZmInitHelpWindow (const char* szMainHelpDoc, Widget w);
93 
94 
95 /* Add another document to help repository. */
96 void ZmHW_AddHelpDoc (ZmHelpWinInternals* pHWI, const char* szDocName);
97 
98 /* Create help window. */
99 void ZmHW_CreateHelpDialog (ZmHelpWinInternals* pHWI);
100 
101 /* Assign pixmaps to push buttons of help dialog. */
102 void ZmHW_AssignPixmaps (ZmHelpWinInternals* pHWI);
103 
104 /* Create table of contents dialog */
105 void ZmHW_CreateTOCDialog (Widget wParent, ZmHelpWinInternals* pHWI);
106 
107 /* Register callbacks */
108 void ZmHW_RegisterCallbacksHelpWin (ZmHelpWinInternals* pHWI);
109 
110 /* Store state of the window in special state variable */
111 void ZmHW_StoreHelpWinState (ZmHelpWinInternals* pHWI);
112 
113 /* Restore state of the window from special state variable */
114 void ZmHW_RestoreHelpWinState (ZmHelpWinInternals* pHWI);
115 
116 /* Setup state of the window */
117 void ZmHW_SetupHelpWinState (ZmHelpWinInternals* pHWI);
118 
119 /* Place help window */
120 void ZmHW_PlaceHelpWin (Widget wParent, ZmHelpWinInternals* pHWI);
121 
122 /* Set localized fonts to some GUI items. */
123 void ZmHW_ForceLocalizedFonts (ZmHelpWinInternals* pHWI);
124 
125 /* Display given text translated from some encoding to another. */
126 void ZmHW_SetLocalizedString (Widget wTarget, TextEncoding eTargetEnc,
127  TextEncoding eSourceEnc, const char* szString);
128 
129 /* Display help section labeled by szSection in given help window
130  context. */
131 void ZmHW_HelpShow (ZmHelpWinInternals* pHWI, const char* szSection);
132 
133 /* Display current section. */
134 void ZmHW_DisplayCurrentSection (ZmHelpWinInternals* pHWI);
135 
136 /* Find index of reference in list or -1. */
137 int ZmHW_FindIndexOfReference (ChReference* pHead,
138  ChReference* pRef);
139 
140 /* Find reference by index in list or NULL. */
141 ChReference* ZmHW_FindReferenceByIndex (ChReference* pHead,
142  int iRef);
143 
144 /* Fill table of contents */
145 void ZmHW_FillTOCDialog (ZmHelpWinInternals* pHWI);
146 
147 /* Erase all items from table of contents */
148 void ZmHW_CleanTOCDialog (ZmHelpWinInternals* pHWI);
149 
150 
151 /***********************************************************************
152  * Error notification
153  ***********************************************************************/
154 
155 /* Display error message about unknown section. */
156 void ZmHW_ErrorSectionIsNotFound (ZmHelpWinInternals* pHWI,
157  const char* szSection);
158 
159 
160 /***********************************************************************
161  * History
162  ***********************************************************************/
163 
164 /* Add section to the end of history list. */
165 ZmHelpHistItem* ZmHW_AddSectionToHistory (ZmHelpWinInternals* pHWI,
166  const char* szSection);
167 
168 /* History walking buttons' sensitivity. */
169 void ZmHW_HistoryButtonsSensitivity (ZmHelpWinInternals* pHWI);
170 
171 /* Debug tool for history. */
172 void ZmHW_PrintHistory (ZmHelpWinInternals* pHWI);
173 
174 
175 /***********************************************************************
176  * Callbacks
177  ***********************************************************************/
178 
179 #define DeclareCallback(f) void f(Widget, XtPointer, XtPointer)
180 
181 /* Handle closure of the help window */
182 DeclareCallback(ZmHW_CloseHelpWinCB);
183 
184 /* Handle prev history item button of the help window */
185 DeclareCallback(ZmHW_PrevHelpItemCB);
186 
187 /* Handle next history item button of the help window */
188 DeclareCallback(ZmHW_NextHelpItemCB);
189 
190 /* Handle list of help contents button of the help window */
191 DeclareCallback(ZmHW_HelpContentsCB);
192 
193 /* Handle double-click on reference */
194 DeclareCallback(ZmHW_SelectRefCB);
195 
196 /* Handle OK (selected) event in TOC dialog window */
197 DeclareCallback(ZmHW_TOCOkCB);
198 
199 /* Handle Cancel/Close event in TOC dialog window */
200 DeclareCallback(ZmHW_TOCCancelCB);
201 
202 #undef DeclareCallback
203 
204 
205 #ifdef __HelpWinVars
206 #define EXTERN
207 #else
208 #define EXTERN extern
209 #endif /* __HelpWinVars */
210 
211 /* General application context help window */
212 EXTERN ZmHelpWinInternals *pAppHelpWin;
213 
214 
215 EXTERN char *szCwd,*szHelpDir;
216 
217 #undef EXTERN
218 
219 
220 #ifdef __cplusplus
221 };
222 #endif /* __cplusplus */
223 
224 #endif /* helpdialog.h */
Definition: helpdialog.h:40
Definition: helpdoc.h:54
Definition: helpdialog.h:32
Definition: helpdialog.h:51
Definition: helpdoc.h:75