File: menu.h

package info (click to toggle)
searchandrescue 0.8.2-10
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 4,656 kB
  • ctags: 6,111
  • sloc: ansic: 89,072; cpp: 7,691; sh: 90; makefile: 80
file content (931 lines) | stat: -rw-r--r-- 23,923 bytes parent folder | download | duplicates (6)
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
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
/*
                            SAR Menus and Menu Objects
 */

#ifndef MENU_H
#define MENU_H

#include <sys/types.h>
#include "v3dtex.h"
#include "gw.h"
#include "image.h"


/*
 *	Flags:
 */
#define sar_menu_flags_t	unsigned long

/*
 *	Menu Types:
 */
typedef enum {
	SAR_MENU_TYPE_STANDARD
} sar_menu_type;

/*
 *	Object Types:
 */
typedef enum {
	SAR_MENU_OBJECT_TYPE_LABEL,
	SAR_MENU_OBJECT_TYPE_BUTTON,
	SAR_MENU_OBJECT_TYPE_PROGRESS,
        SAR_MENU_OBJECT_TYPE_MESSAGE_BOX,
        SAR_MENU_OBJECT_TYPE_LIST,
        SAR_MENU_OBJECT_TYPE_MDISPLAY,
        SAR_MENU_OBJECT_TYPE_SWITCH,
        SAR_MENU_OBJECT_TYPE_SPIN,
        SAR_MENU_OBJECT_TYPE_SLIDER,
        SAR_MENU_OBJECT_TYPE_MAP,
        SAR_MENU_OBJECT_TYPE_OBJVIEW
} sar_menu_object_type;
#define SAR_MENU_OBJECT_TYPE(p)	(((p) != NULL) ? \
 (*(sar_menu_object_type *)p) : -1)


/*
 *	Color:
 */
typedef struct {
	float	a, r, g, b;	/* 0.0 to 1.0 */
} sar_menu_color_struct;
#define SAR_MENU_COLOR(p)	((sar_menu_color_struct *)(p))


/*
 *	Label:
 *
 *	A plain label with an optional background image.
 */
typedef struct {

	sar_menu_object_type	type;	/* SAR_MENU_OBJECT_TYPE_LABEL */
	int	id;		/* Value used to identify this object */
	void	*client_data;	/* User data */

	float	x, y;		/* Position coefficient */
	int	offset_x,	/* Offset from center in pixels */
		offset_y;
	int	width,		/* Size in pixels */
		height;
	Boolean	sensitive;
	const sar_image_struct *image;	/* Shared bg image */

	GWFont	*font;
	sar_menu_color_struct	color;
	char	*label;
#define SAR_MENU_LABEL_ALIGN_CENTER	0
#define SAR_MENU_LABEL_ALIGN_LEFT	1
#define SAR_MENU_LABEL_ALIGN_RIGHT	2
	int	align;		/* One of SAR_MENU_LABEL_ALIGN_* */

} sar_menu_label_struct;
#define SAR_MENU_LABEL(p)	((sar_menu_label_struct *)(p))
#define SAR_MENU_IS_LABEL(p)	(SAR_MENU_OBJECT_TYPE(p) == SAR_MENU_OBJECT_TYPE_LABEL)

/*
 *	Button:
 *
 *	Push button with label, the label is to the right of the button.
 *	Both the button and label are of fixed width.
 */
typedef struct {

	sar_menu_object_type	type;	/* SAR_MENU_OBJECT_TYPE_BUTTON */
	int	id;		/* Value used to identify this object */
	void	*client_data;	/* User data */

	float	x, y;		/* Position coefficient */
	int	offset_x,	/* Offset from center in pixels */
		offset_y;
	int	width,		/* Size in pixels */
		height;
	Boolean	sensitive;

#define SAR_MENU_BUTTON_STATE_UNARMED		0
#define SAR_MENU_BUTTON_STATE_ARMED		1
#define SAR_MENU_BUTTON_STATE_HIGHLIGHTED	2
	int	state;		/* One of SAR_MENU_BUTTON_STATE_* */
	const sar_image_struct	*unarmed_image,		/* Shared images */
				*armed_image,
				*highlighted_image;

	GWFont	*font;
	sar_menu_color_struct	color;
	char	*label;		/* Button label */

	void	(*func_cb)(
		void *,		/* This Object */
		int,		/* ID Code */
		void *		/* Data */
	);

} sar_menu_button_struct;
#define SAR_MENU_BUTTON(p)	((sar_menu_button_struct *)(p))
#define SAR_MENU_IS_BUTTON(p)	(SAR_MENU_OBJECT_TYPE(p) == SAR_MENU_OBJECT_TYPE_BUTTON)

