File: libmx.h

package info (click to toggle)
xcopilot 1%3A0.6.6
  • links: PTS
  • area: contrib
  • in suites: potato, slink
  • size: 3,252 kB
  • ctags: 3,406
  • sloc: ansic: 37,932; cpp: 1,918; sh: 329; makefile: 68
file content (306 lines) | stat: -rw-r--r-- 10,754 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
/*****************************************************************************

    Copyright (C) 1994,1997 Ivan A. Curtis.  All rights reserved.

This code must not be re-distributed without these copyright notices intact.

*******************************************************************************
*******************************************************************************

Filename:	~icurtis/src/mx/basic.h

Description:	

Update History:   (most recent first)
   I. Curtis   9-Apr-97 12:02 -- Updated
   I. Curtis  22-Mar-94 23:11 -- Created.

******************************************************************************/
#ifndef __MX_BASIC
#define __MX_BASIC

#ifndef NULL
#define NULL 0
#endif

#include "X11/Xlib.h"
#include "X11/Xutil.h"

#define MXItemFlag_Left       0
#define MXItemFlag_Center     1
#define MXItemFlag_Right      2
#define MXItemMask_Align      3
#define MXItemFlag_Disabled   4
#define MXItemFlag_Hilite     8
#define MXItemFlag_Underlined 16
#define MXItemFlag_Overlined  32
#define MXItemFlag_Boxed      48

#define mx_min(a, b) ((a) < (b) ? (a) : (b))
#define mx_max(a, b) ((a) > (b) ? (a) : (b))

/***************************************
 * A menu item has text and attributes *
 ***************************************/
typedef struct _mx_menu_item {
  int flag;			/* alignment, disabled etc. */
  char *text;			/* the text string */
  int length;			/* length of the text string */
} mx_menu_item;

/****************************************
 * An appearance structure contains the *
 * parameters which define the overall  *
 * appearance of menus etc.             *
 ****************************************/
typedef struct _mx_appearance {
  int win_border;		/* size of window border (pixels) */
  int item_border;		/* amount of room around each item (pixels) */
  XFontStruct *font;		/* a font structure */
  int em, ascent, descent;	/* font characteristics (pixels) */
  GC gcf, gcd;			/* flipping and drawing GCs */
  Pixmap stipple;		/* a bitmap for stipple patterns */
  Pixmap button;		/* a bitmap for buttons */
  int button_width,
    button_height;
  int (*expose_fun)(XEvent *event);  /* function to call for exposure */
} mx_appearance;

typedef struct _mx_panel {
  mx_appearance *app;		/* the appearance structure */
  int width, height;		/* dimension of each panel item (pixels) */
  int n_items;			/* number of items in panel */
  mx_menu_item *item;		/* pointer to an array of items */
  int first_item, last_item;	/* sub-range of items used */
} mx_panel;


extern Window mx_window_open(Display *display, int screen, char *title,
			     int WindowXSize, int WindowYSize,
			     int WindowBorder);

extern mx_panel *mx_panel_create(Display *display, mx_appearance *app,
				 int n_items, mx_menu_item *mi);

extern mx_appearance *mx_appearance_create(Display *display, int screen,
					   Window window,
					   char *font_name,
					   int win_border, int item_border,
					   int pix_width, int pix_height,
					   char *pix_bits,
					   int (*expose_fun)(XEvent *event));

extern void mx_items_draw(Display *display, Window window, mx_appearance *app,
			  mx_menu_item *item, int start_item, int max_items,
			  int width, int height,
			  int tlx, int tly);

extern void mx_adjust_xy(Display *display, int width, int height,
			 int *x, int *y);

extern Window mx_transient_window_open(Display *display, int screen,
				       int border, int xpos, int ypos,
				       int xsize, int ysize);

extern void mx_window_close(Display *display, Window window);

#endif
/*****************************************************************************

    Copyright (C) 1994,1997 Ivan A. Curtis.  All rights reserved.

This code must not be re-distributed without these copyright notices intact.

*******************************************************************************
*******************************************************************************

Filename:	~icurtis/src/mx/alert.h

Description:	

Update History:   (most recent first)
   I. Curtis   9-Apr-97 12:02 -- Updated
   I. Curtis  22-Mar-94 23:11 -- Created.

******************************************************************************/

typedef struct _mx_alert {
  Window window;
  mx_appearance *app;		/* the appearance structure */
  int width, height;		/* dimension of each panel (pixels) */
  int inside;			/* flag indicating focus */
  int momentary;
  int start_item;
  int max_items;		/* number of items in alert */
  mx_menu_item *item;		/* pointer to array of items */
} mx_alert;

extern int mx_popup_alert(Display *display, int screen, mx_panel *main_panel,
			  mx_panel *resp_panel,
			  int *x, int *y);

extern int mx_alert_event(Display *display, int screen, XEvent *event,
			  mx_alert *alert, int *done, int *x, int *y);
