UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Zm.h
1 /* Zm.h */
2 /* $Revision: 1.22 $ Zm.h $Date: 2009/08/17 10:26:30 $ */
3 #ifndef __Zm_h
4 #define __Zm_h
5 
6 #include <time.h>
7 
8 #include <X11/cursorfont.h>
9 #include <X11/Intrinsic.h>
10 #include <Xm/Xm.h>
11 #include <Xm/TextF.h>
12 
13 #include <mix/Types.h>
14 
15 
16 #ifdef __cplusplus
17 extern "C"
18 {
19 #endif /* __cplusplus */
20 
21 /***********************************************************************
22  * Macro for quick definition of a callback
23  ***********************************************************************/
24 #define ZmDefineCB(NameCB) void NameCB (Widget w, \
25  XtPointer pUserData, \
26  XtPointer pCallData)
27 
28 /*************************************************************
29  * Application specific and commonly used dialogs.
30  *************************************************************/
31 
32 /* Status of dialog completition */
33 typedef enum
34 {
35  ZmNONE, /* no actions has been done */
36  ZmOK_PRESSED, /* default OK action has been done */
37  ZmCANCEL_PRESSED, /* default CANCEL action has benn done */
38  ZmEMPTY /* insufficient data */
39 
40 } ZmDialogCompletition;
41 
42 
43 /*************************************************************
44  * Process some events by XToolkit and Motif.
45  *************************************************************/
46 
47 #define ZM_EVENTS_NUMBER 15
48 
49 void ZmProcessEvents (Widget w, int nEvents);
50 
51 
52 /*************************************************************
53  * Changing button states: Arm/Disarm, Sensitive/Insensitive.
54  *************************************************************/
55 void ChangeArmState (Widget w);
56 void SetSensitivity (Widget w, Logic flag);
57 
58 
59 /***********************************************************************
60  * The function composes the list of top level windows resides on
61  * given display. Returns number of windows and list of them in
62  * *tlist, which must be free() after usage.
63  ***********************************************************************/
64 unsigned XListToplevelWindows (Display* dpy, Window root,
65  Window** tlist);
66 
67 
68 /***********************************************************************
69  * The function checks for given window id existance. Only toplevel
70  * windows are can be checked in this manner. "Toplevel" means
71  * WM-managed.
72  ***********************************************************************/
73 Logic XCheckToplevelWindow (Display* dpy, Window wid);
74 
75 
76 /*************************************************************
77  * Format to XmString directly.
78  *************************************************************/
79 
80 #define XMPRINTF_BUFSIZE 1024
81 
82 XmString xmprintf (const char* format, ...);
83 
84 
85 /***********************************************************************
86  * Find the toplevel from the given widget.
87  ***********************************************************************/
88 Widget ZmToplevel (Widget w);
89 
90 /*************************************************************
91  * Print to stdout reverse path to given widget just for debug
92  *************************************************************/
93 void ZmFullWidgetName (Widget w);
94 
95 /*************************************************************
96  * Set bitmap as an icon for label and button.
97  *************************************************************/
98 void ZmAssignIconFromBitmapData (Widget w, char* data,
99  int width, int height);
100 
101 /* Structure for inlined bitmaps representation */
102 typedef struct {
103  char *data;
104  int width;
105  int height;
107 
108 #define ZmInlineXBM(root) root##_bits,root##_width,root##_height
109 
110 #define ZmAssignIconFromBitmap(w,root) \
111  ZmAssignIconFromBitmapData(w,root##_bits,root##_width,root##_height)
112 
113 /*************************************************************
114  * XmTextField utilities
115  *************************************************************/
116 
117 /* Compose entered value with old one in XmTextField.
118  Return temporary allocated buffer. */
119 char* ZmTextFieldNewValue (const XmTextVerifyPtr verify,
120  const char* prevValue);
121 
122 typedef enum
123 {
124  ZmTEXT_ACCEPT, /* good text contents */
125  ZmTEXT_REJECT, /* bad text contents */
126  ZmTEXT_BAD_REASON, /* can't handle given reason */
127  ZmTEXT_BAD_CALL /* calling error */
128 
129 } ZmTextVerified;
130 
131 /* Verify entered characters for validity as a seismic
132  modification name */
133 ZmTextVerified ZmVerifyModText (Widget wTextField,
134  XmTextVerifyPtr verify);
135 
136 
137 /*************************************************************
138  * Cursor API
139  * X cursors: XC_watch
140  *************************************************************/
141 
142 /* Set cursor in given window. */
143 void ZmSetCursor (Display* dpy, Window wid, unsigned int xcursor);
144 
145 /* Set cursor in given widget. */
146 void ZmSetCursorInWidget (Widget w, unsigned int xcursor);
147 
148 /* Reset cursor in given window. */
149 void ZmResetCursor (Display* dpy, Window wid);
150 
151 /* Reset cursor in given widget. */
152 void ZmResetCursorInWidget (Widget w);
153 
154 /* Free all cursors. */
155 void ZmFreeAllCursors (Display* dpy);
156 
157 
158 /*************************************************************
159  * Save image to raster file.
160  *************************************************************/
161 
164 typedef struct
165 {
168  char *szDateTime;
170 
171 
176 ErrCode ZmWriteImageToTIFF (const char* path,
177  Display* dpy, Drawable did, XRectangle* area,
178  ZmImageRemarks* remarks);
179 
184 ErrCode ZmWriteImageToPNG (const char* path,
185  Display* dpy, Drawable did, XRectangle* area,
186  ZmImageRemarks* remarks);
187 
192 void ZmSaveImage (Widget wParent, Drawable did, XRectangle* area,
193  const char* szDescription);
194 
195 
196 /*************************************************************
197  * Operations over drawables.
198  *************************************************************/
199 
201 Pixmap ZmCreateAndCopyPixmap (Display* dpy, Drawable src);
202 
204 void ZmFillDrawable (Display* dpy, Drawable dst, const char* color);
205 
207 void ZmCopyDrawable (Display* dpy, Drawable dst, Drawable src);
208 
209 
210 /*************************************************************
211  * Progress indicator API
212  * (implemented as a wrapper over ZmProgress).
213  *************************************************************/
214 
216 typedef void* ProgressStruct;
217 
219 typedef enum
220  {
221  PROGRESS_RUNNING = 0,
222  PROGRESS_COMPLETED,
223  PROGRESS_BREAK,
224  PROGRESS_ERROR
226  } ProgressState;
227 
229 typedef float ZmPrMeter;
230 
232 ProgressState ZmCreateProgressIndicator (ProgressStruct* ps,
233  Widget wParent, /*Logic modalness,*/
234  double begin_v, double end_v);
235 
237 void ZmDestroyProgressIndicator (ProgressStruct* ps);
238 
240 ProgressState ZmProgressStep (ProgressStruct* ps, double step_v);
241 
243 void ZmProgressMsg (ProgressStruct* ps, const char* fmt, ...);
244 
246 void Fortran(prgindstep)(float* step_v, int* state);
247 
248 
249 #ifdef __DefaultProgressIndicator
250 /* real definition */
251 #define ZmEXTERN_VAR
252 #else /* __DefaultProgressIndicator */
253 /* declaration */
254 #define ZmEXTERN_VAR extern
255 #endif /* __DefaultProgressIndicator */
256 
257 ZmEXTERN_VAR ProgressStruct psDefaultProgress;
258 
259 #undef ZmEXTERN_VAR
260 
261 
262 #ifdef __cplusplus
263 };
264 #endif /* __cplusplus */
265 
266 #endif /* Zm.h */
Definition: Zm.h:102
char * szDateTime
Definition: Zm.h:168
char * szDescription
Definition: Zm.h:167
Definition: Zm.h:164
char * szPictureName
Definition: Zm.h:166