/*
 *	Progress Bar:
 *
 *	A left to right progress bar, the width and height can be -1 to
 *	indicate the entire width of the window and a default height
 *	(respectively).
 */
typedef struct {

	sar_menu_object_type	type;	/* SAR_MENU_OBJECT_TYPE_PROGRESS */
	int	id;		/* Value used to identify this object */
	void	*client_data;	/* User data */

	float	x, y;		/* Position coefficient */
	int	width,		/* Size in pixels */
		height;
	Boolean	sensitive;

	const sar_image_struct	*bg_image,	/* Shared images */
				*fg_image;

	GWFont	*font;
	sar_menu_color_struct	color;
	char	*label;

	float	progress;	/* 0.0 to 1.0 */

} sar_menu_progress_struct;
#define SAR_MENU_PROGRESS(p)	((sar_menu_progress_struct *)(p))
#define SAR_MENU_IS_PROGRESS(p)	(SAR_MENU_OBJECT_TYPE(p) == SAR_MENU_OBJECT_TYPE_PROGRESS)

/*
 *	Message Box:
 *
 *	A message box displaying several lines of text and capable of
 *	scrolling.  Uses XML-like tags for font color and style.
 */
typedef struct {

	sar_menu_object_type	type;	/* SAR_MENU_OBJECT_TYPE_MESSAGE_BOX */
	int	id;		/* Value used to identify this object */
	void	*client_data;	/* User data */

	float	x, y;		/* Position coefficient */
	float	width,		/* Size coefficient */
		height;
	Boolean	sensitive;

	GWFont	*font;
	sar_menu_color_struct	color,		/* Foreground */
				bg_color,	/* Background */
				bold_color,
				underline_color;

#define MENU_MESSAGE_BOX_BG_TOTAL_IMAGES	9
	const sar_image_struct	**bg_image;	/* Pointer to array of 9 shared images */

	int	scrolled_line;
	char	*message;

} sar_menu_message_box_struct;
#define SAR_MENU_MESSAGE_BOX(p)	((sar_menu_message_box_struct *)(p))
#define SAR_MENU_IS_MESSAGE_BOX(p)	(SAR_MENU_OBJECT_TYPE(p) == SAR_MENU_OBJECT_TYPE_MESSAGE_BOX)

/*
 *	List Item:
 */
typedef struct {

	sar_menu_flags_t	flags;
	char	*name;
	void	*client_data;	/* User data */

} sar_menu_list_item_struct;
#define SAR_MENU_LIST_ITEM(p)	((sar_menu_list_item_struct *)(p))

/*
 *	List:
 *
 *	A list displaying items and capable of scrolling.
 */
typedef struct {

	sar_menu_object_type	type;	/* SAR_MENU_OBJECT_TYPE_LIST */
	int	id;		/* Value used to identify this object */
	void	*client_data;	/* User data */

	float	x, y;		/* Position coefficient */
	float	width,		/* Size coefficient */
		height;
	Boolean	sensitive;

#define MENU_LIST_BG_TOTAL_IMAGES	9
	const sar_image_struct	**bg_image;	/* Pointer to array of 9 shared images */

	GWFont	*font;
	sar_menu_color_struct	color;
	char	*label;

	sar_menu_list_item_struct	**item;
	int	total_items,
		items_visable,	/* Number of items visible */
		scrolled_item,	/* First visible item */
		selected_item;	/* Selected item */

	void	(*select_cb)(
		void *,		/* This Object */
		int,		/* ID Code */
		void *,		/* Data */
		int,		/* Item Number */
		void *,		/* Item Pointer */
		void *		/* Item Data */
	);

	void	(*activate_cb)(
		void *,		/* This Object */
		int,		/* ID Code */
		void *,		/* Data */
		int,		/* Item Number */
		void *,		/* Item Pointer */
		void *		/* Item Data */
	);

} sar_menu_list_struct;
#define SAR_MENU_LIST(p)	((sar_menu_list_struct *)(p))
#define SAR_MENU_IS_LIST(p)	(SAR_MENU_OBJECT_TYPE(p) == SAR_MENU_OBJECT_TYPE_LIST)