/*****************************************************************************

    Copyright (C) 1994,1997 Ivan A. Curtis.  All rights reserved.

This code must not be re-distributed without these copyright notices intact.

*******************************************************************************
*******************************************************************************

Filename:	~icurtis/src/mx/menu.h

Description:	

Update History:   (most recent first)
   I. Curtis   9-Apr-97 12:02 -- Updated
   I. Curtis  22-Mar-94 23:11 -- Created.

******************************************************************************/

typedef struct _mx_menu {
  Window window;
  mx_appearance *app;		/* the appearance structure */
  int width, height;		/* dimension of each menu item (pixels) */
  int item_width;		/* width of largest menu item (pixels) */
  int n_items;			/* number of items in menu */
  mx_menu_item *item;		/* pointer to array of items */
  int start_item, max_items;	/* sub-range of items used */
  int inside;			/* flag indicating focus */
  int momentary;
  int choice;			/* -1 for no choice */
  int cur_x, cur_y;		/* cursor position in window */
  int cur_w, cur_h;		/* cursor size */
} mx_menu;

extern mx_menu *mx_menu_create(Display *display, mx_appearance *app,
			       int n_items, mx_menu_item *mi);

extern int mx_popup_menu(Display *display, int screen, mx_panel *panel,
			 int *x, int *y, int momentary);

extern int mx_menu_event(Display *display, int screen, XEvent *event,
			 mx_menu *menu, int *done, int *x, int *y);
/*****************************************************************************

    Copyright (C) 1994,1997 Ivan A. Curtis.  All rights reserved.

This code must not be re-distributed without these copyright notices intact.

*******************************************************************************
*******************************************************************************

Filename:	~icurtis/src/mx/request.h

Description:	

Update History:   (most recent first)
   I. Curtis   9-Apr-97 12:02 -- Updated
   I. Curtis  22-Mar-94 23:11 -- Created.

******************************************************************************/

typedef struct _mx_request {
  Window window;
  mx_appearance *app;		/* the appearance structure */
  int width, height;		/* dimension of request window (pixels) */
  int inside;			/* flag indicating focus */
  int cur_x, cur_y;		/* cursor position in window */
  int cur_w, cur_h;		/* cursor size */
  int cp;			/* cusor position in text */
  char *text;			/* request string */
  int length;			/* length of request string */
  int max_len;			/* maximum length of request string */
} mx_request;

extern int mx_popup_request(Display *display, int screen, mx_panel *panel,
			    int *x, int *y, char *text, int max_len);
/*****************************************************************************

    Copyright (C) 1994,1997 Ivan A. Curtis.  All rights reserved.

This code must not be re-distributed without these copyright notices intact.

*******************************************************************************
*******************************************************************************

Filename:	~icurtis/src/mx/select.h

Description:	

Update History:   (most recent first)
   I. Curtis   9-Apr-97 12:02 -- Updated
   I. Curtis  22-Mar-94 23:11 -- Created.

******************************************************************************/

typedef struct _mx_scroll {
  Window window;
  mx_appearance *app;		/* the appearance structure */
  int width, height;		/* dimension of scroll window (pixels) */
  mx_menu *menu;		/* pointer to menu being scrolled */
  int inside;			/* flag indicating focus */
  int cur_x, cur_y;		/* cursor position in window */
  int cur_w, cur_h;		/* cursor size */
  int min_item, max_item;
} mx_scroll;

extern int mx_popup_select(Display *display, int screen, mx_panel *panel,
			   int *x, int *y, int max_items);
/*****************************************************************************

    Copyright (C) 1994,1997 Ivan A. Curtis.  All rights reserved.

This code must not be re-distributed without these copyright notices intact.

*******************************************************************************
*******************************************************************************

Filename:	~icurtis/src/mx/buttons.h

Description:	

Update History:   (most recent first)
   I. Curtis   9-Apr-97 12:02 -- Updated
   I. Curtis  22-Mar-94 23:11 -- Created.

******************************************************************************/

typedef struct _mx_button {
  Window window;
  mx_appearance *app;		/* the appearance structure */
  int width, height;		/* dimension of each button (pixels) */
  int n_items;			/* number of buttons */
  mx_menu_item *item;		/* pointer to array of items */
  int first_item, last_item;	/* sub-range of items used */
  int inside;			/* flag indicating focus */
  int cur_x, cur_y;		/* cursor position in window */
  unsigned int value;		/* bitmap of button states */
} mx_button;

extern mx_popup_button(Display *display, int screen, mx_panel *panel,
		       unsigned int value, int *x, int *y);
/*****************************************************************************

    Copyright (C) 1994,1997 Ivan A. Curtis.  All rights reserved.

This code must not be re-distributed without these copyright notices intact.

*******************************************************************************
*******************************************************************************

Filename:	~icurtis/src/mx/filesel.c

Description:	

Update History:   (most recent first)
   I. Curtis   9-Apr-97 12:02 -- Updated
   I. Curtis  22-Mar-94 23:11 -- Created.

******************************************************************************/

extern char *mx_popup_filesel(Display *display, int screen,
			      mx_appearance *app,
			      int *x, int *y, int allP);