1 /* -*- tab-width: 4 -*-
2  *
3  * Electric(tm) VLSI Design System
4  *
5  * File: edialogs.h
6  * Header file for dialog handling
7  * Written by: Steven M. Rubin, Static Free Software
8  *
9  * Copyright (c) 2000 Static Free Software.
10  *
11  * Electric(tm) is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * Electric(tm) is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with Electric(tm); see the file COPYING.  If not, write to
23  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
24  * Boston, Mass 02111-1307, USA.
25  *
26  * Static Free Software
27  * 4119 Alpine Road
28  * Portola Valley, California 94028
29  * info@staticfreesoft.com
30  */
31 
32 /*
33  *    DIALOG CONTROL
34  * d = DiaInitDialog(dia)                  initializes dialog from table "dia"
35  * d = DiaInitDialogModeless(dia, hitroutine) initializes modeless dialog, call "hitroutine" for hits
36  * item = DiaNextHit(d)                    obtains next "item" hit in dialog processing
37  * DiaDoneDialog(d)                        removes and terminates dialog
38  * DiaResizeDialog(d, wid, hei)            changes dialog size
39  * DiaBringToTop(d)                        brings the dialog to the top if it is obscured
40  *
41  *    CONTROL OF STANDARD DIALOG ITEMS
42  * DiaSetText(d, item, msg)                puts "msg" in "item" in the dialog
43  * line = DiaGetText(d, item)              gets text in "item" in the dialog
44  * DiaSetControl(d, item, value)           puts "value" in "item" in the dialog
45  * value = DiaGetControl(d, item)          gets integer in "item" in the dialog
46  * valid = DiaValidEntry(d, item)          returns true if "item" is nonblank in the dialog
47  *
48  *    SPECIAL DIALOG CONTROL
49  * DiaDimItem(d, item)                     makes "item" dimmed in the dialog
50  * DiaUnDimItem(d, item)                   makes "item" undimmed in the dialog
51  * DiaNoEditControl(d, item)               makes "item" not editable in the dialog
52  * DiaEditControl(d, item)                 makes "item" editable in the dialog
53  * DiaOpaqueEdit(d, item)                  makes "item" not display text
54  * DiaDefaultButton(d, item)               makes "item" the default button
55  * DiaChangeIcon(d, item, addr)            sets the icon in "item" to "addr"
56  *
57  *    CONTROL OF POPUP ITEMS
58  * DiaSetPopup(d, item, count, names)      makes "item" a popup with "count" entries in "names"
59  * DiaSetPopupEntry(d, item, entry)        makes popup "item" use entry "entry" as current
60  * entry = DiaGetPopupEntry(d, item)       gets current entry in popup "item"
61  *
62  *    CONTROL OF SCROLLABLE ITEMS
63  * DiaInitTextDialog(d, item, top, next, done, sortpos, flags)
64  * DiaLoadTextDialog(d, item, top, next, done, sortpos)
65  * DiaStuffLine(d, item, msg)              add line "msg" to item "item"
66  * DiaSelectLine(d, item, l)               select line "l" in item "item"
67  * DiaSelectLines(d, item, c, l)           select "c" lines in "l" in item "item"
68  * which = DiaGetCurLine(d, item)          get current line number in scroll item "item"
69  * *which = DiaGetCurLines(d, item)        get array of selected lines in scroll item "item"
70  * DiaGetNumScrollLines(d, item)           returns number of lines in scroll item "item"
71  * msg = DiaGetScrollLine(d, item, l)      get line "l" in scroll item "item"
72  * DiaSetScrollLine(d, item, l, msg)       set line "l" in scroll item "item"
73  * DiaSynchVScrolls(d, item1, item2, item3) synchronizes vertical scroll items "item1/2/3"
74  * DiaUnSynchVScrolls(d)                   removes all vertical scroll synchronization
75  *
76  *    USER-CONTROL OF DIALOG ITEMS
77  * DiaItemRect(d, item, r)                 get rectangle for item "item"
78  * DiaPercent(d, item, p)                  fill item "item" with "p" percent progress
79  * DiaRedispRoutine(d, item, routine)      call "routine" to redisplay item "item"
80  * DiaAllowUserDoubleClick(d)              double-click in user items reports "OK" item
81  * DiaFillPoly(d, item, x, y, c, r, g, b)  draw "c" points in (x,y) with color (r,g,b)
82  * DiaDrawRect(d, item, rect, r, g, b)     fill rectangle "rect" with "(r,g,b)"
83  * DiaFrameRect(d, item, r)                draw frame in rectangle "r"
84  * DiaInvertRect(d, item, r)               invert color in rectangle "r"
85  * DiaDrawLine(d, item, fx, fy, tx, ty, m) draw line from (fx,fy) to (tx,ty) mode "m"
86  * DiaSetTextSize(d, size)                 set size of text to "size"
87  * DiaGetTextInfo(d, msg, wid, hei)        get "wid" and "hei" of "msg"
88  * DiaPutText(d, item, msg, x, y)          put text "msg" at (x,y)
89  * DiaTrackCursor(d, eachdown)             track cursor calling "eachdown" on mouse move
90  * DiaGetMouse(d, x, y)                    get current mouse position into "x/y"
91  */
92 
93 #if defined(__cplusplus) && !defined(ALLCPLUSPLUS)
94 extern "C"
95 {
96 #endif
97 
98 /** @defgroup Dialogs Dialogs
99  * Dialogs API permits to describe structure and behaviour of a dialog in a platform-independent way.
100  * The structure is described by DIALOG type. Appearance of the dialog on Qt can be additionally specified in
101  * ".ui" form.
102  *
103  * The behaviour of dialog can be described either in C++ or in C style.
104  * In C++ style, the behaviour of modal dialog is specified by EDialogModal,
105  * behaviour of modeless dialogs - by EDialogModeless.
106  * These classes inherit most member functions from EDialog.
107  * The C styles routines match member functions of EDialog.
108  *
109  * The are also standard dialogs: message dialog, progress dialog.
110  */
111 /*@{*/
112 
113 /** default button numbers */
114 enum DiaButtonNumber {
115 	OK           =   1,         /**< default "OK" button number */
116 	CANCEL       =   2          /**< default "Cancel" button number */
117 };
118 
119 /** type of DIALOGITEM::type */
120 enum DiaItemType {
121 	ITEMTYPE    =  017,         /**< mask for types of item */
122 	BUTTON      =    0,         /**< standard push-button */
123 	DEFBUTTON   =    1,         /**< default push-button */
124 	CHECK       =    2,         /**< standard check-box */
125 	RADIO       =    3,         /**< standard radio-button */
126 	SCROLL      =    4,         /**< scrolling list of text */
127 	SCROLLMULTI =    5,         /**< scrolling list of text (multiple lines can be selected) */
128 	MESSAGE     =    6,         /**< non-editable text */
129 	EDITTEXT    =    7,         /**< editable text */
130 	ICON        =  010,         /**< 32x32 icon */
131 	USERDRAWN   =  011,         /**< open area for user graphics */
132 	POPUP       =  012,         /**< popup menu */
133 	PROGRESS    =  013,         /**< progress bar (0-100%) */
134 	DIVIDELINE  =  014,         /**< dividing line */
135 	INACTIVE    = 0200,         /**< flag of inactive dialog item. Set if item is dimmed */
136 	ITEMTYPEEXT =03400|ITEMTYPE,/**< mask for extended types of item */
137 	AUTOCHECK   =00400|CHECK,   /**< check-button with automatic switching */
138 	RADIOA      =00400|RADIO,   /**< radio-button from radio-group A */
139 	RADIOB      =01000|RADIO,   /**< radio-button from radio-group B */
140 	RADIOC      =01400|RADIO,   /**< radio-button from radio-group C */
141 	RADIOD      =02000|RADIO,   /**< radio-button from radio-group D */
142 	RADIOE      =02400|RADIO,   /**< radio-button from radio-group E */
143 	RADIOF      =03000|RADIO,   /**< radio-button from radio-group F */
144 	RADIOG      =03400|RADIO,   /**< radio-button from radio-group G */
145 	OPAQUEEDIT  =00400|EDITTEXT	/**< non-displayed editable text */
146 };
147 
148 /** the last parameter to "DiaInitTextDialog" */
149 enum DiaTextFlag {
150 	SCSELMOUSE   =   1,         /**< mouse clicks select in scroll area */
151 	SCSELKEY     =   2,         /**< key strokes select in scroll area */
152 	SCDOUBLEQUIT =   4,         /**< double-click in scroll area exits dialog */
153 	SCREPORT     =   8,         /**< report selections in the scroll area */
154 	SCHORIZBAR   =  16,         /**< want horizontal scroll-bar in scroll area */
155 	SCSMALLFONT  =  32,         /**< want small text in scroll area */
156 	SCFIXEDWIDTH =  64          /**< want fixed-width text in scroll area */
157 };
158 
159 /** the mode to "DiaDrawLine" */
160 enum DiaDrawLineMode {
161 	DLMODEON     =   1,			/**< draw the line on */
162 	DLMODEOFF    =   2,			/**< draw the line off */
163 	DLMODEINVERT =   3			/**< draw the line inverted */
164 };
165 
166 /** Description of dialog item.
167  * Items are contained in DIALOG.
168  */
169 typedef struct Idialogitem
170 {
171 	INTBIG        data;        /**< data storage for item (initially 0). Internal data storage
172                                   that is used by the dialog system. It should be 0 initially. */
173 	RECTAREA      r;           /**< location of item. The bounds of the item */
174 	INTBIG        type;        /**< the type of the item - OR'ed #DialogItemType. */
175 	CHAR         *msg;         /**< initial item string placed in the item */
176 } DIALOGITEM;
177 
178 /** Platform-independent description of dialog structure.
179  * It consists of series of DIALOGITEM's.
180  */
181 typedef struct
182 {
183 	RECTAREA    windowRect;    /**< location of dialog on the display */
184 	CHAR       *movable;       /**< dialog title (o if none).
185                                   If 0, no title bar will be displayed for the dialog. */
186 	INTBIG      translated;    /**< translated into foreign language */
187 	INTBIG      items;         /**< number of items in the dialog */
188 	DIALOGITEM *list;          /**< array of dialog items. An array of DIALOGITEM
189                                   structures that define the items in the dialog */
190     CHAR       *uiFile;        /**< name of Qt ".ui" file with form description */
191     INTBIG      briefHeight;   /**< height of brief part of extensible dialog.
192                                   If 0, dialog is not extensible */
193 } DIALOG;
194 
195 #ifdef __cplusplus
196 
197 class EDialogPrivate;
198 #ifdef USEQT
199 class QStrList;
200 #endif
201 
202 /** The EDialog is abstract class that provides platform-independent dialogs API.
203  * There are two kinds of dialog - modal and modeless. They are implemented by
204  * EDialogModal and EDialogModeless subclasses. In any case itemHitAction event
205  * handler receives user events. The event handler can control the dialog using
206  * EDialog member functions from dialog control and item control groups.
207  * Dialog description is loaded from DIALOG structure. On Qt DIALOG::uiFile can
208  * contain filename with ".ui" form which defines layout of stretchable dialog.
209  */
210 
211 class EDialog
212 {
213 	friend class EDialogPrivate;
214 public:
215 	/* Dialog control */
216 	/** Abstract dialog constructor.
217 	 * Dialogs usually are created by EDialogModal and EDialogModeless constructors.
218      */
219 	EDialog(DIALOG *dialog);
220 #if defined(__GNUC__) && __GNUC__ >= 3
221 	virtual ~EDialog(); //!< Destroys the dialog
222 #else
223 	~EDialog(); //!< Destroys the dialog
224 #endif
225 	/** This function can be reimplemented in a subclass to return dialog state to initial.
226      * It is called when it is necessary to reset state of dialog to initial (for example,
227      * after library saving.
228 	 */
229 	virtual void reset();
230 	/** obtains next item hit in dialog processing (obsolete) .
231 	 *	This function is obsolete. Use EDialogModal::exec() instead
232 	 */
233 	INTBIG nextHit();
234 	/** This event handler, for item \a itemHit, can be reimplemented in a subclass to receive events for the dialog.
235 	 * The \a itemHit is a item, hit by user.
236 	 */
237 	virtual void itemHitAction(INTBIG itemHit);
238 
239 	/** \name C++ API - Dialog control */
240 	/*@{*/
241 	//! If showIt is TRUE, the dialog's extension is shown; otherwise the extension is hidden.
242     void showExtension( BOOLEAN showIt );
243     BOOLEAN extension(); //!< Return TRUE, if the dialog's extension is shown (will be changed)
244 	/** changes dialog size (obsolete).
245 		This function is obsolete. Use EDialog::showExtension instead.
246 	 */
247 	void resizeDialog(INTBIG wid, INTBIG hei);
248 	void bringToTop(); //!< brings dialog to top.
249 	/*@}*/
250 
251 	/** \name C++ API - Control of standard dialog items */
252 	/*@{*/
253 	void setText(INTBIG item, CHAR *msg); //!< puts \a msg in \a item in the dialog
254 	CHAR *getText(INTBIG item); //!< gets text in \a item in the dialog
255 	void setControl(INTBIG item, INTBIG value); //!< puts \a value in \a item in the dialog
256 	INTBIG getControl(INTBIG item); //!< gets integer in \a item in the dialog
257 	BOOLEAN validEntry(INTBIG item); //!< returns true if \a item is nonblank in the dialog
258 	/*@}*/
259 
260 	/** \name C++ API - Special dialog control */
261 	/*@{*/
262 	void dimItem(INTBIG item); //!< makes \a item dimmed in the dialog */
263 	void unDimItem(INTBIG item); //!< makes \a item undimmed in the dialog
264 	void noEditControl(INTBIG item); //!< makes \a item not editable in the dialog
265 	void editControl(INTBIG item); //!< makes \a item editable in the dialog
266 	void opaqueEdit(INTBIG item); //!< makes \a item not display text
267 	void defaultButton(INTBIG item); //!< makes \a item the default button
268 	void changeIcon(INTBIG item, UCHAR1 *icon); //!< sets the icon in \a item to \a addr
269 	/*@}*/
270 
271 	/** \name C++ API -  Control of popup items */
272 	/*@{*/
273 	void setPopup(INTBIG item, INTBIG count, CHAR **names); //!< makes \a item a popup with \a count entries in \a names
274 	void setPopupEntry(INTBIG item, INTBIG entry); //!< makes popup \a item use entry \a entry as current
275 	INTBIG getPopupEntry(INTBIG item); //!< gets current entry in popup \a item
276 	/*@}*/
277 
278 	/** \name C++ API - Control of scrollable items */
279 	/*@{*/
280 	/** This routine initializes the scroll-list \a item to contain strings obtained by the
281      * \a toplist, \a nextinlist and \a donelist routines in the same way as initTextDialog does.
282      * The scroll list has flags set to \a flags, which can be any combination of the following:
283 	 * ::SCSELMOUSE to allow mouse selection in the list; ::SCSELKEY to allow keystrokes to select
284      * items; ::SCDOUBLEQUIT to allow double-clicks on the item to terminate dialog; ::SCREPORT to
285      * report all hits in the scroll list; ::SCHORIZBAR to display horizontal scroll-bar in the list;
286      * ::SCSMALLFONT to display the list with a small font; and ::SCFIXEDWIDTH to display the list with
287      * a fixed-width font.
288      */
289 	void initTextDialog(INTBIG item, BOOLEAN (*toplist)(CHAR **), CHAR *(*nextinlist)(void),
290 			void (*donelist)(void), INTBIG sortpos, INTBIG flags);
291 	/** This routine reloads the scroll-list \a item.
292      * The scroll-list \a item will contain strings obtained by \a toplist, \a nextinlist,
293      * and \a donelist routines. The routine first calls \a toplist to initialize the reporting
294      * of strings (it takes the address of a string that is the starting point for parsing and it
295      * should return nonzero), then makes repeative calls to \a nextinlist which returns strings
296      * to be added to the scroll-list item (returns zero when done), and finally calls \a donelist
297      * to terminate the reporting of strings. If no initial list is desired, use the routines
298      * ::DiaNullDlogList, ::DiaNullDlogItem, ::DiaNullDlogDone. The items are sorted in character
299      * position \a sortpos (-1 to not sort). \sa initTextDialog
300 	 */
301 	void loadTextDialog(INTBIG item, BOOLEAN (*toplist)(CHAR **), CHAR *(*nextinlist)(void),
302 			void (*donelist)(void), INTBIG sortpos);
303 	void stuffLine(INTBIG item, CHAR *line); //!< add \a line to \a item
304 	void selectLine(INTBIG item, INTBIG line); //!< select line \a l in \a item
305 	void selectLines(INTBIG item, INTBIG count, INTBIG *lines); //!< select \a count lines in \a lines in \a item
306 	INTBIG getCurLine(INTBIG item); //!< get current line number in scroll \a item
307 	INTBIG *getCurLines(INTBIG item); //!< get array of selected lines in scroll \a item
308 	INTBIG getNumScrollLines(INTBIG item); //!< returns number of lines in scroll \a item
309 	CHAR *getScrollLine(INTBIG item, INTBIG line); //!< get \a line in scroll \a item
310 	void setScrollLine(INTBIG item, INTBIG line, CHAR *msg); //!< set line \a which in scroll \a item
311 	void synchVScrolls(INTBIG item1, INTBIG item2, INTBIG item3); //!< synchronizes vertical scroll items \a item1 \a item2 \a item3
312 	void unSynchVScrolls(); //!< removes all vertical scroll synchronization
313 	/*@}*/
314 
315 	/** \name C++ API - User-control of dialog items */
316 	/*@{*/
317 	void itemRect(INTBIG item, RECTAREA *rect); //!< get rectangle for \a item
318 	void percent(INTBIG item, INTBIG percent); //!< fill \a item with \a percent progress
319 	void redispRoutine(INTBIG item, void (*routine)(RECTAREA *rect, void *dia)); //!< call \a routine to redisplay \a item
320 	void allowUserDoubleClick(void); //!< double-click in user items reports #OK item
321 	//! draw \a count points in (\a xv, \a yv) with color (\a r, \a g, \a b)
322 	void fillPoly(INTBIG item, INTBIG *xv, INTBIG *yv, INTBIG count, INTBIG r, INTBIG g, INTBIG b);
323 	void drawRect(INTBIG item, RECTAREA *rect, INTBIG r, INTBIG g, INTBIG b); //!< fill rectangle \a rect with "(\a r, \a g, \a b)
324 	void frameRect(INTBIG item, RECTAREA *r); //!< draw frame in rectangle \a r
325 	void invertRect(INTBIG item, RECTAREA *r); //!< invert color in rectangle \a r
326 	//! draw line from (\a fx, \a fy) to (\a tx, \a ty) with \a mode
327 	void drawLine(INTBIG item, INTBIG fx, INTBIG fy, INTBIG tx, INTBIG ty, INTBIG mode);
328 	void setTextSize(INTBIG size); //!< set size of text to \a size
329 	void getTextInfo(CHAR *msg, INTBIG *wid, INTBIG *hei); //!< get \a wid and \a hei of \a msg
330 	void putText(INTBIG item, CHAR *msg, INTBIG x, INTBIG y); //!< put text \ msg at (\a x, \a y)
331 	void trackCursor(void (*eachdown)(INTBIG x, INTBIG y)); //!< track cursor calling \a eachdown on mouse move
332 	void getMouse(INTBIG *x, INTBIG *y); //!< get current mouse position into \a x/ \a y
333 	/*@}*/
334 
itemDesc()335 	DIALOG *itemDesc() { return itemdesc; } //!< DIALOG structure, describing this dialog
336 #ifdef USEQT
337 	static QStrList *itemNamesFromUi( CHAR *uiFile, BOOLEAN ext = FALSE );
338 #endif
339 protected:
340 	EDialogPrivate *d;
341 private:
342     BOOLEAN isExtended;
343 	DIALOG *itemdesc;
344 };
345 
346 /** The EDialogModal is a class that provides platform-independent modal dialogs API */
347 
348 class EDialogModal: public EDialog
349 {
350 public:
351 	EDialogModal(DIALOG *dialog);
352 	enum DialogCode { Rejected, Accepted };
353 	DialogCode exec();
354 protected:
accept()355 	void accept() { result = Accepted; in_loop = FALSE; }
reject()356 	void reject() { result = Rejected; in_loop = FALSE; }
357 private:
358 	BOOLEAN in_loop;
359 	DialogCode result;
360 };
361 
362 /** The EDialogModeless is a class that provides platform-independent modeless dialogs API.
363  * Modeless dialog operates independently of other windows in the same application.
364  * Call show() to display a modeless dialog. show() returns immediately so the flow of control
365  * will continue in the calling code. Call hide() to hide dialog from screen.
366  * EDialog::itemHitAction event handler receives user events.
367  */
368 
369 class EDialogModeless: public EDialog
370 {
371 public:
372 	EDialogModeless(DIALOG *dialog); //!< Creates modeless dialog from description
373 	void show(); //!< show dialog. Control returns immediately
374 	void hide(); //!< hide dialog. Dialog is not destroyed
375 	BOOLEAN isHidden(); //!< returns TRUE, if the dialog is hidden
376 };
377 #endif
378 
379 /** \name C API - Dialog control */
380 /*@{*/
381 /** initializes dialog from table \a dialog.
382  * This routine displays a dialog defined by \a dialog and set it to be the current dialog for
383  * subsequent calls. If there is already a dialog on the screen, this one replaces it as the
384  * curent one.
385  * Returns the address of the dialog object (0 if dialog cannot be initialized).
386  * \sa EDialogModal::EDialogModal(DIALOG *dialog)
387  */
388 void   *DiaInitDialog(DIALOG *dialog);
389 /** initializes modeless dialog, call \a itemhit for hits.
390  * Routine to initialize dialog \a dialog in modeless style, calling
391  * \a itemhit routine with for each hit. First argument of \a itemhit is the \a handler,
392  * second is the number of hitted item,
393  * \sa EDialogModeless::EDialogModeless(DIALOG *dialog)
394  */
395 void   *DiaInitDialogModeless(DIALOG *dialog, void (*itemhit)(void *dia, INTBIG item));
396 /** removes and terminates dialog.
397  * This routine terminates the dialog \a dia and removes it from the screen
398  */
399 void    DiaDoneDialog(void *dia);
400 /** changes dialog size.
401  * This routine changes the size of the dialog \a dia to width \a wid and height \a hei
402  */
403 void    DiaResizeDialog(void *dia, INTBIG wid, INTBIG hei);
404 /** brings dialog to top.
405  * This routine forces dialog \a dia be displayed on top of other windows
406  */
407 void    DiaBringToTop(void *dia);
408 /** obtains next item hit in dialog processing.
409  * This routine handles actions and returns the next item that is hit in the dialog \a dia.
410  */
411 INTBIG  DiaNextHit(void *dia);
412 /*@}*/
413 
414 /** \name C API - Control of standard dialog items */
415 /*@{*/
416 /** puts \a msg in \a item in the dialog
417  */
418 void    DiaSetText(void *dia, INTBIG item, CHAR *msg);
419 /** gets text in \a item in the dialog
420  */
421 CHAR   *DiaGetText(void *dia, INTBIG item);
422 /** puts \a value in \a item in the dialog
423  */
424 void    DiaSetControl(void *dia, INTBIG item, INTBIG value);
425 /** gets integer in \a item in the dialog
426  */
427 INTBIG  DiaGetControl(void *dia, INTBIG item);
428 /** returns true if \a item is nonblank in the dialog
429  */
430 BOOLEAN DiaValidEntry(void *dia, INTBIG item);
431 /*@}*/
432 
433 /** \name C API - Special dialog control */
434 /*@{*/
435 /** makes \a item dimmed in the dialog */
436 void    DiaDimItem(void *dia, INTBIG item);
437 /** makes \a item undimmed in the dialog
438  */
439 void    DiaUnDimItem(void *dia, INTBIG item);
440 /** makes \a item not editable in the dialog
441  */
442 void    DiaNoEditControl(void *dia, INTBIG item);
443 /** makes \a item editable in the dialog
444  */
445 void    DiaEditControl(void *dia, INTBIG item);
446 /** makes \a item not display text
447  */
448 void    DiaOpaqueEdit(void *dia, INTBIG item);
449 /** makes \a item the default button
450  */
451 void    DiaDefaultButton(void *dia, INTBIG item);
452 /** sets the icon in \a item to \a addr
453  */
454 void    DiaChangeIcon(void *dia, INTBIG item, UCHAR1 *addr);
455 /*@}*/
456 
457 /** \name C API - Control of popup items */
458 /*@{*/
459 /** makes \a item a popup with \a count entries in \a names
460  */
461 void    DiaSetPopup(void *dia, INTBIG item, INTBIG count, CHAR **names);
462 /** makes popup \a item use entry \a entry as current
463  */
464 void    DiaSetPopupEntry(void *dia, INTBIG item, INTBIG entry);
465 /** gets current entry in popup \a item
466  */
467 INTBIG  DiaGetPopupEntry(void *dia, INTBIG item);
468 /*@}*/
469 
470 /** \name C API - Control of scrollable items */
471 /*@{*/
472 /** \sa EDialog::initTextDialog
473   */
474 void    DiaInitTextDialog(void *dia, INTBIG item, BOOLEAN (*toplist)(CHAR **),
475 			CHAR *(*nextinlist)(void), void (*donelist)(void),
476             INTBIG sortpos, INTBIG flags);
477 /** \sa EDialog::loadTextDialog
478  */
479 void    DiaLoadTextDialog(void *dia, INTBIG item, BOOLEAN (*toplist)(CHAR **),
480 			CHAR *(*nextinlist)(void), void (*donelist)(void), INTBIG sortpos);
481 /** add line \a msg to \a item
482  */
483 void    DiaStuffLine(void *dia, INTBIG item, CHAR *line);
484 /** select line \a l in \a item
485  */
486 void    DiaSelectLine(void *dia, INTBIG item, INTBIG which);
487 /** select \a c lines in \a l in \a item
488  */
489 void    DiaSelectLines(void *dia, INTBIG item, INTBIG count, INTBIG *lines);
490 /** get current line number in scroll \a item
491  */
492 INTBIG  DiaGetCurLine(void *dia, INTBIG item);
493 /** get array of selected lines in scroll \a item
494  */
495 INTBIG *DiaGetCurLines(void *dia, INTBIG item);
496 /** returns number of lines in scroll \a item
497  */
498 INTBIG  DiaGetNumScrollLines(void *dia, INTBIG item);
499 /** get line \a l in scroll \a item
500  */
501 CHAR   *DiaGetScrollLine(void *dia, INTBIG item, INTBIG which);
502 /** set line \a which in scroll \a item
503  */
504 void    DiaSetScrollLine(void *dia, INTBIG item, INTBIG which, CHAR *msg);
505 /** synchronizes vertical scroll items \a item1 \a item2 \a item3
506  */
507 void    DiaSynchVScrolls(void *dia, INTBIG item1, INTBIG item2, INTBIG item3);
508 /** removes all vertical scroll synchronization
509  */
510 void    DiaUnSynchVScrolls(void *dia);
511 /*@}*/
512 
513 /** \name C API - User-control of dialog items */
514 /*@{*/
515 /** get rectangle for \a item
516  */
517 void    DiaItemRect(void *dia, INTBIG item, RECTAREA *rect);
518 /** fill \a item with \a p percent progress
519  */
520 void    DiaPercent(void *dia, INTBIG item, INTBIG p);
521 /** call \a routine to redisplay \a item
522  */
523 void    DiaRedispRoutine(void *dia, INTBIG item, void (*routine)(RECTAREA *rect, void *dia));
524 /** double-click in user items reports #OK item
525  */
526 void    DiaAllowUserDoubleClick(void *dia);
527 /** draw \a count points in (\a x, \a y) with color (\a r, \a g, \a b)
528  */
529 void    DiaFillPoly(void *dia, INTBIG item, INTBIG *x, INTBIG *y, INTBIG count, INTBIG r, INTBIG g, INTBIG b);
530 /** fill rectangle \a rect with "(\a r, \a g, \a b)
531  */
532 void    DiaDrawRect(void *dia, INTBIG item, RECTAREA *rect, INTBIG r, INTBIG g, INTBIG b);
533 /** draw frame in rectangle \a r
534  */
535 void    DiaFrameRect(void *dia, INTBIG item, RECTAREA *r);
536 /** invert color in rectangle \a r
537  */
538 void    DiaInvertRect(void *dia, INTBIG item, RECTAREA *r);
539 /** draw line from (\a fx, \a fy) to (\a tx, \a ty) with \a mode
540  */
541 void    DiaDrawLine(void *dia, INTBIG item, INTBIG fx, INTBIG fy, INTBIG tx, INTBIG ty, INTBIG mode);
542 /** set size of text to \a size
543  */
544 void    DiaSetTextSize(void *dia, INTBIG size);
545 /** get \a wid and \a hei of \a msg
546  */
547 void    DiaGetTextInfo(void *dia, CHAR *msg, INTBIG *wid, INTBIG *hei);
548 /** put text \a msg at (\a x, \a y)
549  */
550 void    DiaPutText(void *dia, INTBIG item, CHAR *msg, INTBIG x, INTBIG y);
551 /** track cursor calling \a eachdown on mouse move
552  */
553 void    DiaTrackCursor(void *dia, void (*eachdown)(INTBIG x, INTBIG y));
554 /** get current mouse position into \a x/ \a y
555  */
556 void    DiaGetMouse(void *dia, INTBIG *x, INTBIG *y);
557 /*@}*/
558 
559 /** routine to show message in a message dialog */
560 void    DiaMessageInDialog(CHAR*, ...);
561 
562 /** routine used by tools to create private dialogs.
563  * The parameter \a terminputkeyword is the keyword that the "terminal input" command
564  * will use to identify this dialog (zero if none). The parameter \a getlinecomp is the
565  * command completion objects that, when parsed, will invoke the dialog. The parameter
566  * \a routine is the code that runs the dialog.
567  */
568 void    DiaDeclareHook(CHAR *terminputkeyword, COMCOMP *getlinecomp, void (*routine)(void));
569 /** routine used for toplist argument EDialog::initTextDialog and EDialog::loadTextDialog if empty initial list is desired */
570 BOOLEAN DiaNullDlogList(CHAR**);
571 /** routine used for nextinlist argument EDialog::initTextDialog and EDialog::loadTextDialog if empty initial list is desired */
572 CHAR   *DiaNullDlogItem(void);
573 /** routine used for donelist argument EDialog::initTextDialog and EDialog::loadTextDialog if empty initial list is desired */
574 void    DiaNullDlogDone(void);
575 /** routine translates dialog \a dia into a foreign-language.
576  * It is called internally by the initialization routine and need not be used in standard dialog sequences
577  */
578 void    DiaTranslate(DIALOG *dia);
579 /** routine to close (hide() and reset()) all modeless dialogs */
580 void    DiaCloseAllModeless();
581 
582 /** \name Progress dialog
583  * Progress dialog provides feedback on the progress of a slow operation.
584  * It contains progress bar, text label and caption text. On Qt progress dialog
585  * is shown only for long operations ( more than 4 sec ) and is hidden when
586  * (\a progress == \a totalSteps)
587  */
588 /*@{*/
589 /** init and show progress dialog.
590  * If \a label is 0 "Reading file..." label is shown.
591  * If \a caption is 0, caption is not shown.
592  * Returned pointer is passed as dia argument to other progress bar routines
593  */
594 void   *DiaInitProgress(CHAR *label, CHAR *caption);
595 /** update progress bar of progress dialog.
596  * Progress bar will show \a dia to \a progress / \a totalSteps * 100 percent.
597  * On Qt dialog is hidden if \a progress == \a totalSteps .
598  */
599 void    DiaSetProgress(void *dia, INTBIG progress, INTBIG totalSteps);
600 /** change label of progress dialog */
601 void    DiaSetTextProgress(void *dia, CHAR *label);
602 /** get lable of progress dialog */
603 CHAR   *DiaGetTextProgress(void *dia);
604 /** change caption of progress dialog */
605 void    DiaSetCaptionProgress(void *dia, CHAR *caption);
606 /** destroy progress dialog */
607 void    DiaDoneProgress(void *dia);
608 /*@}*/
609 
610 /*@}*/
611 
612 extern DIALOG us_eprogressdialog;
613 extern DIALOG us_progressdialog;
614 
615 #if defined(__cplusplus) && !defined(ALLCPLUSPLUS)
616 }
617 #endif
618