/*
 *	Multi-Purpose DIsplay:
 *
 *	This is basically a drawing area that allows you to draw
 *	anything you want on to it when the draw_cb() is called.
 */
typedef struct {

	sar_menu_object_type	type;	/* SAR_MENU_OBJECT_TYPE_MDISPLAY */
	int	id;		/* Value used to identify this object */
	void	*client_data;	/* User data */

	float	x, y;		/* Position coefficient */
	float	width,		/* Size coefficient */
		height;
	Boolean	sensitive;

#define MENU_MDISPLAY_BG_TOTAL_IMAGES	9
	const sar_image_struct	**bg_image;	/* Pointer to array of 9 shared images */

	void	(*draw_cb)(
		void *,		/* Display */
		void *,		/* Menu */
		void *,		/* This Object */
		int,		/* ID Code */
		void *,		/* Data */
		int, int, int, int	/* x_min, y_min, x_max, y_max */
	);

} sar_menu_mdisplay_struct;
#define SAR_MENU_MDISPLAY(p)	((sar_menu_mdisplay_struct *)(p))
#define SAR_MENU_IS_MDISPLAY(p)	(SAR_MENU_OBJECT_TYPE(p) == SAR_MENU_OBJECT_TYPE_MDISPLAY)

/*
 *	Switch:
 *
 *	A toggle switch that holds a boolean value.
 */
typedef struct {

	sar_menu_object_type	type;	/* SAR_MENU_OBJECT_TYPE_SWITCH */
	int	id;		/* Value used to identify this object */
	void	*client_data;	/* User data */

	float	x, y;		/* Position coefficient */
	int	width,		/* Size coefficient */
		height;
	Boolean	sensitive;

	const sar_image_struct	*bg_image,		/* Shared images */
				*switch_off_image,
				*switch_on_image;

	GWFont	*font;
	sar_menu_color_struct	color;
	char	*label;

	Boolean state;

	void	(*switch_cb)(
		void *,		/* This Object */
		int,		/* ID Code */
		void *,		/* Data */
		Boolean		/* Value */
	);

} sar_menu_switch_struct;
#define SAR_MENU_SWITCH(p)	((sar_menu_switch_struct *)(p))
#define SAR_MENU_IS_SWITCH(p)	(SAR_MENU_OBJECT_TYPE(p) == SAR_MENU_OBJECT_TYPE_SWITCH) 

/*
 *	Spin:
 *
 *	A box with an array of values that can be selected by
 *	"spinning".
 */
typedef struct {

	sar_menu_object_type	type;	/* SAR_MENU_OBJECT_TYPE_SPIN */
	int	id;		/* Value used to identify this object */
	void	*client_data;	/* User data */

	float	x, y;		/* Position coefficient */
	float	width,		/* Size coefficient */
		height;
	Boolean	sensitive;

	const sar_image_struct	*label_image,	/* Shared images */
				*value_image,
				*dec_armed_image,
				*dec_unarmed_image,
				*inc_armed_image,
				*inc_unarmed_image;

	GWFont	*font,		/* Label font */
		*value_font;	/* Value font */
	sar_menu_color_struct	label_color,
				value_color;

	int	dec_state,	/* One of SAR_MENU_BUTTON_STATE_* */
		inc_state;

	char	*label;

#define SAR_MENU_SPIN_TYPE_STRING	0
#define SAR_MENU_SPIN_TYPE_NUMERIC	1
	int	value_type;	/* One of SAR_MENU_SPIN_TYPE_* */

	Boolean	allow_warp;	/* Allow end to beginning cycle warping */

	float	step;	/* Increment step (for SAR_MENU_SPIN_TYPE_NUMERIC) */


	/* List of values, if the value_type is set to
	 * SAR_MENU_SPIN_TYPE_NUMERIC then there will only be one value.
	 * However if value_type is set to SAR_MENU_SPIN_TYPE_STRING then
	 * there may be one or more values in this list.
	 */
	char	**value;
	int	total_values,
		cur_value;

	void	(*change_cb)(
		void *,		/* This Object */
		int,		/* ID Code */
		void *,		/* Data */
		char *		/* Value */
	);

} sar_menu_spin_struct;
#define SAR_MENU_SPIN(p)	((sar_menu_spin_struct *)(p))
#define SAR_MENU_IS_SPIN(p)	(SAR_MENU_OBJECT_TYPE(p) == SAR_MENU_OBJECT_TYPE_SPIN)

/*
 *	Slider:
 *
 *	A "slideable" scale that can hold a gradient value.
 */
typedef struct {

	sar_menu_object_type	type;	/* SAR_MENU_OBJECT_TYPE_SLIDER */
	int	id;		/* Value used to identify this object */
	void	*client_data;	/* User data */

	float	x, y;		/* Position coefficient */
	float	width,		/* Size coefficient */
		height;
	Boolean	sensitive;

	const sar_image_struct	*label_image,	/* Shared images */
				*trough_image,
				*handle_image;

	GWFont	*font;
	sar_menu_color_struct	label_color;

	char	*label;

	float	value,		/* Current value */
		lower,		/* Lowest value */
		upper;		/* Highest value */

	int	drag_button;	/* Pointer button that is currently
				 * dragging or 0 for none
				 */

	void	(*change_cb)(
		void *,		/* This Object */
		int,		/* ID Code */
		void *,		/* Data */
		float		/* Value */
	);

} sar_menu_slider_struct;
#define SAR_MENU_SLIDER(p)	((sar_menu_slider_struct *)(p))
#define SAR_MENU_IS_SLIDER(p)	(SAR_MENU_OBJECT_TYPE(p) == SAR_MENU_OBJECT_TYPE_SLIDER)


/*
 *	Map Marking Types:
 */
typedef enum {
	SAR_MENU_MAP_MARKING_TYPE_ICON,
	SAR_MENU_MAP_MARKING_TYPE_INTERCEPT_LINE
} sar_menu_map_marking_type;

/*
 *	Map Marking:
 */
typedef struct {

	sar_menu_map_marking_type	type;
	sar_menu_color_struct	fg_color;
	float	x, y;		/* In meters */
	float	x_end, y_end;	/* In meters (for intercept line) */

	const sar_image_struct	*icon;	/* Shared icon image */
	char	*desc;		/* Description (preferably short one-liner) */

} sar_menu_map_marking_struct;
#define SAR_MENU_MAP_MARKING(p)	((sar_menu_map_marking_struct *)(p))

/*
 *	Map:
 */
typedef struct {

	sar_menu_object_type	type;	/* SAR_MENU_OBJECT_TYPE_MAP */
	int	id;		/* Value used to identify this object */
	void	*client_data;	/* User data */

	float	x, y;		/* Position coefficient */
	float	width,		/* Size coefficient */
		height;
	Boolean	sensitive;

	GWFont	*font;
	sar_menu_color_struct	color;

	const sar_image_struct	**bg_image;	/* Pointer to array of 9 shared images */

	char	*title;

	int	scroll_x,	/* Scroll position, upper left corner, in pixels */
		scroll_y;

	float	m_to_pixels_coeff;	/* Meters to pixels coefficient */ 

	v3d_texture_ref_struct	*bg_tex;	/* Background texture */
	float	bg_tex_width,	/* Intended size of texture in meters */
		bg_tex_height;


#define SAR_MENU_MAP_SHOW_MARKING_ALL		0	/* Show all markings */
#define SAR_MENU_MAP_SHOW_MARKING_SELECTED	1	/* Show only selected marking */
	int	show_markings_policy;	/* One of SAR_MENU_MAP_SHOW_MARKING_* */

	sar_menu_map_marking_struct	**marking;
	int	total_markings;

	/* Marking that pointer is over, show desc of this marking.
	 * Can be -1 for none
	 */
	int	selected_marking;

} sar_menu_map_struct;
#define SAR_MENU_MAP(p)		((sar_menu_map_struct *)(p))
#define SAR_MENU_IS_MAP(p)	(SAR_MENU_OBJECT_TYPE(p) == SAR_MENU_OBJECT_TYPE_MAP)


/*
 *	Object Viewer:
 *
 *	Displays an OpenGL object in 3D and allows interactive rotate
 *	and zoom.
 */
typedef struct {

	sar_menu_object_type	type;	/* SAR_MENU_OBJECT_TYPE_OBJVIEW */
	int	id;		/* Value used to identify this object */
	void	*client_data;	/* User data */

	float	x, y;		/* Position coefficient */
	float	width,		/* Size coefficient */
		height;
	Boolean	sensitive;

	GWFont	*font;
	sar_menu_color_struct	color,		/* Foreground */
				bg_color,	/* Background */
				bold_color,
				underline_color;

#define MENU_OBJVIEW_BG_TOTAL_IMAGES	9
	const sar_image_struct	**bg_image;	/* Pointer to array of 9 shared images */

	/* Pointer drag info */
	Boolean	rotate_drag_state,
		bank_drag_state;
	int	prev_motion_x, prev_motion_y;
	time_t	last_motion_time;

	/* Render options */
	Boolean	render_lighting,
		render_antialias;

	char	*title;
	char	*message;
	Boolean	show_message;

	void	*obj_list;	/* GL list of the 3d object */
	void	*obj_glres;	/* libv3d GL resources for the 3d
				 * object (v3d_glresource_struct *).
				 */

	float	camera_distance;	/* Camera distance from object in meters */
	float	obj_size_radius;	/* Size of object's radius in meters */

	/* Rotation of object in radians */
	float	obj_heading,
		obj_pitch,
		obj_bank;

	/* Position of light in radians */
	float	light_heading,
		light_pitch,
		light_bank;

	/* Last drawn gl image pixels of the 3d object, we buffer it
	 * instead of drawing the list each time. So we draw this image
	 * (which has transparent pixels) to speed things up. The format
	 * is GL_RGBA and the data type is GL_UNSIGNED_BYTE (so 4 bytes
	 * per pixel)
	 */
	void	*objimg;
	int	objimg_width,
		objimg_height;

} sar_menu_objview_struct;
#define SAR_MENU_OBJVIEW(p)	((sar_menu_objview_struct *)(p))
#define SAR_MENU_IS_OBJVIEW(p)	(SAR_MENU_OBJECT_TYPE(p) == SAR_MENU_OBJECT_TYPE_OBJVIEW) 

/*
 *	Menu:
 */
typedef struct {

	sar_menu_type	type;
	char	*name;		/* Name of this menu (for matching) */

	Boolean	always_full_redraw;	/* Always perform complete menu
					 * redraws even if only a part of
					 * the menu has changed (for some
					 * fixing problems on some of the
					 * accelerated video cards
					 */                       

	char	*bg_image_path;	/* Path to background image file */
	sar_image_struct	*bg_image;	/* Background image (not shared) */

	/* List of menu objects */
	void	**object;
	int	total_objects,
		selected_object;

} sar_menu_struct;
#define SAR_MENU(p)		((sar_menu_struct *)(p))


/* In menu.c */
/* Utility functions */
extern void SARMenuGLStateReset(gw_display_struct *display);
extern void *SARMenuGetObject(sar_menu_struct *m, int n);
extern void *SARMenuGetObjectByID(sar_menu_struct *m, int id, int *n);
extern Boolean SARMenuObjectIsSensitive(sar_menu_struct *m, int n);

/* Menu functions */
extern sar_menu_struct *SARMenuNew(
	sar_menu_type type, const char *name, const char *bg_image
);
extern void SARMenuLoadBackgroundImage(sar_menu_struct *m);
extern void SARMenuUnloadBackgroundImage(sar_menu_struct *m);
extern void SARMenuDelete(sar_menu_struct *m);

/* Label */
extern int SARMenuLabelNew(
	sar_menu_struct *m,
	float x, float y,
	int width, int height,
	const char *label,
	sar_menu_color_struct *fg_color, GWFont *font,
	const sar_image_struct *image
);

/* Button */
extern int SARMenuButtonNew(
	sar_menu_struct *m,
	float x, float y,
	int width, int height,
	const char *label,
	sar_menu_color_struct *fg_color,
	GWFont *font,
	const sar_image_struct *unarmed_image,
	const sar_image_struct *armed_image,
	const sar_image_struct *highlighted_image,
	void *client_data, int id,
	void (*func_cb)(void *, int, void *)
);

/* Progress Bar */
extern int SARMenuProgressNew(
	sar_menu_struct *m,
	float x, float y,
	int width, int height,
	const char *label,
	sar_menu_color_struct *fg_color,
	GWFont *font,
	const sar_image_struct *bg_image,
	const sar_image_struct *fg_image,
	float progress
);
extern void SARMenuProgressSet(
	gw_display_struct *display, sar_menu_struct *m, int n,
	float progress, Boolean redraw
);

/* Message Box */
extern int SARMenuMessageBoxNew(
	sar_menu_struct *m,
	float x, float y,
	float width, float height,
	sar_menu_color_struct *fg_color, GWFont *font,
	const sar_image_struct **bg_image,	/* Pointer to 9 images */
	void *client_data, int id,
	const char *message
);
extern void SARMenuMessageBoxSet(
	gw_display_struct *display, sar_menu_struct *m, int n,
	const char *message, Boolean redraw
);

/* List */
extern int SARMenuListNew(
	sar_menu_struct *m,
	float x, float y,
	float width, float height,
	sar_menu_color_struct *fg_color, GWFont *font,
	const char *label,
	const sar_image_struct **bg_image,
	void *client_data, int id,
	void (*select_cb)(void *, int, void *, int, void *, void *),
	void (*activate_cb)(void *, int, void *, int, void *, void *)
);
extern int SARMenuListAppendItem(
	sar_menu_struct *m, int n,
	const char *name,
	void *client_data,
	sar_menu_flags_t flags
);
extern sar_menu_list_item_struct *SARMenuListGetItemByNumber(
	sar_menu_list_struct *list, int i
);
extern void SARMenuListSelect(
	gw_display_struct *display, sar_menu_struct *m, int n,
	int i,
	Boolean scroll, Boolean redraw
);
extern void SARMenuListDeleteAllItems(
	sar_menu_struct *m,
	int n			/* List object number on m */
);

/* Multi-purpose Display */
extern int SARMenuMDisplayNew(
	sar_menu_struct *m,
	float x, float y,
	float width, float height,
	const sar_image_struct **bg_image,	/* Pointer to 9 images */
	void *client_data, int id,
	void (*draw_cb)(
		void *,         /* Display */
		void *,         /* Menu */
		void *,         /* This Object */
		int,            /* ID Code */
		void *,         /* Data */
		int, int, int, int      /* x_min, y_min, x_max, y_max */
	)
);
extern void SARMenuMDisplayDraw(
	gw_display_struct *display, sar_menu_struct *m, int n
);

/* Switch */
extern int SARMenuSwitchNew(
	sar_menu_struct *m,
	float x, float y,
	int width, int height,   
	sar_menu_color_struct *fg_color, GWFont *font,
	const char *label,
	const sar_image_struct *bg_image,
	const sar_image_struct *switch_off_image,
	const sar_image_struct *switch_on_image,
	Boolean state,
	void *client_data, int id,
	void (*switch_cb)(void *, int, void *, Boolean)
);
extern Boolean SARMenuSwitchGetValue(sar_menu_struct *m, int n);
extern void SARMenuSwitchSetValue(
	gw_display_struct *display, sar_menu_struct *m, int n,
	Boolean state, Boolean redraw
);

/* Spin */
extern int SARMenuSpinNew(
	sar_menu_struct *m,
	float x, float y,
	float width, float height,
	sar_menu_color_struct *label_color,
	sar_menu_color_struct *value_color,
	GWFont *font, GWFont *value_font,
	const char *label,
	const sar_image_struct *label_image,
	const sar_image_struct *value_image,
	const sar_image_struct *dec_armed_image,
	const sar_image_struct *dec_unarmed_image,
	const sar_image_struct *inc_armed_image,
	const sar_image_struct *inc_unarmed_image,
	void *client_data, int id,
	void (*change_cb)(void *, int, void *, char *)
);
extern void SARMenuSpinSetValueType(
	sar_menu_struct *m, int n, int type
);
extern int SARMenuSpinAddValue(
	sar_menu_struct *m, int n, const char *value
);
extern char *SARMenuSpinGetCurrentValue(
	sar_menu_struct *m, int n, int *sel_num
);
extern void SARMenuSpinSelectValueIndex(
	gw_display_struct *display, sar_menu_struct *m, int n,
	int value_num,
	Boolean redraw
);
extern void SARMenuSpinSetValueIndex(
	gw_display_struct *display, sar_menu_struct *m, int n,
	int value_num, const char *value,
	Boolean redraw
);
extern void SARMenuSpinDeleteAllValues(sar_menu_struct *m, int n);
extern void SARMenuSpinDoInc(
	gw_display_struct *display, sar_menu_struct *m, int n,
	Boolean redraw
);
extern void SARMenuSpinDoInc(
	gw_display_struct *display, sar_menu_struct *m, int n,
	Boolean redraw
);

/* Slider */
extern int SARMenuSliderNew(
	sar_menu_struct *m,
	float x, float y,
	float width, float height,
	sar_menu_color_struct *label_color,
	GWFont *font,
	const char *label,
	const sar_image_struct *label_image,
	const sar_image_struct *trough_image,
	const sar_image_struct *handle_image,
	void *client_data, int id,
	void (*change_cb)(void *, int, void *, float)
);
extern void SARMenuSliderSetValueBounds(
	gw_display_struct *display, sar_menu_struct *m, int n,
	float lower, float upper,
	Boolean redraw
);
extern void SARMenuSliderSetValue(
	gw_display_struct *display, sar_menu_struct *m, int n,
	float value,
	Boolean redraw
);
extern float SARMenuSliderGetValue(sar_menu_struct *m, int n);

/* Common object functions */
extern void SARMenuObjectSetSensitive(
	gw_display_struct *display, sar_menu_struct *m, int n,
	Boolean sensitive, Boolean redraw
);
extern void SARMenuObjectDelete(sar_menu_struct *m, int n);

/* Drawing */
extern void SARMenuDrawWindowBG(
	gw_display_struct *display,
	const sar_image_struct **bg_image,		/* Total 9 images */
	const sar_menu_color_struct *base_color,	/* Set NULL to use image as base */
	int x, int y,
	int width, int height,
	Boolean draw_base,
	Boolean draw_shadow,
	Boolean is_selected
);
extern void SARMenuDrawObject(
	gw_display_struct *display,
	sar_menu_struct *m,
	int n
);
extern void SARMenuDrawAll(
	gw_display_struct *display,
	sar_menu_struct *m
);
extern int SARMenuManagePointer(
	gw_display_struct *display, sar_menu_struct *m,
	int x, int y, gw_event_type type, int btn_num
);
extern int SARMenuManageKey(
	gw_display_struct *display,
	sar_menu_struct *m,   
	int key, Boolean state
);


/* In menumap.c */
extern sar_menu_map_marking_struct *SARMenuMapGetMarkingPtr(
	sar_menu_map_struct *map, int i
);
extern int SARMenuMapNew(
	sar_menu_struct *m,
	float x, float y,
	float width, float height,
	GWFont *font,
	sar_menu_color_struct *color,
	const sar_image_struct **bg_image,	/* Total 9 images */
	float scroll_x, float scroll_y,	/* In meters */
	float m_to_pixels_coeff,	/* Meters to pixels coeff */
	int show_markings_policy
);
extern int SARMenuMapAppendMarking(
	sar_menu_map_struct *map,
	int type,			/* One of SAR_MENU_MAP_MARKING_TYPE_* */
	const sar_menu_color_struct *fg_color,
	float x, float y,		/* In meters */
	float x_end, float y_end,	/* In meters (for intercept line) */
	const sar_image_struct *icon,	/* Shared icon image */
	const char *desc
);
extern void SARMenuMapDeleteAllMarkings(sar_menu_map_struct *map);
extern void SARMenuMapMarkingSelectNext(
	sar_menu_map_struct *map, Boolean allow_warp
);
extern void SARMenuMapMarkingSelectPrev(
	sar_menu_map_struct *map, Boolean allow_warp
);
extern void SARMenuMapDraw(
	gw_display_struct *display,
	sar_menu_struct *m,
	sar_menu_map_struct *map,
	int map_num
);
extern int SARMenuMapManagePointer(
	gw_display_struct *display, sar_menu_struct *m,
	sar_menu_map_struct *map, int menu_obj_num,
	int x, int y, gw_event_type type, int btn_num
);

/* In menuobjview.c */
extern int SARMenuObjViewNew(
	sar_menu_struct *m,
	float x, float y,
	float width, float height,
	GWFont *font,
	sar_menu_color_struct *color,
	const sar_image_struct **bg_image,	/* Pointer to 9 images */
	const char *title
);
extern int SARMenuObjViewManagePointer(
	gw_display_struct *display, sar_menu_struct *m,
	sar_menu_objview_struct *ov_ptr, int ov_num,
	int x, int y, gw_event_type type, int btn_num
);
extern int SARMenuObjViewManageKey(
	gw_display_struct *display, sar_menu_struct *m,
	sar_menu_objview_struct *ov_ptr, int ov_num,
	int key, Boolean state
);
extern int SARMenuObjViewLoad(
	gw_display_struct *display, sar_menu_struct *m,
	sar_menu_objview_struct *ov_ptr, int ov_num,
	const char *filename
);
extern void SARMenuObjViewRebufferImage(
	gw_display_struct *display, sar_menu_struct *m,
	sar_menu_objview_struct *ov_ptr, int ov_num
);


#endif	/* MENU_H */